Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4VisCommandSceneHandlerAttach Class Reference

#include <G4VisCommandsSceneHandler.hh>

Inheritance diagram for G4VisCommandSceneHandlerAttach:
G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandSceneHandlerAttach ()
 
 ~G4VisCommandSceneHandlerAttach ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4VVisCommand
 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *)
 
- Protected Member Functions inherited from G4VVisCommand
void UpdateVisManagerScene (const G4String &sceneName="")
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Static Protected Member Functions inherited from G4VVisCommand
static G4String ConvertToString (G4double x, G4double y, const char *unitName)
 
static void ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentLineWidth = 1.
 
static
G4ModelingParameters::PVNameCopyNoPath 
fCurrentTouchablePath
 

Detailed Description

Definition at line 39 of file G4VisCommandsSceneHandler.hh.

Constructor & Destructor Documentation

G4VisCommandSceneHandlerAttach::G4VisCommandSceneHandlerAttach ( )

Definition at line 44 of file G4VisCommandsSceneHandler.cc.

44  {
45  G4bool omitable, currentAsDefault;
46  fpCommand = new G4UIcmdWithAString ("/vis/sceneHandler/attach", this);
47  fpCommand -> SetGuidance ("Attaches scene to current scene handler.");
48  fpCommand -> SetGuidance
49  ("If scene-name is omitted, current scene is attached. To see scenes and"
50  "\nscene handlers, use \"/vis/scene/list\" and \"/vis/sceneHandler/list\"");
51  fpCommand -> SetParameterName ("scene-name",
52  omitable = true,
53  currentAsDefault = true);
54 }
bool G4bool
Definition: G4Types.hh:79
G4VisCommandSceneHandlerAttach::~G4VisCommandSceneHandlerAttach ( )

Definition at line 56 of file G4VisCommandsSceneHandler.cc.

56  {
57  delete fpCommand;
58 }

Member Function Documentation

G4String G4VisCommandSceneHandlerAttach::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 60 of file G4VisCommandsSceneHandler.cc.

References G4VVisCommand::fpVisManager.

60  {
61  G4Scene* pScene = fpVisManager -> GetCurrentScene ();
62  return pScene ? pScene -> GetName () : G4String("");
63 }
static G4VisManager * fpVisManager
void G4VisCommandSceneHandlerAttach::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 65 of file G4VisCommandsSceneHandler.cc.

References G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetVerbosity(), and G4VisManager::warnings.

66  {
67 
69 
70  G4String& sceneName = newValue;
71 
72  if (sceneName.length () == 0) {
73  if (verbosity >= G4VisManager::warnings) {
74  G4cout <<
75  "WARNING: No scene specified. Maybe there are no scenes available"
76  "\n yet. Please create one." << G4endl;
77  }
78  return;
79  }
80 
81  G4VSceneHandler* pSceneHandler = fpVisManager -> GetCurrentSceneHandler ();
82  if (!pSceneHandler) {
83  if (verbosity >= G4VisManager::errors) {
84  G4cout <<
85  "ERROR: Current scene handler not defined. Please select or create one."
86  << G4endl;
87  }
88  return;
89  }
90 
91  G4SceneList& sceneList = fpVisManager -> SetSceneList ();
92 
93  if (sceneList.empty ()) {
94  if (verbosity >= G4VisManager::errors) {
95  G4cout <<
96  "ERROR: No valid scenes available yet. Please create one."
97  << G4endl;
98  }
99  return;
100  }
101 
102  G4int iScene, nScenes = sceneList.size ();
103  for (iScene = 0; iScene < nScenes; iScene++) {
104  if (sceneList [iScene] -> GetName () == sceneName) break;
105  }
106  if (iScene < nScenes) {
107  G4Scene* pScene = sceneList [iScene];
108  pSceneHandler -> SetScene (pScene);
109  // Make sure scene is current...
110  fpVisManager -> SetCurrentScene (pScene);
111  // Refresh viewer, if any (only if auto-refresh)...
112  G4VViewer* pViewer = pSceneHandler -> GetCurrentViewer();
113  if (pViewer && pViewer -> GetViewParameters().IsAutoRefresh()) {
114  pViewer -> SetView ();
115  pViewer -> ClearView ();
116  pViewer -> DrawView ();
117  }
118  if (verbosity >= G4VisManager::confirmations) {
119  G4cout << "Scene \"" << sceneName
120  << "\" attached to scene handler \""
121  << pSceneHandler -> GetName () <<
122  ".\n (You may have to refresh with \"/vis/viewer/flush\" if view"
123  " is not \"auto-refresh\".)"
124  << G4endl;
125  }
126  }
127  else {
128  if (verbosity >= G4VisManager::errors) {
129  G4cout << "ERROR: Scene \"" << sceneName
130  << "\" not found. Use \"/vis/scene/list\" to see possibilities."
131  << G4endl;
132  }
133  }
134 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
static G4VisManager * fpVisManager

The documentation for this class was generated from the following files: