625 {
626
628
630 std::istringstream is (newValue);
631 is >> sceneName >> refresh_flush;
633 if (refresh_flush(0) == 'f') flush = true;
634
638
639
640 const G4int nScenes = sceneList.size ();
642 for (iScene = 0; iScene < nScenes; iScene++) {
643 G4Scene* scene = sceneList [iScene];
644 if (sceneName == scene -> GetName ()) break;
645 }
646 if (iScene >= nScenes ) {
648 G4cout <<
"WARNING: Scene \"" << sceneName <<
"\" not found."
649 "\n /vis/scene/list to see scenes."
651 }
652 return;
653 }
654
655
658 if (!pCurrentSceneHandler) {
660 G4cout <<
"WARNING: No current scene handler."
662 }
663 return;
664 }
666 if (!pCurrentViewer) {
668 G4cout <<
"WARNING: No current viewer."
670 }
671 return;
672 }
674 if (!pCurrentScene) {
676 G4cout <<
"WARNING: No current scene."
678 }
679 return;
680 }
681
683
684
685
686
687
688
689
690 const G4int nSceneHandlers = sceneHandlerList.size ();
691 for (
G4int iSH = 0; iSH < nSceneHandlers; iSH++) {
693 G4Scene* aScene = aSceneHandler -> GetScene ();
694 if (aScene) {
695 const G4String& aSceneName = aScene -> GetName ();
696 if (sceneName == aSceneName) {
698 G4ViewerList& viewerList = aSceneHandler -> SetViewerList ();
699 const G4int nViewers = viewerList.size ();
700 for (
G4int iV = 0; iV < nViewers; iV++) {
702
703 aViewer -> NeedKernelVisit();
705 aSceneHandler -> SetCurrentViewer (aViewer);
706
710 aViewer -> SetView ();
711 aViewer -> ClearView ();
712 aViewer -> DrawView ();
713 if (flush) aViewer -> ShowView ();
715 G4cout <<
"Viewer \"" << aViewer -> GetName ()
716 << "\" of scene handler \"" << aSceneHandler -> GetName ()
717 << "\"\n ";
718 if (flush)
G4cout <<
"flushed";
719 else G4cout <<
"refreshed";
720 G4cout <<
" at request of scene \"" << sceneName
722 }
723 } else {
725 G4cout <<
"NOTE: The scene, \""
726 << sceneName
727 << "\", of viewer \""
728 << aViewer -> GetName ()
729 << "\"\n of scene handler \""
730 << aSceneHandler -> GetName ()
731 << "\" has changed. To see effect,"
732 << "\n \"/vis/viewer/select "
733 << aViewer -> GetShortName ()
734 << "\" and \"/vis/viewer/rebuild\"."
736 }
737 }
738 }
739 }
740 }
741 else {
743 G4cout <<
"WARNING: G4VisCommandSceneNotifyHandlers: scene handler \""
745 << "\" has a null scene."
747 }
748 }
749 }
750
751
752
753
754
755
756
758 fpVisManager -> SetCurrentSceneHandler(pCurrentSceneHandler);
761
762 if (pCurrentSceneHandler) {
763 G4ViewerList& viewerList = pCurrentSceneHandler -> SetViewerList ();
764 const G4int nViewers = viewerList.size ();
765 if (nViewers) {
766 pCurrentSceneHandler -> SetCurrentViewer (pCurrentViewer);
767
768
769
770
771 }
772 }
773}
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
const G4ViewParameters & GetViewParameters() const
static G4VisManager * fpVisManager
G4bool IsAutoRefresh() const
static Verbosity GetVerbosity()