Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 <vector>
43
44class G4UIcommand;
46
48{
49public:
50
51 // Uses compiler defaults for copy constructor and assignment.
53 virtual ~G4VVisCommand ();
54
55 static G4VisManager* GetVisManager ();
56
57 static void SetVisManager (G4VisManager* pVisManager);
58
59 static const G4Colour& GetCurrentTextColour();
60
61protected:
62
63 // Utility functions
64
65 void SetViewParameters(G4VViewer* viewer, const G4ViewParameters& viewParams);
66
67 void RefreshIfRequired(G4VViewer* viewer);
68
70 (G4VViewer* currentViewer,
71 std::vector<G4ViewParameters> viewVector,
72 const G4int nInterpolationPoints = 50,
73 const G4int waitTimePerPointmilliseconds = 20,
74 const G4String exportString = "");
75
77 (G4VViewer* currentViewer,
78 const G4ViewParameters& oldVP,
79 const G4ViewParameters& newVP,
80 const G4int nInterpolationPoints = 50,
81 const G4int waitTimePerPointmilliseconds = 20,
82 const G4String exportString = "");
83
84 void Twinkle
85 // Twinkles the touchables in paths
86 // /vis/viewer/centreOn to see its effect
87 (G4VViewer* currentViewer,
88 const G4ViewParameters& baseVP,
89 const std::vector<std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>>& paths);
90
91 // Conversion routines augmenting those in G4UIcommand.
92
94 const char * unitName);
95
96 static G4bool ConvertToDoublePair(const G4String& paramString,
97 G4double& xval,
98 G4double& yval);
99 // Return false if problem parsing paramString.
100
102 void ConvertToColour
103 (G4Colour& colour,
104 const G4String& redOrString,
105 G4double green,
106 G4double blue,
107 G4double opacity);
108 // Note: colour is supplied by the caller and becomes the default if the
109 // remaining parameters cannot be parsed.
110 // Note: redOrString is either a number or string. If a string it must be
111 // one of the recognised colours.
112 // Thus the arguments can be, for example:
113 // (colour,"red",...,...,0.5): will give the colour red with opacity 0.5 (the
114 // third and fourth arguments are ignored), or
115 // (1.,0.,0.,0.5): this also will be red with opacity 0.5.
116
118 (const G4String& where,
119 const G4String& unit,
120 const G4String& category,
121 G4double& value);
122 // Return false if there's a problem
123
125 (G4ViewParameters& target, const G4ViewParameters& from);
126 // Copy view parameters pertaining only to camera
127
128 // Other utilities
129
130 void CheckSceneAndNotifyHandlers (G4Scene* = nullptr);
131
132 G4bool CheckView(); // False if not valid
133
135
137 (const G4UIcommand* fromCmd, G4UIcommand* toCmd, G4int startLine = 0);
138
140 (const G4UIcommand* fromCmd, G4UIcommand* toCmd);
141
142 void DrawExtent(const G4VisExtent&);
143
144 // Data members
145
147
148 // Current quantities for use in appropriate commands
152 //static G4VisAttributes::LineStyle fCurrentLineStyle; Not yet used.
153 //static G4VMarker::FillStyle fCurrentFillStyle; Not yet used.
154 //static G4VMarker::SizeType fCurrentSizeType; Not yet used.
160 static std::vector<G4PhysicalVolumesSearchScene::Findings> fCurrrentPVFindingsForField;
161
162 // When we create a new viewer we would like to use the view parameters of
163 // the existing viewer if there was one. This has to be checked at the
164 // creation of a new viewer and *also* at the creation of a new scene
165 // handler.
166 static G4bool fThereWasAViewer; // True if there was a viewer
167 static G4ViewParameters fExistingVP; // Its view parameters
168};
169
170#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
Layout
Definition: G4Text.hh:76
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
G4bool CheckView()
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)
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="")