Import Geant4 8.2.0 source tree
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenInventor.cc,v 1.20 2006/06/29 21:22:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
#ifdef G4VIS_BUILD_OI_DRIVER
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenInventorSceneHandler.cc,v 1.46 2006/06/29 21:22:14 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// $Id: G4OpenInventorSceneHandler.cc,v 1.50 2006/11/05 20:48:57 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Jeff Kallenbach 01 Aug 1996
|
||||
@@ -72,7 +72,9 @@ typedef HEPVis_SoMarkerSet SoMarkerSet;
|
||||
#include "HEPVis/nodekits/SoDetectorTreeKit.h"
|
||||
#include "HEPVis/misc/SoStyleCache.h"
|
||||
|
||||
#include "Geant4_SoPolyhedron.h"
|
||||
#include "SoG4Polyhedron.h"
|
||||
#include "SoG4LineSet.h"
|
||||
#include "SoG4MarkerSet.h"
|
||||
|
||||
#include "G4Scene.hh"
|
||||
#include "G4NURBS.hh"
|
||||
@@ -94,6 +96,11 @@ typedef HEPVis_SoMarkerSet SoMarkerSet;
|
||||
#include "G4Trap.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4TrajectoriesModel.hh"
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4VTrajectoryPoint.hh"
|
||||
#include "G4HitsModel.hh"
|
||||
#include "G4VHit.hh"
|
||||
#include "G4ModelingParameters.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
@@ -181,6 +188,56 @@ void G4OpenInventorSceneHandler::BeginPrimitives
|
||||
}
|
||||
}
|
||||
|
||||
void G4OpenInventorSceneHandler::LoadAtts
|
||||
(const G4Visible& visible,
|
||||
G4AttHolder* holder)
|
||||
{
|
||||
// Load G4Atts from G4VisAttributes, if any...
|
||||
const std::map<G4String,G4AttDef>* vaDefs =
|
||||
visible.GetVisAttributes()->GetAttDefs();
|
||||
if (vaDefs) {
|
||||
holder->AddAtts(visible.GetVisAttributes()->CreateAttValues(), vaDefs);
|
||||
}
|
||||
|
||||
G4PhysicalVolumeModel* pPVModel =
|
||||
dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
|
||||
if (pPVModel) {
|
||||
// Load G4Atts from G4PhysicalVolumeModel...
|
||||
const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
|
||||
if (defs) {
|
||||
holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
|
||||
}
|
||||
}
|
||||
|
||||
G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
|
||||
if (trajModel) {
|
||||
// Load G4Atts from trajectory...
|
||||
const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
|
||||
const std::map<G4String,G4AttDef>* defs = traj->GetAttDefs();
|
||||
if (defs) {
|
||||
holder->AddAtts(traj->CreateAttValues(), defs);
|
||||
}
|
||||
G4int nPoints = traj->GetPointEntries();
|
||||
for (G4int i = 0; i < nPoints; ++i) {
|
||||
G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
|
||||
const std::map<G4String,G4AttDef>* defs = trajPoint->GetAttDefs();
|
||||
if (defs) {
|
||||
holder->AddAtts(trajPoint->CreateAttValues(), defs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4HitsModel* hitsModel = dynamic_cast<G4HitsModel*>(fpModel);
|
||||
if (hitsModel) {
|
||||
// Load G4Atts from hit...
|
||||
const G4VHit* hit = hitsModel->GetCurrentHit();
|
||||
const std::map<G4String,G4AttDef>* defs = hit->GetAttDefs();
|
||||
if (defs) {
|
||||
holder->AddAtts(hit->CreateAttValues(), defs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Method for handling G4Polyline objects (from tracking).
|
||||
//
|
||||
@@ -220,12 +277,17 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line) {
|
||||
SoDrawStyle* drawStyle = fStyleCache->getLineStyle();
|
||||
fCurrentSeparator->addChild(drawStyle);
|
||||
|
||||
SoLineSet *pLine = new SoLineSet;
|
||||
SoG4LineSet *pLine = new SoG4LineSet;
|
||||
|
||||
// Loads G4Atts for picking...
|
||||
LoadAtts(line, pLine);
|
||||
|
||||
#ifdef INVENTOR2_0
|
||||
pLine->numVertices.setValues(0,1,(const long *)&nPoints);
|
||||
#else
|
||||
pLine->numVertices.setValues(0,1,&nPoints);
|
||||
#endif
|
||||
|
||||
fCurrentSeparator->addChild(pLine);
|
||||
|
||||
delete [] pCoords;
|
||||
@@ -269,9 +331,12 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
|
||||
break;
|
||||
}
|
||||
|
||||
SoMarkerSet* markerSet = new SoMarkerSet;
|
||||
SoG4MarkerSet* markerSet = new SoG4MarkerSet;
|
||||
markerSet->numPoints = pointn;
|
||||
|
||||
// Loads G4Atts for picking...
|
||||
LoadAtts(polymarker, markerSet);
|
||||
|
||||
G4VMarker::FillStyle style = polymarker.GetFillStyle();
|
||||
switch (polymarker.GetMarkerType()) {
|
||||
default:
|
||||
@@ -448,9 +513,13 @@ void G4OpenInventorSceneHandler::AddCircleSquare
|
||||
SoCoordinate3* coordinate3 = new SoCoordinate3;
|
||||
coordinate3->point.setValues(0,1,points);
|
||||
fCurrentSeparator->addChild(coordinate3);
|
||||
SoMarkerSet* markerSet = new SoMarkerSet;
|
||||
|
||||
SoG4MarkerSet* markerSet = new SoG4MarkerSet;
|
||||
markerSet->numPoints = 1;
|
||||
|
||||
// Loads G4Atts for picking...
|
||||
LoadAtts(marker, markerSet);
|
||||
|
||||
G4VMarker::FillStyle style = marker.GetFillStyle();
|
||||
switch (markerType) {
|
||||
case G4OICircle:
|
||||
@@ -507,11 +576,17 @@ void G4OpenInventorSceneHandler::AddCircleSquare
|
||||
void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
if (polyhedron.GetNoFacets() == 0) return;
|
||||
|
||||
Geant4_SoPolyhedron* soPolyhedron = new Geant4_SoPolyhedron(polyhedron);
|
||||
SoG4Polyhedron* soPolyhedron = new SoG4Polyhedron(polyhedron);
|
||||
|
||||
// Loads G4Atts for picking...
|
||||
LoadAtts(polyhedron, soPolyhedron);
|
||||
|
||||
SbString name = "Non-geometry";
|
||||
G4PhysicalVolumeModel* pPVModel =
|
||||
dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
|
||||
if (pPVModel) name = pPVModel->GetCurrentLV()->GetName().c_str();
|
||||
if (pPVModel) {
|
||||
name = pPVModel->GetCurrentLV()->GetName().c_str();
|
||||
}
|
||||
SbName sbName(name);
|
||||
soPolyhedron->setName(sbName);
|
||||
soPolyhedron->solid.setValue(fModelingSolid);
|
||||
@@ -658,6 +733,7 @@ void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
|
||||
G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
|
||||
//G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
|
||||
// Note: pCurrentMaterial may be zero (parallel world).
|
||||
|
||||
// The simplest algorithm, used by the Open Inventor Driver
|
||||
// developers, is to rely on the fact the G4PhysicalVolumeModel
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenInventorTransform3D.cc,v 1.8 2006/06/29 21:22:16 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// jck 17 Dec 1996
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4OpenInventorViewer.cc,v 1.57 2006/11/01 11:06:07 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
|
||||
#ifdef G4VIS_BUILD_OI_DRIVER
|
||||
|
||||
// this :
|
||||
@@ -46,6 +49,10 @@
|
||||
#include "G4VInteractorManager.hh"
|
||||
#include "G4Scene.hh"
|
||||
#include "Geant4_SoPolyhedron.h"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttCheck.hh"
|
||||
#include "G4AttHolder.hh"
|
||||
|
||||
G4OpenInventorViewer::G4OpenInventorViewer(
|
||||
G4OpenInventorSceneHandler& sceneHandler
|
||||
@@ -151,19 +158,23 @@ G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
|
||||
|
||||
if (
|
||||
(vp.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
|
||||
(vp.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
|
||||
(vp.GetRepStyle () != fVP.GetRepStyle ()) ||
|
||||
(vp.IsCulling () != fVP.IsCulling ()) ||
|
||||
(vp.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
|
||||
(vp.IsDensityCulling () != fVP.IsDensityCulling ()) ||
|
||||
(vp.IsCullingCovered () != fVP.IsCullingCovered ()) ||
|
||||
(vp.IsSection () != fVP.IsSection ()) ||
|
||||
// No need to visit kernel if section plane changes.
|
||||
(vp.IsCutaway () != fVP.IsCutaway ()) ||
|
||||
(vp.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) ||
|
||||
// No need to visit kernel if cutaway planes change.
|
||||
// This assumes use of generic clipping (sectioning, slicing,
|
||||
// DCUT, cutaway). If a decision is made to implement locally,
|
||||
// this will need changing. See G4OpenGLViewer::SetView,
|
||||
// G4OpenGLStoredViewer.cc::CompareForKernelVisit and
|
||||
// G4OpenGLStoredSceneHander::CreateSection/CutawayPolyhedron.
|
||||
(vp.IsExplode () != fVP.IsExplode ()) ||
|
||||
(vp.GetNoOfSides () != fVP.GetNoOfSides ())
|
||||
(vp.GetNoOfSides () != fVP.GetNoOfSides ()) ||
|
||||
(vp.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
|
||||
(vp.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
|
||||
) {
|
||||
return true;;
|
||||
}
|
||||
@@ -171,6 +182,18 @@ G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
|
||||
(vp.GetVisibleDensity () != fVP.GetVisibleDensity ()))
|
||||
return true;
|
||||
|
||||
if (vp.IsSection () &&
|
||||
(vp.GetSectionPlane () != fVP.GetSectionPlane ()))
|
||||
return true;
|
||||
|
||||
if (vp.IsCutaway ()) {
|
||||
if (vp.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) return true;
|
||||
for (size_t i = 0; i < vp.GetCutawayPlanes().size(); ++i)
|
||||
if (vp.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
|
||||
return true;
|
||||
}
|
||||
|
||||
if (vp.IsExplode () &&
|
||||
(vp.GetExplodeFactor () != fVP.GetExplodeFactor ()))
|
||||
return true;
|
||||
@@ -385,13 +408,22 @@ void G4OpenInventorViewer::SelectionCB(
|
||||
{
|
||||
G4OpenInventorViewer* This = (G4OpenInventorViewer*)aThis;
|
||||
SoNode* node = ((SoFullPath*)aPath)->getTail();
|
||||
G4String name((char*)node->getName().getString());
|
||||
G4String cls((char*)node->getTypeId().getName().getString());
|
||||
G4cout << "SoNode : " << node
|
||||
<< " SoType : " << cls
|
||||
<< " name : " << name
|
||||
<< G4endl;
|
||||
/*FIXME : to explore
|
||||
G4AttHolder* attHolder = dynamic_cast<G4AttHolder*>(node);
|
||||
if(attHolder && attHolder->GetAttDefs().size()) {
|
||||
for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
G4cout << G4AttCheck(attHolder->GetAttValues()[i],
|
||||
attHolder->GetAttDefs()[i]);
|
||||
}
|
||||
} else {
|
||||
G4String name((char*)node->getName().getString());
|
||||
G4String cls((char*)node->getTypeId().getName().getString());
|
||||
G4cout << "SoNode : " << node
|
||||
<< " SoType : " << cls
|
||||
<< " name : " << name
|
||||
<< G4endl;
|
||||
G4cout << "No attributes attached." << G4endl;
|
||||
}
|
||||
/*FIXME : to explore (need different button - this is used for picking.
|
||||
if(node->isOfType(Geant4_SoPolyhedron::getClassTypeId())) {
|
||||
Geant4_SoPolyhedron* polyhedron = (Geant4_SoPolyhedron*)node;
|
||||
if(polyhedron->solid.getValue()==FALSE)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenInventorWin.cc,v 1.6 2006/06/29 21:22:20 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
// OpenInventor graphics system factory.
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenInventorWinViewer.cc,v 1.25 2006/06/29 21:22:22 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
/*
|
||||
* jck : 05 Feb 1997 : Initial Implementation
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenInventorXt.cc,v 1.4 2006/06/29 21:22:24 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
//
|
||||
// Jeff Kallenbach 01 Aug 1996
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenInventorXtViewer.cc,v 1.24 2006/06/29 21:22:26 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
/*
|
||||
* jck 05 Feb 1997 - Initial Implementation
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: SoBox.cc,v 1.8 2006/06/29 21:22:36 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
/*----------------------------HEPVis----------------------------------------*/
|
||||
/* */
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: SoCons.cc,v 1.8 2006/06/29 21:22:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
/*-----------------------------HEPVis---------------------------------------*/
|
||||
/* */
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: SoDetectorTreeKit.cc,v 1.13 2006/06/29 21:22:51 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
/*-----------------------------HEPVis----------------------------------------*/
|
||||
/* */
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: SoTrap.cc,v 1.8 2006/06/29 21:23:03 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
/*-----------------------------HEPVis----------------------------------------*/
|
||||
/* */
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: SoTrd.cc,v 1.8 2006/06/29 21:23:05 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
/*-----------------------------HEPVis---------------------------------------*/
|
||||
/* */
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: SoTubs.cc,v 1.8 2006/06/29 21:23:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-08-01 $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
//
|
||||
/*-----------------------------HEPVis---------------------------------------*/
|
||||
/* */
|
||||
|
||||
Reference in New Issue
Block a user