Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VVisCommand.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27
28// Base class for visualization commands - John Allison 9th August 1998
29// It is really a messenger - we have one command per messenger.
30
31#ifndef G4VVISCOMMAND_HH
32#define G4VVISCOMMAND_HH
33
34#include "G4VisManager.hh"
35#include "G4UImessenger.hh"
36#include "G4ThreeVector.hh"
37#include "G4Text.hh"
38#include "G4VisAttributes.hh"
39#include "G4VMarker.hh"
42#include "G4SceneTreeItem.hh"
43
44#include <vector>
45
46class G4UIcommand;
48
50{
51public:
52
53 // Uses compiler defaults for copy constructor and assignment.
55 virtual ~G4VVisCommand ();
56
57 static G4VisManager* GetVisManager ();
58
59 static void SetVisManager (G4VisManager* pVisManager);
60
61 static const G4Colour& GetCurrentTextColour();
62
63protected:
64
65 // Utility functions
66
67 void SetViewParameters(G4VViewer* viewer, const G4ViewParameters& viewParams);
68
69 void RefreshIfRequired(G4VViewer* viewer);
70
72 (G4VViewer* currentViewer,
73 std::vector<G4ViewParameters> viewVector,
74 const G4int nInterpolationPoints = 50,
75 const G4int waitTimePerPointmilliseconds = 20,
76 const G4String exportString = "");
77
79 (G4VViewer* currentViewer,
80 const G4ViewParameters& oldVP,
81 const G4ViewParameters& newVP,
82 const G4int nInterpolationPoints = 50,
83 const G4int waitTimePerPointmilliseconds = 20,
84 const G4String exportString = "");
85
86 void Twinkle
87 // Twinkles the touchables in paths
88 // /vis/viewer/centreOn to see its effect
89 (G4VViewer* currentViewer,
90 const G4ViewParameters& baseVP,
91 const std::vector<std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>>& paths);
92
93 // Conversion routines augmenting those in G4UIcommand.
94
96 const char * unitName);
97
98 static G4bool ConvertToDoublePair(const G4String& paramString,
99 G4double& xval,
100 G4double& yval);
101 // Return false if problem parsing paramString.
102
104 void ConvertToColour
105 (G4Colour& colour,
106 const G4String& redOrString,
107 G4double green,
108 G4double blue,
109 G4double opacity);
110 // Note: colour is supplied by the caller and becomes the default if the
111 // remaining parameters cannot be parsed.
112 // Note: redOrString is either a number or string. If a string it must be
113 // one of the recognised colours.
114 // Thus the arguments can be, for example:
115 // (colour,"red",...,...,0.5): will give the colour red with opacity 0.5 (the
116 // third and fourth arguments are ignored), or
117 // (1.,0.,0.,0.5): this also will be red with opacity 0.5.
118
120 (const G4String& where,
121 const G4String& unit,
122 const G4String& category,
123 G4double& value);
124 // Return false if there's a problem
125
127 (G4ViewParameters& target, const G4ViewParameters& from);
128 // Copy view parameters pertaining only to camera
129
130 // Other utilities
131
132 void CheckSceneAndNotifyHandlers (G4Scene* = nullptr);
133
134 G4bool CheckView(); // False if not valid
135
137
139 (const G4UIcommand* fromCmd, G4UIcommand* toCmd, G4int startLine = 0);
140
142 (const G4UIcommand* fromCmd, G4UIcommand* toCmd);
143
144 void DrawExtent(const G4VisExtent&);
145
146 // Data members
147
149
150 // Current quantities for use in appropriate commands
154 //static G4VisAttributes::LineStyle fCurrentLineStyle; Not yet used.
155 //static G4VMarker::FillStyle fCurrentFillStyle; Not yet used.
156 //static G4VMarker::SizeType fCurrentSizeType; Not yet used.
162 static std::vector<G4PhysicalVolumesSearchScene::Findings> fCurrrentPVFindingsForField;
163
164 // When we create a new viewer we would like to use the view parameters of
165 // the existing viewer if there was one. This has to be checked at the
166 // creation of a new viewer and *also* at the creation of a new scene
167 // handler.
168 static G4bool fThereWasAViewer; // True if there was a viewer
169 static G4ViewParameters fExistingVP; // Its view parameters
170 static G4SceneTreeItem fExistingSceneTree; // Its scene tree
171};
172
173#endif
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
static G4double fCurrentTextSize
void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
static void SetVisManager(G4VisManager *pVisManager)
static G4ViewParameters fExistingVP
static G4Colour fCurrentTextColour
void CopyCameraParameters(G4ViewParameters &target, const G4ViewParameters &from)
static G4VisManager * GetVisManager()
void CheckSceneAndNotifyHandlers(G4Scene *=nullptr)
static std::vector< G4PhysicalVolumesSearchScene::Findings > fCurrrentPVFindingsForField
void ConvertToColour(G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
static G4VisManager * fpVisManager
static G4VisExtent fCurrentExtentForField
void DrawExtent(const G4VisExtent &)
void InterpolateToNewView(G4VViewer *currentViewer, const G4ViewParameters &oldVP, const G4ViewParameters &newVP, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
static const G4Colour & GetCurrentTextColour()
static G4bool ConvertToDoublePair(const G4String &paramString, G4double &xval, G4double &yval)
void RefreshIfRequired(G4VViewer *viewer)
static G4SceneTreeItem fExistingSceneTree
void SetViewParameters(G4VViewer *viewer, const G4ViewParameters &viewParams)
const G4String & ConvertToColourGuidance()
void CopyParametersFrom(const G4UIcommand *fromCmd, G4UIcommand *toCmd)
static G4int fCurrentArrow3DLineSegmentsPerCircle
static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
G4bool ProvideValueOfUnit(const G4String &where, const G4String &unit, const G4String &category, G4double &value)
static G4Text::Layout fCurrentTextLayout
static G4bool fThereWasAViewer
virtual ~G4VVisCommand()
static G4double fCurrentLineWidth
void Twinkle(G4VViewer *currentViewer, const G4ViewParameters &baseVP, const std::vector< std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > > &paths)
static G4String ConvertToString(G4double x, G4double y, const char *unitName)
static G4Colour fCurrentColour
void CopyGuidanceFrom(const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
void InterpolateViews(G4VViewer *currentViewer, std::vector< G4ViewParameters > viewVector, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")