Geant4 9.6.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)
 
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 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 45 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 
)

Definition at line 46 of file G4AxesModel.cc.

51 :
52 fXAxisModel(0),
53 fXLabelModel(0),
54 fXAnnotationModel(0),
55 fYAxisModel(0),
56 fYLabelModel(0),
57 fYAnnotationModel(0),
58 fZAxisModel(0),
59 fZLabelModel(0),
60 fZAnnotationModel(0)
61{
62 fType = "G4AxesModel";
64 fGlobalDescription = fType + ": " + description;
66 (x0, x0+length, y0, y0+length, z0, z0+length);
67
68 G4Colour colour(1,1,1,1); // Default white and opaque (unless "auto").
69 G4bool autoColour = false;
70 if (colourString == "auto") autoColour = true;
71 else {
72 if (!G4Colour::GetColour(colourString, colour)) {
74 ed << "Colour \"" << colourString
75 << "\" not found. Defaulting to white and opaque.";
77 ("G4AxesModel::G4AxesModel",
78 "modeling0012", JustWarning, ed);
79 }
80 }
81
82 G4String annotation = G4BestUnit(length,"Length");
83
84 G4Text* text = 0;
85 G4VisAttributes* va = 0;
86
87 G4Colour xColour(colour);
88 if (autoColour) xColour = G4Colour::Red();
89 fXAxisModel = new G4ArrowModel
90 (x0, y0, z0, x0+length, y0, z0, arrowWidth,
91 xColour, "x-axis: " + description);
92 if (withAnnotation) {
93 text = new G4Text("x",G4Point3D(x0+1.05*length, y0, z0));
94 text->SetScreenSize(10.);
96 va = new G4VisAttributes(xColour);
97 text->SetVisAttributes(va);
98 fXLabelModel = new G4TextModel(*text);
99 text = new G4Text(annotation,G4Point3D(x0+0.8*length, y0, z0));
100 text->SetScreenSize(10.);
101 text->SetOffset(5.,5.);
103 va = new G4VisAttributes(xColour);
104 text->SetVisAttributes(va);
105 fXAnnotationModel = new G4TextModel(*text);
106 }
107
108 G4Colour yColour(colour);
109 if (autoColour) yColour = G4Colour::Green();
110 fYAxisModel = new G4ArrowModel
111 (x0, y0, z0, x0, y0+length, z0, arrowWidth,
112 yColour, "y-axis: " + description);
113 if (withAnnotation) {
114 text = new G4Text("y",G4Point3D(x0, y0+1.05*length, z0));
115 text->SetScreenSize(10.);
117 va = new G4VisAttributes(yColour);
118 text->SetVisAttributes(va);
119 fYLabelModel = new G4TextModel(*text);
120 text = new G4Text(annotation,G4Point3D(x0, y0+0.8*length, z0));
121 text->SetScreenSize(10.);
122 text->SetOffset(5.,5.);
124 va = new G4VisAttributes(yColour);
125 text->SetVisAttributes(va);
126 fYAnnotationModel = new G4TextModel(*text);
127 }
128
129 G4Colour zColour(colour);
130 if (autoColour) zColour = G4Colour::Blue();
131 fZAxisModel = new G4ArrowModel
132 (x0, y0, z0, x0, y0, z0+length, arrowWidth,
133 zColour, "z-axis: " + description);
134 if (withAnnotation) {
135 text = new G4Text("z",G4Point3D(x0, y0, z0+1.05*length));
136 text->SetScreenSize(10.);
138 va = new G4VisAttributes(zColour);
139 text->SetVisAttributes(va);
140 fZLabelModel = new G4TextModel(*text);
141 text = new G4Text(annotation,G4Point3D(x0, y0, z0+0.8*length));
142 text->SetScreenSize(10.);
143 text->SetOffset(5.,5.);
145 va = new G4VisAttributes(zColour);
146 text->SetVisAttributes(va);
147 fZAnnotationModel = new G4TextModel(*text);
148 }
149}
@ JustWarning
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
bool G4bool
Definition: G4Types.hh:67
static G4Colour Green()
Definition: G4Colour.hh:148
static G4Colour Red()
Definition: G4Colour.hh:147
static G4Colour Blue()
Definition: G4Colour.hh:149
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:123
Definition: G4Text.hh:73
void SetLayout(Layout)
void SetOffset(double dx, double dy)
@ centre
Definition: G4Text.hh:77
void SetScreenSize(G4double)
G4VisExtent fExtent
Definition: G4VModel.hh:111
G4String fGlobalDescription
Definition: G4VModel.hh:110
G4String fType
Definition: G4VModel.hh:108
G4String fGlobalTag
Definition: G4VModel.hh:109
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:80
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

◆ ~G4AxesModel()

G4AxesModel::~G4AxesModel ( )
virtual

Definition at line 44 of file G4AxesModel.cc.

44{}

Member Function Documentation

◆ DescribeYourselfTo()

void G4AxesModel::DescribeYourselfTo ( G4VGraphicsScene sceneHandler)
virtual

Implements G4VModel.

Definition at line 151 of file G4AxesModel.cc.

152{
153 if (fXAxisModel) fXAxisModel->DescribeYourselfTo(sceneHandler);
154 if (fXLabelModel) fXLabelModel->DescribeYourselfTo(sceneHandler);
155 if (fXAnnotationModel) fXAnnotationModel->DescribeYourselfTo(sceneHandler);
156 if (fYAxisModel) fYAxisModel->DescribeYourselfTo(sceneHandler);
157 if (fYLabelModel) fYLabelModel->DescribeYourselfTo(sceneHandler);
158 if (fYAnnotationModel) fYAnnotationModel->DescribeYourselfTo(sceneHandler);
159 if (fZAxisModel) fZAxisModel->DescribeYourselfTo(sceneHandler);
160 if (fZLabelModel) fZLabelModel->DescribeYourselfTo(sceneHandler);
161 if (fZAnnotationModel) fZAnnotationModel->DescribeYourselfTo(sceneHandler);
162}
virtual void DescribeYourselfTo(G4VGraphicsScene &)=0

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