622 {
623
625
627 std::istringstream is (newValue);
628 is >> sceneName >> refresh_flush;
630 if (refresh_flush(0) == 'f') flush = true;
631
635
636
637 const G4int nScenes = sceneList.size ();
639 for (iScene = 0; iScene < nScenes; iScene++) {
640 G4Scene* scene = sceneList [iScene];
641 if (sceneName == scene -> GetName ()) break;
642 }
643 if (iScene >= nScenes ) {
645 G4cout <<
"WARNING: Scene \"" << sceneName <<
"\" not found."
646 "\n /vis/scene/list to see scenes."
648 }
649 return;
650 }
651
652
655 if (!pCurrentSceneHandler) {
657 G4cout <<
"WARNING: No current scene handler."
659 }
660 return;
661 }
663 if (!pCurrentViewer) {
665 G4cout <<
"WARNING: No current viewer."
667 }
668 return;
669 }
671 if (!pCurrentScene) {
673 G4cout <<
"WARNING: No current scene."
675 }
676 return;
677 }
678
680
681
682
683
684
685
686
687 const G4int nSceneHandlers = sceneHandlerList.size ();
688 for (
G4int iSH = 0; iSH < nSceneHandlers; iSH++) {
690 G4Scene* aScene = aSceneHandler -> GetScene ();
691 if (aScene) {
692 const G4String& aSceneName = aScene -> GetName ();
693 if (sceneName == aSceneName) {
695 G4ViewerList& viewerList = aSceneHandler -> SetViewerList ();
696 const G4int nViewers = viewerList.size ();
697 for (
G4int iV = 0; iV < nViewers; iV++) {
699
700 aViewer -> NeedKernelVisit();
702 aSceneHandler -> SetCurrentViewer (aViewer);
703
707 aViewer -> SetView ();
708 aViewer -> ClearView ();
709 aViewer -> DrawView ();
710 if (flush) aViewer -> ShowView ();
712 G4cout <<
"Viewer \"" << aViewer -> GetName ()
713 << "\" of scene handler \"" << aSceneHandler -> GetName ()
714 << "\"\n ";
715 if (flush)
G4cout <<
"flushed";
716 else G4cout <<
"refreshed";
717 G4cout <<
" at request of scene \"" << sceneName
719 }
720 } else {
722 G4cout <<
"NOTE: The scene, \""
723 << sceneName
724 << "\", of viewer \""
725 << aViewer -> GetName ()
726 << "\"\n of scene handler \""
727 << aSceneHandler -> GetName ()
728 << "\" has changed. To see effect,"
729 << "\n \"/vis/viewer/select "
730 << aViewer -> GetShortName ()
731 << "\" and \"/vis/viewer/rebuild\"."
733 }
734 }
735 }
736 }
737 }
738 else {
740 G4cout <<
"WARNING: G4VisCommandSceneNotifyHandlers: scene handler \""
742 << "\" has a null scene."
744 }
745 }
746 }
747
748
749
750
751
752
753
755 fpVisManager -> SetCurrentSceneHandler(pCurrentSceneHandler);
758
759 if (pCurrentSceneHandler) {
760 G4ViewerList& viewerList = pCurrentSceneHandler -> SetViewerList ();
761 const G4int nViewers = viewerList.size ();
762 if (nViewers) {
763 pCurrentSceneHandler -> SetCurrentViewer (pCurrentViewer);
764 if (pCurrentViewer && pCurrentSceneHandler->
GetScene()) {
765 pCurrentViewer -> SetView ();
766 }
767 }
768 }
769}
G4DLLIMPORT std::ostream G4cout
G4Scene * GetScene() const
const G4String & GetName() const
const G4ViewParameters & GetViewParameters() const
static G4VisManager * fpVisManager
G4bool IsAutoRefresh() const
static Verbosity GetVerbosity()