Geant4 11.3.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VViewer Class Referenceabstract

#include <G4VViewer.hh>

+ Inheritance diagram for G4VViewer:

Classes

class  SceneTreeScene
 

Public Member Functions

 G4VViewer (G4VSceneHandler &, G4int id, const G4String &name="")
 
virtual ~G4VViewer ()
 
virtual void Initialise ()
 
virtual void ResetView ()
 
virtual void SetView ()=0
 
virtual void ClearView ()=0
 
virtual void DrawView ()=0
 
void RefreshView ()
 
virtual void ShowView ()
 
virtual void FinishView ()
 
virtual G4bool ReadyToDraw ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
virtual void DoneWithMasterThread ()
 
virtual void MovingToVisSubThread ()
 
virtual void SwitchToVisSubThread ()
 
virtual void DoneWithVisSubThread ()
 
virtual void MovingToMasterThread ()
 
virtual void SwitchToMasterThread ()
 
void InsertModelInSceneTree (G4VModel *)
 
const G4SceneTreeItemGetSceneTree ()
 
G4SceneTreeItemAccessSceneTree ()
 
void UpdateGUISceneTree ()
 
const G4StringGetName () const
 
const G4StringGetShortName () const
 
void SetName (const G4String &)
 
G4int GetViewId () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4ViewParametersGetViewParameters () const
 
const G4ViewParametersGetDefaultViewParameters () const
 
G4double GetKernelVisitElapsedTimeSeconds () 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 ()
 

Public Attributes

const G4int fMaxNTouchables = 10000
 
G4bool fCurtailDescent = false
 

Protected Member Functions

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

G4VSceneHandlerfSceneHandler
 
G4int fViewId
 
G4String fName
 
G4String fShortName
 
G4ViewParameters fVP
 
G4ViewParameters fDefaultVP
 
G4double fKernelVisitElapsedTimeSeconds = 999.
 
G4SceneTreeItem fSceneTree
 
G4bool fNeedKernelVisit
 

Friends

std::ostream & operator<< (std::ostream &os, const G4VViewer &v)
 

Detailed Description

Definition at line 52 of file G4VViewer.hh.

Constructor & Destructor Documentation

◆ G4VViewer()

G4VViewer::G4VViewer ( G4VSceneHandler & sceneHandler,
G4int id,
const G4String & name = "" )

Definition at line 49 of file G4VViewer.cc.

50 : fSceneHandler(sceneHandler), fViewId(id), fNeedKernelVisit(true)
51{
52 if (name == "") {
53 std::ostringstream ost;
54 ost << fSceneHandler.GetName() << '-' << fViewId;
55 fName = ost.str();
56 }
57 else {
58 fName = name;
59 }
60 fShortName = fName.substr(0, fName.find(' '));
61 G4StrUtil::strip(fShortName);
62
65
67 fSceneTree.SetDescription(fName);
68}
G4bool fNeedKernelVisit
Definition G4VViewer.hh:265
G4VSceneHandler & fSceneHandler
Definition G4VViewer.hh:253
G4String fShortName
Definition G4VViewer.hh:256
G4String fName
Definition G4VViewer.hh:255
G4ViewParameters fDefaultVP
Definition G4VViewer.hh:258
G4int fViewId
Definition G4VViewer.hh:254
G4ViewParameters fVP
Definition G4VViewer.hh:257
G4SceneTreeItem fSceneTree
Definition G4VViewer.hh:261
const G4ViewParameters & GetDefaultViewParameters() const
static G4VisManager * GetInstance()
const char * name(G4int ptype)

Referenced by G4DAWNFILEViewer::G4DAWNFILEViewer(), G4GMocrenFileViewer::G4GMocrenFileViewer(), G4HepRepFileViewer::G4HepRepFileViewer(), G4OpenGLImmediateQtViewer::G4OpenGLImmediateQtViewer(), G4OpenGLImmediateViewer::G4OpenGLImmediateViewer(), G4OpenGLImmediateWin32Viewer::G4OpenGLImmediateWin32Viewer(), G4OpenGLImmediateXmViewer::G4OpenGLImmediateXmViewer(), G4OpenGLImmediateXViewer::G4OpenGLImmediateXViewer(), G4OpenGLQtViewer::G4OpenGLQtViewer(), G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer(), G4OpenGLStoredViewer::G4OpenGLStoredViewer(), G4OpenGLStoredWin32Viewer::G4OpenGLStoredWin32Viewer(), G4OpenGLStoredXmViewer::G4OpenGLStoredXmViewer(), G4OpenGLStoredXViewer::G4OpenGLStoredXViewer(), G4OpenGLViewer::G4OpenGLViewer(), G4OpenGLWin32Viewer::G4OpenGLWin32Viewer(), G4OpenGLXmViewer::G4OpenGLXmViewer(), G4OpenGLXViewer::G4OpenGLXViewer(), G4OpenInventorViewer::G4OpenInventorViewer(), G4Qt3DViewer::G4Qt3DViewer(), G4RayTracerViewer::G4RayTracerViewer(), G4VRML2FileViewer::G4VRML2FileViewer(), G4VtkViewer::G4VtkViewer(), G4VTreeViewer::G4VTreeViewer(), operator<<, G4VViewer::SceneTreeScene::SceneTreeScene(), G4ToolsSGOffscreenViewer::Messenger::SetNewValue(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::Messenger::SetNewValue(), and G4VViewer::SceneTreeScene::~SceneTreeScene().

◆ ~G4VViewer()

G4VViewer::~G4VViewer ( )
virtual

Definition at line 70 of file G4VViewer.cc.

71{
72 fSceneHandler.RemoveViewerFromList(this);
73}

Member Function Documentation

◆ AccessSceneTree()

G4SceneTreeItem & G4VViewer::AccessSceneTree ( )
inline

Definition at line 189 of file G4VViewer.hh.

189{return fSceneTree;}

Referenced by G4VisCommandViewerCreate::SetNewValue().

◆ ClearView()

◆ ComputeFlyThrough()

std::vector< G4ThreeVector > G4VViewer::ComputeFlyThrough ( G4Vector3D * )

◆ DoneWithMasterThread()

virtual void G4VViewer::DoneWithMasterThread ( )
inlinevirtual

Definition at line 124 of file G4VViewer.hh.

124{}

◆ DoneWithVisSubThread()

virtual void G4VViewer::DoneWithVisSubThread ( )
inlinevirtual

Definition at line 133 of file G4VViewer.hh.

133{}

Referenced by G4VisManager::G4VisSubThread().

◆ DrawView()

virtual void G4VViewer::DrawView ( )
pure virtual

Implemented in G4DAWNFILEViewer, G4GMocrenFileViewer, G4HepRepFileViewer, G4OpenGLImmediateQtViewer, G4OpenGLImmediateWin32Viewer, G4OpenGLImmediateXmViewer, G4OpenGLImmediateXViewer, G4OpenGLStoredQtViewer, G4OpenGLStoredWin32Viewer, G4OpenGLStoredXmViewer, G4OpenGLStoredXViewer, G4OpenInventorViewer, G4Qt3DViewer, G4RayTracerViewer, G4ToolsSGOffscreenViewer, G4ToolsSGViewer< SG_SESSION, SG_VIEWER >, G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >, G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >, G4ToolsSGViewer< toolx::Qt::session, toolx::Qt::sg_viewer >, G4ToolsSGViewer< toolx::Qt::session, toolx::Qt::sg_viewer >, G4ToolsSGViewer< toolx::Qt::session, toolx::Qt::zb_viewer >, G4ToolsSGViewer< toolx::Qt::session, toolx::Qt::zb_viewer >, G4VRML2FileViewer, G4VtkViewer, and G4VTreeViewer.

Referenced by G4OpenGLXmViewer::antialias_callback(), G4OpenGLXmViewer::aux_edge_callback(), G4OpenGLXmViewer::background_color_callback(), G4OpenGLXmViewer::dolly_callback(), G4OpenGLXmViewer::drawing_style_callback(), G4OpenGLViewer::GetPickDetails(), G4OpenGLXmViewer::haloing_callback(), G4OpenGLXmViewer::left_right_pan_callback(), G4OpenGLXmViewer::projection_callback(), G4OpenGLXmViewer::reset_callback(), G4OpenGLXmViewer::rotate_in_phi(), G4OpenGLXmViewer::rotate_in_theta(), G4VisCommandViewerRebuild::SetNewValue(), G4OpenGLXmViewer::transparency_callback(), G4OpenGLXmViewer::up_down_pan_callback(), G4OpenGLXmViewer::wobble_timer_callback(), and G4OpenGLXmViewer::zoom_callback().

◆ FinishView()

◆ GetApplicableVisAttributes()

◆ GetDefaultViewParameters()

const G4ViewParameters & G4VViewer::GetDefaultViewParameters ( ) const

◆ GetKernelVisitElapsedTimeSeconds()

G4double G4VViewer::GetKernelVisitElapsedTimeSeconds ( ) const

◆ GetName()

◆ GetPrivateVisAttributesModifiers()

virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * G4VViewer::GetPrivateVisAttributesModifiers ( ) const
virtual

◆ GetSceneHandler()

◆ GetSceneTree()

const G4SceneTreeItem & G4VViewer::GetSceneTree ( )
inline

Definition at line 188 of file G4VViewer.hh.

188{return fSceneTree;}

◆ GetShortName()

const G4String & G4VViewer::GetShortName ( ) const

◆ GetViewId()

◆ GetViewParameters()

const G4ViewParameters & G4VViewer::GetViewParameters ( ) const

Referenced by G4OpenGLXmViewer::actions_callback(), G4OpenGLXmViewer::background_color_callback(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), G4OpenGLStoredXViewer::DrawView(), G4VVisCommand::RefreshIfRequired(), G4VisCommandDrawLogicalVolume::SetNewValue(), G4VisCommandDrawView::SetNewValue(), G4VisCommandGeometrySetDaughtersInvisible::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValue(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4VisCommandSceneNotifyHandlers::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandsViewerSet::SetNewValue(), G4VisCommandViewerAddCutawayPlane::SetNewValue(), G4VisCommandViewerCentreOn::SetNewValue(), G4VisCommandViewerChangeCutawayPlane::SetNewValue(), G4VisCommandViewerClearCutawayPlanes::SetNewValue(), G4VisCommandViewerClearVisAttributesModifiers::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerColourByDensity::SetNewValue(), G4VisCommandViewerCopyViewFrom::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerDolly::SetNewValue(), G4VisCommandViewerInterpolate::SetNewValue(), G4VisCommandViewerPan::SetNewValue(), G4VisCommandViewerResetCameraParameters::SetNewValue(), G4VisCommandViewerSave::SetNewValue(), G4VisCommandViewerScale::SetNewValue(), G4VisCommandViewerZoom::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4OpenInventorViewer::SetReducedWireFrame(), G4OpenInventorViewer::SetSolid(), and G4OpenInventorViewer::SetWireFrame().

◆ Initialise()

◆ InsertModelInSceneTree()

void G4VViewer::InsertModelInSceneTree ( G4VModel * model)

Definition at line 235 of file G4VViewer.cc.

236{
237 const auto& modelType = model->GetType();
238 const auto& modelDescription = model->GetGlobalDescription();
239
240 auto type = G4SceneTreeItem::model;
241 auto pvModel = dynamic_cast<G4PhysicalVolumeModel*>(model);
242 if (pvModel) type = G4SceneTreeItem::pvmodel;
243
244 fCurtailDescent = false; // This is used later in SceneTreeScene::ProcessVolume
245 G4String furtherInfo;
246 if (pvModel) {
247 struct : public G4PseudoScene {
248 void ProcessVolume(const G4VSolid&) {++fNTotalTouchables;}
249 G4int fNTotalTouchables = 0;
250 } counter;
251 pvModel->DescribeYourselfTo(counter); // Calls ProcessVolume for every touchable
252 if (counter.fNTotalTouchables > fMaxNTouchables) {
253 std::ostringstream oss;
254 oss << counter.fNTotalTouchables << " touchables - too many for scene tree";
255 furtherInfo = oss.str();
256 if (G4VisManager::GetInstance()->GetVerbosity() >= G4VisManager::warnings) {
258 ed << pvModel->GetGlobalDescription() <<
259 ":\n Too many touchables (" << counter.fNTotalTouchables
260 << ") for scene tree. Scene tree for this model will be empty.";
261 G4Exception("G4VViewer::InsertModelInSceneTree", "visman0404", JustWarning, ed);
262 }
263 fCurtailDescent = true; // This is used later in SceneTreeScene::ProcessVolume
264 }
265 }
266
267 // Find appropriate model
268 auto& modelItems = fSceneTree.AccessChildren();
269 auto modelIter = modelItems.begin();
270 auto pvModelIter = modelItems.end();
271 for (; modelIter != modelItems.end(); ++modelIter) {
272 if (modelIter->GetType() == G4SceneTreeItem::pvmodel) {
273 pvModelIter = modelIter; // Last pre-existing PV model (if any)
274 }
275 if (modelIter->GetModelDescription() == modelDescription) break;
276 }
277
278 if (modelIter == modelItems.end()) { // Model not seen before
279 G4SceneTreeItem modelItem(type);
280 modelItem.SetDescription("model");
281 modelItem.SetModelType(modelType);
282 modelItem.SetModelDescription(modelDescription);
283 modelItem.SetFurtherInfo(furtherInfo);
284 if (pvModelIter != modelItems.end() && // There was pre-existing PV Model...
285 type == G4SceneTreeItem::pvmodel) { // ...and the new model is also PV...
286 fSceneTree.InsertChild(++pvModelIter, modelItem); // ...insert after, else...
287 } else {
288 fSceneTree.InsertChild(modelIter, modelItem); // ...insert at end
289 }
290 } else { // Existing model - mark visible == active
291 modelIter->AccessVisAttributes().SetVisibility(true);
292 }
293}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
int G4int
Definition G4Types.hh:85
const G4String & GetGlobalDescription() const
const G4String & GetType() const
G4bool fCurtailDescent
Definition G4VViewer.hh:192
const G4int fMaxNTouchables
Definition G4VViewer.hh:191

◆ MovingToMasterThread()

virtual void G4VViewer::MovingToMasterThread ( )
inlinevirtual

Reimplemented in G4Qt3DViewer.

Definition at line 136 of file G4VViewer.hh.

136{}

Referenced by G4VisManager::G4VisSubThread().

◆ MovingToVisSubThread()

virtual void G4VViewer::MovingToVisSubThread ( )
inlinevirtual

Reimplemented in G4Qt3DViewer.

Definition at line 127 of file G4VViewer.hh.

127{}

◆ NeedKernelVisit()

void G4VViewer::NeedKernelVisit ( )

Definition at line 82 of file G4VViewer.cc.

83{
84 fNeedKernelVisit = true;
85
86 // At one time I thought we'd better notify all viewers. But I guess
87 // each viewer can take care of itself, so the following code is
88 // redundant (but keep it commented out for now). (John Allison)
89 // Notify all viewers that a kernel visit is required.
90 // const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
91 // G4ViewerListConstIterator i;
92 // for (i = viewerList.begin(); i != viewerList.end(); i++) {
93 // (*i) -> SetNeedKernelVisit ();
94 // }
95 // ??...but, there's a problem in OpenGL Stored which seems to
96 // require *all* viewers to revisit the kernel, so...
97 // const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
98 // G4ViewerListConstIterator i;
99 // for (i = viewerList.begin(); i != viewerList.end(); i++) {
100 // (*i) -> SetNeedKernelVisit (true);
101 // }
102 // Feb 2005 - commented out. Let's fix OpenGL if necessary.
103}

Referenced by G4DAWNFILEViewer::DrawView(), G4GMocrenFileViewer::DrawView(), G4HepRepFileViewer::DrawView(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), G4VRML2FileViewer::DrawView(), G4VtkViewer::DrawView(), G4VTreeViewer::DrawView(), G4OpenGLStoredViewer::KernelVisitDecision(), G4OpenInventorViewer::KernelVisitDecision(), G4Qt3DViewer::KernelVisitDecision(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::KernelVisitDecision(), G4OpenGLImmediateViewer::ProcessView(), G4VisCommandViewerRebuild::SetNewValue(), G4OpenInventorViewer::SetPreview(), G4OpenInventorViewer::SetPreviewAndFull(), G4OpenInventorViewer::SetReducedWireFrame(), and G4OpenInventorViewer::UpdateScene().

◆ ProcessView()

void G4VViewer::ProcessView ( )

Definition at line 109 of file G4VViewer.cc.

110{
111 // If the scene has changed, or if the concrete viewer has decided
112 // that it necessary to visit the kernel, perhaps because the view
113 // parameters have changed significantly (this should be done in the
114 // concrete viewer's DrawView)...
115 if (fNeedKernelVisit) {
116 // Reset flag. This must be done before ProcessScene to prevent
117 // recursive calls when recomputing transients...
118 G4Timer timer;
119 timer.Start();
120 fNeedKernelVisit = false;
121 fSceneHandler.ClearStore();
122 fSceneHandler.ProcessScene();
124 timer.Stop();
126 }
127}
void Stop()
void Start()
G4double GetRealElapsed() const
Definition G4Timer.cc:113
G4double fKernelVisitElapsedTimeSeconds
Definition G4VViewer.hh:259
void UpdateGUISceneTree()
Definition G4VViewer.cc:228

Referenced by G4DAWNFILEViewer::DrawView(), G4GMocrenFileViewer::DrawView(), G4HepRepFileViewer::DrawView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), G4OpenGLStoredXViewer::DrawView(), G4OpenInventorViewer::DrawView(), G4Qt3DViewer::DrawView(), G4RayTracerViewer::DrawView(), G4ToolsSGOffscreenViewer::DrawView(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::DrawView(), G4VRML2FileViewer::DrawView(), G4VtkViewer::DrawView(), G4VTreeViewer::DrawView(), and G4OpenGLImmediateViewer::ProcessView().

◆ ReadyToDraw()

virtual G4bool G4VViewer::ReadyToDraw ( )
inlinevirtual

Reimplemented in G4OpenGLQtViewer.

Definition at line 108 of file G4VViewer.hh.

108{return true;}

◆ RefreshView()

void G4VViewer::RefreshView ( )

◆ ResetView()

virtual void G4VViewer::ResetView ( )
virtual

◆ SetDefaultViewParameters()

void G4VViewer::SetDefaultViewParameters ( const G4ViewParameters & vp)

◆ SetName()

void G4VViewer::SetName ( const G4String & name)

Definition at line 75 of file G4VViewer.cc.

76{
77 fName = name;
78 fShortName = fName.substr(0, fName.find(' '));
79 G4StrUtil::strip(fShortName);
80}

◆ SetNeedKernelVisit()

void G4VViewer::SetNeedKernelVisit ( G4bool need)

◆ SetTouchable()

void G4VViewer::SetTouchable ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > & fullPath)
protected

Definition at line 134 of file G4VViewer.cc.

136{
137 // Set the touchable for /vis/touchable/set/... commands.
138 std::ostringstream oss;
139 const auto& pvStore = G4PhysicalVolumeStore::GetInstance();
140 for (const auto& pvNodeId : fullPath) {
141 const auto& pv = pvNodeId.GetPhysicalVolume();
142 auto iterator = find(pvStore->cbegin(), pvStore->cend(), pv);
143 if (iterator == pvStore->cend()) {
145 ed << "Volume no longer in physical volume store.";
146 G4Exception("G4VViewer::SetTouchable", "visman0401", JustWarning, ed);
147 }
148 else {
149 oss << ' ' << pvNodeId.GetPhysicalVolume()->GetName() << ' ' << pvNodeId.GetCopyNo();
150 }
151 }
152 G4UImanager::GetUIpointer()->ApplyCommand("/vis/set/touchable" + oss.str());
153}
static G4PhysicalVolumeStore * GetInstance()
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()

◆ SetView()

◆ SetViewParameters()

◆ ShowView()

◆ SwitchToMasterThread()

◆ SwitchToVisSubThread()

◆ TouchableSetColour()

void G4VViewer::TouchableSetColour ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > & fullPath,
const G4Colour & colour )
protected

Definition at line 191 of file G4VViewer.cc.

194{
195 // Changes the Vis Attribute Modifiers and scene tree WITHOUT triggering a rebuild.
196
197 // The following is equivalent to
198 // G4UImanager::GetUIpointer()->ApplyCommand("/vis/touchable/set/colour ...");
199 // (assuming the touchable has already been set), but avoids view rebuild.
200
201 // Instantiate a working copy of a G4VisAttributes object...
202 G4VisAttributes workingVisAtts;
203 // and set the colour.
204 workingVisAtts.SetColour(colour);
205
206 fVP.AddVisAttributesModifier(G4ModelingParameters::VisAttributesModifier(
207 workingVisAtts, G4ModelingParameters::VASColour,
209 // G4ModelingParameters::VASColour (VAS = Vis Attribute Signifier)
210 // signifies that it is the colour that should be picked out
211 // and merged with the touchable's normal vis attributes.
212
213 // Find scene tree item and set colour
214 // The scene tree works with strings
215 G4String fullPathString = G4PhysicalVolumeModel::GetPVNamePathString(fullPath);
216 std::list<G4SceneTreeItem>::iterator foundIter;
217 if (fSceneTree.FindTouchableFromRoot(fullPathString, foundIter)) {
218 foundIter->AccessVisAttributes().SetColour(colour);
220 }
221 else {
223 ed << "Touchable \"" << fullPath << "\" not found";
224 G4Exception("G4VViewer::TouchableSetColour", "visman0403", JustWarning, ed);
225 }
226}
static G4String GetPVNamePathString(const std::vector< G4PhysicalVolumeNodeID > &)
static G4ModelingParameters::PVNameCopyNoPath GetPVNameCopyNoPath(const std::vector< G4PhysicalVolumeNodeID > &)
void SetColour(const G4Colour &)

◆ TouchableSetVisibility()

void G4VViewer::TouchableSetVisibility ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > & fullPath,
G4bool visibility )
protected

Definition at line 155 of file G4VViewer.cc.

157{
158 // Changes the Vis Attribute Modifiers and scene tree WITHOUT triggering a rebuild.
159
160 // The following is equivalent to
161 // G4UImanager::GetUIpointer()->ApplyCommand("/vis/touchable/set/visibility ...");
162 // (assuming the touchable has already been set), but avoids view rebuild.
163
164 // Instantiate a working copy of a G4VisAttributes object...
165 G4VisAttributes workingVisAtts;
166 // and set the visibility.
167 workingVisAtts.SetVisibility(visibiity);
168
169 fVP.AddVisAttributesModifier(G4ModelingParameters::VisAttributesModifier(
172 // G4ModelingParameters::VASVisibility (VAS = Vis Attribute Signifier)
173 // signifies that it is the visibility that should be picked out
174 // and merged with the touchable's normal vis attributes.
175
176 // Find scene tree item and set visibility
177 // The scene tree works with strings
178 G4String fullPathString = G4PhysicalVolumeModel::GetPVNamePathString(fullPath);
179 std::list<G4SceneTreeItem>::iterator foundIter;
180 if (fSceneTree.FindTouchableFromRoot(fullPathString, foundIter)) {
181 foundIter->AccessVisAttributes().SetVisibility(visibiity);
183 }
184 else {
186 ed << "Touchable \"" << fullPath << "\" not found";
187 G4Exception("G4VViewer::TouchableSetVisibility", "visman0402", JustWarning, ed);
188 }
189}
void SetVisibility(G4bool=true)

◆ UpdateGUISceneTree()

void G4VViewer::UpdateGUISceneTree ( )

Definition at line 228 of file G4VViewer.cc.

229{
230 G4UImanager* UI = G4UImanager::GetUIpointer();
231 auto uiWindow = dynamic_cast<G4VInteractiveSession*>(UI->GetG4UIWindow());
232 if (uiWindow) uiWindow->UpdateSceneTree(fSceneTree);
233}
G4UIsession * GetG4UIWindow() const

Referenced by ProcessView(), G4VisCommandViewerSelect::SetNewValue(), TouchableSetColour(), and TouchableSetVisibility().

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const G4VViewer & v )
friend

Definition at line 446 of file G4VViewer.cc.

447{
448 os << "View " << v.fName << ":\n";
449 os << v.fVP;
450 return os;
451}

Member Data Documentation

◆ fCurtailDescent

G4bool G4VViewer::fCurtailDescent = false

Definition at line 192 of file G4VViewer.hh.

Referenced by InsertModelInSceneTree().

◆ fDefaultVP

◆ fKernelVisitElapsedTimeSeconds

G4double G4VViewer::fKernelVisitElapsedTimeSeconds = 999.
protected

Definition at line 259 of file G4VViewer.hh.

Referenced by ProcessView().

◆ fMaxNTouchables

const G4int G4VViewer::fMaxNTouchables = 10000

Definition at line 191 of file G4VViewer.hh.

Referenced by InsertModelInSceneTree().

◆ fName

◆ fNeedKernelVisit

◆ fSceneHandler

G4VSceneHandler& G4VViewer::fSceneHandler
protected

Definition at line 253 of file G4VViewer.hh.

Referenced by G4VtkViewer::AddClipperPlaneWidget(), G4VtkViewer::AddCutterPlaneWidget(), G4VtkViewer::AddGeometryOverlay(), G4VtkViewer::AddImageOverlay(), G4OpenGLQtViewer::addNonPVSceneTreeElement(), G4OpenGLQtViewer::addPVSceneTreeElement(), G4VtkViewer::ClearView(), G4VtkViewer::DisableClipper(), G4VtkViewer::DisableCutter(), G4OpenGLStoredViewer::DrawDisplayLists(), G4OpenGLQtViewer::DrawText(), G4OpenGLViewer::DrawText(), G4OpenGLXViewer::DrawText(), G4VtkViewer::EnableClipper(), G4VtkViewer::EnableCutter(), G4VtkViewer::ExportFormatStore(), G4VtkViewer::ExportVTPCutter(), G4VtkOffscreenViewer::FinishView(), G4VtkQtViewer::FinishView(), G4VtkViewer::FinishView(), G4VViewer(), G4OpenGLViewer::getSceneDepth(), G4OpenGLViewer::getSceneFarWidth(), G4OpenGLViewer::getSceneNearWidth(), G4OpenGLImmediateQtViewer::initializeGL(), G4OpenGLStoredQtViewer::initializeGL(), G4VtkViewer::Print(), ProcessView(), G4VtkViewer::SetPolyhedronPipeline(), G4OpenGLViewer::SetView(), G4OpenInventorViewer::SetView(), G4Qt3DViewer::SetView(), G4RayTracerViewer::SetView(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::SetView(), G4VtkViewer::SetView(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::SwitchToMasterThread(), G4OpenGLQtViewer::updateViewerPropertiesTableWidget(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::wheel_rotate(), G4Qt3DViewer::wheelEvent(), and ~G4VViewer().

◆ fSceneTree

◆ fShortName

G4String G4VViewer::fShortName
protected

Definition at line 256 of file G4VViewer.hh.

Referenced by G4RayTracerViewer::DrawView(), G4VViewer(), and SetName().

◆ fViewId

◆ fVP

G4ViewParameters G4VViewer::fVP
protected

Definition at line 257 of file G4VViewer.hh.

Referenced by G4OpenGLXmViewer::actions_callback(), G4OpenGLSceneHandler::AddPrimitive(), G4VtkViewer::AddViewHUD(), G4OpenGLXmViewer::aux_edge_callback(), G4OpenGLStoredQtViewer::CompareForKernelVisit(), G4OpenGLStoredViewer::CompareForKernelVisit(), G4Qt3DViewer::CompareForKernelVisit(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::CompareForKernelVisit(), G4OpenGLQtViewer::CreateMainWindow(), G4OpenGLWin32Viewer::CreateMainWindow(), G4OpenGLXmViewer::CreateMainWindow(), G4OpenGLXViewer::CreateMainWindow(), G4OpenGLXmViewer::dolly_callback(), G4OpenGLStoredViewer::DrawDisplayLists(), G4OpenGLXmViewer::drawing_style_callback(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), G4OpenGLStoredXViewer::DrawView(), G4OpenInventorViewer::DrawView(), G4Qt3DViewer::DrawView(), G4RayTracerViewer::DrawView(), G4ToolsSGOffscreenViewer::DrawView(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::DrawView(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::Export(), G4ASCIITreeViewer::G4ASCIITreeViewer(), G4HepRepFileViewer::G4HepRepFileViewer(), G4OpenGLQtViewer::G4keyPressEvent(), G4OpenGLQtViewer::G4MouseMoveEvent(), G4OpenGLQtViewer::G4MousePressEvent(), G4OpenGLQtViewer::G4MouseReleaseEvent(), G4OpenGLViewer::G4OpenGLViewer(), G4OpenGLXmViewer::G4OpenGLXmViewer(), G4OpenInventorViewer::G4OpenInventorViewer(), G4VtkViewer::G4VtkViewer(), G4VViewer(), G4OpenGLQtViewer::G4wheelEvent(), G4OpenGLViewer::getSceneDepth(), G4OpenGLViewer::getSceneFarWidth(), G4OpenGLViewer::getSceneNearWidth(), G4OpenGLXmViewer::GetXmConnection(), G4OpenInventorQtViewer::Initialise(), G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), G4OpenInventorXtViewer::Initialise(), G4Qt3DViewer::Initialise(), G4RayTracerViewer::Initialise(), G4RayTracerXViewer::Initialise(), G4ToolsSGOffscreenViewer::Initialise(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::Initialise(), G4VtkQtViewer::Initialise(), G4VtkViewer::Initialise(), G4OpenGLViewer::InitializeGLView(), G4OpenGLXmViewer::left_right_pan_callback(), G4OpenGLXmViewer::misc_callback(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::mouse_move(), G4Qt3DViewer::mouseMoveEvent(), G4OpenGLQtViewer::moveScene(), operator<<, G4OpenGLImmediateViewer::ProcessView(), G4OpenGLXmViewer::projection_callback(), G4OpenGLXmViewer::reset_callback(), G4OpenGLXmViewer::ResetView(), G4OpenGLViewer::rotateScene(), G4OpenGLViewer::rotateSceneToggle(), G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI(), G4DAWNFILEViewer::SendViewParameters(), G4OpenGLXmViewer::set_rot_subject_callback(), G4OpenGLViewerMessenger::SetNewValue(), G4OpenGLXmViewerMessenger::SetNewValue(), G4ToolsSGOffscreenViewer::SetSize(), G4OpenGLViewer::SetView(), G4OpenInventorQtViewer::SetView(), G4OpenInventorViewer::SetView(), G4OpenInventorWinViewer::SetView(), G4OpenInventorXtExtendedViewer::SetView(), G4OpenInventorXtViewer::SetView(), G4Qt3DViewer::SetView(), G4RayTracerViewer::SetView(), G4ToolsSGOffscreenViewer::SetView(), G4ToolsSGQtGLESViewer::SetView(), G4ToolsSGQtZBViewer::SetView(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::SetView(), G4VtkViewer::SetView(), SetViewParameters(), G4OpenGLXViewer::ShowView(), G4VtkViewer::ShowView(), TouchableSetColour(), TouchableSetVisibility(), G4OpenGLXmViewer::up_down_pan_callback(), G4OpenGLXmViewer::update_panels_callback(), G4OpenGLQtViewer::updateToolbarAndMouseContextMenu(), G4OpenGLQtViewer::updateViewerPropertiesTableWidget(), G4ToolsSGViewer< tools::offscreen::session, tools::offscreen::sg_viewer >::wheel_rotate(), G4Qt3DViewer::wheelEvent(), G4OpenGLXmViewer::wobble_callback(), G4OpenGLXmViewer::wobble_timer_callback(), and G4OpenGLXmViewer::zoom_callback().


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