Ignore:
Timestamp:
Nov 3, 2009, 11:17:28 AM (15 years ago)
Author:
garnier
Message:

update to CVS

Location:
trunk/source/visualization/management/src
Files:
3 edited

Legend:

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

    r1136 r1140  
    2525//
    2626//
    27 // $Id: G4VSceneHandler.cc,v 1.83 2008/01/04 22:03:46 allison Exp $
     27// $Id: G4VSceneHandler.cc,v 1.86 2009/10/23 07:58:36 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    262262
    263263void G4VSceneHandler::AddCompound (const G4VHit& hit) {
    264   ((G4VHit&)hit).Draw(); // Cast to non-const because Draw is non-const!!!!
     264  static_cast<G4VHit>(hit).Draw(); // Cast because Draw is non-const!!!!
     265}
     266
     267void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) {
     268  // Cast because DrawAllHits is non-const!!!!
     269  static_cast<G4THitsMap<G4double> >(hits).DrawAllHits();
    265270}
    266271
     
    583588  printf("G4VSceneHandler::ProcessScene : Idle ?\n");
    584589#endif
    585   // Refresh event from end-of-event model list.  Allow only in Idle state...
     590  // Refresh event from end-of-event model list.
     591  // Allow only in Idle or GeomClosed state...
    586592  G4StateManager* stateManager = G4StateManager::GetStateManager();
    587593  G4ApplicationState state = stateManager->GetCurrentState();
    588   if (state == G4State_Idle) {
     594  if (state == G4State_Idle || state == G4State_GeomClosed) {
    589595#ifdef G4DEBUG_VIS_MANAGEMENT
    590596    printf("G4VSceneHandler::ProcessScene : IDLE\n");
  • trunk/source/visualization/management/src/G4VisCommandsSceneAdd.cc

    r1136 r1140  
    2525//
    2626//
    27 // $Id: G4VisCommandsSceneAdd.cc,v 1.74 2009/07/24 09:20:52 lgarnier Exp $
     27// $Id: G4VisCommandsSceneAdd.cc,v 1.76 2009/10/30 15:58:50 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 "G4PSHitsModel.hh"
    3940#include "G4TrajectoriesModel.hh"
    4041#include "G4ScaleModel.hh"
     
    229230  const G4Run* currentRun = 0;
    230231  G4RunManager* runManager = G4RunManager::GetRunManager();
    231   if (runManager)  currentRun = runManager->GetCurrentRun();
     232  if (runManager) currentRun = runManager->GetCurrentRun();
    232233
    233234  G4VModel* model = fpVisManager->GetCurrentSceneHandler()->GetModel();
    234   const G4ModelingParameters* mp;
    235   const G4Event* currentEvent;
     235  const G4ModelingParameters* mp = 0;
     236  const G4Event* currentEvent = 0;
    236237  if (model) {
    237238   mp = model->GetModelingParameters();
     
    240241    G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
    241242    if (verbosity >= G4VisManager::errors) {
    242       G4cout << "ERROR: No model defined for this SceneHandler : "<< fpVisManager->GetCurrentSceneHandler()->GetName() << G4endl;
     243      G4cout << "ERROR: No model defined for this SceneHandler : "
     244             << fpVisManager->GetCurrentSceneHandler()->GetName()
     245             << G4endl;
    243246    }
    244247  }
     
    890893  sceneHandler.AddPrimitive(*fp4);
    891894  sceneHandler.EndPrimitives();
     895}
     896
     897////////////// /vis/scene/add/psHits ///////////////////////////////////////
     898
     899G4VisCommandSceneAddPSHits::G4VisCommandSceneAddPSHits () {
     900  fpCommand = new G4UIcmdWithoutParameter ("/vis/scene/add/psHits", this);
     901  fpCommand -> SetGuidance
     902    ("Adds Primitive Scorer Hits (PSHits) to current scene.");
     903  fpCommand -> SetGuidance
     904    ("PSHits are drawn at end of run when the scene in which"
     905     "\nthey are added is current.");
     906}
     907
     908G4VisCommandSceneAddPSHits::~G4VisCommandSceneAddPSHits () {
     909  delete fpCommand;
     910}
     911
     912G4String G4VisCommandSceneAddPSHits::GetCurrentValue (G4UIcommand*) {
     913  return "";
     914}
     915
     916void G4VisCommandSceneAddPSHits::SetNewValue (G4UIcommand*, G4String) {
     917
     918  G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
     919  G4bool warn(verbosity >= G4VisManager::warnings);
     920
     921  G4Scene* pScene = fpVisManager->GetCurrentScene();
     922  if (!pScene) {
     923    if (verbosity >= G4VisManager::errors) {
     924      G4cout << "ERROR: No current scene.  Please create one." << G4endl;
     925    }
     926    return;
     927  }
     928
     929  G4PSHitsModel* model = new G4PSHitsModel;
     930  const G4String& currentSceneName = pScene -> GetName ();
     931  G4bool successful = pScene -> AddEndOfEventModel (model, warn);
     932  if (successful) {
     933    if (verbosity >= G4VisManager::confirmations) {
     934      G4cout << "Primitive Scorer hits will be drawn in scene \""
     935             << currentSceneName << "\"."
     936             << G4endl;
     937    }
     938  }
     939  else G4VisCommandsSceneAddUnsuccessful(verbosity);
     940  UpdateVisManagerScene (currentSceneName);
    892941}
    893942
  • trunk/source/visualization/management/src/G4VisManager.cc

    r1136 r1140  
    2424// ********************************************************************
    2525//
    26 // $Id: G4VisManager.cc,v 1.118 2009/03/09 12:42:00 allison Exp $
     26// $Id: G4VisManager.cc,v 1.121 2009/10/30 16:03:41 allison Exp $
    2727// GEANT4 tag $Name:  $
    2828//
     
    656656        G4cout << "ERROR in G4VisManager::CreateSceneHandler during "
    657657               << fpGraphicsSystem -> GetName ()
    658                << " scene creation.\n  No action taken."
     658               << " scene handler creation.\n  No action taken."
    659659               << G4endl;
    660660      }
     
    669669  if (!fInitialised) Initialise ();
    670670
    671   if (fpSceneHandler) {
    672     printf("G4VisManager::CreateViewer 1-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
    673     G4VViewer* p = fpGraphicsSystem -> CreateViewer (*fpSceneHandler, name);
    674     printf("G4VisManager::CreateViewer 2-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
    675 
    676     // Viewer is created, now we can set geometry parameters
    677     // Before 12/2008, it was done in G4VViewer.cc but it did not have to be there!
     671  if (!fpSceneHandler) {
     672    PrintInvalidPointers ();
     673    return;
     674  }
     675
     676  printf("G4VisManager::CreateViewer 1-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
     677  G4VViewer* p = fpGraphicsSystem -> CreateViewer (*fpSceneHandler, name);
     678  printf("G4VisManager::CreateViewer 2-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
     679
     680  if (!p) {
     681    if (fVerbosity >= errors) {
     682      G4cout << "ERROR in G4VisManager::CreateViewer during "
     683             << fpGraphicsSystem -> GetName ()
     684             << " viewer creation.\n  No action taken."
     685             << G4endl;
     686    }
     687    return;
     688  }
     689
     690  if (p -> GetViewId() < 0) {
     691    if (fVerbosity >= errors) {
     692      G4cout << "ERROR in G4VisManager::CreateViewer during "
     693             << fpGraphicsSystem -> GetName ()
     694             << " viewer initialisation.\n  No action taken."
     695             << G4endl;
     696    }
     697    return;
     698  }
     699
     700  // Viewer is created, now we can set geometry parameters
     701  // Before 12/2008, it was done in G4VViewer.cc but it did not have to be there!
    678702   
    679     //    printf("G4VisManager::CreateViewer 3-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
    680     G4ViewParameters vp = p->GetViewParameters();
    681     //    printf("G4VisManager::CreateViewer 4-------------------- %s ----%s\n",name.c_str(),XGeometry.c_str());
    682     vp.SetXGeometryString(XGeometry);
    683     p->SetViewParameters(vp); //parse string and store parameters
    684 
    685     if (!p) {
    686       if (fVerbosity >= errors) {
    687         G4cout << "ERROR in G4VisManager::CreateViewer during "
    688                << fpGraphicsSystem -> GetName ()
    689                << " viewer creation.\n  No action taken."
    690                << G4endl;
    691       }
    692     } else {
    693       p -> Initialise ();
    694       if (p -> GetViewId() < 0) {
    695         if (fVerbosity >= errors) {
    696         G4cout << "ERROR in G4VisManager::CreateViewer during "
    697                << fpGraphicsSystem -> GetName ()
    698                << " viewer initialisation.\n  No action taken."
    699                << G4endl;
    700         }
    701       } else {
    702         fpViewer = p;                             // Make current.
    703         fpSceneHandler -> AddViewerToList (fpViewer);
    704         fpSceneHandler -> SetCurrentViewer (fpViewer);
    705 
    706         if (fVerbosity >= confirmations) {
    707           G4cout << "G4VisManager::CreateViewer: new viewer created."
    708                  << G4endl;
    709         }
    710 
    711         const G4ViewParameters& vp = fpViewer->GetViewParameters();
    712         if (fVerbosity >= parameters) {
    713           G4cout << " view parameters are:\n  " << vp << G4endl;
    714         }
    715 
    716         if (vp.IsCulling () && vp.IsCullingInvisible ()) {
    717           static G4bool warned = false;
    718           if (fVerbosity >= confirmations) {
    719             if (!warned) {
    720               G4cout <<
     703  G4ViewParameters initialvp = p -> GetViewParameters();
     704  initialvp.SetXGeometryString(XGeometry); //parse string and store parameters
     705  p -> SetViewParameters(initialvp);
     706  p -> Initialise ();  // (Viewer itself may change view parameters further.)
     707
     708  fpViewer = p;                             // Make current.
     709  fpSceneHandler -> AddViewerToList (fpViewer);
     710  fpSceneHandler -> SetCurrentViewer (fpViewer);
     711  if (fVerbosity >= confirmations) {
     712    G4cout << "G4VisManager::CreateViewer: new viewer created."
     713           << G4endl;
     714  }
     715
     716  const G4ViewParameters& vp = fpViewer->GetViewParameters();
     717  if (fVerbosity >= parameters) {
     718    G4cout << " view parameters are:\n  " << vp << G4endl;
     719  }
     720
     721  if (vp.IsCulling () && vp.IsCullingInvisible ()) {
     722    static G4bool warned = false;
     723    if (fVerbosity >= confirmations) {
     724      if (!warned) {
     725        G4cout <<
    721726  "NOTE: objects with visibility flag set to \"false\""
    722727  " will not be drawn!"
    723728  "\n  \"/vis/viewer/set/culling global false\" to Draw such objects."
    724729  "\n  Also see other \"/vis/viewer/set\" commands."
    725                      << G4endl;
    726               warned = true;
    727             }
    728           }
    729         }
    730         if (vp.IsCullingCovered ()) {
    731           static G4bool warned = false;
    732           if (fVerbosity >= warnings) {
    733             if (!warned) {
    734               G4cout <<
     730               << G4endl;
     731        warned = true;
     732      }
     733    }
     734  }
     735  if (vp.IsCullingCovered ()) {
     736    static G4bool warned = false;
     737    if (fVerbosity >= warnings) {
     738      if (!warned) {
     739        G4cout <<
    735740  "WARNING: covered objects in solid mode will not be rendered!"
    736741  "\n  \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
    737742  "\n  Also see other \"/vis/viewer/set\" commands."
    738                      << G4endl;
    739               warned = true;
    740             }
    741           }
    742         }
    743       }
    744     }
    745   }
    746   else PrintInvalidPointers ();
     743               << G4endl;
     744        warned = true;
     745      }
     746    }
     747  }
    747748}
    748749
     
    10881089  RegisterMessenger(new G4VisCommandSceneAddLogicalVolume);
    10891090  RegisterMessenger(new G4VisCommandSceneAddLogo);
     1091  RegisterMessenger(new G4VisCommandSceneAddPSHits);
    10901092  RegisterMessenger(new G4VisCommandSceneAddScale);
    10911093  RegisterMessenger(new G4VisCommandSceneAddText);
     
    13311333          printf("G4VisManager::EndOfEvent 7 \n");
    13321334          G4cout <<
    1333             "WARNING: G4VisManager::EndOfEvent: Event keeping suspended."
    1334             "\n  The number of events exceeds the maximum that may be kept, "
    1335                  << maxNumberOfKeptEvents << '.'
     1335 "WARNING: G4VisManager::EndOfEvent: Automatic event keeping suspended."
     1336 "\n  The number of events exceeds the maximum, "
     1337                 << maxNumberOfKeptEvents <<
     1338 ", that can be kept by the vis manager."
    13361339                 << G4endl;
    13371340        }
     
    13711374    if (fEventKeepingSuspended && fVerbosity >= warnings) {
    13721375      G4cout <<
    1373         "WARNING: G4VisManager::EndOfRun: Event keeping was suspended."
    1374         "\n  The number of events in the run exceeded the maximum to be kept, "
    1375              << fpScene->GetMaxNumberOfKeptEvents() << '.' <<
    1376         "\n  The number of events to be kept can be changed with"
    1377         "\n  \"/vis/scene/endOfEventAction accumulate <N>\", where N is the"
    1378         "\n  maximum number you wish to allow.  N < 0 means \"unlimited\"."
     1376 "WARNING: G4VisManager::EndOfRun: Automatic event keeping has been suspended."
     1377 "\n  The number of events in the run exceeded the maximum, "
     1378             << fpScene->GetMaxNumberOfKeptEvents() <<
     1379 ", that can be kept by the vis manager." <<
     1380 "\n  The number of events kept by the vis manager can be changed with"
     1381 "\n  \"/vis/scene/endOfEventAction accumulate <N>\", where N is the"
     1382 "\n  maximum number you wish to allow.  N < 0 means \"unlimited\"."
    13791383             << G4endl;
    13801384    }
Note: See TracChangeset for help on using the changeset viewer.