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

#include <G4XXXSGViewer.hh>

Inheritance diagram for G4XXXSGViewer:
Collaboration diagram for G4XXXSGViewer:

Public Member Functions

 G4XXXSGViewer (G4VSceneHandler &, const G4String &name)
 
virtual ~G4XXXSGViewer ()
 
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 (const G4String &source)
 
- 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 G4XXXSGViewer.hh.

Constructor & Destructor Documentation

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

Definition at line 42 of file G4XXXSGViewer.cc.

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

Definition at line 46 of file G4XXXSGViewer.cc.

46 {}

Member Function Documentation

void G4XXXSGViewer::ClearView ( void  )
virtual

Implements G4VViewer.

Definition at line 54 of file G4XXXSGViewer.cc.

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

Definition at line 115 of file G4XXXSGViewer.cc.

116 {
117  // Typical comparison. Taken from OpenGL.
118  if (
119  (lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
120  (lastVP.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
121  (lastVP.IsCulling () != fVP.IsCulling ()) ||
122  (lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
123  (lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
124  (lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
125  // No need to visit kernel if section plane changes.
126  // No need to visit kernel if cutaway planes change.
127  (lastVP.IsExplode () != fVP.IsExplode ()) ||
128  (lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
129  (lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
130  (lastVP.GetDefaultVisAttributes()->GetColour() !=
132  (lastVP.GetDefaultTextVisAttributes()->GetColour() !=
134  (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
135  (lastVP.GetVisAttributesModifiers() !=
137  ) {
138  return true;
139  }
140 
141  if (lastVP.IsDensityCulling () &&
142  (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
143  return true;
144 
145  if (lastVP.IsExplode () &&
146  (lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
147  return true;
148 
149  return false;
150 }
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 G4XXXSGViewer::DrawFromStore ( const G4String source)
protected

Definition at line 152 of file G4XXXSGViewer.cc.

152  {
153  SceneGraph& sceneGraph =
154  static_cast<G4XXXSGSceneHandler&>(fSceneHandler).fSceneGraph;
155  // Write to a file for testing...
156  static G4int iCount = 0;
157  std::ostringstream oss;
158  oss << source << '.' << fName << '.' << iCount++ << ".out";
159  G4cout << "Writing " << oss.str() << G4endl;
160  std::ofstream ofs(oss.str().c_str());
161  JA::PrintTree(ofs,&sceneGraph);
162  ofs.close();
163 }
void PrintTree(std::ostream &, Node *)
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4String fName
Definition: G4VViewer.hh:203
#define G4endl
Definition: G4ios.hh:61
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:201

Here is the call graph for this function:

Here is the caller graph for this function:

void G4XXXSGViewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 60 of file G4XXXSGViewer.cc.

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

Definition at line 100 of file G4XXXSGViewer.cc.

100  {
101 
102  // If there's a significant difference with the last view parameters
103  // of either the scene handler or this viewer, trigger a rebuild.
104 
105  SceneGraph& sceneGraph =
106  static_cast<G4XXXSGSceneHandler&>(fSceneHandler).fSceneGraph;
107  if (sceneGraph.fDaughters.size() == 3 // I.e., only the root nodes.
108  // (The above needs re-thinking.)
110  NeedKernelVisit (); // Sets fNeedKernelVisit.
111  }
112  fLastVP = fVP;
113 }
G4bool CompareForKernelVisit(G4ViewParameters &)
G4ViewParameters fLastVP
G4ViewParameters fVP
Definition: G4VViewer.hh:205
std::vector< Node * > fDaughters
void NeedKernelVisit()
Definition: G4VViewer.cc:78
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:201

Here is the call graph for this function:

Here is the caller graph for this function:

void G4XXXSGViewer::SetView ( )
virtual

Implements G4VViewer.

Definition at line 48 of file G4XXXSGViewer.cc.

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

Reimplemented from G4VViewer.

Definition at line 92 of file G4XXXSGViewer.cc.

92  {
93  //#ifdef G4XXXSGDEBUG
94  G4cout << "G4XXXSGViewer::ShowView() called." << G4endl;
95  //#endif
96  // This is what you should see...
97  DrawFromStore("G4XXXSGViewer::ShowView");
98 }
G4GLOB_DLL std::ostream G4cout
void DrawFromStore(const G4String &source)
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Member Data Documentation

G4ViewParameters G4XXXSGViewer::fLastVP
protected

Definition at line 51 of file G4XXXSGViewer.hh.


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