Geant4  10.02.p03
G4VisCommandSetColour Class Reference

#include <G4VisCommandsSet.hh>

Inheritance diagram for G4VisCommandSetColour:
Collaboration 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, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Private Member Functions

 G4VisCommandSetColour (const G4VisCommandSetColour &)
 
G4VisCommandSetColouroperator= (const G4VisCommandSetColour &)
 

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 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 41 of file G4VisCommandsSet.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSetColour() [1/2]

G4VisCommandSetColour::G4VisCommandSetColour ( )

Definition at line 42 of file G4VisCommandsSet.cc.

43 {
44  G4bool omitable;
45  fpCommand = new G4UIcommand("/vis/set/colour", this);
47  ("Defines colour and opacity for future \"/vis/scene/add/\" commands.");
49  ("(Except \"/vis/scene/add/text\" commands - see \"/vis/set/textColour\".)");
50  fpCommand->SetGuidance("Default: white and opaque.");
51  G4UIparameter* parameter;
52  parameter = new G4UIparameter ("red", 's', omitable = true);
53  parameter->SetGuidance
54  ("Red component or a string, e.g., \"cyan\" (green and blue parameters are ignored).");
55  parameter->SetDefaultValue ("1.");
56  fpCommand->SetParameter (parameter);
57  parameter = new G4UIparameter ("green", 'd', omitable = true);
58  parameter->SetDefaultValue (1.);
59  fpCommand->SetParameter (parameter);
60  parameter = new G4UIparameter ("blue", 'd', omitable = true);
61  parameter->SetDefaultValue (1.);
62  fpCommand->SetParameter (parameter);
63  parameter = new G4UIparameter ("alpha", 'd', omitable = true);
64  parameter->SetDefaultValue (1.);
65  parameter->SetGuidance ("Opacity");
66  fpCommand->SetParameter (parameter);
67 }
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetDefaultValue(const char *theDefaultValue)
bool G4bool
Definition: G4Types.hh:79
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetGuidance(const char *theGuidance)
Here is the call graph for this function:

◆ ~G4VisCommandSetColour()

G4VisCommandSetColour::~G4VisCommandSetColour ( )
virtual

Definition at line 69 of file G4VisCommandsSet.cc.

70 {
71  delete fpCommand;
72 }

◆ G4VisCommandSetColour() [2/2]

G4VisCommandSetColour::G4VisCommandSetColour ( const G4VisCommandSetColour )
private

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSetColour::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 74 of file G4VisCommandsSet.cc.

◆ operator=()

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

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 79 of file G4VisCommandsSet.cc.

80 {
82 
83  G4String redOrString;
84  G4double green, blue, opacity;
85  std::istringstream iss(newValue);
86  iss >> redOrString >> green >> blue >> opacity;
87 
88  G4Colour colour(1,1,1,1); // Default white and opaque.
89  if (std::isalpha(redOrString(0))) {
90  if (!G4Colour::GetColour(redOrString, colour)) {
91  if (verbosity >= G4VisManager::warnings) {
92  G4cout << "WARNING: Colour \"" << redOrString
93  << "\" not found. Defaulting to white and opaque."
94  << G4endl;
95  }
96  }
97  } else {
98  colour = G4Colour
99  (G4UIcommand::ConvertToDouble(redOrString), green, blue);
100  }
101  // Add opacity
103  (colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
104 
105  if (verbosity >= G4VisManager::confirmations) {
106  G4cout <<
107  "Colour for future \"/vis/scene/add/\" commands has been set to "
108  << fCurrentColour <<
109  ".\n(Except \"/vis/scene/add/text\" commands - use \"/vis/set/textColour\".)"
110  << G4endl;
111  }
112 }
static G4Colour fCurrentColour
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:126
Definition: test07.cc:36
G4GLOB_DLL std::ostream G4cout
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:443
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static G4VisManager * fpVisManager
Here is the call graph for this function:

Member Data Documentation

◆ fpCommand

G4UIcommand* G4VisCommandSetColour::fpCommand
private

Definition at line 50 of file G4VisCommandsSet.hh.


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