Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpenInventorSceneHandler Class Reference

#include <G4OpenInventorSceneHandler.hh>

+ Inheritance diagram for G4OpenInventorSceneHandler:

Public Member Functions

 G4OpenInventorSceneHandler (G4OpenInventor &system, const G4String &name="")
 
virtual ~G4OpenInventorSceneHandler ()
 
void AddPrimitive (const G4Polyline &line)
 
void AddPrimitive (const G4Text &)
 
void AddPrimitive (const G4Circle &)
 
void AddPrimitive (const G4Square &)
 
void AddPrimitive (const G4Polyhedron &p)
 
void AddPrimitive (const G4Polymarker &)
 
void AddCompound (const G4Mesh &)
 
void ClearStore ()
 
void ClearTransientStore ()
 
void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &visAttribs)
 
void BeginPrimitives (const G4Transform3D &objectTransformation)
 
virtual void AddPrimitive (const G4Polyline &)=0
 
virtual void AddPrimitive (const G4Text &)=0
 
virtual void AddPrimitive (const G4Circle &)=0
 
virtual void AddPrimitive (const G4Square &)=0
 
virtual void AddPrimitive (const G4Polymarker &)
 
virtual void AddPrimitive (const G4Polyhedron &)=0
 
virtual void AddPrimitive (const G4Plotter &)
 
virtual void AddCompound (const G4VTrajectory &)
 
virtual void AddCompound (const G4VHit &)
 
virtual void AddCompound (const G4VDigi &)
 
virtual void AddCompound (const G4THitsMap< G4double > &)
 
virtual void AddCompound (const G4THitsMap< G4StatDouble > &)
 
virtual void AddCompound (const G4Mesh &)
 
- Public Member Functions inherited from G4VSceneHandler
 G4VSceneHandler (G4VGraphicsSystem &system, G4int id, const G4String &name="")
 
virtual ~G4VSceneHandler ()
 
virtual void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &)
 
virtual void PostAddSolid ()
 
virtual void AddSolid (const G4Box &)
 
virtual void AddSolid (const G4Cons &)
 
virtual void AddSolid (const G4Orb &)
 
virtual void AddSolid (const G4Para &)
 
virtual void AddSolid (const G4Sphere &)
 
virtual void AddSolid (const G4Torus &)
 
virtual void AddSolid (const G4Trap &)
 
virtual void AddSolid (const G4Trd &)
 
virtual void AddSolid (const G4Tubs &)
 
virtual void AddSolid (const G4Ellipsoid &)
 
virtual void AddSolid (const G4Polycone &)
 
virtual void AddSolid (const G4Polyhedra &)
 
virtual void AddSolid (const G4TessellatedSolid &)
 
virtual void AddSolid (const G4VSolid &)
 
virtual void AddCompound (const G4VTrajectory &)
 
virtual void AddCompound (const G4VHit &)
 
virtual void AddCompound (const G4VDigi &)
 
virtual void AddCompound (const G4THitsMap< G4double > &)
 
virtual void AddCompound (const G4THitsMap< G4StatDouble > &)
 
virtual void AddCompound (const G4Mesh &)
 
virtual void BeginModeling ()
 
virtual void EndModeling ()
 
virtual void BeginPrimitives (const G4Transform3D &objectTransformation=G4Transform3D())
 
virtual void EndPrimitives ()
 
virtual void BeginPrimitives2D (const G4Transform3D &objectTransformation=G4Transform3D())
 
virtual void EndPrimitives2D ()
 
virtual void AddPrimitive (const G4Polyline &)=0
 
virtual void AddPrimitive (const G4Text &)=0
 
virtual void AddPrimitive (const G4Circle &)=0
 
virtual void AddPrimitive (const G4Square &)=0
 
virtual void AddPrimitive (const G4Polymarker &)
 
virtual void AddPrimitive (const G4Polyhedron &)=0
 
virtual void AddPrimitive (const G4Plotter &)
 
virtual const G4VisExtentGetExtent () const
 
const G4StringGetName () const
 
G4int GetSceneHandlerId () const
 
G4int GetViewCount () const
 
G4VGraphicsSystemGetGraphicsSystem () const
 
G4SceneGetScene () const
 
const G4ViewerListGetViewerList () const
 
G4VModelGetModel () const
 
G4VViewerGetCurrentViewer () const
 
G4bool GetMarkForClearingTransientStore () const
 
G4bool IsReadyForTransients () const
 
G4bool GetTransientsDrawnThisEvent () const
 
G4bool GetTransientsDrawnThisRun () const
 
const G4Transform3DGetObjectTransformation () const
 
void SetName (const G4String &)
 
void SetCurrentViewer (G4VViewer *)
 
virtual void SetScene (G4Scene *)
 
G4ViewerListSetViewerList ()
 
void SetModel (G4VModel *)
 
void SetMarkForClearingTransientStore (G4bool)
 
void SetTransientsDrawnThisEvent (G4bool)
 
void SetTransientsDrawnThisRun (G4bool)
 
void SetObjectTransformation (const G4Transform3D &)
 
const G4ColourGetColour ()
 
const G4ColourGetColor ()
 
const G4ColourGetColour (const G4Visible &)
 
const G4ColourGetColor (const G4Visible &)
 
const G4ColourGetTextColour (const G4Text &)
 
const G4ColourGetTextColor (const G4Text &)
 
G4double GetLineWidth (const G4VisAttributes *)
 
G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes *)
 
G4int GetNumberOfCloudPoints (const G4VisAttributes *) const
 
G4bool GetAuxEdgeVisible (const G4VisAttributes *)
 
G4int GetNoOfSides (const G4VisAttributes *)
 
G4double GetMarkerSize (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerDiameter (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerRadius (const G4VMarker &, MarkerSizeType &)
 
G4ModelingParametersCreateModelingParameters ()
 
void DrawEvent (const G4Event *)
 
void DrawEndOfRunModels ()
 
template<class T >
void AddSolidT (const T &solid)
 
template<class T >
void AddSolidWithAuxiliaryEdges (const T &solid)
 
G4int IncrementViewCount ()
 
virtual void ClearStore ()
 
virtual void ClearTransientStore ()
 
void AddViewerToList (G4VViewer *pView)
 
void RemoveViewerFromList (G4VViewer *pView)
 
- Public Member Functions inherited from G4VGraphicsScene
 G4VGraphicsScene ()
 
virtual ~G4VGraphicsScene ()
 
virtual void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &visAttribs)=0
 
virtual void PostAddSolid ()=0
 
virtual void AddSolid (const G4Box &)=0
 
virtual void AddSolid (const G4Cons &)=0
 
virtual void AddSolid (const G4Orb &)=0
 
virtual void AddSolid (const G4Para &)=0
 
virtual void AddSolid (const G4Sphere &)=0
 
virtual void AddSolid (const G4Torus &)=0
 
virtual void AddSolid (const G4Trap &)=0
 
virtual void AddSolid (const G4Trd &)=0
 
virtual void AddSolid (const G4Tubs &)=0
 
virtual void AddSolid (const G4Ellipsoid &)=0
 
virtual void AddSolid (const G4Polycone &)=0
 
virtual void AddSolid (const G4Polyhedra &)=0
 
virtual void AddSolid (const G4TessellatedSolid &)=0
 
virtual void AddSolid (const G4VSolid &)=0
 
virtual void AddCompound (const G4VTrajectory &)=0
 
virtual void AddCompound (const G4VHit &)=0
 
virtual void AddCompound (const G4VDigi &)=0
 
virtual void AddCompound (const G4THitsMap< G4double > &)=0
 
virtual void AddCompound (const G4THitsMap< G4StatDouble > &)=0
 
virtual void AddCompound (const G4Mesh &)=0
 
virtual void BeginPrimitives (const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void EndPrimitives ()=0
 
virtual void BeginPrimitives2D (const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void EndPrimitives2D ()=0
 
virtual void AddPrimitive (const G4Polyline &)=0
 
virtual void AddPrimitive (const G4Text &)=0
 
virtual void AddPrimitive (const G4Circle &)=0
 
virtual void AddPrimitive (const G4Square &)=0
 
virtual void AddPrimitive (const G4Polymarker &)=0
 
virtual void AddPrimitive (const G4Polyhedron &)=0
 
virtual void AddPrimitive (const G4Plotter &)=0
 
virtual const G4VisExtentGetExtent () const
 

Friends

class G4OpenInventorViewer
 

Additional Inherited Members

- Public Types inherited from G4VSceneHandler
enum  MarkerSizeType { world , screen }
 
- Protected Member Functions inherited from G4VSceneHandler
virtual void ProcessScene ()
 
virtual void RequestPrimitives (const G4VSolid &solid)
 
virtual G4DisplacedSolidCreateSectionSolid ()
 
virtual G4DisplacedSolidCreateCutawaySolid ()
 
void LoadAtts (const G4Visible &, G4AttHolder *)
 
void StandardSpecialMeshRendering (const G4Mesh &)
 
void Draw3DRectMeshAsDots (const G4Mesh &)
 
void Draw3DRectMeshAsSurfaces (const G4Mesh &)
 
void DrawTetMeshAsDots (const G4Mesh &)
 
void DrawTetMeshAsSurfaces (const G4Mesh &)
 
G4ThreeVector GetPointInBox (const G4ThreeVector &pos, G4double halfX, G4double halfY, G4double halfZ) const
 
G4ThreeVector GetPointInTet (const std::vector< G4ThreeVector > &vertices) const
 
- Protected Attributes inherited from G4VSceneHandler
G4VGraphicsSystemfSystem
 
const G4int fSceneHandlerId
 
G4String fName
 
G4int fViewCount
 
G4ViewerList fViewerList
 
G4VViewerfpViewer
 
G4ScenefpScene
 
G4bool fMarkForClearingTransientStore
 
G4bool fReadyForTransients
 
G4bool fTransientsDrawnThisEvent
 
G4bool fTransientsDrawnThisRun
 
G4bool fProcessingSolid
 
G4bool fProcessing2D
 
G4VModelfpModel
 
G4Transform3D fObjectTransformation
 
G4int fNestingDepth
 
const G4VisAttributesfpVisAttribs
 
const G4Transform3D fIdentityTransformation
 

Detailed Description

Definition at line 49 of file G4OpenInventorSceneHandler.hh.

Constructor & Destructor Documentation

◆ G4OpenInventorSceneHandler()

G4OpenInventorSceneHandler::G4OpenInventorSceneHandler ( G4OpenInventor system,
const G4String name = "" 
)

Definition at line 104 of file G4OpenInventorSceneHandler.cc.

106:G4VSceneHandler (system, fSceneIdCount++, name)
107,fRoot(0)
108,fDetectorRoot(0)
109,fTransientRoot(0)
110,fCurrentSeparator(0)
111,fModelingSolid(false)
112,fReducedWireFrame(true)
113,fStyleCache(0)
114,fPreviewAndFull(true)
115{
116 fStyleCache = new SoStyleCache;
117 fStyleCache->ref();
118
119 fRoot = new SoSeparator;
120 fRoot->ref();
121 fRoot->setName("Root");
122
123 fDetectorRoot = new SoSeparator;
124 fDetectorRoot->setName("StaticRoot");
125 fRoot->addChild(fDetectorRoot);
126
127 fTransientRoot = new SoSeparator;
128 fTransientRoot->setName("TransientRoot");
129 fRoot->addChild(fTransientRoot);
130
131 fCurrentSeparator = fTransientRoot;
132}
#define SoStyleCache
Definition: SoStyleCache.h:41

◆ ~G4OpenInventorSceneHandler()

G4OpenInventorSceneHandler::~G4OpenInventorSceneHandler ( )
virtual

Definition at line 134 of file G4OpenInventorSceneHandler.cc.

135{
136 fRoot->unref();
137 fStyleCache->unref();
138}

Member Function Documentation

◆ AddCompound() [1/7]

void G4VSceneHandler::AddCompound ( const G4Mesh mesh)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 133 of file G4VSceneHandler.cc.

432{
433 G4warn <<
434 "There has been an attempt to draw a mesh with option \""
436 << "\":\n" << mesh
437 << "but it is not of a recognised type or is not implemented"
438 "\nby the current graphics driver. Instead we draw its"
439 "\ncontainer \"" << mesh.GetContainerVolume()->GetName() << "\"."
440 << G4endl;
441 const auto& pv = mesh.GetContainerVolume();
442 const auto& lv = pv->GetLogicalVolume();
443 const auto& solid = lv->GetSolid();
444 const auto& transform = mesh.GetTransform();
445 // Make sure container is visible
446 G4VisAttributes tmpVisAtts; // Visible, white, not forced.
447 const auto& saveVisAtts = lv->GetVisAttributes();
448 if (saveVisAtts) {
449 tmpVisAtts = *saveVisAtts;
450 tmpVisAtts.SetVisibility(true);
451 auto colour = saveVisAtts->GetColour();
452 colour.SetAlpha(1.);
453 tmpVisAtts.SetColour(colour);
454 }
455 // Draw container
456 PreAddSolid(transform,tmpVisAtts);
457 solid->DescribeYourselfTo(*this);
458 PostAddSolid();
459 // Restore vis attributes
460 lv->SetVisAttributes(saveVisAtts);
461}
#define G4warn
Definition: G4Scene.cc:41
#define G4endl
Definition: G4ios.hh:57
G4VSolid * GetSolid() const
G4VPhysicalVolume * GetContainerVolume() const
Definition: G4Mesh.hh:73
const G4Transform3D & GetTransform() const
Definition: G4Mesh.hh:77
void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &visAttribs)
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
G4VViewer * fpViewer
virtual void PostAddSolid()
const G4ViewParameters & GetViewParameters() const
SMROption GetSpecialMeshRenderingOption() const
void SetColour(const G4Colour &)
void SetVisibility(G4bool=true)

◆ AddCompound() [2/7]

void G4OpenInventorSceneHandler::AddCompound ( const G4Mesh mesh)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 588 of file G4OpenInventorSceneHandler.cc.

588 {
590}
void StandardSpecialMeshRendering(const G4Mesh &)

◆ AddCompound() [3/7]

void G4VSceneHandler::AddCompound ( const G4THitsMap< G4double > &  hits)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 131 of file G4VSceneHandler.cc.

345 {
346 using MeshScoreMap = G4VScoringMesh::MeshScoreMap;
347 //G4cout << "AddCompound: hits: " << &hits << G4endl;
348 G4bool scoreMapHits = false;
350 if (scoringManager) {
351 std::size_t nMeshes = scoringManager->GetNumberOfMesh();
352 for (std::size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
353 G4VScoringMesh* mesh = scoringManager->GetMesh((G4int)iMesh);
354 if (mesh && mesh->IsActive()) {
355 MeshScoreMap scoreMap = mesh->GetScoreMap();
356 const G4String& mapNam = const_cast<G4THitsMap<G4double>&>(hits).GetName();
357 for(MeshScoreMap::const_iterator i = scoreMap.cbegin();
358 i != scoreMap.cend(); ++i) {
359 const G4String& scoreMapName = i->first;
360 if (scoreMapName == mapNam) {
361 G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
362 scoreMapHits = true;
363 mesh->DrawMesh(scoreMapName, &colorMap);
364 }
365 }
366 }
367 }
368 }
369 if (scoreMapHits) {
370 static G4bool first = true;
371 if (first) {
372 first = false;
373 G4cout <<
374 "Scoring map drawn with default parameters."
375 "\n To get gMocren file for gMocren browser:"
376 "\n /vis/open gMocrenFile"
377 "\n /vis/viewer/flush"
378 "\n Many other options available with /score/draw... commands."
379 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
380 << G4endl;
381 }
382 } else { // Not score map hits. Just call DrawAllHits.
383 // Cast away const because DrawAllHits is non-const!!!!
384 const_cast<G4THitsMap<G4double>&>(hits).DrawAllHits();
385 }
386}
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cout
G4VScoringMesh * GetMesh(G4int i) const
size_t GetNumberOfMesh() const
static G4ScoringManager * GetScoringManagerIfExist()
const G4String & GetName() const
G4bool IsActive() const
std::map< G4String, RunScore * > MeshScoreMap
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
MeshScoreMap GetScoreMap() const

◆ AddCompound() [4/7]

void G4VSceneHandler::AddCompound ( const G4THitsMap< G4StatDouble > &  hits)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 132 of file G4VSceneHandler.cc.

388 {
389 using MeshScoreMap = G4VScoringMesh::MeshScoreMap;
390 //G4cout << "AddCompound: hits: " << &hits << G4endl;
391 G4bool scoreMapHits = false;
393 if (scoringManager) {
394 std::size_t nMeshes = scoringManager->GetNumberOfMesh();
395 for (std::size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
396 G4VScoringMesh* mesh = scoringManager->GetMesh((G4int)iMesh);
397 if (mesh && mesh->IsActive()) {
398 MeshScoreMap scoreMap = mesh->GetScoreMap();
399 for(MeshScoreMap::const_iterator i = scoreMap.cbegin();
400 i != scoreMap.cend(); ++i) {
401 const G4String& scoreMapName = i->first;
402 const G4THitsMap<G4StatDouble>* foundHits = i->second;
403 if (foundHits == &hits) {
404 G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
405 scoreMapHits = true;
406 mesh->DrawMesh(scoreMapName, &colorMap);
407 }
408 }
409 }
410 }
411 }
412 if (scoreMapHits) {
413 static G4bool first = true;
414 if (first) {
415 first = false;
416 G4cout <<
417 "Scoring map drawn with default parameters."
418 "\n To get gMocren file for gMocren browser:"
419 "\n /vis/open gMocrenFile"
420 "\n /vis/viewer/flush"
421 "\n Many other options available with /score/draw... commands."
422 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
423 << G4endl;
424 }
425 } else { // Not score map hits. Just call DrawAllHits.
426 // Cast away const because DrawAllHits is non-const!!!!
427 const_cast<G4THitsMap<G4StatDouble>&>(hits).DrawAllHits();
428 }
429}

◆ AddCompound() [5/7]

void G4VSceneHandler::AddCompound ( const G4VDigi digi)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 130 of file G4VSceneHandler.cc.

340 {
341 // Cast away const because Draw is non-const!!!!
342 const_cast<G4VDigi&>(digi).Draw();
343}

◆ AddCompound() [6/7]

void G4VSceneHandler::AddCompound ( const G4VHit hit)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 129 of file G4VSceneHandler.cc.

335 {
336 // Cast away const because Draw is non-const!!!!
337 const_cast<G4VHit&>(hit).Draw();
338}
Definition: G4VHit.hh:48

◆ AddCompound() [7/7]

void G4VSceneHandler::AddCompound ( const G4VTrajectory traj)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 128 of file G4VSceneHandler.cc.

323 {
324 G4TrajectoriesModel* trajectoriesModel =
325 dynamic_cast<G4TrajectoriesModel*>(fpModel);
326 if (trajectoriesModel)
327 traj.DrawTrajectory();
328 else {
330 ("G4VSceneHandler::AddCompound(const G4VTrajectory&)",
331 "visman0105", FatalException, "Not a G4TrajectoriesModel.");
332 }
333}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
virtual void DrawTrajectory() const

◆ AddPrimitive() [1/13]

void G4OpenInventorSceneHandler::AddPrimitive ( const G4Circle circle)
virtual

Implements G4VSceneHandler.

Definition at line 430 of file G4OpenInventorSceneHandler.cc.

430 {
431 AddCircleSquare(G4OICircle, circle);
432}

◆ AddPrimitive() [2/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Circle )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [3/13]

void G4VSceneHandler::AddPrimitive ( const G4Plotter )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 193 of file G4VSceneHandler.cc.

510 {
511 G4warn << "WARNING: Plotter not implemented for " << fSystem.GetName() << G4endl;
512 G4warn << " Open a plotter-aware graphics system or remove plotter with" << G4endl;
513 G4warn << " /vis/scene/removeModel Plotter" << G4endl;
514}
const G4String & GetName() const
G4VGraphicsSystem & fSystem

◆ AddPrimitive() [4/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Polyhedron )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [5/13]

void G4OpenInventorSceneHandler::AddPrimitive ( const G4Polyhedron p)
virtual

Implements G4VSceneHandler.

Definition at line 546 of file G4OpenInventorSceneHandler.cc.

547{
548 if (polyhedron.GetNoFacets() == 0) return;
549
550 if (fProcessing2D) {
551 static G4bool warned = false;
552 if (!warned) {
553 warned = true;
555 ("G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron&)",
556 "OpenInventor-0005", JustWarning,
557 "2D polyhedra not implemented. Ignored.");
558 }
559 return;
560 }
561
562 // Get vis attributes - pick up defaults if none.
563 const G4VisAttributes* pVA =
564 fpViewer -> GetApplicableVisAttributes (polyhedron.GetVisAttributes ());
565
566 AddProperties(pVA); // Colour, etc.
567 AddTransform(); // Transformation
568
569 SoG4Polyhedron* soPolyhedron = new SoG4Polyhedron(polyhedron);
570
571 // Loads G4Atts for picking...
573 LoadAtts(polyhedron, soPolyhedron);
574
575 SbString name = "Non-geometry";
576 G4PhysicalVolumeModel* pPVModel =
577 dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
578 if (pPVModel) {
579 name = pPVModel->GetCurrentLV()->GetName().c_str();
580 }
581 SbName sbName(name);
582 soPolyhedron->setName(sbName);
583 soPolyhedron->solid.setValue(fModelingSolid);
584 soPolyhedron->reducedWireFrame.setValue(fReducedWireFrame?TRUE:FALSE);
585 fCurrentSeparator->addChild(soPolyhedron);
586}
@ JustWarning
const G4String & GetName() const
G4LogicalVolume * GetCurrentLV() const
void LoadAtts(const G4Visible &, G4AttHolder *)
G4bool IsPicking() const
#define TRUE
Definition: globals.hh:41
#define FALSE
Definition: globals.hh:38
const char * name(G4int ptype)

◆ AddPrimitive() [6/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Polyline )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [7/13]

void G4OpenInventorSceneHandler::AddPrimitive ( const G4Polyline line)
virtual

Implements G4VSceneHandler.

Definition at line 184 of file G4OpenInventorSceneHandler.cc.

185{
186 if (fProcessing2D) {
187 static G4bool warned = false;
188 if (!warned) {
189 warned = true;
191 ("G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline&)",
192 "OpenInventor-0001", JustWarning,
193 "2D polylines not implemented. Ignored.");
194 }
195 return;
196 }
197
198 // Get vis attributes - pick up defaults if none.
199 const G4VisAttributes* pVA =
200 fpViewer -> GetApplicableVisAttributes (line.GetVisAttributes ());
201
202 AddProperties(pVA); // Colour, etc.
203 AddTransform(); // Transformation
204
205 G4int nPoints = (G4int)line.size();
206 SbVec3f* pCoords = new SbVec3f[nPoints];
207
208 for (G4int iPoint = 0; iPoint < nPoints ; ++iPoint) {
209 pCoords[iPoint].setValue((G4float)line[iPoint].x(),
210 (G4float)line[iPoint].y(),
211 (G4float)line[iPoint].z());
212 }
213
214 //
215 // Point Set
216 //
217 SoCoordinate3 *polyCoords = new SoCoordinate3;
218 polyCoords->point.setValues(0,nPoints,pCoords);
219 fCurrentSeparator->addChild(polyCoords);
220
221 //
222 // Wireframe
223 //
224 SoDrawStyle* drawStyle = fStyleCache->getLineStyle();
225 fCurrentSeparator->addChild(drawStyle);
226
227 SoG4LineSet *pLine = new SoG4LineSet;
228
229 // Loads G4Atts for picking...
230 if (fpViewer->GetViewParameters().IsPicking()) LoadAtts(line, pLine);
231
232#ifdef INVENTOR2_0
233 pLine->numVertices.setValues(0,1,(const G4long *)&nPoints);
234#else
235 pLine->numVertices.setValues(0,1,&nPoints);
236#endif
237
238 fCurrentSeparator->addChild(pLine);
239
240 delete [] pCoords;
241}
float G4float
Definition: G4Types.hh:84
long G4long
Definition: G4Types.hh:87
const G4VisAttributes * GetVisAttributes() const

◆ AddPrimitive() [8/13]

void G4VSceneHandler::AddPrimitive ( const G4Polymarker polymarker)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 191 of file G4VSceneHandler.cc.

467 {
468 switch (polymarker.GetMarkerType()) {
469 default:
471 {
472 G4Circle dot (polymarker);
473 dot.SetWorldSize (0.);
474 dot.SetScreenSize (0.1); // Very small circle.
475 for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
476 dot.SetPosition (polymarker[iPoint]);
477 AddPrimitive (dot);
478 }
479 }
480 break;
482 {
483 G4Circle circle (polymarker); // Default circle
484 for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
485 circle.SetPosition (polymarker[iPoint]);
486 AddPrimitive (circle);
487 }
488 }
489 break;
491 {
492 G4Square square (polymarker); // Default square
493 for (std::size_t iPoint = 0; iPoint < polymarker.size (); ++iPoint) {
494 square.SetPosition (polymarker[iPoint]);
495 AddPrimitive (square);
496 }
497 }
498 break;
499 }
500}
void AddPrimitive(const G4Polyline &line)
MarkerType GetMarkerType() const

◆ AddPrimitive() [9/13]

void G4OpenInventorSceneHandler::AddPrimitive ( const G4Polymarker polymarker)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 243 of file G4OpenInventorSceneHandler.cc.

244{
245 if (fProcessing2D) {
246 static G4bool warned = false;
247 if (!warned) {
248 warned = true;
250 ("G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker&)",
251 "OpenInventor-0002", JustWarning,
252 "2D polymarkers not implemented. Ignored.");
253 }
254 return;
255 }
256
257 // Get vis attributes - pick up defaults if none.
258 const G4VisAttributes* pVA =
259 fpViewer -> GetApplicableVisAttributes (polymarker.GetVisAttributes ());
260
261 AddProperties(pVA); // Colour, etc.
262 AddTransform(); // Transformation
263
264 G4int pointn = (G4int)polymarker.size();
265 if(pointn<=0) return;
266
267 SbVec3f* points = new SbVec3f[pointn];
268 for (G4int iPoint = 0; iPoint < pointn ; ++iPoint) {
269 points[iPoint].setValue((G4float)polymarker[iPoint].x(),
270 (G4float)polymarker[iPoint].y(),
271 (G4float)polymarker[iPoint].z());
272 }
273
274 SoCoordinate3* coordinate3 = new SoCoordinate3;
275 coordinate3->point.setValues(0,pointn,points);
276 fCurrentSeparator->addChild(coordinate3);
277
278 MarkerSizeType sizeType;
279 G4double screenSize = GetMarkerSize (polymarker, sizeType);
280 switch (sizeType) {
281 default:
282 case screen:
283 // Draw in screen coordinates. OK.
284 break;
285 case world:
286 // Draw in world coordinates. Not implemented. Use screenSize = 10.
287 screenSize = 10.;
288 break;
289 }
290
291 SoG4MarkerSet* markerSet = new SoG4MarkerSet;
292 markerSet->numPoints = pointn;
293
294 // Loads G4Atts for picking...
296 LoadAtts(polymarker, markerSet);
297
298 G4VMarker::FillStyle style = polymarker.GetFillStyle();
299 switch (polymarker.GetMarkerType()) {
300 default:
301 // Are available 5_5, 7_7 and 9_9
303 if (screenSize <= 5.) {
305 } else if (screenSize <= 7.) {
307 } else {
309 }
310 break;
312 if (screenSize <= 5.) {
313 if (style == G4VMarker::filled) {
315 } else {
317 }
318 } else if (screenSize <= 7.) {
319 if (style == G4VMarker::filled) {
321 } else {
323 }
324 } else {
325 if (style == G4VMarker::filled) {
327 } else {
329 }
330 }
331 break;
333 if (screenSize <= 5.) {
334 if (style == G4VMarker::filled) {
336 } else {
338 }
339 } else if (screenSize <= 7.) {
340 if (style == G4VMarker::filled) {
342 } else {
344 }
345 } else {
346 if (style == G4VMarker::filled) {
348 } else {
350 }
351 }
352 }
353 fCurrentSeparator->addChild(markerSet);
354
355 delete [] points;
356}
double G4double
Definition: G4Types.hh:83
FillStyle GetFillStyle() const
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
SoMFInt32 markerIndex
Definition: SoMarkerSet.h:38

◆ AddPrimitive() [10/13]

void G4OpenInventorSceneHandler::AddPrimitive ( const G4Square square)
virtual

Implements G4VSceneHandler.

Definition at line 437 of file G4OpenInventorSceneHandler.cc.

437 {
438 AddCircleSquare(G4OISquare, square);
439}

◆ AddPrimitive() [11/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Square )
virtual

Implements G4VSceneHandler.

◆ AddPrimitive() [12/13]

void G4OpenInventorSceneHandler::AddPrimitive ( const G4Text text)
virtual

Implements G4VSceneHandler.

Definition at line 360 of file G4OpenInventorSceneHandler.cc.

361{
362 if (fProcessing2D) {
363 static G4bool warned = false;
364 if (!warned) {
365 warned = true;
367 ("G4OpenInventorSceneHandler::AddPrimitive (const G4Text&)",
368 "OpenInventor-0003", JustWarning,
369 "2D text not implemented. Ignored.");
370 }
371 return;
372 }
373
374 AddProperties(text.GetVisAttributes()); // Colour, etc.
375 AddTransform(text.GetPosition()); // Transformation
376
377 //
378 // Color. Note: text colour is worked out differently. This
379 // over-rides the colour added in AddProperties...
380 //
381 const G4Colour& c = GetTextColour (text);
382 SoMaterial* material =
383 fStyleCache->getMaterial((G4float)c.GetRed(),
384 (G4float)c.GetGreen(),
385 (G4float)c.GetBlue(),
386 (G4float)(1-c.GetAlpha()));
387 fCurrentSeparator->addChild(material);
388
389 MarkerSizeType sizeType;
390 G4double size = GetMarkerSize (text, sizeType);
391 switch (sizeType) {
392 default:
393 case screen:
394 // Draw in screen coordinates. OK.
395 break;
396 case world:
397 // Draw in world coordinates. Not implemented. Use size = 20.
398 size = 20.;
399 break;
400 }
401
402 //
403 // Font
404 //
405 SoFont *g4Font = new SoFont();
406 g4Font->size = size;
407 fCurrentSeparator->addChild(g4Font);
408
409 //
410 // Text
411 //
412 SoText2 *g4String = new SoText2();
413 g4String->string.setValue(text.GetText());
414 g4String->spacing = 2.0;
415 switch (text.GetLayout()) {
416 default:
417 case G4Text::left:
418 g4String->justification = SoText2::LEFT; break;
419 case G4Text::centre:
420 g4String->justification = SoText2::CENTER; break;
421 case G4Text::right:
422 g4String->justification = SoText2::RIGHT; break;
423 }
424 fCurrentSeparator->addChild(g4String);
425}
G4double GetBlue() const
Definition: G4Colour.hh:154
G4double GetAlpha() const
Definition: G4Colour.hh:155
G4double GetRed() const
Definition: G4Colour.hh:152
G4double GetGreen() const
Definition: G4Colour.hh:153
Layout GetLayout() const
G4String GetText() const
@ centre
Definition: G4Text.hh:76
@ right
Definition: G4Text.hh:76
@ left
Definition: G4Text.hh:76
G4Point3D GetPosition() const
const G4Colour & GetTextColour(const G4Text &)

◆ AddPrimitive() [13/13]

virtual void G4VSceneHandler::AddPrimitive ( const G4Text )
virtual

Implements G4VSceneHandler.

◆ BeginPrimitives()

void G4OpenInventorSceneHandler::BeginPrimitives ( const G4Transform3D objectTransformation)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 169 of file G4OpenInventorSceneHandler.cc.

170 {
171
172 G4VSceneHandler::BeginPrimitives (objectTransformation);
173
174 // If thread of control has already passed through PreAddSolid,
175 // avoid opening a graphical data base component again.
176 if (!fProcessingSolid) {
177 GeneratePrerequisites();
178 }
179}
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())

◆ ClearStore()

void G4OpenInventorSceneHandler::ClearStore ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 140 of file G4OpenInventorSceneHandler.cc.

141{
142 fDetectorRoot->removeAllChildren();
143 fSeparatorMap.clear();
144
145 fTransientRoot->removeAllChildren();
146}

◆ ClearTransientStore()

void G4OpenInventorSceneHandler::ClearTransientStore ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 148 of file G4OpenInventorSceneHandler.cc.

149{
150 fTransientRoot->removeAllChildren();
151}

◆ PreAddSolid()

void G4OpenInventorSceneHandler::PreAddSolid ( const G4Transform3D objectTransformation,
const G4VisAttributes visAttribs 
)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 156 of file G4OpenInventorSceneHandler.cc.

159{
160 G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs);
161 // Stores arguments away for future use, e.g., AddPrimitives.
162
163 GeneratePrerequisites();
164}
virtual void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)

Friends And Related Function Documentation

◆ G4OpenInventorViewer

friend class G4OpenInventorViewer
friend

Definition at line 51 of file G4OpenInventorSceneHandler.hh.


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