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

#include <G4VisCommandsSet.hh>

+ Inheritance diagram for G4VisCommandSetColour:

Public Member Functions

 G4VisCommandSetColour ()
 
virtual ~G4VisCommandSetColour ()
 
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 42 of file G4VisCommandsSet.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSetColour()

G4VisCommandSetColour::G4VisCommandSetColour ( )

Definition at line 43 of file G4VisCommandsSet.cc.

44{
45 G4bool omitable;
46 fpCommand = new G4UIcommand("/vis/set/colour", this);
47 fpCommand->SetGuidance
48 ("Defines colour and opacity for future \"/vis/scene/add/\" commands.");
49 fpCommand->SetGuidance
50 ("(Except \"/vis/scene/add/text\" commands - see \"/vis/set/textColour\".)");
51 fpCommand->SetGuidance("Default: white and opaque.");
52 G4UIparameter* parameter;
53 parameter = new G4UIparameter ("red", 's', omitable = true);
54 parameter->SetGuidance
55 ("Red component or a string, e.g., \"cyan\" (green and blue parameters are ignored).");
56 parameter->SetDefaultValue ("1.");
57 fpCommand->SetParameter (parameter);
58 parameter = new G4UIparameter ("green", 'd', omitable = true);
59 parameter->SetDefaultValue (1.);
60 fpCommand->SetParameter (parameter);
61 parameter = new G4UIparameter ("blue", 'd', omitable = true);
62 parameter->SetDefaultValue (1.);
63 fpCommand->SetParameter (parameter);
64 parameter = new G4UIparameter ("alpha", 'd', omitable = true);
65 parameter->SetDefaultValue (1.);
66 parameter->SetGuidance ("Opacity");
67 fpCommand->SetParameter (parameter);
68}
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)

◆ ~G4VisCommandSetColour()

G4VisCommandSetColour::~G4VisCommandSetColour ( )
virtual

Definition at line 70 of file G4VisCommandsSet.cc.

71{
72 delete fpCommand;
73}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSetColour::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 75 of file G4VisCommandsSet.cc.

76{
77 return G4String();
78}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 80 of file G4VisCommandsSet.cc.

81{
83
84 G4String redOrString;
85 G4double green, blue, opacity;
86 std::istringstream iss(newValue);
87 iss >> redOrString >> green >> blue >> opacity;
88
89 G4Colour colour(1,1,1,1); // Default white and opaque.
90 if (std::isalpha(redOrString(0))) {
91 if (!G4Colour::GetColour(redOrString, colour)) {
92 if (verbosity >= G4VisManager::warnings) {
93 G4cout << "WARNING: Colour \"" << redOrString
94 << "\" not found. Defaulting to white and opaque."
95 << G4endl;
96 }
97 }
98 } else {
99 colour = G4Colour
100 (G4UIcommand::ConvertToDouble(redOrString), green, blue);
101 }
102 // Add opacity
104 (colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
105
106 if (verbosity >= G4VisManager::confirmations) {
107 G4cout <<
108 "Colour for future \"/vis/scene/add/\" commands has been set to "
109 << fCurrentColour <<
110 ".\n(Except \"/vis/scene/add/text\" commands - use \"/vis/set/textColour\".)"
111 << G4endl;
112 }
113}
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 G4VisManager * fpVisManager
static G4Colour fCurrentColour
static Verbosity GetVerbosity()

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