Changeset 1140 for trunk/source/visualization/management/src
- Timestamp:
- Nov 3, 2009, 11:17:28 AM (15 years ago)
- Location:
- trunk/source/visualization/management/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/management/src/G4VSceneHandler.cc
r1136 r1140 25 25 // 26 26 // 27 // $Id: G4VSceneHandler.cc,v 1.8 3 2008/01/04 22:03:46 allison Exp $27 // $Id: G4VSceneHandler.cc,v 1.86 2009/10/23 07:58:36 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 262 262 263 263 void 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 267 void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) { 268 // Cast because DrawAllHits is non-const!!!! 269 static_cast<G4THitsMap<G4double> >(hits).DrawAllHits(); 265 270 } 266 271 … … 583 588 printf("G4VSceneHandler::ProcessScene : Idle ?\n"); 584 589 #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... 586 592 G4StateManager* stateManager = G4StateManager::GetStateManager(); 587 593 G4ApplicationState state = stateManager->GetCurrentState(); 588 if (state == G4State_Idle ) {594 if (state == G4State_Idle || state == G4State_GeomClosed) { 589 595 #ifdef G4DEBUG_VIS_MANAGEMENT 590 596 printf("G4VSceneHandler::ProcessScene : IDLE\n"); -
trunk/source/visualization/management/src/G4VisCommandsSceneAdd.cc
r1136 r1140 25 25 // 26 26 // 27 // $Id: G4VisCommandsSceneAdd.cc,v 1.7 4 2009/07/24 09:20:52 lgarnierExp $27 // $Id: G4VisCommandsSceneAdd.cc,v 1.76 2009/10/30 15:58:50 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // /vis/scene commands - John Allison 9th August 1998 … … 37 37 #include "G4ModelingParameters.hh" 38 38 #include "G4HitsModel.hh" 39 #include "G4PSHitsModel.hh" 39 40 #include "G4TrajectoriesModel.hh" 40 41 #include "G4ScaleModel.hh" … … 229 230 const G4Run* currentRun = 0; 230 231 G4RunManager* runManager = G4RunManager::GetRunManager(); 231 if (runManager) 232 if (runManager) currentRun = runManager->GetCurrentRun(); 232 233 233 234 G4VModel* model = fpVisManager->GetCurrentSceneHandler()->GetModel(); 234 const G4ModelingParameters* mp ;235 const G4Event* currentEvent ;235 const G4ModelingParameters* mp = 0; 236 const G4Event* currentEvent = 0; 236 237 if (model) { 237 238 mp = model->GetModelingParameters(); … … 240 241 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 241 242 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; 243 246 } 244 247 } … … 890 893 sceneHandler.AddPrimitive(*fp4); 891 894 sceneHandler.EndPrimitives(); 895 } 896 897 ////////////// /vis/scene/add/psHits /////////////////////////////////////// 898 899 G4VisCommandSceneAddPSHits::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 908 G4VisCommandSceneAddPSHits::~G4VisCommandSceneAddPSHits () { 909 delete fpCommand; 910 } 911 912 G4String G4VisCommandSceneAddPSHits::GetCurrentValue (G4UIcommand*) { 913 return ""; 914 } 915 916 void 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); 892 941 } 893 942 -
trunk/source/visualization/management/src/G4VisManager.cc
r1136 r1140 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4VisManager.cc,v 1.1 18 2009/03/09 12:42:00allison Exp $26 // $Id: G4VisManager.cc,v 1.121 2009/10/30 16:03:41 allison Exp $ 27 27 // GEANT4 tag $Name: $ 28 28 // … … 656 656 G4cout << "ERROR in G4VisManager::CreateSceneHandler during " 657 657 << fpGraphicsSystem -> GetName () 658 << " scene creation.\n No action taken."658 << " scene handler creation.\n No action taken." 659 659 << G4endl; 660 660 } … … 669 669 if (!fInitialised) Initialise (); 670 670 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! 678 702 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 << 721 726 "NOTE: objects with visibility flag set to \"false\"" 722 727 " will not be drawn!" 723 728 "\n \"/vis/viewer/set/culling global false\" to Draw such objects." 724 729 "\n Also see other \"/vis/viewer/set\" commands." 725 726 727 728 729 730 731 732 733 734 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 << 735 740 "WARNING: covered objects in solid mode will not be rendered!" 736 741 "\n \"/vis/viewer/set/culling coveredDaughters false\" to reverse this." 737 742 "\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 } 747 748 } 748 749 … … 1088 1089 RegisterMessenger(new G4VisCommandSceneAddLogicalVolume); 1089 1090 RegisterMessenger(new G4VisCommandSceneAddLogo); 1091 RegisterMessenger(new G4VisCommandSceneAddPSHits); 1090 1092 RegisterMessenger(new G4VisCommandSceneAddScale); 1091 1093 RegisterMessenger(new G4VisCommandSceneAddText); … … 1331 1333 printf("G4VisManager::EndOfEvent 7 \n"); 1332 1334 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." 1336 1339 << G4endl; 1337 1340 } … … 1371 1374 if (fEventKeepingSuspended && fVerbosity >= warnings) { 1372 1375 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\"." 1379 1383 << G4endl; 1380 1384 }
Note: See TracChangeset
for help on using the changeset viewer.