Import Geant4 0.0.0 source tree
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# $Id: GNUmakefile,v 2.3 1998/07/07 17:11:11 allison Exp $
|
||||
|
||||
name := G4OPACS
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
include $(G4INSTALL)/config/G4VIS_BUILD.gmk
|
||||
include $(G4INSTALL)/config/interactivity.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
|
||||
CPPFLAGS += -I$(G4BASE)/graphics_reps/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
|
||||
CPPFLAGS += -I$(G4BASE)/interfaces/common/include
|
||||
|
||||
ifdef G4VIS_BUILD_OPACS_DRIVER
|
||||
CPPFLAGS += -I$(COROOT)/include -I$(XXROOT)/include -I$(WOROOT)/include\
|
||||
-I$(GOROOT)/include -I$(XOROOT)/include
|
||||
ifeq ($(G4_OPACS_WIDGET_SET),Xm)
|
||||
CPPFLAGS += -DHAS_XM $(X11FLAGS) $(XMFLAGS)
|
||||
else
|
||||
CPPFLAGS += -DHAS_XAW $(X11FLAGS) $(XAWFLAGS)
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
@@ -0,0 +1,113 @@
|
||||
OPACS as a G4 driver
|
||||
--------------------
|
||||
The OPACS html address is :
|
||||
|
||||
http://www.lal.in2p3.fr/OPACS
|
||||
|
||||
To have G4 running with OPACS :
|
||||
|
||||
- Install the OPACS v3 by following
|
||||
the web installation page.
|
||||
For G4 take the group :
|
||||
WoXoXm if you have MOTIF
|
||||
WoXoXaw if you have Xaw
|
||||
For example on a UNIX with MOTIF only :
|
||||
UNIX> mkdir OPACS
|
||||
UNIX> cd OPACS
|
||||
UNIX> ftp ftp.lal.in2p3.fr
|
||||
anonymous
|
||||
user name
|
||||
ftp> cd pub/OPACS/v3
|
||||
ftp> bin
|
||||
ftp> get WoXoXm.tar.Z
|
||||
( ftp> get WoXoXaw.tar.Z )
|
||||
ftp> quit
|
||||
UNIX> uncompress WoXoXm.tar.Z
|
||||
( UNIX> uncompress WoXoXaw.tar.Z )
|
||||
UNIX> tar xvf WoXoXm.tar
|
||||
( UNIX> tar xvf WoXoXaw.tar )
|
||||
UNIX> rm WoXoXm.tar
|
||||
( UNIX> rm WoXoXaw.tar )
|
||||
UNIX> cd OPACS/v3
|
||||
UNIX> chmod u+x conf.sh
|
||||
UNIX> ./conf.sh
|
||||
csh> source setup.csh
|
||||
(sh> . ./setup.sh)
|
||||
UNIX> make WoXo
|
||||
( UNIX> gmake WoXo )
|
||||
At end of installation you should
|
||||
be able to build a simple Wo application
|
||||
(for exa named Xxx) by doing :
|
||||
csh> mkdir tmp
|
||||
csh> cd tmp
|
||||
with MOTIF :
|
||||
csh> onew Xxx
|
||||
or with Xaw :
|
||||
csh> onew Xxx $WOROOT/usr/template/Xaw/
|
||||
then :
|
||||
csh> gmake `uname`
|
||||
csh> ./Xxx.exe
|
||||
The interpreted interface is described
|
||||
in Xxx.odb.
|
||||
See OPACS doc for more.
|
||||
|
||||
- Execute OPACS setup script :
|
||||
csh> source <OPACS_HOME>/OPACS/v3/setup.csh
|
||||
|
||||
- Set environment variables :
|
||||
G4UI_BUILD_WO_SESSION
|
||||
G4UI_USE_WO
|
||||
G4VIS_BUILD_OPACS_DRIVER
|
||||
G4VIS_USE_OPACS
|
||||
For example :
|
||||
csh> setenv G4UI_BUILD_WO_SESSION 1
|
||||
csh> setenv G4UI_USE_WO 1
|
||||
csh> setenv G4VIS_BUILD_OPACS_DRIVER 1
|
||||
csh> setenv G4VIS_USE_OPACS 1
|
||||
Set G4_OPACS_WIDGET_SET to Xaw if you want
|
||||
to use Athena widget set instead of Motif :
|
||||
csh> setenv G4_OPACS_WIDGET_SET Xaw
|
||||
|
||||
- Compile G4 interfaces and visualization modules with
|
||||
the upper variables setted.
|
||||
|
||||
- Build visualization/test/test19.
|
||||
|
||||
- example to run test 19 with Xaw G4UI and Xo vis driver :
|
||||
csh> source <OPACS_HOME>/OPACS/v3/setup.csh
|
||||
(or sh> . <OPACS_HOME>/v3/setup.sh)
|
||||
csh> cd .../visualization/test
|
||||
csh> G++-Linux/test19 Xaw
|
||||
In the little window type :
|
||||
continue (and click on ok)
|
||||
continue
|
||||
/vis~/create_view/new_graphics_system Xo
|
||||
/run/beamOn 1
|
||||
continue
|
||||
When you have something in the Xo window
|
||||
you can manipulate it with :
|
||||
Ctrl+button1+move pointer
|
||||
on the window. On button3 you have a popup
|
||||
menu to do things, like changing "Ctrl" action,
|
||||
setting ZBuffer, etc...
|
||||
|
||||
- example to run test19 with Wo G4UI reconstructed
|
||||
with MOTIF :
|
||||
csh> source <OPACS_HOME>/OPACS/v3/setup.csh
|
||||
(or sh> . <OPACS_HOME>/v3/setup.sh)
|
||||
csh> cd .../visualization/test
|
||||
csh> HP-UX/test19 Wo
|
||||
or with Xaw :
|
||||
csh> source <OPACS_HOME>/OPACS/v3/setup.csh
|
||||
csh> cd .../visualization/test
|
||||
csh> setenv WOENVIRONMENT test19Xaw.odb
|
||||
csh> G++-Linux/test19 Wo
|
||||
The "Wo" interface to test19 is in test19.odb
|
||||
(or test19Xaw.odb). In this file you can
|
||||
find examples of buttons that triggs G4 commands.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GoScene.hh,v 2.1 1998/11/06 13:42:01 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 04 November 1996
|
||||
// Wo scene - creates Wo Display lists.
|
||||
|
||||
#ifndef G4GOSCENE_HH
|
||||
#define G4GOSCENE_HH
|
||||
|
||||
#if defined(G4VIS_BUILD_OPACS_DRIVER) || defined(G4VIS_USE_OPACS)
|
||||
|
||||
//Go
|
||||
#include <ONode.h>
|
||||
#include <OColormap.h>
|
||||
//G4
|
||||
#include "globals.hh"
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
#include "G4VScene.hh"
|
||||
|
||||
class G4GoScene: public G4VScene {
|
||||
|
||||
public:
|
||||
G4GoScene (G4VGraphicsSystem& system,
|
||||
const G4String& name = "");
|
||||
~G4GoScene ();
|
||||
void AddPrimitive (const G4Polyline&);
|
||||
void AddPrimitive (const G4Text&);
|
||||
void AddPrimitive (const G4Circle&);
|
||||
void AddPrimitive (const G4Square&);
|
||||
void AddPrimitive (const G4Polymarker&);
|
||||
void AddPrimitive (const G4Polyhedron&);
|
||||
void AddPrimitive (const G4NURBS&);
|
||||
|
||||
void AddThis (const G4Box&);
|
||||
void AddThis (const G4Cons&);
|
||||
void AddThis (const G4Tubs&);
|
||||
void AddThis (const G4Trd&);
|
||||
void AddThis (const G4Trap&);
|
||||
void AddThis (const G4Sphere&);
|
||||
void AddThis (const G4Para&);
|
||||
void AddThis (const G4Torus&);
|
||||
void AddThis (const G4VSolid&);
|
||||
|
||||
void BeginPrimitives (const G4Transform3D& objectTransformation);
|
||||
void EndPrimitives ();
|
||||
void PreAddThis (const G4Transform3D& objectTransformation,
|
||||
const G4VisAttributes& visAttribs);
|
||||
void PostAddThis ();
|
||||
static G4int GetSceneCount ();
|
||||
ONode GetRootNode ();
|
||||
|
||||
private:
|
||||
void ClearStore ();
|
||||
void RequestPrimitives (const G4VSolid& solid);
|
||||
G4VGraphicsSystem& fSystem; // Graphics system for this scene.
|
||||
ONode fRootGoNode; // Root ONode for this scene.
|
||||
static G4int fSceneIdCount; // static counter for Wo scenes.
|
||||
static G4int fSceneCount; // No. of extanct scenes.
|
||||
static ONode fGoNode; // Current ONode.
|
||||
static OColormap fOColormap;
|
||||
void SetColour (const G4Colour&);
|
||||
char* nodeName;
|
||||
};
|
||||
|
||||
inline G4int G4GoScene::GetSceneCount () {
|
||||
return fSceneCount;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Wo.hh,v 2.1 1998/11/06 13:42:01 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 04 November 1996
|
||||
// Wo graphics system factory.
|
||||
|
||||
#ifndef G4WO_HH
|
||||
#define G4WO_HH
|
||||
|
||||
#if defined(G4VIS_BUILD_OPACS_DRIVER) || defined(G4VIS_USE_OPACS)
|
||||
|
||||
//G4
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
class G4VInteractorManager;
|
||||
|
||||
class G4Wo: public G4VGraphicsSystem {
|
||||
public:
|
||||
G4Wo ();
|
||||
~G4Wo ();
|
||||
G4VScene* CreateScene (const G4String& name = "");
|
||||
G4VView* CreateView (G4VScene&, const G4String& name = "");
|
||||
static G4VInteractorManager* GetInteractorManager ();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4WoView.hh,v 2.1 1998/11/06 13:42:02 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 04 November 1996
|
||||
// Wo view - opens window, hard copy, etc.
|
||||
|
||||
#ifndef G4WOVIEW_HH
|
||||
#define G4WOVIEW_HH
|
||||
|
||||
#if defined(G4VIS_BUILD_OPACS_DRIVER) || defined(G4VIS_USE_OPACS)
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <OCamera.h>
|
||||
|
||||
#include "G4VView.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4GoScene;
|
||||
|
||||
// Base class for various WoView classes.
|
||||
class G4WoView: public G4VView {
|
||||
public:
|
||||
G4WoView (G4GoScene& scene, const G4String& name = "");
|
||||
~G4WoView ();
|
||||
void DrawView ();
|
||||
void ShowView ();
|
||||
OCamera GetCamera ();
|
||||
private:
|
||||
void ClearView ();
|
||||
void FinishView ();
|
||||
void SetView ();
|
||||
private:
|
||||
G4GoScene& fScene; // Graphics Scene for this view.
|
||||
OCamera fGoCamera;
|
||||
Widget fXoCamera;
|
||||
Widget fShell;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Xo.hh,v 2.1 1998/11/06 13:42:04 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 04 November 1996
|
||||
// Wo graphics system factory.
|
||||
|
||||
#ifndef G4XO_HH
|
||||
#define G4XO_HH
|
||||
|
||||
#if defined(G4VIS_BUILD_OPACS_DRIVER) || defined(G4VIS_USE_OPACS)
|
||||
|
||||
//G4
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
class G4VInteractorManager;
|
||||
|
||||
class G4Xo: public G4VGraphicsSystem {
|
||||
public:
|
||||
G4Xo ();
|
||||
~G4Xo ();
|
||||
G4VScene* CreateScene (const G4String& name = "");
|
||||
G4VView* CreateView (G4VScene&, const G4String& name = "");
|
||||
static G4VInteractorManager* GetInteractorManager ();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4XoView.hh,v 2.1 1998/11/06 13:42:05 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 04 November 1996
|
||||
// Wo view - opens window, hard copy, etc.
|
||||
|
||||
#ifndef G4XOVIEW_HH
|
||||
#define G4XOVIEW_HH
|
||||
|
||||
#if defined(G4VIS_BUILD_OPACS_DRIVER) || defined(G4VIS_USE_OPACS)
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <OCamera.h>
|
||||
|
||||
#include "G4VView.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Xo;
|
||||
class G4GoScene;
|
||||
|
||||
// Base class for various WoView classes.
|
||||
class G4XoView: public G4VView {
|
||||
public:
|
||||
G4XoView (G4GoScene& scene, const G4String& name = "");
|
||||
~G4XoView ();
|
||||
void DrawView ();
|
||||
void ShowView ();
|
||||
OCamera GetCamera ();
|
||||
private:
|
||||
void ClearView ();
|
||||
void FinishView ();
|
||||
void SetView ();
|
||||
private:
|
||||
G4GoScene& fScene; // Graphics Scene for this view.
|
||||
OCamera fGoCamera;
|
||||
Widget fXoCamera;
|
||||
Widget fShell;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,471 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4GoScene.cc,v 2.3 1998/11/06 13:42:07 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 04 November 1996
|
||||
// Wo stored scene - creates Wo display lists.
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
#ifdef G4VIS_BUILD_OPACS_DRIVER
|
||||
|
||||
//Co
|
||||
#include <CPrinter.h>
|
||||
#include <CString.h>
|
||||
//Go
|
||||
#include <Go.h>
|
||||
//G4
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4Normal3D.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Polymarker.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Square.hh"
|
||||
#include "G4Text.hh"
|
||||
#include "G4NURBS.hh"
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
//This
|
||||
#include "G4GoScene.hh"
|
||||
|
||||
static G4Transform3D transformation;
|
||||
|
||||
G4int G4GoScene::fSceneIdCount = 0;
|
||||
G4int G4GoScene::fSceneCount = 0;
|
||||
ONode G4GoScene::fGoNode = NULL;
|
||||
OColormap G4GoScene::fOColormap = NULL;
|
||||
/***************************************************************************/
|
||||
G4GoScene::G4GoScene (
|
||||
G4VGraphicsSystem& system,
|
||||
const G4String& name
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Creator.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
:
|
||||
G4VScene (system, fSceneIdCount++, name),
|
||||
fSystem (system),
|
||||
fRootGoNode (NULL),
|
||||
nodeName (NULL)
|
||||
/*.........................................................................*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::G4GoScene" << endl;
|
||||
#endif
|
||||
fSceneCount++;
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4GoScene::~G4GoScene (
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Destructor.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(ONodeIsValid(fRootGoNode)==1) ONodeDelete (fRootGoNode); //fRootGoNode could be deleted by an XoCamera popup "Erase".
|
||||
fRootGoNode = NULL;
|
||||
fSceneCount--;
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddPrimitive (
|
||||
const G4Polyline& line
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Method for handling G4Polyline objects.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::AddPrimitive(G4Polyline&) " << line.entries () << endl;
|
||||
#endif
|
||||
SetColour (GetColour(line));
|
||||
int nPoints = line.entries ();
|
||||
OPointList points;
|
||||
points = OPointListCreate(nPoints);
|
||||
for (int iPoint = 0; iPoint < nPoints; iPoint++) {
|
||||
OPointListSetIthEntry (points,iPoint,
|
||||
line(iPoint).x(),
|
||||
line(iPoint).y(),
|
||||
line(iPoint).z());
|
||||
}
|
||||
GoAddLinesToNode (fGoNode,points);
|
||||
OPointListDelete (points);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddPrimitive (
|
||||
const G4Polymarker& line
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Method for handling G4Polymarker objects.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::AddPrimitive(G4Polymarker&) " << line.entries () << endl;
|
||||
#endif
|
||||
SetColour (GetColour(line));
|
||||
int nPoints = line.entries ();
|
||||
OPointList points;
|
||||
points = OPointListCreate(nPoints);
|
||||
for (int iPoint = 0; iPoint < nPoints; iPoint++) {
|
||||
OPointListSetIthEntry (points,iPoint,
|
||||
line(iPoint).x(),
|
||||
line(iPoint).y(),
|
||||
line(iPoint).z());
|
||||
}
|
||||
GoAddMarkersToNode (fGoNode,points);
|
||||
OPointListDelete (points);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddPrimitive (
|
||||
const G4Circle& circle
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Method for handling G4Circle objects.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
SetColour (GetColour(circle));
|
||||
G4Point3D center = circle.GetPosition();
|
||||
G4double radius = circle.GetWorldSize();
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::AddPrimitive(G4Circle&) : center : "
|
||||
<< " x : " << center.x()
|
||||
<< " y : " << center.y()
|
||||
<< " z : " << center.z()
|
||||
<< " ,radius : " << radius << endl;
|
||||
#endif
|
||||
// Direction of circle ?
|
||||
//GoAddCircleToNode (fGoNode,radius,center.x(),center.y(),center.z(),0.,0.,1.);
|
||||
GoAddMarkerToNode (fGoNode,center.x(),center.y(),center.z());
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddPrimitive (
|
||||
const G4Polyhedron& polyhedron
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Method for handling G4Polyhedron objects for drawing solids.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::AddPrimitive(G4Polyhedron&) " << endl;
|
||||
#endif
|
||||
SetColour (GetColour(polyhedron));
|
||||
|
||||
OModeling modeling = OModelingWireFrame;
|
||||
switch (GetDrawingStyle (polyhedron)) {
|
||||
case (G4ViewParameters::hlhsr):
|
||||
case (G4ViewParameters::hsr):
|
||||
modeling = OModelingSolid;
|
||||
break;
|
||||
case (G4ViewParameters::hlr):
|
||||
case (G4ViewParameters::wireframe):
|
||||
default:
|
||||
modeling = OModelingWireFrame;
|
||||
break;
|
||||
}
|
||||
|
||||
G4bool notLastFace;
|
||||
G4Normal3D SurfaceNormal;
|
||||
double xs[5];
|
||||
double ys[5];
|
||||
double zs[5];
|
||||
|
||||
do
|
||||
{
|
||||
G4bool notLastEdge;
|
||||
G4Point3D vertex;
|
||||
G4int edgeFlag = 1;
|
||||
int iPoint;
|
||||
iPoint = 0;
|
||||
notLastFace = polyhedron.GetNextNormal (SurfaceNormal);
|
||||
do
|
||||
{
|
||||
notLastEdge = polyhedron.GetNextVertex (vertex, edgeFlag);
|
||||
xs[iPoint] = vertex.x();
|
||||
ys[iPoint] = vertex.y();
|
||||
zs[iPoint] = vertex.z();
|
||||
iPoint++;
|
||||
} while (notLastEdge);
|
||||
if( (iPoint!=3) && (iPoint!=4) )
|
||||
{
|
||||
CWarnF ("G4GoScene::AddPrimitive G4Polyhedron : not a quad or a triangle : %d\n",iPoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (modeling==OModelingWireFrame)
|
||||
{
|
||||
xs[iPoint] = xs[0];
|
||||
ys[iPoint] = ys[0];
|
||||
zs[iPoint] = zs[0];
|
||||
iPoint++;
|
||||
ONodeAddLines (fGoNode,OContextGetStaticInstance(),iPoint,xs,ys,zs);
|
||||
}
|
||||
else if (modeling==OModelingSolid)
|
||||
{
|
||||
ONodeAddPolygon (fGoNode,OContextGetStaticInstance(),iPoint,xs,ys,zs);
|
||||
}
|
||||
}
|
||||
} while (notLastFace);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddPrimitive (
|
||||
const G4Text& text
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Method for handling G4Text objects.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
SetColour (GetTextColour(text));
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::AddPrimitive(G4Text&) " << endl;
|
||||
#endif
|
||||
CWarnF ("G4GoScene::AddPrimitive G4Text : not yet implemented.\n");
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddPrimitive (
|
||||
const G4Square& Square
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Method for handling G4Square objects.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
SetColour (GetColour(Square));
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::AddPrimitive(G4Square&) " << endl;
|
||||
#endif
|
||||
CWarnF ("G4GoScene::AddPrimitive G4Square : not yet implemented.\n");
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddPrimitive (
|
||||
const G4NURBS& nurb
|
||||
)
|
||||
/***************************************************************************/
|
||||
//Method for handling G4NURBS objects for drawing solids.
|
||||
//Knots and Ctrl Pnts MUST be arrays of GLfloats.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
SetColour (GetColour(nurb));
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::AddPrimitive(G4NURBS&) " << endl;
|
||||
#endif
|
||||
CWarnF ("G4GoScene::AddPrimitive G4NURBS : not yet implemented.\n");
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddThis (
|
||||
const G4Box& box
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4VScene::AddThis (box);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddThis (
|
||||
const G4Cons& cons
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4VScene::AddThis (cons);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddThis (
|
||||
const G4Tubs& tubs
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4VScene::AddThis (tubs);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddThis (
|
||||
const G4Trd& trd
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4VScene::AddThis (trd);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddThis (
|
||||
const G4Trap& trap
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4VScene::AddThis (trap);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddThis (
|
||||
const G4Sphere& sphere
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4VScene::AddThis (sphere);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddThis (
|
||||
const G4Para& para
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4VScene::AddThis (para);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddThis (
|
||||
const G4Torus& torus
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4VScene::AddThis (torus);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::AddThis (
|
||||
const G4VSolid& solid
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4VScene::AddThis (solid);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::PreAddThis (
|
||||
const G4Transform3D& objectTransformation,
|
||||
const G4VisAttributes& visAttribs
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4VScene::PreAddThis (objectTransformation, visAttribs);
|
||||
|
||||
CStringDelete (nodeName);
|
||||
nodeName = NULL;
|
||||
|
||||
const G4VPhysicalVolume* currentPhysicalVolume = fpCurrentPV;
|
||||
|
||||
if(currentPhysicalVolume==NULL) return;
|
||||
|
||||
nodeName = CStringCreateF (15+64,"PhysicalVolume/%lu",currentPhysicalVolume );
|
||||
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::PreAddThis : " << nodeName << endl;
|
||||
#endif
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::PostAddThis (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::PostAddThis" << endl;
|
||||
#endif
|
||||
CStringDelete (nodeName);
|
||||
nodeName = NULL;
|
||||
G4VScene::PostAddThis();
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::BeginPrimitives (
|
||||
const G4Transform3D& objectTransformation
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::BeginPrimitives" << endl;
|
||||
#endif
|
||||
G4VScene::BeginPrimitives (objectTransformation);
|
||||
transformation = objectTransformation;
|
||||
fGoNode = nodeName!=NULL ? ONodeCreate (nodeName) : ONodeMake ();
|
||||
if(ONodeIsValid(fRootGoNode)==0) fRootGoNode = ONodeMake ();
|
||||
ONodeAddChild (fRootGoNode,fGoNode);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::EndPrimitives (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::EndPrimitives" << endl;
|
||||
#endif
|
||||
G4double g4angle;
|
||||
G4ThreeVector g4axis;
|
||||
G4ThreeVector g4trans;
|
||||
transformation.getRotation().getAngleAxis(g4angle,g4axis);
|
||||
g4trans = transformation.getTranslation();
|
||||
OMatrix orot = OMatrixCreate (OMatrixRotationAxis,g4angle,g4axis.x(),g4axis.y(),g4axis.z());
|
||||
OMatrix otra = OMatrixCreate (OMatrixTranslation,g4trans.x(),g4trans.y(),g4trans.z());
|
||||
OMatrix omatrix = OMatrixMultiply (otra,orot);
|
||||
ONodeSetMatrix (fGoNode,omatrix);
|
||||
OMatrixDelete (omatrix);
|
||||
OMatrixDelete (orot);
|
||||
OMatrixDelete (otra);
|
||||
fGoNode = NULL;
|
||||
G4VScene::EndPrimitives ();
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::ClearStore (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::ClearStore" << endl;
|
||||
#endif
|
||||
if(ONodeIsValid(fRootGoNode)==0) fRootGoNode = NULL;
|
||||
ONodeDestroyChildren (fRootGoNode);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::RequestPrimitives (
|
||||
const G4VSolid& solid
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Stop-gap solution for display List re-use.
|
||||
// A proper implementation would use geometry hierarchy.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::RequestPrimitives" << endl;
|
||||
#endif
|
||||
G4VScene::RequestPrimitives (solid);
|
||||
}
|
||||
/***************************************************************************/
|
||||
ONode G4GoScene::GetRootNode (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::RequestPrimitives" << endl;
|
||||
#endif
|
||||
if(ONodeIsValid(fRootGoNode)==0) fRootGoNode = NULL;
|
||||
return fRootGoNode;
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4GoScene::SetColour (
|
||||
const G4Colour& a_colour
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(fOColormap==NULL) fOColormap = OColormapGetIdentifier("ocolormap_X");
|
||||
int index = OColormapGetRGB_Index(fOColormap,a_colour.GetRed (), a_colour.GetGreen (), a_colour.GetBlue ());
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4GoScene::SetColour : red : " << a_colour.GetRed () <<
|
||||
" green : " << a_colour.GetGreen () <<
|
||||
" blue : " << a_colour.GetBlue () <<
|
||||
" index : " << index << endl;
|
||||
#endif
|
||||
OContextSetColorIndex (OContextGetStaticInstance(),index);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Wo.cc,v 2.1 1998/11/06 13:42:08 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 04 November 1996
|
||||
// Wo graphics system factory.
|
||||
|
||||
#ifdef G4VIS_BUILD_OPACS_DRIVER
|
||||
|
||||
//Co
|
||||
#include <CPrinter.h>
|
||||
#include <Wo.h>
|
||||
//G4
|
||||
#include "G4Xt.hh"
|
||||
#include "G4WoView.hh"
|
||||
#include "G4GoScene.hh"
|
||||
//This
|
||||
#include "G4Wo.hh"
|
||||
|
||||
static G4VInteractorManager* interactorManager = NULL;
|
||||
/***************************************************************************/
|
||||
G4Wo::G4Wo (
|
||||
)
|
||||
:G4VGraphicsSystem ("Wo",G4VGraphicsSystem::threeD)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
/*.........................................................................*/
|
||||
{
|
||||
interactorManager = G4Xt::getInstance ();
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4Wo::~G4Wo (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4VInteractorManager* G4Wo::GetInteractorManager (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
return interactorManager;
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4VScene* G4Wo::CreateScene (
|
||||
const G4String& name
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4GoScene* pScene = new G4GoScene (*this, name);
|
||||
return pScene;
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4VView* G4Wo::CreateView (
|
||||
G4VScene& scene,
|
||||
const G4String& name
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4GoScene* pScene = (G4GoScene*)&scene;
|
||||
G4VView* pView = new G4WoView (*pScene, name);
|
||||
return pView;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4WoView.cc,v 2.8 1998/11/09 15:51:38 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 04 November 1996
|
||||
|
||||
#ifdef G4VIS_BUILD_OPACS_DRIVER
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
/*Co*/
|
||||
#include <CPrinter.h>
|
||||
#include <CString.h>
|
||||
/*Xx*/
|
||||
#include <XWidget.h>
|
||||
/*Go*/
|
||||
#include <OCamera.h>
|
||||
/*Wo*/
|
||||
#include <OWidget.h>
|
||||
#include <Wo.h>
|
||||
//G4
|
||||
#include "G4VInteractorManager.hh"
|
||||
#include "G4Wo.hh"
|
||||
#include "G4GoScene.hh"
|
||||
//This
|
||||
#include "G4WoView.hh"
|
||||
|
||||
/***************************************************************************/
|
||||
G4WoView::G4WoView (
|
||||
G4GoScene& scene,
|
||||
const G4String& name
|
||||
)
|
||||
:G4VView (scene, scene.IncrementViewCount(), name)
|
||||
,fScene (scene)
|
||||
,fGoCamera (NULL)
|
||||
,fXoCamera (NULL)
|
||||
,fShell (NULL)
|
||||
/***************************************************************************/
|
||||
// Constructor.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4WoView::G4WoView" << endl;
|
||||
#endif
|
||||
|
||||
if(WoIsInitialized()==0) {
|
||||
CWarn ("G4WoView : Wo is not initialized !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
char* defName = CStringDuplicate((char*)fName.data());
|
||||
CStringReplacePart (&defName,"-","_");
|
||||
|
||||
fGoCamera = OCameraGetIdentifier (defName);
|
||||
if(fGoCamera!=NULL) {
|
||||
return; //OCamera could have been created
|
||||
//by loading an odb file at Wo startup.
|
||||
}
|
||||
|
||||
G4VInteractorManager* interactorManager = G4Wo::GetInteractorManager();
|
||||
Widget parent = (Widget)interactorManager->GetParentInteractor ();
|
||||
char* wname = NULL;
|
||||
if(parent==NULL) { //Create a shell widget.
|
||||
wname = CStringCreateF (6+strlen(defName),"shell_%s",defName);
|
||||
#ifdef HAS_XM
|
||||
fShell = OWidgetCreate (wname,XWidgetGetTop(),"XmFormDialog",False);
|
||||
#else
|
||||
fShell = OWidgetCreate (wname,XWidgetGetTop(),"TopLevelShell",False);
|
||||
#endif
|
||||
CStringDelete (wname);
|
||||
parent = fShell;
|
||||
wname = CStringDuplicate (defName);
|
||||
} else {
|
||||
char* str = interactorManager->GetCreationString ();
|
||||
if(str==NULL) {
|
||||
wname = CStringDuplicate (defName);
|
||||
} else {
|
||||
wname = CStringDuplicate (str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fXoCamera = OWidgetCreate (wname,parent,"XoCamera",False);
|
||||
|
||||
if(fShell!=NULL) {
|
||||
#ifdef HAS_XM
|
||||
OWidgetSetResourceFromString (fShell,"dialogTitle",wname,False);
|
||||
OWidgetSetResourceFromString (fXoCamera,"topAttachment","attach_form",False);
|
||||
OWidgetSetResourceFromString (fXoCamera,"leftAttachment","attach_form",False);
|
||||
OWidgetSetResourceFromString (fXoCamera,"rightAttachment","attach_form",False);
|
||||
OWidgetSetResourceFromString (fXoCamera,"bottomAttachment","attach_form",False);
|
||||
#else
|
||||
OWidgetSetResourceFromString (fShell,"title",wname,False);
|
||||
#endif
|
||||
XWidgetMap (fShell);
|
||||
}
|
||||
|
||||
fGoCamera = OCameraGetIdentifier (wname);
|
||||
|
||||
if(fGoCamera==NULL) {
|
||||
CWarnF ("Can't find/create OCamera %s\n",wname);
|
||||
}
|
||||
|
||||
CStringDelete (wname);
|
||||
CStringDelete (defName);
|
||||
|
||||
interactorManager->SetCreatedInteractor (fXoCamera);
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4WoView::~G4WoView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Destructor.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(fShell!=NULL) {
|
||||
OWidgetDelete (fShell,False);
|
||||
} else if(fXoCamera!=NULL) {
|
||||
OWidgetDelete (fXoCamera,False);
|
||||
}
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4WoView::ClearView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
{
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4WoView::SetView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Calculates view representation based on extent of object being
|
||||
// viewed and (initial) direction of camera. (Note: it can change
|
||||
// later due to user interaction via visualization system's GUI.)
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
const G4Point3D target = fVP.GetCurrentTargetPoint ();
|
||||
G4double radius = fScene.GetSceneData().GetExtent().GetExtentRadius();
|
||||
if(radius<=0.) radius = 1. * m;
|
||||
const G4double cameraDistance = fVP.GetCameraDistance (radius);
|
||||
const G4Point3D& pCamera =
|
||||
target + cameraDistance * fVP.GetViewpointDirection().unit();
|
||||
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4WoView::SetView : target.x " << target.x() << " target.y " << target.y() << " target.z " << target.z() << endl;
|
||||
G4cout << "G4WoView::SetView : dir.x " << fVP.GetViewpointDirection().unit().x() <<
|
||||
" dir.y " << fVP.GetViewpointDirection().unit().y() <<
|
||||
" dir.z " << fVP.GetViewpointDirection().unit().z() << endl;
|
||||
G4cout << "G4WoView::SetView : cameraDistance " << cameraDistance << endl;
|
||||
G4cout << "G4WoView::SetView : pCamera.x " << pCamera.x() << " pCamera.y " << pCamera.y() << " pCamera.z " << pCamera.z() << endl;
|
||||
G4cout << "G4WoView::SetView : pCamera.x " << pCamera.x() << " pCamera.y " << pCamera.y() << " pCamera.z " << pCamera.z() << endl;
|
||||
#endif
|
||||
|
||||
OCameraSetCenter (fGoCamera,target.x() ,target.y() ,target.z());
|
||||
OCameraSetDefaultVRP (fGoCamera,pCamera.x(),pCamera.y(),pCamera.z());
|
||||
|
||||
OCameraSetDefaultUpVector (fGoCamera,0.,1.,0.);
|
||||
|
||||
OCameraSetField (fGoCamera,-radius,radius);
|
||||
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4WoView::DrawView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
{
|
||||
NeedKernelVisit ();
|
||||
ProcessView ();
|
||||
ShowView ();
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4WoView::ShowView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
{
|
||||
OCameraViewNode (fGoCamera,fScene.GetRootNode());
|
||||
}
|
||||
/***************************************************************************/
|
||||
OCamera G4WoView::GetCamera (
|
||||
)
|
||||
/***************************************************************************/
|
||||
{
|
||||
return fGoCamera;
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4WoView::FinishView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,88 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Xo.cc,v 2.2 1998/11/06 13:42:10 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 04 November 1996
|
||||
// Wo graphics system factory.
|
||||
|
||||
#ifdef G4VIS_BUILD_OPACS_DRIVER
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
//Co
|
||||
#include <CPrinter.h>
|
||||
//Xx
|
||||
#include <XWidget.h>
|
||||
//G4
|
||||
#include "G4Xt.hh"
|
||||
#include "G4XoView.hh"
|
||||
#include "G4GoScene.hh"
|
||||
//This
|
||||
#include "G4Xo.hh"
|
||||
|
||||
static G4VInteractorManager* interactorManager = NULL;
|
||||
/***************************************************************************/
|
||||
G4Xo::G4Xo (
|
||||
)
|
||||
:G4VGraphicsSystem ("Xo",G4VGraphicsSystem::threeD)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
/*.........................................................................*/
|
||||
{
|
||||
interactorManager = G4Xt::getInstance ();
|
||||
Widget top = (Widget)interactorManager->GetMainInteractor ();
|
||||
if(top==NULL) {
|
||||
CWarn ("G4Xo : Unable to init Xt.\n");
|
||||
return;
|
||||
}
|
||||
XWidgetSetTop (top);
|
||||
XDisplayPutFileInResourceDatabase (XtDisplay(top),"G4Xo.xrm");
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4Xo::~G4Xo (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4VInteractorManager* G4Xo::GetInteractorManager (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
return interactorManager;
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4VScene* G4Xo::CreateScene (
|
||||
const G4String& name
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4GoScene* pScene = new G4GoScene (*this, name);
|
||||
return pScene;
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4VView* G4Xo::CreateView (
|
||||
G4VScene& scene,
|
||||
const G4String& name
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4GoScene* pScene = (G4GoScene*)&scene;
|
||||
G4VView* pView = new G4XoView (*pScene, name);
|
||||
return pView;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,263 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4XoView.cc,v 2.7 1998/11/06 13:42:11 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 04 November 1996
|
||||
|
||||
#ifdef G4VIS_BUILD_OPACS_DRIVER
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
//X11
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/Shell.h>
|
||||
/*Co*/
|
||||
#include <CPrinter.h>
|
||||
#include <CString.h>
|
||||
#include <CList.h>
|
||||
/*Xx*/
|
||||
#include <XWidget.h>
|
||||
/*Go*/
|
||||
#include <OCamera.h>
|
||||
/*Xo*/
|
||||
#include <XoCamera.h>
|
||||
//G4
|
||||
#include "G4GoScene.hh"
|
||||
#include "G4Xo.hh"
|
||||
#include "G4VInteractorManager.hh"
|
||||
//This
|
||||
#include "G4XoView.hh"
|
||||
|
||||
static Bool WaitForNotify (Display*,XEvent*,char*);
|
||||
static void ActivateCallback (Widget,XtPointer,XtPointer);
|
||||
static void CollectCallback (Widget,XtPointer,XtPointer);
|
||||
/***************************************************************************/
|
||||
G4XoView::G4XoView (
|
||||
G4GoScene& scene,
|
||||
const G4String& name
|
||||
)
|
||||
:G4VView (scene, scene.IncrementViewCount(), name)
|
||||
,fScene (scene)
|
||||
,fGoCamera (NULL)
|
||||
,fXoCamera (NULL)
|
||||
,fShell (NULL)
|
||||
/***************************************************************************/
|
||||
// Constructor.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4XoView::G4XoView" << endl;
|
||||
#endif
|
||||
|
||||
G4VInteractorManager* interactorManager = G4Xo::GetInteractorManager();
|
||||
Widget top = (Widget)interactorManager->GetMainInteractor ();
|
||||
if(top==NULL) {
|
||||
CWarn ("Xt is not initialized !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
char* defName = CStringDuplicate((char*)fName.data());
|
||||
CStringReplacePart (&defName,"-","_");
|
||||
|
||||
Arg args[1];
|
||||
char* wname = NULL;
|
||||
Widget parent = (Widget)interactorManager->GetParentInteractor ();
|
||||
if(parent==NULL) {
|
||||
// Create a shell widget.
|
||||
// Add WMClose does not works on ApplicationShell, then use a TopLevelShell.
|
||||
char* cname;
|
||||
wname = CStringCreateF (6+strlen(defName),"shell_%s",defName);
|
||||
cname = CStringCreateF (6+strlen(defName),"Shell_%s",defName);
|
||||
fShell = XtAppCreateShell (wname,cname,topLevelShellWidgetClass,XtDisplay(top),args,0);
|
||||
CStringDelete (wname);
|
||||
CStringDelete (cname);
|
||||
interactorManager->AddShell (fShell);
|
||||
parent = fShell;
|
||||
wname = CStringDuplicate(defName);
|
||||
} else {
|
||||
char* str = interactorManager->GetCreationString ();
|
||||
if(str==NULL) {
|
||||
wname = CStringDuplicate (defName);
|
||||
} else {
|
||||
wname = CStringDuplicate (str);
|
||||
}
|
||||
}
|
||||
|
||||
fXoCamera = XtCreateManagedWidget (wname,xoCameraWidgetClass ,parent, args, 0);
|
||||
fGoCamera = (OCamera) XoCameraGetCamera (fXoCamera);
|
||||
|
||||
XoCameraAddPopupEntry (fXoCamera,"Escape",ActivateCallback,NULL);
|
||||
XtAddCallback (fXoCamera,XoNcollectCallback,CollectCallback,NULL);
|
||||
|
||||
if(fShell!=NULL) {
|
||||
XtRealizeWidget (fShell);
|
||||
XtMapWidget (fShell);
|
||||
XEvent event;
|
||||
XIfEvent (XtDisplay(fShell), &event, WaitForNotify, (char*)XtWindow(fShell));
|
||||
}
|
||||
|
||||
if(fGoCamera==NULL) {
|
||||
CWarnF ("Can't create OCamera %s\n",wname);
|
||||
fXoCamera = NULL;
|
||||
fGoCamera = NULL;
|
||||
}
|
||||
|
||||
// g++ wants the cast !!!
|
||||
interactorManager->AddSecondaryLoopPreAction ((G4SecondaryLoopAction)XoCameraEnablePopup);
|
||||
interactorManager->AddSecondaryLoopPostAction ((G4SecondaryLoopAction)XoCameraDisablePopup);
|
||||
interactorManager->SetCreatedInteractor (fXoCamera);
|
||||
|
||||
CStringDelete (wname);
|
||||
CStringDelete (defName);
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4XoView::~G4XoView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Destructor.
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(fShell!=NULL) {
|
||||
G4Xo::GetInteractorManager()->RemoveShell (fShell);
|
||||
XtDestroyWidget (fShell);
|
||||
} else if(fXoCamera!=NULL) {
|
||||
XtDestroyWidget (fXoCamera);
|
||||
}
|
||||
fXoCamera = NULL;
|
||||
fGoCamera = NULL;
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4XoView::ClearView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
{
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4XoView::SetView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
// Calculates view representation based on extent of object being
|
||||
// viewed and (initial) direction of camera. (Note: it can change
|
||||
// later due to user interaction via visualization system's GUI.)
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
const G4Point3D target = fVP.GetCurrentTargetPoint ();
|
||||
G4double radius = fScene.GetSceneData().GetExtent().GetExtentRadius();
|
||||
if(radius<=0.) radius = 1. * m;
|
||||
const G4double cameraDistance = fVP.GetCameraDistance (radius);
|
||||
const G4Point3D& pCamera =
|
||||
target + cameraDistance * fVP.GetViewpointDirection().unit();
|
||||
|
||||
#ifdef DEBUG
|
||||
G4cout << "G4XoView::SetView : target.x " << target.x() << " target.y " << target.y() << " target.z " << target.z() << endl;
|
||||
G4cout << "G4XoView::SetView : dir.x " << fVP.GetViewpointDirection().unit().x() <<
|
||||
" dir.y " << fVP.GetViewpointDirection().unit().y() <<
|
||||
" dir.z " << fVP.GetViewpointDirection().unit().z() << endl;
|
||||
G4cout << "G4XoView::SetView : cameraDistance " << cameraDistance << endl;
|
||||
G4cout << "G4XoView::SetView : pCamera.x " << pCamera.x() << " pCamera.y " << pCamera.y() << " pCamera.z " << pCamera.z() << endl;
|
||||
#endif
|
||||
|
||||
OCameraSetCenter (fGoCamera,target.x() ,target.y() ,target.z());
|
||||
OCameraSetDefaultVRP (fGoCamera,pCamera.x(),pCamera.y(),pCamera.z());
|
||||
|
||||
OCameraSetDefaultUpVector (fGoCamera,0.,1.,0.);
|
||||
|
||||
OCameraSetField (fGoCamera,-radius,radius);
|
||||
|
||||
}
|
||||
/***************************************************************************/
|
||||
OCamera G4XoView::GetCamera (
|
||||
)
|
||||
/***************************************************************************/
|
||||
{
|
||||
return fGoCamera;
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4XoView::DrawView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
{
|
||||
NeedKernelVisit ();
|
||||
ProcessView ();
|
||||
FinishView ();
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4XoView::FinishView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4XoView::ShowView (
|
||||
)
|
||||
/***************************************************************************/
|
||||
{
|
||||
OCameraViewNode (fGoCamera,fScene.GetRootNode());
|
||||
G4Xo::GetInteractorManager() -> SecondaryLoop();
|
||||
}
|
||||
/***************************************************************************/
|
||||
/***************************************************************************/
|
||||
/***************************************************************************/
|
||||
Bool WaitForNotify (
|
||||
Display* d
|
||||
,XEvent* e
|
||||
,char* arg
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
/*.........................................................................*/
|
||||
d = NULL;
|
||||
return (e->type == MapNotify) && (e->xmap.window == (Window)arg);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void ActivateCallback (
|
||||
Widget This
|
||||
,XtPointer a_tag
|
||||
,XtPointer a_data
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4Xo::GetInteractorManager() -> RequireExitSecondaryLoop (XO_EXIT_CODE);
|
||||
This = NULL;
|
||||
a_tag = NULL;
|
||||
a_data = NULL;
|
||||
}
|
||||
/***************************************************************************/
|
||||
void CollectCallback (
|
||||
Widget This
|
||||
,XtPointer a_tag
|
||||
,XtPointer a_data
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
OCamera camera;
|
||||
ONode* nodes;
|
||||
int noden,count;
|
||||
/*.........................................................................*/
|
||||
// collectCallback = osh> getCameraNodes `thisCamera` | collect ONode where highlight eq 1 | get - name | dump -
|
||||
camera = (OCamera)XoCameraGetCamera (This);
|
||||
nodes = OCameraCollect (camera,OCollectHighlighted);
|
||||
noden = CListGetSize ((CList)nodes);
|
||||
for(count=0;count<noden;count++)
|
||||
{
|
||||
char* name = ONodeGetName(nodes[count]);
|
||||
CInfoF("%s\n",name==NULL ? "(nil)" : name);
|
||||
}
|
||||
CListDelete ((CList)nodes);
|
||||
This = NULL;
|
||||
a_tag = NULL;
|
||||
a_data = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user