404 {
405
407
409 std::istringstream is (newValue);
410
411
412
413 char c;
414 while (is.get(c) && c == ' '){}
415 if (c == '"') {
416 while (is.get(c) && c != '"') {originalName += c;}
417 }
418 else {
419 originalName += c;
420 while (is.get(c) && c != ' ') {originalName += c;}
421 }
424
426 if (!originalViewer) {
428 G4cout <<
"ERROR: Viewer \"" << originalName
429 << "\" not found - \"/vis/viewer/list\" to see possibilities."
431 }
432 return;
433 }
434 originalName = originalViewer->
GetName();
435
436 while (is.get(c) && c == ' '){}
437 if (c == '"') {
438 while (is.get(c) && c != '"') {cloneName += c;}
439 }
440 else {
441 cloneName += c;
442 while (is.get(c) && c != ' ') {cloneName += c;}
443 }
446
447 G4bool errorWhileNaming =
false;
448 if (cloneName == "none") {
450 do {
451 cloneName = originalName;
452 std::ostringstream oss;
453 oss << '-' << subID++;
454 G4String::size_type lastDashPosition, nextSpacePosition;
455 if ((lastDashPosition = cloneName.rfind('-')) != G4String::npos &&
456 (nextSpacePosition = cloneName.find(" ", lastDashPosition)) !=
457 G4String::npos) {
458 cloneName.insert(nextSpacePosition, oss.str());
459 } else {
460 G4String::size_type spacePosition = cloneName.find(' ');
461 if (spacePosition != G4String::npos)
462 cloneName.insert(spacePosition, oss.str());
463 else
464 errorWhileNaming = true;
465 }
466 }
while (!errorWhileNaming &&
fpVisManager -> GetViewer (cloneName));
467 }
468
469 if (errorWhileNaming) {
471 G4cout <<
"ERROR: While naming clone viewer \"" << cloneName
472 << "\"."
474 }
475 return;
476 }
477
480 G4cout <<
"ERROR: Putative clone viewer \"" << cloneName
481 << "\" already exists."
483 }
484 return;
485 }
486
489
493 if (keepVerbose >= 2 ||
495 newVerbose = 2;
499 (
G4String(
"/vis/viewer/create ! \"" + cloneName +
"\" " + windowSizeHint));
502
504 G4cout <<
"Viewer \"" << originalName <<
"\" cloned." <<
G4endl;
505 G4cout <<
"Clone \"" << cloneName <<
"\" now current." <<
G4endl;
506 }
507}
G4DLLIMPORT std::ostream G4cout
G4String strip(G4int strip_Type=trailing, char c=' ')
G4int ApplyCommand(const char *aCommand)
G4int GetVerboseLevel() const
static G4UImanager * GetUIpointer()
void SetVerboseLevel(G4int val)
const G4String & GetName() const
const G4ViewParameters & GetViewParameters() const
const G4String & GetXGeometryString() const
static Verbosity GetVerbosity()