201 {
202
204
206 std::istringstream is (newValue);
207 is >> graphicsSystem >> newName;
208
211 G4int nSystems = gsl.size ();
212 if (nSystems <= 0) {
214 G4cerr <<
"ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
215 " no graphics systems available."
216 "\n Did you instantiate any in"
217 " YourVisManager::RegisterGraphicsSystems()?"
219 }
220 return;
221 }
224 for (iGS = 0; iGS < nSystems; iGS++) {
225 const auto& gs = gsl[iGS];
227 found = true;
228 break;
229 } else {
230 const auto& nicknames = gs->GetNicknames();
231 for (size_t i = 0; i < nicknames.size(); ++i) {
232 const auto& nickname = nicknames[i];
234 found = true;
235 break;
236 }
237 }
238 if (found) {
239 break;
240 }
241 }
242 }
243 if (!found) {
244
245
248 "ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
249 "\n invalid graphics system \""
250 << graphicsSystem
251 << "\" requested."
253 }
254 return;
255 }
256
257
259 G4int loopCounter = 0;
260 while (!gsl[iGS]->IsUISessionCompatible()) {
261 G4int iGSBeingTested = iGS;
262
263 fallback = false;
264 G4String fallbackNickname = gsl[iGS]->GetNickname() +
"_FALLBACK";
265 for (iGS = 0; iGS < nSystems; iGS++) {
266 const auto& nicknames = gsl[iGS]->GetNicknames();
267 for (size_t i = 0; i < nicknames.size(); ++i) {
268 const auto& nickname = nicknames[i];
270 fallback = true;
271 break;
272 }
273 }
274 if (fallback) {
275 break;
276 }
277 }
278 if (iGS < 0 || iGS >= nSystems || loopCounter >=3) {
279 std::ostringstream oss;
280 oss << "\"" << gsl[iGSBeingTested]->GetNickname()
281 << "\" is not compatible with your chosen session,"
282 " and no fallback system found.";
284 G4cerr <<
"ERROR: G4VisCommandSceneHandlerCreate::SetNewValue: "
286 }
288 return;
289 }
290
291 ++loopCounter;
292 }
293
294
296
298 G4cout <<
"WARNING: G4VisCommandSceneHandlerCreate::SetNewValue:"
299 "\n Using fallback graphics system: "
300 << pSystem -> GetName ()
301 << " ("
302 << pSystem -> GetNickname ()
303 << ')'
305 }
306
307
308
311 G4cout <<
"Graphics system set to "
312 << pSystem -> GetName ()
313 << " ("
314 << pSystem -> GetNickname ()
315 << ')'
317 }
318
319
321 if (newName == "") {
322 newName = nextName;
323 }
324 if (newName == nextName) fId++;
325
327 size_t iScene;
328 for (iScene = 0; iScene < list.size (); iScene++) {
330 if (sceneHandler -> GetName () == newName) {
332 G4cerr <<
"ERROR: Scene handler \"" << newName
333 <<
"\" already exists." <<
G4endl;
334 }
335 return;
336 }
337 }
338
339
341 if (
fpVisManager -> GetCurrentSceneHandler () -> GetName () != newName) {
343 G4cerr <<
"ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
344 " Curious name mismatch."
345 "\n Current name \""
346 <<
fpVisManager -> GetCurrentSceneHandler () -> GetName ()
347 << "\" is not the new name \""
348 << newName
349 << "\".\n Please report to vis coordinator."
351 }
352 return;
353 }
354
356 G4cout <<
"New scene handler \"" << newName <<
"\" created." <<
G4endl;
357 }
358
359
362}
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
G4int compareTo(const char *, caseCompare mode=exact) const
void CommandFailed(G4int errCode, G4ExceptionDescription &ed)
static G4UImanager * GetUIpointer()
static Verbosity GetVerbosity()