45 G4bool omitable, currentAsDefault;
47 fpCommand -> SetGuidance (
"Attaches scene to current scene handler.");
49 (
"If scene-name is omitted, current scene is attached. To see scenes and"
50 "\nscene handlers, use \"/vis/scene/list\" and \"/vis/sceneHandler/list\"");
51 fpCommand -> SetParameterName (
"scene-name",
53 currentAsDefault =
true);
62 return pScene ? pScene -> GetName () :
G4String(
"");
72 if (sceneName.length () == 0) {
75 "WARNING: No scene specified. Maybe there are no scenes available"
76 "\n yet. Please create one." <<
G4endl;
85 "ERROR: Current scene handler not defined. Please select or create one."
93 if (sceneList.empty ()) {
96 "ERROR: No valid scenes available yet. Please create one."
102 G4int iScene, nScenes = sceneList.size ();
103 for (iScene = 0; iScene < nScenes; iScene++) {
104 if (sceneList [iScene] -> GetName () == sceneName)
break;
106 if (iScene < nScenes) {
107 G4Scene* pScene = sceneList [iScene];
108 pSceneHandler -> SetScene (pScene);
112 G4VViewer* pViewer = pSceneHandler -> GetCurrentViewer();
113 if (pViewer && pViewer -> GetViewParameters().IsAutoRefresh()) {
114 pViewer -> SetView ();
115 pViewer -> ClearView ();
116 pViewer -> DrawView ();
119 G4cout <<
"Scene \"" << sceneName
120 <<
"\" attached to scene handler \""
121 << pSceneHandler -> GetName () <<
122 ".\n (You may have to refresh with \"/vis/viewer/flush\" if view"
123 " is not \"auto-refresh\".)"
129 G4cout <<
"ERROR: Scene \"" << sceneName
130 <<
"\" not found. Use \"/vis/scene/list\" to see possibilities."
142 (
"Creates an scene handler for a specific graphics system.");
144 (
"Attaches current scene, if any. (You can change attached scenes with"
145 "\n\"/vis/sceneHandler/attach\".) Invents a scene handler name if not"
146 "\nsupplied. This scene handler becomes current.");
149 's', omitable =
false);
153 for (
size_t igslist = 0; igslist < gslist.size (); igslist++) {
155 const G4String& nickname = gslist [igslist] -> GetNickname ();
160 candidates += nickname;
164 candidates = candidates.
strip ();
165 parameter -> SetParameterCandidates(candidates);
168 (
"scene-handler-name",
's', omitable =
true);
169 parameter -> SetCurrentAsDefault (
true);
178 std::ostringstream oss;
179 oss <<
"scene-handler-" <<
fId;
188 if (graphicsSystem) {
189 graphicsSystemName = graphicsSystem -> GetName ();
194 if (gslist.size ()) {
195 graphicsSystemName = gslist [0] -> GetName ();
198 graphicsSystemName =
"none";
202 return graphicsSystemName +
" " +
NextName ();
211 std::istringstream is (newValue);
212 is >> graphicsSystem >> newName;
216 int nSystems = gsl.size ();
219 G4cout <<
"ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
220 " no graphics systems available."
221 "\n Did you instantiate any in"
222 " YourVisManager::RegisterGraphicsSystems()?"
228 for (iGS = 0; iGS < nSystems; iGS++) {
229 if (graphicsSystem.
compareTo (gsl [iGS] -> GetName (),
231 graphicsSystem.
compareTo (gsl [iGS] -> GetNickname (),
236 if (iGS < 0 || iGS >= nSystems) {
240 G4cout <<
"ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
241 " invalid graphics system specified."
248 if (!gsl[iGS]->IsUISessionCompatible()) {
249 G4String fallbackNickname = gsl[iGS]->GetNickname() +
"_FALLBACK";
250 for (iGS = 0; iGS < nSystems; iGS++) {
251 if (fallbackNickname.
compareTo (gsl [iGS] -> GetNickname (),
256 if (iGS < 0 || iGS >= nSystems) {
258 G4cout <<
"ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
259 " could not find fallback graphics system."
265 G4cout <<
"WARNING: G4VisCommandSceneHandlerCreate::SetNewValue:"
266 " using fallback graphics system."
276 G4cout <<
"Graphics system set to " << pSystem -> GetName () <<
G4endl;
284 if (newName == nextName)
fId++;
288 for (iScene = 0; iScene < list.size (); iScene++) {
290 if (sceneHandler -> GetName () == newName) {
292 G4cout <<
"ERROR: Scene handler \"" << newName
293 <<
"\" already exists." <<
G4endl;
301 if (
fpVisManager -> GetCurrentSceneHandler () -> GetName () != newName) {
303 G4cout <<
"ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
304 " Curious name mismatch."
306 <<
fpVisManager -> GetCurrentSceneHandler () -> GetName ()
307 <<
"\" is not the new name \""
309 <<
"\".\n Please report to vis coordinator."
316 G4cout <<
"New scene handler \"" << newName <<
"\" created." <<
G4endl;
329 fpCommand -> SetGuidance (
"Lists scene handler(s).");
331 (
"\"help /vis/verbose\" for definition of verbosity.");
333 parameter =
new G4UIparameter(
"scene-handler-name",
's', omitable =
true);
334 parameter -> SetDefaultValue (
"all");
336 parameter =
new G4UIparameter (
"verbosity",
's', omitable =
true);
337 parameter -> SetDefaultValue (
"warnings");
352 std::istringstream is (newValue);
353 is >> name >> verbosityString;
359 if (currentSceneHandler) currentName = currentSceneHandler->
GetName();
363 for (
size_t iSH = 0; iSH < list.size (); iSH++) {
364 const G4String& iName = list [iSH] -> GetName ();
366 if (name != iName)
continue;
369 if (iName == currentName) {
375 G4cout <<
" scene handler \"" << list [iSH] -> GetName () <<
"\""
376 <<
" (" << list [iSH] -> GetGraphicsSystem () -> GetName () <<
")";
378 G4cout <<
"\n " << *(list [iSH]);
383 G4cout <<
"No scene handlers found";
385 G4cout <<
" of name \"" << name <<
"\"";
396 fpCommand -> SetGuidance (
"Selects a scene handler.");
398 (
"Makes the scene handler current. \"/vis/sceneHandler/list\" to see"
399 "\n possible scene handler names.");
400 fpCommand -> SetParameterName (
"scene-handler-name",
421 for (iSH = 0; iSH < list.size (); iSH++) {
422 if (list [iSH] -> GetName () == selectName)
break;
424 if (iSH < list.size ()) {
425 if (
fpVisManager -> GetCurrentSceneHandler () -> GetName ()
428 G4cout <<
"Scene handler \"" << selectName <<
"\""
429 <<
" already selected." <<
G4endl;
434 G4cout <<
"Scene handler \"" << selectName <<
"\""
435 <<
" being selected." <<
G4endl;
442 G4cout <<
"ERROR: Scene handler \"" << selectName <<
"\""
443 <<
" not found - \"/vis/sceneHandler/list\""
444 "\n to see possibilities."
~G4VisCommandSceneHandlerAttach()
G4String strip(G4int strip_Type=trailing, char c=' ')
const G4String & GetName() const
static Verbosity GetVerbosityValue(const G4String &)
G4UIcmdWithAString * fpCommand
static G4UImanager * GetUIpointer()
G4String GetCurrentValue(G4UIcommand *command)
~G4VisCommandSceneHandlerCreate()
~G4VisCommandSceneHandlerSelect()
G4GLOB_DLL std::ostream G4cout
G4UIcmdWithAString * fpCommand
G4VisCommandSceneHandlerCreate()
G4VisCommandSceneHandlerList()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandSceneHandlerAttach()
G4VisCommandSceneHandlerSelect()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
static Verbosity GetVerbosity()
G4int compareTo(const char *, caseCompare mode=exact) const
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
~G4VisCommandSceneHandlerList()
void SetNewValue(G4UIcommand *command, G4String newValue)
static G4VisManager * fpVisManager