[830] | 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.12 2006/06/29 19:06:14 gunter Exp $ |
---|
| 28 | // GEANT4 tag $Name: $ |
---|
| 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 | |
---|
| 100 | ////////////////////////////////////////////////////// |
---|
| 101 | // Constructors... |
---|
| 102 | G4VMarker (); |
---|
| 103 | G4VMarker (const G4Point3D& pos); |
---|
| 104 | |
---|
| 105 | ////////////////////////////////////////////////////// |
---|
| 106 | // Destructor... |
---|
| 107 | virtual ~G4VMarker (); |
---|
| 108 | |
---|
| 109 | ////////////////////////////////////////////////////// |
---|
| 110 | // Logical... |
---|
| 111 | G4bool operator != (const G4VMarker&) const; |
---|
| 112 | |
---|
| 113 | ///////////////////////////////////////////////////// |
---|
| 114 | // Get functions... |
---|
| 115 | G4Point3D GetPosition () const; |
---|
| 116 | G4double GetWorldSize () const; |
---|
| 117 | G4double GetWorldDiameter () const; |
---|
| 118 | G4double GetWorldRadius () const; |
---|
| 119 | G4double GetScreenSize () const; |
---|
| 120 | G4double GetScreenDiameter () const; |
---|
| 121 | G4double GetScreenRadius () const; |
---|
| 122 | FillStyle GetFillStyle () const; |
---|
| 123 | |
---|
| 124 | ///////////////////////////////////////////////////// |
---|
| 125 | // Set functions... |
---|
| 126 | void SetPosition (const G4Point3D&); |
---|
| 127 | void SetWorldSize (G4double); |
---|
| 128 | void SetWorldDiameter (G4double); |
---|
| 129 | void SetWorldRadius (G4double); |
---|
| 130 | void SetScreenSize (G4double); |
---|
| 131 | void SetScreenDiameter (G4double); |
---|
| 132 | void SetScreenRadius (G4double); |
---|
| 133 | void SetFillStyle (FillStyle); |
---|
| 134 | |
---|
| 135 | // Access functions to the string for user customizable information |
---|
| 136 | virtual const G4String& GetInfo() const; |
---|
| 137 | virtual void SetInfo( const G4String& info ); |
---|
| 138 | |
---|
| 139 | private: |
---|
| 140 | G4Point3D fPosition; |
---|
| 141 | G4double fWorldSize; // Default 0. means use screen size. |
---|
| 142 | G4double fScreenSize; // Default 0. means use global default. |
---|
| 143 | FillStyle fFillStyle; |
---|
| 144 | |
---|
| 145 | // String for user customizable information |
---|
| 146 | G4String fInfo ; |
---|
| 147 | |
---|
| 148 | }; |
---|
| 149 | |
---|
| 150 | #include "G4VMarker.icc" |
---|
| 151 | |
---|
| 152 | #endif |
---|