Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
@@ -0,0 +1,23 @@
// 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: G4GraphicsSystemList.hh,v 2.0 1998/07/02 16:49:36 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 2nd April 1996
#ifndef G4GRAPHICSSYSTEMLIST_HH
#define G4GRAPHICSSYSTEMLIST_HH
#include <rw/tpordvec.h>
#include "G4VGraphicsSystem.hh"
class G4GraphicsSystemList: public RWTPtrOrderedVector<G4VGraphicsSystem> {
};
#endif
@@ -0,0 +1,102 @@
// 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: G4SceneData.hh,v 2.7 1998/11/29 15:34:00 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Scene data John Allison 19th July 1996.
//
// Defines the scene in terms of GEANT4 objects. All other parameters are
// in G4ViewParamaters.
//
// Note that although the C++ name is G4SceneData, it is often simply
// referred to as the scene.
#ifndef G4SCENEDATA_HH
#define G4SCENEDATA_HH
#include "globals.hh"
#include "G4ios.hh"
class G4VPhysicalVolume;
#include "G4VisExtent.hh"
#include "G4Point3D.hh"
#include "G4VModel.hh"
#include <rw/tpordvec.h>
class G4SceneData {
friend ostream& operator << (ostream& os, const G4SceneData& d);
friend G4bool operator != (const G4SceneData& d1,
const G4SceneData& d2);
public:
enum {UNLIMITED = -1};
G4SceneData (const G4String& name = "invalid scene");
~G4SceneData ();
// Makes use of default (compiler generated) copy constructor and
// assignment operator.
// For RWTPtrOrderedVector...
G4bool operator == (const G4SceneData& sd) const;
//////////////////////////////////////////////////////
// Get functions...
const G4String& GetName () const;
G4bool IsEmpty () const;
const RWTPtrOrderedVector <G4VModel>& GetRunDurationModelList () const;
// Contains models which are expected to last for the duration of
// the run, for example geometry volumes.
const RWTPtrOrderedVector <G4VModel>& GetEndOfEventModelList () const;
// Contains models which are described at the end of event when the
// scene is current.
const G4VisExtent& GetExtent () const;
// Overall extent of all objects in the scene.
const G4Point3D& GetStandardTargetPoint () const;
// Usually centre of extent. See G4ViewParameters for definition.
//////////////////////////////////////////////
// Add, Set, Clear functions...
void AddRunDurationModel (G4VModel*);
// Adds models of type which are expected to last for the duration
// of the run, for example geometry volumes.
void AddEndOfEventModel (G4VModel*);
// Adds models of type which are described at the end of event when
// the scene is current.
RWTPtrOrderedVector <G4VModel>& SetRunDurationModelList ();
// Allows you to change the model list - do with care!
RWTPtrOrderedVector <G4VModel>& SetEndOfEventModelList ();
// Allows you to change the model list - do with care!
void Clear ();
// Clears and destroys models in all lists.
private:
G4String fName;
RWTPtrOrderedVector <G4VModel> fRunDurationModelList;
RWTPtrOrderedVector <G4VModel> fEndOfEventModelList;
G4VisExtent fExtent;
G4Point3D fStandardTargetPoint;
};
#include "G4SceneData.icc"
#endif
@@ -0,0 +1,57 @@
// 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: G4SceneData.icc,v 2.5 1998/11/29 15:34:01 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Scene data John Allison 19th July 1996.
inline G4bool G4SceneData::operator == (const G4SceneData& sd) const {
return !(*this != sd);
}
inline const G4String& G4SceneData::GetName () const {
return fName;
}
inline G4bool G4SceneData::IsEmpty () const {
return fRunDurationModelList.entries () == 0 &&
fEndOfEventModelList.entries () == 0;
}
inline const RWTPtrOrderedVector <G4VModel>&
G4SceneData::GetRunDurationModelList () const {
return fRunDurationModelList;
}
inline const RWTPtrOrderedVector <G4VModel>&
G4SceneData::GetEndOfEventModelList () const {
return fEndOfEventModelList;
}
inline const G4VisExtent& G4SceneData::GetExtent () const {
return fExtent;
}
inline const G4Point3D& G4SceneData::GetStandardTargetPoint () const {
return fStandardTargetPoint;
}
inline RWTPtrOrderedVector <G4VModel>& G4SceneData::SetRunDurationModelList ()
{
return fRunDurationModelList;
}
inline RWTPtrOrderedVector <G4VModel>& G4SceneData::SetEndOfEventModelList ()
{
return fRunDurationModelList;
}
inline void G4SceneData::AddEndOfEventModel (G4VModel* pModel) {
fEndOfEventModelList.append (pModel);
}
@@ -0,0 +1,41 @@
// 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: G4SceneDataObjectList.hh,v 2.1 1998/08/09 17:54:15 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 9th August 1998
#ifndef G4SCENEDATAOBJECTLIST_HH
#define G4SCENEDATAOBJECTLIST_HH
#include "G4SceneData.hh"
#include "globals.hh"
#include <rw/tvhdict.h>
class G4SceneDataObjectList:
public RWTValHashDictionary <G4String, G4SceneData>
// Each scene data object is keyed to a name.
{
public:
G4SceneDataObjectList
(
unsigned (*)(const G4String&), // Hashing function
size_t size = RWDEFAULT_CAPACITY // No. of buckets
);
friend class G4SceneDataObjectListIterator;
};
class G4SceneDataObjectListIterator:
public RWTValHashDictionaryIterator <G4String, G4SceneData>
{
public:
G4SceneDataObjectListIterator (G4SceneDataObjectList&);
};
#endif
@@ -0,0 +1,23 @@
// 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: G4SceneList.hh,v 2.0 1998/07/02 16:48:25 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison May 1996
#ifndef G4SCENELIST_HH
#define G4SCENELIST_HH
#include <rw/tpordvec.h>
#include "G4VScene.hh"
class G4SceneList: public RWTPtrOrderedVector<G4VScene> {
};
#endif
@@ -0,0 +1,73 @@
// 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: G4VGraphicsSystem.hh,v 2.1 1998/11/06 13:43:02 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 27th March 1996
// Abstract interface class for graphics systems.
#ifndef G4VGRAPHICSSYSTEM_HH
#define G4VGRAPHICSSYSTEM_HH
#include "globals.hh"
class G4VScene;
class G4VView;
class G4VGraphicsSystem {
public:
enum Functionality {
noFunctionality,
twoD, // Simple 2D, e.g., X (no stored structures).
twoDStore, // 2D with stored structures.
threeD, // Passive 3D (with stored structures).
threeDInteractive, // 3D with "pick" functionality.
virtualReality // Virtual Reality functionality.
};
G4VGraphicsSystem (const G4String& name,
Functionality f);
G4VGraphicsSystem (const G4String& name,
const G4String& nickname,
Functionality f);
G4VGraphicsSystem (const G4String& name,
const G4String& nickname,
const G4String& description,
Functionality f);
virtual ~G4VGraphicsSystem ();
// For RWTPtrOrderedVector...
G4bool operator == (const G4VGraphicsSystem& system) const;
virtual G4VScene* CreateScene (const G4String& name) = 0;
virtual G4VView* CreateView (G4VScene&, const G4String& name) = 0;
// Access functions.
const G4String& GetName () const;
const G4String& GetNickname () const;
const G4String& GetDescription () const;
Functionality GetFunctionality () const;
protected:
const G4String fName;
const G4String fNickname;
const G4String fDescription;
Functionality fFunctionality;
};
ostream& operator << (ostream& os, const G4VGraphicsSystem& gs);
#include "G4VGraphicsSystem.icc"
#endif
@@ -0,0 +1,37 @@
// 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: G4VGraphicsSystem.icc,v 2.0 1998/07/02 16:48:28 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 27th March 1996
// Abstract interface class for graphics systems.
inline G4VGraphicsSystem::~G4VGraphicsSystem () {}
inline G4bool
G4VGraphicsSystem::operator == (const G4VGraphicsSystem& system) const {
return this == &system;
}
inline const G4String& G4VGraphicsSystem::GetName () const {
return fName;
}
inline const G4String& G4VGraphicsSystem::GetNickname () const {
return fNickname;
}
inline const G4String& G4VGraphicsSystem::GetDescription () const {
return fDescription;
}
inline G4VGraphicsSystem::Functionality
G4VGraphicsSystem::GetFunctionality () const {
return fFunctionality;
}
@@ -0,0 +1,271 @@
// 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: G4VScene.hh,v 2.4 1998/12/09 23:56:21 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 19th July 1996.
// Abstract interface class for graphics scenes.
// Inherits from G4VGraphicsScene, in the graphics_reps component, which is
// a minimal abstract interface for the GEANT4 kernel.
// A scene is a set of objects which are sufficient to describe what
// is to be viewed.
#ifndef G4VSCENE_HH
#define G4VSCENE_HH
#include "globals.hh"
#include "G4VGraphicsScene.hh"
#include "G4SceneData.hh"
#include "G4VViewList.hh"
#include "G4ViewParameters.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Tubs.hh"
#include "G4Trd.hh"
#include "G4Trap.hh"
#include "G4Sphere.hh"
#include "G4Para.hh"
#include "G4Torus.hh"
#include "G4Transform3D.hh"
#include "G4VModel.hh"
class G4VGraphicsSystem;
class G4VView;
class G4VSolid;
class G4Polyline;
class G4Text;
class G4Circle;
class G4Square;
class G4Polymarker;
class G4Polyhedron;
class G4NURBS;
class G4VisAttributes;
class G4Colour;
class G4Visible;
class G4VSolid;
class G4ModelingParameters;
class G4LogicalVolume;
class G4VScene: public G4VGraphicsScene {
friend ostream& operator << (ostream& os, const G4VScene& s);
public:
enum MarkerSizeType {world, screen};
G4VScene (G4VGraphicsSystem& system, G4int id, const G4String& name = "");
virtual ~G4VScene ();
// For RWTPtrOrderedVector...
G4bool operator == (const G4VScene& scene) const;
//////////////////////////////////////////////////////////////
// Functions for adding raw GEANT4 objects, if the graphics system
// can can understand them (optional on the part of the graphics
// system). If your graphics system is sophisticated enough to
// handle a particular solid shape as a primitive, in your derived
// class write a function to override one or more of the following.
// See the implementation of G4VScene::AddThis (const G4Box& box) for
// more suggestions. If not, please implement the base class
// invocation.
virtual void AddThis (const G4Box&);
virtual void AddThis (const G4Cons&);
virtual void AddThis (const G4Tubs&);
virtual void AddThis (const G4Trd&);
virtual void AddThis (const G4Trap&);
virtual void AddThis (const G4Sphere&);
virtual void AddThis (const G4Para&);
virtual void AddThis (const G4Torus&);
virtual void AddThis (const G4VSolid&); // For solids not above.
///////////////////////////////////////////////////////////////
// Other inherited functions.
virtual void EstablishSpecials (G4PhysicalVolumeModel&);
// Used to establish any special relationships between scene and this
// particular type of model - non-pure, i.e., no requirement to
// implement. See G4PhysicalVolumeModel.hh for details.
virtual void PreAddThis (const G4Transform3D& objectTransformation,
const G4VisAttributes& visAttribs);
// objectTransformation is the transformation in the world
// coordinate system of the object about to be added, and visAttribs
// is its visualization attributes.
// IMPORTANT: invoke this from your polymorphic versions, e.g.:
// void MyXXXScene::PreAddThis (const G4Transform3D& objectTransformation,
// const G4VisAttributes& visAttribs) {
// G4VScene::PreAddThis (objectTransformation, visAttribs);
// ...
// }
virtual void PostAddThis ();
// IMPORTANT: invoke this from your polymorphic versions, e.g.:
// void MyXXXScene::PostAddThis () {
// ...
// G4VScene::PostAddThis (objectTransformation, visAttribs);
// }
//////////////////////////////////////////////////////////////
// Functions for adding primitives.
virtual void BeginModeling ();
// IMPORTANT: invoke this from your polymorphic versions, e.g.:
// void MyXXXScene::BeginModeling () {
// G4VScene::BeginModeling ();
// ...
// }
virtual void EndModeling ();
// IMPORTANT: invoke this from your polymorphic versions, e.g.:
// void MyXXXScene::EndModeling () {
// ...
// G4VScene::EndModeling ();
// }
virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
// IMPORTANT: invoke this from your polymorphic versions, e.g.:
// void MyXXXScene::BeginPrimitives
// (const G4Transform3D& objectTransformation) {
// G4VScene::BeginPrimitives (objectTransformation);
// ...
// }
virtual void EndPrimitives ();
// IMPORTANT: invoke this from your polymorphic versions, e.g.:
// void MyXXXScene::EndPrimitives () {
// ...
// G4VScene::EndPrimitives ();
// }
virtual void AddPrimitive (const G4Polyline&) = 0;
virtual void AddPrimitive (const G4Text&) = 0;
virtual void AddPrimitive (const G4Circle&) = 0;
virtual void AddPrimitive (const G4Square&) = 0;
virtual void AddPrimitive (const G4Polymarker&); // Uses the above.
virtual void AddPrimitive (const G4Polyhedron&) = 0;
virtual void AddPrimitive (const G4NURBS&) = 0;
//////////////////////////////////////////////////////////////
// Access functions.
const G4String& GetName () const;
void SetName (const G4String&);
G4int GetSceneId () const;
G4int GetViewCount () const;
G4VGraphicsSystem* GetGraphicsSystem () const;
const G4SceneData& GetSceneData () const;
const G4VViewList& GetViewList () const;
const G4VModel* GetModel () const;
G4VView* GetCurrentView () const;
void SetCurrentView (G4VView*);
void SetSceneData (const G4SceneData&);
G4VViewList& SetViewList (); // Non-const if you need to change.
void SetModel (const G4VModel*);
//////////////////////////////////////////////////////////////
// Public utility functions.
const G4Colour& GetColour (const G4Visible&);
const G4Colour& GetColor (const G4Visible&);
// The above return colour of G4Visible object, or default global colour.
const G4Colour& GetTextColour (const G4Text&);
const G4Colour& GetTextColor (const G4Text&);
// The above return colour of G4Text object, or default text colour.
G4ViewParameters::DrawingStyle GetDrawingStyle (const G4Visible&);
// Returns drawing style of G4Visible object, i.e., the global
// default value unless ovewrridden by forced attributes. And the
// attributes themselves can be specified or the global default is
// used - see next function. So use this function is you have a
// G4Visible, or the next if all you have is a G4VisAttributes
// pointer.
G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes*);
// Returns global default drawing style unless forced attributes are set.
// So always use this to get the applicable drawing style.
G4double GetMarkerSize (const G4VMarker&, MarkerSizeType&);
// Returns applicable marker size (diameter) and type (in second
// argument). Uses global default marker if marker sizes are not
// set.
G4double GetMarkerDiameter (const G4VMarker&, MarkerSizeType&);
// Alias for GetMarkerSize.
G4double GetMarkerRadius (const G4VMarker&, MarkerSizeType&);
// GetMarkerSize / 2.
G4ModelingParameters* CreateModelingParameters ();
// Only the scene and view know what the Modeling Parameters should
// be. For historical reasons, the GEANT4 Visualization Environment
// maintains its own Scene Data and View Parameters, which must be
// converted, when needed, to Modeling Parameters.
//////////////////////////////////////////////////////////////
// Administration functions.
G4int IncrementViewCount ();
virtual void ClearStore ();
// Clears graphics database (display lists) if any.
void AddViewToList (G4VView* pView); // Add view to view List.
void RemoveViewFromList (G4VView* pView); // Remove view from view List.
protected:
//////////////////////////////////////////////////////////////
// Default routine used by default AddThis ().
virtual void RequestPrimitives (const G4VSolid& solid);
//////////////////////////////////////////////////////////////
// Data members
G4VGraphicsSystem& fSystem; // Abstract system for this scene.
const G4int fSceneId; // Id of this instance.
G4String fName;
G4int fViewCount; // To determine view ids for this scene.
G4VViewList fViewList; // Views.
G4VView* fpView; // Current view.
G4SceneData fSD; // Scene data for this scene.
//////////////////////////////////////////////////////////////
// Workspace...
G4bool fReadyForTransients; // I.e., not processing scene.
const G4VModel* fpModel; // Current model.
const G4Transform3D* fpObjectTransformation; // Accum'd obj. transfn.
const G4VisAttributes* fpVisAttribs; // Working vis attributes.
G4int fCurrentDepth; // Current depth of geom. hierarchy.
G4VPhysicalVolume* fpCurrentPV; // Current physical volume.
G4LogicalVolume* fpCurrentLV; // Current logical volume.
private:
//////////////////////////////////////////////////////////////
// Friend function accessed only by views of this scene.
friend void G4VView::ProcessView ();
//////////////////////////////////////////////////////////////
// Private functions, etc..
void ProcessScene (G4VView& view);
// Accessed by G4VView::ProcessView ().
};
#include "G4VScene.icc"
#endif
@@ -0,0 +1,148 @@
// 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: G4VScene.icc,v 2.3 1998/11/06 13:43:04 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 19th July 1996.
inline G4bool G4VScene::operator == (const G4VScene& scene) const {
return this == &scene;
}
inline void G4VScene::EndModeling () {}
inline void G4VScene::AddThis (const G4Box& box) {
RequestPrimitives (box);
// If your graphics system is sophisticated enough to handle a
// particular solid shape as a primitive, in your derived class write a
// function to override this. (Note: some compilers warn that your
// function "hides" this one. That's OK.)
// Your function might look like this...
// void G4MyScene::AddThis (const G4Box& box) {
// Get parameters of appropriate object, e.g.:
// G4double dx = box.GetXHalfLength ();
// G4double dy = box.GetYHalfLength ();
// G4double dz = box.GetZHalfLength ();
// and Draw or Store in your display List.
}
inline void G4VScene::AddThis (const G4Tubs& tubs) {
RequestPrimitives (tubs);
}
inline void G4VScene::AddThis (const G4Cons& cons) {
RequestPrimitives (cons);
}
inline void G4VScene::AddThis (const G4Trd& trd) {
RequestPrimitives (trd);
}
inline void G4VScene::AddThis (const G4Trap& trap) {
RequestPrimitives (trap);
}
inline void G4VScene::AddThis (const G4Sphere& sphere) {
RequestPrimitives ( sphere );
}
inline void G4VScene::AddThis (const G4Para& para ) {
RequestPrimitives ( para );
}
inline void G4VScene::AddThis (const G4Torus& torus ) {
RequestPrimitives ( torus );
}
inline void G4VScene::AddThis (const G4VSolid& solid) {
RequestPrimitives (solid);
}
inline void G4VScene::PreAddThis (const G4Transform3D& objectTransformation,
const G4VisAttributes& visAttribs) {
fpObjectTransformation = &objectTransformation;
fpVisAttribs = &visAttribs;
}
inline void G4VScene::PostAddThis () {}
inline void G4VScene::ClearStore () {}
inline G4VGraphicsSystem* G4VScene::GetGraphicsSystem () const {
return &fSystem;
}
inline G4int G4VScene::GetSceneId () const {
return fSceneId;
}
inline G4int G4VScene::GetViewCount () const {
return fViewCount;
}
inline
G4double G4VScene::GetMarkerDiameter (const G4VMarker& marker,
G4VScene::MarkerSizeType& sizeType) {
return GetMarkerSize (marker, sizeType);
}
inline
G4double G4VScene::GetMarkerRadius (const G4VMarker& marker,
G4VScene::MarkerSizeType& sizeType) {
return GetMarkerSize (marker, sizeType) / 2.;
}
inline G4int G4VScene::IncrementViewCount () {
return fViewCount++;
}
inline const G4String& G4VScene::GetName () const {
return fName;
}
inline void G4VScene::SetName (const G4String& name) {
fName = name;
}
inline const G4SceneData& G4VScene::GetSceneData () const {
return fSD;
}
inline const G4VViewList& G4VScene::GetViewList () const {
return fViewList;
}
inline const G4VModel* G4VScene::GetModel () const {
return fpModel;
}
inline G4VView* G4VScene::GetCurrentView () const {
return fpView;
}
inline void G4VScene::SetCurrentView (G4VView* pView) {
fpView = pView;
}
inline G4VViewList& G4VScene::SetViewList () {
return fViewList;
}
inline void
G4VScene::SetModel (const G4VModel* pModel) {
fpModel = pModel;
}
inline const G4Colour& G4VScene::GetColor (const G4Visible& visible) {
return GetColour (visible);
}
inline const G4Colour& G4VScene::GetTextColor (const G4Text& text) {
return GetTextColour (text);
}
@@ -0,0 +1,130 @@
// 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: G4VView.hh,v 2.3 1998/11/06 13:43:05 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 27th March 1996
// Abstract interface class for graphics views.
#ifndef G4VVIEW_HH
#define G4VVIEW_HH
#include "globals.hh"
#include "G4ViewParameters.hh"
class G4VScene;
class G4VView {
friend ostream& operator << (ostream& os, const G4VView& v);
public:
G4VView (G4VScene& scene, G4int id, const G4String& name = "");
virtual ~G4VView ();
// For RWTPtrOrderedVector...
G4bool operator == (const G4VView& view) const;
//////////////////////////////////////////////////////////////
// View manipulation functions.
virtual void SetView () = 0;
// Take view parameters and work out model/view transformation,
// projection transformation, lighting, etc.
virtual void ClearView () = 0;
// Clear screen/viewing buffers.
virtual void DrawView () = 0;
// Draw scene - see example of a minimal function at end of this file.
virtual void ShowView ();
// Show view (for graphics systems which require to process
// all drawn objects before finalising the view).
virtual void FinishView ();
// Called at the end of drawing scene. Used to flush streams, or
// swap buffers. (Perhaps it is inappropriately named, perhaps its
// function could be incorporated into EndModeling (). It marks the
// end of scene drawing; be aware hits and digi drawing may Follow.
// It is not yet the end of all drawing; that is signalled by
// ShowView ().)
//////////////////////////////////////////////////////////////
// Access functions.
const G4String& GetName () const;
void SetName (const G4String&);
G4int GetViewId () const;
G4VScene* GetScene () const;
const G4ViewParameters& GetViewParameters () const;
void SetViewParameters (const G4ViewParameters& vp);
//////////////////////////////////////////////////////////////
// Public utility functions.
const G4VisAttributes* GetApplicableVisAttributes
(const G4VisAttributes*) const;
void SetNeedKernelVisit ();
// Sets individual need-visit flags.
void NeedKernelVisit ();
// Flags all views the need to re-visit the GEANT4 kernel to refresh
// the scene.
protected:
void ProcessView ();
// Used by DrawView (). Invokes SetView (). The basic logic is here.
//////////////////////////////////////////////////////////////
// Data members
G4VScene& fScene; // Abstract scene for this view.
G4int fViewId; // Id of this instance.
G4String fName;
G4ViewParameters fVP; // Viewing parameters.
//////////////////////////////////////////////////////////////
// Other parameters.
G4bool fModified; // If View Parameters have been modified.
G4bool fNeedKernelVisit; // See DrawView() for comments.
};
#include "G4VView.icc"
/*********************************************
Here is a minimal DrawView () as it might be implemented in the
concrete view.
void G4VView::DrawView () { // Default - concrete view usually overrides.
// First, a view should decide when to re-visit the G4 kernel.
// Sometimes it might not be necessary, e.g., if the scene is stored
// in a graphical database (e.g., OpenGL's display lists) and only
// the viewing angle has changed. But graphics systems without a
// graphical database will always need to visit the G4 kernel.
NeedKernelVisit (); // Default is - always visit G4 kernel.
// Note: this routine sets the fNeedKernelVisit flag of *all* the views of
// the scene.
ProcessView (); // The basic logic is here.
// Then a view may have more to do, e.g., display the graphical
// database. That code should come here before finally...
FinishView (); // Flush streams and/or swap buffers.
}
*********************************************/
#endif
@@ -0,0 +1,42 @@
// 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: G4VView.icc,v 2.1 1998/10/14 14:15:06 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 30th December 1996
inline G4bool G4VView::operator == (const G4VView& view) const{
return this == &view;
}
inline G4int G4VView::GetViewId () const {
return fViewId;
}
inline const G4String& G4VView::GetName () const {
return fName;
}
inline void G4VView::SetName (const G4String& name) {
fName = name;
}
inline G4VScene* G4VView::GetScene () const {
return &fScene;
}
inline const G4ViewParameters& G4VView::GetViewParameters () const {
return fVP;
}
inline void G4VView::SetNeedKernelVisit () {
fNeedKernelVisit = true;
}
inline void G4VView::FinishView () {}
@@ -0,0 +1,22 @@
// 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: G4VViewList.hh,v 2.0 1998/07/02 16:48:51 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison May 1996
#ifndef G4VVIEWLIST_HH
#define G4VVIEWLIST_HH
#include <rw/tpordvec.h>
#include "G4VView.hh"
class G4VViewList: public RWTPtrOrderedVector<G4VView> {};
#endif
@@ -0,0 +1,44 @@
// 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: G4VVisCommand.hh,v 2.4 1998/12/09 23:56:22 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
#ifndef G4VVISCOMMAND_HH
#define G4VVISCOMMAND_HH
#include "G4UImessenger.hh"
class G4VisManager;
class G4UIcommand;
class G4UIcmdWithAString;
class G4VVisCommand: public G4UImessenger {
public:
// Uses compiler defaults for destructor, copy constructor and assignment.
G4VVisCommand ();
static void SetVisManager (G4VisManager*);
protected:
static G4VisManager* fpVisManager;
// Commands which need to be accessed by other messengers...
static G4UIcmdWithAString* fpCommandSceneNotifyHandlers;
static G4UIcmdWithAString* fpCommandSceneRemove;
static G4UIcmdWithAString* fpCommandSceneSelect;
static G4UIcmdWithAString* fpCommandSceneHandlerAttach;
static G4UIcmdWithAString* fpCommandSceneHandlerRemove;
static G4UIcmdWithAString* fpCommandSceneHandlerSelect;
static G4UIcommand* fpCommandViewerCreate;
static G4UIcmdWithAString* fpCommandViewerRemove;
static G4UIcmdWithAString* fpCommandViewerSelect;
};
#include "G4VVisCommand.icc"
#endif
@@ -0,0 +1,18 @@
// 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: G4VVisCommand.icc,v 2.1 1998/08/09 17:54:17 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
inline G4VVisCommand::G4VVisCommand () {}
inline void G4VVisCommand::SetVisManager (G4VisManager* pVisManager) {
fpVisManager = pVisManager;
}
@@ -0,0 +1,239 @@
// 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: G4ViewParameters.hh,v 2.3 1998/11/25 16:31:26 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 19th July 1996
// View parameters and options.
#ifndef G4VIEWPARAMETERS_HH
#define G4VIEWPARAMETERS_HH
#include <rw/tvordvec.h>
#include "G4Vector3D.hh"
#include "G4Point3D.hh"
#include "G4Plane3D.hh"
#include "G4VisAttributes.hh"
#include "G4VMarker.hh"
typedef RWTValOrderedVector<G4Plane3D> G4Planes;
//. % THE STANDARD VIEW AND ALL THAT.
//.
//. In GEANT4 visualization, we have the concept of a ``Standard View''.
//. This is the view when the complete set of objects being viewed is
//. comfortably in view from any viewpoint. It is defined by the
//. ``Bounding Sphere'' of ``visible'' objects when initially registered
//. in the scene, and the View Parameters.
//.
//. There is also the ``Standard Target Point'', which is the centre
//. of the Bounding Sphere (note that these belong to the scene, and are
//. stored in the Scene Data). The ``Current Target Point'', initially
//. set to the Standard Target Point, is incremented by the
//. ``dolly'' and ``zoom'' commands, and can be reset to the
//. Standard Target Point with the {\tt /vis~/camera/reset} command.
//.
//. Also, the ``Standard Camera Position'' is the ``Standard Camera
//. Distance'' along
//. the Viewpoint Direction vector from the Standard Target Point.
//. The Standard Camera Distance is the radius of the
//. Bounding Sphere divided by {\tt fFieldHalfAngle}. It is not stored
//. explicitly because of the singularity at {\tt fFieldHalfAngle} = 0,
//. which implies parallel projection.
//.
//. Similarly, the ``Current Camera Position'' is the ``Current
//. Camera Distance''
//. along the Viewpoint Direction vector from the Current Target Point.
//. The Current Camera Distance is given by the formulae below, but
//. note that it can be negative, meaning that the camera has
//. moved {\em beyond} the Current Target Point, which is conceptually
//. possible, but which might give some problems when setting up
//. the view matrix --- see, for example, {\tt G4OpenGLView::SetView ()}.
//.
//. All views are expected to keep the ``Up Vector'' vertical.
//.
//. Finally, the view is magnified by the ``Zoom Factor'' which is
//. reset to 1 by the \linebreak
//. {\tt /vis~/camera/reset} command.
//.
//. Note: the camera movements pan, dolly and zoom, are currently coded in
//. \linebreak {\tt G4VisManMessenger.cc}.
//.
//. The algorithms for calculating various useful quantities from the
//. View Parameters are encapsulated in the functions described in
//. Appendix \ref{ap:useful}.
class G4ViewParameters {
friend ostream& operator << (ostream& os, const G4ViewParameters& v);
friend G4bool operator != (const G4ViewParameters& v1,
const G4ViewParameters& v2);
public:
enum DrawingStyle {
wireframe, // Draw edges - no hidden line removal.
hlr, // Draw edges - hidden lines removed.
hsr, // Draw surfaces - hidden surfaces removed.
hlhsr // Draw surfaces and edges - hidden removed.
};
enum RepStyle {
polyhedron, // Use G4Polyhedron.
nurbs // Use G4NURBS.
};
G4ViewParameters ();
~G4ViewParameters ();
// Note: uses default assignment operator and copy constructor.
// Get and Is functions.
DrawingStyle GetDrawingStyle () const;
RepStyle GetRepStyle () const;
G4bool IsCulling () const;
G4bool IsCullingInvisible () const;
G4bool IsDensityCulling () const;
G4double GetVisibleDensity () const;
G4bool IsCullingCovered () const;
G4bool IsSection () const;
const G4Plane3D& GetSectionPlane () const;
G4bool IsCutaway () const;
const G4Planes& GetCutawayPlanes () const;
G4bool IsExplode () const;
G4double GetExplodeFactor () const;
G4int GetNoOfSides () const;
const G4Vector3D& GetViewpointDirection () const;
const G4Vector3D& GetUpVector () const;
G4double GetFieldHalfAngle () const;
G4double GetZoomFactor () const;
const G4Point3D& GetCurrentTargetPoint () const;
G4double GetDolly () const;
G4bool GetLightsMoveWithCamera () const;
const G4Vector3D& GetLightpointDirection () const; // Relative...
G4Vector3D& GetActualLightpointDirection (); // Actual...
// ... depending on GetLightsMoveWithCamera.
G4bool IsViewGeom () const;
G4bool IsViewHits () const;
G4bool IsViewDigis () const;
const G4VisAttributes* GetDefaultVisAttributes () const;
const G4VisAttributes* GetDefaultTextVisAttributes () const;
const G4VMarker& GetDefaultMarker () const;
G4double GetGlobalMarkerScale () const;
G4bool IsMarkerNotHidden () const;
G4int GetWindowSizeHintX () const;
G4int GetWindowSizeHintY () const;
// Here Follow functions to evaluate the above algorithms as a
// function of the radius of the Bounding Sphere of the object being
// viewed. Call them in the order given - for efficiency, later
// functions depend on the results of earlier ones (Store the
// results of earlier functions in your own temporary variables -
// see, for example, G4OpenGLView::SetView ().)
G4double GetCameraDistance (G4double radius) const;
G4double GetNearDistance (G4double cameraDistance, G4double radius) const;
G4double GetFarDistance (G4double cameraDistance,
G4double nearDistance, G4double radius) const;
G4double GetFrontHalfHeight (G4double nearDistance, G4double radius) const;
// Set, Add, Multiply, Increment, Unset and Clear functions.
void SetDrawingStyle (G4ViewParameters::DrawingStyle style);
void SetRepStyle (G4ViewParameters::RepStyle style);
void SetCulling (G4bool);
void SetCullingInvisible (G4bool);
void SetDensityCulling (G4bool);
void SetVisibleDensity (G4double visibleDensity);
void SetCullingCovered (G4bool);
void SetSectionPlane (const G4Plane3D& sectionPlane);
void UnsetSectionPlane ();
void AddCutawayPlane (const G4Plane3D& cutawayPlane);
void ClearCutawayPlanes ();
void SetExplodeFactor (G4double explodeFactor);
void UnsetExplodeFactor ();
void SetNoOfSides (G4int nSides);
void SetViewpointDirection (const G4Vector3D& viewpointDirection);
// Prefer the following to get lightpoint direction right too.
void SetViewAndLights (const G4Vector3D& viewpointDirection);
// Also sets lightpoint direction according to G4bool fLightsMoveWithCamera.
void SetUpVector (const G4Vector3D& upVector);
void SetFieldHalfAngle (G4double fieldHalfAngle);
void SetZoomFactor (G4double zoomFactor);
void MultiplyZoomFactor (G4double zoomFactorMultiplier);
void SetCurrentTargetPoint (const G4Point3D& currentTargetPoint);
void SetDolly (G4double dolly);
void IncrementDolly (G4double dollyIncrement);
void SetLightpointDirection (const G4Vector3D& lightpointDirection);
void SetLightsMoveWithCamera (G4bool moves);
void SetViewGeom ();
void UnsetViewGeom ();
void SetViewHits ();
void UnsetViewHits ();
void SetViewDigis ();
void UnsetViewDigis ();
void SetDefaultVisAttributes (const G4VisAttributes&);
void SetDefaultTextVisAttributes (const G4VisAttributes&);
void SetDefaultMarker (const G4VMarker& defaultMarker);
void SetGlobalMarkerScale (G4double globalMarkerScale);
void SetMarkerHidden ();
void SetMarkerNotHidden ();
void SetWindowSizeHint (G4int xHint, G4int yHint);
void Pan (G4double right, G4double up);
// Note: the result of above "pan"operation is always an Increment
// relative to the current target point and also depends on the
// veiwpoint and up directions.
void PrintDifferences (const G4ViewParameters& v) const;
private:
DrawingStyle fDrawingStyle; // Drawing style.
RepStyle fRepStyle; // Representation style.
G4bool fCulling; // Culling requested.
G4bool fCullInvisible; // Cull (don't Draw) invisible objects.
G4bool fDensityCulling; // Density culling requested. If so...
G4double fVisibleDensity; // ...density lower than this not drawn.
G4bool fCullCovered; // Cull daughters covered by opaque mothers.
G4bool fSection; // Section drawing requested (DCUT in GEANT3).
G4Plane3D fSectionPlane; // Cut plane for section drawing (DCUT).
G4bool fCutaway; // Cutaway flag.
G4Planes fCutawayPlanes; // Set of planes used for cutaway.
G4bool fExplode; // Explode flag.
G4double fExplodeFactor;
G4int fNoOfSides; // ...if polygon approximates circle.
G4Vector3D fViewpointDirection;
G4Vector3D fUpVector; // Up vector. (Warning: MUST NOT be parallel
// to fViewpointDirection!)
G4double fFieldHalfAngle; // Radius / camara distance, 0 for parallel.
G4double fZoomFactor; // Magnification relative to Standard View.
G4Point3D fCurrentTargetPoint;
G4double fDolly; // Distance towards current target point.
G4bool fLightsMoveWithCamera;
G4Vector3D fRelativeLightpointDirection;
// i.e., rel. to object or camera accoding to G4bool LightsMoveWithCamera.
G4Vector3D fActualLightpointDirection;
G4bool fViewGeom; // View geometry objects.
G4bool fViewHits; // View hits, if any.
G4bool fViewDigis; // View digis, if any.
G4VisAttributes fDefaultVisAttributes;
G4VisAttributes fDefaultTextVisAttributes;
G4VMarker fDefaultMarker;
G4double fGlobalMarkerScale;
G4bool fMarkerNotHidden;
// True if transients are to be drawn and not hidden by
// hidden-line-hidden-surface removal algorithms, e.g., z-buffer
// testing; false if they are to be hidden-line-hidden-surface
// removed.
G4int fWindowSizeHintX; // Size hints for pixel-based window systems.
G4int fWindowSizeHintY;
};
#include "G4ViewParameters.icc"
#endif
@@ -0,0 +1,284 @@
// 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: G4ViewParameters.icc,v 2.0 1998/07/02 16:48:54 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 20th October 1996
// View parameters and options.
inline G4ViewParameters::DrawingStyle
G4ViewParameters::GetDrawingStyle () const {
return fDrawingStyle;
}
inline G4ViewParameters::RepStyle G4ViewParameters::GetRepStyle () const {
return fRepStyle;
}
inline G4bool G4ViewParameters::IsCulling () const {
return fCulling;
}
inline G4bool G4ViewParameters::IsCullingInvisible () const {
return fCullInvisible;
}
inline G4bool G4ViewParameters::IsDensityCulling () const {
return fDensityCulling;
}
inline G4double G4ViewParameters::GetVisibleDensity () const {
return fVisibleDensity;
}
inline G4bool G4ViewParameters::IsCullingCovered () const {
return fCullCovered;
}
inline G4bool G4ViewParameters::IsSection () const {
return fSection;
}
inline const G4Plane3D& G4ViewParameters::GetSectionPlane () const {
return fSectionPlane;
}
inline G4bool G4ViewParameters::IsCutaway () const {
return fCutaway;
}
inline const G4Planes& G4ViewParameters::GetCutawayPlanes () const {
return fCutawayPlanes;
}
inline G4bool G4ViewParameters::IsExplode () const {
return fExplode;
}
inline G4double G4ViewParameters::GetExplodeFactor () const {
return fExplodeFactor;
}
inline G4int G4ViewParameters::GetNoOfSides () const {
return fNoOfSides;
}
inline const G4Vector3D& G4ViewParameters::GetViewpointDirection () const {
return fViewpointDirection;
}
inline const G4Vector3D& G4ViewParameters::GetUpVector () const {
return fUpVector;
}
inline G4double G4ViewParameters::GetFieldHalfAngle () const {
return fFieldHalfAngle;
}
inline G4double G4ViewParameters::GetZoomFactor () const {
return fZoomFactor;
}
inline const G4Point3D& G4ViewParameters::GetCurrentTargetPoint () const {
return fCurrentTargetPoint;
}
inline G4double G4ViewParameters::GetDolly () const {
return fDolly;
}
inline const G4Vector3D& G4ViewParameters::GetLightpointDirection () const {
return fRelativeLightpointDirection;
}
inline G4bool G4ViewParameters::GetLightsMoveWithCamera () const {
return fLightsMoveWithCamera;
}
inline G4bool G4ViewParameters::IsViewGeom () const {
return fViewGeom;
}
inline G4bool G4ViewParameters::IsViewHits () const {
return fViewHits;
}
inline G4bool G4ViewParameters::IsViewDigis () const {
return fViewDigis;
}
inline const G4VisAttributes*
G4ViewParameters::GetDefaultVisAttributes () const {
return &fDefaultVisAttributes;
}
inline const G4VisAttributes*
G4ViewParameters::GetDefaultTextVisAttributes () const {
return &fDefaultTextVisAttributes;
}
inline const G4VMarker& G4ViewParameters::GetDefaultMarker () const {
return fDefaultMarker;
}
inline G4double G4ViewParameters::GetGlobalMarkerScale () const {
return fGlobalMarkerScale;
}
inline G4bool G4ViewParameters::IsMarkerNotHidden () const {
return fMarkerNotHidden;
}
inline G4int G4ViewParameters::GetWindowSizeHintX () const {
return fWindowSizeHintX;
}
inline G4int G4ViewParameters::GetWindowSizeHintY () const {
return fWindowSizeHintY;
}
inline void
G4ViewParameters::SetDrawingStyle (G4ViewParameters::DrawingStyle style) {
fDrawingStyle = style;
}
inline void
G4ViewParameters::SetRepStyle (G4ViewParameters::RepStyle style) {
fRepStyle = style;
}
inline void G4ViewParameters::SetCulling (G4bool value) {
fCulling = value;
}
inline void G4ViewParameters::SetCullingInvisible (G4bool value) {
fCullInvisible = value;
}
inline void G4ViewParameters::SetDensityCulling (G4bool value) {
fDensityCulling = value;
}
inline void G4ViewParameters::SetCullingCovered (G4bool value) {
fCullCovered = value;
}
inline void G4ViewParameters::SetSectionPlane (const G4Plane3D& sectionPlane) {
fSection = true;
fSectionPlane = sectionPlane;
}
inline void G4ViewParameters::UnsetSectionPlane () {
fSection = false;
}
inline void G4ViewParameters::SetViewpointDirection
(const G4Vector3D& viewpointDirection) {
fViewpointDirection = viewpointDirection;
}
inline void G4ViewParameters::SetExplodeFactor (G4double explodeFactor) {
fExplode = true;
fExplodeFactor = explodeFactor;
}
inline void G4ViewParameters::UnsetExplodeFactor () {
fExplode = false;
}
inline void G4ViewParameters::SetUpVector (const G4Vector3D& upVector) {
fUpVector = upVector;
}
inline void G4ViewParameters::SetFieldHalfAngle (G4double fieldHalfAngle) {
fFieldHalfAngle = fieldHalfAngle;
}
inline void G4ViewParameters::SetZoomFactor (G4double zoomFactor) {
fZoomFactor = zoomFactor;
}
inline void
G4ViewParameters::MultiplyZoomFactor (G4double zoomFactorMultiplier) {
fZoomFactor *= zoomFactorMultiplier;
}
inline void
G4ViewParameters::SetCurrentTargetPoint (const G4Point3D& currentTargetPoint) {
fCurrentTargetPoint = currentTargetPoint;
}
inline void G4ViewParameters::SetDolly (G4double dolly) {
fDolly = dolly;
}
inline void G4ViewParameters::IncrementDolly (G4double dollyIncrement) {
fDolly += dollyIncrement;
}
inline void G4ViewParameters::SetLightsMoveWithCamera (G4bool moves) {
fLightsMoveWithCamera = moves;
}
inline void G4ViewParameters::SetViewGeom () {
fViewGeom = true;
}
inline void G4ViewParameters::UnsetViewGeom () {
fViewGeom = false;
}
inline void G4ViewParameters::SetViewHits () {
fViewHits = true;
}
inline void G4ViewParameters::UnsetViewHits () {
fViewHits = false;
}
inline void G4ViewParameters::SetViewDigis () {
fViewDigis = true;
}
inline void G4ViewParameters::UnsetViewDigis () {
fViewDigis = false;
}
inline void G4ViewParameters::SetDefaultVisAttributes
(const G4VisAttributes& defaultVisAttributes) {
fDefaultVisAttributes = defaultVisAttributes;
}
inline void G4ViewParameters::SetDefaultTextVisAttributes
(const G4VisAttributes& defaultTextVisAttributes) {
fDefaultTextVisAttributes = defaultTextVisAttributes;
}
inline void
G4ViewParameters::SetDefaultMarker (const G4VMarker& defaultMarker) {
fDefaultMarker = defaultMarker;
}
inline void
G4ViewParameters::SetGlobalMarkerScale (G4double globalMarkerScale) {
fGlobalMarkerScale = globalMarkerScale;
}
inline void G4ViewParameters::SetMarkerHidden () {
fMarkerNotHidden = false;
}
inline void G4ViewParameters::SetMarkerNotHidden () {
fMarkerNotHidden = true;
}
inline void G4ViewParameters::SetWindowSizeHint (G4int xHint, G4int yHint) {
fWindowSizeHintX = xHint;
fWindowSizeHintY = yHint;
}
@@ -0,0 +1,84 @@
// 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: G4VisCommandTemplates.hh,v 2.1 1998/07/12 03:09:54 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Visualization Command Messenger Templates.
// John Allison 7th September 1997
#ifndef G4VISCOMMANDTEMPLATES_HH
#define G4VISCOMMANDTEMPLATES_HH
#include "globals.hh"
#include "G4UImessenger.hh"
class G4UIcommand;
/***************************************
// Vis Command Messenger Template - General Purpose.
template <class T>
class G4VisCommandMessenger: public G4UImessenger {
public:
G4VisCommandMessenger ();
~G4VisCommandMessenger ();
void SetNewValue (G4UIcommand* command, G4String newValues);
private:
T fCommand;
};
************************************************/
// Command Messenger Template for directory - OLD STYLE!!
template <class tCommandDirectory>
class G4VisCommandDirectoryMessenger: public G4UImessenger {
public:
G4VisCommandDirectoryMessenger ();
~G4VisCommandDirectoryMessenger ();
private:
tCommandDirectory fCommandDirectory;
G4UIcommand* fpCommand;
};
// Command Messenger Template for simple commands with no arguments -
// OLD STYLE!!
template <class tSimpleCommand>
class G4VisSimpleCommandMessenger: public G4UImessenger {
public:
G4VisSimpleCommandMessenger ();
~G4VisSimpleCommandMessenger ();
void SetNewValue (G4UIcommand* command, G4String newValues);
private:
tSimpleCommand fSimpleCommand;
G4UIcommand* fpCommand;
};
// Command Messenger Template for Boolean attributes which can
// usefully be implemented as a button on a GUI - OLD STYLE!!
template <class tButtonCommand>
class G4VisButtonCommandMessenger: public G4UImessenger {
public:
G4VisButtonCommandMessenger ();
~G4VisButtonCommandMessenger ();
void SetNewValue (G4UIcommand* command, G4String newValues);
private:
tButtonCommand fButtonCommand;
G4UIcommand* fpCommand;
};
// OLD STYLE!!
G4UIcommand* G4VisButtonCommandMessengerRegister (G4String commandName,
G4String guidance,
G4UImessenger* messenger);
// OLD STYLE!!
G4int G4VisButtonCommandMessengerInterpret (G4String newValues);
#include "G4VisCommandTemplates.icc"
#endif
@@ -0,0 +1,118 @@
// 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: G4VisCommandTemplates.icc,v 2.4 1998/07/19 05:53:51 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Command Messenger Templates.
// John Allison 7th September 1997
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4ios.hh"
/**************************************
// What follows is just a try at a general template. But I think I'll
abandon templates for this job - JA.
template <class T>
G4VisCommandMessenger <T> ::G4VisCommandMessenger () {
fpCommand = G4VisCommandMessengerRegister
(fCommand.GetCommandName (),
fCommand.GetGuidance (),
this);
}
template <class T>
G4VisCommandMessenger <T>
::~G4VisCommandMessenger () {
delete fpCommand;
}
template <class T>
void G4VisCommandMessenger <T> ::SetNewValue
(G4UIcommand*, G4String newValues) {
switch (G4VisCommandMessengerInterpret (newValues)) {
case 0: fCommand.SetValue (false); break;
case 1: fCommand.SetValue (true); break;
default: break;
}
G4cout << "Current value of " << fCommand.GetValueName ()
<< " is " << fCommand.GetValue () << endl;
}
************************************/
// OLD STYLE!!
template <class tCommandDirectory>
G4VisCommandDirectoryMessenger <tCommandDirectory>
::G4VisCommandDirectoryMessenger () {
fpCommand = new G4UIdirectory (fCommandDirectory.GetCommandName ());
fpCommand -> SetGuidance (fCommandDirectory.GetGuidance ());
}
// OLD STYLE!!
template <class tCommandDirectory>
G4VisCommandDirectoryMessenger <tCommandDirectory>
::~G4VisCommandDirectoryMessenger () {
delete fpCommand;
}
// OLD STYLE!!
template <class tSimpleCommand>
G4VisSimpleCommandMessenger <tSimpleCommand>
::G4VisSimpleCommandMessenger () {
fpCommand = new G4UIcmdWithoutParameter
(fSimpleCommand.GetCommandName (), this);
fpCommand -> SetGuidance (fSimpleCommand.GetGuidance ());
}
// OLD STYLE!!
template <class tSimpleCommand>
G4VisSimpleCommandMessenger <tSimpleCommand>
::~G4VisSimpleCommandMessenger () {
delete fpCommand;
}
// OLD STYLE!!
template <class tSimpleCommand>
void G4VisSimpleCommandMessenger <tSimpleCommand> ::SetNewValue
(G4UIcommand*, G4String) {
fSimpleCommand.SetValue ();
}
// OLD STYLE!!
template <class tButtonCommand>
G4VisButtonCommandMessenger <tButtonCommand>
::G4VisButtonCommandMessenger () {
fpCommand = G4VisButtonCommandMessengerRegister
(fButtonCommand.GetCommandName (),
fButtonCommand.GetGuidance (),
this);
}
// OLD STYLE!!
template <class tButtonCommand>
G4VisButtonCommandMessenger <tButtonCommand>
::~G4VisButtonCommandMessenger () {
delete fpCommand;
}
// OLD STYLE!!
template <class tButtonCommand>
void G4VisButtonCommandMessenger <tButtonCommand> ::SetNewValue
(G4UIcommand*, G4String newValues) {
switch (G4VisButtonCommandMessengerInterpret (newValues)) {
case 0: fButtonCommand.SetValue (false); break;
case 1: fButtonCommand.SetValue (true); break;
default: break;
}
G4cout << "Current value of " << fButtonCommand.GetValueName ()
<< " is " << fButtonCommand.GetValue () << endl;
}
@@ -0,0 +1,47 @@
// 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: G4VisCommandsCamera.hh,v 2.2 1998/07/12 03:09:56 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/camera/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSCAMERA_HH
#define G4VISCOMMANDSCAMERA_HH
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4ViewParameters.hh"
//////////////////////////////////////////////////// /vis~/camera/... ////
//vis \hline
//vis /vis~/camera/ &&
//vis ...menu of camera commands. \\%
class G4VisCommandCamera {
public:
G4String GetCommandName () const {return "/vis~/camera/";}
G4String GetGuidance () const {
return "...menu of camera commands.";
}
};
///////////////////////////////////// /vis~/camera/reset ////
//camera \hline
//camera /vis~/camera/reset &&
//camera Resets dolly, pan and zoom. Regains ``Standard View''. \\%
class G4VisCommandCameraReset {
public:
G4String GetCommandName () const {return "/vis~/camera/reset";}
G4String GetGuidance () const {
return "Resets dolly, pan and zoom. Regains \"Standard View\".";
}
void SetValue ();
};
#endif
@@ -0,0 +1,32 @@
// 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: G4VisCommandsCameraMessengers.hh,v 2.3 1998/07/12 03:44:45 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Messengers for /vis~/camera commands - John Allison 6th April 1998.
#ifndef G4VISCOMMANDSCAMERAMESSENGERS_HH
#define G4VISCOMMANDSCAMERAMESSENGERS_HH
#include "globals.hh"
#include "G4UImessenger.hh"
class G4UIcommand;
class G4VisCommandsCameraSetMessenger: public G4UImessenger {
public:
G4VisCommandsCameraSetMessenger ();
~G4VisCommandsCameraSetMessenger ();
G4String GetCurrentValue(G4UIcommand * command);
void SetNewValue (G4UIcommand* command, G4String newValues);
private:
G4UIcommand* fpCommand;
};
#endif
@@ -0,0 +1,103 @@
// 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: G4VisCommandsClear.hh,v 2.2 1998/07/12 03:09:58 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/clear/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSCLEAR_HH
#define G4VISCOMMANDSCLEAR_HH
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4ViewParameters.hh"
//////////////////////////////////////////////////// /vis~/clear/... ////
//vis \hline
//vis /vis~/clear/ &&
//vis ...menu of clear commands. \\%
class G4VisCommandClear {
public:
G4String GetCommandName () const {return "/vis~/clear/";}
G4String GetGuidance () const {
return "...menu of clear commands.";
}
};
///////////////////////////////////////// /vis~/clear/scene ////
//clear \hline
//clear /vis~/clear/scene &&
//clear Clears current scene and scene data and marks all its views
//clear as needing refreshing (but does not clear them). \\%
class G4VisCommandClearScene {
public:
G4String GetCommandName () const {return "/vis~/clear/scene";}
G4String GetGuidance () const {
return "Clears current scene and scene data and marks all its views"
" as needing refreshing (but does not clear them).";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
pVMan -> ClearScene ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
}
}
};
//////////////////////////////////////// /vis~/clear/view ////
//clear \hline
//clear /vis~/clear/view &&
//clear Clears visible window of current view. \\%
class G4VisCommandClearView {
public:
G4String GetCommandName () const {return "/vis~/clear/view";}
G4String GetGuidance () const {
return "Clears visible window of current view.";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
pVMan -> ClearView ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
}
}
};
/////////////////////////////////////// /vis~/clear/view_and_scene ////
//clear \hline
//clear /vis~/clear/view\_and\_scene &&
//clear Combination command. \\%
class G4VisCommandClearViewAndScene {
public:
G4String GetCommandName () const {return "/vis~/clear/view_and_scene";}
G4String GetGuidance () const {
return "Combination command.";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
pVMan -> ClearView ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
pVMan -> ClearScene ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
}
}
};
#endif
@@ -0,0 +1,109 @@
// 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: G4VisCommandsCopy.hh,v 2.2 1998/07/12 03:09:59 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/copy/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSCOPY_HH
#define G4VISCOMMANDSCOPY_HH
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4ViewParameters.hh"
//////////////////////////////////////////////////// /vis~/copy/... ////
//vis \hline
//vis /vis~/copy/ &&
//vis ...menu of copy commands. \\%
class G4VisCommandCopy {
public:
G4String GetCommandName () const {return "/vis~/copy/";}
G4String GetGuidance () const {
return "...menu of copy commands.";
}
};
////////////////////////////////////////////// /vis~/copy/all ////
//copy \hline
//copy /vis~/copy/all &&
//copy Copy all data of current scene and view into current memory.
//copy WARNING: this overwrites the current scene data and
//copy current view parameters. \\%
class G4VisCommandCopyAll {
public:
G4String GetCommandName () const {return "/vis~/copy/all";}
G4String GetGuidance () const {
return "Copy all data of current scene and view into current memory."
" WARNING: this overwrites the current scene data and "
"current view parameters.";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
pVMan -> CopyScene ();
pVMan -> CopyView ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentScene ();
}
}
}
};
////////////////////////////////////////// /vis~/copy/scene ////
//copy \hline
//copy /vis~/copy/scene &&
//copy Copy scene data of current scene into current scene data.
//copy WARNING: this overwrites the current scene data. \\%
class G4VisCommandCopyScene {
public:
G4String GetCommandName () const {return "/vis~/copy/scene";}
G4String GetGuidance () const {
return "Copy scene data of current scene into current scene data."
" WARNING: this overwrites the current scene data.";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
pVMan -> CopyScene ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentScene ();
}
}
}
};
////////////////////////////////////////// /vis~/copy/view ////
//copy \hline
//copy /vis~/copy/view &&
//copy Copy view parameters of current view into current view parameters.
//copy WARNING: this overwrites the current view parameters. \\%
class G4VisCommandCopyView {
public:
G4String GetCommandName () const {return "/vis~/copy/view";}
G4String GetGuidance () const {
return "Copy view parameters of current view into current view parameters."
" WARNING: this overwrites the current view parameters.";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
pVMan -> CopyView ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
}
}
};
#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: G4VisCommandsCreateScene.hh,v 2.2 1998/07/12 03:10:00 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/create_scene/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSCREATESCENE_HH
#define G4VISCOMMANDSCREATESCENE_HH
#include "globals.hh"
#include "G4UImanager.hh"
///////////////////////////////////////////// /vis~/create_scene/... ////
//vis \hline
//vis /vis~/create\_scene/ &&
//vis ...menu of scene creation commands. \\%
class G4VisCommandCreateScene {
public:
G4String GetCommandName () const {return "/vis~/create_scene/";}
G4String GetGuidance () const {
return "...menu of scene creation commands.";
}
};
////////////////////////////////// /vis~/create_scene/clear ////
//cr_sc \hline
//cr_sc /vis~/create\_scene/clear &&
//cr_sc Same as {\tt /vis~/clear/scene}. \\%
class G4VisCommandCreateSceneClear {
public:
G4String GetCommandName () const {return "/vis~/create_scene/clear";}
G4String GetGuidance () const {
return "Same as /vis~/clear/scene.";
}
void SetValue () {
G4UImanager* UI = G4UImanager::GetUIpointer ();
UI -> ApplyCommand("/vis~/clear/scene");
}
};
#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: G4VisCommandsCreateView.hh,v 2.3 1998/10/14 14:15:07 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/create_view/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSCREATEVIEW_HH
#define G4VISCOMMANDSCREATEVIEW_HH
#include "globals.hh"
#include "G4VisManager.hh"
///////////////////////////////////////////// /vis~/create_view/... ////
//vis \hline
//vis /vis~/create\_view/ &&
//vis ...menu of view creation commands. \\%
class G4VisCommandCreateView {
public:
G4String GetCommandName () const {return "/vis~/create_view/";}
G4String GetGuidance () const {
return "...menu of view creation commands.";
}
};
// //////////////////////////////// /vis~/create_view/new_scene ////
// //cr_vw \hline
// //cr_vw /vis~/create\_view/new\_scene &&
// //cr_vw Creates a new scene and a new view; both become current. \\%
class G4VisCommandCreateViewNewScene {
public:
G4String GetCommandName () const {return "/vis~/create_view/new_scene";}
G4String GetGuidance () const {
return "Creates a new scene and a new view; both become current.";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
pVMan -> CreateScene ();
pVMan -> CreateView ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentScene ();
}
}
}
};
//////////////////////////////// /vis~/create_view/new_view ////
//cr_vw \hline
//cr_vw /vis~/create\_view/new\_view &&
//cr_vw Creates a new view of current scene; new view becomes
//cr_vw current view. \\%
class G4VisCommandCreateViewNewView {
public:
G4String GetCommandName () const {return "/vis~/create_view/new_view";}
G4String GetGuidance () const {
return "Creates a new view of current scene; new view becomes "
"current view.";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
pVMan -> CreateView ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
}
}
};
#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: G4VisCommandsDelete.hh,v 2.2 1998/07/12 03:10:02 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/delete/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSDELETE_HH
#define G4VISCOMMANDSDELETE_HH
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4ViewParameters.hh"
//////////////////////////////////////////////////// /vis~/delete/... ////
//vis \hline
//vis /vis~/delete/ &&
//vis ...menu of deleting possibilities. \\%
class G4VisCommandDelete {
public:
G4String GetCommandName () const {return "/vis~/delete/";}
G4String GetGuidance () const {
return "...menu of deleting possibilities.";
}
};
/////////////////////////////////////////// /vis~/delete/scene ////
//delete \hline
//delete /vis~/delete/scene &&
//delete Deletes the current scene and its views. \\%
class G4VisCommandDeleteScene {
public:
G4String GetCommandName () const {return "/vis~/delete/scene";}
G4String GetGuidance () const {
return "Deletes the current scene and its views.";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
pVMan -> DeleteCurrentScene ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
}
};
/////////////////////////////////////////// /vis~/delete/view ////
//delete \hline
//delete /vis~/delete/view &&
//delete Deletes the current view. \\%
class G4VisCommandDeleteView {
public:
G4String GetCommandName () const {return "/vis~/delete/view";}
G4String GetGuidance () const {
return "Deletes the current view.";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
pVMan -> DeleteCurrentView ();
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
}
};
#endif
@@ -0,0 +1,57 @@
// 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: G4VisCommandsDraw.hh,v 2.3 1998/07/16 01:59:27 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/draw/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSDRAW_HH
#define G4VISCOMMANDSDRAW_HH
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4ViewParameters.hh"
//////////////////////////////////////////////////// /vis~/draw/... ////
//vis \hline
//vis /vis~/draw/ &&
//vis ...menu of drawing possibilities. \\%
class G4VisCommandDraw {
public:
G4String GetCommandName () const {return "/vis~/draw/";}
G4String GetGuidance () const {
return "...menu of drawing possibilities.";
}
};
/////////////////////////////////////////// /vis~/draw/current ////
//draw \hline
//draw /vis~/draw/current &&
//draw Draws the current scene in the current view using the current
//draw view parameters. \\%
class G4VisCommandDrawCurrent {
public:
G4String GetCommandName () const {return "/vis~/draw/current";}
G4String GetGuidance () const {
return "Draws the current scene in the current view using the current "
"view parameters.";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
pVMan -> Draw ();
}
}
};
#endif
@@ -0,0 +1,63 @@
// 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: G4VisCommandsLights.hh,v 2.3 1998/07/13 17:12:16 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/lights/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSLIGHTS_HH
#define G4VISCOMMANDSLIGHTS_HH
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4ViewParameters.hh"
//////////////////////////////////////////////////// /vis~/lights/... ////
//vis \hline
//vis /vis~/lights/ &&
//vis ...menu of lights commands. \\%
class G4VisCommandLights {
public:
G4String GetCommandName () const {return "/vis~/lights/";}
G4String GetGuidance () const {
return "...menu of lights commands.";
}
};
/////////////////////////////////////// /vis~/lights/move_with_camera ////
//lights \hline
//lights /vis~/lights/move\_with\_camera & true/false &
//lights Lights move with change of viewpoint. \\%
class G4VisCommandLightsMoveWithCamera {
public:
G4String GetCommandName () const {return "/vis~/lights/move_with_camera";}
G4String GetGuidance () const {
return "Lights move with change of viewpoint.";
}
G4String GetValueName () const {return "lights move flag";}
G4bool GetValue () const {
return G4VisManager::GetInstance () -> GetCurrentViewParameters ().
GetLightsMoveWithCamera ();
}
void SetValue (G4bool value) {
G4VisManager* pVMan = G4VisManager::GetInstance ();
pVMan -> SetCurrentViewParameters ().SetLightsMoveWithCamera (value);
G4VView* pView = pVMan -> GetCurrentView ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (pVMan -> GetCurrentViewParameters ());
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << endl;
}
};
#endif
@@ -0,0 +1,34 @@
// 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: G4VisCommandsPrint.hh,v 2.3 1998/07/16 01:59:28 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/print/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSPRINT_HH
#define G4VISCOMMANDSPRINT_HH
#include "globals.hh"
//////////////////////////////////////////////////// /vis~/print/... ////
//vis \hline
//vis /vis~/print/ &&
//vis ...menu of printing possibilities, also controlled by ``Verbose''
//vis parameter. \\%
class G4VisCommandPrint {
public:
G4String GetCommandName () const {return "/vis~/print/";}
G4String GetGuidance () const {
return "...menu of printing possibilities, also controlled by \"Verbose\" "
"parameter.";
}
};
#endif
@@ -0,0 +1,54 @@
// 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: G4VisCommandsRefresh.hh,v 2.2 1998/07/12 03:10:05 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/refresh/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSREFRESH_HH
#define G4VISCOMMANDSREFRESH_HH
#include "globals.hh"
#include "G4VisManager.hh"
/////////////////////////////////////////////////// /vis~/refresh/... ////
//vis \hline
//vis /vis~/refresh/ &&
//vis ...menu of refresh commands. \\%
class G4VisCommandRefresh {
public:
G4String GetCommandName () const {return "/vis~/refresh/";}
G4String GetGuidance () const {
return "...menu of refresh commands.";
}
};
///////////////////////////////////////////// /vis~/refresh/view ////
//view \hline
//view /vis~/refresh/view &&
//view Optimal redraw of current view of current scene - uses
//view double buffer and graphical database, if any. \\%
class G4VisCommandRefreshView {
public:
G4String GetCommandName () const {return "/vis~/refresh/view";}
G4String GetGuidance () const {
return "Optimal redraw of current view of current scene - uses "
"double buffer and graphical database, if any.";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
pVMan -> RefreshCurrentView ();
// Soft clear - clears back buffer only on double-buffered systems.
}
}
};
#endif
@@ -0,0 +1,91 @@
// 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: G4VisCommandsScene.hh,v 2.8 1998/12/09 23:56:23 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// /vis/scene commands - John Allison 9th August 1998
#ifndef G4VISCOMMANDSSCENE_HH
#define G4VISCOMMANDSSCENE_HH
#include "G4VVisCommand.hh"
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithoutParameter;
class G4VVisCommandScene: public G4VVisCommand {
public:
// Uses compiler defaults for destructor, copy constructor and assignment.
G4VVisCommandScene ();
protected:
void UpdateCandidateLists ();
void UpdateVisManagerSceneDataAndViewParameters
(const G4String& sceneName = "");
static G4String fSceneNameList;
// member so that it has long life - static because shared between objects.
};
class G4VisCommandSceneCreate: public G4VVisCommandScene {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneCreate ();
~G4VisCommandSceneCreate ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4String NextName ();
G4UIcmdWithAString* fpCommand;
G4int fId;
};
class G4VisCommandSceneList: public G4VVisCommandScene {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneList ();
~G4VisCommandSceneList ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcommand* fpCommand;
};
class G4VisCommandSceneNotifyHandlers: public G4VVisCommandScene {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneNotifyHandlers ();
~G4VisCommandSceneNotifyHandlers ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
class G4VisCommandSceneRemove: public G4VVisCommandScene {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneRemove ();
~G4VisCommandSceneRemove ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
class G4VisCommandSceneSelect: public G4VVisCommandScene {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneSelect ();
~G4VisCommandSceneSelect ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
#endif
@@ -0,0 +1,40 @@
// 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: G4VisCommandsSceneAdd.hh,v 2.1 1998/08/22 16:40:56 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// /vis/scene commands - John Allison 9th August 1998
#ifndef G4VISCOMMANDSSCENEADD_HH
#define G4VISCOMMANDSSCENEADD_HH
#include "G4VisCommandsScene.hh"
class G4VisCommandSceneAddVolume: public G4VVisCommandScene {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneAddVolume ();
~G4VisCommandSceneAddVolume ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcommand* fpCommand;
};
class G4VisCommandSceneAddGhosts: public G4VVisCommandScene {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneAddGhosts ();
~G4VisCommandSceneAddGhosts ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
#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: G4VisCommandsSceneHandler.hh,v 1.3 1998/12/09 23:56:24 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// /vis/sceneHandler commands - John Allison 10th October 1998
#ifndef G4VISCOMMANDSSCENEHANDLER_HH
#define G4VISCOMMANDSSCENEHANDLER_HH
#include "G4VVisCommand.hh"
class G4UIcommand;
class G4UIcmdWithAString;
class G4VVisCommandSceneHandler: public G4VVisCommand {
public:
// Uses compiler defaults for destructor, copy constructor and assignment.
G4VVisCommandSceneHandler ();
protected:
void UpdateCandidateLists ();
static G4String fSceneHandlerNameList;
// member so that it has long life - static because shared between objects.
};
class G4VisCommandSceneHandlerAttach: public G4VVisCommandSceneHandler {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneHandlerAttach ();
~G4VisCommandSceneHandlerAttach ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
class G4VisCommandSceneHandlerCreate: public G4VVisCommandSceneHandler {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneHandlerCreate ();
~G4VisCommandSceneHandlerCreate ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4String NextName ();
G4UIcommand* fpCommand;
G4int fId;
};
class G4VisCommandSceneHandlerList: public G4VVisCommandSceneHandler {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneHandlerList ();
~G4VisCommandSceneHandlerList ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcommand* fpCommand;
};
class G4VisCommandSceneHandlerRemove: public G4VVisCommandSceneHandler {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneHandlerRemove ();
~G4VisCommandSceneHandlerRemove ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
class G4VisCommandSceneHandlerSelect: public G4VVisCommandSceneHandler {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneHandlerSelect ();
~G4VisCommandSceneHandlerSelect ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
#endif
@@ -0,0 +1,40 @@
// 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: G4VisCommandsSceneInclude.hh,v 2.1 1998/08/27 15:32:34 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// /vis/scene commands - John Allison 9th August 1998
#ifndef G4VISCOMMANDSSCENEINCLUDE_HH
#define G4VISCOMMANDSSCENEINCLUDE_HH
#include "G4VisCommandsScene.hh"
class G4VisCommandSceneIncludeHits: public G4VVisCommandScene {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneIncludeHits ();
~G4VisCommandSceneIncludeHits ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithoutParameter* fpCommand;
};
class G4VisCommandSceneIncludeTrajectories: public G4VVisCommandScene {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandSceneIncludeTrajectories ();
~G4VisCommandSceneIncludeTrajectories ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithoutParameter* fpCommand;
};
#endif
@@ -0,0 +1,125 @@
// 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: G4VisCommandsSet.hh,v 2.3 1998/07/13 17:12:17 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/set/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSSET_HH
#define G4VISCOMMANDSSET_HH
#include "globals.hh"
#include "G4VisManager.hh"
#include "G4ViewParameters.hh"
//////////////////////////////////////////////////// /vis~/set/... ////
//vis \hline
//vis /vis~/set/ &&
//vis ...menu of set commands. \\%
class G4VisCommandSet {
public:
G4String GetCommandName () const {return "/vis~/set/";}
G4String GetGuidance () const {
return "...menu of set commands.";
}
};
/////////////////////////////////////////// /vis~/set/culling ////
//set \hline
//set /vis~/set/culling & true/false &
//set Global culling flag. Does not change specific culling flags. \\%
class G4VisCommandSetCulling {
public:
G4String GetCommandName () const {return "/vis~/set/culling";}
G4String GetGuidance () const {
return "Global culling flag. Does not change specific culling flags.";
}
G4String GetValueName () const {return "global culling flag";}
G4bool GetValue () const {
return G4VisManager::GetInstance () -> GetCurrentViewParameters ().
IsCulling ();
}
void SetValue (G4bool value) {
G4VisManager* pVMan = G4VisManager::GetInstance ();
pVMan -> SetCurrentViewParameters ().SetCulling (value);
G4VView* pView = pVMan -> GetCurrentView ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (pVMan -> GetCurrentViewParameters ());
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << endl;
}
};
////////////////////////////////////////// /vis~/set/cull_covered_daughters
//set \hline
//set /vis~/set/ cull\_covered\_daughters & true/false &
//set Cull (i.e., do not Draw) daughters covered by opaque mothers. \\%
class G4VisCommandSetCullCoveredDaughters {
public:
G4String GetCommandName () const {return "/vis~/set/cull_covered_daughters";}
G4String GetGuidance () const {
return "Cull (i.e., do not Draw) daughters covered by opaque mothers.";
}
G4String GetValueName () const {return "culling covered daughters flag";}
G4bool GetValue () const {
return G4VisManager::GetInstance () -> GetCurrentViewParameters ().
IsCullingCovered ();
}
void SetValue (G4bool value) {
G4cout << "\nNote: this is only effective in surface drawing style,"
"\nand then only if the volumes are visible and opaque, and then"
"\nonly if no sections or cutways are in operation."
<< endl;
G4VisManager* pVMan = G4VisManager::GetInstance ();
pVMan -> SetCurrentViewParameters ().SetCullingCovered (value);
G4VView* pView = pVMan -> GetCurrentView ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (pVMan -> GetCurrentViewParameters ());
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << endl;
}
};
////////////////////////////////////////// /vis~/set/cull_invisible_objects
//set \hline
//set /vis~/set/ cull\_invisible\_objects & true/false &
//set Cull (i.e., do not Draw) ``invisible'' objects. \\%
class G4VisCommandSetCullInvisible {
public:
G4String GetCommandName () const {return "/vis~/set/cull_invisible_objects";}
G4String GetGuidance () const {
return "Cull (i.e., do not Draw) \"invisible\" objects.";
}
G4String GetValueName () const {return "culling invisible objects flag";}
G4bool GetValue () const {
return G4VisManager::GetInstance () -> GetCurrentViewParameters ().
IsCullingInvisible ();
}
void SetValue (G4bool value) {
G4VisManager* pVMan = G4VisManager::GetInstance ();
pVMan -> SetCurrentViewParameters ().SetCullingInvisible (value);
G4VView* pView = pVMan -> GetCurrentView ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (pVMan -> GetCurrentViewParameters ());
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << endl;
}
};
#endif
@@ -0,0 +1,58 @@
// 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: G4VisCommandsShow.hh,v 2.2 1998/07/12 03:10:07 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// /vis~/show/ commands
// John Allison 7th September 1997
#ifndef G4VISCOMMANDSSHOW_HH
#define G4VISCOMMANDSSHOW_HH
#include "globals.hh"
#include "G4VisManager.hh"
/////////////////////////////////////////////////// /vis~/show/... ////
//vis \hline
//vis /vis~/show/ &&
//vis ...menu of show commands. \\%
class G4VisCommandShow {
public:
G4String GetCommandName () const {return "/vis~/show/";}
G4String GetGuidance () const {
return "...menu of show commands.";
}
};
//////////////////////////////////////////// /vis~/show/view ////
//view \hline
//view /vis~/show/view &&
//view Make the view visible, if not so already (initiates
//view post-processing for
//view graphics systems which use such techniques). \\%
class G4VisCommandShowView {
public:
G4String GetCommandName () const {return "/vis~/show/view";}
G4String GetGuidance () const {
return "Make the view visible, if not so already (initiates "
"post-processing for "
"graphics systems which use such techniques).";
}
void SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
}
pVMan -> Show ();
}
}
};
#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: G4VisCommandsViewer.hh,v 2.3 1998/12/09 23:56:25 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// /vis/viewer commands - John Allison 25th October 1998
#ifndef G4VISCOMMANDSVIEWER_HH
#define G4VISCOMMANDSVIEWER_HH
#include "G4VVisCommand.hh"
class G4UIcommand;
class G4UIcmdWithAString;
class G4VVisCommandViewer: public G4VVisCommand {
public:
// Uses compiler defaults for destructor, copy constructor and assignment.
G4VVisCommandViewer ();
protected:
G4String ShortName (const G4String &);
void UpdateCandidateLists ();
static G4String fViewerNameList;
// member so that it has long life - static because shared between objects.
};
class G4VisCommandViewerCreate: public G4VVisCommandViewer {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandViewerCreate ();
~G4VisCommandViewerCreate ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4String NextName ();
G4UIcommand* fpCommand;
G4int fId;
};
class G4VisCommandViewerList: public G4VVisCommandViewer {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandViewerList ();
~G4VisCommandViewerList ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcommand* fpCommand;
};
class G4VisCommandViewerRemove: public G4VVisCommandViewer {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandViewerRemove ();
~G4VisCommandViewerRemove ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
class G4VisCommandViewerSelect: public G4VVisCommandViewer {
public:
// Uses compiler defaults for copy constructor and assignment.
G4VisCommandViewerSelect ();
~G4VisCommandViewerSelect ();
G4String GetCurrentValue (G4UIcommand* command);
void SetNewValue (G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
#endif
@@ -0,0 +1,18 @@
// 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: G4VisFeaturesOfDAWNFILE.hh,v 2.0 1998/07/02 16:49:28 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4VISFEATURESOFDAWNFILE_HH
#define G4VISFEATURESOFDAWNFILE_HH
#include "globals.hh"
G4String G4VisFeaturesOfDAWNFILE ();
#endif
@@ -0,0 +1,20 @@
// 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: G4VisFeaturesOfFukuiRenderer.hh,v 2.0 1998/07/02 16:49:29 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#ifndef G4VISFEATURESOFFUKUIRENDERER_HH
#define G4VISFEATURESOFFUKUIRENDERER_HH
#include "globals.hh"
G4String G4VisFeaturesOfFukuiRenderer ();
#endif
@@ -0,0 +1,25 @@
// 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: G4VisFeaturesOfOpenGL.hh,v 2.0 1998/07/02 16:49:31 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#ifndef G4VISFEATURESOFOPENGL_HH
#define G4VISFEATURESOFOPENGL_HH
#include "globals.hh"
G4String G4VisFeaturesOfOpenGLIX ();
G4String G4VisFeaturesOfOpenGLSX ();
G4String G4VisFeaturesOfOpenGLIXm ();
G4String G4VisFeaturesOfOpenGLSXm ();
G4String G4VisFeaturesOfOpenGLIWin32 ();
G4String G4VisFeaturesOfOpenGLSWin32 ();
#endif
@@ -0,0 +1,20 @@
// 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: G4VisFeaturesOfOpenInventor.hh,v 1.1 1998/09/11 15:11:11 jkallenb Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#ifndef G4VISFEATURESOFOPENINVENTOR_HH
#define G4VISFEATURESOFOPENINVENTOR_HH
#include "globals.hh"
G4String G4VisFeaturesOfOpenInventor ();
#endif
@@ -0,0 +1,20 @@
// 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: G4VisFeaturesOfRay.hh,v 2.0 1998/07/02 16:49:32 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
#ifndef G4VISFEATURESRAY_HH
#define G4VISFEATURESRAY_HH
#include "globals.hh"
G4String G4VisFeaturesOfRayX ();
#endif
@@ -0,0 +1,62 @@
// 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: G4VisManMessenger.hh,v 2.2 1998/07/12 03:44:48 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
#ifndef G4VISMANMESSENGER_HH
#define G4VISMANMESSENGER_HH
#include "G4UImessenger.hh"
#include "globals.hh"
#include <rw/tpordvec.h>
class G4VisManager;
class G4UIcommand;
class G4VisManMessenger: public G4UImessenger {
public:
G4VisManMessenger (G4VisManager* pVMan);
~G4VisManMessenger ();
void SetNewValue (G4UIcommand* command, G4String newValues);
G4String GetCurrentValue (G4UIcommand* command);
private:
void AddCommandCamera ();
// void AddCommandClear ();
// void AddCommandCopy ();
// void AddCommandCreateScene ();
void AddCommandCreateView ();
void AddCommandDraw ();
void AddCommandLights ();
// void AddCommandPrint ();
// void AddCommandRefresh ();
void AddCommandSet ();
// void AddCommandShow ();
void AddCommandExpert ();
void DoCommandCamera (const G4String& commandPath, G4String& newValues);
// void DoCommandClear (const G4String& commandPath, G4String& newValues);
// void DoCommandCopy (const G4String& commandPath, G4String& newValues);
// void DoCommandCreateScene (const G4String& commandPath, G4String& newValues);
void DoCommandCreateView (const G4String& commandPath, G4String& newValues);
void DoCommandDraw (const G4String& commandPath, G4String& newValues);
void DoCommandLights (const G4String& commandPath, G4String& newValues);
// void DoCommandPrint (const G4String& commandPath, G4String& newValues);
// void DoCommandRefresh (const G4String& commandPath, G4String& newValues);
void DoCommandSet (const G4String& commandPath, G4String& newValues);
// void DoCommandShow (const G4String& commandPath, G4String& newValues);
void DoCommandExpert (const G4String& commandPath, G4String& newValues);
G4bool ViewValid ();
void RotateViewpointAboutUpVectorBy (G4double dbeta);
G4VisManager* fpVMan;
RWTPtrOrderedVector <G4UIcommand> fCommandList;
};
#endif
@@ -0,0 +1,243 @@
// 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: G4VisManager.hh,v 2.10 1998/11/29 15:34:03 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// The GEANT4 Visualization Manager - John Allison 02/Jan/1996.
// This is a "Singleton", i.e., only one instance of it may exist. A
// G4Exception is thrown if an attempt to instantiate more than one is
// made.
// Graphics system registration is normally Done through the protected
// pure virtual function RegisterGraphicsSystems called from
// Initialise (). You must define your own subclass and implement
// RegisterGraphicsSystems. You can also use the public function
// RegisterGraphicsSystem (new MyGraphicsSystem) if you have your own
// graphics system.
// The VisManager creates graphics systems, scenes and views and
// manages them. You can have any number. It has the concept of a
// "current view", and the "current scene" and "current graphics
// system" which go with it. You can select the current view. Most
// of the the operations of the VisManager take place on the current
// view, in particular, the Draw operations.
// Each scene has its "scene data".
// Each view has its "view parameters".
// The VisManager also has the concept of "current scene data" and
// "current view parameters" which, in general, will be different to
// those of any scene or view. When a view is drawn, it is given the
// current data and parameters; this might trigger "consequent
// actions", such as reconstruction of display lists. If the
// differences are minor, e.g, if only the viewpoint direction has
// changed, then it might not be necessary to reconstruct the display
// lists - each system must decide.
// G4VisManager is "state dependent", i.e., it is notified on change
// of state (G4ApplicationState). This is used to draw hits and
// trajectories in the current scene at the end of event, as required.
#ifndef G4VISMANAGER_HH
#define G4VISMANAGER_HH
#include "G4VVisManager.hh"
#include "globals.hh"
#include "G4GraphicsSystemList.hh"
#include "G4SceneList.hh"
#include "G4SceneData.hh"
#include "G4SceneDataObjectList.hh"
#include "G4ViewParameters.hh"
#include "G4Transform3D.hh"
#include "G4UImessenger.hh"
#include "G4VStateDependent.hh"
#include <rw/tpordvec.h>
class G4VisManMessenger;
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4VSolid;
class G4VGraphicsSystem;
class G4VScene;
class G4VView;
class G4Polyline;
class G4Text;
class G4Circle;
class G4Square;
class G4Polymarker;
class G4Polyhedron;
class G4NURBS;
class G4VisManager: public G4VVisManager, public G4VStateDependent {
public:
G4VisManager ();
virtual ~G4VisManager ();
static G4VisManager* GetInstance ();
// Returns pointer to itself. Throws a G4Exception if called before
// instantiation. The general user should instead use
// G4VVisManager::GetConcreteInstance() to get a "higher level"
// pointer for general use - but always test for non-zero.
void Initialise ();
void Initialize (); // Alias Initialise ().
G4bool RegisterGraphicsSystem (G4VGraphicsSystem* pSystem);
//////////////////////////////////////////////////////////////////////
// Drawing routines!
void Clear ();
// Clear current scene and current view, marking all its views as
// needing refreshing. This is a comprehensive clear which clears
// both framebuffers of a double buffered system and clears the
// scene's graphics databse (display lists, etc.) and clears the
// current scene data.
void ClearScene ();
// Clear current scene, marking all its views as needing refreshing.
// Clears the scene's graphics databse (display lists, etc.)
// Clears the current scene data.
void ClearView ();
// Clear visible window of current view (both buffers of a double
// buffered system).
void Draw ();
// Draw current scene in current view.
void Show ();
// Show current view (for graphics systems which require to process
// all drawn objects before finalising the view).
// Now functions for drawing hits, digis, etc. These are treated as
// "transients", in contrast to the scene (as defined by the Scene
// Data), which is treated as "permanent". The crucial difference
// is that a scene can be recreated by a visit to the GEANT4 kernel
// if the graphics system requires it; transient objects cannot.
void Draw (const G4Polyline&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4Text&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4Circle&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4Square&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4Polymarker&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4Polyhedron&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4NURBS&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
// Now Follow functions for drawing a GEANT4 geometry object. Note
// that the 2nd argument overrides any visualization attributes that
// are associated with the object itself.
void Draw (const G4VSolid&, const G4VisAttributes&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4LogicalVolume&, const G4VisAttributes&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
void Draw (const G4VPhysicalVolume&, const G4VisAttributes&,
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
G4bool Notify (G4ApplicationState requestedState);
// This is called on change of state (G4ApplicationState). It is
// used to draw hits and trajectories in the current scene at the
// end of event, as required.
////////////////////////////////////////////////////////////////////////
// Administration routines.
void ClearCurrentSceneData ();
void CopyScene ();
// Copy scene data of current scene into current scene data.
void CopyView ();
// Copy view parameters of current view into current view parameters.
void CreateScene (G4String name = "");
// Creates scene of the current system.
void CreateView (G4String name = "");
// Creates view of the current scene.
void DeleteCurrentScene (); // Leaves current scene and view undefined!
void DeleteCurrentView (); // Leaves current scene and view undefined!
void GeometryHasChanged (); // Used by run manager to notify change.
void RefreshCurrentView (); // Soft clear, then redraw.
void PrintCurrentSystem () const;
void PrintCurrentSystems () const;
void PrintCurrentScene () const;
void PrintCurrentView () const;
/////////////////////////////////////////////////////////////////////
// Access functions.
G4VGraphicsSystem* GetCurrentGraphicsSystem () const;
G4VScene* GetCurrentScene () const;
G4VView* GetCurrentView () const;
const G4SceneData& GetCurrentSceneData () const;
const G4ViewParameters& GetCurrentViewParameters () const;
const G4GraphicsSystemList& GetAvailableGraphicsSystems ();
// The above is non-const because it checks and updates the List by
// calling RegisterGraphicsSystems() if no graphics systems are
// already registered.
const G4SceneList& GetAvailableScenes () const;
const G4SceneDataObjectList& GetSceneDataObjectList () const;
G4int GetVerboseLevel () const;
G4bool IsValidView ();
void SetCurrentGraphicsSystemAndCreateView
(G4VGraphicsSystem* pSystem);
void SetCurrentGraphicsSystem (G4VGraphicsSystem* pSystem);
void SetCurrentScene (G4VScene* pScene);
void SetCurrentView (G4VView* pView);
G4SceneData& SetCurrentSceneData (); // Returns lvalue.
G4ViewParameters& SetCurrentViewParameters (); // Returns lvalue.
G4SceneList& SetAvailableScenes (); // Returns lvalue.
G4SceneDataObjectList& SetSceneDataObjectList (); // Returns lvalue.
void SetVerboseLevel (G4int vLevel);
protected:
virtual void RegisterGraphicsSystems () = 0;
void RegisterMessengers (); // Command messengers.
void PrintAllGraphicsSystems () const;
void PrintInstalledGraphicsSystems () const;
void PrintAvailableGraphicsSystems () const;
void PrintInvalidPointers () const;
static G4VisManager* fpInstance; // Pointer to single instance.
G4bool fInitialised;
G4VGraphicsSystem* fpGraphicsSystem; // Current graphics system.
G4VScene* fpScene; // Current graphics model.
G4VView* fpView; // Current view.
G4GraphicsSystemList fAvailableGraphicsSystems;
G4SceneList fAvailableScenes;
G4SceneDataObjectList fSceneDataObjectList;
G4SceneData fSD; // Current scene data object.
G4ViewParameters fVP; // Current viewing parameters.
G4int fVerbose; // Verbosity level 0-10.
G4VisManMessenger* fpMessenger; // Pointer to messenger.
RWTPtrOrderedVector <G4UImessenger> fMessengerList;
};
#include "G4VisManager.icc"
#endif
@@ -0,0 +1,73 @@
// 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: G4VisManager.icc,v 2.6 1998/11/06 13:43:08 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
inline void G4VisManager::Initialize () {
Initialise ();
}
inline G4VScene* G4VisManager::GetCurrentScene () const {
return fpScene;
}
inline G4VView* G4VisManager::GetCurrentView () const {
return fpView;
}
inline const G4SceneData& G4VisManager::GetCurrentSceneData () const {
return fSD;
}
inline const G4ViewParameters&
G4VisManager::GetCurrentViewParameters () const {
return fVP;
}
inline const G4SceneList&
G4VisManager::GetAvailableScenes () const {
return fAvailableScenes;
}
inline const G4SceneDataObjectList&
G4VisManager::GetSceneDataObjectList () const {
return fSceneDataObjectList;
}
inline G4VGraphicsSystem*
G4VisManager::GetCurrentGraphicsSystem () const {
return fpGraphicsSystem;
}
inline G4int G4VisManager::GetVerboseLevel () const {
return fVerbose;
}
inline G4SceneData& G4VisManager::SetCurrentSceneData () {
return fSD;
}
inline G4ViewParameters& G4VisManager::SetCurrentViewParameters () {
return fVP;
}
inline G4SceneDataObjectList&
G4VisManager::SetSceneDataObjectList () {
return fSceneDataObjectList;
}
inline G4SceneList& G4VisManager::SetAvailableScenes () {
return fAvailableScenes;
}
inline void G4VisManager::SetVerboseLevel (G4int vLevel) {
fVerbose = vLevel;
}
@@ -0,0 +1,30 @@
// 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: G4VisToOldVisCommands.hh,v 1.1 1998/12/09 23:54:58 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Implements some /vis/ commands as /vis~/ temporarily.
// John Allison 9th December 1998.
#ifndef G4VISTOOLDVISCOMMANDS_HH
#define G4VISTOOLDVISCOMMANDS_HH
#include "G4UImessenger.hh"
#include "globals.hh"
#include <rw/tpordvec.h>
class G4VisToOldVisCommands: public G4UImessenger {
public:
G4VisToOldVisCommands ();
~G4VisToOldVisCommands ();
void SetNewValue (G4UIcommand* command, G4String newValues);
};
#endif
@@ -0,0 +1,128 @@
// 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: MyVisManager.cc,v 2.4 1998/11/09 04:20:16 stanaka Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 24th January 1998.
#include "MyVisManager.hh"
// Supported drivers...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.hh"
#endif
#ifdef G4VIS_USE_DAWNFILE
#include "G4DAWNFILE.hh"
#endif
#ifdef G4VIS_USE_OPACS
#include "G4Wo.hh"
#include "G4Xo.hh"
#endif
#ifdef G4VIS_USE_OPENGLX
#include "G4OpenGLImmediateX.hh"
#include "G4OpenGLStoredX.hh"
#endif
#ifdef G4VIS_USE_OPENGLWIN32
#include "G4OpenGLImmediateWin32.hh"
#include "G4OpenGLStoredWin32.hh"
#endif
#ifdef G4VIS_USE_OPENGLXM
#include "G4OpenGLImmediateXm.hh"
#include "G4OpenGLStoredXm.hh"
#endif
#ifdef G4VIS_USE_OIX
#include "G4OpenInventorX.hh"
#endif
#ifdef G4VIS_USE_OIWIN32
#include "G4OpenInventorWin32.hh"
#endif
#ifdef G4VIS_USE_RAYX
#include "G4RayX.hh"
#endif
#ifdef G4VIS_USE_VRML
#include "G4VRML1.hh"
#include "G4VRML2.hh"
#endif
#ifdef G4VIS_USE_VRMLFILE
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
#endif
MyVisManager::MyVisManager () {}
void MyVisManager::RegisterGraphicsSystems () {
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
#ifdef G4VIS_USE_DAWNFILE
RegisterGraphicsSystem (new G4DAWNFILE);
#endif
#ifdef G4VIS_USE_OPACS
RegisterGraphicsSystem (new G4Wo);
RegisterGraphicsSystem (new G4Xo);
#endif
#ifdef G4VIS_USE_OPENGLX
RegisterGraphicsSystem (new G4OpenGLImmediateX);
RegisterGraphicsSystem (new G4OpenGLStoredX);
#endif
#ifdef G4VIS_USE_OPENGLWIN32
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
#endif
#ifdef G4VIS_USE_OPENGLXM
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
RegisterGraphicsSystem (new G4OpenGLStoredXm);
#endif
#ifdef G4VIS_USE_OIX
RegisterGraphicsSystem (new G4OpenInventorX);
#endif
#ifdef G4VIS_USE_OIWIN32
RegisterGraphicsSystem (new G4OpenInventorWin32);
#endif
#ifdef G4VIS_USE_RAYX
RegisterGraphicsSystem (new G4RayX);
#endif
#ifdef G4VIS_USE_VRML
RegisterGraphicsSystem (new G4VRML1);
RegisterGraphicsSystem (new G4VRML2);
#endif
#ifdef G4VIS_USE_VRMLFILE
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< endl;
PrintAvailableGraphicsSystems ();
}
}
@@ -0,0 +1,44 @@
// 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: MyVisManager.hh,v 2.3 1998/07/12 03:10:10 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 24th January 1998.
// Example Visualization Manager implementing virtual function
// RegisterGraphicsSystems. Exploits C-pre-processor variables
// G4VIS_USE_DAWN, etc., which are set by the GNUmakefiles if
// environment variables of the same name are set.
// So all you have to do is set environment variables and compile and
// instantiate this in your main().
// Alternatively, you can implement an empty function here and just
// register the systems you want in your main(), e.g.:
// G4VisManager* myVisManager = new MyVisManager;
// myVisManager -> RegisterGraphicsSystem (new MyGraphicsSystem);
#ifndef MYEXAMPLEVISMANAGER_HH
#define MYEXAMPLEVISMANAGER_HH
#include "G4VisManager.hh"
class MyVisManager: public G4VisManager {
public:
MyVisManager ();
private:
void RegisterGraphicsSystems ();
};
#endif