Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
@@ -5,24 +5,27 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SceneData.cc,v 2.7 1998/11/29 15:34:05 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Scene.cc,v 1.3 1999/05/25 09:14:15 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// Scene data John Allison 19th July 1996.
#include "G4SceneData.hh"
#include "G4Scene.hh"
#include "G4Vector3D.hh"
#include "G4BoundingSphereScene.hh"
#include "G4VisAttributes.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4TransportationManager.hh"
G4SceneData::G4SceneData (const G4String& name):
G4Scene::G4Scene (const G4String& name):
fName (name)
{} // Note all data members have default initial values.
G4SceneData::~G4SceneData () {}
G4Scene::~G4Scene () {}
void G4SceneData::AddRunDurationModel (G4VModel* pModel) {
void G4Scene::AddRunDurationModel (G4VModel* pModel) {
fRunDurationModelList.append (pModel);
G4int nModels = fRunDurationModelList.entries ();
G4BoundingSphereScene boundingSphereScene;
@@ -44,12 +47,39 @@ void G4SceneData::AddRunDurationModel (G4VModel* pModel) {
fStandardTargetPoint = fExtent.GetExtentCentre ();
}
void G4SceneData::Clear () {
void G4Scene::AddWorldIfEmpty () {
if (IsEmpty ()) {
G4VPhysicalVolume* pWorld =
G4TransportationManager::GetTransportationManager ()
-> GetNavigatorForTracking () -> GetWorldVolume ();
if (pWorld) {
const G4VisAttributes* pVisAttribs =
pWorld -> GetLogicalVolume () -> GetVisAttributes ();
if (!pVisAttribs || pVisAttribs -> IsVisible ()) {
G4cout <<
"Your \"world\" has no vis attributes or is marked as visible."
"\n For a better view of the contents, mark the world as"
" invisible, e.g.,"
"\n myWorldLogicalVol ->"
" SetVisAttributes (G4VisAttributes::Invisible);"
<< endl;
}
AddRunDurationModel (new G4PhysicalVolumeModel (pWorld));
// Note: default depth and no modeling parameters.
G4cout <<
"G4Scene::AddWorldIfEmpty: The scene was empty,"
"\n \"world\" has been added.";
G4cout << endl;
}
}
}
void G4Scene::Clear () {
fRunDurationModelList.clearAndDestroy ();
fEndOfEventModelList.clearAndDestroy ();
}
ostream& operator << (ostream& os, const G4SceneData& d) {
ostream& operator << (ostream& os, const G4Scene& d) {
os << "Scene data:";
@@ -70,17 +100,16 @@ ostream& operator << (ostream& os, const G4SceneData& d) {
return os;
}
G4bool operator != (const G4SceneData& d1,
const G4SceneData& d2) {
G4bool G4Scene::operator != (const G4Scene& s) const {
if (
(d1.fRunDurationModelList.entries () !=
d2.fRunDurationModelList.entries ()) ||
(d1.fExtent != d2.fExtent) ||
!(d1.fStandardTargetPoint == d2.fStandardTargetPoint)
(fRunDurationModelList.entries () !=
s.fRunDurationModelList.entries ()) ||
(fExtent != s.fExtent) ||
!(fStandardTargetPoint == s.fStandardTargetPoint)
) return true;
for (int i = 0; i < d1.fRunDurationModelList.entries (); i++) {
if (d1.fRunDurationModelList[i] != d2.fRunDurationModelList[i])
for (int i = 0; i < fRunDurationModelList.entries (); i++) {
if (fRunDurationModelList[i] != s.fRunDurationModelList[i])
return true;
}
@@ -1,27 +0,0 @@
// 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.cc,v 2.2 1998/08/10 10:19:09 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 9th August 1998
#include "G4SceneDataObjectList.hh"
G4SceneDataObjectList::G4SceneDataObjectList
(
unsigned (*hashFun)(const G4String&), // Hashing function
size_t size // No. of buckets
):
RWTValHashDictionary <G4String, G4SceneData> (hashFun, size)
{}
G4SceneDataObjectListIterator::G4SceneDataObjectListIterator
(G4SceneDataObjectList& list):
RWTValHashDictionaryIterator <G4String, G4SceneData> (list)
{}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VGraphicsSystem.cc,v 2.1 1998/11/06 13:43:10 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VGraphicsSystem.cc,v 1.4 1999/05/10 14:04:11 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// John Allison 27th March 1996
@@ -16,6 +16,8 @@
#include "G4VisManager.hh"
G4VGraphicsSystem::~G4VGraphicsSystem () {}
G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
Functionality f):
fName (name),
@@ -42,7 +44,7 @@ G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
ostream& operator << (ostream& os, const G4VGraphicsSystem& gs) {
G4VisManager* pVMan = G4VisManager::GetInstance ();
const G4SceneList& scenes = pVMan -> GetAvailableScenes ();
const G4SceneHandlerList& scenes = pVMan -> GetAvailableSceneHandlers ();
os << "Graphics System: " << gs.GetName ();
if (gs.GetNickname () != "") {
os << ", nickname: " << gs.GetNickname ();
@@ -5,14 +5,14 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VScene.cc,v 2.8 1998/11/29 15:34:06 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VSceneHandler.cc,v 1.4 1999/05/10 14:04:13 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// John Allison 19th July 1996
// Abstract interface class for graphics scenes.
#include "G4VScene.hh"
#include "G4VSceneHandler.hh"
#include "G4ios.hh"
#ifdef WIN32
@@ -23,7 +23,7 @@
#include "G4VisManager.hh"
#include "G4VGraphicsSystem.hh"
#include "G4VView.hh"
#include "G4VViewer.hh"
#include "G4VSolid.hh"
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
@@ -42,11 +42,11 @@
#include "G4PhysicalVolumeModel.hh"
#include "G4ModelingParameters.hh"
G4VScene::G4VScene (G4VGraphicsSystem& system, G4int id, const G4String& name):
G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4String& name):
fSystem (system),
fSceneId (id),
fViewCount (0),
fpView (0),
fpViewer (0),
fReadyForTransients (false),
fpModel (0),
fpObjectTransformation (0),
@@ -56,7 +56,7 @@ G4VScene::G4VScene (G4VGraphicsSystem& system, G4int id, const G4String& name):
fpCurrentLV (0)
{
G4VisManager* pVMan = G4VisManager::GetInstance ();
fSD = pVMan -> GetCurrentSceneData ();
fpScene = pVMan -> GetCurrentScene ();
if (name == "") {
char charname [50];
ostrstream ost (charname, 50);
@@ -68,33 +68,88 @@ G4VScene::G4VScene (G4VGraphicsSystem& system, G4int id, const G4String& name):
}
}
G4VScene::~G4VScene () {
fViewList.clearAndDestroy ();
G4VSceneHandler::~G4VSceneHandler () {
fViewerList.clearAndDestroy ();
}
void G4VScene::AddViewToList (G4VView* pView) {
fViewList.append (pView);
void G4VSceneHandler::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.
}
void G4VScene::EstablishSpecials (G4PhysicalVolumeModel& pvModel) {
void G4VSceneHandler::AddThis (const G4Tubs& tubs) {
RequestPrimitives (tubs);
}
void G4VSceneHandler::AddThis (const G4Cons& cons) {
RequestPrimitives (cons);
}
void G4VSceneHandler::AddThis (const G4Trd& trd) {
RequestPrimitives (trd);
}
void G4VSceneHandler::AddThis (const G4Trap& trap) {
RequestPrimitives (trap);
}
void G4VSceneHandler::AddThis (const G4Sphere& sphere) {
RequestPrimitives (sphere );
}
void G4VSceneHandler::AddThis (const G4Para& para) {
RequestPrimitives (para);
}
void G4VSceneHandler::AddThis (const G4Torus& torus) {
RequestPrimitives (torus);
}
void G4VSceneHandler::AddThis (const G4Polycone& polycone) {
RequestPrimitives (polycone);
}
void G4VSceneHandler::AddThis (const G4Polyhedra& polyhedra) {
RequestPrimitives (polyhedra);
}
void G4VSceneHandler::AddThis (const G4VSolid& solid) {
RequestPrimitives (solid);
}
void G4VSceneHandler::AddViewerToList (G4VViewer* pViewer) {
fViewerList.append (pViewer);
}
void G4VSceneHandler::EstablishSpecials (G4PhysicalVolumeModel& pvModel) {
pvModel.DefinePointersToWorkingSpace (&fCurrentDepth,
&fpCurrentPV,
&fpCurrentLV);
}
void G4VScene::BeginModeling () {
if (!GetModel ()) G4Exception ("G4VScene::BeginModeling: NO MODEL!!!");
void G4VSceneHandler::BeginModeling () {
if (!GetModel ()) G4Exception ("G4VSceneHandler::BeginModeling: NO MODEL!!!");
}
void G4VScene::BeginPrimitives
void G4VSceneHandler::BeginPrimitives
(const G4Transform3D& objectTransformation) {
if (!GetModel ()) G4Exception ("G4VScene::BeginPrimitives: NO MODEL!!!");
if (!GetModel ()) G4Exception ("G4VSceneHandler::BeginPrimitives: NO MODEL!!!");
fpObjectTransformation = &objectTransformation;
}
void G4VScene::EndPrimitives () {}
void G4VSceneHandler::EndPrimitives () {}
void G4VScene::AddPrimitive (const G4Polymarker& polymarker) {
void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
switch (polymarker.GetMarkerType()) {
default:
case G4Polymarker::line:
@@ -138,19 +193,19 @@ void G4VScene::AddPrimitive (const G4Polymarker& polymarker) {
}
}
void G4VScene::RemoveViewFromList (G4VView* pView) {
fViewList.remove (pView);
void G4VSceneHandler::RemoveViewerFromList (G4VViewer* pViewer) {
fViewerList.remove (pViewer);
}
void G4VScene::SetSceneData (const G4SceneData& sd) {
fSD = sd;
// Notify all views that a kernel visit is required.
for (int i = 0; i < fViewList.entries (); i++) {
fViewList [i] -> SetNeedKernelVisit ();
void G4VSceneHandler::SetScene (G4Scene* pScene) {
fpScene = pScene;
// Notify all viewers that a kernel visit is required.
for (int i = 0; i < fViewerList.entries (); i++) {
fViewerList [i] -> SetNeedKernelVisit ();
}
}
void G4VScene::RequestPrimitives (const G4VSolid& solid) {
void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
G4Polyhedron* pPolyhedron;
G4NURBS* pNURBS;
BeginPrimitives (*fpObjectTransformation);
@@ -159,7 +214,7 @@ void G4VScene::RequestPrimitives (const G4VSolid& solid) {
pNURBS = solid.CreateNURBS ();
if (pNURBS) {
pNURBS -> SetVisAttributes
(fpView -> GetApplicableVisAttributes (fpVisAttribs));
(fpViewer -> GetApplicableVisAttributes (fpVisAttribs));
AddPrimitive (*pNURBS);
delete pNURBS;
break;
@@ -177,7 +232,7 @@ void G4VScene::RequestPrimitives (const G4VSolid& solid) {
G4Polyhedron::ResetNumberOfRotationSteps ();
if (pPolyhedron) {
pPolyhedron -> SetVisAttributes
(fpView -> GetApplicableVisAttributes (fpVisAttribs));
(fpViewer -> GetApplicableVisAttributes (fpVisAttribs));
AddPrimitive (*pPolyhedron);
delete pPolyhedron;
}
@@ -198,56 +253,54 @@ void G4VScene::RequestPrimitives (const G4VSolid& solid) {
EndPrimitives ();
}
void G4VScene::ProcessScene (G4VView& view) {
void G4VSceneHandler::ProcessScene (G4VViewer& view) {
fReadyForTransients = false;
// Clear stored scene, if any, i.e., display lists, scene graphs.
ClearStore ();
if (fpView -> GetViewParameters ().IsViewGeom ()) {
// Traverse geometry tree and send drawing primitives to window(s).
// Traverse geometry tree and send drawing primitives to window(s).
const RWTPtrOrderedVector <G4VModel>& runDurationModelList =
fpScene -> GetRunDurationModelList ();
const RWTPtrOrderedVector <G4VModel>& runDurationModelList =
fSD.GetRunDurationModelList ();
if (runDurationModelList.entries ()) {
G4cout << "Traversing scene data..." << endl;
G4ModelingParameters* pMP = CreateModelingParameters ();
for (int i = 0; i < runDurationModelList.entries (); i++) {
G4VModel* pModel = runDurationModelList[i];
const G4ModelingParameters* tempMP =
pModel -> GetModelingParameters ();
// NOTE THAT tempMP COULD BE ZERO.
// (Not sure the above is necessary; but in future we might
// want to take notice of the modeling parameters with which
// the model was created. For the time being we are ignoring
// them and simply using the view parameters. When the time
// comes to do this, then perhaps there should be a default
// set of modeling parameters in the view parameters for the
// case of a zero modeling parameters pointer.)
pModel -> SetModelingParameters (pMP);
SetModel (pModel); // Store for use by derived class.
BeginModeling ();
pModel -> DescribeYourselfTo (*this);
EndModeling ();
pModel -> SetModelingParameters (tempMP);
}
delete pMP;
SetModel (0); // Flags invalid model.
}
else {
G4cerr << "No run-duration models in scene data." << endl;
if (runDurationModelList.entries ()) {
G4cout << "Traversing scene data..." << endl;
G4ModelingParameters* pMP = CreateModelingParameters ();
for (int i = 0; i < runDurationModelList.entries (); i++) {
G4VModel* pModel = runDurationModelList[i];
const G4ModelingParameters* tempMP =
pModel -> GetModelingParameters ();
// NOTE THAT tempMP COULD BE ZERO.
// (Not sure the above is necessary; but in future we might
// want to take notice of the modeling parameters with which
// the model was created. For the time being we are ignoring
// them and simply using the view parameters. When the time
// comes to do this, then perhaps there should be a default
// set of modeling parameters in the view parameters for the
// case of a zero modeling parameters pointer.)
// (I think for the G4 Vis System we'll rely on view parameters and convert.
pModel -> SetModelingParameters (pMP);
SetModel (pModel); // Store for use by derived class.
BeginModeling ();
pModel -> DescribeYourselfTo (*this);
EndModeling ();
pModel -> SetModelingParameters (tempMP);
}
delete pMP;
SetModel (0); // Flags invalid model.
}
else {
G4cerr << "No run-duration models in scene data." << endl;
}
fReadyForTransients = true;
}
G4ModelingParameters* G4VScene::CreateModelingParameters () {
G4ModelingParameters* G4VSceneHandler::CreateModelingParameters () {
// Create modeling parameters from View Parameters...
const G4ViewParameters& vp = fpView -> GetViewParameters ();
const G4ViewParameters& vp = fpViewer -> GetViewParameters ();
// Convert rep styles...
G4ModelingParameters::RepStyle modelRepStyle =
G4ModelingParameters::wireframe;
@@ -285,43 +338,47 @@ G4ModelingParameters* G4VScene::CreateModelingParameters () {
vp.IsDensityCulling (),
vp.GetVisibleDensity (),
reallyCullCovered,
vp.GetNoOfSides ());
vp.GetNoOfSides (),
vp.IsViewGeom (),
vp.IsViewHits (),
vp.IsViewDigis ()
);
return pModelingParams;
}
const G4Colour& G4VScene::GetColour (const G4Visible& visible) {
const G4Colour& G4VSceneHandler::GetColour (const G4Visible& visible) {
// Colour is determined by the applicable (real) vis attributes.
const G4VisAttributes* pVA = visible.GetVisAttributes ();
pVA = fpView -> GetApplicableVisAttributes (pVA);
pVA = fpViewer -> GetApplicableVisAttributes (pVA);
return pVA -> GetColour ();
}
const G4Colour& G4VScene::GetTextColour (const G4Text& text) {
const G4Colour& G4VSceneHandler::GetTextColour (const G4Text& text) {
const G4VisAttributes* pVA = text.GetVisAttributes ();
if (!pVA) {
pVA = fpView -> GetViewParameters (). GetDefaultTextVisAttributes ();
pVA = fpViewer -> GetViewParameters (). GetDefaultTextVisAttributes ();
}
return pVA -> GetColour ();
}
G4ViewParameters::DrawingStyle G4VScene::GetDrawingStyle
G4ViewParameters::DrawingStyle G4VSceneHandler::GetDrawingStyle
(const G4Visible& visible) {
// Drawing style is determined by the applicable (real) vis
// attributes, except when overridden - see GetDrawingStyle (const
// G4VisAttributes* pVisAttribs).
const G4VisAttributes* pVA = visible.GetVisAttributes ();
pVA = fpView -> GetApplicableVisAttributes (pVA);
pVA = fpViewer -> GetApplicableVisAttributes (pVA);
return GetDrawingStyle (pVA);
}
G4ViewParameters::DrawingStyle G4VScene::GetDrawingStyle
G4ViewParameters::DrawingStyle G4VSceneHandler::GetDrawingStyle
(const G4VisAttributes* pVisAttribs) {
// Drawing style is normally determined by the view parameters, but
// it can be overriddden by the ForceDrawingStyle flag in the vis
// attributes.
G4ViewParameters::DrawingStyle style =
fpView->GetViewParameters().GetDrawingStyle();
fpViewer->GetViewParameters().GetDrawingStyle();
if (pVisAttribs -> IsForceDrawingStyle ()) {
G4VisAttributes::ForcedDrawingStyle forcedStyle =
pVisAttribs -> GetForcedDrawingStyle ();
@@ -362,11 +419,11 @@ G4ViewParameters::DrawingStyle G4VScene::GetDrawingStyle
return style;
}
G4double G4VScene::GetMarkerSize (const G4VMarker& marker,
G4VScene::MarkerSizeType& markerSizeType) {
G4double G4VSceneHandler::GetMarkerSize (const G4VMarker& marker,
G4VSceneHandler::MarkerSizeType& markerSizeType) {
G4bool userSpecified = marker.GetWorldSize() || marker.GetScreenSize();
const G4VMarker& defaultMarker =
fpView -> GetViewParameters().GetDefaultMarker();
fpViewer -> GetViewParameters().GetDefaultMarker();
G4double size;
if (size = // Assignment intentional.
userSpecified ? marker.GetWorldSize() : defaultMarker.GetWorldSize()) {
@@ -380,21 +437,21 @@ G4double G4VScene::GetMarkerSize (const G4VMarker& marker,
markerSizeType = screen;
}
if (size <= 0.) size = 1.;
size *= fpView -> GetViewParameters().GetGlobalMarkerScale();
size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
return size;
}
ostream& operator << (ostream& os, const G4VScene& s) {
ostream& operator << (ostream& os, const G4VSceneHandler& s) {
G4VisManager* pVMan = G4VisManager::GetInstance ();
os << "Scene " << s.fName << " has "
<< s.fViewList.entries () << " views:";
for (int i = 0; i < s.fViewList.entries (); i++) {
os << "\n " << s.fViewList [i];
<< s.fViewerList.entries () << " viewers:";
for (int i = 0; i < s.fViewerList.entries (); i++) {
os << "\n " << s.fViewerList [i];
}
os << "\n " << s.fSD;
os << "\n " << *s.fpScene;
return os;
}
@@ -5,14 +5,14 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VView.cc,v 2.5 1998/11/06 13:43:12 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VViewer.cc,v 1.3 1999/01/11 00:48:30 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// John Allison 27th March 1996
// Abstract interface class for graphics views.
#include "G4VView.hh"
#include "G4VViewer.hh"
#include "G4ios.hh"
#ifdef WIN32
@@ -23,20 +23,13 @@
#include "G4VisManager.hh"
#include "G4VGraphicsSystem.hh"
#include "G4VScene.hh"
#include "G4VSceneHandler.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4Event.hh"
// Forward declaration for g++ linker.
#ifdef GNU_GCC
#include <rw/tvvector.h>
#include "G4Plane3D.hh"
template class RWTValVector<G4Plane3D>;
#endif
G4VView::G4VView (G4VScene& scene, G4int id, const G4String& name):
fScene (scene),
G4VViewer::G4VViewer (G4VSceneHandler& scene, G4int id, const G4String& name):
fSceneHandler (scene),
fViewId (id),
fModified (true),
fNeedKernelVisit (true)
@@ -46,7 +39,7 @@ fNeedKernelVisit (true)
if (name == "") {
char charname [50];
ostrstream ost (charname, 50);
ost << fScene.GetName () << '-' << fViewId << ends;
ost << fSceneHandler.GetName () << '-' << fViewId << ends;
fName = charname;
}
else {
@@ -54,9 +47,9 @@ fNeedKernelVisit (true)
}
}
G4VView::~G4VView () {}
G4VViewer::~G4VViewer () {}
const G4VisAttributes* G4VView::GetApplicableVisAttributes
const G4VisAttributes* G4VViewer::GetApplicableVisAttributes
(const G4VisAttributes* pVisAttribs) const {
// If the pointer is null, pick up the default vis attributes from
// the view parameters.
@@ -65,17 +58,17 @@ const G4VisAttributes* G4VView::GetApplicableVisAttributes
return pVisAttribs;
}
void G4VView::NeedKernelVisit () {
void G4VViewer::NeedKernelVisit () {
// Notify all views that a kernel visit is required.
const G4VViewList& viewList = fScene.GetViewList ();
const G4ViewerList& viewList = fSceneHandler.GetViewerList ();
for (int i = 0; i < viewList.entries (); i++) {
viewList [i] -> SetNeedKernelVisit ();
}
}
void G4VView::ShowView () {}
void G4VViewer::ShowView () {}
void G4VView::ProcessView () {
void G4VViewer::ProcessView () {
// If view parameters have been modified, SetView () works out consequences.
if (fModified) {
@@ -84,41 +77,21 @@ void G4VView::ProcessView () {
}
// If the scene data has changed (fNeedVisit is set to true in
// G4VScene::SetSceneData), or if the concrete view has decided that it
// G4VSceneHandler::SetSceneData), or if the concrete view has decided that it
// necessary to visit the kernel (this should be Done in the concrete
// object's DrawView ())...
if (fNeedKernelVisit) {
fNeedKernelVisit = false;
fScene.ProcessScene (*this);
fSceneHandler.ProcessScene (*this);
}
/*********************************************
Note that hits and digi drawing is totally the responsibility of the
"user" at present. So the following code just represents an
alternative approach, namely, the user sets a flag, then the Vis
Manager draws them. I will leave the code hear for now; also the
flags and methods in G4ViewParameters.
// If event data is available...
G4Event* pEvent = G4VisManager::GetInstance () -> GetEvent ();
if (pEvent) {
if (fVP.IsViewHits ()) {
G4cout << "Drawing hits..." << endl;
}
if (fVP.IsViewDigis ()) {
G4cout << "Drawing digis..." << endl;
}
}
***********************************************/
}
void G4VView::SetViewParameters (const G4ViewParameters& vp) {
void G4VViewer::SetViewParameters (const G4ViewParameters& vp) {
fVP = vp;
fModified = true;
}
ostream& operator << (ostream& os, const G4VView& v) {
ostream& operator << (ostream& os, const G4VViewer& v) {
os << "View " << v.fName << ":\n";
os << v.fVP;
return os;
@@ -5,14 +5,16 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VVisCommand.cc,v 2.4 1998/12/09 23:56:27 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VVisCommand.cc,v 1.3 1999/05/10 14:04:14 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
#include "G4VVisCommand.hh"
G4VVisCommand::~G4VVisCommand () {}
G4VisManager* G4VVisCommand::fpVisManager = 0;
G4UIcmdWithAString* G4VVisCommand::fpCommandSceneNotifyHandlers = 0;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ViewParameters.cc,v 2.4 1998/11/25 16:31:28 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ViewParameters.cc,v 1.4 1999/05/25 09:14:17 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// John Allison 19th July 1996
@@ -39,8 +39,8 @@ G4ViewParameters::G4ViewParameters ():
fActualLightpointDirection (G4Vector3D (1., 1., 1.)),
fLightsMoveWithCamera (false),
fViewGeom (true),
fViewHits (false),
fViewDigis (false),
fViewHits (true),
fViewDigis (true),
fDefaultTextVisAttributes (G4Colour (0., 0., 1.)),
fGlobalMarkerScale (1.),
fMarkerNotHidden (true),
@@ -367,8 +367,8 @@ ostream& operator << (ostream& os, const G4ViewParameters& v) {
os << "\n Global marker scale: " << v.fGlobalMarkerScale;
os << "\n Marker ";
if (v.fMarkerNotHidden) os << "not";
os << " hidden by surfaces.";
if (v.fMarkerNotHidden) os << "not ";
os << "hidden by surfaces.";
os << "\n Window size hint: "
<< v.fWindowSizeHintX << 'x'<< v.fWindowSizeHintX;
@@ -376,62 +376,61 @@ ostream& operator << (ostream& os, const G4ViewParameters& v) {
return os;
}
G4bool operator != (const G4ViewParameters& v1,
const G4ViewParameters& v2) {
G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
// Put performance-sensitive parameters first.
if (
// This first to optimise spin, etc.
(v1.fViewpointDirection != v2.fViewpointDirection) ||
(fViewpointDirection != v.fViewpointDirection) ||
// No particular order from here on.
(v1.fDrawingStyle != v2.fDrawingStyle) ||
(v1.fRepStyle != v2.fRepStyle) ||
(v1.fCulling != v2.fCulling) ||
(v1.fCullInvisible != v2.fCullInvisible) ||
(v1.fDensityCulling != v2.fDensityCulling) ||
(v1.fCullCovered != v2.fCullCovered) ||
(v1.fSection != v2.fSection) ||
(v1.fCutaway != v2.fCutaway) ||
(v1.fExplode != v2.fExplode) ||
(v1.fNoOfSides != v2.fNoOfSides) ||
(v1.fUpVector != v2.fUpVector) ||
(v1.fFieldHalfAngle != v2.fFieldHalfAngle) ||
(v1.fZoomFactor != v2.fZoomFactor) ||
(v1.fCurrentTargetPoint != v2.fCurrentTargetPoint) ||
(v1.fDolly != v2.fDolly) ||
(v1.fRelativeLightpointDirection != v2.fRelativeLightpointDirection) ||
(v1.fLightsMoveWithCamera != v2.fLightsMoveWithCamera) ||
(v1.fViewGeom != v2.fViewGeom) ||
(v1.fViewHits != v2.fViewHits) ||
(v1.fViewDigis != v2.fViewDigis) ||
(v1.fDefaultVisAttributes != v2.fDefaultVisAttributes) ||
(v1.fDefaultTextVisAttributes != v2.fDefaultTextVisAttributes) ||
(v1.fDefaultMarker != v2.fDefaultMarker) ||
(v1.fGlobalMarkerScale != v2.fGlobalMarkerScale) ||
(v1.fMarkerNotHidden != v2.fMarkerNotHidden) ||
(v1.fWindowSizeHintX != v2.fWindowSizeHintX) ||
(v1.fWindowSizeHintY != v2.fWindowSizeHintY))
(fDrawingStyle != v.fDrawingStyle) ||
(fRepStyle != v.fRepStyle) ||
(fCulling != v.fCulling) ||
(fCullInvisible != v.fCullInvisible) ||
(fDensityCulling != v.fDensityCulling) ||
(fCullCovered != v.fCullCovered) ||
(fSection != v.fSection) ||
(fCutaway != v.fCutaway) ||
(fExplode != v.fExplode) ||
(fNoOfSides != v.fNoOfSides) ||
(fUpVector != v.fUpVector) ||
(fFieldHalfAngle != v.fFieldHalfAngle) ||
(fZoomFactor != v.fZoomFactor) ||
(fCurrentTargetPoint != v.fCurrentTargetPoint) ||
(fDolly != v.fDolly) ||
(fRelativeLightpointDirection != v.fRelativeLightpointDirection) ||
(fLightsMoveWithCamera != v.fLightsMoveWithCamera) ||
(fViewGeom != v.fViewGeom) ||
(fViewHits != v.fViewHits) ||
(fViewDigis != v.fViewDigis) ||
(fDefaultVisAttributes != v.fDefaultVisAttributes) ||
(fDefaultTextVisAttributes != v.fDefaultTextVisAttributes) ||
(fDefaultMarker != v.fDefaultMarker) ||
(fGlobalMarkerScale != v.fGlobalMarkerScale) ||
(fMarkerNotHidden != v.fMarkerNotHidden) ||
(fWindowSizeHintX != v.fWindowSizeHintX) ||
(fWindowSizeHintY != v.fWindowSizeHintY))
return true;
if (v1.fDensityCulling &&
(v1.fVisibleDensity != v2.fVisibleDensity)) return true;
if (fDensityCulling &&
(fVisibleDensity != v.fVisibleDensity)) return true;
if (v1.fSection &&
(!(v1.fSectionPlane == v2.fSectionPlane))) return true;
if (fSection &&
(!(fSectionPlane == v.fSectionPlane))) return true;
if (v1.fCutaway) {
if (v1.fCutawayPlanes.entries () != v2.fCutawayPlanes.entries ())
if (fCutaway) {
if (fCutawayPlanes.entries () != v.fCutawayPlanes.entries ())
return true;
else {
for (int i = 0; i < v1.fCutawayPlanes.entries (); i++) {
if (!(v1.fCutawayPlanes (i) == v2.fCutawayPlanes (i))) return true;
for (int i = 0; i < fCutawayPlanes.entries (); i++) {
if (!(fCutawayPlanes (i) == v.fCutawayPlanes (i))) return true;
}
}
}
if (v1.fExplode &&
(v1.fExplodeFactor != v2.fExplodeFactor)) return true;
if (fExplode &&
(fExplodeFactor != v.fExplodeFactor)) return true;
return false;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandTemplates.cc,v 2.2 1998/07/13 17:12:26 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisCommandTemplates.cc,v 1.2 1999/01/09 16:31:18 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// Visualization Command Messenger Template private functions.
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsCamera.cc,v 2.2 1998/07/23 02:18:55 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisCommandsCamera.cc,v 1.3 1999/01/11 00:48:31 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
@@ -15,15 +15,19 @@
void G4VisCommandCameraReset::SetValue () {
G4VisManager* pVMan = G4VisManager::GetInstance ();
if (pVMan -> IsValidView ()) {
const G4SceneData& sd = pVMan -> GetCurrentSceneData ();
const G4Scene* pScene = pVMan -> GetCurrentScene ();
G4ViewParameters& vp = pVMan -> SetCurrentViewParameters ();
vp.SetCurrentTargetPoint (sd.GetStandardTargetPoint ());
vp.SetCurrentTargetPoint (pScene -> GetStandardTargetPoint ());
vp.SetZoomFactor (1.);
vp.SetDolly (0.);
vp.SetViewpointDirection (G4Vector3D (0., 0., 1.));
vp.SetUpVector (G4Vector3D (0., 1., 0.));
if (pVMan -> GetVerboseLevel () > 0) {
G4cout << "Target point reset";
G4cout << "\nZoom factor reset to 1.";
G4cout << "\nDolly distance reset to 0.";
G4cout << "\nViewpoint direction reset to +z.";
G4cout << "\nUp vector set to +y.";
G4cout << endl;
if (pVMan -> GetVerboseLevel () > 1) {
pVMan -> PrintCurrentView ();
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsCameraMessengers.cc,v 2.3 1998/07/12 03:44:55 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisCommandsCameraMessengers.cc,v 1.2 1999/01/09 16:31:19 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// Messengers for /vis~/camera commands - John Allison 6th April 1998.
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsScene.cc,v 2.12 1998/12/09 23:56:28 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisCommandsScene.cc,v 1.7 1999/05/10 14:04:15 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// /vis/scene commands - John Allison 9th August 1998
@@ -16,6 +16,7 @@
#include "G4TransportationManager.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4ApplicationState.hh"
#include "G4UImanager.hh"
#include "G4UIcommand.hh"
#include "G4UIcmdWithAString.hh"
#include "G4ios.hh"
@@ -27,57 +28,55 @@
G4VVisCommandScene::G4VVisCommandScene () {}
G4VVisCommandScene::~G4VVisCommandScene () {}
void G4VVisCommandScene::UpdateCandidateLists () {
G4SceneDataObjectList& list = fpVisManager -> SetSceneDataObjectList ();
// Seems it has to be non-const to satisfy iterator.
G4SceneDataObjectListIterator iterator (list);
G4String fSceneNameList;
while (++iterator) {
fSceneNameList += iterator.key () + " ";
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
G4String nameList;
for (iScene = 0; iScene < nScenes; iScene++) {
nameList += sceneList [iScene] -> GetName () + " ";
}
fSceneNameList = fSceneNameList.strip ();
nameList = nameList.strip ();
if (fpCommandSceneNotifyHandlers) {
fpCommandSceneNotifyHandlers -> GetParameter (0) ->
SetParameterCandidates (fSceneNameList);
SetParameterCandidates (nameList);
}
if (fpCommandSceneRemove) {
fpCommandSceneRemove -> GetParameter (0) ->
SetParameterCandidates (fSceneNameList);
SetParameterCandidates (nameList);
}
if (fpCommandSceneSelect) {
fpCommandSceneSelect -> GetParameter (0) ->
SetParameterCandidates (fSceneNameList);
SetParameterCandidates (nameList);
}
if (fpCommandSceneHandlerAttach) {
fpCommandSceneHandlerAttach -> GetParameter (0) ->
SetParameterCandidates (fSceneNameList);
SetParameterCandidates (nameList);
}
}
void G4VVisCommandScene::UpdateVisManagerSceneDataAndViewParameters
void G4VVisCommandScene::UpdateVisManagerSceneAndViewParameters
(const G4String& sceneName) {
G4SceneData& currentScene = fpVisManager -> SetCurrentSceneData ();
G4SceneDataObjectList& sceneList = fpVisManager -> SetSceneDataObjectList ();
if (sceneList.contains (sceneName)) {
currentScene = sceneList [sceneName];
G4ViewParameters& currentVP = fpVisManager -> SetCurrentViewParameters ();
currentVP.SetCurrentTargetPoint (currentScene.GetStandardTargetPoint ());
currentVP.SetZoomFactor (1.);
currentVP.SetDolly (0.);
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
for (iScene = 0; iScene < nScenes; iScene++) {
if (sceneList [iScene] -> GetName () == sceneName) break;
}
if (iScene < nScenes) {
fpVisManager -> SetCurrentScene (sceneList [iScene]);
G4UImanager::GetUIpointer () -> ApplyCommand ("/vis/camera/reset");
}
else {
currentScene = G4SceneData ("invalid scene");
fpVisManager -> SetCurrentScene (0);
}
}
G4String G4VVisCommandScene::fSceneNameList;
////////////// /vis/scene/create ///////////////////////////////////////
G4VisCommandSceneCreate::G4VisCommandSceneCreate (): fId (0) {
@@ -117,16 +116,20 @@ void G4VisCommandSceneCreate::SetNewValue (G4UIcommand* command,
}
if (newName == nextName) fId++;
G4SceneDataObjectList& list = fpVisManager -> SetSceneDataObjectList ();
if (list.contains (newName)) {
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
for (iScene = 0; iScene < nScenes; iScene++) {
if (sceneList [iScene] -> GetName () == newName) break;
}
if (iScene < nScenes) {
G4cout << "Scene \"" << newName << "\" already exists." << endl;
}
else {
list [newName] = G4SceneData (newName);
sceneList.append (new G4Scene (newName));
// Adds empty scene data object to list.
UpdateVisManagerSceneDataAndViewParameters (newName);
UpdateVisManagerSceneAndViewParameters (newName);
G4cout << "New empty scene \"" << newName << "\" created." << endl;
UpdateCandidateLists ();
@@ -171,17 +174,18 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand* command,
istrstream is ((char*)newValue.data());
is >> name >> verbosity;
G4SceneDataObjectList& list = fpVisManager -> SetSceneDataObjectList ();
G4SceneDataObjectListIterator iterator (list);
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
G4bool found = false;
while (++iterator) {
for (iScene = 0; iScene < nScenes; iScene++) {
const G4String& iName = sceneList [iScene] -> GetName ();
if (name != "all") {
if (name != iterator.key ()) continue;
if (name != iName) continue;
}
found = true;
G4cout << "Scene name: \"" << iterator.key () << "\"";
G4cout << "Scene name: \"" << iName << "\"";
if (verbosity > 0) {
G4cout << ", " << iterator.value ();
G4cout << ", " << *sceneList [iScene];
}
G4cout << endl;
}
@@ -202,7 +206,9 @@ G4VisCommandSceneNotifyHandlers::G4VisCommandSceneNotifyHandlers () {
fpCommand -> SetGuidance ("/vis/scene/notifyHandlers [<scene-name>]");
fpCommand -> SetGuidance
("Notifies scene handlers of possible changes of scene.");
fpCommand -> SetGuidance ("<scene-name> default is current scene.");
fpCommand -> SetGuidance ("<scene-name> default is current scene name.");
fpCommand -> SetGuidance
("This command does not change current scene, scene handler or viewer.");
fpCommand -> SetParameterName ("scene-name",
omitable = true,
currentAsDefault = true);
@@ -215,28 +221,46 @@ G4VisCommandSceneNotifyHandlers::~G4VisCommandSceneNotifyHandlers () {
G4String G4VisCommandSceneNotifyHandlers::GetCurrentValue
(G4UIcommand* command) {
return fpVisManager -> GetCurrentSceneData ().GetName ();
return fpVisManager -> GetCurrentScene () -> GetName ();
}
void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String& sceneName = newValue;
const G4SceneDataObjectList& sceneList =
fpVisManager -> GetSceneDataObjectList ();
G4SceneList& sceneHandlerList = fpVisManager -> SetAvailableScenes ();
const G4SceneList& sceneList = fpVisManager -> GetSceneList ();
G4SceneHandlerList& sceneHandlerList =
fpVisManager -> SetAvailableSceneHandlers ();
// Check scene name.
const G4int nScenes = sceneList.entries ();
G4int iScene;
for (iScene = 0; iScene < nScenes; iScene++) {
G4Scene* scene = sceneList [iScene];
if (sceneName == scene -> GetName ()) {
scene -> AddWorldIfEmpty ();
break;
}
}
if (iScene >= nScenes ) {
G4cout << "Scene \"" << sceneName << "\" not found."
"\n /vis/scene/list to see scenes."
<< endl;
return;
}
// For each scene handler, if it contains the scene, for each viewer
// clear, (re)draw, and show.
// set (make current), clear, (re)draw, and show.
const G4int nSceneHandlers = sceneHandlerList.entries ();
for (G4int iSH = 0; iSH < nSceneHandlers; iSH++) {
G4VScene* aSceneHandler = sceneHandlerList [iSH];
const G4SceneData& theScene = aSceneHandler -> GetSceneData ();
const G4String& theSceneName = theScene.GetName ();
G4VSceneHandler* aSceneHandler = sceneHandlerList [iSH];
G4Scene* theScene = aSceneHandler -> GetScene ();
const G4String& theSceneName = theScene -> GetName ();
if (sceneName == theSceneName) {
G4VViewList& viewerList = aSceneHandler -> SetViewList ();
G4ViewerList& viewerList = aSceneHandler -> SetViewerList ();
const G4int nViewers = viewerList.entries ();
for (G4int iV = 0; iV < nViewers; iV++) {
G4VView* aViewer = viewerList [iV];
G4VViewer* aViewer = viewerList [iV];
aViewer -> SetView ();
aViewer -> ClearView ();
aViewer -> DrawView ();
aViewer -> ShowView ();
@@ -269,30 +293,33 @@ G4VisCommandSceneRemove::~G4VisCommandSceneRemove () {
}
G4String G4VisCommandSceneRemove::GetCurrentValue (G4UIcommand* command) {
return fpVisManager -> GetCurrentSceneData ().GetName ();
return fpVisManager -> GetCurrentScene () -> GetName ();
}
void G4VisCommandSceneRemove::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String& removeName = newValue;
G4SceneDataObjectList& list = fpVisManager -> SetSceneDataObjectList ();
const G4String& currentSceneName =
fpVisManager -> GetCurrentSceneData ().GetName ();
if (list.contains (removeName)) {
list.remove (removeName);
fpVisManager -> GetCurrentScene () -> GetName ();
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
for (iScene = 0; iScene < nScenes; iScene++) {
if (sceneList [iScene] -> GetName () == removeName) break;
}
if (iScene < nScenes) {
delete sceneList [iScene];
sceneList.removeAt (iScene);
G4cout << "Scene \"" << removeName << "\" removed." << endl;
UpdateCandidateLists ();
if (list.isEmpty ()) {
UpdateVisManagerSceneDataAndViewParameters ();
if (sceneList.isEmpty ()) {
UpdateVisManagerSceneAndViewParameters ();
G4cout << "No scenes left. Please create a new one." << endl;
}
else {
if (currentSceneName == removeName) {
G4SceneDataObjectListIterator iterator (list);
++iterator;
UpdateVisManagerSceneDataAndViewParameters (iterator.key ());
UpdateVisManagerSceneAndViewParameters (sceneList [0] -> GetName ());
G4cout << "Current scene is now \""
<< fpVisManager -> GetCurrentSceneData ().GetName ()
<< fpVisManager -> GetCurrentScene () -> GetName ()
<< "\"" << endl;
}
else {
@@ -327,16 +354,20 @@ G4VisCommandSceneSelect::~G4VisCommandSceneSelect () {
}
G4String G4VisCommandSceneSelect::GetCurrentValue (G4UIcommand* command) {
return fpVisManager -> GetCurrentSceneData ().GetName ();
return fpVisManager -> GetCurrentScene () -> GetName ();
}
void G4VisCommandSceneSelect::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String& selectName = newValue;
G4SceneDataObjectList& list = fpVisManager -> SetSceneDataObjectList ();
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
for (iScene = 0; iScene < nScenes; iScene++) {
if (sceneList [iScene] -> GetName () == selectName) break;
}
G4cout << "Scene \"" << selectName;
if (list.contains (selectName)) {
UpdateVisManagerSceneDataAndViewParameters (selectName);
if (iScene < nScenes) {
UpdateVisManagerSceneAndViewParameters (selectName);
G4cout << "\" selected." << endl;
}
else {
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsSceneAdd.cc,v 2.6 1998/11/29 15:34:08 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisCommandsSceneAdd.cc,v 1.5 1999/04/16 09:06:09 mora Exp $
// GEANT4 tag $Name: geant4-00-01 $
// /vis/scene commands - John Allison 9th August 1998
@@ -17,7 +17,7 @@
#include "G4PhysicalVolumeModel.hh"
#include "G4ModelingParameters.hh"
#include "G4PhysicalVolumeSearchScene.hh"
#include "G4GlobalFastSimulationManager.hh"
#include "G4VGlobalFastSimulationManager.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4FlavoredParallelWorldModel.hh"
@@ -42,11 +42,13 @@ G4VisCommandSceneAddVolume::G4VisCommandSceneAddVolume () {
fpCommand -> SetGuidance ("Adds a physical volume to the current scene.");
fpCommand -> SetGuidance
("1st parameter: volume name (default \"world\").");
fpCommand -> SetGuidance
(" \"list\" to list all volumes.");
fpCommand -> SetGuidance
("2nd parameter: copy number (default 0).");
fpCommand -> SetGuidance
("3rd parameter: depth of descending geometry hierarchy"
" (default G4SceneData::UNLIMITED (-1)).");
" (default G4Scene::UNLIMITED (-1)).");
G4UIparameter* parameter;
parameter = new G4UIparameter ("volume", 's', omitable = true);
parameter -> SetDefaultValue ("world");
@@ -55,7 +57,7 @@ G4VisCommandSceneAddVolume::G4VisCommandSceneAddVolume () {
parameter -> SetDefaultValue (0);
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter ("depth", 'i', omitable = true);
parameter -> SetDefaultValue (G4SceneData::UNLIMITED);
parameter -> SetDefaultValue (G4Scene::UNLIMITED);
fpCommand -> SetParameter (parameter);
}
@@ -64,13 +66,13 @@ G4VisCommandSceneAddVolume::~G4VisCommandSceneAddVolume () {
}
G4String G4VisCommandSceneAddVolume::GetCurrentValue (G4UIcommand* command) {
return "";
return "world 0 -1";
}
void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4SceneDataObjectList& list = fpVisManager -> SetSceneDataObjectList ();
if (list.isEmpty ()) {
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
if (sceneList.isEmpty ()) {
G4cout << "No scenes - please create one before adding anything."
<< endl;
return;
@@ -101,13 +103,23 @@ void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand* command,
}
}
else {
// Create search scene, model and modeling parameters with
// long-enough life...
G4PhysicalVolumeSearchScene searchScene (name, copyNo);
G4PhysicalVolumeModel searchModel (world);
G4ModelingParameters mp;
searchModel.SetModelingParameters (&mp);
// Initiate search...
searchModel.DescribeYourselfTo (searchScene);
// OK, what have we got...?
foundVolume = searchScene.GetFoundVolume ();
const G4Transform3D&
transformation = searchScene.GetFoundTransformation ();
foundDepth = searchScene.GetFoundDepth ();
if (foundVolume) {
model = new G4PhysicalVolumeModel (foundVolume,
requestedDepthOfDescent,
@@ -120,10 +132,10 @@ void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand* command,
}
if (model) {
const G4String& currentSceneName =
fpVisManager -> GetCurrentSceneData ().GetName ();
(list [currentSceneName]).AddRunDurationModel (model);
UpdateVisManagerSceneDataAndViewParameters (currentSceneName);
G4Scene* pScene = fpVisManager -> GetCurrentScene ();
const G4String& currentSceneName = pScene -> GetName ();
pScene -> AddRunDurationModel (model);
UpdateVisManagerSceneAndViewParameters (currentSceneName);
G4cout << "First occurrence of \"" << foundVolume -> GetName ()
<< "\", copy no. " << copyNo
<< ", found at depth " << foundDepth
@@ -160,40 +172,40 @@ G4String G4VisCommandSceneAddGhosts::GetCurrentValue (G4UIcommand* command) {
void G4VisCommandSceneAddGhosts::SetNewValue (G4UIcommand* command,
G4String newValue) {
const G4String& currentSceneName =
fpVisManager -> GetCurrentSceneData ().GetName ();
G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene ();
const G4String& currentSceneName = pCurrentScene -> GetName ();
G4SceneDataObjectList& list = fpVisManager -> SetSceneDataObjectList ();
if (list.isEmpty ()) {
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
if (sceneList.isEmpty ()) {
G4cout << "No scenes - please create one before adding anything."
<< endl;
return;
}
G4GlobalFastSimulationManager* theGlobalFastSimulationManager;
G4VGlobalFastSimulationManager* theGlobalFastSimulationManager;
if(!(theGlobalFastSimulationManager =
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager())){
G4VGlobalFastSimulationManager::GetConcreteInstance ())){
G4cout<< "WARNING: no G4GlobalFastSimulationManager" << endl;
return;
}
G4ParticleTable* theParticleTable=G4ParticleTable::GetParticleTable();
if(newValue=="all") {
G4FlavoredParallelWorld* CurrentFlavoredWorld;
G4VFlavoredParallelWorld* CurrentFlavoredWorld;
for (G4int iParticle=0; iParticle<theParticleTable->entries();
iParticle++)
if(CurrentFlavoredWorld=theGlobalFastSimulationManager->
GetFlavoredWorldForThis(theParticleTable->
GetParticle(iParticle)))
(list [currentSceneName]).AddRunDurationModel
pCurrentScene -> AddRunDurationModel
(new G4FlavoredParallelWorldModel (CurrentFlavoredWorld));
UpdateVisManagerSceneDataAndViewParameters ();
UpdateVisManagerSceneAndViewParameters ();
G4cout << "Ghosts added to the Scene, refresh the view to see it."
<< endl;
return;
}
G4ParticleDefinition* currentParticle =
theParticleTable->FindParticle(newValue);
if (currentParticle == NULL) {
@@ -201,12 +213,12 @@ void G4VisCommandSceneAddGhosts::SetNewValue (G4UIcommand* command,
return;
}
G4FlavoredParallelWorld* worldForThis;
G4VFlavoredParallelWorld* worldForThis;
if(worldForThis=theGlobalFastSimulationManager->
GetFlavoredWorldForThis(currentParticle)) {
(list [currentSceneName]).AddRunDurationModel
pCurrentScene -> AddRunDurationModel
(new G4FlavoredParallelWorldModel (worldForThis));
UpdateVisManagerSceneDataAndViewParameters (currentSceneName);
UpdateVisManagerSceneAndViewParameters (currentSceneName);
G4cout << "Ghosts added to the Scene, refresh the view to see it."
<< endl;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsSceneHandler.cc,v 1.5 1998/12/09 23:56:29 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisCommandsSceneHandler.cc,v 1.7 1999/05/12 13:58:48 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// /vis/sceneHandler commands - John Allison 10th October 1998
@@ -15,6 +15,7 @@
#include "G4VisManager.hh"
#include "G4GraphicsSystemList.hh"
#include "G4VisCommandsScene.hh"
#include "G4UImanager.hh"
#include "G4UIcommand.hh"
#include "G4UIcmdWithAString.hh"
#include "G4ios.hh"
@@ -26,13 +27,16 @@
G4VVisCommandSceneHandler::G4VVisCommandSceneHandler () {}
G4VVisCommandSceneHandler::~G4VVisCommandSceneHandler () {}
void G4VVisCommandSceneHandler::UpdateCandidateLists () {
const G4SceneList& list = fpVisManager -> GetAvailableScenes ();
const G4SceneHandlerList& list =
fpVisManager -> GetAvailableSceneHandlers ();
fSceneHandlerNameList = G4String ();
for (int iScene = 0; iScene < list.entries (); iScene++) {
G4VScene* sceneHandler = list [iScene];
G4VSceneHandler* sceneHandler = list [iScene];
fSceneHandlerNameList += sceneHandler -> GetName () + " ";
}
fSceneHandlerNameList = fSceneHandlerNameList.strip ();
@@ -79,7 +83,8 @@ G4VisCommandSceneHandlerAttach::~G4VisCommandSceneHandlerAttach () {
}
G4String G4VisCommandSceneHandlerAttach::GetCurrentValue (G4UIcommand* command) {
return fpVisManager -> GetCurrentSceneData ().GetName ();
G4Scene* pScene = fpVisManager -> GetCurrentScene ();
return pScene ? pScene -> GetName () : G4String("");
}
void G4VisCommandSceneHandlerAttach::SetNewValue (G4UIcommand* command,
@@ -93,7 +98,7 @@ void G4VisCommandSceneHandlerAttach::SetNewValue (G4UIcommand* command,
return;
}
G4VScene* pSceneHandler = fpVisManager -> GetCurrentScene ();
G4VSceneHandler* pSceneHandler = fpVisManager -> GetCurrentSceneHandler ();
if (!pSceneHandler) {
G4cout <<
"Current scene handler not defined. Please select or create one."
@@ -101,12 +106,24 @@ void G4VisCommandSceneHandlerAttach::SetNewValue (G4UIcommand* command,
return;
}
G4SceneDataObjectList& sceneList =
fpVisManager -> SetSceneDataObjectList ();
if (sceneList.contains (sceneName)) {
const G4SceneData& scene = sceneList [sceneName];
pSceneHandler -> SetSceneData (scene);
fpVisManager -> SetCurrentSceneData () = scene;
G4SceneList& sceneList =
fpVisManager -> SetSceneList ();
if (sceneList.isEmpty ()) {
G4cout <<
"No valid scenes available yet. Please create one."
<< endl;
return;
}
G4int iScene, nScenes = sceneList.entries ();
for (iScene = 0; iScene < nScenes; iScene++) {
if (sceneList [iScene] -> GetName () == sceneName) break;
}
if (iScene < nScenes) {
G4Scene* pScene = sceneList [iScene];
pSceneHandler -> SetScene (pScene);
fpVisManager -> SetCurrentScene (pScene);
G4cout << "Scene \"" << sceneName
<< "\" attached to scene handler \"" << pSceneHandler -> GetName ()
<< "." << endl;
@@ -124,28 +141,41 @@ G4VisCommandSceneHandlerCreate::G4VisCommandSceneHandlerCreate (): fId (0) {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/sceneHandler/create", this);
fpCommand -> SetGuidance
("/vis/sceneHandler/create [<graphics-system>] [<scene-handler-name>]");
("/vis/sceneHandler/create");
fpCommand -> SetGuidance
(" <graphics-system> [<scene-handler-name>] [<scene-name>]");
fpCommand -> SetGuidance
("Creates an scene handler for a specific graphics system.");
fpCommand -> SetGuidance
("Default graphics system is current graphics system.");
fpCommand -> SetGuidance ("Invents a name if not supplied.");
("Attaches specified scene.");
fpCommand -> SetGuidance
("This graphics system and scene handler become current.");
("Default graphics system is current graphics system.");
fpCommand -> SetGuidance
("Invents a name if not supplied.");
fpCommand -> SetGuidance
("Default scene is current scene. You can change attached scenes with");
fpCommand -> SetGuidance
(" /vis/sceneHandler/attach [<scene-name>].");
fpCommand -> SetGuidance
("This graphics system, scene handler and scene become current.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("graphics-system", 's', omitable = true);
parameter -> SetCurrentAsDefault (true);
parameter = new G4UIparameter ("graphics-system", 's', omitable = false);
//parameter -> SetCurrentAsDefault (true);
const G4GraphicsSystemList& gslist =
fpVisManager -> GetAvailableGraphicsSystems ();
G4String candidates;
for (int igslist = 0; igslist < gslist.entries (); igslist++) {
G4String name = gslist (igslist) -> GetName ();
G4String nickname = gslist (igslist) -> GetNickname ();
if (nickname.length () > 0) {
candidates += nickname + " ";
const G4String& name = gslist (igslist) -> GetName ();
const G4String& nickname = gslist (igslist) -> GetNickname ();
if (nickname.isNull ()) {
candidates += name;
}
candidates += name + " ";
else {
candidates += nickname;
}
candidates += " ";
}
candidates = candidates.strip ();
parameter -> SetParameterCandidates(candidates);
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter
@@ -167,23 +197,41 @@ G4String G4VisCommandSceneHandlerCreate::NextName () {
G4String G4VisCommandSceneHandlerCreate::GetCurrentValue
(G4UIcommand* command) {
G4String graphicsSystemName;
const G4GraphicsSystemList& gslist =
fpVisManager -> GetAvailableGraphicsSystems ();
if (gslist.entries ()) {
graphicsSystemName = gslist [0] -> GetName ();
const G4VGraphicsSystem* graphicsSystem =
fpVisManager -> GetCurrentGraphicsSystem ();
if (graphicsSystem) {
graphicsSystemName = graphicsSystem -> GetName ();
}
else {
graphicsSystemName = "none";
const G4GraphicsSystemList& gslist =
fpVisManager -> GetAvailableGraphicsSystems ();
if (gslist.entries ()) {
graphicsSystemName = gslist [0] -> GetName ();
}
else {
graphicsSystemName = "none";
}
}
return graphicsSystemName + " " + NextName ();
G4String sceneName;
const G4VSceneHandler* scene = fpVisManager -> GetCurrentSceneHandler ();
if (scene) {
sceneName = scene -> GetName ();
}
else {
sceneName = "none";
}
return graphicsSystemName + " " + NextName () + " " + sceneName;
}
void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String graphicsSystem, newName;
G4String graphicsSystem, newName, sceneName;
istrstream is ((char*)newValue.data());
is >> graphicsSystem >> newName;
is >> graphicsSystem >> newName >> sceneName;
const G4GraphicsSystemList& gsl =
fpVisManager -> GetAvailableGraphicsSystems ();
@@ -219,9 +267,6 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
fpVisManager -> SetCurrentGraphicsSystem (pSystem);
if (fpVisManager -> GetVerboseLevel () > 0) {
G4cout << "Graphics system set to " << pSystem -> GetName () << endl;
if (fpVisManager -> GetVerboseLevel () > 1) {
fpVisManager -> PrintCurrentSystem ();
}
}
// Now deal with name of scene handler.
@@ -231,10 +276,10 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
}
if (newName == nextName) fId++;
const G4SceneList& list = fpVisManager -> GetAvailableScenes ();
const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
int iScene;
for (iScene = 0; iScene < list.entries (); iScene++) {
G4VScene* sceneHandler = list [iScene];
G4VSceneHandler* sceneHandler = list [iScene];
if (sceneHandler -> GetName () == newName) {
G4cout << "Scene handler \"" << newName << "\" already exists." << endl;
return;
@@ -242,9 +287,13 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
}
//Create scene handler.
fpVisManager -> CreateScene (newName);
fpVisManager -> CreateSceneHandler (newName);
G4cout << "New scene handler \"" << newName << "\" created." << endl;
// Attach scene.
G4String commandString = "/vis/sceneHandler/attach " + sceneName;
G4UImanager::GetUIpointer () -> ApplyCommand (commandString);
UpdateCandidateLists ();
}
@@ -287,7 +336,7 @@ void G4VisCommandSceneHandlerList::SetNewValue (G4UIcommand* command,
istrstream is ((char*)newValue.data());
is >> name >> verbosity;
const G4SceneList& list = fpVisManager -> GetAvailableScenes ();
const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
G4bool found = false;
for (int iSH = 0; iSH < list.entries (); iSH++) {
if (name != "all") {
@@ -331,7 +380,7 @@ G4VisCommandSceneHandlerRemove::~G4VisCommandSceneHandlerRemove () {
}
G4String G4VisCommandSceneHandlerRemove::GetCurrentValue (G4UIcommand* command) {
G4VScene* sceneHandler = fpVisManager -> GetCurrentScene ();
G4VSceneHandler* sceneHandler = fpVisManager -> GetCurrentSceneHandler ();
if (sceneHandler) {
return sceneHandler -> GetName ();
}
@@ -343,13 +392,14 @@ G4String G4VisCommandSceneHandlerRemove::GetCurrentValue (G4UIcommand* command)
void G4VisCommandSceneHandlerRemove::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String& removeName = newValue;
G4VScene* currentSceneHandler = fpVisManager -> GetCurrentScene ();
G4VSceneHandler* currentSceneHandler =
fpVisManager -> GetCurrentSceneHandler ();
G4String currentName;
if (currentSceneHandler) {
currentName = currentSceneHandler -> GetName ();
}
G4SceneList& list = fpVisManager -> SetAvailableScenes ();
G4SceneHandlerList& list = fpVisManager -> SetAvailableSceneHandlers ();
G4int iSH;
for (iSH = 0; iSH < list.entries (); iSH++) {
if (list [iSH] -> GetName () == removeName) break;
@@ -364,7 +414,7 @@ void G4VisCommandSceneHandlerRemove::SetNewValue (G4UIcommand* command,
G4cout << "Scene handler \"" << removeName << "\" removed." << endl;
if (removeName == currentName) {
fpVisManager -> DeleteCurrentScene ();
fpVisManager -> DeleteCurrentSceneHandler ();
}
else {
list.remove (list [iSH]);
@@ -396,7 +446,7 @@ G4VisCommandSceneHandlerSelect::~G4VisCommandSceneHandlerSelect () {
G4String G4VisCommandSceneHandlerSelect::GetCurrentValue
(G4UIcommand* command) {
G4VScene* sceneHandler = fpVisManager -> GetCurrentScene ();
G4VSceneHandler* sceneHandler = fpVisManager -> GetCurrentSceneHandler ();
if (sceneHandler) {
return sceneHandler -> GetName ();
}
@@ -408,19 +458,19 @@ G4String G4VisCommandSceneHandlerSelect::GetCurrentValue
void G4VisCommandSceneHandlerSelect::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String& selectName = newValue;
const G4SceneList& list = fpVisManager -> GetAvailableScenes ();
const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
G4cout << "Scene handler \"" << selectName << "\"";
G4int iSH;
for (iSH = 0; iSH < list.entries (); iSH++) {
if (list [iSH] -> GetName () == selectName) break;
}
if (iSH < list.entries ()) {
if (fpVisManager -> GetCurrentScene () -> GetName () == selectName) {
if (fpVisManager -> GetCurrentSceneHandler () -> GetName () == selectName) {
G4cout << " already selected." << endl;
}
else {
G4cout << " being selected." << endl;
fpVisManager -> SetCurrentScene (list [iSH]);
fpVisManager -> SetCurrentSceneHandler (list [iSH]);
}
}
else {
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsSceneInclude.cc,v 2.3 1998/11/29 15:34:10 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisCommandsSceneInclude.cc,v 1.3 1999/01/11 00:48:34 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
// /vis/scene commands - John Allison 9th August 1998
@@ -39,7 +39,7 @@ G4String G4VisCommandSceneIncludeHits::GetCurrentValue (G4UIcommand* command) {
void G4VisCommandSceneIncludeHits::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4SceneDataObjectList& list = fpVisManager -> SetSceneDataObjectList ();
G4SceneList& list = fpVisManager -> SetSceneList ();
if (list.isEmpty ()) {
G4cout << "No scenes - please create one before adding anything."
<< endl;
@@ -47,12 +47,11 @@ void G4VisCommandSceneIncludeHits::SetNewValue (G4UIcommand* command,
}
G4HitsModel* model = new G4HitsModel;
const G4String& currentSceneName =
fpVisManager -> GetCurrentSceneData ().GetName ();
(list [currentSceneName]).AddEndOfEventModel (model);
UpdateVisManagerSceneDataAndViewParameters ();
G4cout << "Hits will be drawn at end of event when scene \""
<< currentSceneName << "\" is current"
G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene ();
const G4String& currentSceneName = pCurrentScene -> GetName ();
pCurrentScene -> AddEndOfEventModel (model);
G4cout << "Hits will be drawn in scene \""
<< currentSceneName << "\"."
<< endl;
}
@@ -79,7 +78,7 @@ G4String G4VisCommandSceneIncludeTrajectories::GetCurrentValue (G4UIcommand* com
void G4VisCommandSceneIncludeTrajectories::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4SceneDataObjectList& list = fpVisManager -> SetSceneDataObjectList ();
G4SceneList& list = fpVisManager -> SetSceneList ();
if (list.isEmpty ()) {
G4cout << "No scenes - please create one before adding anything."
<< endl;
@@ -87,11 +86,10 @@ void G4VisCommandSceneIncludeTrajectories::SetNewValue (G4UIcommand* command,
}
G4TrajectoriesModel* model = new G4TrajectoriesModel;
const G4String& currentSceneName =
fpVisManager -> GetCurrentSceneData ().GetName ();
(list [currentSceneName]).AddEndOfEventModel (model);
UpdateVisManagerSceneDataAndViewParameters ();
G4cout << "Trajectories will be drawn at end of event when scene \""
<< currentSceneName << "\" is current"
G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene ();
const G4String& currentSceneName = pCurrentScene -> GetName ();
pCurrentScene -> AddEndOfEventModel (model);
G4cout << "Trajectories will be drawn in scene \""
<< currentSceneName << "\"."
<< endl;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsViewer.cc,v 2.3 1998/12/09 23:56:30 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisCommandsViewer.cc,v 1.6 1999/05/10 14:04:18 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// /vis/viewer commands - John Allison 25th October 1998
@@ -26,23 +26,25 @@
G4VVisCommandViewer::G4VVisCommandViewer () {}
G4VVisCommandViewer::~G4VVisCommandViewer () {}
G4String G4VVisCommandViewer::ShortName (const G4String& name) {
G4String shortName = name;
if (name.contains (' ')) {
shortName = name (0, name.first (' '));
G4String shortName (name);
if (shortName.contains (' ')) {
shortName = shortName (0, shortName.first (' '));
}
return shortName;
}
void G4VVisCommandViewer::UpdateCandidateLists () {
const G4SceneList& sceneHandlerList = fpVisManager -> GetAvailableScenes ();
const G4SceneHandlerList& sceneHandlerList = fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.entries ();
fViewerNameList = G4String ();
for (int iHandler = 0; iHandler < nHandlers; iHandler++) {
G4VScene* sceneHandler = sceneHandlerList [iHandler];
const G4VViewList& viewerList = sceneHandler -> GetViewList ();
G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
for (int iViewer = 0; iViewer < viewerList.entries (); iViewer++) {
const G4String& viewerName = viewerList [iViewer] -> GetName ();
fViewerNameList += ShortName (viewerName) + " ";
@@ -99,7 +101,7 @@ G4String G4VisCommandViewerCreate::NextName () {
const int charLength = 100;
char nextName [charLength];
ostrstream ost (nextName, charLength);
G4VScene* sceneHandler = fpVisManager -> GetCurrentScene ();
G4VSceneHandler* sceneHandler = fpVisManager -> GetCurrentSceneHandler ();
ost << "viewer-" << fId << " (";
if (sceneHandler) {
ost << sceneHandler -> GetGraphicsSystem () -> GetName ();
@@ -113,7 +115,8 @@ G4String G4VisCommandViewerCreate::NextName () {
G4String G4VisCommandViewerCreate::GetCurrentValue (G4UIcommand* command) {
G4String currentValue;
G4VScene* currentSceneHandler = fpVisManager -> GetCurrentScene ();
G4VSceneHandler* currentSceneHandler =
fpVisManager -> GetCurrentSceneHandler ();
if (currentSceneHandler) {
currentValue = currentSceneHandler -> GetName ();
}
@@ -152,11 +155,11 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command,
newName = newName.strip (G4String::both, ' ');
newName = newName.strip (G4String::both, '"');
const G4SceneList& sceneHandlerList = fpVisManager -> GetAvailableScenes ();
const G4SceneHandlerList& sceneHandlerList = fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.entries ();
if (nHandlers <= 0) {
G4cout << "G4VisCommandViewerCreate::SetNewValue: no scene handlers."
"\n Create a scene handler with \"/vis/create/sceneHandler\""
"\n Create a scene handler with \"/vis/sceneHandler/create\""
<< endl;
return;
}
@@ -177,9 +180,9 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command,
// Valid index. Set current scene handler and graphics system in
// preparation for creating viewer.
G4VScene* sceneHandler = sceneHandlerList [iHandler];
if (sceneHandler != fpVisManager -> GetCurrentScene ()) {
fpVisManager -> SetCurrentScene (sceneHandler);
G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
if (sceneHandler != fpVisManager -> GetCurrentSceneHandler ()) {
fpVisManager -> SetCurrentSceneHandler (sceneHandler);
}
// Now deal with name of viewer.
@@ -190,8 +193,8 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command,
if (newName == nextName) fId++;
for (iHandler = 0; iHandler < nHandlers; iHandler++) {
G4VScene* sceneHandler = sceneHandlerList [iHandler];
const G4VViewList& viewerList = sceneHandler -> GetViewList ();
G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
for (int iViewer = 0; iViewer < viewerList.entries (); iViewer++) {
if (viewerList [iViewer] -> GetName () == newName ) {
G4cout << "Viewer \"" << newName << "\" already exists." << endl;
@@ -201,7 +204,7 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command,
}
// Create viewer.
fpVisManager -> CreateView (newName);
fpVisManager -> CreateViewer (newName);
G4cout << "New viewer \"" << newName << "\" created." << endl;
UpdateCandidateLists ();
@@ -245,34 +248,67 @@ void G4VisCommandViewerList::SetNewValue (G4UIcommand* command,
G4int verbosity;
istrstream is ((char*)newValue.data());
is >> name >> verbosity;
G4String shortName = ShortName (name);
G4bool found = false;
const G4SceneList& sceneHandlerList = fpVisManager -> GetAvailableScenes ();
const G4VViewer* currentViewer = fpVisManager -> GetCurrentViewer ();
G4String currentViewerShortName;
if (currentViewer) {
currentViewerShortName = ShortName (currentViewer -> GetName ());
}
else {
currentViewerShortName = "none";
}
const G4SceneHandlerList& sceneHandlerList = fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.entries ();
G4bool found = false;
G4bool foundCurrent = false;
for (int iHandler = 0; iHandler < nHandlers; iHandler++) {
G4VScene* sceneHandler = sceneHandlerList [iHandler];
const G4VViewList& viewerList = sceneHandler -> GetViewList ();
for (int iViewer = 0; iViewer < viewerList.entries (); iViewer++) {
if (name != "all") {
if (name != viewerList [iViewer] -> GetName ()) continue;
}
found = true;
G4cout << "Scene handler \"" << sceneHandler -> GetName ()
<< "\": viewer \"" << viewerList [iViewer] -> GetName ()
<< "\"";
if (verbosity > 0) {
G4cout << "\n " << *(viewerList [iViewer]);
G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
const G4Scene* pScene = sceneHandler -> GetScene ();
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
G4cout << "Scene handler \"" << sceneHandler -> GetName ()
<< "\", scene \"" << pScene -> GetName () << "\":";
G4int nViewers = viewerList.entries ();
if (nViewers == 0) {
G4cout << "\n No viewers for this scene handler." << endl;
}
else {
for (int iViewer = 0; iViewer < nViewers; iViewer++) {
const G4VViewer* thisViewer = viewerList [iViewer];
G4String thisName = thisViewer -> GetName ();
G4String thisShortName = ShortName (thisName);
if (name != "all") {
if (thisShortName != shortName) continue;
}
found = true;
G4cout << "\n ";
if (thisShortName == currentViewerShortName) {
foundCurrent = true;
G4cout << "(current)";
}
else {
G4cout << " ";
}
G4cout << " viewer \"" << thisName << "\"";
if (verbosity > 0) {
G4cout << "\n " << *thisViewer << '\n';
}
}
G4cout << endl;
}
}
if (!foundCurrent) {
G4cout << "No valid current viewer - please create or select one." << endl;
}
if (!found) {
G4cout << "No viewers found";
G4cout << "No viewers";
if (name != "all") {
G4cout << " of name \"" << name << "\"";
}
G4cout << "." << endl;
G4cout << " found." << endl;
}
}
@@ -297,7 +333,7 @@ G4VisCommandViewerRemove::~G4VisCommandViewerRemove () {
}
G4String G4VisCommandViewerRemove::GetCurrentValue (G4UIcommand* command) {
G4VView* viewer = fpVisManager -> GetCurrentView ();
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (viewer) {
return viewer -> GetName ();
}
@@ -310,22 +346,25 @@ void G4VisCommandViewerRemove::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String& removeName = newValue;
G4String removeShortName = ShortName (removeName);
G4VView* currentViewer = fpVisManager -> GetCurrentView ();
G4VViewer* currentViewer = fpVisManager -> GetCurrentViewer ();
G4String currentName;
if (currentViewer) {
currentName = currentViewer -> GetName ();
}
else {
currentName = "none";
}
G4String currentShortName = ShortName (currentName);
const G4SceneList& sceneHandlerList = fpVisManager -> GetAvailableScenes ();
const G4SceneHandlerList& sceneHandlerList = fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.entries ();
G4int iHandler, iViewer;
G4VScene* sceneHandler;
G4VView* viewer;
G4VSceneHandler* sceneHandler;
G4VViewer* viewer;
G4bool found = false;
for (iHandler = 0; iHandler < nHandlers; iHandler++) {
sceneHandler = sceneHandlerList [iHandler];
const G4VViewList& viewerList = sceneHandler -> GetViewList ();
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
for (iViewer = 0; iViewer < viewerList.entries (); iViewer++) {
viewer = viewerList [iViewer];
const G4String& viewerName = viewer -> GetName ();
@@ -345,10 +384,10 @@ void G4VisCommandViewerRemove::SetNewValue (G4UIcommand* command,
G4cout << "Viewer \"" << removeName << "\" removed." << endl;
if (removeShortName == currentShortName) {
fpVisManager -> DeleteCurrentView ();
fpVisManager -> DeleteCurrentViewer ();
}
else {
sceneHandler -> SetViewList ().remove (viewer);
sceneHandler -> SetViewerList ().remove (viewer);
G4cout << "Current viewer unchanged." << endl;
}
@@ -377,7 +416,7 @@ G4VisCommandViewerSelect::~G4VisCommandViewerSelect () {
G4String G4VisCommandViewerSelect::GetCurrentValue
(G4UIcommand* command) {
G4VView* viewer = fpVisManager -> GetCurrentView ();
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (viewer) {
return viewer -> GetName ();
}
@@ -391,15 +430,16 @@ void G4VisCommandViewerSelect::SetNewValue (G4UIcommand* command,
G4String& selectName = newValue;
G4String selectShortName = ShortName (selectName);
const G4SceneList& sceneHandlerList = fpVisManager -> GetAvailableScenes ();
const G4SceneHandlerList& sceneHandlerList =
fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.entries ();
G4int iHandler, iViewer;
G4VScene* sceneHandler;
G4VView* viewer;
G4VSceneHandler* sceneHandler;
G4VViewer* viewer;
G4bool found = false;
for (iHandler = 0; iHandler < nHandlers; iHandler++) {
sceneHandler = sceneHandlerList [iHandler];
const G4VViewList& viewerList = sceneHandler -> GetViewList ();
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
for (iViewer = 0; iViewer < viewerList.entries (); iViewer++) {
viewer = viewerList [iViewer];
if (selectShortName == ShortName (viewer -> GetName ())) {
@@ -407,17 +447,19 @@ void G4VisCommandViewerSelect::SetNewValue (G4UIcommand* command,
break;
}
}
if (found) break;
}
G4cout << "Viewer \"" << selectName << "\"";
if (found) {
if (ShortName (fpVisManager -> GetCurrentView () -> GetName ())
== selectShortName) {
G4VViewer* currentViewer = fpVisManager -> GetCurrentViewer ();
if (currentViewer &&
ShortName (currentViewer -> GetName ()) == selectShortName) {
G4cout << " already selected." << endl;
}
else {
G4cout << " being selected." << endl;
fpVisManager -> SetCurrentView (viewer);
fpVisManager -> SetCurrentViewer (viewer);
}
}
else {
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisFeaturesOfDAWNFILE.cc,v 2.2 1998/07/12 03:10:19 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.2 1999/01/09 16:31:25 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#include "G4VisFeaturesOfDAWNFILE.hh"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisFeaturesOfFukuiRenderer.cc,v 2.2 1998/07/12 03:10:20 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.2 1999/01/09 16:31:26 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisFeaturesOfOpenGL.cc,v 2.1 1998/07/12 03:10:21 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisFeaturesOfOpenGL.cc,v 1.2 1999/01/09 16:31:26 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisFeaturesOfOpenInventor.cc,v 2.1 1998/09/11 15:10:41 jkallenb Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisFeaturesOfOpenInventor.cc,v 1.2 1999/01/09 16:31:27 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisFeaturesOfRay.cc,v 2.0 1998/07/02 16:49:56 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisFeaturesOfRay.cc,v 1.2 1999/01/09 16:31:27 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessCamera.cc,v 2.3 1998/07/13 17:12:30 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisManMessCamera.cc,v 1.3 1999/01/11 00:48:35 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -200,10 +200,10 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
fpVMan -> PrintCurrentView ();
}
}
// fpVMan -> GetCurrentView () -> ClearView (); // Clears buffer only.
// fpVMan -> GetCurrentViewer () -> ClearView (); // Clears buffer only.
// fpVMan -> Draw ();
// fpVMan -> Show ();
G4VView* pView = fpVMan -> GetCurrentView ();
G4VViewer* pView = fpVMan -> GetCurrentViewer ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
@@ -225,7 +225,7 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
fpVMan -> SetCurrentViewParameters ().SetLightsMoveWithCamera (false);
for (int i = 0; i < nFrames; i++) {
RotateViewpointAboutUpVectorBy (dbeta);
fpVMan -> GetCurrentView () -> ClearView (); // Clears buffer only.
fpVMan -> GetCurrentViewer () -> ClearView (); // Clears buffer only.
fpVMan -> Draw ();
fpVMan -> Show ();
}
@@ -248,10 +248,10 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
fpVMan -> PrintCurrentView ();
}
}
// fpVMan -> GetCurrentView () -> ClearView (); // Clears buffer only.
// fpVMan -> GetCurrentViewer () -> ClearView (); // Clears buffer only.
// fpVMan -> Draw ();
// fpVMan -> Show ();
G4VView* pView = fpVMan -> GetCurrentView ();
G4VViewer* pView = fpVMan -> GetCurrentViewer ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
@@ -312,11 +312,11 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
}
}
// if (ViewValid ()) {
// fpVMan -> GetCurrentView () -> ClearView ();
// fpVMan -> GetCurrentViewer () -> ClearView ();
// fpVMan -> Draw ();
// fpVMan -> Show ();
// }
G4VView* pView = fpVMan -> GetCurrentView ();
G4VViewer* pView = fpVMan -> GetCurrentViewer ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
@@ -338,7 +338,7 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
fpVMan -> SetCurrentViewParameters ().SetLightsMoveWithCamera (true);
for (int i = 0; i < nFrames; i++) {
RotateViewpointAboutUpVectorBy (dbeta);
fpVMan -> GetCurrentView () -> ClearView (); // Clears buffer only.
fpVMan -> GetCurrentViewer () -> ClearView (); // Clears buffer only.
fpVMan -> Draw ();
fpVMan -> Show ();
}
@@ -369,11 +369,11 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
}
}
// if (ViewValid ()) {
// fpVMan -> GetCurrentView () -> ClearView (); // Clears buffer only.
// fpVMan -> GetCurrentViewer () -> ClearView (); // Clears buffer only.
// fpVMan -> Draw ();
// fpVMan -> Show ();
// }
G4VView* pView = fpVMan -> GetCurrentView ();
G4VViewer* pView = fpVMan -> GetCurrentViewer ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
@@ -411,10 +411,10 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
fpVMan -> PrintCurrentView ();
}
}
// fpVMan -> GetCurrentView () -> ClearView (); // Clears buffer only.
// fpVMan -> GetCurrentViewer () -> ClearView (); // Clears buffer only.
// fpVMan -> Draw ();
// fpVMan -> Show ();
G4VView* pView = fpVMan -> GetCurrentView ();
G4VViewer* pView = fpVMan -> GetCurrentViewer ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessCreateView.cc,v 2.4 1998/07/13 17:12:31 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisManMessCreateView.cc,v 1.3 1999/01/11 00:48:36 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -140,7 +140,7 @@ void G4VisManMessenger::DoCommandCreateView (const G4String& commandPath,
if (iGS >=0 && iGS < nSystems) {
// Valid index. Create view.
G4VGraphicsSystem* pSystem = gsl [iGS];;
fpVMan -> SetCurrentGraphicsSystemAndCreateView (pSystem);
fpVMan -> SetCurrentGraphicsSystemAndCreateViewer (pSystem);
if (fpVMan -> GetVerboseLevel () > 0) {
G4cout << "Graphics system set to " << pSystem -> GetName () << endl;
if (fpVMan -> GetVerboseLevel () > 1) {
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessDraw.cc,v 2.7 1998/08/14 08:48:45 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisManMessDraw.cc,v 1.4 1999/04/16 09:06:09 mora Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -23,7 +23,7 @@
#include "G4UnitsTable.hh"
#include "G4ios.hh"
#include "G4GlobalFastSimulationManager.hh"
#include "G4VGlobalFastSimulationManager.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4FlavoredParallelWorldModel.hh"
@@ -226,24 +226,24 @@ void G4VisManMessenger::DoCommandDraw (const G4String& commandPath,
G4cout<< "grafic system not yet avaliable." << endl;
return;
}
G4GlobalFastSimulationManager* theGlobalFastSimulationManager;
G4VGlobalFastSimulationManager* theGlobalFastSimulationManager;
if(!(theGlobalFastSimulationManager =
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager())){
G4VGlobalFastSimulationManager::GetConcreteInstance ())){
G4cout<< "WARNING: none G4GlobalFastSimulationManager" << endl;
return;
}
G4ParticleTable* theParticleTable=G4ParticleTable::GetParticleTable();
G4SceneData& currentScene = theVisManager -> SetCurrentSceneData ();
G4Scene* currentScene = theVisManager -> GetCurrentScene ();
// Ok, lets look on the parameters
if(newValues=="all") {
G4FlavoredParallelWorld* CurrentFlavoredWorld;
G4VFlavoredParallelWorld* CurrentFlavoredWorld;
for (G4int iParticle=0; iParticle<theParticleTable->entries();
iParticle++)
if(CurrentFlavoredWorld=theGlobalFastSimulationManager->
GetFlavoredWorldForThis(theParticleTable->
GetParticle(iParticle)))
currentScene.AddRunDurationModel
currentScene -> AddRunDurationModel
(new G4FlavoredParallelWorldModel (CurrentFlavoredWorld));
G4cout << "Ghosts added to the Scene, refresh the view to see it."
<< endl;
@@ -255,13 +255,13 @@ void G4VisManMessenger::DoCommandDraw (const G4String& commandPath,
G4cout << newValues << ": not found this particle name!" << endl;
return;
}
G4FlavoredParallelWorld* worldForThis;
G4VFlavoredParallelWorld* worldForThis;
if(worldForThis=theGlobalFastSimulationManager->
GetFlavoredWorldForThis(currentParticle)) {
currentScene.AddRunDurationModel
currentScene -> AddRunDurationModel
(new G4FlavoredParallelWorldModel (worldForThis));
G4cout << "Ghosts added to the Scene, refresh the view to see it."
<< endl;
<< endl;
}
else G4cout << "There are no ghosts for "<<newValues<<endl;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessExpert.cc,v 2.4 1998/07/16 02:06:08 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisManMessExpert.cc,v 1.3 1999/01/11 00:48:37 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -285,7 +285,7 @@ void G4VisManMessenger::DoCommandExpert (const G4String& commandPath,
// Given a physical volume...
G4VPhysicalVolume* pPhysVol =
fpVMan -> GetCurrentSceneData ().GetPhysicalVolume ();
fpVMan -> GetCurrentScene ().GetPhysicalVolume ();
// Given its transformation (normally, this would be known from
// the hits or digis information)...
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessLights.cc,v 2.3 1998/07/13 17:12:35 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisManMessLights.cc,v 1.3 1999/01/11 00:48:38 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -70,7 +70,7 @@ void G4VisManMessenger::DoCommandLights (const G4String& commandPath,
}
}
if (ViewValid ()) {
fpVMan -> GetCurrentView () -> ClearView (); // Clears buffer only.
fpVMan -> GetCurrentViewer () -> ClearView (); // Clears buffer only.
fpVMan -> Draw ();
fpVMan -> Show ();
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessSet.cc,v 2.5 1998/07/19 05:53:54 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisManMessSet.cc,v 1.3 1999/01/11 00:48:39 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -236,7 +236,7 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
G4cout << "\nDensity cut is now: "
<< getVP.GetVisibleDensity () * cm3 / g << " g/cm3.";
G4cout << endl;
G4VView* pView = fpVMan -> GetCurrentView ();
G4VViewer* pView = fpVMan -> GetCurrentViewer ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (getVP);
@@ -340,7 +340,7 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
fpVMan -> PrintCurrentView ();
}
//}
G4VView* pView = fpVMan -> GetCurrentView ();
G4VViewer* pView = fpVMan -> GetCurrentViewer ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (getVP);
@@ -386,7 +386,7 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
if (getVP.IsMarkerNotHidden ()) G4cout << "not";
G4cout << " hidden by surfaces." << endl;
//}
G4VView* pView = fpVMan -> GetCurrentView ();
G4VViewer* pView = fpVMan -> GetCurrentViewer ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (getVP);
@@ -441,7 +441,7 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
G4cout << "\nSection plane is now: "
<< getVP.GetSectionPlane ();
G4cout << endl;
G4VView* pView = fpVMan -> GetCurrentView ();
G4VViewer* pView = fpVMan -> GetCurrentViewer ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (getVP);
@@ -488,7 +488,7 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
fpVMan -> PrintCurrentView ();
}
}
G4VView* pView = fpVMan -> GetCurrentView ();
G4VViewer* pView = fpVMan -> GetCurrentViewer ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
@@ -554,7 +554,7 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
G4cout << "Temporary algorithm..." << endl;
G4VPhysicalVolume* pVPV =
fpVMan -> GetCurrentSceneData ().GetPhysicalVolume ();
fpVMan -> GetCurrentScene ().GetPhysicalVolume ();
G4VPhysicalVolume* pNewVPV = 0;
if (pVPV) {
@@ -631,15 +631,15 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
/////////////////////////////////////////// /vis~/set/view /////////
if (commandPath == "/vis~/set/view") {
// Make List of available views.
RWTPtrOrderedVector<G4VView> vList;
const G4SceneList& gml = fpVMan -> GetAvailableScenes ();
RWTPtrOrderedVector<G4VViewer> vList;
const G4SceneHandlerList& gml = fpVMan -> GetAvailableSceneHandlers ();
G4int nViewTotal = 0;
G4int iGM, nScenes = gml.entries ();
for (iGM = 0; iGM < nScenes; iGM++) {
const G4VViewList& views = gml [iGM] -> GetViewList ();
const G4ViewerList& views = gml [iGM] -> GetViewerList ();
int nViews = views.entries ();
for (int iView = 0; iView < nViews; iView++) {
G4VView* pView = views [iView];
G4VViewer* pView = views [iView];
vList.append (pView);
nViewTotal++;
}
@@ -655,8 +655,8 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
if (iSelect < 0 || iSelect >= nViewTotal) {
G4cout << "Available views:";
for (int iView = 0; iView < nViewTotal; iView++) {
const G4VView* pView = vList [iView];
const G4VScene* pScene = pView -> GetScene ();
const G4VViewer* pView = vList [iView];
const G4VSceneHandler* pScene = pView -> GetScene ();
const G4VGraphicsSystem* pSystem = pScene -> GetGraphicsSystem ();
G4cout << "\n " << iView << ") " << pView -> GetName ();
}
@@ -664,8 +664,8 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
G4cout << endl;
}
else {
G4VView* pView = vList[iSelect];
fpVMan -> SetCurrentView (pView);
G4VViewer* pView = vList[iSelect];
fpVMan -> SetCurrentViewer (pView);
if (fpVMan -> GetVerboseLevel () > 0) {
G4cout << "Current view now " << pView -> GetName () << endl;
if (fpVMan -> GetVerboseLevel () > 1) {
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessenger.cc,v 2.6 1998/08/09 17:54:42 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisManMessenger.cc,v 1.2 1999/01/09 16:31:32 allison Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
File diff suppressed because it is too large Load Diff
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManagerRegisterMessengers.cc,v 2.10 1998/12/09 23:55:57 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisManagerRegisterMessengers.cc,v 1.6 1999/05/25 09:14:21 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// G4VisManager::RegisterMessengers - John Allison 30/July/1998.
@@ -48,20 +48,6 @@ Introduction
============
This note defines the concepts of scene, scene handler and viewers.
For reasons which are lost in history they correspond to confusingly
differently named objects in Geant4. What we would like to call a
scene is a G4SceneData object and a G4VScene object is a scene
handler. Similarly a viewer is represented by a G4VView object.
However, this is historical, and changing C++ names is a pain. I dont
plan to change names right now!!
The situation ca be summarised as follows:
Working Concept (Terms Used Below) Geant4 C++ Object
---------------------------------- -----------------
scene G4SceneData
scene handler Sub-class of G4VScene
viewer Sub-class of G4VView
Scenes
======
@@ -88,7 +74,7 @@ manages a list of scenes.
* /vis/scene/set/hitOption accumulate|byEvent
* /vis/scene/set/notifyOption immediate|delayed
* /vis/scene/set/modelingStyle [<modeling-style>]
* /vis/scene/notifyHandlers
/vis/scene/notifyHandlers
Scene Handlers
@@ -99,7 +85,8 @@ into something that the graphics system can understand.
The commands would look something like:
/vis/sceneHandler/create <graphics-system> [<scene-handler-name>]
/vis/sceneHandler/create
<graphics-system> [<scene-handler-name>] [<scene-name>]
/vis/sceneHandler/attach [<scene-name>]
/vis/sceneHandler/list
/vis/sceneHandler/select [<scene-handler-name>]
@@ -193,7 +180,7 @@ or some such.
command -> SetGuidance ("Operations on Geant4 scenes.");
fMessengerList.append (new G4VisCommandSceneCreate);
fMessengerList.append (new G4VisCommandSceneList);
// fMessengerList.append (new G4VisCommandSceneNotifyHandlers); (Not ready!)
fMessengerList.append (new G4VisCommandSceneNotifyHandlers);
fMessengerList.append (new G4VisCommandSceneSelect);
fMessengerList.append (new G4VisCommandSceneRemove);
command = new G4UIdirectory ("/vis/scene/add/");
@@ -227,20 +214,20 @@ or some such.
// Clear - OLD STYLE!!
fMessengerList.append
(new G4VisCommandDirectoryMessenger <G4VisCommandClear>);
fMessengerList.append
(new G4VisSimpleCommandMessenger <G4VisCommandClearScene>);
// fMessengerList.append
// (new G4VisSimpleCommandMessenger <G4VisCommandClearScene>);
fMessengerList.append
(new G4VisSimpleCommandMessenger <G4VisCommandClearView>);
fMessengerList.append
(new G4VisSimpleCommandMessenger <G4VisCommandClearViewAndScene>);
// fMessengerList.append
// (new G4VisSimpleCommandMessenger <G4VisCommandClearViewAndScene>);
// Copy - OLD STYLE!!
fMessengerList.append
(new G4VisCommandDirectoryMessenger <G4VisCommandCopy>);
fMessengerList.append
(new G4VisSimpleCommandMessenger <G4VisCommandCopyAll>);
fMessengerList.append
(new G4VisSimpleCommandMessenger <G4VisCommandCopyScene>);
// fMessengerList.append
// (new G4VisSimpleCommandMessenger <G4VisCommandCopyAll>);
// fMessengerList.append
// (new G4VisSimpleCommandMessenger <G4VisCommandCopyScene>);
fMessengerList.append
(new G4VisSimpleCommandMessenger <G4VisCommandCopyView>);
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisToOldVisCommands.cc,v 1.1 1998/12/09 23:55:00 allison Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VisToOldVisCommands.cc,v 1.3 1999/06/19 16:29:01 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// Implements some /vis/ commands as /vis~/ temporarily.
@@ -67,7 +67,7 @@ void G4VisToOldVisCommands::SetNewValue
"\n /vis/viewer/create"
"\nThis way you can also use \"/vis/scene/addVolume\" to select"
"\n sub-detector components. (The command is still available"
"\n as \"/vis~/create_view/new_graphics/system " << newValues <<
"\n as \"/vis~/create_view/new_graphics_system " << newValues <<
"\".)"
<< endl;
}