Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4VisCommandSceneAddText2D Class Reference

#include <G4VisCommandsSceneAdd.hh>

Inheritance diagram for G4VisCommandSceneAddText2D:
Collaboration diagram for G4VisCommandSceneAddText2D:

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
 

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 G4int fErrorCode = 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::G4VisCommandSceneAddText2D ( )

Definition at line 2350 of file G4VisCommandsSceneAdd.cc.

2350  {
2351  G4bool omitable;
2352  fpCommand = new G4UIcommand ("/vis/scene/add/text2D", this);
2353  fpCommand -> SetGuidance ("Adds 2D text to current scene.");
2354  fpCommand -> SetGuidance
2355  ("Use \"/vis/set/textColour\" to set colour.");
2356  fpCommand -> SetGuidance
2357  ("Use \"/vis/set/textLayout\" to set layout:");
2358  G4UIparameter* parameter;
2359  parameter = new G4UIparameter ("x", 'd', omitable = true);
2360  parameter->SetDefaultValue (0);
2361  fpCommand->SetParameter (parameter);
2362  parameter = new G4UIparameter ("y", 'd', omitable = true);
2363  parameter->SetDefaultValue (0);
2364  fpCommand->SetParameter (parameter);
2365  parameter = new G4UIparameter ("font_size", 'd', omitable = true);
2366  parameter->SetDefaultValue (12);
2367  parameter->SetGuidance ("pixels");
2368  fpCommand->SetParameter (parameter);
2369  parameter = new G4UIparameter ("x_offset", 'd', omitable = true);
2370  parameter->SetDefaultValue (0);
2371  parameter->SetGuidance ("pixels");
2372  fpCommand->SetParameter (parameter);
2373  parameter = new G4UIparameter ("y_offset", 'd', omitable = true);
2374  parameter->SetDefaultValue (0);
2375  parameter->SetGuidance ("pixels");
2376  fpCommand->SetParameter (parameter);
2377  parameter = new G4UIparameter ("text", 's', omitable = true);
2378  parameter->SetGuidance ("The rest of the line is text.");
2379  parameter->SetDefaultValue ("Hello G4");
2380  fpCommand->SetParameter (parameter);
2381 }
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 ( )
virtual

Definition at line 2383 of file G4VisCommandsSceneAdd.cc.

2383  {
2384  delete fpCommand;
2385 }

Member Function Documentation

G4String G4VisCommandSceneAddText2D::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 2387 of file G4VisCommandsSceneAdd.cc.

2387  {
2388  return "";
2389 }
void G4VisCommandSceneAddText2D::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 2391 of file G4VisCommandsSceneAdd.cc.

2391  {
2392 
2394  G4bool warn = verbosity >= G4VisManager::warnings;
2395 
2396  G4Scene* pScene = fpVisManager->GetCurrentScene();
2397  if (!pScene) {
2398  if (verbosity >= G4VisManager::errors) {
2399  G4cerr << "ERROR: No current scene. Please create one." << G4endl;
2400  }
2401  return;
2402  }
2403 
2404  G4Tokenizer next(newValue);
2405  G4double x = StoD(next());
2406  G4double y = StoD(next());
2407  G4double font_size = StoD(next());
2408  G4double x_offset = StoD(next());
2409  G4double y_offset = StoD(next());
2410  G4String text = next("\n");
2411 
2412  G4Text g4text(text, G4Point3D(x,y,0.));
2414  g4text.SetVisAttributes(visAtts);
2415  g4text.SetLayout(fCurrentTextLayout);
2416  g4text.SetScreenSize(font_size);
2417  g4text.SetOffset(x_offset,y_offset);
2418  G4Text2D* g4text2D = new G4Text2D(g4text);
2419  G4VModel* model =
2421  model->SetType("Text2D");
2422  model->SetGlobalTag("Text2D");
2423  model->SetGlobalDescription("Text2D: " + newValue);
2424  const G4String& currentSceneName = pScene -> GetName ();
2425  G4bool successful = pScene -> AddRunDurationModel (model, warn);
2426  if (successful) {
2427  if (verbosity >= G4VisManager::confirmations) {
2428  G4cout << "2D text \"" << text
2429  << "\" has been added to scene \"" << currentSceneName << "\"."
2430  << G4endl;
2431  }
2432  }
2433  else G4VisCommandsSceneAddUnsuccessful(verbosity);
2434  UpdateVisManagerScene (currentSceneName);
2435 }
void SetGlobalTag(const G4String &)
Definition: G4Text.hh:73
void UpdateVisManagerScene(const G4String &sceneName="")
static G4Text::Layout fCurrentTextLayout
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
static void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
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
const XML_Char XML_Content * model
Definition: expat.h:151
void SetGlobalDescription(const G4String &)
G4Scene * GetCurrentScene() const
G4GLOB_DLL std::ostream G4cerr
static G4VisManager * fpVisManager

Here is the call graph for this function:


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