G4AxesModel Class Reference

#include <G4AxesModel.hh>

Inheritance diagram for G4AxesModel:

G4VModel

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

Detailed Description

Definition at line 45 of file G4AxesModel.hh.


Constructor & Destructor Documentation

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 47 of file G4AxesModel.cc.

References G4Colour::Blue(), G4Text::centre, G4BestUnit, G4Exception(), G4Colour::GetColour(), G4Colour::Green(), JustWarning, G4Colour::Red(), G4Text::SetLayout(), G4Text::SetOffset(), G4VMarker::SetScreenSize(), and G4Visible::SetVisAttributes().

00051                        :
00052   fXAxisModel(0),
00053   fXLabelModel(0),
00054   fXAnnotationModel(0),
00055   fYAxisModel(0),
00056   fYLabelModel(0),
00057   fYAnnotationModel(0),
00058   fZAxisModel(0),
00059   fZLabelModel(0),
00060   fZAnnotationModel(0)
00061 {
00062   fType = "G4AxesModel";
00063   fGlobalTag = fType;
00064   fGlobalDescription = fType + ": " + description;
00065   fExtent = G4VisExtent
00066     (x0, x0+length, y0, y0+length, z0, z0+length);
00067 
00068   G4Colour colour(1,1,1,1);  // Default white and opaque (unless "auto").
00069   G4bool autoColour = false;
00070   if (colourString == "auto") autoColour = true;
00071   else {
00072     if (!G4Colour::GetColour(colourString, colour)) {
00073       G4ExceptionDescription ed;
00074       ed << "Colour \"" << colourString
00075          << "\" not found.  Defaulting to white and opaque.";
00076       G4Exception
00077         ("G4AxesModel::G4AxesModel",
00078          "modeling0012", JustWarning, ed);
00079     }
00080   }
00081 
00082   G4String annotation = G4BestUnit(length,"Length");
00083 
00084   G4Text* text = 0;
00085   G4VisAttributes* va = 0;
00086 
00087   G4Colour xColour(colour);
00088   if (autoColour) xColour = G4Colour::Red();
00089   fXAxisModel = new G4ArrowModel
00090     (x0, y0, z0, x0+length, y0, z0, arrowWidth,
00091      xColour, "x-axis: " + description);
00092   if (withAnnotation) {
00093     text = new G4Text("x",G4Point3D(x0+1.05*length, y0, z0));
00094     text->SetScreenSize(10.);
00095     text->SetLayout(G4Text::centre);
00096     va = new G4VisAttributes(xColour);
00097     text->SetVisAttributes(va);
00098     fXLabelModel = new G4TextModel(*text);
00099     text = new G4Text(annotation,G4Point3D(x0+0.8*length, y0, z0));
00100     text->SetScreenSize(10.);
00101     text->SetOffset(5.,5.);
00102     text->SetLayout(G4Text::centre);
00103     va = new G4VisAttributes(xColour);
00104     text->SetVisAttributes(va);
00105     fXAnnotationModel = new G4TextModel(*text);
00106   }
00107 
00108   G4Colour yColour(colour);
00109   if (autoColour) yColour = G4Colour::Green();
00110   fYAxisModel = new G4ArrowModel
00111     (x0, y0, z0, x0, y0+length, z0, arrowWidth,
00112      yColour, "y-axis: " + description);
00113   if (withAnnotation) {
00114     text = new G4Text("y",G4Point3D(x0, y0+1.05*length, z0));
00115     text->SetScreenSize(10.);
00116     text->SetLayout(G4Text::centre);
00117     va = new G4VisAttributes(yColour);
00118     text->SetVisAttributes(va);
00119     fYLabelModel = new G4TextModel(*text);
00120     text = new G4Text(annotation,G4Point3D(x0, y0+0.8*length, z0));
00121     text->SetScreenSize(10.);
00122     text->SetOffset(5.,5.);
00123     text->SetLayout(G4Text::centre);
00124     va = new G4VisAttributes(yColour);
00125     text->SetVisAttributes(va);
00126     fYAnnotationModel = new G4TextModel(*text);
00127   }
00128 
00129   G4Colour zColour(colour);
00130   if (autoColour) zColour = G4Colour::Blue();
00131   fZAxisModel = new G4ArrowModel
00132     (x0, y0, z0, x0, y0, z0+length, arrowWidth,
00133      zColour, "z-axis: " + description);
00134   if (withAnnotation) {
00135     text = new G4Text("z",G4Point3D(x0, y0, z0+1.05*length));
00136     text->SetScreenSize(10.);
00137     text->SetLayout(G4Text::centre);
00138     va = new G4VisAttributes(zColour);
00139     text->SetVisAttributes(va);
00140     fZLabelModel = new G4TextModel(*text);
00141     text = new G4Text(annotation,G4Point3D(x0, y0, z0+0.8*length));
00142     text->SetScreenSize(10.);
00143     text->SetOffset(5.,5.);
00144     text->SetLayout(G4Text::centre);
00145     va = new G4VisAttributes(zColour);
00146     text->SetVisAttributes(va);
00147     fZAnnotationModel = new G4TextModel(*text);
00148   }
00149 }

G4AxesModel::~G4AxesModel (  )  [virtual]

Definition at line 44 of file G4AxesModel.cc.

00044 {}


Member Function Documentation

void G4AxesModel::DescribeYourselfTo ( G4VGraphicsScene  )  [virtual]

Implements G4VModel.

Definition at line 151 of file G4AxesModel.cc.

References G4VModel::DescribeYourselfTo().

00152 {
00153   if (fXAxisModel)       fXAxisModel->DescribeYourselfTo(sceneHandler);
00154   if (fXLabelModel)      fXLabelModel->DescribeYourselfTo(sceneHandler);
00155   if (fXAnnotationModel) fXAnnotationModel->DescribeYourselfTo(sceneHandler);
00156   if (fYAxisModel)       fYAxisModel->DescribeYourselfTo(sceneHandler);
00157   if (fYLabelModel)      fYLabelModel->DescribeYourselfTo(sceneHandler);
00158   if (fYAnnotationModel) fYAnnotationModel->DescribeYourselfTo(sceneHandler);
00159   if (fZAxisModel)       fZAxisModel->DescribeYourselfTo(sceneHandler);
00160   if (fZLabelModel)      fZLabelModel->DescribeYourselfTo(sceneHandler);
00161   if (fZAnnotationModel) fZAnnotationModel->DescribeYourselfTo(sceneHandler);
00162 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:51:29 2013 for Geant4 by  doxygen 1.4.7