Import Geant4 0.1.0 source tree
This commit is contained in:
@@ -5,42 +5,38 @@
|
||||
// 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 $
|
||||
// $Id: G4VisManager.hh,v 1.5 1999/02/07 17:32:15 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
//
|
||||
//
|
||||
|
||||
// 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.
|
||||
// This is a "Singleton", i.e., only one instance may exist. A
|
||||
// G4Exception is thrown if an attempt is made to instantiate more
|
||||
// than one.
|
||||
|
||||
// Graphics system registration is normally Done through the protected
|
||||
// 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.
|
||||
// RegisterGraphicsSystems - for an example see
|
||||
// visualization/include/MyVisManager.hh/cc. 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.
|
||||
// The VisManager creates graphics systems, scenes, scene handlers and
|
||||
// viewers and manages them. You can have any number. It has the
|
||||
// concept of a "current viewer", and the "current scene handler", the
|
||||
// "current scene" and the "current graphics system" which go with it.
|
||||
// You can select the current viewer. Most of the the operations of
|
||||
// the VisManager take place with the current viewer, 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.
|
||||
// Each scene comprises drawable objects such as detector components
|
||||
// and hits when appropriate. A scene handler translates a scene into
|
||||
// graphics-system-specific function calls and, possibly, a
|
||||
// graphics-system-dependent database - display lists, scene graphs,
|
||||
// etc. Each viewer has its "view parameters".
|
||||
|
||||
// G4VisManager is "state dependent", i.e., it is notified on change
|
||||
// of state (G4ApplicationState). This is used to draw hits and
|
||||
@@ -53,9 +49,9 @@
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4GraphicsSystemList.hh"
|
||||
#include "G4SceneHandlerList.hh"
|
||||
#include "G4Scene.hh"
|
||||
#include "G4SceneList.hh"
|
||||
#include "G4SceneData.hh"
|
||||
#include "G4SceneDataObjectList.hh"
|
||||
#include "G4ViewParameters.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
@@ -68,8 +64,8 @@ class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
class G4VSolid;
|
||||
class G4VGraphicsSystem;
|
||||
class G4VScene;
|
||||
class G4VView;
|
||||
class G4VSceneHandler;
|
||||
class G4VViewer;
|
||||
class G4Polyline;
|
||||
class G4Text;
|
||||
class G4Circle;
|
||||
@@ -80,17 +76,61 @@ class G4NURBS;
|
||||
|
||||
class G4VisManager: public G4VVisManager, public G4VStateDependent {
|
||||
|
||||
// List of classes and functions which need access to private
|
||||
// members of G4VisManager. This is mainly to obtain access to
|
||||
// GetInstance (), which is private. The correct way for normal
|
||||
// users to obtain a pointer to the vis manager is with
|
||||
// G4VVisManager::GetConcreteInstance (), always testing for
|
||||
// non-zero.
|
||||
|
||||
friend void G4OpenGLXmViewerSecondaryLoopPostAction (); // Mmmm!
|
||||
|
||||
friend class G4VSceneHandler;
|
||||
friend class G4VViewer;
|
||||
|
||||
friend class ostream & operator <<
|
||||
(class ostream &, const class G4VGraphicsSystem &);
|
||||
|
||||
friend class ostream & operator <<
|
||||
(class ostream &, const class G4VSceneHandler &);
|
||||
|
||||
// Now classes associated with the old commands...
|
||||
friend class G4VisManMessenger;
|
||||
friend class G4VisCommandCameraReset;
|
||||
friend class G4VisCommandClearScene;
|
||||
friend class G4VisCommandClearView;
|
||||
friend class G4VisCommandClearViewAndScene;
|
||||
friend class G4VisCommandCopyAll;
|
||||
friend class G4VisCommandCopyScene;
|
||||
friend class G4VisCommandCopyView;
|
||||
friend class G4VisCommandCreateViewNewScene;
|
||||
friend class G4VisCommandCreateViewNewView;
|
||||
friend class G4VisCommandDeleteScene;
|
||||
friend class G4VisCommandDeleteView;
|
||||
friend class G4VisCommandDrawCurrent;
|
||||
friend class G4VisCommandLightsMoveWithCamera;
|
||||
friend class G4VisCommandRefreshView;
|
||||
friend class G4VisCommandSetCulling;
|
||||
friend class G4VisCommandSetCullCoveredDaughters;
|
||||
friend class G4VisCommandSetCullInvisible;
|
||||
friend class G4VisCommandShowView;
|
||||
|
||||
public:
|
||||
|
||||
G4VisManager ();
|
||||
|
||||
virtual ~G4VisManager ();
|
||||
|
||||
private:
|
||||
|
||||
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.
|
||||
// instantiation. Private so that only friends can use; the normal
|
||||
// user should instead use G4VVisManager::GetConcreteInstance () to
|
||||
// get a "higher level" pointer for general use - but always test
|
||||
// for non-zero.
|
||||
|
||||
public:
|
||||
|
||||
void Initialise ();
|
||||
void Initialize (); // Alias Initialise ().
|
||||
@@ -99,34 +139,20 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// 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
|
||||
// Clear visible window of current viewer (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).
|
||||
// Show current view (initiates post-procesing of graphical
|
||||
// databases for graphics systems which require it.)
|
||||
|
||||
// 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.
|
||||
// ///////////////////////////////////////////////////////////////
|
||||
// Now functions for drawing various visualization primitives,
|
||||
// useful for representing hits, digis, etc.
|
||||
|
||||
void Draw (const G4Polyline&,
|
||||
const G4Transform3D& objectTransformation = G4Transform3D::Identity);
|
||||
@@ -149,9 +175,10 @@ public:
|
||||
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.
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// Now 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);
|
||||
@@ -164,25 +191,34 @@ public:
|
||||
|
||||
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.
|
||||
// used to draw hits and trajectories if included 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 CopyViewParameters ();
|
||||
// Copy view parameters of current viewer into current view parameters.
|
||||
|
||||
void CreateSceneHandler (G4String name = "");
|
||||
// Creates scene handler for the current system.
|
||||
|
||||
void CreateViewer (G4String name = "");
|
||||
// Creates viewer for the current scene handler.
|
||||
|
||||
void DeleteCurrentSceneHandler ();
|
||||
// Leaves current scene handler and viewer undefined!
|
||||
|
||||
void DeleteCurrentViewer ();
|
||||
// Leaves current scene and view undefined!
|
||||
|
||||
void GeometryHasChanged ();
|
||||
// Used by run manager to notify change.
|
||||
|
||||
void RefreshCurrentView ();
|
||||
// Soft clear, then redraw.
|
||||
|
||||
// These can go when OLD STYLE commands go...
|
||||
void PrintCurrentSystem () const;
|
||||
void PrintCurrentSystems () const;
|
||||
void PrintCurrentScene () const;
|
||||
@@ -192,27 +228,27 @@ public:
|
||||
// Access functions.
|
||||
|
||||
G4VGraphicsSystem* GetCurrentGraphicsSystem () const;
|
||||
G4VScene* GetCurrentScene () const;
|
||||
G4VView* GetCurrentView () const;
|
||||
const G4SceneData& GetCurrentSceneData () const;
|
||||
G4Scene* GetCurrentScene () const;
|
||||
G4VSceneHandler* GetCurrentSceneHandler () const;
|
||||
G4VViewer* GetCurrentViewer () 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;
|
||||
const G4SceneHandlerList& GetAvailableSceneHandlers () const;
|
||||
const G4SceneList& GetSceneList () const;
|
||||
G4int GetVerboseLevel () const;
|
||||
G4bool IsValidView ();
|
||||
void SetCurrentGraphicsSystemAndCreateView
|
||||
void SetCurrentGraphicsSystemAndCreateViewer
|
||||
(G4VGraphicsSystem* pSystem);
|
||||
void SetCurrentGraphicsSystem (G4VGraphicsSystem* pSystem);
|
||||
void SetCurrentScene (G4VScene* pScene);
|
||||
void SetCurrentView (G4VView* pView);
|
||||
G4SceneData& SetCurrentSceneData (); // Returns lvalue.
|
||||
void SetCurrentScene (G4Scene*);
|
||||
void SetCurrentSceneHandler (G4VSceneHandler* pScene);
|
||||
void SetCurrentViewer (G4VViewer* pView);
|
||||
G4ViewParameters& SetCurrentViewParameters (); // Returns lvalue.
|
||||
G4SceneList& SetAvailableScenes (); // Returns lvalue.
|
||||
G4SceneDataObjectList& SetSceneDataObjectList (); // Returns lvalue.
|
||||
G4SceneHandlerList& SetAvailableSceneHandlers (); // Returns lvalue.
|
||||
G4SceneList& SetSceneList (); // Returns lvalue.
|
||||
void SetVerboseLevel (G4int vLevel);
|
||||
|
||||
protected:
|
||||
@@ -226,12 +262,12 @@ protected:
|
||||
static G4VisManager* fpInstance; // Pointer to single instance.
|
||||
G4bool fInitialised;
|
||||
G4VGraphicsSystem* fpGraphicsSystem; // Current graphics system.
|
||||
G4VScene* fpScene; // Current graphics model.
|
||||
G4VView* fpView; // Current view.
|
||||
G4Scene* fpScene; // Current scene.
|
||||
G4VSceneHandler* fpSceneHandler; // Current scene handler.
|
||||
G4VViewer* fpViewer; // Current viewer.
|
||||
G4GraphicsSystemList fAvailableGraphicsSystems;
|
||||
G4SceneList fAvailableScenes;
|
||||
G4SceneDataObjectList fSceneDataObjectList;
|
||||
G4SceneData fSD; // Current scene data object.
|
||||
G4SceneList fSceneList;
|
||||
G4SceneHandlerList fAvailableSceneHandlers;
|
||||
G4ViewParameters fVP; // Current viewing parameters.
|
||||
G4int fVerbose; // Verbosity level 0-10.
|
||||
G4VisManMessenger* fpMessenger; // Pointer to messenger.
|
||||
|
||||
Reference in New Issue
Block a user