00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // 00030 // G4VMarker - base class for markers - circles, squares, etc. 00031 // John Allison 17/11/96. 00032 00033 // Class Description: 00034 // G4VMarkers are 2-dimensional G4VVisPrims with the special 00035 // properties (a) of always facing the camera and (b) of having the 00036 // possibility of a size defined in screen units (pixels) or paper 00037 // units (points - there are 72 points per inch). The convention is 00038 // that if a world size is not specified, then the marker will be 00039 // drawn to the given screen size or paper size independent of the 00040 // viewing transformation in effect. 00041 // 00042 // "Size" means "overall size", e.g., diameter of circle, side of 00043 // square, height of text (but diameter and radius access functions 00044 // are defined to avoid ambiguity). 00045 // 00046 // So the user who constructs the marker decides whether it should be 00047 // drawn to a given size in world coordinates by setting the world 00048 // size. Alternatively, the user can set the screen size (internally, 00049 // the world size is set to zero) and the marker is drawn to its 00050 // screen size. Finally, the user may decide not to set any size; in 00051 // that case, it is drawn according to the sizes specified in the 00052 // default marker specified in G4ViewParameters. 00053 // 00054 // Also in G4ViewParameters is a "global marker scale" which is a 00055 // factor by which all marker sizes are multiplied before drawing. 00056 // 00057 // Thus the graphics system driver scene handler code might look like: 00058 // 00059 // void G4XXXGraphicsSceneHandler::AddPrimitive (const G4Circle& circle) { 00060 // G4bool hidden = !(fpView -> GetViewParameters().IsMarkerNotHidden()); 00061 // const G4Colour& colour = GetColour (circle); 00062 // // Base class GetColour. 00063 // G4VMarker::FillStyle style = circle.GetFillStyle(); 00064 // const G4Point3D& centre = circle.GetPosition(); 00065 // MarkerSizeType sizeType; 00066 // G4double size = GetMarkerSize (circle, sizeType); 00067 // switch (sizeType) { 00068 // default: 00069 // case screen: 00070 // // Draw in screen coordinates. 00071 // // ... 00072 // break; 00073 // case world: 00074 // // Draw in world coordinates. 00075 // // ... 00076 // break; 00077 // } 00078 // } 00079 // Class Description - End: 00080 00081 00082 #ifndef G4VMARKER_HH 00083 #define G4VMARKER_HH 00084 00085 #include "globals.hh" 00086 #include "G4Visible.hh" 00087 #include "G4Point3D.hh" 00088 #include "G4Colour.hh" 00089 #include "G4Color.hh" 00090 00091 class G4VMarker: public G4Visible { 00092 00093 friend std::ostream& operator << (std::ostream& os, const G4VMarker&); 00094 00095 public: // With description 00096 00097 enum FillStyle {noFill, hashed, filled}; 00098 enum SizeType {none, world, screen}; 00099 00101 // Constructors... 00102 G4VMarker (); 00103 G4VMarker (const G4VMarker&); 00104 G4VMarker (const G4Point3D& position); 00105 00107 // Destructor... 00108 virtual ~G4VMarker (); 00109 00111 // Assignment... 00112 G4VMarker& operator = (const G4VMarker&); 00113 00115 // Logical... 00116 G4bool operator != (const G4VMarker&) const; 00117 00119 // Get functions... 00120 G4Point3D GetPosition () const; 00121 SizeType GetSizeType () const; 00122 G4double GetWorldSize () const; 00123 G4double GetWorldDiameter () const; 00124 G4double GetWorldRadius () const; 00125 G4double GetScreenSize () const; 00126 G4double GetScreenDiameter () const; 00127 G4double GetScreenRadius () const; 00128 FillStyle GetFillStyle () const; 00129 00131 // Set functions... 00132 void SetPosition (const G4Point3D&); 00133 void SetSize (SizeType, G4double); 00134 void SetDiameter (SizeType, G4double); 00135 void SetRadius (SizeType, G4double); 00136 void SetWorldSize (G4double); 00137 void SetWorldDiameter (G4double); 00138 void SetWorldRadius (G4double); 00139 void SetScreenSize (G4double); 00140 void SetScreenDiameter (G4double); 00141 void SetScreenRadius (G4double); 00142 void SetFillStyle (FillStyle); 00143 00144 // Access functions to the string for user customizable information 00145 virtual const G4String& GetInfo() const; 00146 virtual void SetInfo( const G4String& info ); 00147 00148 private: 00149 G4Point3D fPosition; 00150 G4double fWorldSize; // Default 0. means use screen size. 00151 G4double fScreenSize; // Default 0. means use global default. 00152 FillStyle fFillStyle; 00153 00154 // String for user customizable information 00155 G4String fInfo ; 00156 00157 }; 00158 00159 #include "G4VMarker.icc" 00160 00161 #endif