Geant4 11.2.2
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 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 > &)
 
- Public Member Functions inherited from G4VSceneHandler
 G4VSceneHandler (G4VGraphicsSystem &system, G4int id, const G4String &name="")
 
virtual ~G4VSceneHandler ()
 
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 BeginModeling ()
 
virtual void EndModeling ()
 
virtual void EndPrimitives ()
 
virtual void BeginPrimitives2D (const G4Transform3D &objectTransformation=G4Transform3D())
 
virtual void EndPrimitives2D ()
 
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 ()
 
void AddViewerToList (G4VViewer *pView)
 
void RemoveViewerFromList (G4VViewer *pView)
 
- Public Member Functions inherited from G4VGraphicsScene
 G4VGraphicsScene ()
 
virtual ~G4VGraphicsScene ()
 

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
G4VSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")

◆ ~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/6]

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() [2/6]

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

Reimplemented from G4VSceneHandler.

Definition at line 131 of file G4VSceneHandler.cc.

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

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

Reimplemented from G4VSceneHandler.

Definition at line 132 of file G4VSceneHandler.cc.

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

◆ AddCompound() [4/6]

void G4VSceneHandler::AddCompound ( const G4VDigi & digi)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 130 of file G4VSceneHandler.cc.

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

◆ AddCompound() [5/6]

void G4VSceneHandler::AddCompound ( const G4VHit & hit)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 129 of file G4VSceneHandler.cc.

337 {
338 // Cast away const because Draw is non-const!!!!
339 const_cast<G4VHit&>(hit).Draw();
340}

◆ AddCompound() [6/6]

void G4VSceneHandler::AddCompound ( const G4VTrajectory & traj)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 128 of file G4VSceneHandler.cc.

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

◆ AddPrimitive() [1/7]

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/7]

void G4VSceneHandler::AddPrimitive ( const G4Plotter & )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 193 of file G4VSceneHandler.cc.

512 {
513 G4warn << "WARNING: Plotter not implemented for " << fSystem.GetName() << G4endl;
514 G4warn << " Open a plotter-aware graphics system or remove plotter with" << G4endl;
515 G4warn << " /vis/scene/removeModel Plotter" << G4endl;
516}
#define G4warn
Definition G4Scene.cc:41
const G4String & GetName() const
G4VGraphicsSystem & fSystem

◆ AddPrimitive() [3/7]

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 *)
const G4ViewParameters & GetViewParameters() const
G4bool IsPicking() const
#define TRUE
Definition globals.hh:41
#define FALSE
Definition globals.hh:38
const char * name(G4int ptype)

◆ AddPrimitive() [4/7]

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() [5/7]

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
MarkerType GetMarkerType() const
FillStyle GetFillStyle() const
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
SoMFInt32 markerIndex
Definition SoMarkerSet.h:38

◆ AddPrimitive() [6/7]

void G4OpenInventorSceneHandler::AddPrimitive ( const G4Square & square)
virtual

Implements G4VSceneHandler.

Definition at line 437 of file G4OpenInventorSceneHandler.cc.

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

◆ AddPrimitive() [7/7]

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 &)

◆ 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 Symbol 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: