Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CexmcScenePrimitives.hh
Go to the documentation of this file.
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  * =============================================================================
28  *
29  * Filename: CexmcScenePrimitives.hh
30  *
31  * Description: auxiliary scene primitives (radial lines etc.)
32  *
33  * Version: 1.0
34  * Created: 03.01.2011 11:27:34
35  * Revision: none
36  * Compiler: gcc
37  *
38  * Author: Alexey Radkov (),
39  * Company: PNPI
40  *
41  * =============================================================================
42  */
43 
44 #ifndef CEXMC_SCENE_PRIMITIVES_HH
45 #define CEXMC_SCENE_PRIMITIVES_HH
46 
47 #include <vector>
48 #include <map>
49 #include <G4Colour.hh>
50 #include <G4ThreeVector.hh>
51 #include <G4VModel.hh>
52 #include <G4VVisManager.hh>
53 
54 class G4VGraphicsScene;
55 class CexmcSetup;
57 
58 
60 {
64 };
65 
66 
68 {
69  private:
70  struct CexmcRadialLine
71  {
72  CexmcRadialLine( const G4ThreeVector & line ) :
73  theta( line.x() ), phi( line.y() ), length( line.z() )
74  {}
75 
76  G4double theta;
77 
78  G4double phi;
79 
80  G4double length;
81  };
82 
83  typedef std::vector< CexmcRadialLine > CexmcRadialLines;
84 
85  typedef std::map< CexmcSPType, G4Colour > CexmcSPColourMap;
86 
87  public:
88  explicit CexmcScenePrimitives( CexmcSetup * setup );
89 
91 
92  public:
93  void DescribeYourselfTo( G4VGraphicsScene & scene );
94 
95  public:
96  void MarkTargetCenter( G4bool on = true );
97 
98  void DrawRadialLine( const G4ThreeVector & line );
99 
100  void HighlightInnerCrystals( G4bool = true );
101 
102  void ClearRadialLines( void );
103 
104  void SetColour( CexmcSPType primitive, const G4Colour & colour );
105 
106  private:
107  void DrawRadialLine( G4VGraphicsScene & scene,
108  const CexmcRadialLine * rLine );
109 
110  void MarkTargetCenter( G4VGraphicsScene & scene );
111 
113 
114  private:
115  void UpdateScene( void );
116 
117  private:
118  CexmcSetup * setup;
119 
120  G4bool markTargetCenter;
121 
122  G4bool highlightInnerCrystals;
123 
124  CexmcRadialLines radialLines;
125 
126  CexmcSPColourMap spColours;
127 
128  private:
129  CexmcScenePrimitivesMessenger * messenger;
130 };
131 
132 
134  const G4Colour & colour )
135 {
136  spColours[ primitive ] = colour;
137 }
138 
139 
141 {
142  radialLines.push_back( line );
143  UpdateScene();
144 }
145 
146 
148 {
149  markTargetCenter = on;
150  UpdateScene();
151 }
152 
153 
155 {
156  highlightInnerCrystals = on;
157  UpdateScene();
158 }
159 
160 
162 {
163  radialLines.clear();
164  UpdateScene();
165 }
166 
167 
168 inline void CexmcScenePrimitives::UpdateScene( void )
169 {
171  if ( visManager )
172  visManager->NotifyHandlers();
173 }
174 
175 
176 #endif
177 
double x() const
static G4VVisManager * GetConcreteInstance()
void SetColour(CexmcSPType primitive, const G4Colour &colour)
void MarkTargetCenter(G4bool on=true)
double z() const
bool G4bool
Definition: G4Types.hh:79
CexmcScenePrimitives(CexmcSetup *setup)
double y() const
double G4double
Definition: G4Types.hh:76
void HighlightInnerCrystals(G4bool=true)
void DrawRadialLine(const G4ThreeVector &line)
void DescribeYourselfTo(G4VGraphicsScene &scene)