Geant4-11
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 // Conversion routines augmenting those in G4UIcommand.
85
87 const char * unitName);
88
89 static G4bool ConvertToDoublePair(const G4String& paramString,
90 G4double& xval,
91 G4double& yval);
92 // Return false if problem parsing paramString.
93
96 (G4Colour& colour,
97 const G4String& redOrString,
98 G4double green,
99 G4double blue,
100 G4double opacity);
101 // Note: colour is supplied by the caller and becomes the default if the
102 // remaining parameters cannot be parsed.
103 // Note: redOrString is either a number or string. If a string it must be
104 // one of the recognised colours.
105 // Thus the arguments can be, for example:
106 // (colour,"red",...,...,0.5): will give the colour red with opacity 0.5 (the
107 // third and fourth arguments are ignored), or
108 // (1.,0.,0.,0.5): this also will be red with opacity 0.5.
109
111 (const G4String& where,
112 const G4String& unit,
113 const G4String& category,
114 G4double& value);
115 // Return false if there's a problem
116
118 (G4ViewParameters& target, const G4ViewParameters& from);
119 // Copy view parameters except for autoRefresh and background...
120
122 (G4ViewParameters& target, const G4ViewParameters& from);
123 // Copy view parameters pertaining only to camera
124
125 // Other utilities
126
127 void CheckSceneAndNotifyHandlers (G4Scene* = nullptr);
128
129 G4bool CheckView(); // False if not valid
130
132
134 (const G4UIcommand* fromCmd, G4UIcommand* toCmd, G4int startLine = 0);
135
137 (const G4UIcommand* fromCmd, G4UIcommand* toCmd);
138
139 void DrawExtent(const G4VisExtent&);
140
141 // Data members
142
144
145 // Current quantities for use in appropriate commands
149 //static G4VisAttributes::LineStyle fCurrentLineStyle; Not yet used.
150 //static G4VMarker::FillStyle fCurrentFillStyle; Not yet used.
151 //static G4VMarker::SizeType fCurrentSizeType; Not yet used.
157 static std::vector<G4PhysicalVolumesSearchScene::Findings> fCurrrentPVFindingsForField;
158
159 // When we create a new viewer we would like to use the view parameters of
160 // the existing viewer if there was one. This has to be checked at the
161 // creation of a new viewer and *also* at the creation of a new scene
162 // handler.
163 static G4bool fThereWasAViewer; // True if there was a viewer
164 static G4ViewParameters fVPExistingViewer; // Its view parameters
165};
166
167#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 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 G4ViewParameters fVPExistingViewer
static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
G4bool ProvideValueOfUnit(const G4String &where, const G4String &unit, const G4String &category, G4double &value)
void CopyMostViewParameters(G4ViewParameters &target, const G4ViewParameters &from)
static G4Text::Layout fCurrentTextLayout
static G4bool fThereWasAViewer
virtual ~G4VVisCommand()
static G4double fCurrentLineWidth
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="")