Geant4 11.2.2
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 ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static G4VisManagerGetVisManager ()
 
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="")
 
void Twinkle (G4VViewer *currentViewer, const G4ViewParameters &baseVP, const std::vector< std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > > &paths)
 
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 CopyCameraParameters (G4ViewParameters &target, const G4ViewParameters &from)
 
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 LtoS (G4long l)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const 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 = nullptr
 
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
 
static G4bool fThereWasAViewer = false
 
static G4ViewParameters fExistingVP
 
static G4SceneTreeItem fExistingSceneTree
 

Detailed Description

Definition at line 80 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneAddAxes()

G4VisCommandSceneAddAxes::G4VisCommandSceneAddAxes ( )

Definition at line 262 of file G4VisCommandsSceneAdd.cc.

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

◆ ~G4VisCommandSceneAddAxes()

G4VisCommandSceneAddAxes::~G4VisCommandSceneAddAxes ( )
virtual

Definition at line 301 of file G4VisCommandsSceneAdd.cc.

301 {
302 delete fpCommand;
303}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneAddAxes::GetCurrentValue ( G4UIcommand * command)
virtual

Reimplemented from G4UImessenger.

Definition at line 305 of file G4VisCommandsSceneAdd.cc.

305 {
306 return "";
307}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 309 of file G4VisCommandsSceneAdd.cc.

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

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