Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4XXXStoredViewer Class Reference

#include <G4XXXStoredViewer.hh>

Inheritance diagram for G4XXXStoredViewer:
Collaboration diagram for G4XXXStoredViewer:

Public Member Functions

 G4XXXStoredViewer (G4VSceneHandler &, const G4String &name)
 
virtual ~G4XXXStoredViewer ()
 
void SetView ()
 
void ClearView ()
 
void DrawView ()
 
void ShowView ()
 
- Public Member Functions inherited from G4VViewer
 G4VViewer (G4VSceneHandler &, G4int id, const G4String &name="")
 
virtual ~G4VViewer ()
 
virtual void Initialise ()
 
virtual void ResetView ()
 
void RefreshView ()
 
virtual void FinishView ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
const G4StringGetName () const
 
const G4StringGetShortName () const
 
void SetName (const G4String &)
 
G4int GetViewId () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4ViewParametersGetViewParameters () const
 
const G4ViewParametersGetDefaultViewParameters () const
 
virtual const std::vector
< G4ModelingParameters::VisAttributesModifier > * 
GetPrivateVisAttributesModifiers () const
 
void SetViewParameters (const G4ViewParameters &vp)
 
void SetDefaultViewParameters (const G4ViewParameters &vp)
 
const G4VisAttributesGetApplicableVisAttributes (const G4VisAttributes *) const
 
void SetNeedKernelVisit (G4bool need)
 
void NeedKernelVisit ()
 
void ProcessView ()
 

Protected Member Functions

void KernelVisitDecision ()
 
G4bool CompareForKernelVisit (G4ViewParameters &)
 
void DrawFromStore ()
 
- Protected Member Functions inherited from G4VViewer
void SetTouchable (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
 
void TouchableSetVisibility (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
 
void TouchableSetColour (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
 

Protected Attributes

G4ViewParameters fLastVP
 
- Protected Attributes inherited from G4VViewer
G4VSceneHandlerfSceneHandler
 
G4int fViewId
 
G4String fName
 
G4String fShortName
 
G4ViewParameters fVP
 
G4ViewParameters fDefaultVP
 
G4bool fNeedKernelVisit
 

Detailed Description

Definition at line 39 of file G4XXXStoredViewer.hh.

Constructor & Destructor Documentation

G4XXXStoredViewer::G4XXXStoredViewer ( G4VSceneHandler sceneHandler,
const G4String name 
)

Definition at line 43 of file G4XXXStoredViewer.cc.

43  :
44  G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
45 {}
const XML_Char * name
Definition: expat.h:151
G4int IncrementViewCount()
G4VViewer(G4VSceneHandler &, G4int id, const G4String &name="")
Definition: G4VViewer.cc:46
G4XXXStoredViewer::~G4XXXStoredViewer ( )
virtual

Definition at line 47 of file G4XXXStoredViewer.cc.

47 {}

Member Function Documentation

void G4XXXStoredViewer::ClearView ( void  )
virtual

Implements G4VViewer.

Definition at line 55 of file G4XXXStoredViewer.cc.

55  {
56 #ifdef G4XXXStoredDEBUG
57  G4cout << "G4XXXStoredViewer::ClearView() called." << G4endl;
58 #endif
59 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4bool G4XXXStoredViewer::CompareForKernelVisit ( G4ViewParameters lastVP)
protected

Definition at line 113 of file G4XXXStoredViewer.cc.

114 {
115  // Typical comparison. Taken from OpenGL.
116  if (
117  (lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
118  (lastVP.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
119  (lastVP.IsCulling () != fVP.IsCulling ()) ||
120  (lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
121  (lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
122  (lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
123  // No need to visit kernel if section plane changes.
124  // No need to visit kernel if cutaway planes change.
125  (lastVP.IsExplode () != fVP.IsExplode ()) ||
126  (lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
127  (lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
128  (lastVP.GetDefaultVisAttributes()->GetColour() !=
130  (lastVP.GetDefaultTextVisAttributes()->GetColour() !=
132  (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
133  (lastVP.GetVisAttributesModifiers() !=
135  ) {
136  return true;
137  }
138 
139  if (lastVP.IsDensityCulling () &&
140  (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
141  return true;
142 
143  if (lastVP.IsExplode () &&
144  (lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
145  return true;
146 
147  return false;
148 }
const G4Colour & GetBackgroundColour() const
G4double GetVisibleDensity() const
G4bool IsCullingInvisible() const
G4double GetExplodeFactor() const
const G4Colour & GetColour() const
G4bool IsDensityCulling() const
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
G4bool IsAuxEdgeVisible() const
G4bool IsCullingCovered() const
G4ViewParameters fVP
Definition: G4VViewer.hh:205
const G4VisAttributes * GetDefaultTextVisAttributes() const
G4bool IsExplode() const
G4bool IsMarkerNotHidden() const
G4int GetNoOfSides() const
DrawingStyle GetDrawingStyle() const
const G4VisAttributes * GetDefaultVisAttributes() const
G4bool IsCulling() const

Here is the call graph for this function:

Here is the caller graph for this function:

void G4XXXStoredViewer::DrawFromStore ( )
protected

Definition at line 150 of file G4XXXStoredViewer.cc.

150  {
151  typedef std::list<G4String> Store;
152  typedef std::list<G4String>::iterator StoreIterator;
153  Store& store =
154  static_cast<G4XXXStoredSceneHandler&>(fSceneHandler).fStore;
155  // Write to a file for testing...
156  static G4int iCount = 0;
157  std::ostringstream oss;
158  oss << fName << '.' << iCount++ << ".out";
159  std::ofstream ofs(oss.str().c_str());
160  for (StoreIterator i = store.begin(); i != store.end(); ++i) {
161  ofs << *i;
162  }
163  ofs.close();
164 }
int G4int
Definition: G4Types.hh:78
G4String fName
Definition: G4VViewer.hh:203
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:201

Here is the caller graph for this function:

void G4XXXStoredViewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 61 of file G4XXXStoredViewer.cc.

61  {
62 #ifdef G4XXXStoredDEBUG
63  G4cout << "G4XXXStoredViewer::DrawView() called." << G4endl;
64 #endif
65 
66  // First, a view should decide when to re-visit the G4 kernel.
67  // Sometimes it might not be necessary, e.g., if the scene is stored
68  // in a graphical database (e.g., OpenGL's display lists) and only
69  // the viewing angle has changed. But graphics systems without a
70  // graphical database will always need to visit the G4 kernel.
71 
72  // The fNeedKernelVisit flag might have been set by the user in
73  // /vis/viewer/rebuild, but if not, make decision and set flag only
74  // if necessary...
76  G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
77 
78  ProcessView (); // Clears store and processes scene only if necessary.
79 
80  if (kernelVisitWasNeeded) {
81  // Some systems, notably OpenGL, can draw while re-building, so
82  // there might not be a need to draw from store again here. But
83  // in this case...
84  DrawFromStore();
85  } else {
86  DrawFromStore();
87  }
88 
89  // ...before finally...
90  FinishView (); // Flush streams and/or swap buffers.
91 }
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
G4bool fNeedKernelVisit
Definition: G4VViewer.hh:210
#define G4endl
Definition: G4ios.hh:61
void ProcessView()
Definition: G4VViewer.cc:105
virtual void FinishView()
Definition: G4VViewer.cc:101

Here is the call graph for this function:

void G4XXXStoredViewer::KernelVisitDecision ( )
protected

Definition at line 99 of file G4XXXStoredViewer.cc.

99  {
100 
101  // If there's a significant difference with the last view parameters
102  // of either the scene handler or this viewer, trigger a rebuild.
103 
104  typedef std::list<G4String> Store;
105  Store& store =
106  static_cast<G4XXXStoredSceneHandler&>(fSceneHandler).fStore;
107  if (store.empty() || CompareForKernelVisit(fLastVP)) {
108  NeedKernelVisit (); // Sets fNeedKernelVisit.
109  }
110  fLastVP = fVP;
111 }
G4ViewParameters fVP
Definition: G4VViewer.hh:205
G4bool CompareForKernelVisit(G4ViewParameters &)
void NeedKernelVisit()
Definition: G4VViewer.cc:78
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:201
G4ViewParameters fLastVP

Here is the call graph for this function:

Here is the caller graph for this function:

void G4XXXStoredViewer::SetView ( )
virtual

Implements G4VViewer.

Definition at line 49 of file G4XXXStoredViewer.cc.

49  {
50 #ifdef G4XXXStoredDEBUG
51  G4cout << "G4XXXStoredViewer::SetView() called." << G4endl;
52 #endif
53 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4XXXStoredViewer::ShowView ( void  )
virtual

Reimplemented from G4VViewer.

Definition at line 93 of file G4XXXStoredViewer.cc.

93  {
94 #ifdef G4XXXStoredDEBUG
95  G4cout << "G4XXXStoredViewer::ShowView() called." << G4endl;
96 #endif
97 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Member Data Documentation

G4ViewParameters G4XXXStoredViewer::fLastVP
protected

Definition at line 51 of file G4XXXStoredViewer.hh.


The documentation for this class was generated from the following files: