627 {
628
630
632 std::istringstream is (newValue);
633 is >> sceneName >> refresh_flush;
635 if (refresh_flush[0] == 'f') flush = true;
636
640
641
642 const std::size_t nScenes = sceneList.size ();
643 std::size_t iScene;
644 for (iScene = 0; iScene < nScenes; ++iScene) {
645 G4Scene* scene = sceneList [iScene];
646 if (sceneName == scene -> GetName ()) break;
647 }
648 if (iScene >= nScenes ) {
650 G4warn <<
"WARNING: Scene \"" << sceneName <<
"\" not found."
651 "\n /vis/scene/list to see scenes."
653 }
654 return;
655 }
656
657
660 if (!pCurrentSceneHandler) {
662 G4warn <<
"WARNING: No current scene handler."
664 }
665 return;
666 }
668 if (!pCurrentViewer) {
670 G4warn <<
"WARNING: No current viewer."
672 }
673 return;
674 }
676 if (!pCurrentScene) {
678 G4warn <<
"WARNING: No current scene."
680 }
681 return;
682 }
683
685
686
687
688
689
690
691
692 const std::size_t nSceneHandlers = sceneHandlerList.size ();
693 for (std::size_t iSH = 0; iSH < nSceneHandlers; ++iSH) {
695 G4Scene* aScene = aSceneHandler -> GetScene ();
696 if (aScene) {
697 const G4String& aSceneName = aScene -> GetName ();
698 if (sceneName == aSceneName) {
700 G4ViewerList& viewerList = aSceneHandler -> SetViewerList ();
701 const std::size_t nViewers = viewerList.size ();
702 for (std::size_t iV = 0; iV < nViewers; ++iV) {
704
705 aViewer -> NeedKernelVisit();
707 aSceneHandler -> SetCurrentViewer (aViewer);
708
712 aViewer -> SetView ();
713 aViewer -> ClearView ();
714 aViewer -> DrawView ();
715 if (flush) aViewer -> ShowView ();
717 G4cout <<
"Viewer \"" << aViewer -> GetName ()
718 << "\" of scene handler \"" << aSceneHandler -> GetName ()
719 << "\"\n ";
720 if (flush)
G4cout <<
"flushed";
721 else G4cout <<
"refreshed";
722 G4cout <<
" at request of scene \"" << sceneName
724 }
725 } else {
727 G4cout <<
"NOTE: The scene, \""
728 << sceneName
729 << "\", of viewer \""
730 << aViewer -> GetName ()
731 << "\"\n of scene handler \""
732 << aSceneHandler -> GetName ()
733 << "\" has changed. To see effect,"
734 << "\n \"/vis/viewer/select "
735 << aViewer -> GetShortName ()
736 << "\" and \"/vis/viewer/rebuild\"."
738 }
739 }
740 }
741 }
742 }
743 else {
745 G4warn <<
"WARNING: G4VisCommandSceneNotifyHandlers: scene handler \""
747 << "\" has a null scene."
749 }
750 }
751 }
752
753
754
755
756
757
758
760 fpVisManager -> SetCurrentSceneHandler(pCurrentSceneHandler);
763
764 if (pCurrentSceneHandler) {
765 G4ViewerList& viewerList = pCurrentSceneHandler -> SetViewerList ();
766 const std::size_t nViewers = viewerList.size ();
767 if (nViewers) {
768 pCurrentSceneHandler -> SetCurrentViewer (pCurrentViewer);
769
770
771
772
773 }
774 }
775}
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
const G4ViewParameters & GetViewParameters() const
static G4VisManager * fpVisManager
G4bool IsAutoRefresh() const
static Verbosity GetVerbosity()