Import Geant4 8.2.0 source tree
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsScene.cc,v 1.54 2006/06/29 21:29:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4VisCommandsScene.cc,v 1.65 2006/11/26 19:37:54 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
|
||||
// /vis/scene commands - John Allison 9th August 1998
|
||||
|
||||
@@ -98,6 +98,7 @@ void G4VisCommandSceneCreate::SetNewValue (G4UIcommand*, G4String newValue) {
|
||||
if (iScene < nScenes) {
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "WARNING: Scene \"" << newName << "\" already exists."
|
||||
<< "\n New scene not created."
|
||||
<< G4endl;
|
||||
}
|
||||
} else {
|
||||
@@ -117,7 +118,7 @@ void G4VisCommandSceneCreate::SetNewValue (G4UIcommand*, G4String newValue) {
|
||||
|
||||
G4VisCommandSceneEndOfEventAction::G4VisCommandSceneEndOfEventAction () {
|
||||
G4bool omitable;
|
||||
fpCommand = new G4UIcmdWithAString ("/vis/scene/endOfEventAction", this);
|
||||
fpCommand = new G4UIcommand ("/vis/scene/endOfEventAction", this);
|
||||
fpCommand -> SetGuidance
|
||||
("Accumulate or refresh the viewer for each new event.");
|
||||
fpCommand -> SetGuidance
|
||||
@@ -125,10 +126,16 @@ G4VisCommandSceneEndOfEventAction::G4VisCommandSceneEndOfEventAction () {
|
||||
fpCommand -> SetGuidance
|
||||
("\"refresh\": viewer shows them at end of event or, for direct-screen"
|
||||
"\n viewers, refreshes the screen just before drawing the next event.");
|
||||
fpCommand -> SetGuidance ("The detector remains or is redrawn.");
|
||||
fpCommand -> SetParameterName ("action", omitable = true);
|
||||
fpCommand -> SetCandidates ("accumulate refresh");
|
||||
fpCommand -> SetDefaultValue ("refresh");
|
||||
G4UIparameter* parameter;
|
||||
parameter = new G4UIparameter ("action", 's', omitable = true);
|
||||
parameter -> SetParameterCandidates ("accumulate refresh");
|
||||
parameter -> SetDefaultValue ("refresh");
|
||||
fpCommand -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter ("maxNumber", 'i', omitable = true);
|
||||
parameter -> SetDefaultValue (100);
|
||||
parameter -> SetGuidance
|
||||
("Maximum number of events kept. Unlimited if negative.");
|
||||
fpCommand -> SetParameter (parameter);
|
||||
}
|
||||
|
||||
G4VisCommandSceneEndOfEventAction::~G4VisCommandSceneEndOfEventAction () {
|
||||
@@ -145,8 +152,9 @@ void G4VisCommandSceneEndOfEventAction::SetNewValue (G4UIcommand*,
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
|
||||
G4String action;
|
||||
G4int maxNumberOfKeptEvents;
|
||||
std::istringstream is (newValue);
|
||||
is >> action;
|
||||
is >> action >> maxNumberOfKeptEvents;
|
||||
|
||||
G4Scene* pScene = fpVisManager->GetCurrentScene();
|
||||
if (!pScene) {
|
||||
@@ -166,10 +174,20 @@ void G4VisCommandSceneEndOfEventAction::SetNewValue (G4UIcommand*,
|
||||
|
||||
if (action == "accumulate") {
|
||||
pScene->SetRefreshAtEndOfEvent(false);
|
||||
pScene->SetMaxNumberOfKeptEvents(maxNumberOfKeptEvents);
|
||||
}
|
||||
else if (action == "refresh") {
|
||||
pScene->SetRefreshAtEndOfEvent(true);
|
||||
pSceneHandler->SetMarkForClearingTransientStore(true);
|
||||
if (!pScene->GetRefreshAtEndOfRun()) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout <<
|
||||
"ERROR: Cannot refresh events unless runs refresh too."
|
||||
"\n Use \"/vis/scene/endOfRun refresh\"."
|
||||
<< G4endl;
|
||||
}
|
||||
} else {
|
||||
pScene->SetRefreshAtEndOfEvent(true);
|
||||
pSceneHandler->SetMarkForClearingTransientStore(true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
@@ -180,12 +198,34 @@ void G4VisCommandSceneEndOfEventAction::SetNewValue (G4UIcommand*,
|
||||
return;
|
||||
}
|
||||
|
||||
// Change of transients behaviour, so...
|
||||
fpVisManager->ResetTransientsDrawnFlags();
|
||||
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "End of event action set to \"";
|
||||
if (pScene->GetRefreshAtEndOfEvent()) G4cout << "refresh";
|
||||
else G4cout << "accumulate";
|
||||
G4cout << "\"" << G4endl;
|
||||
G4cout << "End of event action set to ";
|
||||
if (pScene->GetRefreshAtEndOfEvent()) G4cout << "\"refresh\".";
|
||||
else {
|
||||
G4cout << "\"accumulate\"."
|
||||
"\n Maximum number of events to be kept: "
|
||||
<< maxNumberOfKeptEvents
|
||||
<< " (unlimited if negative)."
|
||||
"\n This may be changed with, e.g., "
|
||||
"\"/vis/scene/endOfEventAction accumulate 100\"."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
if (!pScene->GetRefreshAtEndOfEvent() &&
|
||||
maxNumberOfKeptEvents != 0 &&
|
||||
verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "WARNING: The vis manager will keep ";
|
||||
if (maxNumberOfKeptEvents < 0) G4cout << "an unlimited number of";
|
||||
else G4cout << "up to " << maxNumberOfKeptEvents;
|
||||
G4cout << " events.";
|
||||
if (maxNumberOfKeptEvents > 1 || maxNumberOfKeptEvents < 0)
|
||||
G4cout << "\n This may use a lot of memory.";
|
||||
G4cout << G4endl;
|
||||
}
|
||||
UpdateVisManagerScene (pScene->GetName());
|
||||
}
|
||||
|
||||
////////////// /vis/scene/endOfRunAction ////////////////////////////
|
||||
@@ -266,12 +306,16 @@ void G4VisCommandSceneEndOfRunAction::SetNewValue (G4UIcommand*,
|
||||
return;
|
||||
}
|
||||
|
||||
// Change of transients behaviour, so...
|
||||
fpVisManager->ResetTransientsDrawnFlags();
|
||||
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "End of run action set to \"";
|
||||
if (pScene->GetRefreshAtEndOfRun()) G4cout << "refresh";
|
||||
else G4cout << "accumulate";
|
||||
G4cout << "\"" << G4endl;
|
||||
}
|
||||
UpdateVisManagerScene (pScene->GetName());
|
||||
}
|
||||
|
||||
////////////// /vis/scene/list ///////////////////////////////////////
|
||||
@@ -459,25 +503,41 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
|
||||
const G4int nViewers = viewerList.size ();
|
||||
for (G4int iV = 0; iV < nViewers; iV++) {
|
||||
G4VViewer* aViewer = viewerList [iV];
|
||||
aSceneHandler -> SetCurrentViewer (aViewer);
|
||||
// Ensure consistency of vis manager...
|
||||
fpVisManager -> SetCurrentViewer(aViewer);
|
||||
fpVisManager -> SetCurrentSceneHandler(aSceneHandler);
|
||||
fpVisManager -> SetCurrentScene(aScene);
|
||||
// Re-draw, forcing rebuild of graphics database, if any...
|
||||
aViewer -> NeedKernelVisit();
|
||||
aViewer -> SetView ();
|
||||
aViewer -> ClearView ();
|
||||
aViewer -> DrawView ();
|
||||
if (flush) aViewer -> ShowView ();
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Viewer \"" << aViewer -> GetName ()
|
||||
<< "\" of scene handler \"" << aSceneHandler -> GetName ()
|
||||
<< "\"\n ";
|
||||
if (flush) G4cout << "flushed";
|
||||
else G4cout << "refreshed";
|
||||
G4cout << " at request of scene \"" << sceneName
|
||||
<< "\"." << G4endl;
|
||||
if (aViewer->GetViewParameters().IsAutoRefresh()) {
|
||||
aSceneHandler -> SetCurrentViewer (aViewer);
|
||||
// Ensure consistency of vis manager...
|
||||
fpVisManager -> SetCurrentViewer(aViewer);
|
||||
fpVisManager -> SetCurrentSceneHandler(aSceneHandler);
|
||||
fpVisManager -> SetCurrentScene(aScene);
|
||||
// Re-draw, forcing rebuild of graphics database, if any...
|
||||
aViewer -> NeedKernelVisit();
|
||||
aViewer -> SetView ();
|
||||
aViewer -> ClearView ();
|
||||
aViewer -> DrawView ();
|
||||
if (flush) aViewer -> ShowView ();
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Viewer \"" << aViewer -> GetName ()
|
||||
<< "\" of scene handler \"" << aSceneHandler -> GetName ()
|
||||
<< "\"\n ";
|
||||
if (flush) G4cout << "flushed";
|
||||
else G4cout << "refreshed";
|
||||
G4cout << " at request of scene \"" << sceneName
|
||||
<< "\"." << G4endl;
|
||||
}
|
||||
} else {
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout << "WARNING: The scene, \""
|
||||
<< sceneName
|
||||
<< "\", of viewer \""
|
||||
<< aViewer -> GetName ()
|
||||
<< "\"\n of scene handler \""
|
||||
<< aSceneHandler -> GetName ()
|
||||
<< "\" has changed. To see effect,"
|
||||
<< "\n \"/vis/viewer/select "
|
||||
<< aViewer -> GetShortName ()
|
||||
<< "\" and \"/vis/viewer/rebuild\"."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -559,76 +619,4 @@ void G4VisCommandSceneSelect::SetNewValue (G4UIcommand*, G4String newValue) {
|
||||
<< "\" selected." << G4endl;
|
||||
}
|
||||
UpdateVisManagerScene (selectName);
|
||||
|
||||
}
|
||||
|
||||
////////////// /vis/scene/transientsAction ////////////////////////////
|
||||
|
||||
G4VisCommandSceneTransientsAction::G4VisCommandSceneTransientsAction () {
|
||||
G4bool omitable;
|
||||
fpCommand = new G4UIcmdWithAString ("/vis/scene/transientsAction", this);
|
||||
fpCommand -> SetGuidance
|
||||
("Rerun events to get transienst (trajectories, etc.), when needed.");
|
||||
fpCommand -> SetGuidance
|
||||
("Note: ineffective in absence of instantiated run manager.");
|
||||
fpCommand -> SetParameterName ("action", omitable = true);
|
||||
fpCommand -> SetCandidates ("rerun none");
|
||||
fpCommand -> SetDefaultValue ("rerun");
|
||||
|
||||
}
|
||||
|
||||
G4VisCommandSceneTransientsAction::~G4VisCommandSceneTransientsAction () {
|
||||
delete fpCommand;
|
||||
}
|
||||
|
||||
G4String G4VisCommandSceneTransientsAction::GetCurrentValue(G4UIcommand*) {
|
||||
return "";
|
||||
}
|
||||
|
||||
void G4VisCommandSceneTransientsAction::SetNewValue (G4UIcommand*,
|
||||
G4String newValue) {
|
||||
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
|
||||
G4String action;
|
||||
std::istringstream is (newValue);
|
||||
is >> action;
|
||||
|
||||
G4Scene* pScene = fpVisManager->GetCurrentScene();
|
||||
if (!pScene) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout << "ERROR: No current scene. Please create one." << G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
|
||||
if (!pSceneHandler) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout << "ERROR: No current sceneHandler. Please create one." << G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (action == "rerun") {
|
||||
pScene->SetRecomputeTransients(true);
|
||||
}
|
||||
else if (action == "none") {
|
||||
pScene->SetRecomputeTransients(false);
|
||||
}
|
||||
else {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout <<
|
||||
"ERROR: unrecognised parameter \"" << action << "\"."
|
||||
<< G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Transients action set to \"";
|
||||
if (pScene->GetRecomputeTransients()) G4cout << "rerun";
|
||||
else G4cout << "none";
|
||||
G4cout << "\"" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user