Ignore:
Timestamp:
Jun 1, 2010, 6:36:22 PM (14 years ago)
Author:
garnier
Message:

update from CVS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/visualization/management/src/G4VisCommandsSceneAdd.cc

    r1258 r1288  
    2525//
    2626//
    27 // $Id: G4VisCommandsSceneAdd.cc,v 1.79 2010/05/11 10:58:49 allison Exp $
     27// $Id: G4VisCommandsSceneAdd.cc,v 1.81 2010/06/01 16:08:15 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929// /vis/scene commands - John Allison  9th August 1998
     
    3737#include "G4ModelingParameters.hh"
    3838#include "G4HitsModel.hh"
     39#include "G4DigiModel.hh"
    3940#include "G4PSHitsModel.hh"
    4041#include "G4TrajectoriesModel.hh"
     
    157158}
    158159
     160
     161////////////// /vis/scene/add/digis ///////////////////////////////////////
     162
     163G4VisCommandSceneAddDigis::G4VisCommandSceneAddDigis () {
     164  fpCommand = new G4UIcmdWithoutParameter ("/vis/scene/add/digitisations", this);
     165  fpCommand -> SetGuidance ("Adds digis to current scene.");
     166  fpCommand -> SetGuidance
     167    ("Digis are drawn at end of event when the scene in which"
     168     "\nthey are added is current.");
     169
     170  fpCommandUS = new G4UIcmdWithoutParameter ("/vis/scene/add/digitizations", this);
     171  fpCommandUS -> SetGuidance ("Adds digis to current scene.");
     172  fpCommandUS -> SetGuidance
     173    ("Digis are drawn at end of event when the scene in which"
     174     "\nthey are added is current.");
     175}
     176
     177G4VisCommandSceneAddDigis::~G4VisCommandSceneAddDigis () {
     178  delete fpCommandUS;
     179  delete fpCommand;
     180}
     181
     182G4String G4VisCommandSceneAddDigis::GetCurrentValue (G4UIcommand*) {
     183  return "";
     184}
     185
     186void G4VisCommandSceneAddDigis::SetNewValue (G4UIcommand*, G4String) {
     187
     188  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
     189  G4bool warn(verbosity >= G4VisManager::warnings);
     190
     191  G4Scene* pScene = fpVisManager->GetCurrentScene();
     192  if (!pScene) {
     193    if (verbosity >= G4VisManager::errors) {
     194      G4cout << "ERROR: No current scene.  Please create one." << G4endl;
     195    }
     196    return;
     197  }
     198
     199  G4DigiModel* model = new G4DigiModel;
     200  const G4String& currentSceneName = pScene -> GetName ();
     201  G4bool successful = pScene -> AddEndOfEventModel (model, warn);
     202  if (successful) {
     203    if (verbosity >= G4VisManager::confirmations) {
     204      G4cout << "Digis will be drawn in scene \""
     205             << currentSceneName << "\"."
     206             << G4endl;
     207    }
     208  }
     209  else G4VisCommandsSceneAddUnsuccessful(verbosity);
     210  UpdateVisManagerScene (currentSceneName);
     211}
    159212
    160213////////////// /vis/scene/add/eventID ///////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.