Geant4  10.02.p03
G4AxesModel Class Reference

#include <G4AxesModel.hh>

Inheritance diagram for G4AxesModel:
Collaboration 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 ()
 
const G4ModelingParameters * GetModelingParameters () const
 
const G4String & GetType () const
 
virtual G4String GetCurrentDescription () const
 
virtual G4String GetCurrentTag () const
 
const G4VisExtent & GetExtent () const
 
const G4String & GetGlobalDescription () const
 
const G4String & GetGlobalTag () const
 
const G4Transform3D & GetTransformation () 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)
 

Private Member Functions

 G4AxesModel (const G4AxesModel &)
 
G4AxesModel & operator= (const G4AxesModel &)
 

Private Attributes

G4VModel * fXAxisModel
 
G4VModel * fXLabelModel
 
G4VModel * fXAnnotationModel
 
G4VModel * fYAxisModel
 
G4VModel * fYLabelModel
 
G4VModel * fYAnnotationModel
 
G4VModel * fZAxisModel
 
G4VModel * fZLabelModel
 
G4VModel * fZAnnotationModel
 

Additional Inherited Members

- Protected Attributes inherited from G4VModel
G4String fType
 
G4String fGlobalTag
 
G4String fGlobalDescription
 
G4VisExtent fExtent
 
G4Transform3D fTransform
 
const G4ModelingParameters * fpMP
 

Detailed Description

Definition at line 45 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. 
)

Definition at line 58 of file G4AxesModel.cc.

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

◆ ~G4AxesModel()

G4AxesModel::~G4AxesModel ( )
virtual

Definition at line 44 of file G4AxesModel.cc.

45 {
46  delete fZAnnotationModel;
47  delete fZLabelModel;
48  delete fZAxisModel;
49  delete fYAnnotationModel;
50  delete fYLabelModel;
51  delete fYAxisModel;
52  delete fXAnnotationModel;
53  delete fXLabelModel;
54  delete fXAxisModel;
55 }
G4VModel * fYLabelModel
Definition: G4AxesModel.hh:70
G4VModel * fZAxisModel
Definition: G4AxesModel.hh:70
G4VModel * fYAnnotationModel
Definition: G4AxesModel.hh:70
G4VModel * fXLabelModel
Definition: G4AxesModel.hh:70
G4VModel * fZAnnotationModel
Definition: G4AxesModel.hh:70
G4VModel * fZLabelModel
Definition: G4AxesModel.hh:70
G4VModel * fXAxisModel
Definition: G4AxesModel.hh:70
G4VModel * fYAxisModel
Definition: G4AxesModel.hh:70
G4VModel * fXAnnotationModel
Definition: G4AxesModel.hh:70
Here is the call graph for this function:

◆ G4AxesModel() [2/2]

G4AxesModel::G4AxesModel ( const G4AxesModel &  )
private

Member Function Documentation

◆ DescribeYourselfTo()

void G4AxesModel::DescribeYourselfTo ( G4VGraphicsScene &  sceneHandler)
virtual

Implements G4VModel.

Definition at line 171 of file G4AxesModel.cc.

172 {
173  if (fXAxisModel) fXAxisModel->DescribeYourselfTo(sceneHandler);
174  if (fXLabelModel) fXLabelModel->DescribeYourselfTo(sceneHandler);
176  if (fYAxisModel) fYAxisModel->DescribeYourselfTo(sceneHandler);
177  if (fYLabelModel) fYLabelModel->DescribeYourselfTo(sceneHandler);
179  if (fZAxisModel) fZAxisModel->DescribeYourselfTo(sceneHandler);
180  if (fZLabelModel) fZLabelModel->DescribeYourselfTo(sceneHandler);
182 }
G4VModel * fYLabelModel
Definition: G4AxesModel.hh:70
virtual void DescribeYourselfTo(G4VGraphicsScene &)=0
G4VModel * fZAxisModel
Definition: G4AxesModel.hh:70
G4VModel * fYAnnotationModel
Definition: G4AxesModel.hh:70
G4VModel * fXLabelModel
Definition: G4AxesModel.hh:70
G4VModel * fZAnnotationModel
Definition: G4AxesModel.hh:70
G4VModel * fZLabelModel
Definition: G4AxesModel.hh:70
G4VModel * fXAxisModel
Definition: G4AxesModel.hh:70
G4VModel * fYAxisModel
Definition: G4AxesModel.hh:70
G4VModel * fXAnnotationModel
Definition: G4AxesModel.hh:70
Here is the call graph for this function:

◆ operator=()

G4AxesModel& G4AxesModel::operator= ( const G4AxesModel &  )
private

Member Data Documentation

◆ fXAnnotationModel

G4VModel * G4AxesModel::fXAnnotationModel
private

Definition at line 70 of file G4AxesModel.hh.

◆ fXAxisModel

G4VModel* G4AxesModel::fXAxisModel
private

Definition at line 70 of file G4AxesModel.hh.

◆ fXLabelModel

G4VModel * G4AxesModel::fXLabelModel
private

Definition at line 70 of file G4AxesModel.hh.

◆ fYAnnotationModel

G4VModel * G4AxesModel::fYAnnotationModel
private

Definition at line 70 of file G4AxesModel.hh.

◆ fYAxisModel

G4VModel * G4AxesModel::fYAxisModel
private

Definition at line 70 of file G4AxesModel.hh.

◆ fYLabelModel

G4VModel * G4AxesModel::fYLabelModel
private

Definition at line 70 of file G4AxesModel.hh.

◆ fZAnnotationModel

G4VModel * G4AxesModel::fZAnnotationModel
private

Definition at line 70 of file G4AxesModel.hh.

◆ fZAxisModel

G4VModel * G4AxesModel::fZAxisModel
private

Definition at line 70 of file G4AxesModel.hh.

◆ fZLabelModel

G4VModel * G4AxesModel::fZLabelModel
private

Definition at line 70 of file G4AxesModel.hh.


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