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

#include <G4VisCommandsSceneAdd.hh>

+ Inheritance diagram for G4VisCommandSceneAddAxes:

Public Member Functions

 G4VisCommandSceneAddAxes ()
 
virtual ~G4VisCommandSceneAddAxes ()
 
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 ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *pVisManager)
 
static const G4ColourGetCurrentTextColour ()
 
- Protected Member Functions inherited from G4VVisCommandScene
G4String CurrentSceneName ()
 
- Protected Member Functions inherited from G4VVisCommand
void SetViewParameters (G4VViewer *viewer, const G4ViewParameters &viewParams)
 
void RefreshIfRequired (G4VViewer *viewer)
 
void InterpolateViews (G4VViewer *currentViewer, std::vector< G4ViewParameters > viewVector, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
void InterpolateToNewView (G4VViewer *currentViewer, const G4ViewParameters &oldVP, const G4ViewParameters &newVP, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
const G4StringConvertToColourGuidance ()
 
void ConvertToColour (G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
 
G4bool ProvideValueOfUnit (const G4String &where, const G4String &unit, const G4String &category, G4double &value)
 
void CheckSceneAndNotifyHandlers (G4Scene *=nullptr)
 
G4bool CheckView ()
 
void G4VisCommandsSceneAddUnsuccessful (G4VisManager::Verbosity verbosity)
 
void CopyGuidanceFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
 
void CopyParametersFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd)
 
void DrawExtent (const G4VisExtent &)
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4long StoL (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 G4bool ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4int fCurrentArrow3DLineSegmentsPerCircle = 6
 
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 G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
 
static G4VisExtent fCurrentExtentForField
 
static std::vector< G4PhysicalVolumesSearchScene::FindingsfCurrrentPVFindingsForField
 

Detailed Description

Definition at line 80 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddAxes()

G4VisCommandSceneAddAxes::G4VisCommandSceneAddAxes ( )

Definition at line 258 of file G4VisCommandsSceneAdd.cc.

258 {
259 G4bool omitable;
260 fpCommand = new G4UIcommand ("/vis/scene/add/axes", this);
261 fpCommand -> SetGuidance ("Add axes.");
262 fpCommand -> SetGuidance
263 ("Draws axes at (x0, y0, z0) of given length and colour.");
264 fpCommand -> SetGuidance
265 ("If \"colour-string\" is \"auto\", x, y and z will be red, green and blue"
266 "\n respectively. Otherwise it can be one of the pre-defined text-specified"
267 "\n colours - see information printed by the vis manager at start-up or"
268 "\n use \"/vis/list\".");
269 fpCommand -> SetGuidance
270 ("If \"length\" is negative, it is set to about 25% of scene extent.");
271 fpCommand -> SetGuidance
272 ("If \"showtext\" is false, annotations are suppressed.");
273 G4UIparameter* parameter;
274 parameter = new G4UIparameter ("x0", 'd', omitable = true);
275 parameter->SetDefaultValue (0.);
276 fpCommand->SetParameter (parameter);
277 parameter = new G4UIparameter ("y0", 'd', omitable = true);
278 parameter->SetDefaultValue (0.);
279 fpCommand->SetParameter (parameter);
280 parameter = new G4UIparameter ("z0", 'd', omitable = true);
281 parameter->SetDefaultValue (0.);
282 fpCommand->SetParameter (parameter);
283 parameter = new G4UIparameter ("length", 'd', omitable = true);
284 parameter->SetDefaultValue (-1.);
285 fpCommand->SetParameter (parameter);
286 parameter = new G4UIparameter ("unit", 's', omitable = true);
287 parameter->SetDefaultValue ("m");
288 fpCommand->SetParameter (parameter);
289 parameter = new G4UIparameter ("colour-string", 's', omitable = true);
290 parameter->SetDefaultValue ("auto");
291 fpCommand->SetParameter (parameter);
292 parameter = new G4UIparameter ("showtext", 'b', omitable = true);
293 parameter->SetDefaultValue ("true");
294 fpCommand->SetParameter (parameter);
295}
bool G4bool
Definition: G4Types.hh:86
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:146
void SetDefaultValue(const char *theDefaultValue)

◆ ~G4VisCommandSceneAddAxes()

G4VisCommandSceneAddAxes::~G4VisCommandSceneAddAxes ( )
virtual

Definition at line 297 of file G4VisCommandsSceneAdd.cc.

297 {
298 delete fpCommand;
299}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddAxes::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 301 of file G4VisCommandsSceneAdd.cc.

301 {
302 return "";
303}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 305 of file G4VisCommandsSceneAdd.cc.

305 {
306
308 G4bool warn(verbosity >= G4VisManager::warnings);
309
311 if (!pScene) {
312 if (verbosity >= G4VisManager::errors) {
313 G4cerr << "ERROR: No current scene. Please create one." << G4endl;
314 }
315 return;
316 } else {
317 if (pScene->GetExtent().GetExtentRadius() <= 0.) {
318 if (verbosity >= G4VisManager::errors) {
319 G4cerr
320 << "ERROR: Scene has no extent. Add volumes or use \"/vis/scene/add/extent\"."
321 << G4endl;
322 }
323 return;
324 }
325 }
326
327 G4String unitString, colourString, showTextString;
328 G4double x0, y0, z0, length;
329 std::istringstream is (newValue);
330 is >> x0 >> y0 >> z0 >> length >> unitString
331 >> colourString >> showTextString;
332 G4bool showText = G4UIcommand::ConvertToBool(showTextString);
333
334
335 G4double unit = G4UIcommand::ValueOf(unitString);
336 x0 *= unit; y0 *= unit; z0 *= unit;
337 const G4VisExtent& sceneExtent = pScene->GetExtent(); // Existing extent.
338 if (length < 0.) {
339 const G4double lengthMax = 0.5 * sceneExtent.GetExtentRadius();
340 const G4double intLog10Length = std::floor(std::log10(lengthMax));
341 length = std::pow(10,intLog10Length);
342 if (5.*length < lengthMax) length *= 5.;
343 else if (2.*length < lengthMax) length *= 2.;
344 } else {
345 length *= unit;
346 }
347
348 // Consult scene for arrow width...
349 G4double arrowWidth =
350 0.005 * fCurrentLineWidth * sceneExtent.GetExtentRadius();
351 // ...but limit it to length/50.
352 if (arrowWidth > length/50.) arrowWidth = length/50.;
353
354 G4VModel* model = new G4AxesModel
355 (x0, y0, z0, length, arrowWidth, colourString, newValue,
356 showText, fCurrentTextSize);
357
358 G4bool successful = pScene -> AddRunDurationModel (model, warn);
359 const G4String& currentSceneName = pScene -> GetName ();
360 if (successful) {
361 if (verbosity >= G4VisManager::confirmations) {
362 G4cout << "Axes of length " << G4BestUnit(length,"Length")
363 << "have been added to scene \"" << currentSceneName << "\"."
364 << G4endl;
365 }
366 }
367 else G4VisCommandsSceneAddUnsuccessful(verbosity);
368
370}
double G4double
Definition: G4Types.hh:83
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4VisExtent & GetExtent() const
static G4double ValueOf(const char *unitName)
Definition: G4UIcommand.cc:348
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:530
static G4double fCurrentTextSize
void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
void CheckSceneAndNotifyHandlers(G4Scene *=nullptr)
static G4VisManager * fpVisManager
static G4double fCurrentLineWidth
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75
G4Scene * GetCurrentScene() const
static Verbosity GetVerbosity()

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