Geant4-11
G4OpenInventorViewer.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26
27// 03-MAY-2021 F.W. Jones: removed the camera sensor which is redundant
28// since the group node sensor receives all camera motion events and
29// can update the view parameters, irrespective of any changes to the
30// camera type.
31
32// this :
34
35#include <Inventor/nodes/SoSelection.h>
36#include <Inventor/nodes/SoShape.h>
37#include <Inventor/nodes/SoOrthographicCamera.h>
38#include <Inventor/nodes/SoPerspectiveCamera.h>
39#include <Inventor/actions/SoCallbackAction.h>
40#include <Inventor/actions/SoWriteAction.h>
41#include <Inventor/sensors/SoNodeSensor.h>
42
47
48#include "G4OpenInventor.hh"
51#include "G4Scene.hh"
52#include "Geant4_SoPolyhedron.h"
53#include "G4AttValue.hh"
54#include "G4AttDef.hh"
55#include "G4AttCheck.hh"
56#include "G4AttHolder.hh"
57
59 G4OpenInventorSceneHandler& sceneHandler
60,const G4String& name)
61:G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
62,fG4OpenInventorSceneHandler(sceneHandler)
63,fInteractorManager(0)
64,fSoSelection(0)
65,fSoImageWriter(0)
66,fGL2PSAction(0) //To be set be suclass.
67,fGroupCameraSensor(0)
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}
134
136 // fCameraSensor->detach();
137 // delete fCameraSensor;
138 fGroupCameraSensor->detach();
139 delete fGroupCameraSensor;
140 fSoSelection->unref();
141}
142
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)
155 }
156}
157
159
160 if (
161 (vp.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
163 (vp.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
164 (vp.IsCulling () != fVP.IsCulling ()) ||
166 (vp.IsDensityCulling () != fVP.IsDensityCulling ()) ||
167 (vp.IsCullingCovered () != fVP.IsCullingCovered ()) ||
168 (vp.GetCBDAlgorithmNumber() !=
170 (vp.IsSection () != fVP.IsSection ()) ||
171 (vp.IsCutaway () != fVP.IsCutaway ()) ||
172 // This assumes use of generic clipping (sectioning, slicing,
173 // DCUT, cutaway). If a decision is made to implement locally,
174 // this will need changing. See G4OpenGLViewer::SetView,
175 // G4OpenGLStoredViewer.cc::CompareForKernelVisit and
176 // G4OpenGLStoredSceneHander::CreateSection/CutawayPolyhedron.
177 (vp.IsExplode () != fVP.IsExplode ()) ||
178 (vp.GetNoOfSides () != fVP.GetNoOfSides ()) ||
187 (vp.IsPicking () != fVP.IsPicking ()) ||
188 // Scaling for Open Inventor is done by the scene handler so it
189 // needs a kernel visit. (In this respect, it differs from the
190 // OpenGL drivers, where it's done in SetView.)
191 (vp.GetScaleFactor () != fVP.GetScaleFactor ()) ||
192 // If G4OpenInventor ever introduces VAMs, the following might need
193 // changing to a complete comparison, i.e., remove ".size()". See
194 // G4OpenGLStoredViewer::CompareForKernelVisit.
199 )
200 return true;
201
202 if (vp.IsDensityCulling () &&
204 return true;
205
206 if (vp.GetCBDAlgorithmNumber() > 0) {
207 if (vp.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
208 else if (vp.GetCBDParameters() != fVP.GetCBDParameters()) return true;
209 }
210
211 if (vp.IsSection () &&
212 (vp.GetSectionPlane () != fVP.GetSectionPlane ()))
213 return true;
214
215 if (vp.IsCutaway ()) {
216 if (vp.GetCutawayPlanes ().size () !=
217 fVP.GetCutawayPlanes ().size ()) return true;
218 for (size_t i = 0; i < vp.GetCutawayPlanes().size(); ++i)
219 if (vp.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
220 return true;
221 }
222
223 if (vp.IsExplode () &&
225 return true;
226
227 if (vp.IsSpecialMeshRendering() &&
229 return true;
230
231 return false;
232}
233
235}
236
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}
309
310//COIN_FUNCTION_EXTENSION
311void
312G4OpenInventorViewer::pointAt(SoCamera* camera,const SbVec3f & targetpoint, const SbVec3f & upvector)
313{
314 SbVec3f dir = targetpoint - camera->position.getValue();
315 if (dir.normalize() == 0.0f) return;
316 lookAt(camera,dir, upvector);
317}
318
319//COIN_FUNCTION
320// Private method that calculates a new orientation based on camera
321// direction and camera up vector. Vectors must be unit length.
322void
323G4OpenInventorViewer::lookAt(SoCamera* camera,const SbVec3f & dir, const SbVec3f & up)
324{
325 SbVec3f z = -dir;
326 SbVec3f y = up;
327 SbVec3f x = y.cross(z);
328
329 // recompute y to create a valid coordinate system
330 y = z.cross(x);
331
332 // normalize x and y to create an orthonormal coord system
333 y.normalize();
334 x.normalize();
335
336 // create a rotation matrix
337 SbMatrix rot = SbMatrix::identity();
338 rot[0][0] = x[0];
339 rot[0][1] = x[1];
340 rot[0][2] = x[2];
341
342 rot[1][0] = y[0];
343 rot[1][1] = y[1];
344 rot[1][2] = y[2];
345
346 rot[2][0] = z[0];
347 rot[2][1] = z[1];
348 rot[2][2] = z[2];
349
350 camera->orientation.setValue(SbRotation(rot));
351}
352
353void
354G4OpenInventorViewer::lookedAt(SoCamera* camera,SbVec3f & dir, SbVec3f & up)
355{
356 SbRotation rot = camera->orientation.getValue();
357 SbMatrix mrot; rot.getValue(mrot);
358
359 SbVec3f x, y, z;
360
361 // create a rotation matrix
362 x[0] = mrot[0][0];
363 x[1] = mrot[0][1];
364 x[2] = mrot[0][2];
365
366 y[0] = mrot[1][0];
367 y[1] = mrot[1][1];
368 y[2] = mrot[1][2];
369
370 z[0] = mrot[2][0];
371 z[1] = mrot[2][1];
372 z[2] = mrot[2][2];
373
374 dir = -z;
375 dir.normalize();
376 up = SbVec3f(0.f,1.f,0.f); // Choose y-axis if possible.
377 if (std::abs(up.dot(z)) > 1.e-6) {
378 up = y;
379 up.normalize();
380 }
381}
382
384 //G4cout << "debug Iv::DrawViewer " <<G4endl;
386 fLastVP= fVP;
387 ProcessView();
388 FinishView();
389}
390
392 fInteractorManager -> SecondaryLoop ();
393}
394
395// FWJ This sensor now performs the fVP updates
396void G4OpenInventorViewer::GroupCameraSensorCB(void* aThis, SoSensor* aSensor)
397{
399
400 SoNode* node = ((SoNodeSensor*)aSensor)->getTriggerNode();
401 // printf("debug : GroupCameraSensorCB %s\n",
402 // node->getTypeId().getName().getString());
403
404 if(node->isOfType(SoCamera::getClassTypeId())) {
405 SoCamera* camera = (SoCamera*)node;
406
407 // FWJ DEBUG
408 // G4cout << " UPDATING fVP FROM CAMERA " << camera << G4endl;
409 SbVec3f direction, up;
410 lookedAt(camera, direction, up);
412 (G4Vector3D(-direction[0], -direction[1], -direction[2]));
413 This->fVP.SetUpVector(G4Vector3D(up[0], up[1], up[2]));
414
415 SbVec3f pos = camera->position.getValue();
416 SbVec3f target = pos + direction * camera->focalDistance.getValue();
417
418 This->fVP.SetCurrentTargetPoint(G4Point3D(target[0], target[1], target[2]));
419
420 // FWJ camera sensor no longer needed
421 // Viewer had changed the camera type,
422 // attach the fCameraSensor to the new camera.
423 // FWJ DEBUG
424 // G4cout << " SWITCHING TO CAMERA " << camera << G4endl;
425 // This->fCameraSensor->detach();
426 // This->fCameraSensor->attach(camera);
427 }
428
429}
430
431/* FWJ This sensor is no longer needed
432void G4OpenInventorViewer::CameraSensorCB(void* aThis,SoSensor* aSensor) {
433 G4OpenInventorViewer* This = (G4OpenInventorViewer*)aThis;
434
435 // printf("debug : CameraSensorCB\n");
436
437 SoNode* node = ((SoNodeSensor*)aSensor)->getTriggerNode();
438// printf("debug : CameraSensorCB %s\n",
439// node->getTypeId().getName().getString());
440
441 if(node->isOfType(SoCamera::getClassTypeId())) {
442 SoCamera* camera = (SoCamera*)node;
443
444 SbVec3f direction, up;
445 lookedAt(camera,direction, up);
446 This->fVP.SetViewpointDirection
447 (G4Vector3D(-direction[0],-direction[1],-direction[2]));
448 This->fVP.SetUpVector(G4Vector3D(up[0],up[1],up[2]));
449
450 SbVec3f pos = camera->position.getValue();
451 SbVec3f target = pos + direction * camera->focalDistance.getValue();
452
453 This->fVP.SetCurrentTargetPoint(G4Point3D(target[0],target[1],target[2]));
454 }
455}
456*/
457
459 void* aThis
460,SoPath* aPath
461)
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}
490/*
491void G4OpenInventorViewer::DeselectionCB(
492 void* aThis
493,SoPath* aPath
494)
495{
496 //G4OpenInventorViewer* This = (G4OpenInventorViewer*)aThis;
497 G4String name((char*)aPath->getTail()->getTypeId().getName().getString());
498 G4cout << "Deselect : " << name << G4endl;
499}
500*/
501
503 /* Replace this... - JA
504 // DrawView does a ClearStore. Do not clear the transient store :
505 SoSeparator* tmp = fG4OpenInventorSceneHandler.fTransientRoot;
506 fG4OpenInventorSceneHandler.fTransientRoot = new SoSeparator;
507 if (!fNeedKernelVisit) KernelVisitDecision();
508 ProcessView();
509 fG4OpenInventorSceneHandler.fTransientRoot->unref();
510 fG4OpenInventorSceneHandler.fTransientRoot = tmp;
511 */
512 // ...by this... - JA
513 DrawView();
514}
515
519
521 G4cout << "Escape..." <<G4endl;
523}
524
526 if(!fGL2PSAction) return;
527 fGL2PSAction->setFileName(aFile.c_str());
528 fGL2PSAction->setExportImageFormat(GL2PS_EPS);
529 // Use gl2ps default buffer (2048*2048)
530 fGL2PSAction->setBufferSize(0);
531 G4cout << "Produce " << aFile << "..." << G4endl;
532 if (fGL2PSAction->enableFileWriting()) {
533 ViewerRender();
534 fGL2PSAction->disableFileWriting();
535 }
536 fGL2PSAction->resetBufferSizeParameters();
537}
538
540 if(!fGL2PSAction) return;
541 fGL2PSAction->setFileName(aFile.c_str());
542 fGL2PSAction->setExportImageFormat(GL2PS_PDF);
543 // Use gl2ps default buffer (2048*2048)
544 fGL2PSAction->setBufferSize(0);
545 G4cout << "Produce " << aFile << "..." << G4endl;
546 if (fGL2PSAction->enableFileWriting()) {
547 ViewerRender();
548 fGL2PSAction->disableFileWriting();
549 }
550 fGL2PSAction->resetBufferSizeParameters();
551}
552
554 fSoImageWriter->fileName.setValue(aFile.c_str());
555 //imageWriter->format.setValue(SoImageWriter::POST_SCRIPT);
556 fSoImageWriter->enable();
557 ViewerRender();
558 fSoImageWriter->disable();
559 if(fSoImageWriter->getStatus()) {
560 G4cout << G4String(fSoImageWriter->fileName.getValue().getString())
561 << " produced."
562 << G4endl;
563 } else {
564 G4cout << G4String(fSoImageWriter->fileName.getValue().getString())
565 << " not produced."
566 << G4endl;
567 }
568}
569
571 G4cout << "Produce " << aFile << "..." << G4endl;
572
573 SbBool genAlternateRep = TRUE;
574 //SbBool binary = FALSE;
575 SbBool binary = TRUE;
576 SoAlternateRepAction alternateRepAction;
577 if(genAlternateRep==TRUE) {
578 alternateRepAction.setGenerate(TRUE); //Clear alternate reps.
579 alternateRepAction.apply(fSoSelection);
580 }
581
582 SoWriteAction writeAction;
583 writeAction.getOutput()->openFile(aFile.c_str());
584 writeAction.getOutput()->setBinary(binary);
585 writeAction.apply(fSoSelection);
586 writeAction.getOutput()->closeFile();
587
588 if(genAlternateRep==TRUE) {
589 alternateRepAction.setGenerate(FALSE); //Clear alternate reps.
590 alternateRepAction.apply(fSoSelection);
591 }
592
593
594
595}
596
597struct Counter {
601};
602
604 void* userData
605,SoCallbackAction*
606,const SoPrimitiveVertex*
607,const SoPrimitiveVertex*,
608const SoPrimitiveVertex*)
609{
610 Counter* counter = (Counter*)userData;
611 counter->fTriangles++;
612}
613
615 void* userData
616,SoCallbackAction*
617,const SoPrimitiveVertex*
618,const SoPrimitiveVertex*)
619{
620 Counter* counter = (Counter*)userData;
621 counter->fLineSegments++;
622}
623
624static void CountPointsCB(
625 void* userData
626,SoCallbackAction*
627,const SoPrimitiveVertex*)
628{
629 Counter* counter = (Counter*)userData;
630 counter->fPoints++;
631}
632
634 Counter counter;
635 counter.fTriangles = 0;
636 counter.fLineSegments = 0;
637 counter.fPoints = 0;
638
639 SoCallbackAction callbackAction;
640 callbackAction.addTriangleCallback
641 (SoShape::getClassTypeId(),CountTrianglesCB,(void*)&counter);
642 callbackAction.addLineSegmentCallback
643 (SoShape::getClassTypeId(),CountLineSegmentsCB,(void*)&counter);
644 callbackAction.addPointCallback
645 (SoShape::getClassTypeId(),CountPointsCB,(void*)&counter);
646 callbackAction.apply(fSoSelection);
647
648 SoCounterAction counterAction;
649 counterAction.apply(fSoSelection);
650 int nodes = counterAction.getCount();
651
652 counterAction.setLookFor(SoCounterAction::TYPE);
653 counterAction.setType(SoShape::getClassTypeId());
654 counterAction.apply(fSoSelection);
655 int shapes = counterAction.getCount();
656
657 G4cout << "Number of triangles : " << counter.fTriangles << G4endl;
658 G4cout << "Number of line segments : " << counter.fLineSegments << G4endl;
659 G4cout << "Number of points : " << counter.fPoints << G4endl;
660 G4cout << "Number of nodes : " << nodes << G4endl;
661 G4cout << "Number of shapes : " << shapes << G4endl;
662}
663
665 fG4OpenInventorSceneHandler.fDetectorRoot->removeAllChildren();
666}
668 fG4OpenInventorSceneHandler.fTransientRoot->removeAllChildren();
669}
670
673
675 DrawDetector();
676}
677
680
682 DrawDetector();
683}
684
685// When ViewParameter <-> SoCamera mapping ready
686// uncomment the below
687//#define USE_SET_VIEW
688
692 //From G4VisCommandsViewerSet : /vis/viewer/set/style solid.
693 switch (existingStyle) {
696 break;
699 break;
701 break;
703 break;
706 break;
707 }
709 DrawDetector();
710}
714 switch (existingStyle) {
716 break;
718 break;
721 break;
724 break;
727 break;
728 }
730 DrawDetector();
731}
732
733
736
737 // Set the wire frame kind :
738 vp.SetAuxEdgeVisible(!aValue);
739
740 // Set wire frame :
742 switch (existingStyle) {
744 break;
746 break;
749 break;
752 break;
755 break;
756 }
758 NeedKernelVisit(); // Just in case it was alread in wire framw.
759 DrawDetector();
760}
761
763 /* Replace this... - JA
764 fG4OpenInventorSceneHandler.ClearStore();
765 ClearView();
766 if (!fNeedKernelVisit) KernelVisitDecision();
767 ProcessView();
768 ShowView();
769 */
770 // ...by this - JA
772 DrawView();
773}
775 if(aTopic=="controls") {
776 return G4String("\
777Controls on an Inventor examiner viewer are :\n\
778- in picking mode (cursor is the upper left arrow)\n\
779 Ctrl + pick a volume : see daughters.\n\
780 Shift + pick a volume : see mother.\n\
781- in viewing mode (cursor is the hand)\n\
782 Left-button + pointer move : rotate.\n\
783 Ctrl+Left-button + pointer move : pan.\n\
784 Ctrl+Shift+Left-button + pointer move : scale.\n\
785 Middle-button + pointer move : pan.\n\
786 Right-button : popup menu.\n");
787 } else {
788 return "";
789 }
790}
static const G4double pos
static void CountLineSegmentsCB(void *userData, SoCallbackAction *, const SoPrimitiveVertex *, const SoPrimitiveVertex *)
static void CountPointsCB(void *userData, SoCallbackAction *, const SoPrimitiveVertex *)
static void CountTrianglesCB(void *userData, SoCallbackAction *, const SoPrimitiveVertex *, const SoPrimitiveVertex *, const SoPrimitiveVertex *)
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:34
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
#define OIV_EXIT_CODE
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:34
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
#define TRUE
Definition: Globals.hh:27
#define FALSE
Definition: Globals.hh:23
#define SoImageWriter
Definition: SoImageWriter.h:40
const std::vector< const std::vector< G4AttValue > * > & GetAttValues() const
Definition: G4AttHolder.hh:59
const std::vector< const std::map< G4String, G4AttDef > * > & GetAttDefs() const
Definition: G4AttHolder.hh:61
G4String Help(const G4String &topic="controls")
virtual SoCamera * GetCamera()=0
SoNodeSensor * fGroupCameraSensor
void WriteInventor(const G4String &file="g4out.iv")
static void pointAt(SoCamera *, const SbVec3f &targetpoint, const SbVec3f &upvector)
virtual void ViewerRender()=0
void WritePostScript(const G4String &file="g4out.ps")
void Escape()
Menu items callbacks /////////////////////////////////////////////////////.
G4OpenInventorSceneHandler & fG4OpenInventorSceneHandler
virtual void KernelVisitDecision()
static void lookedAt(SoCamera *, SbVec3f &dir, SbVec3f &up)
G4OpenInventorViewer(G4OpenInventorSceneHandler &scene, const G4String &name="")
static void lookAt(SoCamera *, const SbVec3f &dir, const SbVec3f &up)
G4VInteractorManager * fInteractorManager
void WritePixmapPostScript(const G4String &file="g4out.ps")
static void SelectionCB(void *, SoPath *)
G4bool CompareForKernelVisit(G4ViewParameters &)
void WritePDF(const G4String &file="g4out.pdf")
Geant4_SoImageWriter * fSoImageWriter
static void GroupCameraSensorCB(void *, SoSensor *)
Geant4_SoGL2PSAction * fGL2PSAction
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
G4VGraphicsSystem * GetGraphicsSystem() const
G4Scene * GetScene() const
G4bool fNeedKernelVisit
Definition: G4VViewer.hh:224
const G4ViewParameters & GetViewParameters() const
void ProcessView()
Definition: G4VViewer.cc:105
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:215
void NeedKernelVisit()
Definition: G4VViewer.cc:78
G4ViewParameters fDefaultVP
Definition: G4VViewer.hh:220
G4ViewParameters fVP
Definition: G4VViewer.hh:219
virtual void FinishView()
Definition: G4VViewer.cc:101
void SetViewParameters(const G4ViewParameters &vp)
Definition: G4VViewer.cc:120
void SetViewpointDirection(const G4Vector3D &viewpointDirection)
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
const G4Vector3D & GetScaleFactor() const
void SetAutoRefresh(G4bool)
G4int GetNoOfSides() const
G4bool IsSpecialMeshRendering() const
G4double GetCameraDistance(G4double radius) const
G4double GetExplodeFactor() const
G4int GetNumberOfCloudPoints() const
G4bool IsMarkerNotHidden() const
G4double GetGlobalLineWidthScale() const
G4bool IsCutaway() const
void SetCurrentTargetPoint(const G4Point3D &currentTargetPoint)
void SetDrawingStyle(G4ViewParameters::DrawingStyle style)
const G4Colour & GetBackgroundColour() const
const G4Vector3D & GetViewpointDirection() const
G4bool IsSection() const
const G4Point3D & GetCurrentTargetPoint() const
G4bool IsPicking() const
void SetPicking(G4bool)
G4double GetFieldHalfAngle() const
G4bool IsCulling() const
const G4VisAttributes * GetDefaultTextVisAttributes() const
G4bool IsExplode() const
const G4Vector3D & GetUpVector() const
const std::vector< G4double > & GetCBDParameters() const
G4int GetCBDAlgorithmNumber() const
const std::vector< G4ModelingParameters::PVNameCopyNo > & GetSpecialMeshVolumes() const
G4double GetGlobalMarkerScale() const
G4bool IsCullingInvisible() const
const G4VisAttributes * GetDefaultVisAttributes() const
void SetUpVector(const G4Vector3D &upVector)
const G4Planes & GetCutawayPlanes() const
G4bool IsDensityCulling() const
G4double GetVisibleDensity() const
void SetAuxEdgeVisible(G4bool)
G4bool IsCullingCovered() const
const G4Plane3D & GetSectionPlane() const
DrawingStyle GetDrawingStyle() const
G4bool IsAuxEdgeVisible() const
const G4Colour & GetColour() const
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75
BasicVector3D< T > unit() const
void setGenerate(SbBool)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
int getCount() const
void setLookFor(LookFor)
void setType(const SoType, SbBool=TRUE)
#define GL2PS_EPS
Definition: gl2ps.h:130
#define GL2PS_PDF
Definition: gl2ps.h:132
const char * name(G4int ptype)
#define userData
Definition: xmlparse.cc:572