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

#include <G4VisCommandsSceneAdd.hh>

+ Inheritance diagram for G4VisCommandSceneAddDate:

Public Member Functions

 G4VisCommandSceneAddDate ()
 
virtual ~G4VisCommandSceneAddDate ()
 
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 91 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddDate()

G4VisCommandSceneAddDate::G4VisCommandSceneAddDate ( )

Definition at line 360 of file G4VisCommandsSceneAdd.cc.

360 {
361 G4bool omitable;
362 fpCommand = new G4UIcommand ("/vis/scene/add/date", this);
363 fpCommand -> SetGuidance ("Adds date to current scene.");
364 G4UIparameter* parameter;
365 parameter = new G4UIparameter ("size", 'i', omitable = true);
366 parameter -> SetGuidance ("Screen size of text in pixels.");
367 parameter -> SetDefaultValue (18);
368 fpCommand -> SetParameter (parameter);
369 parameter = new G4UIparameter ("x-position", 'd', omitable = true);
370 parameter -> SetGuidance ("x screen position in range -1 < x < 1.");
371 parameter -> SetDefaultValue (0.0); // Would prefer 0.95 right.
372 fpCommand -> SetParameter (parameter);
373 parameter = new G4UIparameter ("y-position", 'd', omitable = true);
374 parameter -> SetGuidance ("y screen position in range -1 < y < 1.");
375 parameter -> SetDefaultValue (0.9);
376 fpCommand -> SetParameter (parameter);
377 parameter = new G4UIparameter ("layout", 's', omitable = true);
378 parameter -> SetGuidance ("Layout, i.e., adjustment: left|centre|right.");
379 parameter -> SetDefaultValue ("left"); // Would prefer right.
380 fpCommand -> SetParameter (parameter);
381 parameter = new G4UIparameter ("date", 's', omitable = true);
382 parameter -> SetGuidance
383 ("The date you want to appear on the view of the scene (this includes the"
384 "\nrest of the line, including spaces). The default, \'-\', writes the"
385 "\ndate and time of the moment of drawing.");
386 parameter -> SetDefaultValue ("-");
387 fpCommand -> SetParameter (parameter);
388}
bool G4bool
Definition: G4Types.hh:67

◆ ~G4VisCommandSceneAddDate()

G4VisCommandSceneAddDate::~G4VisCommandSceneAddDate ( )
virtual

Definition at line 390 of file G4VisCommandsSceneAdd.cc.

390 {
391 delete fpCommand;
392}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddDate::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 394 of file G4VisCommandsSceneAdd.cc.

394 {
395 return "";
396}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 398 of file G4VisCommandsSceneAdd.cc.

399{
401 G4bool warn(verbosity >= G4VisManager::warnings);
402
404 if (!pScene) {
405 if (verbosity >= G4VisManager::errors) {
406 G4cout << "ERROR: No current scene. Please create one." << G4endl;
407 }
408 return;
409 }
410
411 G4int size;
412 G4double x, y;
413 G4String layoutString, dateString;
414 std::istringstream is(newValue);
415 is >> size >> x >> y >> layoutString >> dateString;
416 // Read rest of line, if any.
417 const size_t NREMAINDER = 100;
418 char remainder[NREMAINDER];
419 is.getline(remainder, NREMAINDER);
420 dateString += remainder;
422 if (layoutString(0) == 'l') layout = G4Text::left;
423 else if (layoutString(0) == 'c') layout = G4Text::centre;
424 else if (layoutString(0) == 'r') layout = G4Text::right;
425
426 Date* date = new Date(fpVisManager, size, x, y, layout, dateString);
427 G4VModel* model =
429 model->SetType("Date");
430 model->SetGlobalTag("Date");
431 model->SetGlobalDescription("Date");
432 const G4String& currentSceneName = pScene -> GetName ();
433 G4bool successful = pScene -> AddRunDurationModel (model, warn);
434 if (successful) {
435 if (verbosity >= G4VisManager::confirmations) {
436 G4cout << "Date has been added to scene \""
437 << currentSceneName << "\"."
438 << G4endl;
439 }
440 }
441 else G4VisCommandsSceneAddUnsuccessful(verbosity);
442 UpdateVisManagerScene (currentSceneName);
443}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
Layout
Definition: G4Text.hh:77
@ centre
Definition: G4Text.hh:77
@ right
Definition: G4Text.hh:77
@ left
Definition: G4Text.hh:77
void SetType(const G4String &)
void SetGlobalDescription(const G4String &)
void SetGlobalTag(const G4String &)
static G4VisManager * fpVisManager
void UpdateVisManagerScene(const G4String &sceneName="")
G4Scene * GetCurrentScene() const
static Verbosity GetVerbosity()

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