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

#include <G4AxesModel.hh>

+ Inheritance diagram for G4AxesModel:

Public Member Functions

 G4AxesModel (G4double x0, G4double y0, G4double z0, G4double length, G4double arrowWidth=1., const G4String &colourString="auto", const G4String &description="", G4bool withAnnotation=true, G4double textSize=10., const G4Transform3D &transform=G4Transform3D())
 
 G4AxesModel (G4double x0, G4double y0, G4double z0, G4double length, const G4Transform3D &transform=G4Transform3D())
 
virtual ~G4AxesModel ()
 
void Construct (G4double x0, G4double y0, G4double z0, G4double length, G4double arrowWidth, const G4String &colourString, const G4String &description, G4bool withAnnotation, G4double textSize, const G4Transform3D &transform)
 
void DescribeYourselfTo (G4VGraphicsScene &) override
 
- Public Member Functions inherited from G4VModel
 G4VModel (const G4ModelingParameters *=0)
 
virtual ~G4VModel ()
 
const G4ModelingParametersGetModelingParameters () const
 
const G4StringGetType () const
 
virtual G4String GetCurrentDescription () const
 
virtual G4String GetCurrentTag () const
 
const G4VisExtentGetExtent () const
 
const G4StringGetGlobalDescription () const
 
const G4StringGetGlobalTag () const
 
void SetModelingParameters (const G4ModelingParameters *)
 
void SetExtent (const G4VisExtent &)
 
void SetType (const G4String &)
 
void SetGlobalDescription (const G4String &)
 
void SetGlobalTag (const G4String &)
 
virtual G4bool Validate (G4bool warn=true)
 

Additional Inherited Members

- Protected Attributes inherited from G4VModel
G4String fType
 
G4String fGlobalTag
 
G4String fGlobalDescription
 
G4VisExtent fExtent
 
const G4ModelingParametersfpMP
 

Detailed Description

Definition at line 44 of file G4AxesModel.hh.

Constructor & Destructor Documentation

◆ G4AxesModel() [1/2]

G4AxesModel::G4AxesModel ( G4double x0,
G4double y0,
G4double z0,
G4double length,
G4double arrowWidth = 1.,
const G4String & colourString = "auto",
const G4String & description = "",
G4bool withAnnotation = true,
G4double textSize = 10.,
const G4Transform3D & transform = G4Transform3D() )

Definition at line 56 of file G4AxesModel.cc.

63{
65 (x0,y0,z0,length,arrowWidth,
66 colourString,description,withAnnotation,textSize,
67 transform);
68}
void Construct(G4double x0, G4double y0, G4double z0, G4double length, G4double arrowWidth, const G4String &colourString, const G4String &description, G4bool withAnnotation, G4double textSize, const G4Transform3D &transform)

◆ G4AxesModel() [2/2]

G4AxesModel::G4AxesModel ( G4double x0,
G4double y0,
G4double z0,
G4double length,
const G4Transform3D & transform = G4Transform3D() )

Definition at line 71 of file G4AxesModel.cc.

74{
75 G4double arrowWidth = 1.;
76 const G4String& colourString = "auto";
77 const G4String& description = "";
78 G4bool withAnnotation = true;
79 G4double textSize = 10.;
81 (x0,y0,z0,length,arrowWidth,
82 colourString,description,withAnnotation,textSize,
83 transform);
84}
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86

◆ ~G4AxesModel()

G4AxesModel::~G4AxesModel ( )
virtual

Definition at line 43 of file G4AxesModel.cc.

44{
45 delete fZAnnotationModel;
46 delete fZLabelModel;
47 delete fZAxisModel;
48 delete fYAnnotationModel;
49 delete fYLabelModel;
50 delete fYAxisModel;
51 delete fXAnnotationModel;
52 delete fXLabelModel;
53 delete fXAxisModel;
54}

Member Function Documentation

◆ Construct()

void G4AxesModel::Construct ( G4double x0,
G4double y0,
G4double z0,
G4double length,
G4double arrowWidth,
const G4String & colourString,
const G4String & description,
G4bool withAnnotation,
G4double textSize,
const G4Transform3D & transform )

Definition at line 86 of file G4AxesModel.cc.

93{
94 fXAxisModel = nullptr;
95 fXLabelModel = nullptr;
96 fXAnnotationModel = nullptr;
97 fYAxisModel = nullptr;
98 fYLabelModel = nullptr;
99 fYAnnotationModel = nullptr;
100 fZAxisModel = nullptr;
101 fZLabelModel = nullptr;
102 fZAnnotationModel = nullptr;
103
104 fTransform = transform;
105
106 fType = "Axes";
108 fGlobalDescription = fType + ": " + description;
110 (x0, x0+length, y0, y0+length, z0, z0+length);
111
112 G4Colour colour(1,1,1,1); // Default white and opaque (unless "auto").
113 G4bool autoColour = false;
114 if (colourString == "auto") autoColour = true;
115 else {
116 if (!G4Colour::GetColour(colourString, colour)) {
118 ed << "Colour \"" << colourString
119 << "\" not found. Defaulting to white and opaque.";
121 ("G4AxesModel::G4AxesModel",
122 "modeling0011", JustWarning, ed);
123 }
124 }
125
126 G4String annotation = G4BestUnit(length,"Length");
127 G4int lineSegmentsPerCircle = 6;
128
129 G4Colour xColour(colour);
130 if (autoColour) xColour = G4Colour::Red();
131 fXAxisModel = new G4ArrowModel
132 (x0, y0, z0, x0+length, y0, z0, arrowWidth,
133 xColour, "x-axis: " + description,
134 lineSegmentsPerCircle, fTransform);
135 if (withAnnotation) {
136 G4VisAttributes va(xColour);
137 G4Text lmtext("x",G4Point3D(x0+1.05*length,y0,z0));
138 lmtext.SetScreenSize(textSize);
139 lmtext.SetOffset(0.5*textSize,0.5*textSize);
140 lmtext.SetLayout(G4Text::centre);
141 lmtext.SetVisAttributes(va);
142 fXLabelModel = new G4TextModel(lmtext,fTransform);
143 G4Text amtext(annotation,G4Point3D(x0+0.8*length,y0,z0));
144 amtext.SetScreenSize(textSize);
145 amtext.SetOffset(-1.5*textSize,-1.5*textSize);
146 amtext.SetLayout(G4Text::centre);
147 amtext.SetVisAttributes(va);
148 fXAnnotationModel = new G4TextModel(amtext,fTransform);
149 }
150
151 G4Colour yColour(colour);
152 if (autoColour) yColour = G4Colour::Green();
153 fYAxisModel = new G4ArrowModel
154 (x0, y0, z0, x0, y0+length, z0, arrowWidth,
155 yColour, "y-axis: " + description,
156 lineSegmentsPerCircle, fTransform);
157 if (withAnnotation) {
158 G4VisAttributes va(yColour);
159 G4Text lmtext("y",G4Point3D(x0,y0+1.05*length,z0));
160 lmtext.SetScreenSize(textSize);
161 lmtext.SetOffset(0.5*textSize,0.5*textSize);
162 lmtext.SetLayout(G4Text::centre);
163 lmtext.SetVisAttributes(va);
164 fYLabelModel = new G4TextModel(lmtext,fTransform);
165 G4Text amtext(annotation,G4Point3D(x0,y0+0.8*length,z0));
166 amtext.SetScreenSize(textSize);
167 amtext.SetOffset(-1.5*textSize,-1.5*textSize);
168 amtext.SetLayout(G4Text::centre);
169 amtext.SetVisAttributes(va);
170 fYAnnotationModel = new G4TextModel(amtext,fTransform);
171 }
172
173 G4Colour zColour(colour);
174 if (autoColour) zColour = G4Colour::Blue();
175 fZAxisModel = new G4ArrowModel
176 (x0, y0, z0, x0, y0, z0+length, arrowWidth,
177 zColour, "z-axis: " + description,
178 lineSegmentsPerCircle, fTransform);
179 if (withAnnotation) {
180 G4VisAttributes va(zColour);
181 G4Text lmtext("z",G4Point3D(x0,y0,z0+1.05*length));
182 lmtext.SetScreenSize(textSize);
183 lmtext.SetOffset(0.5*textSize,0.5*textSize);
184 lmtext.SetLayout(G4Text::centre);
185 lmtext.SetVisAttributes(va);
186 fZLabelModel = new G4TextModel(lmtext,fTransform);
187 G4Text amtext(annotation,G4Point3D(x0,y0,z0+0.8*length));
188 amtext.SetScreenSize(textSize);
189 amtext.SetOffset(-1.5*textSize,-1.5*textSize);
190 amtext.SetLayout(G4Text::centre);
191 amtext.SetVisAttributes(va);
192 fZAnnotationModel = new G4TextModel(amtext,fTransform);
193 }
194}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
HepGeom::Point3D< G4double > G4Point3D
Definition G4Point3D.hh:34
#define G4BestUnit(a, b)
int G4int
Definition G4Types.hh:85
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition G4Colour.cc:155
static G4Colour Green()
Definition G4Colour.hh:162
static G4Colour Red()
Definition G4Colour.hh:161
static G4Colour Blue()
Definition G4Colour.hh:163
@ centre
Definition G4Text.hh:76
G4VisExtent fExtent
Definition G4VModel.hh:97
G4String fGlobalDescription
Definition G4VModel.hh:96
G4String fType
Definition G4VModel.hh:94
G4String fGlobalTag
Definition G4VModel.hh:95

Referenced by G4AxesModel(), and G4AxesModel().

◆ DescribeYourselfTo()

void G4AxesModel::DescribeYourselfTo ( G4VGraphicsScene & sceneHandler)
overridevirtual

Implements G4VModel.

Definition at line 196 of file G4AxesModel.cc.

197{
198 if (fXAxisModel) fXAxisModel-> DescribeYourselfTo(sceneHandler);
199 if (fXLabelModel) fXLabelModel-> DescribeYourselfTo(sceneHandler);
200 if (fXAnnotationModel) fXAnnotationModel->DescribeYourselfTo(sceneHandler);
201
202 if (fYAxisModel) fYAxisModel-> DescribeYourselfTo(sceneHandler);
203 if (fYLabelModel) fYLabelModel-> DescribeYourselfTo(sceneHandler);
204 if (fYAnnotationModel) fYAnnotationModel->DescribeYourselfTo(sceneHandler);
205
206 if (fZAxisModel) fZAxisModel-> DescribeYourselfTo(sceneHandler);
207 if (fZLabelModel) fZLabelModel-> DescribeYourselfTo(sceneHandler);
208 if (fZAnnotationModel) fZAnnotationModel->DescribeYourselfTo(sceneHandler);
209}
void DescribeYourselfTo(G4VGraphicsScene &) override
virtual void DescribeYourselfTo(G4VGraphicsScene &)=0

Referenced by DescribeYourselfTo(), and G4VisCommandsTouchable::SetNewValue().


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