Geant4-11
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes
G4OpenGLViewerMessenger Class Reference

#include <G4OpenGLViewerMessenger.hh>

Inheritance diagram for G4OpenGLViewerMessenger:
G4UImessenger

Public Member Functions

G4bool CommandsShouldBeInMaster () const
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool operator== (const G4UImessenger &messenger) const
 
void SetNewValue (G4UIcommand *, G4String)
 
 ~G4OpenGLViewerMessenger ()
 

Static Public Member Functions

static G4OpenGLViewerMessengerGetInstance ()
 

Protected Member Functions

void AddUIcommand (G4UIcommand *newCommand)
 
G4String BtoS (G4bool b)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
G4String DtoS (G4double a)
 
G4String ItoS (G4int i)
 
G4bool StoB (G4String s)
 
G4double StoD (G4String s)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 

Protected Attributes

G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Private Member Functions

 G4OpenGLViewerMessenger ()
 

Private Attributes

G4UIcmdWithAnIntegerfpCommandDisplayListLimit
 
G4UIcommandfpCommandExport
 
G4UIcommandfpCommandExportFormat
 
G4UIcommandfpCommandFlushAt
 
G4UIcommandfpCommandPrintFilename
 
G4UIcmdWithAStringfpCommandPrintMode
 
G4UIcommandfpCommandPrintSize
 
G4UIcmdWithABoolfpCommandTransparency
 
G4UIdirectoryfpDirectory
 
G4UIdirectoryfpDirectorySet
 

Static Private Attributes

static G4OpenGLViewerMessengerfpInstance = 0
 

Detailed Description

Definition at line 43 of file G4OpenGLViewerMessenger.hh.

Constructor & Destructor Documentation

◆ ~G4OpenGLViewerMessenger()

G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger ( )

Definition at line 179 of file G4OpenGLViewerMessenger.cc.

180{
182 delete fpCommandPrintSize;
183 delete fpCommandPrintMode;
187 delete fpDirectorySet;
188 delete fpCommandFlushAt;
189 delete fpCommandExport;
190 delete fpDirectory;
191
192 delete fpInstance;
193}
static G4OpenGLViewerMessenger * fpInstance
G4UIcmdWithAString * fpCommandPrintMode
G4UIcmdWithABool * fpCommandTransparency
G4UIcmdWithAnInteger * fpCommandDisplayListLimit

References fpCommandDisplayListLimit, fpCommandExport, fpCommandExportFormat, fpCommandFlushAt, fpCommandPrintFilename, fpCommandPrintMode, fpCommandPrintSize, fpCommandTransparency, fpDirectory, fpDirectorySet, and fpInstance.

◆ G4OpenGLViewerMessenger()

G4OpenGLViewerMessenger::G4OpenGLViewerMessenger ( )
private

Definition at line 54 of file G4OpenGLViewerMessenger.cc.

55{
56 G4bool omitable;
57
58 fpDirectory = new G4UIdirectory("/vis/ogl/");
59 fpDirectory->SetGuidance("G4OpenGLViewer commands.");
60
62 new G4UIcommand("/vis/ogl/export", this);
63 fpCommandExport->SetGuidance ("Export a screenshot of current OpenGL viewer");
65 ("If name is \"\", filename and extension will have the current value");
67 ("If name is \"toto.png\", set the name to \"toto\" and the format to \"png\".");
69 ("If name is \"toto\", set the name to \"toto\" and the format to current format.");
71 ("Will also add an incremented suffix at the end of the name, except if name is"
72 "\nthe same as previous it will not reset the incremented suffix.");
74 ("Setting size is available only on eps/pdf/svg/ps formats.");
75 G4UIparameter* parameterExport;
76 parameterExport = new G4UIparameter ("name", 's', omitable = true);
77 parameterExport->SetDefaultValue("!");
78 parameterExport->SetGuidance
79 ("By default, will take a default value or the last \"/vis/ogl/set/printFilename\""
80 " value if set.");
81 fpCommandExport->SetParameter(parameterExport);
82 parameterExport = new G4UIparameter ("width", 'd', omitable = true);
83 parameterExport->SetGuidance
84 ("By default, will take the current width of the viewer or \"/vis/ogl/set/printSize\""
85 "\nif set. This parameter is only useful for eps/pdf/svg/ps formats !");
86 parameterExport->SetDefaultValue(-1);
87 fpCommandExport->SetParameter(parameterExport);
88 parameterExport = new G4UIparameter ("height", 'd', omitable = true);
89 parameterExport->SetGuidance
90 ("By default, will take the current height of the viewer or \"/vis/ogl/set/printSize\""
91 "\nif set. This parameter is only useful for eps/pdf/svg/ps formats !");
92 parameterExport->SetDefaultValue(-1);
93 fpCommandExport->SetParameter(parameterExport);
94
95 fpCommandFlushAt = new G4UIcommand("/vis/ogl/flushAt", this);
97 ("Controls the rate at which graphics primitives are flushed to screen.");
99 ("Flushing to screen is an expensive operation so to speed drawing choose"
100 "\nan action suitable for your application. Note that detectors are flushed"
101 "\nto screen anyway at end of drawing, and events are flushed to screen"
102 "\nanyway depending on /vis/scene/endOfEventAction and endOfRunAction.");
104 ("For NthPrimitive and NthEvent the second parameter N is operative.");
106 ("For \"never\", detectors and events are still flushed as described above.");
107 G4UIparameter* parameterFlushAt;
108 parameterFlushAt = new G4UIparameter ("action", 's', omitable = true);
109 parameterFlushAt->SetParameterCandidates
110 ("endOfEvent endOfRun eachPrimitive NthPrimitive NthEvent never");
111 parameterFlushAt->SetDefaultValue("NthEvent");
112 fpCommandFlushAt->SetParameter(parameterFlushAt);
113 parameterFlushAt = new G4UIparameter ("N", 'i', omitable = true);
114 parameterFlushAt->SetDefaultValue(100);
115 fpCommandFlushAt->SetParameter(parameterFlushAt);
116
117 fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/");
118 fpDirectorySet->SetGuidance("G4OpenGLViewer set commands.");
119
121 new G4UIcmdWithAnInteger("/vis/ogl/set/displayListLimit", this);
123 ("Set/reset display list number of primitive limit (to avoid memory exhaustion).");
124 fpCommandDisplayListLimit->SetParameterName("limit", omitable = true);
126 fpCommandDisplayListLimit->SetRange("limit>=10000");
127
129 new G4UIcommand("/vis/ogl/set/exportFormat", this);
130 fpCommandExportFormat->SetGuidance ("Set export format");
131 fpCommandExportFormat->SetGuidance ("By default, pdf/eps/svg/ps are available. Depending of viewers several other format are available.");
132 fpCommandExportFormat->SetGuidance ("Try /vis/ogl/set/exportFormat without parameters to see them.");
133 fpCommandExportFormat->SetGuidance ("Changing format will reset the incremental suffix to 0.");
134 G4UIparameter* parameterExportFormat;
135 parameterExportFormat = new G4UIparameter ("format", 's', omitable = true);
136 parameterExportFormat->SetDefaultValue("");
137 fpCommandExportFormat->SetParameter(parameterExportFormat);
138
140 new G4UIcommand("/vis/ogl/set/printFilename", this);
141 fpCommandPrintFilename->SetGuidance ("Set print filename");
142 fpCommandPrintFilename->SetGuidance ("Setting 'incremental' will increment filename by one at each new print, starting at 0");
143 G4UIparameter* parameterPrintFilename;
144 parameterPrintFilename = new G4UIparameter ("name", 's', omitable = true);
145 parameterPrintFilename->SetDefaultValue("G4OpenGL");
146 fpCommandPrintFilename->SetParameter(parameterPrintFilename);
147 parameterPrintFilename = new G4UIparameter ("incremental", 'b', omitable = true);
148 parameterPrintFilename->SetDefaultValue(1);
149 fpCommandPrintFilename->SetParameter(parameterPrintFilename);
150
151 fpCommandPrintMode = new G4UIcmdWithAString("/vis/ogl/set/printMode",this);
152 fpCommandPrintMode->SetGuidance("Set print mode, only available for \"ps\" format");
153 fpCommandPrintMode->SetParameterName("print_mode",omitable = true);
154 fpCommandPrintMode->SetCandidates("vectored pixmap");
156
158 new G4UIcommand("/vis/ogl/set/printSize", this);
159 fpCommandPrintSize->SetGuidance ("Set print size");
160 fpCommandPrintSize->SetGuidance ("Tip : -1 will mean 'print size' = 'window size'");
161 fpCommandPrintSize->SetGuidance (" Setting size greater than your maximum graphic card capacity , will set the size to maximum size.");
162 G4UIparameter* parameterPrintSize;
163 parameterPrintSize = new G4UIparameter ("width", 'd', omitable = false);
164 parameterPrintSize->SetDefaultValue(-1);
165 fpCommandPrintSize->SetParameter(parameterPrintSize);
166 parameterPrintSize = new G4UIparameter ("height", 'd', omitable = false);
167 parameterPrintSize->SetDefaultValue(-1);
168 fpCommandPrintSize->SetParameter(parameterPrintSize);
169
171 new G4UIcmdWithABool("/vis/ogl/set/transparency", this);
173 ("True/false to enable/disable rendering of transparent objects.");
175 ("transparency-enabled", omitable = true);
177}
bool G4bool
Definition: G4Types.hh:86
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:146
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120
void SetDefaultValue(const char *theDefaultValue)
void SetGuidance(const char *theGuidance)
void SetParameterCandidates(const char *theString)

References fpCommandDisplayListLimit, fpCommandExport, fpCommandExportFormat, fpCommandFlushAt, fpCommandPrintFilename, fpCommandPrintMode, fpCommandPrintSize, fpCommandTransparency, fpDirectory, fpDirectorySet, G4UIcmdWithAString::SetCandidates(), G4UIcmdWithAString::SetDefaultValue(), G4UIparameter::SetDefaultValue(), G4UIcmdWithABool::SetDefaultValue(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIparameter::SetGuidance(), G4UIcommand::SetParameter(), G4UIparameter::SetParameterCandidates(), G4UIcmdWithABool::SetParameterName(), G4UIcmdWithAnInteger::SetParameterName(), G4UIcmdWithAString::SetParameterName(), and G4UIcommand::SetRange().

Referenced by GetInstance().

Member Function Documentation

◆ AddUIcommand()

void G4UImessenger::AddUIcommand ( G4UIcommand newCommand)
protectedinherited

Definition at line 149 of file G4UImessenger.cc.

150{
151 G4cerr << "Warning : Old style definition of G4UIcommand <"
152 << newCommand->GetCommandPath() << ">." << G4endl;
153}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:136

References G4cerr, G4endl, and G4UIcommand::GetCommandPath().

◆ BtoS()

G4String G4UImessenger::BtoS ( G4bool  b)
protectedinherited

Definition at line 98 of file G4UImessenger.cc.

99{
100 G4String vl = "0";
101 if(b)
102 vl = "true";
103 return vl;
104}

◆ CommandsShouldBeInMaster()

G4bool G4UImessenger::CommandsShouldBeInMaster ( ) const
inlineinherited

Definition at line 77 of file G4UImessenger.hh.

78 {
80 }
G4bool commandsShouldBeInMaster

References G4UImessenger::commandsShouldBeInMaster.

Referenced by G4UIcommand::G4UIcommandCommonConstructorCode().

◆ CreateCommand()

template<typename T >
T * G4UImessenger::CreateCommand ( const G4String cname,
const G4String dsc 
)
protectedinherited

Definition at line 110 of file G4UImessenger.hh.

111{
112 G4String path;
113 if(cname[0] != '/')
114 {
115 path = baseDirName + cname;
116 if(path[0] != '/')
117 path = "/" + path;
118 }
119
120 T* command = new T(path.c_str(), this);
121 command->SetGuidance(dsc.c_str());
122
123 return command;
124}
G4String baseDirName

References G4UImessenger::baseDirName.

◆ CreateDirectory()

void G4UImessenger::CreateDirectory ( const G4String path,
const G4String dsc,
G4bool  commandsToBeBroadcasted = true 
)
protectedinherited

Definition at line 156 of file G4UImessenger.cc.

158{
160
161 G4String fullpath = path;
162 if(fullpath.back() != '/')
163 fullpath.append("/");
164
165 G4UIcommandTree* tree = ui->GetTree()->FindCommandTree(fullpath.c_str());
166 if(tree != nullptr)
167 {
168 baseDirName = tree->GetPathName();
169 }
170 else
171 {
172 baseDir = new G4UIdirectory(fullpath.c_str(), commandsToBeBroadcasted);
173 baseDirName = fullpath;
174 baseDir->SetGuidance(dsc.c_str());
175 }
176}
const G4String & GetPathName() const
G4UIcommandTree * FindCommandTree(const char *commandPath)
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4UIdirectory * baseDir

References G4UImessenger::baseDir, G4UImessenger::baseDirName, G4UIcommandTree::FindCommandTree(), G4UIcommandTree::GetPathName(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), and G4UIcommand::SetGuidance().

Referenced by G4MoleculeShootMessenger::G4MoleculeShootMessenger(), and G4UImessenger::G4UImessenger().

◆ DtoS()

G4String G4UImessenger::DtoS ( G4double  a)
protectedinherited

Definition at line 90 of file G4UImessenger.cc.

91{
92 std::ostringstream os;
93 os << a;
94 return G4String(os.str());
95}

Referenced by G4ScoreQuantityMessenger::FilterCommands(), and G4UIcontrolMessenger::SetNewValue().

◆ GetCurrentValue()

G4String G4UImessenger::GetCurrentValue ( G4UIcommand command)
virtualinherited

Reimplemented in G4ScoreQuantityMessenger, G4VisCommandModelCreate< Factory >, G4VisCommandListManagerList< Manager >, G4VisCommandListManagerSelect< Manager >, G4VisCommandManagerMode< Manager >, G4ToolsAnalysisMessenger, G4ScoringMessenger, G4EvManMessenger, G4GeneralParticleSourceMessenger, G4ParticleGunMessenger, G4GeometryMessenger, G4GenericMessenger, G4UIcontrolMessenger, GFlashShowerModelMessenger, G4DecayTableMessenger, G4ParticleMessenger, G4ParticlePropertyMessenger, G4tgrMessenger, G4PersistencyCenterMessenger, G4ProductionCutsTableMessenger, G4SchedulerMessenger, G4VITSteppingVerbose, G4MoleculeShootMessenger, G4MoleculeGunMessenger, G4ProcessManagerMessenger, G4ProcessTableMessenger, G4MatScanMessenger, G4RunMessenger, G4UserPhysicsListMessenger, G4TrackingMessenger, G4GMocrenMessenger, G4HepRepMessenger, G4VisCommandAbortReviewKeptEvents, G4VisCommandDrawOnlyToBeKeptEvents, G4VisCommandEnable, G4VisCommandList, G4VisCommandReviewKeptEvents, G4VisCommandVerbose, G4VisCommandGeometryList, G4VisCommandGeometryRestore, G4VisCommandGeometrySetColour, G4VisCommandGeometrySetDaughtersInvisible, G4VisCommandGeometrySetForceAuxEdgeVisible, G4VisCommandGeometrySetForceCloud, G4VisCommandGeometrySetForceSolid, G4VisCommandGeometrySetForceLineSegmentsPerCircle, G4VisCommandGeometrySetForceWireframe, G4VisCommandGeometrySetLineStyle, G4VisCommandGeometrySetLineWidth, G4VisCommandGeometrySetVisibility, G4VisCommandSceneActivateModel, G4VisCommandSceneCreate, G4VisCommandSceneEndOfEventAction, G4VisCommandSceneEndOfRunAction, G4VisCommandSceneList, G4VisCommandSceneNotifyHandlers, G4VisCommandSceneRemoveModel, G4VisCommandSceneSelect, G4VisCommandSceneShowExtents, G4VisCommandSceneAddArrow, G4VisCommandSceneAddArrow2D, G4VisCommandSceneAddAxes, G4VisCommandSceneAddDate, G4VisCommandSceneAddDigis, G4VisCommandSceneAddEventID, G4VisCommandSceneAddExtent, G4VisCommandSceneAddElectricField, G4VisCommandSceneAddFrame, G4VisCommandSceneAddGPS, G4VisCommandSceneAddGhosts, G4VisCommandSceneAddHits, G4VisCommandSceneAddLine, G4VisCommandSceneAddLine2D, G4VisCommandSceneAddLocalAxes, G4VisCommandSceneAddLogicalVolume, G4VisCommandSceneAddLogo, G4VisCommandSceneAddLogo2D, G4VisCommandSceneAddMagneticField, G4VisCommandSceneAddPSHits, G4VisCommandSceneAddScale, G4VisCommandSceneAddText, G4VisCommandSceneAddText2D, G4VisCommandSceneAddTrajectories, G4VisCommandSceneAddUserAction, G4VisCommandSceneAddVolume, G4VisCommandSceneAddPlotter, G4VisCommandSceneHandlerAttach, G4VisCommandSceneHandlerCreate, G4VisCommandSceneHandlerList, G4VisCommandSceneHandlerSelect, G4VisCommandSetArrow3DLineSegmentsPerCircle, G4VisCommandSetColour, G4VisCommandSetExtentForField, G4VisCommandSetLineWidth, G4VisCommandSetTextColour, G4VisCommandSetTextLayout, G4VisCommandSetTextSize, G4VisCommandSetTouchable, G4VisCommandSetVolumeForField, G4VisCommandsTouchable, G4VisCommandsTouchableSet, G4VisCommandViewerAddCutawayPlane, G4VisCommandViewerCentreOn, G4VisCommandViewerChangeCutawayPlane, G4VisCommandViewerClear, G4VisCommandViewerClearCutawayPlanes, G4VisCommandViewerClearTransients, G4VisCommandViewerClearVisAttributesModifiers, G4VisCommandViewerClone, G4VisCommandViewerColourByDensity, G4VisCommandViewerCopyViewFrom, G4VisCommandViewerCreate, G4VisCommandViewerDolly, G4VisCommandViewerFlush, G4VisCommandViewerInterpolate, G4VisCommandViewerList, G4VisCommandViewerPan, G4VisCommandViewerReset, G4VisCommandViewerRefresh, G4VisCommandViewerRebuild, G4VisCommandViewerSave, G4VisCommandViewerScale, G4VisCommandViewerSelect, G4VisCommandViewerUpdate, G4VisCommandViewerZoom, G4VisCommandViewerDefaultHiddenEdge, G4VisCommandViewerDefaultStyle, G4VisCommandsViewerSet, G4VModelCommand< T >, G4VModelCommand< M >, G4RTMessenger, G4ASCIITreeMessenger, G4VtkMessenger, G4PolarizationMessenger, and G4DNAChemistryManager.

Definition at line 58 of file G4UImessenger.cc.

59{
60 G4String nullString;
61 return nullString;
62}

Referenced by G4UIcommand::DoIt(), and G4UIcommand::GetCurrentValue().

◆ GetInstance()

G4OpenGLViewerMessenger * G4OpenGLViewerMessenger::GetInstance ( )
static

◆ ItoS()

G4String G4UImessenger::ItoS ( G4int  i)
protectedinherited

Definition at line 82 of file G4UImessenger.cc.

83{
84 std::ostringstream os;
85 os << i;
86 return G4String(os.str());
87}

Referenced by G4GenericMessenger::DeclareMethod(), and G4ParticleGunMessenger::GetCurrentValue().

◆ operator!=()

G4bool G4UImessenger::operator!= ( const G4UImessenger messenger) const
inherited

Definition at line 76 of file G4UImessenger.cc.

77{
78 return this != &messenger;
79}

◆ operator==()

G4bool G4UImessenger::operator== ( const G4UImessenger messenger) const
inherited

Definition at line 70 of file G4UImessenger.cc.

71{
72 return this == &messenger;
73}

◆ SetNewValue()

void G4OpenGLViewerMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 195 of file G4OpenGLViewerMessenger.cc.

197{
199
200 G4VViewer* pViewer = pVisManager->GetCurrentViewer();
201 if (!pViewer) {
202 G4cout <<
203 "G4OpenGLViewerMessenger::SetNewValue: No current viewer."
204 "\n \"/vis/open\", or similar, to get one."
205 << G4endl;
206 return;
207 }
208
209 G4VSceneHandler* pSceneHandler = pViewer->GetSceneHandler();
210 if (!pSceneHandler) {
211 G4cout <<
212 "G4OpenGLViewerMessenger::SetNewValue: This viewer has no scene handler."
213 "\n Shouldn't happen - please report circumstances."
214 "\n (Viewer is \"" << pViewer->GetName() << "\".)"
215 "\n Try \"/vis/open\", or similar, to get one."
216 << G4endl;
217 return;
218 }
219
220 G4OpenGLViewer* pOGLViewer = dynamic_cast<G4OpenGLViewer*>(pViewer);
221 if (!pOGLViewer) {
222 G4cout <<
223 "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type"
224 "\n OGL. (It is \""
225 << pViewer->GetName() <<
226 "\".)\n Use \"/vis/viewer/select\" or \"/vis/open\"."
227 << G4endl;
228 return;
229 }
230
231 G4OpenGLSceneHandler* pOGLSceneHandler =
232 dynamic_cast<G4OpenGLSceneHandler*>(pSceneHandler);
233 if (!pOGLSceneHandler) {
234 G4cout <<
235 "G4OpenGLViewerMessenger::SetNewValue: Current scene handler is not of type"
236 "\n OGL. (Viewer is \"" << pViewer->GetName() << "\".)"
237 "\n (Scene handler is \"" << pSceneHandler->GetName() << "\".)"
238 "\n Use \"/vis/sceneHandler/list\" and \"/vis/sceneHandler/select\""
239 "\n or \"/vis/open\"."
240 << G4endl;
241 return;
242 }
243
244 if (command == fpCommandExport)
245 {
247 G4int width,height;
248 std::istringstream iss(newValue);
249 iss >> name >> width >> height;
250 pOGLViewer->exportImage(name, width, height);
251
252 if (pOGLViewer->fVP.IsAutoRefresh())
253 G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
254 return;
255 }
256
257 if (command == fpCommandExportFormat)
258 {
260 std::istringstream iss(newValue);
261 iss >> name;
262 pOGLViewer->setExportImageFormat(name);
263
264 return;
265 }
266
267 if (command == fpCommandFlushAt)
268 {
269 static G4bool firstTime = true;
270 static std::map<G4String,G4OpenGLSceneHandler::FlushAction> actionMap;
271 if (firstTime) {
272 actionMap["endOfEvent"] = G4OpenGLSceneHandler::endOfEvent;
273 actionMap["endOfRun"] = G4OpenGLSceneHandler::endOfRun;
274 actionMap["eachPrimitive"] = G4OpenGLSceneHandler::eachPrimitive;
275 actionMap["NthPrimitive"] = G4OpenGLSceneHandler::NthPrimitive;
276 actionMap["NthEvent"] = G4OpenGLSceneHandler::NthEvent;
277 actionMap["never"] = G4OpenGLSceneHandler::never;
278 firstTime = false;
279 }
281 G4int entitiesFlushInterval;
282 std::istringstream iss(newValue);
283 iss >> action >> entitiesFlushInterval;
284 pOGLSceneHandler->SetFlushAction(actionMap[action]);
285 pOGLSceneHandler->SetEntitiesFlushInterval(entitiesFlushInterval);
286 return;
287 }
288
289 if (command == fpCommandPrintFilename)
290 {
292 G4bool inc;
293 std::istringstream iss(newValue);
294 iss >> name
295 >> inc;
296 pOGLViewer->setExportFilename(name,inc);
297 return;
298 }
299
300 if (command == fpCommandPrintMode)
301 {
302 if (newValue == "vectored") pOGLViewer->fVectoredPs = true;
303
304 if (newValue == "pixmap") pOGLViewer->fVectoredPs = false;
305 return;
306 }
307
308 if (command == fpCommandPrintSize)
309 {
310 G4int width,height;
311 std::istringstream iss(newValue);
312 iss >> width
313 >> height;
314 pOGLViewer->setExportSize(width,height);
315 return;
316 }
317
318 if (command == fpCommandTransparency)
319 {
320 pOGLViewer->transparency_enabled = command->ConvertToBool(newValue);
321 if (pOGLViewer->fVP.IsAutoRefresh())
322 G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
323 return;
324 }
325
326 // Stored viewer commands
327 G4OpenGLStoredViewer* pOGLSViewer =
328 dynamic_cast<G4OpenGLStoredViewer*>(pViewer);
329
330 if (!pOGLSViewer)
331 {
332 G4cout <<
333 "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type OGLS."
334 "\n (It is \"" << pViewer->GetName() << "\".)"
335 "\n This feature is only implemented for OGL Stored viewers."
336 "\n Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"."
337 << G4endl;
338 return;
339 }
340
341 // Scene handler commands
342 G4OpenGLStoredSceneHandler* pOGLSSceneHandler =
343 dynamic_cast<G4OpenGLStoredSceneHandler*>(pViewer->GetSceneHandler());
344
345 if (!pOGLSSceneHandler) {
346 G4cout <<
347 "G4OpenGLViewerMessenger::SetNewValue: Current scene handler is not of type"
348 "\n OGLS (Stored). (Viewer is \"" << pViewer->GetName() << "\".)"
349 "\n (Scene handler is \"" << pSceneHandler->GetName() << "\".)"
350 "\n This feature is only implemented for OGL Stored"
351 "\n scene handlers. Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"."
352 << G4endl;
353 return;
354 }
355
356 if (command == fpCommandDisplayListLimit)
357 {
358 G4int displayListLimit =
360 pOGLSSceneHandler->SetDisplayListLimit(displayListLimit);
361 return;
362 }
363}
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cout
static void SetFlushAction(FlushAction action)
static void SetEntitiesFlushInterval(G4int interval)
static void SetDisplayListLimit(G4int lim)
bool setExportImageFormat(std::string format, bool quiet=false)
bool setExportFilename(G4String name, G4bool inc=true)
void setExportSize(G4int, G4int)
G4bool transparency_enabled
virtual bool exportImage(std::string name="", int width=-1, int height=-1)
static G4int GetNewIntValue(const char *paramString)
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:545
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
const G4String & GetName() const
const G4String & GetName() const
G4ViewParameters fVP
Definition: G4VViewer.hh:219
G4VSceneHandler * GetSceneHandler() const
G4bool IsAutoRefresh() const
G4VViewer * GetCurrentViewer() const
static G4VisManager * GetInstance()
const char * name(G4int ptype)

References geant4_check_module_cycles::action, G4UImanager::ApplyCommand(), G4UIcommand::ConvertToBool(), G4OpenGLSceneHandler::eachPrimitive, G4OpenGLSceneHandler::endOfEvent, G4OpenGLSceneHandler::endOfRun, G4OpenGLViewer::exportImage(), fpCommandDisplayListLimit, fpCommandExport, fpCommandExportFormat, fpCommandFlushAt, fpCommandPrintFilename, fpCommandPrintMode, fpCommandPrintSize, fpCommandTransparency, G4OpenGLViewer::fVectoredPs, G4VViewer::fVP, G4cout, G4endl, G4VisManager::GetCurrentViewer(), G4VisManager::GetInstance(), G4VSceneHandler::GetName(), G4VViewer::GetName(), G4UIcmdWithAnInteger::GetNewIntValue(), G4VViewer::GetSceneHandler(), G4UImanager::GetUIpointer(), G4ViewParameters::IsAutoRefresh(), G4InuclParticleNames::name(), G4OpenGLSceneHandler::never, G4OpenGLSceneHandler::NthEvent, G4OpenGLSceneHandler::NthPrimitive, G4OpenGLStoredSceneHandler::SetDisplayListLimit(), G4OpenGLSceneHandler::SetEntitiesFlushInterval(), G4OpenGLViewer::setExportFilename(), G4OpenGLViewer::setExportImageFormat(), G4OpenGLViewer::setExportSize(), G4OpenGLSceneHandler::SetFlushAction(), and G4OpenGLViewer::transparency_enabled.

◆ StoB()

G4bool G4UImessenger::StoB ( G4String  s)
protectedinherited

Definition at line 137 of file G4UImessenger.cc.

138{
140 G4bool vl = false;
141 if(v == "Y" || v == "YES" || v == "1" || v == "T" || v == "TRUE")
142 {
143 vl = true;
144 }
145 return vl;
146}
G4String to_upper_copy(G4String str)
Return uppercase copy of string.

References G4StrUtil::to_upper_copy().

Referenced by G4LocalThreadCoutMessenger::SetNewValue(), G4CascadeParamMessenger::SetNewValue(), G4ScoreQuantityMessenger::SetNewValue(), and G4ScoringMessenger::SetNewValue().

◆ StoD()

G4double G4UImessenger::StoD ( G4String  s)
protectedinherited

◆ StoI()

G4int G4UImessenger::StoI ( G4String  s)
protectedinherited

◆ StoL()

G4long G4UImessenger::StoL ( G4String  s)
protectedinherited

Definition at line 117 of file G4UImessenger.cc.

118{
119 G4long vl;
120 const char* t = str;
121 std::istringstream is(t);
122 is >> vl;
123 return vl;
124}
long G4long
Definition: G4Types.hh:87

Referenced by G4RunMessenger::SetNewValue().

Field Documentation

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir = nullptr
protectedinherited

◆ baseDirName

G4String G4UImessenger::baseDirName = ""
protectedinherited

◆ commandsShouldBeInMaster

G4bool G4UImessenger::commandsShouldBeInMaster = false
protectedinherited

◆ fpCommandDisplayListLimit

G4UIcmdWithAnInteger* G4OpenGLViewerMessenger::fpCommandDisplayListLimit
private

◆ fpCommandExport

G4UIcommand* G4OpenGLViewerMessenger::fpCommandExport
private

◆ fpCommandExportFormat

G4UIcommand* G4OpenGLViewerMessenger::fpCommandExportFormat
private

◆ fpCommandFlushAt

G4UIcommand* G4OpenGLViewerMessenger::fpCommandFlushAt
private

◆ fpCommandPrintFilename

G4UIcommand* G4OpenGLViewerMessenger::fpCommandPrintFilename
private

◆ fpCommandPrintMode

G4UIcmdWithAString* G4OpenGLViewerMessenger::fpCommandPrintMode
private

◆ fpCommandPrintSize

G4UIcommand* G4OpenGLViewerMessenger::fpCommandPrintSize
private

◆ fpCommandTransparency

G4UIcmdWithABool* G4OpenGLViewerMessenger::fpCommandTransparency
private

◆ fpDirectory

G4UIdirectory* G4OpenGLViewerMessenger::fpDirectory
private

Definition at line 53 of file G4OpenGLViewerMessenger.hh.

Referenced by G4OpenGLViewerMessenger(), and ~G4OpenGLViewerMessenger().

◆ fpDirectorySet

G4UIdirectory* G4OpenGLViewerMessenger::fpDirectorySet
private

Definition at line 57 of file G4OpenGLViewerMessenger.hh.

Referenced by G4OpenGLViewerMessenger(), and ~G4OpenGLViewerMessenger().

◆ fpInstance

G4OpenGLViewerMessenger * G4OpenGLViewerMessenger::fpInstance = 0
staticprivate

Definition at line 51 of file G4OpenGLViewerMessenger.hh.

Referenced by GetInstance(), and ~G4OpenGLViewerMessenger().


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