Geant4 10.7.0
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.)
 
virtual ~G4AxesModel ()
 
virtual void DescribeYourselfTo (G4VGraphicsScene &)
 
- Public Member Functions inherited from G4VModel
 G4VModel (const G4Transform3D &modelTransformation=G4Transform3D(), const G4ModelingParameters *=0)
 
virtual ~G4VModel ()
 
virtual void DescribeYourselfTo (G4VGraphicsScene &)=0
 
const G4ModelingParametersGetModelingParameters () const
 
const G4StringGetType () const
 
virtual G4String GetCurrentDescription () const
 
virtual G4String GetCurrentTag () const
 
const G4VisExtentGetExtent () const
 
const G4VisExtentGetTransformedExtent () const
 
const G4StringGetGlobalDescription () const
 
const G4StringGetGlobalTag () const
 
const G4Transform3DGetTransformation () const
 
void SetModelingParameters (const G4ModelingParameters *)
 
void SetExtent (const G4VisExtent &)
 
void SetType (const G4String &)
 
void SetGlobalDescription (const G4String &)
 
void SetGlobalTag (const G4String &)
 
void SetTransformation (const G4Transform3D &)
 
virtual G4bool Validate (G4bool warn=true)
 

Additional Inherited Members

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

Detailed Description

Definition at line 44 of file G4AxesModel.hh.

Constructor & Destructor Documentation

◆ G4AxesModel()

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. 
)

Definition at line 56 of file G4AxesModel.cc.

61 :
62 fXAxisModel(0),
63 fXLabelModel(0),
64 fXAnnotationModel(0),
65 fYAxisModel(0),
66 fYLabelModel(0),
67 fYAnnotationModel(0),
68 fZAxisModel(0),
69 fZLabelModel(0),
70 fZAnnotationModel(0)
71{
72 fType = "G4AxesModel";
74 fGlobalDescription = fType + ": " + description;
76 (x0, x0+length, y0, y0+length, z0, z0+length);
77
78 G4Colour colour(1,1,1,1); // Default white and opaque (unless "auto").
79 G4bool autoColour = false;
80 if (colourString == "auto") autoColour = true;
81 else {
82 if (!G4Colour::GetColour(colourString, colour)) {
84 ed << "Colour \"" << colourString
85 << "\" not found. Defaulting to white and opaque.";
87 ("G4AxesModel::G4AxesModel",
88 "modeling0011", JustWarning, ed);
89 }
90 }
91
92 G4String annotation = G4BestUnit(length,"Length");
93
94 G4Text* text = 0;
95 G4VisAttributes* va = 0;
96
97 G4Colour xColour(colour);
98 if (autoColour) xColour = G4Colour::Red();
99 fXAxisModel = new G4ArrowModel
100 (x0, y0, z0, x0+length, y0, z0, arrowWidth,
101 xColour, "x-axis: " + description);
102 if (withAnnotation) {
103 text = new G4Text("x",G4Point3D(x0+1.05*length, y0, z0));
104 text->SetScreenSize(textSize);
105 text->SetOffset(0.5*textSize,0.5*textSize);
107 va = new G4VisAttributes(xColour);
108 text->SetVisAttributes(va);
109 fXLabelModel = new G4TextModel(*text);
110 delete text;
111 text = new G4Text(annotation,G4Point3D(x0+0.8*length, y0, z0));
112 text->SetScreenSize(textSize);
113 text->SetOffset(-1.5*textSize,-1.5*textSize);
115 va = new G4VisAttributes(xColour);
116 text->SetVisAttributes(va);
117 fXAnnotationModel = new G4TextModel(*text);
118 delete text;
119 }
120
121 G4Colour yColour(colour);
122 if (autoColour) yColour = G4Colour::Green();
123 fYAxisModel = new G4ArrowModel
124 (x0, y0, z0, x0, y0+length, z0, arrowWidth,
125 yColour, "y-axis: " + description);
126 if (withAnnotation) {
127 text = new G4Text("y",G4Point3D(x0, y0+1.05*length, z0));
128 text->SetScreenSize(textSize);
129 text->SetOffset(0.5*textSize,0.5*textSize);
131 va = new G4VisAttributes(yColour);
132 text->SetVisAttributes(va);
133 fYLabelModel = new G4TextModel(*text);
134 delete text;
135 text = new G4Text(annotation,G4Point3D(x0, y0+0.8*length, z0));
136 text->SetScreenSize(textSize);
137 text->SetOffset(-1.5*textSize,-1.5*textSize);
139 va = new G4VisAttributes(yColour);
140 text->SetVisAttributes(va);
141 fYAnnotationModel = new G4TextModel(*text);
142 delete text;
143 }
144
145 G4Colour zColour(colour);
146 if (autoColour) zColour = G4Colour::Blue();
147 fZAxisModel = new G4ArrowModel
148 (x0, y0, z0, x0, y0, z0+length, arrowWidth,
149 zColour, "z-axis: " + description);
150 if (withAnnotation) {
151 text = new G4Text("z",G4Point3D(x0, y0, z0+1.05*length));
152 text->SetScreenSize(textSize);
153 text->SetOffset(0.5*textSize,0.5*textSize);
155 va = new G4VisAttributes(zColour);
156 text->SetVisAttributes(va);
157 fZLabelModel = new G4TextModel(*text);
158 delete text;
159 text = new G4Text(annotation,G4Point3D(x0, y0, z0+0.8*length));
160 text->SetScreenSize(textSize);
161 text->SetOffset(-1.5*textSize,-1.5*textSize);
163 va = new G4VisAttributes(zColour);
164 text->SetVisAttributes(va);
165 fZAnnotationModel = new G4TextModel(*text);
166 delete text;
167 }
168}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:34
#define G4BestUnit(a, b)
bool G4bool
Definition: G4Types.hh:86
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:162
static G4Colour Green()
Definition: G4Colour.hh:160
static G4Colour Red()
Definition: G4Colour.hh:159
static G4Colour Blue()
Definition: G4Colour.hh:161
Definition: G4Text.hh:72
void SetLayout(Layout)
void SetOffset(double dx, double dy)
@ centre
Definition: G4Text.hh:76
void SetScreenSize(G4double)
G4VisExtent fExtent
Definition: G4VModel.hh:113
G4String fGlobalDescription
Definition: G4VModel.hh:112
G4String fType
Definition: G4VModel.hh:110
G4String fGlobalTag
Definition: G4VModel.hh:111
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:79

◆ ~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

◆ DescribeYourselfTo()

void G4AxesModel::DescribeYourselfTo ( G4VGraphicsScene sceneHandler)
virtual

Implements G4VModel.

Definition at line 170 of file G4AxesModel.cc.

171{
172 if (fXAxisModel) fXAxisModel->DescribeYourselfTo(sceneHandler);
173 if (fXLabelModel) fXLabelModel->DescribeYourselfTo(sceneHandler);
174 if (fXAnnotationModel) fXAnnotationModel->DescribeYourselfTo(sceneHandler);
175 if (fYAxisModel) fYAxisModel->DescribeYourselfTo(sceneHandler);
176 if (fYLabelModel) fYLabelModel->DescribeYourselfTo(sceneHandler);
177 if (fYAnnotationModel) fYAnnotationModel->DescribeYourselfTo(sceneHandler);
178 if (fZAxisModel) fZAxisModel->DescribeYourselfTo(sceneHandler);
179 if (fZLabelModel) fZLabelModel->DescribeYourselfTo(sceneHandler);
180 if (fZAnnotationModel) fZAnnotationModel->DescribeYourselfTo(sceneHandler);
181}
virtual void DescribeYourselfTo(G4VGraphicsScene &)=0

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