Geant4  10.02.p03
G4VisCommandSceneAddText2D Class Reference

#include <G4VisCommandsSceneAdd.hh>

Inheritance diagram for G4VisCommandSceneAddText2D:
Collaboration diagram for G4VisCommandSceneAddText2D:

Classes

struct  G4Text2D
 

Public Member Functions

 G4VisCommandSceneAddText2D ()
 
virtual ~G4VisCommandSceneAddText2D ()
 
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, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Private Member Functions

 G4VisCommandSceneAddText2D (const G4VisCommandSceneAddText2D &)
 
G4VisCommandSceneAddText2Doperator= (const G4VisCommandSceneAddText2D &)
 

Private Attributes

G4UIcommandfpCommand
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *)
 
static const G4ColourGetCurrentColour ()
 
static G4double GetCurrentLineWidth ()
 
static const G4ColourGetCurrentTextColour ()
 
static G4Text::Layout GetCurrentTextLayout ()
 
static G4double GetCurrentTextSize ()
 
- 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, 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
 
G4bool commandsShouldBeInMaster
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4double fCurrentLineWidth = 1.
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentTextSize = 12.
 
static G4ModelingParameters::PVNameCopyNoPath fCurrentTouchablePath
 

Detailed Description

Definition at line 367 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddText2D() [1/2]

G4VisCommandSceneAddText2D::G4VisCommandSceneAddText2D ( )

Definition at line 2338 of file G4VisCommandsSceneAdd.cc.

2338  {
2339  G4bool omitable;
2340  fpCommand = new G4UIcommand ("/vis/scene/add/text2D", this);
2341  fpCommand -> SetGuidance ("Adds 2D text to current scene.");
2342  fpCommand -> SetGuidance
2343  ("Use \"/vis/set/textColour\" to set colour.");
2344  fpCommand -> SetGuidance
2345  ("Use \"/vis/set/textLayout\" to set layout:");
2346  G4UIparameter* parameter;
2347  parameter = new G4UIparameter ("x", 'd', omitable = true);
2348  parameter->SetDefaultValue (0);
2349  fpCommand->SetParameter (parameter);
2350  parameter = new G4UIparameter ("y", 'd', omitable = true);
2351  parameter->SetDefaultValue (0);
2352  fpCommand->SetParameter (parameter);
2353  parameter = new G4UIparameter ("font_size", 'd', omitable = true);
2354  parameter->SetDefaultValue (12);
2355  parameter->SetGuidance ("pixels");
2356  fpCommand->SetParameter (parameter);
2357  parameter = new G4UIparameter ("x_offset", 'd', omitable = true);
2358  parameter->SetDefaultValue (0);
2359  parameter->SetGuidance ("pixels");
2360  fpCommand->SetParameter (parameter);
2361  parameter = new G4UIparameter ("y_offset", 'd', omitable = true);
2362  parameter->SetDefaultValue (0);
2363  parameter->SetGuidance ("pixels");
2364  fpCommand->SetParameter (parameter);
2365  parameter = new G4UIparameter ("text", 's', omitable = true);
2366  parameter->SetGuidance ("The rest of the line is text.");
2367  parameter->SetDefaultValue ("Hello G4");
2368  fpCommand->SetParameter (parameter);
2369 }
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetDefaultValue(const char *theDefaultValue)
bool G4bool
Definition: G4Types.hh:79
void SetGuidance(const char *theGuidance)
Here is the call graph for this function:

◆ ~G4VisCommandSceneAddText2D()

G4VisCommandSceneAddText2D::~G4VisCommandSceneAddText2D ( )
virtual

Definition at line 2371 of file G4VisCommandsSceneAdd.cc.

2371  {
2372  delete fpCommand;
2373 }

◆ G4VisCommandSceneAddText2D() [2/2]

G4VisCommandSceneAddText2D::G4VisCommandSceneAddText2D ( const G4VisCommandSceneAddText2D )
private

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddText2D::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 2375 of file G4VisCommandsSceneAdd.cc.

2375  {
2376  return "";
2377 }

◆ operator=()

G4VisCommandSceneAddText2D& G4VisCommandSceneAddText2D::operator= ( const G4VisCommandSceneAddText2D )
private

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 2379 of file G4VisCommandsSceneAdd.cc.

2379  {
2380 
2382  G4bool warn = verbosity >= G4VisManager::warnings;
2383 
2384  G4Scene* pScene = fpVisManager->GetCurrentScene();
2385  if (!pScene) {
2386  if (verbosity >= G4VisManager::errors) {
2387  G4cerr << "ERROR: No current scene. Please create one." << G4endl;
2388  }
2389  return;
2390  }
2391 
2392  G4Tokenizer next(newValue);
2393  G4double x = StoD(next());
2394  G4double y = StoD(next());
2395  G4double font_size = StoD(next());
2396  G4double x_offset = StoD(next());
2397  G4double y_offset = StoD(next());
2398  G4String text = next("\n");
2399 
2400  G4Text g4text(text, G4Point3D(x,y,0.));
2402  g4text.SetVisAttributes(visAtts);
2403  g4text.SetLayout(fCurrentTextLayout);
2404  g4text.SetScreenSize(font_size);
2405  g4text.SetOffset(x_offset,y_offset);
2406  G4Text2D* g4text2D = new G4Text2D(g4text);
2407  G4VModel* model =
2409  model->SetType("Text2D");
2410  model->SetGlobalTag("Text2D");
2411  model->SetGlobalDescription("Text2D: " + newValue);
2412  const G4String& currentSceneName = pScene -> GetName ();
2413  G4bool successful = pScene -> AddRunDurationModel (model, warn);
2414  if (successful) {
2415  if (verbosity >= G4VisManager::confirmations) {
2416  G4cout << "2D text \"" << text
2417  << "\" has been added to scene \"" << currentSceneName << "\"."
2418  << G4endl;
2419  }
2420  }
2421  else G4VisCommandsSceneAddUnsuccessful(verbosity);
2422  UpdateVisManagerScene (currentSceneName);
2423 }
void SetGlobalTag(const G4String &)
Definition: G4Text.hh:73
G4Scene * GetCurrentScene() const
void UpdateVisManagerScene(const G4String &sceneName="")
static G4Text::Layout fCurrentTextLayout
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
static void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
Double_t y
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
void SetType(const G4String &)
G4double StoD(G4String s)
static G4Colour fCurrentTextColour
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetGlobalDescription(const G4String &)
G4GLOB_DLL std::ostream G4cerr
static G4VisManager * fpVisManager
Here is the call graph for this function:

Member Data Documentation

◆ fpCommand

G4UIcommand* G4VisCommandSceneAddText2D::fpCommand
private

Definition at line 382 of file G4VisCommandsSceneAdd.hh.


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