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

#include <G4VisCommandsSet.hh>

+ Inheritance diagram for G4VisCommandSetTextColour:

Public Member Functions

 G4VisCommandSetTextColour ()
 
virtual ~G4VisCommandSetTextColour ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- 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 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 54 of file G4VisCommandsSet.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSetTextColour()

G4VisCommandSetTextColour::G4VisCommandSetTextColour ( )

Definition at line 154 of file G4VisCommandsSet.cc.

155{
156 G4bool omitable;
157 fpCommand = new G4UIcommand("/vis/set/textColour", this);
158 fpCommand->SetGuidance
159 ("Defines colour and opacity for future \"/vis/scene/add/text\" commands.");
160 fpCommand->SetGuidance("Default: blue and opaque.");
161 G4UIparameter* parameter;
162 parameter = new G4UIparameter ("red", 's', omitable = true);
163 parameter->SetGuidance
164 ("Red component or a string, e.g., \"cyan\" (green and blue parameters are ignored).");
165 parameter->SetDefaultValue ("0.");
166 fpCommand->SetParameter (parameter);
167 parameter = new G4UIparameter ("green", 'd', omitable = true);
168 parameter->SetDefaultValue (0.);
169 fpCommand->SetParameter (parameter);
170 parameter = new G4UIparameter ("blue", 'd', omitable = true);
171 parameter->SetDefaultValue (1.);
172 fpCommand->SetParameter (parameter);
173 parameter = new G4UIparameter ("alpha", 'd', omitable = true);
174 parameter->SetDefaultValue (1.);
175 parameter->SetGuidance ("Opacity");
176 fpCommand->SetParameter (parameter);
177}
bool G4bool
Definition: G4Types.hh:67
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:147
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetDefaultValue(const char *theDefaultValue)
void SetGuidance(const char *theGuidance)

◆ ~G4VisCommandSetTextColour()

G4VisCommandSetTextColour::~G4VisCommandSetTextColour ( )
virtual

Definition at line 179 of file G4VisCommandsSet.cc.

180{
181 delete fpCommand;
182}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSetTextColour::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 184 of file G4VisCommandsSet.cc.

185{
186 return G4String();
187}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 189 of file G4VisCommandsSet.cc.

190{
192
193 G4String redOrString;
194 G4double green, blue, opacity;
195 std::istringstream iss(newValue);
196 iss >> redOrString >> green >> blue >> opacity;
197
198 G4Colour colour(0,0,1,1); // Default blue and opaque.
199 if (std::isalpha(redOrString(0))) {
200 if (!G4Colour::GetColour(redOrString, colour)) {
201 if (verbosity >= G4VisManager::warnings) {
202 G4cout << "WARNING: Text colour \"" << redOrString
203 << "\" not found. Defaulting to blue and opaque."
204 << G4endl;
205 }
206 }
207 } else {
208 colour = G4Colour
209 (G4UIcommand::ConvertToDouble(redOrString), green, blue);
210 }
211 // Add opacity
213 (colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
214
215 if (verbosity >= G4VisManager::confirmations) {
216 G4cout <<
217 "Colour for future \"/vis/scene/add/text\" commands has been set to "
218 << fCurrentTextColour << '.'
219 << G4endl;
220 }
221}
double G4double
Definition: G4Types.hh:64
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:123
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:421
static G4Colour fCurrentTextColour
static G4VisManager * fpVisManager
static Verbosity GetVerbosity()

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