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

#include <G4OpenInventorViewer.hh>

+ Inheritance diagram for G4OpenInventorViewer:

Public Member Functions

virtual void DrawView ()
 
virtual void ShowView ()
 
virtual void ClearView ()
 
virtual void SetView ()
 
virtual void KernelVisitDecision ()
 
 G4OpenInventorViewer (G4OpenInventorSceneHandler &scene, const G4String &name="")
 
virtual ~G4OpenInventorViewer ()
 
- Public Member Functions inherited from G4VViewer
 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 ()
 
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
 
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 ()
 

Protected Member Functions

virtual void ViewerRender ()=0
 
virtual SoCamera * GetCamera ()=0
 
void Escape ()
 Menu items callbacks /////////////////////////////////////////////////////.
 
void WritePostScript (const G4String &file="g4out.ps")
 
void WritePDF (const G4String &file="g4out.pdf")
 
void WritePixmapPostScript (const G4String &file="g4out.ps")
 
void WriteInventor (const G4String &file="g4out.iv")
 
void SceneGraphStatistics ()
 
void EraseDetector ()
 
void EraseEvent ()
 
void SetPreviewAndFull ()
 
void SetPreview ()
 
void SetSolid ()
 
void SetWireFrame ()
 
void SetReducedWireFrame (bool)
 
void UpdateScene ()
 
G4String Help (const G4String &topic="controls")
 
- 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 &)
 

Static Protected Member Functions

static void SelectionCB (void *, SoPath *)
 

Protected Attributes

G4OpenInventorSceneHandlerfG4OpenInventorSceneHandler
 
G4VInteractorManagerfInteractorManager
 
SoSelection * fSoSelection
 
Geant4_SoImageWriter * fSoImageWriter
 
Geant4_SoGL2PSAction * fGL2PSAction
 
SoNodeSensor * fGroupCameraSensor
 
- Protected Attributes inherited from G4VViewer
G4VSceneHandlerfSceneHandler
 
G4int fViewId
 
G4String fName
 
G4String fShortName
 
G4ViewParameters fVP
 
G4ViewParameters fDefaultVP
 
G4double fKernelVisitElapsedTimeSeconds = 999.
 
G4bool fNeedKernelVisit
 

Detailed Description

Definition at line 49 of file G4OpenInventorViewer.hh.

Constructor & Destructor Documentation

◆ G4OpenInventorViewer()

G4OpenInventorViewer::G4OpenInventorViewer ( G4OpenInventorSceneHandler scene,
const G4String name = "" 
)

Definition at line 58 of file G4OpenInventorViewer.cc.

61:G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
62,fG4OpenInventorSceneHandler(sceneHandler)
66,fGL2PSAction(0) //To be set be suclass.
68 //,fCameraSensor(0)
69{
70 fVP.SetAutoRefresh(true);
72 fVP.SetPicking(true);
74
75 //FIXME : G.Barrand : not convinced that we have to rm culling.
76 // For viewing of all objects by default :
77 //fDefaultVP.SetCulling(false);
78 //fVP.SetCulling(false);
79
82 GetInteractorManager();
83
84 // Main user scene graph root sent to the viewers.
85 fSoSelection = new SoSelection;
86 fSoSelection->ref();
87 fSoSelection->addSelectionCallback(SelectionCB,this);
88 //fSoSelection->addDeselectionCallback(DeselectionCB,this);
89 fSoSelection->policy = SoSelection::SINGLE;
90
91 SoGroup* group = new SoGroup;
92 fSoSelection->addChild(group);
93
94 // Have a camera under fSoSelection in order
95 // that the below SceneGraphSensor be notifed
96 // when the viewer changes the camera type.
97 // But we put the camera under a SoGroup so that
98 // the SceneGraphSensor be not triggered at each change
99 // under the fG4OpenInventorSceneHandler.fRoot.
100 SoOrthographicCamera* camera = new SoOrthographicCamera;
101 camera->viewportMapping.setValue(SoCamera::ADJUST_CAMERA);
102 //camera->aspectRatio.setValue(10);
103 camera->position.setValue(0,0,10);
104 camera->orientation.setValue(SbRotation(SbVec3f(0,1,0),0));
105 camera->height.setValue(10);
106 camera->nearDistance.setValue(1);
107 camera->farDistance.setValue(100);
108 camera->focalDistance.setValue(10);
109 group->addChild(camera);
110
111 {SoInput soInput;
112 if(soInput.openFile("g4view.iv",TRUE)) {
113 SoSeparator* separator = SoDB::readAll(&soInput);
114 if(separator) fSoSelection->addChild(separator);
115 }}
116
118
119 // SoImageWriter should be the last.
121 fSoImageWriter->fileName.setValue("g4out.ps");
122 fSoSelection->addChild(fSoImageWriter);
123
124 // Sensors :
125 // To detect that the viewer had changed the camera type :
126 fGroupCameraSensor = new SoNodeSensor(GroupCameraSensorCB,this);
127 fGroupCameraSensor->setPriority(0);//Needed in order to do getTriggerNode()
128 fGroupCameraSensor->attach(group);
129 // FWJ Upgraded the group sensor so the camera sensor is not needed
130 // fCameraSensor = new SoNodeSensor(CameraSensorCB,this);
131 // fCameraSensor->setPriority(0);//Needed in order to do getTriggerNode()
132 // fCameraSensor->attach(camera);
133}
#define SoImageWriter
Definition: SoImageWriter.h:40
SoNodeSensor * fGroupCameraSensor
G4OpenInventorSceneHandler & fG4OpenInventorSceneHandler
G4VInteractorManager * fInteractorManager
static void SelectionCB(void *, SoPath *)
Geant4_SoImageWriter * fSoImageWriter
Geant4_SoGL2PSAction * fGL2PSAction
G4VGraphicsSystem * GetGraphicsSystem() const
G4ViewParameters fDefaultVP
Definition: G4VViewer.hh:221
G4ViewParameters fVP
Definition: G4VViewer.hh:220
void SetAutoRefresh(G4bool)
void SetPicking(G4bool)
#define TRUE
Definition: globals.hh:41

◆ ~G4OpenInventorViewer()

G4OpenInventorViewer::~G4OpenInventorViewer ( )
virtual

Definition at line 135 of file G4OpenInventorViewer.cc.

135 {
136 // fCameraSensor->detach();
137 // delete fCameraSensor;
138 fGroupCameraSensor->detach();
139 delete fGroupCameraSensor;
140 fSoSelection->unref();
141}

Member Function Documentation

◆ ClearView()

void G4OpenInventorViewer::ClearView ( void  )
virtual

Implements G4VViewer.

Definition at line 234 of file G4OpenInventorViewer.cc.

234 {
235}

◆ DrawView()

void G4OpenInventorViewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 383 of file G4OpenInventorViewer.cc.

383 {
384 //G4cout << "debug Iv::DrawViewer " <<G4endl;
386 fLastVP= fVP;
387 ProcessView();
388 FinishView();
389}
virtual void KernelVisitDecision()
G4bool fNeedKernelVisit
Definition: G4VViewer.hh:227
void ProcessView()
Definition: G4VViewer.cc:107
virtual void FinishView()
Definition: G4VViewer.cc:103

Referenced by UpdateScene().

◆ EraseDetector()

void G4OpenInventorViewer::EraseDetector ( )
protected

Definition at line 660 of file G4OpenInventorViewer.cc.

660 {
661 fG4OpenInventorSceneHandler.fDetectorRoot->removeAllChildren();
662}

Referenced by G4OpenInventorXtViewer::EraseDetectorCbk().

◆ EraseEvent()

void G4OpenInventorViewer::EraseEvent ( )
protected

Definition at line 663 of file G4OpenInventorViewer.cc.

663 {
664 fG4OpenInventorSceneHandler.fTransientRoot->removeAllChildren();
665}

Referenced by G4OpenInventorXtViewer::EraseEventCbk().

◆ Escape()

void G4OpenInventorViewer::Escape ( )
protected

Menu items callbacks /////////////////////////////////////////////////////.

Definition at line 520 of file G4OpenInventorViewer.cc.

520 {
521 G4cout << "Escape..." <<G4endl;
523}
#define OIV_EXIT_CODE
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout

Referenced by G4OpenInventorXtViewer::EscapeCbk().

◆ GetCamera()

virtual SoCamera * G4OpenInventorViewer::GetCamera ( )
protectedpure virtual

◆ Help()

G4String G4OpenInventorViewer::Help ( const G4String topic = "controls")
protected

Definition at line 770 of file G4OpenInventorViewer.cc.

770 {
771 if(aTopic=="controls") {
772 return G4String("\
773Controls on an Inventor examiner viewer are :\n\
774- in picking mode (cursor is the upper left arrow)\n\
775 Ctrl + pick a volume : see daughters.\n\
776 Shift + pick a volume : see mother.\n\
777- in viewing mode (cursor is the hand)\n\
778 Left-button + pointer move : rotate.\n\
779 Ctrl+Left-button + pointer move : pan.\n\
780 Ctrl+Shift+Left-button + pointer move : scale.\n\
781 Middle-button + pointer move : pan.\n\
782 Right-button : popup menu.\n");
783 } else {
784 return "";
785 }
786}

Referenced by G4OpenInventorXtViewer::HelpCbk().

◆ KernelVisitDecision()

void G4OpenInventorViewer::KernelVisitDecision ( )
virtual

Definition at line 143 of file G4OpenInventorViewer.cc.

143 {
144
145 // If there's a significant difference with the last view parameters
146 // of either the scene handler or this viewer, trigger a rebuild.
147
148 if (
149 //??fG4OpenInventorSceneHandler.fPODLList.size() == 0 ||
150 // We need a test for empty scene graph, such as
151 // staticRoot.size() or something?????????? See temporary fix
152 // in contructor. (John Allison Aug 2001)
153 CompareForKernelVisit(fLastVP)) {
155 }
156}
void NeedKernelVisit()
Definition: G4VViewer.cc:80

Referenced by DrawView().

◆ SceneGraphStatistics()

void G4OpenInventorViewer::SceneGraphStatistics ( )
protected

Definition at line 629 of file G4OpenInventorViewer.cc.

629 {
630 Counter counter;
631 counter.fTriangles = 0;
632 counter.fLineSegments = 0;
633 counter.fPoints = 0;
634
635 SoCallbackAction callbackAction;
636 callbackAction.addTriangleCallback
637 (SoShape::getClassTypeId(),CountTrianglesCB,(void*)&counter);
638 callbackAction.addLineSegmentCallback
639 (SoShape::getClassTypeId(),CountLineSegmentsCB,(void*)&counter);
640 callbackAction.addPointCallback
641 (SoShape::getClassTypeId(),CountPointsCB,(void*)&counter);
642 callbackAction.apply(fSoSelection);
643
644 SoCounterAction counterAction;
645 counterAction.apply(fSoSelection);
646 int nodes = counterAction.getCount();
647
648 counterAction.setLookFor(SoCounterAction::TYPE);
649 counterAction.setType(SoShape::getClassTypeId());
650 counterAction.apply(fSoSelection);
651 int shapes = counterAction.getCount();
652
653 G4cout << "Number of triangles : " << counter.fTriangles << G4endl;
654 G4cout << "Number of line segments : " << counter.fLineSegments << G4endl;
655 G4cout << "Number of points : " << counter.fPoints << G4endl;
656 G4cout << "Number of nodes : " << nodes << G4endl;
657 G4cout << "Number of shapes : " << shapes << G4endl;
658}
int getCount() const
void setLookFor(LookFor)
void setType(const SoType, SbBool=TRUE)

Referenced by G4OpenInventorXtViewer::SceneGraphStatisticsCbk().

◆ SelectionCB()

void G4OpenInventorViewer::SelectionCB ( void *  aThis,
SoPath *  aPath 
)
staticprotected

Definition at line 458 of file G4OpenInventorViewer.cc.

462{
464 SoNode* node = ((SoFullPath*)aPath)->getTail();
465 G4AttHolder* attHolder = dynamic_cast<G4AttHolder*>(node);
466 if(attHolder && attHolder->GetAttDefs().size()) {
467 for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
468 G4cout << G4AttCheck(attHolder->GetAttValues()[i],
469 attHolder->GetAttDefs()[i]);
470 }
471 } else {
472 G4String name((char*)node->getName().getString());
473 G4String cls((char*)node->getTypeId().getName().getString());
474 G4cout << "SoNode : " << node
475 << " SoType : " << cls
476 << " name : " << name
477 << G4endl;
478 G4cout << "No attributes attached." << G4endl;
479 }
480 /*FIXME : to explore (need different button - this is used for picking.
481 if(node->isOfType(Geant4_SoPolyhedron::getClassTypeId())) {
482 Geant4_SoPolyhedron* polyhedron = (Geant4_SoPolyhedron*)node;
483 if(polyhedron->solid.getValue()==FALSE)
484 polyhedron->solid.setValue(TRUE);
485 else
486 polyhedron->solid.setValue(FALSE);
487 }*/
488 This->fSoSelection->deselectAll();
489}
const std::vector< const std::vector< G4AttValue > * > & GetAttValues() const
Definition: G4AttHolder.hh:61
const std::vector< const std::map< G4String, G4AttDef > * > & GetAttDefs() const
Definition: G4AttHolder.hh:63
const char * name(G4int ptype)

Referenced by G4OpenInventorViewer(), and G4OpenInventorXtExtendedViewer::Initialise().

◆ SetPreview()

void G4OpenInventorViewer::SetPreview ( )
protected

Definition at line 674 of file G4OpenInventorViewer.cc.

674 {
675 fG4OpenInventorSceneHandler.fPreviewAndFull = false;
676
678 DrawDetector();
679}

Referenced by G4OpenInventorXtViewer::SetPreviewCbk().

◆ SetPreviewAndFull()

void G4OpenInventorViewer::SetPreviewAndFull ( )
protected

Definition at line 667 of file G4OpenInventorViewer.cc.

667 {
668 fG4OpenInventorSceneHandler.fPreviewAndFull = true;
669
671 DrawDetector();
672}

Referenced by G4OpenInventorXtViewer::SetPreviewAndFullCbk().

◆ SetReducedWireFrame()

void G4OpenInventorViewer::SetReducedWireFrame ( bool  aValue)
protected

Definition at line 730 of file G4OpenInventorViewer.cc.

730 {
732
733 // Set the wire frame kind :
734 vp.SetAuxEdgeVisible(!aValue);
735
736 // Set wire frame :
738 switch (existingStyle) {
740 break;
742 break;
745 break;
748 break;
751 break;
752 }
754 NeedKernelVisit(); // Just in case it was alread in wire framw.
755 DrawDetector();
756}
const G4ViewParameters & GetViewParameters() const
void SetViewParameters(const G4ViewParameters &vp)
Definition: G4VViewer.cc:126
void SetDrawingStyle(G4ViewParameters::DrawingStyle style)
void SetAuxEdgeVisible(G4bool)
DrawingStyle GetDrawingStyle() const

Referenced by G4OpenInventorXtViewer::SetFullWireFrameCbk(), and G4OpenInventorXtViewer::SetReducedWireFrameCbk().

◆ SetSolid()

void G4OpenInventorViewer::SetSolid ( )
protected

Definition at line 685 of file G4OpenInventorViewer.cc.

685 {
688 //From G4VisCommandsViewerSet : /vis/viewer/set/style solid.
689 switch (existingStyle) {
692 break;
695 break;
697 break;
699 break;
702 break;
703 }
705 DrawDetector();
706}

Referenced by G4OpenInventorXtViewer::SetSolidCbk().

◆ SetView()

void G4OpenInventorViewer::SetView ( )
virtual

Implements G4VViewer.

Reimplemented in G4OpenInventorQtViewer, G4OpenInventorWinViewer, G4OpenInventorXtExtendedViewer, and G4OpenInventorXtViewer.

Definition at line 237 of file G4OpenInventorViewer.cc.

237 {
238
239 // Get G4 camera infos :
240 const G4Point3D target
244 if(radius<=0.) radius = 1.;
245 const G4double cameraDistance = fVP.GetCameraDistance (radius);
246 const G4Vector3D& direction = fVP.GetViewpointDirection().unit();
247 const G4Point3D cameraPosition = target + cameraDistance * direction;
248 //const G4double pnear = fVP.GetNearDistance (cameraDistance, radius);
249 //const G4double pfar = fVP.GetFarDistance (cameraDistance, pnear, radius);
250 const G4Normal3D& up = fVP.GetUpVector ();
251
252/*
253 printf("debug : target : %g %g %g\n",target.x(),
254 target.y(),
255 target.z());
256 printf("debug : dir : %g %g %g\n",direction.x(),
257 direction.y(),
258 direction.z());
259 printf("debug : pos : %g %g %g\n",cameraPosition.x(),
260 cameraPosition.y(),
261 cameraPosition.z());
262 //printf("debug : near %g far %g\n",pnear,pfar);
263*/
264
265 SoCamera* camera = GetCamera();
266 if(!camera) return;
267
268 // viewer camera setup :
269 camera->position.setValue((float)cameraPosition.x(),
270 (float)cameraPosition.y(),
271 (float)cameraPosition.z());
272
273 SbVec3f sbTarget((float)target.x(),
274 (float)target.y(),
275 (float)target.z());
276 SbVec3f sbUp((float)up.x(),
277 (float)up.y(),
278 (float)up.z());
279 sbUp.normalize();
280 // Need Coin's camera->pointAt(sbTarget,sbUp); not in the SGI API
281 // Stole Coin's code...
282 pointAt(camera,sbTarget,sbUp);
283
284 //camera->height.setValue(10);
285 //camera->nearDistance.setValue((float)pnear);
286 //camera->farDistance.setValue((float)pfar);
287 //camera->focalDistance.setValue((float)cameraDistance);
288
289 if(camera->isOfType(SoOrthographicCamera::getClassTypeId())) {
290 if (fVP.GetFieldHalfAngle() == 0.) {
291 //FIXME : ((SoOrthographicCamera*)camera)->height.setValue();
292 //FIXME : (Don't think we have to do that.)
293 } else {
294 //FIXME : Have to set a perspective camera !
295 //FIXME : viewer->setCameraType(SoPerspectiveCamera::getClassTypeId())
296 //FIXME : ((SoPerspectiveCamera*)camera)->heightAngle.setValue
297 //FIXME : (2.*fVP.GetFieldHalfAngle());
298 }
299 } else if(camera->isOfType(SoPerspectiveCamera::getClassTypeId())) {
300 if (fVP.GetFieldHalfAngle() == 0.) {
301 //FIXME : Have to set an orthographic camera !
302 //FIXME : viewer->setCameraType(SoOrthographicCamera::getClassTypeId())
303 } else {
304 //FIXME : ((SoPerspectiveCamera*)camera)->heightAngle.setValue
305 //FIXME : (2.*fVP.GetFieldHalfAngle());
306 }
307 }
308}
double G4double
Definition: G4Types.hh:83
virtual SoCamera * GetCamera()=0
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
G4Scene * GetScene() const
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:216
G4double GetCameraDistance(G4double radius) const
const G4Vector3D & GetViewpointDirection() const
const G4Point3D & GetCurrentTargetPoint() const
G4double GetFieldHalfAngle() const
const G4Vector3D & GetUpVector() const
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75
BasicVector3D< T > unit() const

Referenced by G4OpenInventorQtViewer::SetView(), G4OpenInventorWinViewer::SetView(), G4OpenInventorXtExtendedViewer::SetView(), and G4OpenInventorXtViewer::SetView().

◆ SetWireFrame()

void G4OpenInventorViewer::SetWireFrame ( )
protected

Definition at line 707 of file G4OpenInventorViewer.cc.

707 {
710 switch (existingStyle) {
712 break;
714 break;
717 break;
720 break;
723 break;
724 }
726 DrawDetector();
727}

Referenced by G4OpenInventorXtViewer::SetWireFrameCbk().

◆ ShowView()

void G4OpenInventorViewer::ShowView ( void  )
virtual

Reimplemented from G4VViewer.

Definition at line 391 of file G4OpenInventorViewer.cc.

391 {
392 fInteractorManager -> SecondaryLoop ();
393}

◆ UpdateScene()

void G4OpenInventorViewer::UpdateScene ( )
protected

Definition at line 758 of file G4OpenInventorViewer.cc.

758 {
759 /* Replace this... - JA
760 fG4OpenInventorSceneHandler.ClearStore();
761 ClearView();
762 if (!fNeedKernelVisit) KernelVisitDecision();
763 ProcessView();
764 ShowView();
765 */
766 // ...by this - JA
768 DrawView();
769}

Referenced by G4OpenInventorXtViewer::UpdateSceneCbk().

◆ ViewerRender()

virtual void G4OpenInventorViewer::ViewerRender ( )
protectedpure virtual

◆ WriteInventor()

void G4OpenInventorViewer::WriteInventor ( const G4String file = "g4out.iv")
protected

Definition at line 566 of file G4OpenInventorViewer.cc.

566 {
567 G4cout << "Produce " << aFile << "..." << G4endl;
568
569 SbBool genAlternateRep = TRUE;
570 //SbBool binary = FALSE;
571 SbBool binary = TRUE;
572 SoAlternateRepAction alternateRepAction;
573 if(genAlternateRep==TRUE) {
574 alternateRepAction.setGenerate(TRUE); //Clear alternate reps.
575 alternateRepAction.apply(fSoSelection);
576 }
577
578 SoWriteAction writeAction;
579 writeAction.getOutput()->openFile(aFile.c_str());
580 writeAction.getOutput()->setBinary(binary);
581 writeAction.apply(fSoSelection);
582 writeAction.getOutput()->closeFile();
583
584 if(genAlternateRep==TRUE) {
585 alternateRepAction.setGenerate(FALSE); //Clear alternate reps.
586 alternateRepAction.apply(fSoSelection);
587 }
588
589
590
591}
void setGenerate(SbBool)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
#define FALSE
Definition: globals.hh:38

Referenced by G4OpenInventorXtViewer::WriteInventorCbk().

◆ WritePDF()

void G4OpenInventorViewer::WritePDF ( const G4String file = "g4out.pdf")
protected

Definition at line 537 of file G4OpenInventorViewer.cc.

537 {
538 if(!fGL2PSAction) return;
539 fGL2PSAction->setFileName(aFile.c_str());
540 fGL2PSAction->setExportImageFormat_PDF();
541 fGL2PSAction->setTitleAndProducer("Geant4 output","Geant4");
542 G4cout << "Produce " << aFile << "..." << G4endl;
543 if (fGL2PSAction->enableFileWriting()) {
544 ViewerRender();
545 fGL2PSAction->disableFileWriting();
546 }
547}
virtual void ViewerRender()=0

◆ WritePixmapPostScript()

void G4OpenInventorViewer::WritePixmapPostScript ( const G4String file = "g4out.ps")
protected

Definition at line 549 of file G4OpenInventorViewer.cc.

549 {
550 fSoImageWriter->fileName.setValue(aFile.c_str());
551 //imageWriter->format.setValue(SoImageWriter::POST_SCRIPT);
552 fSoImageWriter->enable();
553 ViewerRender();
554 fSoImageWriter->disable();
555 if(fSoImageWriter->getStatus()) {
556 G4cout << G4String(fSoImageWriter->fileName.getValue().getString())
557 << " produced."
558 << G4endl;
559 } else {
560 G4cout << G4String(fSoImageWriter->fileName.getValue().getString())
561 << " not produced."
562 << G4endl;
563 }
564}

Referenced by G4OpenInventorXtViewer::PixmapPostScriptCbk().

◆ WritePostScript()

void G4OpenInventorViewer::WritePostScript ( const G4String file = "g4out.ps")
protected

Definition at line 525 of file G4OpenInventorViewer.cc.

525 {
526 if(!fGL2PSAction) return;
527 fGL2PSAction->setFileName(aFile.c_str());
528 fGL2PSAction->setExportImageFormat_EPS();
529 fGL2PSAction->setTitleAndProducer("Geant4 output","Geant4");
530 G4cout << "Produce " << aFile << "..." << G4endl;
531 if (fGL2PSAction->enableFileWriting()) {
532 ViewerRender();
533 fGL2PSAction->disableFileWriting();
534 }
535}

Referenced by G4OpenInventorXtViewer::PostScriptCbk().

Member Data Documentation

◆ fG4OpenInventorSceneHandler

G4OpenInventorSceneHandler& G4OpenInventorViewer::fG4OpenInventorSceneHandler
protected

◆ fGL2PSAction

◆ fGroupCameraSensor

SoNodeSensor* G4OpenInventorViewer::fGroupCameraSensor
protected

Definition at line 99 of file G4OpenInventorViewer.hh.

Referenced by G4OpenInventorViewer(), and ~G4OpenInventorViewer().

◆ fInteractorManager

◆ fSoImageWriter

Geant4_SoImageWriter* G4OpenInventorViewer::fSoImageWriter
protected

Definition at line 97 of file G4OpenInventorViewer.hh.

Referenced by G4OpenInventorViewer(), and WritePixmapPostScript().

◆ fSoSelection


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