Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisCommandSceneAddAxes Class Reference

#include <G4VisCommandsSceneAdd.hh>

+ Inheritance diagram for G4VisCommandSceneAddAxes:

Public Member Functions

 G4VisCommandSceneAddAxes ()
 
virtual ~G4VisCommandSceneAddAxes ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4VVisCommandScene
 G4VVisCommandScene ()
 
virtual ~G4VVisCommandScene ()
 
- Public Member Functions inherited from G4VVisCommand
 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
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 G4VVisCommandScene
G4String CurrentSceneName ()
 
- 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)
 
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 79 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddAxes()

G4VisCommandSceneAddAxes::G4VisCommandSceneAddAxes ( )

Definition at line 264 of file G4VisCommandsSceneAdd.cc.

264 {
265 G4bool omitable;
266 fpCommand = new G4UIcommand ("/vis/scene/add/axes", this);
267 fpCommand -> SetGuidance ("Add axes.");
268 fpCommand -> SetGuidance
269 ("Draws axes at (x0, y0, z0) of given length and colour.");
270 G4UIparameter* parameter;
271 parameter = new G4UIparameter ("x0", 'd', omitable = true);
272 parameter->SetDefaultValue (0.);
273 fpCommand->SetParameter (parameter);
274 parameter = new G4UIparameter ("y0", 'd', omitable = true);
275 parameter->SetDefaultValue (0.);
276 fpCommand->SetParameter (parameter);
277 parameter = new G4UIparameter ("z0", 'd', omitable = true);
278 parameter->SetDefaultValue (0.);
279 fpCommand->SetParameter (parameter);
280 parameter = new G4UIparameter ("length", 'd', omitable = true);
281 parameter->SetDefaultValue (-1.);
282 parameter->SetGuidance
283 ("If negative, length automatic, about 25% of scene extent.");
284 fpCommand->SetParameter (parameter);
285 parameter = new G4UIparameter ("unit", 's', omitable = true);
286 parameter->SetDefaultValue ("m");
287 fpCommand->SetParameter (parameter);
288 parameter = new G4UIparameter ("unitcolour", 's', omitable = true);
289 parameter->SetDefaultValue ("auto");
290 parameter->SetGuidance
291 ("If \"auto\", x, y and z will be red, green and blue respectively.");
292 parameter->SetGuidance
293 ("Otherwise choose from the pre-defined text-specified colours - "
294 "\n see information printed by the vis manager at start-up or"
295 "\n use \"/vis/list\".");
296 fpCommand->SetParameter (parameter);
297}
bool G4bool
Definition: G4Types.hh:67
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:147
void SetDefaultValue(const char *theDefaultValue)
void SetGuidance(const char *theGuidance)

◆ ~G4VisCommandSceneAddAxes()

G4VisCommandSceneAddAxes::~G4VisCommandSceneAddAxes ( )
virtual

Definition at line 299 of file G4VisCommandsSceneAdd.cc.

299 {
300 delete fpCommand;
301}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddAxes::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 303 of file G4VisCommandsSceneAdd.cc.

303 {
304 return "";
305}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 307 of file G4VisCommandsSceneAdd.cc.

307 {
308
310 G4bool warn(verbosity >= G4VisManager::warnings);
311
313 if (!pScene) {
314 if (verbosity >= G4VisManager::errors) {
315 G4cout << "ERROR: No current scene. Please create one." << G4endl;
316 }
317 return;
318 }
319
320 G4String unitString, colourString;
321 G4double x0, y0, z0, length;
322 std::istringstream is (newValue);
323 is >> x0 >> y0 >> z0 >> length >> unitString >> colourString;
324
325 G4double unit = G4UIcommand::ValueOf(unitString);
326 x0 *= unit; y0 *= unit; z0 *= unit;
327 const G4VisExtent& sceneExtent = pScene->GetExtent(); // Existing extent.
328 if (length < 0.) {
329 length = 0.5 * sceneExtent.GetExtentRadius();
330 G4double intLog10Length = std::floor(std::log10(length));
331 length = std::pow(10,intLog10Length);
332 } else {
333 length *= unit;
334 }
335 G4String annotation = G4BestUnit(length,"Length");
336
337 // Consult scene for arrow width...
338 G4double arrowWidth =
339 0.005 * fCurrentLineWidth * sceneExtent.GetExtentRadius();
340 // ...but limit it to length/50.
341 if (arrowWidth > length/50.) arrowWidth = length/50.;
342
343 G4VModel* model = new G4AxesModel
344 (x0, y0, z0, length, arrowWidth, colourString, newValue);
345
346 G4bool successful = pScene -> AddRunDurationModel (model, warn);
347 const G4String& currentSceneName = pScene -> GetName ();
348 if (successful) {
349 if (verbosity >= G4VisManager::confirmations) {
350 G4cout << "Axes have been added to scene \"" << currentSceneName << "\"."
351 << G4endl;
352 }
353 }
354 else G4VisCommandsSceneAddUnsuccessful(verbosity);
355 UpdateVisManagerScene (currentSceneName);
356}
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
double G4double
Definition: G4Types.hh:64
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
const G4VisExtent & GetExtent() const
static G4double ValueOf(const char *unitName)
Definition: G4UIcommand.cc:288
static G4VisManager * fpVisManager
static G4double fCurrentLineWidth
void UpdateVisManagerScene(const G4String &sceneName="")
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:73
G4Scene * GetCurrentScene() const
static Verbosity GetVerbosity()

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