1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // |
---|
27 | // $Id: G4VMarker.hh,v 1.13 2009/02/24 10:58:04 allison Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // G4VMarker - base class for markers - circles, squares, etc. |
---|
32 | // John Allison 17/11/96. |
---|
33 | |
---|
34 | // Class Description: |
---|
35 | // G4VMarkers are 2-dimensional G4VVisPrims with the special |
---|
36 | // properties (a) of always facing the camera and (b) of having the |
---|
37 | // possibility of a size defined in screen units (pixels) or paper |
---|
38 | // units (points - there are 72 points per inch). The convention is |
---|
39 | // that if a world size is not specified, then the marker will be |
---|
40 | // drawn to the given screen size or paper size independent of the |
---|
41 | // viewing transformation in effect. |
---|
42 | // |
---|
43 | // "Size" means "overall size", e.g., diameter of circle, side of |
---|
44 | // square, height of text (but diameter and radius access functions |
---|
45 | // are defined to avoid ambiguity). |
---|
46 | // |
---|
47 | // So the user who constructs the marker decides whether it should be |
---|
48 | // drawn to a given size in world coordinates by setting the world |
---|
49 | // size. Alternatively, the user can set the screen size (internally, |
---|
50 | // the world size is set to zero) and the marker is drawn to its |
---|
51 | // screen size. Finally, the user may decide not to set any size; in |
---|
52 | // that case, it is drawn according to the sizes specified in the |
---|
53 | // default marker specified in G4ViewParameters. |
---|
54 | // |
---|
55 | // Also in G4ViewParameters is a "global marker scale" which is a |
---|
56 | // factor by which all marker sizes are multiplied before drawing. |
---|
57 | // |
---|
58 | // Thus the graphics system driver scene handler code might look like: |
---|
59 | // |
---|
60 | // void G4XXXGraphicsSceneHandler::AddPrimitive (const G4Circle& circle) { |
---|
61 | // G4bool hidden = !(fpView -> GetViewParameters().IsMarkerNotHidden()); |
---|
62 | // const G4Colour& colour = GetColour (circle); |
---|
63 | // // Base class GetColour. |
---|
64 | // G4VMarker::FillStyle style = circle.GetFillStyle(); |
---|
65 | // const G4Point3D& centre = circle.GetPosition(); |
---|
66 | // MarkerSizeType sizeType; |
---|
67 | // G4double size = GetMarkerSize (circle, sizeType); |
---|
68 | // switch (sizeType) { |
---|
69 | // default: |
---|
70 | // case screen: |
---|
71 | // // Draw in screen coordinates. |
---|
72 | // // ... |
---|
73 | // break; |
---|
74 | // case world: |
---|
75 | // // Draw in world coordinates. |
---|
76 | // // ... |
---|
77 | // break; |
---|
78 | // } |
---|
79 | // } |
---|
80 | // Class Description - End: |
---|
81 | |
---|
82 | |
---|
83 | #ifndef G4VMARKER_HH |
---|
84 | #define G4VMARKER_HH |
---|
85 | |
---|
86 | #include "globals.hh" |
---|
87 | #include "G4Visible.hh" |
---|
88 | #include "G4Point3D.hh" |
---|
89 | #include "G4Colour.hh" |
---|
90 | #include "G4Color.hh" |
---|
91 | |
---|
92 | class G4VMarker: public G4Visible { |
---|
93 | |
---|
94 | friend std::ostream& operator << (std::ostream& os, const G4VMarker&); |
---|
95 | |
---|
96 | public: // With description |
---|
97 | |
---|
98 | enum FillStyle {noFill, hashed, filled}; |
---|
99 | enum SizeType {none, world, screen}; |
---|
100 | |
---|
101 | ////////////////////////////////////////////////////// |
---|
102 | // Constructors... |
---|
103 | G4VMarker (); |
---|
104 | G4VMarker (const G4Point3D& pos); |
---|
105 | |
---|
106 | ////////////////////////////////////////////////////// |
---|
107 | // Destructor... |
---|
108 | virtual ~G4VMarker (); |
---|
109 | |
---|
110 | ////////////////////////////////////////////////////// |
---|
111 | // Logical... |
---|
112 | G4bool operator != (const G4VMarker&) const; |
---|
113 | |
---|
114 | ///////////////////////////////////////////////////// |
---|
115 | // Get functions... |
---|
116 | G4Point3D GetPosition () const; |
---|
117 | SizeType GetSizeType () const; |
---|
118 | G4double GetWorldSize () const; |
---|
119 | G4double GetWorldDiameter () const; |
---|
120 | G4double GetWorldRadius () const; |
---|
121 | G4double GetScreenSize () const; |
---|
122 | G4double GetScreenDiameter () const; |
---|
123 | G4double GetScreenRadius () const; |
---|
124 | FillStyle GetFillStyle () const; |
---|
125 | |
---|
126 | ///////////////////////////////////////////////////// |
---|
127 | // Set functions... |
---|
128 | void SetPosition (const G4Point3D&); |
---|
129 | void SetSize (SizeType, G4double); |
---|
130 | void SetDiameter (SizeType, G4double); |
---|
131 | void SetRadius (SizeType, G4double); |
---|
132 | void SetWorldSize (G4double); |
---|
133 | void SetWorldDiameter (G4double); |
---|
134 | void SetWorldRadius (G4double); |
---|
135 | void SetScreenSize (G4double); |
---|
136 | void SetScreenDiameter (G4double); |
---|
137 | void SetScreenRadius (G4double); |
---|
138 | void SetFillStyle (FillStyle); |
---|
139 | |
---|
140 | // Access functions to the string for user customizable information |
---|
141 | virtual const G4String& GetInfo() const; |
---|
142 | virtual void SetInfo( const G4String& info ); |
---|
143 | |
---|
144 | private: |
---|
145 | G4Point3D fPosition; |
---|
146 | G4double fWorldSize; // Default 0. means use screen size. |
---|
147 | G4double fScreenSize; // Default 0. means use global default. |
---|
148 | FillStyle fFillStyle; |
---|
149 | |
---|
150 | // String for user customizable information |
---|
151 | G4String fInfo ; |
---|
152 | |
---|
153 | }; |
---|
154 | |
---|
155 | #include "G4VMarker.icc" |
---|
156 | |
---|
157 | #endif |
---|