Import Geant4 3.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:03:00 +02:00
parent cfcb558cfe
commit 137e303ecc
2843 changed files with 37082 additions and 38426 deletions
@@ -0,0 +1,19 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GraphicsSystemList.cc,v 1.2 2001/03/07 14:37:45 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
#include "G4GraphicsSystemList.hh"
void G4GraphicsSystemList::remove(G4VGraphicsSystem* graphicsSystem) {
G4GraphicsSystemListIterator iGS;
for (iGS = begin(); iGS != end(); ++iGS) {
if (*iGS == graphicsSystem) break;
}
if (iGS != end()) erase(iGS);
}
+19 -14
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Scene.cc,v 1.5 1999/12/15 14:54:24 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4Scene.cc,v 1.6 2001/02/23 15:43:22 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Scene data John Allison 19th July 1996.
@@ -26,7 +26,7 @@ G4Scene::G4Scene (const G4String& name):
G4Scene::~G4Scene () {}
G4bool G4Scene::AddRunDurationModel (G4VModel* pModel) {
G4int i, nModels = fRunDurationModelList.entries ();
G4int i, nModels = fRunDurationModelList.size ();
for (i = 0; i < nModels; i++) {
if (pModel -> GetGlobalDescription () ==
fRunDurationModelList [i] -> GetGlobalDescription ()) break;
@@ -40,8 +40,8 @@ G4bool G4Scene::AddRunDurationModel (G4VModel* pModel) {
<< G4endl;
return false;
}
fRunDurationModelList.append (pModel);
nModels = fRunDurationModelList.entries (); // ...has increased by 1...
fRunDurationModelList.push_back (pModel);
nModels = fRunDurationModelList.size (); // ...has increased by 1...
G4BoundingSphereScene boundingSphereScene;
for (i = 0; i < nModels; i++) {
const G4VisExtent& thisExtent =
@@ -88,7 +88,7 @@ G4bool G4Scene::AddWorldIfEmpty () {
}
G4bool G4Scene::AddEndOfEventModel (G4VModel* pModel) {
G4int i, nModels = fEndOfEventModelList.entries ();
G4int i, nModels = fEndOfEventModelList.size ();
for (i = 0; i < nModels; i++) {
if (pModel -> GetGlobalDescription () ==
fEndOfEventModelList [i] -> GetGlobalDescription ()) break;
@@ -102,13 +102,18 @@ G4bool G4Scene::AddEndOfEventModel (G4VModel* pModel) {
<< G4endl;
return false;
}
fEndOfEventModelList.append (pModel);
fEndOfEventModelList.push_back (pModel);
return true;
}
void G4Scene::Clear () {
fRunDurationModelList.clearAndDestroy ();
fEndOfEventModelList.clearAndDestroy ();
int i;
for (i = 0; i < fRunDurationModelList.size(); ++i) {
delete fRunDurationModelList[i];
}
for (i = 0; i < fEndOfEventModelList.size(); ++i) {
delete fEndOfEventModelList[i];
}
}
G4std::ostream& operator << (G4std::ostream& os, const G4Scene& d) {
@@ -116,12 +121,12 @@ G4std::ostream& operator << (G4std::ostream& os, const G4Scene& d) {
os << "Scene data:";
os << "\n Run-duration model list:";
for (int i = 0; i < d.fRunDurationModelList.entries (); i++) {
for (int i = 0; i < d.fRunDurationModelList.size (); i++) {
os << "\n " << *(d.fRunDurationModelList[i]);
}
os << "\n End-of-event model list:";
for (int ii = 0; ii < d.fEndOfEventModelList.entries (); ii++) {
for (int ii = 0; ii < d.fEndOfEventModelList.size (); ii++) {
os << "\n " << *(d.fEndOfEventModelList[ii]);
}
@@ -134,13 +139,13 @@ G4std::ostream& operator << (G4std::ostream& os, const G4Scene& d) {
G4bool G4Scene::operator != (const G4Scene& s) const {
if (
(fRunDurationModelList.entries () !=
s.fRunDurationModelList.entries ()) ||
(fRunDurationModelList.size () !=
s.fRunDurationModelList.size ()) ||
(fExtent != s.fExtent) ||
!(fStandardTargetPoint == s.fStandardTargetPoint)
) return true;
for (int i = 0; i < fRunDurationModelList.entries (); i++) {
for (int i = 0; i < fRunDurationModelList.size (); i++) {
if (fRunDurationModelList[i] != s.fRunDurationModelList[i])
return true;
}
@@ -0,0 +1,19 @@
// This code implementation is the intellectual property of
// the 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: G4SceneHandlerList.cc,v 1.2 2001/03/07 14:37:47 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
#include "G4SceneHandlerList.hh"
void G4SceneHandlerList::remove(G4VSceneHandler* sceneHandler) {
G4SceneHandlerListIterator iSceneHandler;
for (iSceneHandler = begin(); iSceneHandler != end(); ++iSceneHandler) {
if (*iSceneHandler == sceneHandler) break;
}
if (iSceneHandler != end()) erase(iSceneHandler);
}
@@ -0,0 +1,19 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SceneList.cc,v 1.4 2001/03/07 14:37:48 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
#include "G4SceneList.hh"
void G4SceneList::remove(G4Scene* scene) {
G4SceneListIterator iScene;
for (iScene = begin(); iScene != end(); ++iScene) {
if (*iScene == scene) break;
}
if (iScene != end()) erase(iScene);
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VGraphicsSystem.cc,v 1.5 1999/12/15 14:54:25 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VGraphicsSystem.cc,v 1.6 2001/02/23 15:43:24 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// John Allison 27th March 1996
@@ -54,7 +54,7 @@ G4std::ostream& operator << (G4std::ostream& os, const G4VGraphicsSystem& gs) {
}
os << "\n Functionality: " << gs.GetFunctionality ();
if (pVMan -> GetVerboseLevel () > 1) {
G4int nScenes = scenes.entries ();
G4int nScenes = scenes.size ();
if (nScenes) {
G4int nScenesOfThisSystem = 0;
for (int i = 0; i < nScenes; i++) {
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VSceneHandler.cc,v 1.11 2000/05/22 08:27:29 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VSceneHandler.cc,v 1.12 2001/02/23 15:43:24 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// John Allison 19th July 1996
@@ -76,7 +76,10 @@ G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4S
}
G4VSceneHandler::~G4VSceneHandler () {
fViewerList.clearAndDestroy ();
G4ViewerListIterator i;
for (i = fViewerList.begin(); i != fViewerList.end(); ++i) {
delete *i;
}
}
void G4VSceneHandler::EndModeling () {}
@@ -154,7 +157,7 @@ void G4VSceneHandler::AddThis (const G4VSolid& solid) {
}
void G4VSceneHandler::AddViewerToList (G4VViewer* pViewer) {
fViewerList.append (pViewer);
fViewerList.push_back (pViewer);
}
void G4VSceneHandler::EstablishSpecials (G4PhysicalVolumeModel& pvModel) {
@@ -220,14 +223,15 @@ void G4VSceneHandler::AddPrimitive (const G4Polymarker& polymarker) {
}
void G4VSceneHandler::RemoveViewerFromList (G4VViewer* pViewer) {
fViewerList.remove (pViewer);
fViewerList.remove(pViewer);
}
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 ();
G4ViewerListIterator i;
for (i = fViewerList.begin(); i != fViewerList.end(); i++) {
(*i) -> SetNeedKernelVisit ();
}
}
@@ -288,13 +292,13 @@ void G4VSceneHandler::ProcessScene (G4VViewer& view) {
// Traverse geometry tree and send drawing primitives to window(s).
const G4RWTPtrOrderedVector <G4VModel>& runDurationModelList =
const G4std::vector<G4VModel*>& runDurationModelList =
fpScene -> GetRunDurationModelList ();
if (runDurationModelList.entries ()) {
if (runDurationModelList.size ()) {
G4cout << "Traversing scene data..." << G4endl;
G4ModelingParameters* pMP = CreateModelingParameters ();
for (int i = 0; i < runDurationModelList.entries (); i++) {
for (int i = 0; i < runDurationModelList.size (); i++) {
G4VModel* pModel = runDurationModelList[i];
const G4ModelingParameters* tempMP =
pModel -> GetModelingParameters ();
@@ -471,8 +475,8 @@ G4double G4VSceneHandler::GetMarkerSize (const G4VMarker& marker,
G4std::ostream& operator << (G4std::ostream& os, const G4VSceneHandler& s) {
os << "Scene " << s.fName << " has "
<< s.fViewerList.entries () << " viewers:";
for (int i = 0; i < s.fViewerList.entries (); i++) {
<< s.fViewerList.size () << " viewers:";
for (int i = 0; i < s.fViewerList.size (); i++) {
os << "\n " << *(s.fViewerList [i]);
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VViewer.cc,v 1.9 2000/05/13 10:52:51 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VViewer.cc,v 1.11 2001/02/23 15:43:25 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// John Allison 27th March 1996
@@ -63,12 +63,15 @@ const G4VisAttributes* G4VViewer::GetApplicableVisAttributes
void G4VViewer::NeedKernelVisit () {
// Notify all views that a kernel visit is required.
const G4ViewerList& viewList = fSceneHandler.GetViewerList ();
for (int i = 0; i < viewList.entries (); i++) {
viewList [i] -> SetNeedKernelVisit ();
const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
G4ViewerListConstIterator i;
for (i = viewerList.begin(); i != viewerList.end(); i++) {
(*i) -> SetNeedKernelVisit ();
}
}
void G4VViewer::FinishView () {}
void G4VViewer::ShowView () {}
void G4VViewer::ProcessView () {
@@ -5,14 +5,17 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VVisCommand.cc,v 1.6 1999/12/16 17:19:31 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VVisCommand.cc,v 1.8 2001/02/06 23:36:55 johna Exp $
// GEANT4 tag $Name: geant4-03-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"
#include "G4UnitsTable.hh"
#include "g4std/strstream"
G4VVisCommand::~G4VVisCommand () {}
G4VisManager* G4VVisCommand::fpVisManager = 0;
@@ -22,3 +25,96 @@ G4std::vector <G4UIcommand*> G4VVisCommand::sceneNameCommands;
G4std::vector <G4UIcommand*> G4VVisCommand::sceneHandlerNameCommands;
G4std::vector <G4UIcommand*> G4VVisCommand::viewerNameCommands;
G4double G4VVisCommand::ValueOf(G4String unitName) {
return G4UnitDefinition::GetValueOf(unitName);
}
G4String G4VVisCommand::ConvertToString(G4bool blValue)
{
G4String vl = "false";
if(blValue) vl = "true";
return vl;
}
G4String G4VVisCommand::ConvertToString
(G4double x, G4double y, const char * unitName)
{
G4double uv = ValueOf(unitName);
char st[50];
G4std::ostrstream os(st,50);
os << x/uv << " " << y/uv << " " << unitName << G4std::ends;
G4String vl = st;
return vl;
}
G4String G4VVisCommand::ConvertToString(const G4ThreeVector& vec)
{
char st[100];
G4std::ostrstream os(st,100);
os << vec.x() << " " << vec.y() << " " << vec.z() << G4std::ends;
G4String vl = st;
return vl;
}
G4bool G4VVisCommand::GetNewBoolValue(const G4String& paramString)
{
G4String v = paramString;
v.toUpper();
G4bool vl = false;
if( v=="Y" || v=="YES" || v=="1" || v=="T" || v=="TRUE" )
{ vl = true; }
return vl;
}
G4int G4VVisCommand::GetNewIntValue(const G4String& paramString)
{
G4int vl;
const char* t = paramString;
G4std::istrstream is((char*)t);
is >> vl;
return vl;
}
G4double G4VVisCommand::GetNewDoubleValue(const G4String& paramString)
{
G4double vl;
char unts[30];
const char* t = paramString;
G4std::istrstream is((char*)t);
is >> vl >> unts;
G4String unt = unts;
return (vl*ValueOf(unt));
}
G4ThreeVector G4VVisCommand::GetNew3VectorValue(const G4String& paramString)
{
G4double vx;
G4double vy;
G4double vz;
const char* t = paramString;
G4std::istrstream is((char*)t);
is >> vx >> vy >> vz;
return G4ThreeVector(vx,vy,vz);
}
void G4VVisCommand::GetNewDoublePairValue(const G4String& paramString,
G4double& xval,
G4double& yval)
{
G4double x, y;
char unts[30];
const char* t = paramString;
G4std::istrstream is((char*)t);
is >> x >> y >> unts;
G4String unt = unts;
xval = x*ValueOf(unt);
yval = y*ValueOf(unt);
return;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ViewParameters.cc,v 1.7 2000/07/03 10:36:33 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4ViewParameters.cc,v 1.11 2001/02/23 15:47:24 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// John Allison 19th July 1996
@@ -51,7 +51,8 @@ G4ViewParameters::G4ViewParameters ():
fGlobalMarkerScale (1.),
fMarkerNotHidden (true),
fWindowSizeHintX (600),
fWindowSizeHintY (600)
fWindowSizeHintY (600),
fAutoRefresh (false)
{
fDefaultMarker.SetScreenSize (5.);
// Markers are 5 pixels radius, 10 pixels diameter.
@@ -116,8 +117,8 @@ G4double G4ViewParameters::GetFrontHalfHeight (G4double nearDistance,
void G4ViewParameters::AddCutawayPlane (const G4Plane3D& cutawayPlane) {
fCutaway = true;
if (fCutawayPlanes.entries () < 3 ) {
fCutawayPlanes.insert (cutawayPlane);
if (fCutawayPlanes.size () < 3 ) {
fCutawayPlanes.push_back (cutawayPlane);
}
else {
G4cerr << "A maximum of 3 cutaway planes supported." << G4endl;
@@ -180,7 +181,13 @@ void G4ViewParameters::SetLightpointDirection
SetViewAndLights (fViewpointDirection);
}
void G4ViewParameters::Pan (G4double right, G4double up) {
void G4ViewParameters::SetPan (G4double right, G4double up) {
G4Vector3D unitRight = (fUpVector.cross (fViewpointDirection)).unit();
G4Vector3D unitUp = (fViewpointDirection.cross (unitRight)).unit();
fCurrentTargetPoint = right * unitRight + up * unitUp;
}
void G4ViewParameters::IncrementPan (G4double right, G4double up) {
G4Vector3D unitRight = (fUpVector.cross (fViewpointDirection)).unit();
G4Vector3D unitUp = (fViewpointDirection.cross (unitRight)).unit();
fCurrentTargetPoint += right * unitRight + up * unitUp;
@@ -220,7 +227,8 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
(fDefaultMarker != v.fDefaultMarker) ||
(fGlobalMarkerScale != v.fGlobalMarkerScale) ||
(fMarkerNotHidden != v.fMarkerNotHidden) ||
(fWindowSizeHintY != v.fWindowSizeHintY))
(fWindowSizeHintY != v.fWindowSizeHintY) ||
(fAutoRefresh != v.fAutoRefresh))
G4cout << "Difference in 1st batch." << G4endl;
if (fSection) {
@@ -229,12 +237,12 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
}
if (fCutaway) {
if (fCutawayPlanes.entries () != v.fCutawayPlanes.entries ()) {
if (fCutawayPlanes.size () != v.fCutawayPlanes.size ()) {
G4cout << "Difference in no of cutaway planes." << G4endl;
}
else {
for (int i = 0; i < fCutawayPlanes.entries (); i++) {
if (!(fCutawayPlanes (i) == v.fCutawayPlanes (i)))
for (int i = 0; i < fCutawayPlanes.size (); i++) {
if (!(fCutawayPlanes[i] == v.fCutawayPlanes[i]))
G4cout << "Difference in cutaway plane no. " << i << G4endl;
}
}
@@ -246,11 +254,9 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
}
}
G4std::ostream& operator << (G4std::ostream& os, const G4ViewParameters& v) {
os << "View parameters and options:";
os << "\n Drawing style: ";
switch (v.fDrawingStyle) {
G4std::ostream& operator << (G4std::ostream& os,
const G4ViewParameters::DrawingStyle& style) {
switch (style) {
case G4ViewParameters::wireframe:
os << "wireframe"; break;
case G4ViewParameters::hlr:
@@ -261,6 +267,13 @@ G4std::ostream& operator << (G4std::ostream& os, const G4ViewParameters& v) {
os << "hlhsr - hidden line, hidden surface removed"; break;
default: os << "unrecognised"; break;
}
return os;
}
G4std::ostream& operator << (G4std::ostream& os, const G4ViewParameters& v) {
os << "View parameters and options:";
os << "\n Drawing style: " << v.fDrawingStyle;
os << "\n Representation style: ";
switch (v.fRepStyle) {
@@ -297,7 +310,7 @@ G4std::ostream& operator << (G4std::ostream& os, const G4ViewParameters& v) {
os << "\n Cutaway flag: ";
if (v.fCutaway) {
os << "true, cutaway planes: ";
for (int i = 0; i < v.fCutawayPlanes.entries (); i++) {
for (int i = 0; i < v.fCutawayPlanes.size (); i++) {
os << ' ' << v.fCutawayPlanes[i];
}
}
@@ -378,6 +391,10 @@ G4std::ostream& operator << (G4std::ostream& os, const G4ViewParameters& v) {
os << "\n Window size hint: "
<< v.fWindowSizeHintX << 'x'<< v.fWindowSizeHintX;
os << "\n Auto refresh: ";
if (v.fAutoRefresh) os << "true";
else os << "false";
return os;
}
@@ -415,7 +432,8 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
(fGlobalMarkerScale != v.fGlobalMarkerScale) ||
(fMarkerNotHidden != v.fMarkerNotHidden) ||
(fWindowSizeHintX != v.fWindowSizeHintX) ||
(fWindowSizeHintY != v.fWindowSizeHintY))
(fWindowSizeHintY != v.fWindowSizeHintY) ||
(fAutoRefresh != v.fAutoRefresh))
return true;
if (fDensityCulling &&
@@ -425,11 +443,11 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
(!(fSectionPlane == v.fSectionPlane))) return true;
if (fCutaway) {
if (fCutawayPlanes.entries () != v.fCutawayPlanes.entries ())
if (fCutawayPlanes.size () != v.fCutawayPlanes.size ())
return true;
else {
for (int i = 0; i < fCutawayPlanes.entries (); i++) {
if (!(fCutawayPlanes (i) == v.fCutawayPlanes (i))) return true;
for (int i = 0; i < fCutawayPlanes.size (); i++) {
if (!(fCutawayPlanes[i] == v.fCutawayPlanes[i])) return true;
}
}
}
@@ -0,0 +1,19 @@
// This code implementation is the intellectual property of
// the 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: G4ViewerList.cc,v 1.2 2001/03/07 14:37:50 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
#include "G4ViewerList.hh"
void G4ViewerList::remove(G4VViewer* viewer) {
G4ViewerListIterator iViewer;
for (iViewer = begin(); iViewer != end(); ++iViewer) {
if (*iViewer == viewer) break;
}
if (iViewer != end()) erase(iViewer);
}
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VisCommandTemplates.cc,v 1.4 1999/12/15 14:54:25 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Visualization Command Messenger Template private functions.
@@ -0,0 +1,78 @@
// This code implementation is the intellectual property of
// the 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: G4VisCommands.cc,v 1.1 2001/02/23 15:04:04 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
// /vis/ top level commands - John Allison 5th February 2001
#include "G4VisCommands.hh"
#include "G4VisManager.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithoutParameter.hh"
////////////// /vis/enable ///////////////////////////////////////
G4VisCommandEnable::G4VisCommandEnable () {
G4bool omitable;
fpCommand = new G4UIcmdWithABool("/vis/enable", this);
fpCommand -> SetGuidance("/vis/enable [true|false]");
fpCommand -> SetGuidance("Enables/disables visualization system.");
fpCommand -> SetParameterName("enabled", omitable=true);
fpCommand -> SetDefaultValue(true);
fpCommand1 = new G4UIcmdWithoutParameter("/vis/disable", this);
fpCommand1 -> SetGuidance("Disables visualization system.");
}
G4VisCommandEnable::~G4VisCommandEnable () {
delete fpCommand;
delete fpCommand1;
}
G4String G4VisCommandEnable::GetCurrentValue (G4UIcommand* command) {
return G4String();
}
void G4VisCommandEnable::SetNewValue (G4UIcommand* command,
G4String newValue) {
if (command == fpCommand) {
G4bool enable (GetNewBoolValue(newValue));
if (enable) fpVisManager->Enable(); // Printing is in vis manager.
else fpVisManager->Disable(); // Printing is in vis manager.
} else fpVisManager->Disable(); // Printing is in vis manager.
}
////////////// /vis/verbose ///////////////////////////////////////
G4VisCommandVerbose::G4VisCommandVerbose () {
G4bool omitable;
fpCommand = new G4UIcmdWithAnInteger("/vis/verbose", this);
fpCommand -> SetGuidance("/vis/verbose [<verbosity>]");
fpCommand -> SetGuidance("0 = minimum, 10 = maximum verbosity.");
fpCommand -> SetParameterName("verbosity", omitable=true);
fpCommand -> SetDefaultValue(0);
}
G4VisCommandVerbose::~G4VisCommandVerbose () {
delete fpCommand;
}
G4String G4VisCommandVerbose::GetCurrentValue (G4UIcommand* command) {
return G4String();
}
void G4VisCommandVerbose::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4int verbosity (GetNewIntValue(newValue));
fpVisManager->SetVerboseLevel(verbosity);
G4cout << "Visualization verbosity changed to " << verbosity << G4endl;
}
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VisCommandsCamera.cc,v 1.7 2000/05/13 10:52:14 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -1,34 +0,0 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsCameraMessengers.cc,v 1.3 1999/12/15 14:54:26 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// Messengers for /vis~/camera commands - John Allison 6th April 1998.
#include "G4VisCommandsCameraMessengers.hh"
#include "G4UIcommand.hh"
G4VisCommandsCameraSetMessenger::G4VisCommandsCameraSetMessenger () {
fpCommand = new G4UIcommand ("/new_vis/camera/set", this);
fpCommand -> SetGuidance
("Sets and updates view parameters of current view.");
}
G4VisCommandsCameraSetMessenger::~G4VisCommandsCameraSetMessenger () {
delete fpCommand;
}
G4String G4VisCommandsCameraSetMessenger::GetCurrentValue
(G4UIcommand * command) {
return "";
}
void G4VisCommandsCameraSetMessenger::SetNewValue (G4UIcommand* command, G4String newValues) {
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsCompound.cc,v 1.6 2000/10/18 14:02:35 allison Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisCommandsCompound.cc,v 1.10 2001/02/23 15:43:26 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
// Compound /vis/ commands - John Allison 15th May 2000
@@ -16,12 +16,95 @@
#include "G4UImanager.hh"
#include "G4UIcmdWithAString.hh"
////////////// /vis/drawView ///////////////////////////////////////
G4VisCommandDrawView::G4VisCommandDrawView() {
G4bool omitable;
fpCommand = new G4UIcommand("/vis/drawView", this);
fpCommand->SetGuidance
("/vis/drawView [<theta-deg>] [<phi-deg>] [<pan-right>] [<pan-up>]"
" [<pan-unit>] [<zoom-factor>] [<dolly>] [<dolly-unit>]");
fpCommand->SetGuidance("Default: 0 0 0 0 cm 1 0 cm");
G4UIparameter* parameter;
parameter = new G4UIparameter("theta-deg", 'd', omitable = true);
parameter -> SetDefaultValue(0.);
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter("phi-deg", 'd', omitable = true);
parameter -> SetDefaultValue(0.);
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter("pan-right", 'd', omitable = true);
parameter -> SetDefaultValue(0.);
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter("pan-up", 'd', omitable = true);
parameter -> SetDefaultValue(0.);
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter("pan-unit", 's', omitable = true);
parameter -> SetDefaultValue("cm");
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter("zoom-factor", 'd', omitable = true);
parameter -> SetDefaultValue(1.);
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter("dolly", 'd', omitable = true);
parameter -> SetDefaultValue(0.);
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter("dolly-unit", 's', omitable = true);
parameter -> SetDefaultValue("cm");
fpCommand -> SetParameter (parameter);
}
G4VisCommandDrawView::~G4VisCommandDrawView() {
delete fpCommand;
}
void G4VisCommandDrawView::SetNewValue
(G4UIcommand* command, G4String newValue) {
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
G4cout << "G4VisCommandsDrawView::SetNewValue: no current viewer."
<< G4endl;
return;
}
G4String thetaDeg;
G4String phiDeg;
G4String panRight;
G4String panUp;
G4String panUnit;
G4String zoomFactor;
G4String dolly;
G4String dollyUnit;
const char* t = newValue;
G4std::istrstream is((char*)t);
is >> thetaDeg >> phiDeg >> panRight >> panUp >> panUnit
>> zoomFactor >> dolly >> dollyUnit;
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
UImanager->SetVerboseLevel(2);
G4ViewParameters vp = currentViewer->GetViewParameters();
G4bool keepAutoRefresh = vp.IsAutoRefresh();
vp.SetAutoRefresh(false);
currentViewer->SetViewParameters(vp);
UImanager->ApplyCommand
("/vis/viewer/viewpointThetaPhi " + thetaDeg + " " + phiDeg + " deg");
UImanager->ApplyCommand
("/vis/viewer/panTo " + panRight + " " + panUp + " " + panUnit);
UImanager->ApplyCommand
("/vis/viewer/zoomTo " + zoomFactor);
vp = currentViewer->GetViewParameters();
vp.SetAutoRefresh(keepAutoRefresh);
currentViewer->SetViewParameters(vp);
UImanager->ApplyCommand
("/vis/viewer/dollyTo " + dolly + " " + dollyUnit);
UImanager->SetVerboseLevel(keepVerbose);
}
////////////// /vis/drawVolume ///////////////////////////////////////
G4VisCommandDrawVolume::G4VisCommandDrawVolume() {
G4bool omitable;
fpCommand = new G4UIcmdWithAString("/vis/drawVolume", this);
fpCommand->AvailableForStates(Idle, GeomClosed);
fpCommand->SetGuidance("/vis/drawVolume [<physical-volume-name>]");
fpCommand->SetGuidance("Default: world volume");
fpCommand->SetGuidance
@@ -52,19 +135,21 @@ void G4VisCommandDrawVolume::SetNewValue
G4VisCommandOpen::G4VisCommandOpen() {
G4bool omitable;
fpCommand = new G4UIcmdWithAString("/vis/open", this);
fpCommand->SetGuidance("/vis/open <graphics-system-name>");
fpCommand = new G4UIcommand("/vis/open", this);
fpCommand->SetGuidance("/vis/open [<graphics-system-name>] [<pixels>]");
fpCommand->SetGuidance
("For this graphics system, creates a scene handler ready for drawing.");
fpCommand->SetGuidance("The scene handler becomes current.");
fpCommand->SetGuidance("The scene handler name is auto-generated.");
fpCommand->SetParameterName("graphics-system-name", omitable = false);
const G4GraphicsSystemList& gslist =
fpCommand->SetGuidance("The 2nd parameter is the window size hint.");
G4UIparameter* parameter;
parameter = new G4UIparameter("graphics-system-name", 's', omitable = false);
const G4GraphicsSystemList& gslist =
fpVisManager->GetAvailableGraphicsSystems();
G4String candidates;
for (int igslist = 0; igslist < gslist.entries(); igslist++) {
const G4String& name = gslist(igslist)->GetName();
const G4String& nickname = gslist(igslist)->GetNickname();
for (int igslist = 0; igslist < gslist.size(); igslist++) {
const G4String& name = gslist[igslist]->GetName();
const G4String& nickname = gslist[igslist]->GetNickname();
if (nickname.isNull()) {
candidates += name;
}
@@ -74,7 +159,11 @@ G4VisCommandOpen::G4VisCommandOpen() {
candidates += " ";
}
candidates = candidates.strip();
fpCommand->SetCandidates(candidates);
parameter->SetParameterCandidates(candidates);
fpCommand->SetParameter(parameter);
parameter = new G4UIparameter("pixels", 'i', omitable = true);
parameter->SetDefaultValue(600);
fpCommand->SetParameter(parameter);
}
G4VisCommandOpen::~G4VisCommandOpen() {
@@ -82,11 +171,15 @@ G4VisCommandOpen::~G4VisCommandOpen() {
}
void G4VisCommandOpen::SetNewValue (G4UIcommand* command, G4String newValue) {
G4String systemName, windowSizeHint;
const char* t = newValue;
G4std::istrstream is((char*)t);
is >> systemName >> windowSizeHint;
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4int keepVerbose = UImanager->GetVerboseLevel();
UImanager->SetVerboseLevel(2);
UImanager->ApplyCommand("/vis/sceneHandler/create " + newValue);
UImanager->ApplyCommand("/vis/viewer/create");
UImanager->ApplyCommand("/vis/sceneHandler/create " + systemName);
UImanager->ApplyCommand("/vis/viewer/create ! ! " + windowSizeHint);
UImanager->SetVerboseLevel(keepVerbose);
}
@@ -95,7 +188,6 @@ void G4VisCommandOpen::SetNewValue (G4UIcommand* command, G4String newValue) {
G4VisCommandSpecify::G4VisCommandSpecify() {
G4bool omitable;
fpCommand = new G4UIcmdWithAString("/vis/specify", this);
fpCommand->AvailableForStates(Idle, GeomClosed);
fpCommand->SetGuidance("/vis/specify <logical-volume-name>");
fpCommand->SetGuidance
("Creates a scene consisting of this logical volume and asks the"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsScene.cc,v 1.15 2000/05/29 09:21:40 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisCommandsScene.cc,v 1.16 2001/02/23 15:43:27 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
// /vis/scene commands - John Allison 9th August 1998
@@ -36,7 +36,7 @@ G4String G4VVisCommandScene::CurrentSceneName () {
void G4VVisCommandScene::UpdateCandidateLists () {
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
G4int iScene, nScenes = sceneList.size ();
G4String nameList;
for (iScene = 0; iScene < nScenes; iScene++) {
nameList += sceneList [iScene] -> GetName () + " ";
@@ -51,7 +51,7 @@ void G4VVisCommandScene::UpdateCandidateLists () {
void G4VVisCommandScene::UpdateVisManagerScene
(const G4String& sceneName) {
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
if (sceneList [iScene] -> GetName () == sceneName) break;
}
@@ -101,7 +101,7 @@ void G4VisCommandSceneCreate::SetNewValue (G4UIcommand* command,
if (newName == nextName) fId++;
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
if (sceneList [iScene] -> GetName () == newName) break;
}
@@ -110,7 +110,7 @@ void G4VisCommandSceneCreate::SetNewValue (G4UIcommand* command,
}
else {
sceneList.append (new G4Scene (newName));
sceneList.push_back (new G4Scene (newName));
// Adds empty scene data object to list.
UpdateVisManagerScene (newName);
@@ -149,7 +149,7 @@ void G4VisCommandSceneEdit::SetNewValue (G4UIcommand* command,
is >> sceneName;
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
G4int iScene, nScenes = sceneList.size ();
G4Scene* pScene;
for (iScene = 0; iScene < nScenes; iScene++) {
pScene = sceneList [iScene];
@@ -216,7 +216,7 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand* command,
is >> name >> verbosity;
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
G4int iScene, nScenes = sceneList.size ();
G4bool found = false;
for (iScene = 0; iScene < nScenes; iScene++) {
G4Scene* pScene = sceneList [iScene];
@@ -229,7 +229,7 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand* command,
if (verbosity == 1) {
G4int i;
G4cout << "\n Run-duration models:";
G4int nRunModels = pScene -> GetRunDurationModelList ().entries ();
G4int nRunModels = pScene -> GetRunDurationModelList ().size ();
if (nRunModels == 0) {
G4cout << " none.";
}
@@ -238,7 +238,7 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand* command,
G4cout << "\n " << pModel -> GetGlobalDescription ();
}
G4cout << "\n End-of-event models:";
G4int nEOEModels = pScene -> GetEndOfEventModelList ().entries ();
G4int nEOEModels = pScene -> GetEndOfEventModelList ().size ();
if (nEOEModels == 0) {
G4cout << " none.";
}
@@ -295,7 +295,7 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand* command,
fpVisManager -> SetAvailableSceneHandlers ();
// Check scene name.
const G4int nScenes = sceneList.entries ();
const G4int nScenes = sceneList.size ();
G4int iScene;
for (iScene = 0; iScene < nScenes; iScene++) {
G4Scene* scene = sceneList [iScene];
@@ -314,7 +314,7 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand* command,
// For each scene handler, if it contains the scene, clear and
// rebuild the graphical database, then for each viewer set (make
// current), clear, (re)draw, and show.
const G4int nSceneHandlers = sceneHandlerList.entries ();
const G4int nSceneHandlers = sceneHandlerList.size ();
for (G4int iSH = 0; iSH < nSceneHandlers; iSH++) {
G4VSceneHandler* aSceneHandler = sceneHandlerList [iSH];
G4Scene* aScene = aSceneHandler -> GetScene ();
@@ -324,7 +324,7 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand* command,
aSceneHandler -> ClearStore ();
aSceneHandler -> ClearTransientStore ();
G4ViewerList& viewerList = aSceneHandler -> SetViewerList ();
const G4int nViewers = viewerList.entries ();
const G4int nViewers = viewerList.size ();
for (G4int iV = 0; iV < nViewers; iV++) {
G4VViewer* aViewer = viewerList [iV];
aViewer -> ClearView ();
@@ -378,16 +378,16 @@ void G4VisCommandSceneRemove::SetNewValue (G4UIcommand* command,
const G4String& currentSceneName =
fpVisManager -> GetCurrentScene () -> GetName ();
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
for (iScene = 0; iScene < nScenes; iScene++) {
if (sceneList [iScene] -> GetName () == removeName) break;
G4SceneListIterator iScene;
for (iScene = sceneList.begin(); iScene != sceneList.end(); ++iScene) {
if ((*iScene) -> GetName () == removeName) break;
}
if (iScene < nScenes) {
delete sceneList [iScene];
sceneList.removeAt (iScene);
if (iScene != sceneList.end()) {
delete *iScene;
sceneList.erase (iScene);
G4cout << "Scene \"" << removeName << "\" removed." << G4endl;
UpdateCandidateLists ();
if (sceneList.isEmpty ()) {
if (sceneList.empty ()) {
UpdateVisManagerScene ();
G4cout << "No scenes left. Please create a new one." << G4endl;
}
@@ -437,7 +437,7 @@ void G4VisCommandSceneSelect::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String& selectName = newValue;
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
G4int iScene, nScenes = sceneList.entries ();
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
if (sceneList [iScene] -> GetName () == selectName) break;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsSceneAdd.cc,v 1.11 2000/05/19 09:17:56 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisCommandsSceneAdd.cc,v 1.14 2001/02/23 15:43:27 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
// /vis/scene commands - John Allison 9th August 1998
@@ -38,7 +38,6 @@
G4VisCommandSceneAddGhosts::G4VisCommandSceneAddGhosts () {
G4bool omitable;
fpCommand = new G4UIcmdWithAString ("/vis/scene/add/ghosts", this);
fpCommand -> AvailableForStates (Idle, GeomClosed);
fpCommand -> SetGuidance
("/vis/scene/add/ghosts [<particle-name>]");
fpCommand -> SetGuidance
@@ -63,7 +62,7 @@ void G4VisCommandSceneAddGhosts::SetNewValue (G4UIcommand* command,
const G4String& currentSceneName = pCurrentScene -> GetName ();
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
if (sceneList.isEmpty ()) {
if (sceneList.empty ()) {
G4cout << "No scenes - please create one before adding anything."
<< G4endl;
return;
@@ -122,7 +121,6 @@ void G4VisCommandSceneAddGhosts::SetNewValue (G4UIcommand* command,
G4VisCommandSceneAddHits::G4VisCommandSceneAddHits () {
fpCommand = new G4UIcmdWithoutParameter ("/vis/scene/add/hits", this);
fpCommand -> AvailableForStates (Idle, GeomClosed);
fpCommand -> SetGuidance
("Adds hits to current scene.");
fpCommand -> SetGuidance
@@ -141,7 +139,7 @@ G4String G4VisCommandSceneAddHits::GetCurrentValue (G4UIcommand* command) {
void G4VisCommandSceneAddHits::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4SceneList& list = fpVisManager -> SetSceneList ();
if (list.isEmpty ()) {
if (list.empty ()) {
G4cout << "No scenes - please create one before adding anything."
<< G4endl;
return;
@@ -161,7 +159,6 @@ void G4VisCommandSceneAddHits::SetNewValue (G4UIcommand* command,
G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/scene/add/logicalVolume", this);
fpCommand -> AvailableForStates (Idle, GeomClosed);
fpCommand -> SetGuidance
("/vis/scene/add/logicalVolume <logical-volume-name>"
" [<depth-of-descending>]");
@@ -191,7 +188,7 @@ G4String G4VisCommandSceneAddLogicalVolume::GetCurrentValue (G4UIcommand*) {
void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
if (sceneList.isEmpty ()) {
if (sceneList.empty ()) {
G4cout << "No scenes - please create one before adding anything."
<< G4endl;
return;
@@ -237,7 +234,6 @@ void G4VisCommandSceneAddLogicalVolume::SetNewValue (G4UIcommand* command,
G4VisCommandSceneAddTrajectories::G4VisCommandSceneAddTrajectories () {
fpCommand = new G4UIcmdWithoutParameter
("/vis/scene/add/trajectories", this);
fpCommand -> AvailableForStates (Idle, GeomClosed);
fpCommand -> SetGuidance
("Adds trajectories to current scene.");
fpCommand -> SetGuidance
@@ -256,7 +252,7 @@ G4String G4VisCommandSceneAddTrajectories::GetCurrentValue (G4UIcommand* command
void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4SceneList& list = fpVisManager -> SetSceneList ();
if (list.isEmpty ()) {
if (list.empty ()) {
G4cout << "No scenes - please create one before adding anything."
<< G4endl;
return;
@@ -276,10 +272,10 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand* command,
G4VisCommandSceneAddVolume::G4VisCommandSceneAddVolume () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/scene/add/volume", this);
fpCommand -> AvailableForStates (Idle, GeomClosed);
fpCommand -> SetGuidance
("/vis/scene/add/volume [<physical-volume-name>] [<copy-no>] [<depth-of-descending>]");
fpCommand -> SetGuidance ("Adds a physical volume to the current scene.");
fpCommand -> SetGuidance ("Note: adds first occurence only.");
fpCommand -> SetGuidance
("1st parameter: volume name (default \"world\").");
// fpCommand -> SetGuidance // Not implemented - should be in geom?
@@ -312,7 +308,7 @@ G4String G4VisCommandSceneAddVolume::GetCurrentValue (G4UIcommand* command) {
void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4SceneList& sceneList = fpVisManager -> SetSceneList ();
if (sceneList.isEmpty ()) {
if (sceneList.empty ()) {
G4cout << "No scenes - please create one before adding anything."
<< G4endl;
return;
@@ -357,14 +353,13 @@ void G4VisCommandSceneAddVolume::SetNewValue (G4UIcommand* command,
// OK, what have we got...?
foundVolume = searchScene.GetFoundVolume ();
foundDepth = searchScene.GetFoundDepth ();
//const G4Transform3D&
// transformation = searchScene.GetFoundTransformation ();
// Note: a physical volume carries its own transformation and
// does not need an additional model transformation.
const G4Transform3D&
transformation = searchScene.GetFoundTransformation ();
if (foundVolume) {
model = new G4PhysicalVolumeModel (foundVolume,
requestedDepthOfDescent);
requestedDepthOfDescent,
transformation);
}
else {
G4cout << "Volume \"" << name << "\", copy no. " << copyNo
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsSceneHandler.cc,v 1.13 2000/05/18 13:45:45 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisCommandsSceneHandler.cc,v 1.15 2001/02/23 15:43:28 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
// /vis/sceneHandler commands - John Allison 10th October 1998
@@ -31,7 +31,7 @@ void G4VVisCommandSceneHandler::UpdateCandidateLists () {
fpVisManager -> GetAvailableSceneHandlers ();
G4String sceneHandlerNameList;
for (int iScene = 0; iScene < list.entries (); iScene++) {
for (int iScene = 0; iScene < list.size (); iScene++) {
G4VSceneHandler* sceneHandler = list [iScene];
sceneHandlerNameList += sceneHandler -> GetName () + " ";
}
@@ -96,14 +96,14 @@ void G4VisCommandSceneHandlerAttach::SetNewValue (G4UIcommand* command,
G4SceneList& sceneList =
fpVisManager -> SetSceneList ();
if (sceneList.isEmpty ()) {
if (sceneList.empty ()) {
G4cout <<
"No valid scenes available yet. Please create one."
<< G4endl;
return;
}
G4int iScene, nScenes = sceneList.entries ();
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
if (sceneList [iScene] -> GetName () == sceneName) break;
}
@@ -130,7 +130,7 @@ G4VisCommandSceneHandlerCreate::G4VisCommandSceneHandlerCreate (): fId (0) {
fpCommand -> SetGuidance
("/vis/sceneHandler/create");
fpCommand -> SetGuidance
(" <graphics-system-name> [<scene-handler-name>]");
(" [<graphics-system-name>] [<scene-handler-name>]");
fpCommand -> SetGuidance
("Creates an scene handler for a specific graphics system.");
fpCommand -> SetGuidance
@@ -145,13 +145,14 @@ G4VisCommandSceneHandlerCreate::G4VisCommandSceneHandlerCreate (): fId (0) {
("This scene handler becomes current.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("graphics-system-name",
's', omitable = false);
's', omitable = true);
parameter -> SetDefaultValue("error");
const G4GraphicsSystemList& gslist =
fpVisManager -> GetAvailableGraphicsSystems ();
G4String candidates;
for (int igslist = 0; igslist < gslist.entries (); igslist++) {
const G4String& name = gslist (igslist) -> GetName ();
const G4String& nickname = gslist (igslist) -> GetNickname ();
for (int igslist = 0; igslist < gslist.size (); igslist++) {
const G4String& name = gslist [igslist] -> GetName ();
const G4String& nickname = gslist [igslist] -> GetNickname ();
if (nickname.isNull ()) {
candidates += name;
}
@@ -192,7 +193,7 @@ G4String G4VisCommandSceneHandlerCreate::GetCurrentValue
else {
const G4GraphicsSystemList& gslist =
fpVisManager -> GetAvailableGraphicsSystems ();
if (gslist.entries ()) {
if (gslist.size ()) {
graphicsSystemName = gslist [0] -> GetName ();
}
else {
@@ -211,7 +212,7 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
const G4GraphicsSystemList& gsl =
fpVisManager -> GetAvailableGraphicsSystems ();
int nSystems = gsl.entries ();
int nSystems = gsl.size ();
if (nSystems <= 0) {
G4cout << "G4VisCommandSceneHandlerCreate::SetNewValue:"
" no graphics systems available."
@@ -254,7 +255,7 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand* command,
const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
int iScene;
for (iScene = 0; iScene < list.entries (); iScene++) {
for (iScene = 0; iScene < list.size (); iScene++) {
G4VSceneHandler* sceneHandler = list [iScene];
if (sceneHandler -> GetName () == newName) {
G4cout << "Scene handler \"" << newName << "\" already exists." << G4endl;
@@ -317,7 +318,7 @@ void G4VisCommandSceneHandlerList::SetNewValue (G4UIcommand* command,
const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
G4bool found = false;
for (int iSH = 0; iSH < list.entries (); iSH++) {
for (int iSH = 0; iSH < list.size (); iSH++) {
if (name != "all") {
if (name != list [iSH] -> GetName ()) continue;
}
@@ -379,12 +380,12 @@ void G4VisCommandSceneHandlerRemove::SetNewValue (G4UIcommand* command,
}
G4SceneHandlerList& list = fpVisManager -> SetAvailableSceneHandlers ();
G4int iSH;
for (iSH = 0; iSH < list.entries (); iSH++) {
if (list [iSH] -> GetName () == removeName) break;
G4SceneHandlerListIterator iSH;
for (iSH = list.begin(); iSH != list.end(); ++iSH) {
if ((*iSH) -> GetName () == removeName) break;
}
if (iSH >= list.entries ()) {
if (iSH = list.end()) {
G4cout << "Scene handler \"" << removeName
<< "\" not found - \"/vis/sceneHandler/list\" to see possibilities."
<< G4endl;
@@ -396,7 +397,7 @@ void G4VisCommandSceneHandlerRemove::SetNewValue (G4UIcommand* command,
fpVisManager -> DeleteCurrentSceneHandler ();
}
else {
list.remove (list [iSH]);
list.erase (iSH);
G4cout << "Current scene handler unchanged." << G4endl;
}
@@ -440,10 +441,10 @@ void G4VisCommandSceneHandlerSelect::SetNewValue (G4UIcommand* command,
const G4SceneHandlerList& list = fpVisManager -> GetAvailableSceneHandlers ();
G4cout << "Scene handler \"" << selectName << "\"";
G4int iSH;
for (iSH = 0; iSH < list.entries (); iSH++) {
for (iSH = 0; iSH < list.size (); iSH++) {
if (list [iSH] -> GetName () == selectName) break;
}
if (iSH < list.entries ()) {
if (iSH < list.size ()) {
if (fpVisManager -> GetCurrentSceneHandler () -> GetName () == selectName) {
G4cout << " already selected." << G4endl;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsSceneInclude.cc,v 1.5 2000/05/19 09:18:01 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisCommandsSceneInclude.cc,v 1.7 2001/01/18 12:20:00 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
// /vis/scene commands - John Allison 9th August 1998
@@ -21,14 +21,8 @@
G4VisCommandSceneIncludeHits::G4VisCommandSceneIncludeHits () {
fpCommand = new G4UIcmdWithoutParameter ("/vis/scene/include/hits", this);
fpCommand -> AvailableForStates (Idle, GeomClosed);
fpCommand -> SetGuidance
("Deprecated command - please use /vis/scene/add/hits.");
fpCommand -> SetGuidance
("Includes hits in current scene.");
fpCommand -> SetGuidance
("Hits are drawn at end of event when the scene in which"
" they are included is current.");
("Replaced by /vis/scene/add/hits.");
}
G4VisCommandSceneIncludeHits::~G4VisCommandSceneIncludeHits () {
@@ -42,23 +36,8 @@ G4String G4VisCommandSceneIncludeHits::GetCurrentValue (G4UIcommand* command) {
void G4VisCommandSceneIncludeHits::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4cout <<
"/vis/scene/include/hits is a deprecated command - please use"
" /vis/scene/add/hits."
<< G4endl;
G4SceneList& list = fpVisManager -> SetSceneList ();
if (list.isEmpty ()) {
G4cout << "No scenes - please create one before adding anything."
<< G4endl;
return;
}
G4HitsModel* model = new G4HitsModel;
G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene ();
const G4String& currentSceneName = pCurrentScene -> GetName ();
pCurrentScene -> AddEndOfEventModel (model);
G4cout << "Hits will be drawn in scene \""
<< currentSceneName << "\"."
" **** /vis/scene/include/hits has been replaced - \n"
" please use the equivalent command /vis/scene/add/hits."
<< G4endl;
}
@@ -68,13 +47,7 @@ G4VisCommandSceneIncludeTrajectories::G4VisCommandSceneIncludeTrajectories () {
fpCommand = new G4UIcmdWithoutParameter
("/vis/scene/include/trajectories", this);
fpCommand -> SetGuidance
("Deprecated command - please use /vis/scene/add/trajectories.");
fpCommand -> AvailableForStates (Idle, GeomClosed);
fpCommand -> SetGuidance
("Includes trajectories in current scene.");
fpCommand -> SetGuidance
("Trajectories are drawn at end of event when the scene in which"
" they are included is current.");
("Replaced by /vis/scene/add/trajectories.");
}
G4VisCommandSceneIncludeTrajectories::~G4VisCommandSceneIncludeTrajectories () {
@@ -88,22 +61,7 @@ G4String G4VisCommandSceneIncludeTrajectories::GetCurrentValue (G4UIcommand* com
void G4VisCommandSceneIncludeTrajectories::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4cout <<
"/vis/scene/include/trajectories is a deprecated command - please use"
"\n /vis/scene/add/trajectories."
<< G4endl;
G4SceneList& list = fpVisManager -> SetSceneList ();
if (list.isEmpty ()) {
G4cout << "No scenes - please create one before adding anything."
<< G4endl;
return;
}
G4TrajectoriesModel* model = new G4TrajectoriesModel;
G4Scene* pCurrentScene = fpVisManager -> GetCurrentScene ();
const G4String& currentSceneName = pCurrentScene -> GetName ();
pCurrentScene -> AddEndOfEventModel (model);
G4cout << "Trajectories will be drawn in scene \""
<< currentSceneName << "\"."
" **** /vis/scene/include/trajectories has been replaced - \n"
" please use the equivalent command /vis/scene/add/trajectories."
<< G4endl;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsViewer.cc,v 1.19 2000/06/07 08:43:28 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisCommandsViewer.cc,v 1.25 2001/04/02 10:08:46 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
// /vis/viewer commands - John Allison 25th October 1998
@@ -15,8 +15,11 @@
#include "G4VisManager.hh"
#include "G4GraphicsSystemList.hh"
#include "G4VisCommandsScene.hh"
#include "G4UImanager.hh"
#include "G4UIcommand.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
#include "g4std/strstream"
@@ -25,17 +28,30 @@ G4VVisCommandViewer::G4VVisCommandViewer () {}
G4VVisCommandViewer::~G4VVisCommandViewer () {}
void G4VVisCommandViewer::SetViewParameters
(G4VViewer* viewer, const G4ViewParameters& viewParams) {
viewer->SetViewParameters(viewParams);
if (viewParams.IsAutoRefresh()) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
}
else {
G4cout << "Issue /vis/viewer/refresh to see effect." << G4endl;
}
// For now...
fpVisManager->SetCurrentViewParameters() = viewParams;
}
void G4VVisCommandViewer::UpdateCandidateLists () {
const G4SceneHandlerList& sceneHandlerList =
fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.entries ();
G4int nHandlers = sceneHandlerList.size ();
G4String viewerNameList;
for (int iHandler = 0; iHandler < nHandlers; iHandler++) {
G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
for (int iViewer = 0; iViewer < viewerList.entries (); iViewer++) {
for (int iViewer = 0; iViewer < viewerList.size (); iViewer++) {
viewerNameList += viewerList [iViewer] -> GetShortName () + " ";
}
}
@@ -46,13 +62,62 @@ void G4VVisCommandViewer::UpdateCandidateLists () {
}
}
////////////// /vis/viewer/clear ///////////////////////////////////////
G4VisCommandViewerClear::G4VisCommandViewerClear () {
G4bool omitable, currentAsDefault;
fpCommand = new G4UIcmdWithAString ("/vis/viewer/clear", this);
fpCommand -> SetGuidance ("/vis/viewer/clear [<viewer-name>]");
fpCommand -> SetGuidance ("Clears viewer.");
fpCommand -> SetGuidance ("Viewer becomes current.");
fpCommand -> SetGuidance
("Specify viewer by name (\"/vis/viewer/list\""
"\n to see possibilities).");
fpCommand -> SetParameterName ("viewer-name",
omitable = true,
currentAsDefault = true);
viewerNameCommands.push_back (fpCommand);
}
G4VisCommandViewerClear::~G4VisCommandViewerClear () {
delete fpCommand;
}
G4String G4VisCommandViewerClear::GetCurrentValue (G4UIcommand* command) {
G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
if (viewer) {
return viewer -> GetName ();
}
else {
return "none";
}
}
void G4VisCommandViewerClear::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String& clearName = newValue;
G4VViewer* viewer = fpVisManager -> GetViewer (clearName);
if (!viewer) {
G4cout << "Viewer \"" << clearName
<< "\" not found - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
return;
}
viewer->ClearView();
if (fpVisManager->GetVerboseLevel() > 0) {
G4cout << "Viewer \"" << clearName << "\" cleared." << G4endl;
}
}
////////////// /vis/viewer/create ///////////////////////////////////////
G4VisCommandViewerCreate::G4VisCommandViewerCreate (): fId (0) {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/viewer/create", this);
fpCommand -> SetGuidance
("/vis/viewer/create [<scene-handler>] [<viewer-name>]");
("/vis/viewer/create [<scene-handler>] [<viewer-name>] [<pixels>]");
fpCommand -> SetGuidance
("Creates an viewer for a specific scene handler.");
fpCommand -> SetGuidance
@@ -63,6 +128,8 @@ G4VisCommandViewerCreate::G4VisCommandViewerCreate (): fId (0) {
("to the name for identification - only the characters up to the first");
fpCommand -> SetGuidance
("blank are used for removing, selecting, etc.)");
fpCommand -> SetGuidance
("The 3rd parameter is a window size hint.");
fpCommand -> SetGuidance ("This scene handler and viewer become current.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("scene-handler", 's', omitable = true);
@@ -71,6 +138,9 @@ G4VisCommandViewerCreate::G4VisCommandViewerCreate (): fId (0) {
parameter = new G4UIparameter ("viewer-name", 's', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter ("pixels", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommand -> SetParameter (parameter);
viewerNameCommands.push_back (fpCommand);
}
@@ -109,17 +179,7 @@ G4String G4VisCommandViewerCreate::GetCurrentValue (G4UIcommand* command) {
currentValue += NextName ();
currentValue += '"';
/* Replaces currentValue += NextName ();
// Now need to handle the possibility that NextName contains
// embedded blanks.
currentValue += '"';
const int charLength = 100;
char nextName [charLength];
strncpy (nextName, NextName (), charLength);
for (int i = 0; nextName[i]; i++) {
currentValue += nextName[i];
}
*/
currentValue += " 600"; // Default number of pixels for window size hint.
return currentValue;
}
@@ -127,18 +187,30 @@ G4String G4VisCommandViewerCreate::GetCurrentValue (G4UIcommand* command) {
void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String sceneHandlerName, newName;
G4int windowSizeHint;
G4std::istrstream is ((char*)newValue.data());
is >> sceneHandlerName;
// Now need to handle the possibility that the second string
// contains embedded blanks within quotation marks.
// contains embedded blanks within quotation marks...
char c;
while (is.get (c)) newName += c;
while (is.get(c) && c == ' ');
if (c == '"') {
while (is.get(c) && c != '"') newName += c;
}
else {
newName += c;
while (is.get(c) && c != ' ') newName += c;
}
newName = newName.strip (G4String::both, ' ');
newName = newName.strip (G4String::both, '"');
// Now get number of pixels...
is >> windowSizeHint;
const G4SceneHandlerList& sceneHandlerList =
fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.entries ();
G4int nHandlers = sceneHandlerList.size ();
if (nHandlers <= 0) {
G4cout << "G4VisCommandViewerCreate::SetNewValue: no scene handlers."
"\n Create a scene handler with \"/vis/sceneHandler/create\""
@@ -178,7 +250,7 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command,
for (iHandler = 0; iHandler < nHandlers; iHandler++) {
G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
for (int iViewer = 0; iViewer < viewerList.entries (); iViewer++) {
for (int iViewer = 0; iViewer < viewerList.size (); iViewer++) {
if (viewerList [iViewer] -> GetShortName () == newShortName ) {
G4cout << "Viewer \"" << newShortName << "\" already exists."
<< G4endl;
@@ -187,6 +259,12 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command,
}
}
fpVisManager->SetCurrentViewParameters().SetWindowSizeHint
(windowSizeHint, windowSizeHint);
// Currently the viewer does not pick up the above. So a viewer
// picks up a default set of view parameters adn thus, the default
// window size for the moment.
// Create viewer.
fpVisManager -> CreateViewer (newName);
if (fpVisManager -> GetCurrentViewer () -> GetName () == newName) {
@@ -195,6 +273,171 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand* command,
}
}
////////////// /vis/viewer/dolly and dollyTo ////////////////////////////
G4VisCommandViewerDolly::G4VisCommandViewerDolly ():
fDollyIncrement (0.),
fDollyTo (0.)
{
G4bool omitable, currentAsDefault;
fpCommandDolly = new G4UIcmdWithADoubleAndUnit
("/vis/viewer/dolly", this);
fpCommandDolly -> SetGuidance
("/vis/viewer/dolly [<increment>] [<unit>]");
fpCommandDolly -> SetGuidance
("Moves the camera incrementally in by this distance.");
fpCommandDolly -> SetParameterName("increment",
omitable=true,
currentAsDefault=true);
fpCommandDolly -> SetDefaultUnit("m");
fpCommandDollyTo = new G4UIcmdWithADoubleAndUnit
("/vis/viewer/dollyTo", this);
fpCommandDollyTo -> SetGuidance
("/vis/viewer/dollyTo [<distance>] [<unit>]");
fpCommandDollyTo -> SetGuidance
("Moves the camera in this distance relative to standard target point.");
fpCommandDollyTo -> SetParameterName("distance",
omitable=true,
currentAsDefault=true);
fpCommandDollyTo -> SetDefaultUnit("m");
}
G4VisCommandViewerDolly::~G4VisCommandViewerDolly () {
delete fpCommandDolly;
delete fpCommandDollyTo;
}
G4String G4VisCommandViewerDolly::GetCurrentValue (G4UIcommand* command) {
G4String currentValue;
if (command == fpCommandDolly) {
currentValue = fpCommandDolly->ConvertToString(fDollyIncrement, "m");
}
else if (command == fpCommandDollyTo) {
currentValue = fpCommandDollyTo->ConvertToString(fDollyTo, "m");
}
return currentValue;
}
void G4VisCommandViewerDolly::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
G4cout << "G4VisCommandsViewerDolly::SetNewValue: no current viewer."
<< G4endl;
return;
}
G4ViewParameters vp = currentViewer->GetViewParameters();
if (command == fpCommandDolly) {
fDollyIncrement = fpCommandDolly->GetNewDoubleValue(newValue);
vp.IncrementDolly(fDollyIncrement);
}
else if (command == fpCommandDollyTo) {
fDollyTo = fpCommandDolly->GetNewDoubleValue(newValue);
vp.SetDolly(fDollyTo);
}
if (fpVisManager->GetVerboseLevel() > 0) {
G4cout << "Dolly distance changed to " << vp.GetDolly() << G4endl;
}
SetViewParameters(currentViewer, vp);
}
//////// /vis/viewer/lightsThetaPhi and lightsVector /////////////
G4VisCommandViewerLights::G4VisCommandViewerLights ():
fLightsVector (G4ThreeVector(0.,0.,1.))
{
G4bool omitable;
fpCommandLightsThetaPhi = new G4UIcommand
("/vis/viewer/lightsThetaPhi", this);
fpCommandLightsThetaPhi -> SetGuidance
("/vis/viewer/lightsThetaPhi [<theta>] [<phi>] [deg|rad]");
fpCommandLightsThetaPhi -> SetGuidance
("Set direction from target to lights.");
G4UIparameter* parameter;
parameter = new G4UIparameter("theta", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandLightsThetaPhi -> SetParameter (parameter);
parameter = new G4UIparameter("phi", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandLightsThetaPhi -> SetParameter (parameter);
parameter = new G4UIparameter ("unit", 's', omitable = true);
parameter -> SetDefaultValue ("deg");
fpCommandLightsThetaPhi -> SetParameter (parameter);
fpCommandLightsVector = new G4UIcommand
("/vis/viewer/lightsVector", this);
fpCommandLightsVector -> SetGuidance
("/vis/viewer/lightsVector [<x>] [<y>] [<z>]");
fpCommandLightsVector -> SetGuidance
("Set direction from target to lights.");
parameter = new G4UIparameter("x", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandLightsVector -> SetParameter (parameter);
parameter = new G4UIparameter("y", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandLightsVector -> SetParameter (parameter);
parameter = new G4UIparameter ("z", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandLightsVector -> SetParameter (parameter);
}
G4VisCommandViewerLights::~G4VisCommandViewerLights () {
delete fpCommandLightsThetaPhi;
delete fpCommandLightsVector;
}
G4String G4VisCommandViewerLights::GetCurrentValue (G4UIcommand* command) {
G4String currentValue;
if (command == fpCommandLightsThetaPhi) {
currentValue = ConvertToString(fLightsVector.theta(),
fLightsVector.phi(), "deg");
}
else if (command == fpCommandLightsVector) {
currentValue = ConvertToString(fLightsVector);
}
return currentValue;
}
void G4VisCommandViewerLights::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
G4cout << "G4VisCommandsViewerLights::SetNewValue: no current viewer."
<< G4endl;
return;
}
G4ViewParameters vp = currentViewer->GetViewParameters();
if (command == fpCommandLightsThetaPhi) {
G4double theta, phi;
GetNewDoublePairValue(newValue, theta, phi);
G4double x = sin (theta) * cos (phi);
G4double y = sin (theta) * sin (phi);
G4double z = cos (theta);
fLightsVector = G4Vector3D (x, y, z);
}
else if (command == fpCommandLightsVector) {
fLightsVector = GetNew3VectorValue(newValue);
}
vp.SetLightpointDirection(fLightsVector);
if (fpVisManager->GetVerboseLevel() > 0) {
G4cout << "Lights direction set to " << fLightsVector << G4endl;
}
SetViewParameters(currentViewer, vp);
}
////////////// /vis/viewer/list ///////////////////////////////////////
G4VisCommandViewerList::G4VisCommandViewerList () {
@@ -245,7 +488,7 @@ void G4VisCommandViewerList::SetNewValue (G4UIcommand* command,
}
const G4SceneHandlerList& sceneHandlerList = fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.entries ();
G4int nHandlers = sceneHandlerList.size ();
G4bool found = false;
G4bool foundCurrent = false;
for (int iHandler = 0; iHandler < nHandlers; iHandler++) {
@@ -254,7 +497,7 @@ void G4VisCommandViewerList::SetNewValue (G4UIcommand* command,
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
G4cout << "Scene handler \"" << sceneHandler -> GetName ()
<< "\", scene \"" << pScene -> GetName () << "\":";
G4int nViewers = viewerList.entries ();
G4int nViewers = viewerList.size ();
if (nViewers == 0) {
G4cout << "\n No viewers for this scene handler." << G4endl;
}
@@ -298,6 +541,96 @@ void G4VisCommandViewerList::SetNewValue (G4UIcommand* command,
}
}
////////////// /vis/viewer/pan and panTo ////////////////////////////
G4VisCommandViewerPan::G4VisCommandViewerPan ():
fPanIncrementRight (0.),
fPanIncrementUp (0.),
fPanToRight (0.),
fPanToUp (0.)
{
G4bool omitable;
fpCommandPan = new G4UIcommand
("/vis/viewer/pan", this);
fpCommandPan -> SetGuidance
("/vis/viewer/pan [<right-increment>] [<up-increment>] [<unit>]");
fpCommandPan -> SetGuidance
("Moves the camera incrementally right and up by these amounts.");
G4UIparameter* parameter;
parameter = new G4UIparameter("right-increment", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandPan -> SetParameter (parameter);
parameter = new G4UIparameter("up-increment", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandPan -> SetParameter (parameter);
parameter = new G4UIparameter ("unit", 's', omitable = true);
parameter -> SetDefaultValue ("m");
fpCommandPan -> SetParameter (parameter);
fpCommandPanTo = new G4UIcommand
("/vis/viewer/panTo", this);
fpCommandPanTo -> SetGuidance
("/vis/viewer/panTo [<right>] [<up>] [<unit>]");
fpCommandPanTo -> SetGuidance
("Moves the camera to this position right and up relative to standard"
"target point (as seen from viewpoint direction).");
parameter = new G4UIparameter("right", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandPanTo -> SetParameter (parameter);
parameter = new G4UIparameter("up", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandPanTo -> SetParameter (parameter);
parameter = new G4UIparameter ("unit", 's', omitable = true);
parameter -> SetDefaultValue ("m");
fpCommandPanTo -> SetParameter (parameter);
}
G4VisCommandViewerPan::~G4VisCommandViewerPan () {
delete fpCommandPan;
delete fpCommandPanTo;
}
G4String G4VisCommandViewerPan::GetCurrentValue (G4UIcommand* command) {
G4String currentValue;
if (command == fpCommandPan) {
currentValue = ConvertToString(fPanIncrementRight, fPanIncrementUp, "m");
}
else if (command == fpCommandPanTo) {
currentValue = ConvertToString(fPanToRight, fPanToUp, "m");
}
return currentValue;
}
void G4VisCommandViewerPan::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
G4cout << "G4VisCommandsViewerPan::SetNewValue: no current viewer."
<< G4endl;
return;
}
G4ViewParameters vp = currentViewer->GetViewParameters();
if (command == fpCommandPan) {
GetNewDoublePairValue(newValue, fPanIncrementRight, fPanIncrementUp);
vp.IncrementPan(fPanIncrementRight, fPanIncrementUp);
}
else if (command == fpCommandPanTo) {
GetNewDoublePairValue(newValue, fPanToRight, fPanToUp);
vp.SetPan(fPanToRight, fPanToUp);
}
if (fpVisManager->GetVerboseLevel() > 0) {
G4cout << "Current target point now " << vp.GetCurrentTargetPoint()
<< G4endl;
}
SetViewParameters(currentViewer, vp);
}
////////////// /vis/viewer/refresh ///////////////////////////////////////
G4VisCommandViewerRefresh::G4VisCommandViewerRefresh () {
@@ -335,19 +668,38 @@ void G4VisCommandViewerRefresh::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4String& refreshName = newValue;
G4VViewer* viewer = fpVisManager -> GetViewer (refreshName);
if (viewer) {
G4cout << "Refreshing viewer \"" << viewer -> GetName () << "\"..."
<< G4endl;
viewer -> ClearView ();
viewer -> DrawView ();
G4cout << "Viewer \"" << viewer -> GetName () << "\"" << " refreshed."
"\n (You might also need \"/vis/viewer/update\".)" << G4endl;
}
else {
if (!viewer) {
G4cout << "Viewer \"" << refreshName << "\"" <<
" not found - \"/vis/viewer/list\"\n to see possibilities."
<< G4endl;
return;
}
G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
if (!sceneHandler) {
G4cout << "Viewer \"" << refreshName << "\"" <<
" has no scene handler - report serious bug."
<< G4endl;
return;
}
G4Scene* scene = sceneHandler->GetScene();
if (!scene) {
G4cout << "SceneHandler \"" << sceneHandler->GetName()
<< "\", to which viewer \"" << refreshName << "\"" <<
"\n is attached, has no scene - \"/vis/scene/create\" and"
"\"/vis/sceneHandler/attach\""
"\n (or use compound command \"/vis/drawVolume\")."
<< G4endl;
return;
}
G4cout << "Refreshing viewer \"" << viewer -> GetName () << "\"..."
<< G4endl;
viewer -> ClearView ();
viewer -> DrawView ();
G4cout << "Viewer \"" << viewer -> GetName () << "\"" << " refreshed."
"\n (You might also need \"/vis/viewer/update\".)" << G4endl;
}
////////////// /vis/viewer/remove ///////////////////////////////////////
@@ -407,7 +759,8 @@ void G4VisCommandViewerRemove::SetNewValue (G4UIcommand* command,
}
else {
G4VSceneHandler* sceneHandler = viewer -> GetSceneHandler ();
sceneHandler -> SetViewerList ().remove (viewer);
G4ViewerList& viewerList = sceneHandler -> SetViewerList ();
viewerList.remove (viewer);
G4cout << "Current viewer is unchanged (\""
<< currentViewer -> GetName () << "\")." << G4endl;
}
@@ -457,14 +810,7 @@ void G4VisCommandViewerReset::SetNewValue (G4UIcommand* command,
return;
}
if (fpVisManager -> IsValidView ()) {
G4ViewParameters vp; // Default view parameters.
viewer->SetViewParameters(vp);
G4cout << "Viewer \"" << viewer -> GetName () << "\" reset.";
G4cout << "\nIssue \"/vis/viewer/refresh\" to see effect." << G4endl;
// For now...
fpVisManager->SetCurrentViewParameters() = vp;
}
SetViewParameters(viewer, viewer->GetDefaultViewParameters());
}
////////////// /vis/viewer/select ///////////////////////////////////////
@@ -582,3 +928,172 @@ void G4VisCommandViewerUpdate::SetNewValue (G4UIcommand* command,
"\n to see possibilities." << G4endl;
}
}
//////// /vis/viewer/viewpointThetaPhi and viewpointVector /////////////
G4VisCommandViewerViewpoint::G4VisCommandViewerViewpoint ():
fViewpointVector (G4ThreeVector(0.,0.,1.))
{
G4bool omitable;
fpCommandViewpointThetaPhi = new G4UIcommand
("/vis/viewer/viewpointThetaPhi", this);
fpCommandViewpointThetaPhi -> SetGuidance
("/vis/viewer/viewpointThetaPhi [<theta>] [<phi>] [deg|rad]");
fpCommandViewpointThetaPhi -> SetGuidance
("Set direction from target to camera. Also changes lightpoint direction"
"\nif lights are set to move with camera.");
G4UIparameter* parameter;
parameter = new G4UIparameter("theta", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandViewpointThetaPhi -> SetParameter (parameter);
parameter = new G4UIparameter("phi", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandViewpointThetaPhi -> SetParameter (parameter);
parameter = new G4UIparameter ("unit", 's', omitable = true);
parameter -> SetDefaultValue ("deg");
fpCommandViewpointThetaPhi -> SetParameter (parameter);
fpCommandViewpointVector = new G4UIcommand
("/vis/viewer/viewpointVector", this);
fpCommandViewpointVector -> SetGuidance
("/vis/viewer/viewpointVector [<x>] [<y>] [<z>]");
fpCommandViewpointVector -> SetGuidance
("Set direction from target to camera. Also changes lightpoint direction"
"\nif lights are set to move with camera.");
parameter = new G4UIparameter("x", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandViewpointVector -> SetParameter (parameter);
parameter = new G4UIparameter("y", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandViewpointVector -> SetParameter (parameter);
parameter = new G4UIparameter ("z", 'd', omitable = true);
parameter -> SetCurrentAsDefault (true);
fpCommandViewpointVector -> SetParameter (parameter);
}
G4VisCommandViewerViewpoint::~G4VisCommandViewerViewpoint () {
delete fpCommandViewpointThetaPhi;
delete fpCommandViewpointVector;
}
G4String G4VisCommandViewerViewpoint::GetCurrentValue (G4UIcommand* command) {
G4String currentValue;
if (command == fpCommandViewpointThetaPhi) {
currentValue = ConvertToString(fViewpointVector.theta(),
fViewpointVector.phi(), "deg");
}
else if (command == fpCommandViewpointVector) {
currentValue = ConvertToString(fViewpointVector);
}
return currentValue;
}
void G4VisCommandViewerViewpoint::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
G4cout << "G4VisCommandsViewerViewpoint::SetNewValue: no current viewer."
<< G4endl;
return;
}
G4ViewParameters viewParams = currentViewer->GetViewParameters();
if (command == fpCommandViewpointThetaPhi) {
G4double theta, phi;
GetNewDoublePairValue(newValue, theta, phi);
G4double x = sin (theta) * cos (phi);
G4double y = sin (theta) * sin (phi);
G4double z = cos (theta);
fViewpointVector = G4Vector3D (x, y, z);
}
else if (command == fpCommandViewpointVector) {
fViewpointVector = GetNew3VectorValue(newValue);
}
viewParams.SetViewAndLights(fViewpointVector);
if (fpVisManager->GetVerboseLevel() > 0) {
G4cout << "Viewpoint direction set to " << fViewpointVector << G4endl;
if (viewParams.GetLightsMoveWithCamera ()) {
G4cout << "Lightpoint direction set to "
<< viewParams.GetActualLightpointDirection () << G4endl;
}
}
SetViewParameters(currentViewer, viewParams);
}
////////////// /vis/viewer/zoom and zoomTo ////////////////////////////
G4VisCommandViewerZoom::G4VisCommandViewerZoom ():
fZoomMultiplier (1.),
fZoomTo (1.)
{
G4bool omitable, currentAsDefault;
fpCommandZoom = new G4UIcmdWithADouble
("/vis/viewer/zoom", this);
fpCommandZoom -> SetGuidance
("/vis/viewer/zoom [<multiplier>]");
fpCommandZoom -> SetGuidance
("Multiplies magnification by this factor.");
fpCommandZoom -> SetParameterName("multiplier",
omitable=true,
currentAsDefault=true);
fpCommandZoomTo = new G4UIcmdWithADouble
("/vis/viewer/zoomTo", this);
fpCommandZoomTo -> SetGuidance
("/vis/viewer/zoomTo [<factor>]");
fpCommandZoomTo -> SetGuidance
("Magnifies by this factor relative to standard view.");
fpCommandZoomTo -> SetParameterName("factor",
omitable=true,
currentAsDefault=true);
}
G4VisCommandViewerZoom::~G4VisCommandViewerZoom () {
delete fpCommandZoom;
delete fpCommandZoomTo;
}
G4String G4VisCommandViewerZoom::GetCurrentValue (G4UIcommand* command) {
G4String currentValue;
if (command == fpCommandZoom) {
currentValue = fpCommandZoom->ConvertToString(fZoomMultiplier);
}
else if (command == fpCommandZoomTo) {
currentValue = fpCommandZoomTo->ConvertToString(fZoomTo);
}
return currentValue;
}
void G4VisCommandViewerZoom::SetNewValue (G4UIcommand* command,
G4String newValue) {
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
G4cout << "G4VisCommandsViewerZoom::SetNewValue: no current viewer."
<< G4endl;
return;
}
G4ViewParameters vp = currentViewer->GetViewParameters();
if (command == fpCommandZoom) {
fZoomMultiplier = fpCommandZoom->GetNewDoubleValue(newValue);
vp.MultiplyZoomFactor(fZoomMultiplier);
}
else if (command == fpCommandZoomTo) {
fZoomTo = fpCommandZoom->GetNewDoubleValue(newValue);
vp.SetZoomFactor(fZoomTo);
}
if (fpVisManager->GetVerboseLevel() > 0) {
G4cout << "Zoom factor changed to " << vp.GetZoomFactor() << G4endl;
}
SetViewParameters(currentViewer, vp);
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisCommandsViewerSet.cc,v 1.3 2000/05/19 09:18:09 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisCommandsViewerSet.cc,v 1.10 2001/03/29 13:46:18 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -15,26 +15,9 @@
#include "G4UIcommand.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
#include "G4VisManager.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UnitsTable.hh"
#include "g4std/strstream"
G4String G4VisCommandsViewerSet::ConvertToString(G4bool blValue)
{
G4String vl = "false";
if(blValue) vl = "true";
return vl;
}
G4bool G4VisCommandsViewerSet::GetNewBoolValue(const G4String& paramString)
{
G4String v = paramString;
v.toUpper();
G4bool vl = false;
if( v=="Y" || v=="YES" || v=="1" || v=="T" || v=="TRUE" )
{ vl = true; }
return vl;
}
#include "G4VisManager.hh"
G4VisCommandsViewerSet::G4VisCommandsViewerSet () {
G4bool omitable;
@@ -47,21 +30,14 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet () {
fpCommandAll->SetParameterName ("from-viewer-name",omitable = false);
viewerNameCommands.push_back (fpCommandAll);
fpCommandStyle = new G4UIcmdWithAString ("/vis/viewer/set/style",this);
fpCommandStyle->SetGuidance ("/vis/viewer/set/style wireframe|surface");
fpCommandStyle->SetParameterName ("style",omitable = false);
fpCommandStyle->SetCandidates("wireframe surface");
fpCommandEdge = new G4UIcmdWithABool("/vis/viewer/set/edge",this);
fpCommandEdge->SetGuidance("/vis/viewer/set/edge [true|false]");
fpCommandEdge->SetParameterName("edge",omitable = true);
fpCommandEdge->SetDefaultValue(true);
fpCommandHiddenEdge =
new G4UIcmdWithABool("/vis/viewer/set/hiddenEdge",this);
fpCommandHiddenEdge->SetGuidance("/vis/viewer/set/edge [true|false]");
fpCommandHiddenEdge->SetParameterName("hidden-edge",omitable = true);
fpCommandHiddenEdge->SetDefaultValue(true);
fpCommandAutoRefresh = new G4UIcmdWithABool
("/vis/viewer/set/autorefresh",this);
fpCommandAutoRefresh->SetGuidance
("/vis/viewer/set/autorefresh [true|false]");
fpCommandAutoRefresh->SetGuidance
("View is automatically refreshed after a change of view parameters.");
fpCommandAutoRefresh->SetParameterName("auto-refresh",omitable = true);
fpCommandAutoRefresh->SetDefaultValue(false);
fpCommandCulling = new G4UIcommand("/vis/viewer/set/culling",this);
fpCommandCulling->SetGuidance
@@ -84,14 +60,122 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet () {
parameter = new G4UIparameter("unit",'s',omitable = true);
parameter->SetDefaultValue("g/cm3");
fpCommandCulling->SetParameter(parameter);
fpCommandEdge = new G4UIcmdWithABool("/vis/viewer/set/edge",this);
fpCommandEdge->SetGuidance("/vis/viewer/set/edge [true|false]");
fpCommandEdge->SetParameterName("edge",omitable = true);
fpCommandEdge->SetDefaultValue(true);
fpCommandHiddenEdge =
new G4UIcmdWithABool("/vis/viewer/set/hiddenEdge",this);
fpCommandHiddenEdge->SetGuidance("/vis/viewer/set/edge [true|false]");
fpCommandHiddenEdge->SetParameterName("hidden-edge",omitable = true);
fpCommandHiddenEdge->SetDefaultValue(true);
fpCommandHiddenMarker =
new G4UIcmdWithABool("/vis/viewer/set/hiddenMarker",this);
fpCommandHiddenMarker->SetGuidance
("/vis/viewer/set/hiddenMarker [true|false]");
fpCommandHiddenMarker->SetParameterName("hidden-marker",omitable = true);
fpCommandHiddenMarker->SetDefaultValue(true);
fpCommandLightsMove = new G4UIcmdWithAString
("/vis/viewer/set/lightsMove",this);
fpCommandLightsMove->SetGuidance
("/vis/viewer/set/lightsMove with-camera|with-object");
fpCommandLightsMove->SetGuidance
("Note: parameter will be parsed for \"cam\" or \"obj\".");
fpCommandLightsMove->SetParameterName("lightsMove",omitable = false);
// fpCommandLightsMove->SetCandidates("move-with-camera move-with-object");
// Own parsing.
fpCommandLineSegments = new G4UIcmdWithAnInteger
("/vis/viewer/set/lineSegmentsPerCircle",this);
fpCommandLineSegments->SetGuidance
("/vis/viewer/set/lineSegmentsPerCircle [<number-of-sides-per-circle>]");
fpCommandLineSegments->SetGuidance
(" Number of sides per circle in polygon/polyhedron graphical"
"\nrepresentation of objects with curved lines/surfaces.");
fpCommandLineSegments->SetParameterName("line-segments",omitable = true);
fpCommandLineSegments->SetDefaultValue(24);
fpCommandProjection = new G4UIcommand("/vis/viewer/set/projection",this);
fpCommandProjection->SetGuidance
("/vis/viewer/set/projection"
" o[rthogonal]|p[erspective] [<field-half-angle>] [deg|rad]");
fpCommandProjection->SetGuidance
("Note: 1st parameter will be parsed for first character \"o\" or \"p\".");
fpCommandProjection->SetGuidance("Default: orthogonal 30 deg");
parameter = new G4UIparameter("projection",'s',omitable = true);
parameter->SetDefaultValue("orthogonal");
fpCommandProjection->SetParameter(parameter);
parameter = new G4UIparameter("field-half-angle",'d',omitable = true);
parameter->SetDefaultValue(30.);
fpCommandProjection->SetParameter(parameter);
parameter = new G4UIparameter("unit",'s',omitable = true);
parameter->SetDefaultValue("deg");
fpCommandProjection->SetParameter(parameter);
fpCommandSectionPlane = new G4UIcommand
("/vis/viewer/set/section_plane",this);
fpCommandSectionPlane -> SetGuidance
(
"Set plane for drawing section (DCUT). Specify plane by"
"\nx y z units nx ny nz, e.g., for a y-z plane at x = 1 cm:"
"\n/vis~/set/section_plane on 1 0 0 cm 1 0 0"
);
parameter = new G4UIparameter("Selector",'c',true);
parameter -> SetDefaultValue ("?");
fpCommandSectionPlane->SetParameter(parameter);
parameter = new G4UIparameter("x",'d',omitable = true);
parameter -> SetDefaultValue (0);
parameter -> SetGuidance ("Coordinate of point on the plane.");
fpCommandSectionPlane->SetParameter(parameter);
parameter = new G4UIparameter("y",'d',omitable = true);
parameter -> SetDefaultValue (0);
parameter -> SetGuidance ("Coordinate of point on the plane.");
fpCommandSectionPlane->SetParameter(parameter);
parameter = new G4UIparameter("z",'d',omitable = true);
parameter -> SetDefaultValue (0);
parameter -> SetGuidance ("Coordinate of point on the plane.");
fpCommandSectionPlane->SetParameter(parameter);
parameter = new G4UIparameter("unit",'s',omitable = true);
parameter -> SetDefaultValue ("cm");
parameter -> SetGuidance ("Unit of point on the plane.");
fpCommandSectionPlane->SetParameter(parameter);
parameter = new G4UIparameter("nx",'d',omitable = true);
parameter -> SetDefaultValue (1);
parameter -> SetGuidance ("Component of plane normal.");
fpCommandSectionPlane->SetParameter(parameter);
parameter = new G4UIparameter("ny",'d',omitable = true);
parameter -> SetDefaultValue (0);
parameter -> SetGuidance ("Component of plane normal.");
fpCommandSectionPlane->SetParameter(parameter);
parameter = new G4UIparameter("nz",'d',omitable = true);
parameter -> SetDefaultValue (0);
parameter -> SetGuidance ("Component of plane normal.");
fpCommandSectionPlane->SetParameter(parameter);
fpCommandStyle = new G4UIcmdWithAString ("/vis/viewer/set/style",this);
fpCommandStyle->SetGuidance ("/vis/viewer/set/style wireframe|surface");
fpCommandStyle->SetGuidance
("Note: parameter will be parsed for first character \"w\" or \"s\".");
fpCommandStyle->SetParameterName ("style",omitable = false);
// fpCommandStyle->SetCandidates("wireframe surface"); // Own parsing.
}
G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
delete fpCommandAll;
delete fpCommandStyle;
delete fpCommandAutoRefresh;
delete fpCommandCulling;
delete fpCommandEdge;
delete fpCommandHiddenEdge;
delete fpCommandCulling;
delete fpCommandHiddenMarker;
delete fpCommandLineSegments;
delete fpCommandLightsMove;
delete fpCommandProjection;
delete fpCommandSectionPlane;
delete fpCommandStyle;
}
G4String G4VisCommandsViewerSet::GetCurrentValue(G4UIcommand* command) {
@@ -132,45 +216,75 @@ void G4VisCommandsViewerSet::SetNewValue
<< G4endl;
}
else if (command == fpCommandStyle) {
G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
if (newValue == "wireframe") {
switch (existingStyle) {
case G4ViewParameters::wireframe:
break;
case G4ViewParameters::hlr:
break;
case G4ViewParameters::hsr:
vp.SetDrawingStyle(G4ViewParameters::wireframe);
break;
case G4ViewParameters::hlhsr:
vp.SetDrawingStyle(G4ViewParameters::hlr);
break;
}
else if (command == fpCommandAutoRefresh) {
G4bool autoRefresh = GetNewBoolValue(newValue);
vp.SetAutoRefresh(autoRefresh);
G4cout << "Views will ";
if (!vp.IsAutoRefresh()) G4cout << "not ";
G4cout << "be automatically refreshed after a change of view parameters."
<< G4endl;
}
else if (command == fpCommandCulling) {
G4String cullingOption, stringFlag, unit;
G4double density;
G4bool boolFlag;
G4std::istrstream is ((char*)newValue.data());
is >> cullingOption >> stringFlag >> density >> unit;
boolFlag = GetNewBoolValue(stringFlag);
if (cullingOption == "global") {
vp.SetCulling(boolFlag);
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: culling: global culling flag"
" set to " << ConvertToString(boolFlag) <<
".\n Does not change specific culling flags."
<< G4endl;
}
else if (newValue == "surface") {
switch (existingStyle) {
case G4ViewParameters::wireframe:
vp.SetDrawingStyle(G4ViewParameters::hsr);
break;
case G4ViewParameters::hlr:
vp.SetDrawingStyle(G4ViewParameters::hlhsr);
break;
case G4ViewParameters::hsr:
break;
case G4ViewParameters::hlhsr:
break;
else if (cullingOption == "coveredDaughters") {
vp.SetCullingCovered(boolFlag);
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: culling: culling covered"
"\n daughters flag set to "
<< ConvertToString(boolFlag) <<
". Daughters covered by opaque mothers"
"\n will be culled, i.e., not drawn, if this flag is true."
"\n Note: this is only effective in surface drawing style,"
"\n and then only if the volumes are visible and opaque, and then"
"\n only if no sections or cutways are in operation."
<< G4endl;
}
else if (cullingOption == "invisible") {
vp.SetCullingInvisible(boolFlag);
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: culling: culling invisible"
"\n flag set to "
<< boolFlag << ConvertToString(boolFlag) <<
". Volumes marked invisible will be culled,"
"\n i.e., not drawn, if this flag is true."
<< G4endl;
}
else if (cullingOption == "density") {
vp.SetDensityCulling(boolFlag);
if (boolFlag) {
density *= G4UnitDefinition::GetValueOf(unit);
vp.SetVisibleDensity(density);
}
else {
density = vp.GetVisibleDensity();
}
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: culling: culling by density"
"\n flag set to " << ConvertToString(boolFlag) <<
". Volumes with density less than " <<
G4BestUnit(density,"Volumic Mass") <<
"\n will be culled, i.e., not drawn, if this flag is true."
<< G4endl;
}
else {
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: style: unrecognised style."
"G4VisCommandsViewerSet::SetNewValue: culling: option not recognised."
<< G4endl;
return;
}
G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
<< "\" set to " << vp.GetDrawingStyle()
<< G4endl;
}
else if (command == fpCommandEdge) {
@@ -241,64 +355,157 @@ void G4VisCommandsViewerSet::SetNewValue
<< G4endl;
}
else if (command == fpCommandCulling) {
G4String cullingOption, stringFlag, unit;
G4double density;
G4bool boolFlag;
G4std::istrstream is ((char*)newValue.data());
is >> cullingOption >> stringFlag >> density >> unit;
boolFlag = GetNewBoolValue(stringFlag);
if (cullingOption == "global") {
vp.SetCulling(boolFlag);
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: culling: global culling flag"
" set to " << ConvertToString(boolFlag) <<
".\n Does not change specific culling flags."
<< G4endl;
else if (command == fpCommandHiddenMarker) {
G4bool hidden = GetNewBoolValue(newValue);
if (hidden) vp.SetMarkerHidden();
else vp.SetMarkerNotHidden();
G4cout << "Markers will ";
if (vp.IsMarkerNotHidden()) G4cout << "not ";
G4cout << "be hidden under solid objects." << G4endl;
}
else if (command == fpCommandLightsMove) {
G4String s (newValue);
if (s.find("cam") != G4String::npos) vp.SetLightsMoveWithCamera(true);
else if(s.find("obj") != G4String::npos) vp.SetLightsMoveWithCamera(false);
else {
G4cout << "\"" << newValue << "\" not recognised."
" Looking for \"cam\" or \"obj\" in string." << G4endl;
}
else if (cullingOption == "coveredDaughters") {
vp.SetCullingCovered(boolFlag);
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: culling: culling covered"
"\n daughters flag set to " << ConvertToString(boolFlag) <<
". Daughters covered by opaque mothers"
"\n will be culled, i.e., not drawn, if this flag is true."
"\n Note: this is only effective in surface drawing style,"
"\n and then only if the volumes are visible and opaque, and then"
"\n only if no sections or cutways are in operation."
<< G4endl;
G4cout << "Lights move with ";
if (vp.GetLightsMoveWithCamera())
G4cout << "camera (object appears to rotate).";
else G4cout << "object (the viewer appears to be moving).";
G4cout << G4endl;
}
else if (command == fpCommandLineSegments) {
G4int nSides = GetNewIntValue(newValue);
G4cout <<
"Number of line segements per circle in polygon approximation is "
<< nSides << G4endl;
vp.SetNoOfSides(nSides);
}
else if (command == fpCommandProjection) {
G4double fieldHalfAngle;
size_t iPos = 0;
if (newValue[iPos] == 'o') { // "orthogonal"
fieldHalfAngle = 0.;
}
else if (cullingOption == "invisible") {
vp.SetCullingInvisible(boolFlag);
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: culling: culling invisible"
"\n flag set to " << boolFlag << ConvertToString(boolFlag) <<
". Volumes marked invisible will be culled,"
"\n i.e., not drawn, if this flag is true."
<< G4endl;
}
else if (cullingOption == "density") {
vp.SetDensityCulling(boolFlag);
if (boolFlag) {
density *= G4UnitDefinition::GetValueOf(unit);
vp.SetVisibleDensity(density);
else if (newValue[iPos] == 'p') { // "perspective"
G4String dummy;
G4String unit;
G4std::istrstream is ((char*)newValue.data());
is >> dummy >> fieldHalfAngle >> unit;
fieldHalfAngle *= ValueOf(unit);
if (fieldHalfAngle > 89.5 * deg || fieldHalfAngle <= 0.0) {
G4cout << "Field half angle should be 0 < angle <= 89.5 degrees.";
G4cout << G4endl;
return;
}
else {
density = vp.GetVisibleDensity();
}
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: culling: culling by density"
"\n flag set to " << ConvertToString(boolFlag) <<
". Volumes with density less than " <<
G4BestUnit(density,"Volumic Mass") <<
"\n will be culled, i.e., not drawn, if this flag is true."
<< G4endl;
}
else {
G4cout <<
"G4VisCommandsViewerSet::SetNewValue: culling: option not recognised."
<< G4endl;
G4cout << "\"" << newValue << "\" not recognised."
" Looking for 'o' or 'p' first character." << G4endl;
return;
}
vp.SetFieldHalfAngle(fieldHalfAngle);
G4cout << "Projection style of viewer \"" << currentViewer->GetName()
<< "\" set to ";
if (fieldHalfAngle == 0.) {
G4cout << "orthogonal.";
}
else {
G4cout << "perspective\n with half angle " << fieldHalfAngle / deg
<< " degrees.";
}
G4cout << G4endl;
}
else if (command == fpCommandSectionPlane) {
G4String choice, unit;
G4double x, y, z, nx, ny, nz;
const char* t = newValue;
G4std::istrstream is ((char*)t);
is >> choice >> x >> y >> z >> unit >> nx >> ny >> nz;
G4int iSelector = -1;
if (choice.compareTo("off",G4String::ignoreCase) == 0) iSelector = 0;
if (choice.compareTo("on",G4String::ignoreCase) == 0) iSelector = 1;
if (iSelector < 0) {
G4cout << "Choice not recognised (on/off)." << G4endl;
G4cout << "Section drawing is currently: ";
if (vp.IsSection ()) G4cout << "on";
else G4cout << "off";
G4cout << ".\nSection plane is currently: "
<< vp.GetSectionPlane ();
G4cout << G4endl;
return;
}
G4double F;
switch (iSelector) {
case 0:
vp.UnsetSectionPlane();
break;
case 1:
F = ValueOf(unit);
x *= F; y *= F; z *= F;
vp.SetSectionPlane(G4Plane3D(G4Normal3D(nx,ny,nz),
G4Point3D(x,y,z)));
vp.SetViewpointDirection(G4Normal3D(nx,ny,nz));
break;
default: G4cout << "Choice not recognised (on/off).\n"; break;
}
G4cout << "Section drawing is now: ";
if (vp.IsSection ()) G4cout << "on";
else G4cout << "off";
G4cout << ".\nSection plane is now: "
<< vp.GetSectionPlane ();
G4cout << G4endl;
}
else if (command == fpCommandStyle) {
G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
size_t iPos = 0;
if (newValue[iPos] == 'w') { // "wireframe"
switch (existingStyle) {
case G4ViewParameters::wireframe:
break;
case G4ViewParameters::hlr:
break;
case G4ViewParameters::hsr:
vp.SetDrawingStyle(G4ViewParameters::wireframe);
break;
case G4ViewParameters::hlhsr:
vp.SetDrawingStyle(G4ViewParameters::hlr);
break;
}
}
else if (newValue[iPos] == 's') { // "surface"
switch (existingStyle) {
case G4ViewParameters::wireframe:
vp.SetDrawingStyle(G4ViewParameters::hsr);
break;
case G4ViewParameters::hlr:
vp.SetDrawingStyle(G4ViewParameters::hlhsr);
break;
case G4ViewParameters::hsr:
break;
case G4ViewParameters::hlhsr:
break;
}
}
else {
G4cout << "\"" << newValue << "\" not recognised."
" Looking for 'w' or 's' first character." << G4endl;
return;
}
G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
<< "\" set to " << vp.GetDrawingStyle()
<< G4endl;
}
else {
@@ -307,8 +514,5 @@ void G4VisCommandsViewerSet::SetNewValue
return;
}
currentViewer->SetViewParameters(vp);
G4cout << "Issue /vis/viewer/refresh to see effect." << G4endl;
// For now...
fpVisManager->SetCurrentViewParameters() = vp;
SetViewParameters(currentViewer,vp);
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.3 1999/12/15 14:54:26 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.4 2001/02/05 02:34:29 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
#include "G4VisFeaturesOfDAWNFILE.hh"
@@ -22,5 +22,6 @@ G4String G4VisFeaturesOfDAWNFILE () {
"\n connection via g4.prim file to Fukui Renderer DAWN etc."
"\n Disadvantages: compute intensive, takes time (use a fast graphics"
"\n system, such as OpenGL, to select view, then copy"
"\n to this renderer - /vis~/copy/view, /vis~/set/view).";
"\n view parameters to this renderer:"
"\n \"/vis/viewer/set/all <OpenGL-view>\".";
}
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.3 1999/12/15 14:54:26 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VisFeaturesOfOpenGL.cc,v 1.3 1999/12/15 14:54:26 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VisFeaturesOfOpenInventor.cc,v 1.3 1999/12/15 14:54:26 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessCamera.cc,v 1.4 1999/12/15 14:54:26 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisManMessCamera.cc,v 1.8 2001/02/23 15:43:29 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -40,7 +40,7 @@ void G4VisManMessenger::AddCommandCamera () {
param -> SetDefaultValue (0.);
param -> SetGuidance ("world coordinates");
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
//////////////////////////////////////// /vis~/camera/orbit ////
//camera \hline
@@ -62,7 +62,7 @@ void G4VisManMessenger::AddCommandCamera () {
param -> SetGuidance ("degrees");
param -> SetDefaultValue (1.);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/////////////////////////////////////// /vis~/camera/pan ////
//camera \hline
@@ -83,7 +83,7 @@ void G4VisManMessenger::AddCommandCamera () {
param -> SetDefaultValue (0.);
param -> SetGuidance ("world coordinates");
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
///////////////////////////////////// /vis~/camera/projection_style ////
//camera \hline
@@ -100,7 +100,7 @@ void G4VisManMessenger::AddCommandCamera () {
param = new G4UIparameter ("Perspective view half angle.", 'd', true);
param -> SetDefaultValue (0.);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
//////////////////////////////////////// /vis~/camera/spin ////
//camera \hline
@@ -122,7 +122,7 @@ void G4VisManMessenger::AddCommandCamera () {
param -> SetGuidance ("degrees");
param -> SetDefaultValue (1.);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
//////////////////////////////////////// /vis~/camera/viewpoint ////
//camera \hline
@@ -145,7 +145,7 @@ void G4VisManMessenger::AddCommandCamera () {
param -> SetGuidance ("degrees");
param -> SetDefaultValue (0.0);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/////////////////////////////////////// /vis~/camera/window_size_hint ////
//camera \hline
@@ -161,7 +161,7 @@ void G4VisManMessenger::AddCommandCamera () {
param = new G4UIparameter ("Window size hint in pixels", 'i', true);
param -> SetDefaultValue (600);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/////////////////////////////////////// /vis~/camera/zoom ////
//camera \hline
@@ -178,7 +178,7 @@ void G4VisManMessenger::AddCommandCamera () {
param -> SetDefaultValue (1.);
param -> SetGuidance ("magnifies by this");
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
}
@@ -187,6 +187,7 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
/////////////////////////////// /vis~/camera/dolly ////
if (commandPath == "/vis~/camera/dolly") {
G4VisManager::PrintCommandDeprecation("Use \"/vis/viewer/dolly\".");
if (ViewValid ()) {
G4double in;
const char* aString = newValues;
@@ -207,8 +208,6 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << G4endl;
}
@@ -216,6 +215,8 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
//////////////////////////////// /vis~/camera/orbit ////
if (commandPath == "/vis~/camera/orbit") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
if (ViewValid ()) {
G4int nFrames;
G4double dbeta;
@@ -234,12 +235,13 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
/////////////////////////////// /vis~/camera/pan ////
if (commandPath == "/vis~/camera/pan") {
G4VisManager::PrintCommandDeprecation("Use \"/vis/viewer/pan\".");
if (ViewValid ()) {
G4double right, up;
const char* aString = newValues;
G4std::istrstream is((char*) aString);is >> right >> up;
G4cout << "Pan " << right << " right, " << up << " up." << G4endl;
fpVMan -> SetCurrentViewParameters ().Pan (right, up);
fpVMan -> SetCurrentViewParameters ().IncrementPan (right, up);
if (fpVMan -> GetVerboseLevel () > 0) {
G4cout << "Current target point changed to "
<< fpVMan -> GetCurrentViewParameters ().GetCurrentTargetPoint ()
@@ -255,8 +257,6 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << G4endl;
}
@@ -264,6 +264,8 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
///////////////////////////////////// /vis~/camera/projection_style ////
if (commandPath == "/vis~/camera/projection_style") {
G4VisManager::PrintCommandDeprecation
("Use \"/vis/viewer/set/projection\".");
G4int iStyle;
G4double fieldHalfAngleDegrees;
const char* aString = newValues;
@@ -320,8 +322,6 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << G4endl;
}
@@ -329,6 +329,8 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
//////////////////////////////// /vis~/camera/spin ////
if (commandPath == "/vis~/camera/spin") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
if (ViewValid ()) {
G4int nFrames;
G4double dbeta;
@@ -347,6 +349,9 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
//////////////////////////////////////// /vis~/camera/viewpoint ////
if (commandPath == "/vis~/camera/viewpoint") {
G4VisManager::PrintCommandDeprecation
("Use \"/vis/viewer/viewpointThetaPhi\" or"
" \"/vis/viewer/viewpointVector\".");
G4double theta, phi ;
const char* aString = newValues;
G4std::istrstream is((char*) aString) ; is >> theta >> phi;
@@ -377,14 +382,15 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << G4endl;
}
/////////////////////////////////////// /vis~/camera/window_size_hint ////
if (commandPath == "/vis~/camera/window_size_hint") {
G4VisManager::PrintCommandDeprecation
("Use \"/vis/viewer/create ! ! <pixels>\" or"
" \"/vis/open <system> <pixels>\".");
G4int size;
const char* aString = newValues;
G4std::istrstream is((char*) aString) ; is >> size;
@@ -399,6 +405,7 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
//////////////////////////////// /vis~/camera/zoom ////
if (commandPath == "/vis~/camera/zoom") {
G4VisManager::PrintCommandDeprecation("Use \"/vis/viewer/zoom\".");
if (ViewValid ()) {
G4double zoomBy;
const char* aString = newValues;
@@ -418,8 +425,6 @@ void G4VisManMessenger::DoCommandCamera (const G4String& commandPath,
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << G4endl;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessCreateView.cc,v 1.5 1999/12/15 14:54:27 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisManMessCreateView.cc,v 1.7 2001/02/23 15:43:29 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -42,19 +42,19 @@ void G4VisManMessenger::AddCommandCreateView () {
const G4GraphicsSystemList& gslist =
fpVMan -> GetAvailableGraphicsSystems ();
G4String candidates;
for (int igslist = 0; igslist < gslist.entries (); igslist++) {
G4String nickname = gslist (igslist) -> GetNickname ();
for (int igslist = 0; igslist < gslist.size (); igslist++) {
G4String nickname = gslist [igslist] -> GetNickname ();
if (nickname . length () > 0) {
candidates += nickname;
}
else {
candidates += gslist (igslist) -> GetName ();
candidates += gslist [igslist] -> GetName ();
}
candidates += " ";
}
param -> SetParameterCandidates(candidates);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
}
@@ -63,11 +63,13 @@ void G4VisManMessenger::DoCommandCreateView (const G4String& commandPath,
/////////////////// /vis~/create_view/new_graphics_system /////
if (commandPath == "/vis~/create_view/new_graphics_system") {
G4VisManager::PrintCommandDeprecation
("Use \"/vis/scenehandler/create\" or \"/vis/open\".");
G4String selector;
const char* aString = newValues;
G4std::istrstream is ((char*) aString) ; is >> selector;
const G4GraphicsSystemList& gsl = fpVMan -> GetAvailableGraphicsSystems ();
int nSystems = gsl.entries ();
int nSystems = gsl.size ();
if (nSystems > 0) {
int iGS; // Selector index.
for (iGS = 0; iGS < nSystems; iGS++) {
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessDraw.cc,v 1.5 1999/12/15 14:54:27 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisManMessDraw.cc,v 1.7 2001/02/23 15:43:29 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -60,7 +60,7 @@ void G4VisManMessenger::AddCommandDraw () {
param -> SetDefaultValue ("mm");
param -> SetGuidance ("mm, cm, or m.");
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
//////////////////////////////////// /vis~/draw/text /////
//draw \hline
@@ -98,7 +98,7 @@ void G4VisManMessenger::AddCommandDraw () {
param = new G4UIparameter ("text", 's', true);
param -> SetDefaultValue ("text");
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
//
//////////////////////////////////// /vis~/draw/ghosts /////
@@ -110,7 +110,7 @@ void G4VisManMessenger::AddCommandDraw () {
param = new G4UIparameter ("ParticleName", 's', true);
param -> SetDefaultValue ("all");
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/******************************** UNDER DEVELOPMENT ?????????????
@@ -132,7 +132,7 @@ void G4VisManMessenger::AddCommandDraw () {
param = new G4UIparameter ("Physical volume name", 's', true);
param -> SetDefaultValue ("__none__");
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
**************************************************************/
}
@@ -209,7 +209,9 @@ void G4VisManMessenger::DoCommandDraw (const G4String& commandPath,
////////////////////////// /vis~/draw/volume /////
if (commandPath == "/vis~/draw/volume") {
// Find physical_volume.
G4VisManager::PrintCommandDeprecation
("Use \"/vis/scene/add/volume\" or \"/vis/drawVolume\".");
// Find physical_volume.
G4String name;
const char* aString = newValues;
G4std::istrstream is((char*) aString) ; is >> name;
@@ -220,6 +222,8 @@ void G4VisManMessenger::DoCommandDraw (const G4String& commandPath,
}
////////////////////////// /vis~/draw/ghosts /////
if (commandPath == "/vis~/draw/ghosts") {
G4VisManager::PrintCommandDeprecation
("Use \"/vis/scene/add/ghosts\".");
// preliminaries
G4VisManager* theVisManager;
if(!(theVisManager= G4VisManager::GetInstance())) {
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessExpert.cc,v 1.4 1999/12/15 14:54:27 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisManMessExpert.cc,v 1.6 2001/02/23 15:43:30 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -49,7 +49,7 @@ void G4VisManMessenger::AddCommandExpert () {
(
"...menu of expert commands."
);
fCommandList.append (command);
fCommandList.push_back (command);
//////////////////////////////////////// /vis~/expert/draw_circle ////
//expert \hline
@@ -69,7 +69,7 @@ void G4VisManMessenger::AddCommandExpert () {
param = new G4UIparameter ("size", 'd', true);
param -> SetDefaultValue (10.);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
//////////////////////////////////////// /vis~/expert/draw_line ////
//expert \hline
@@ -95,7 +95,7 @@ void G4VisManMessenger::AddCommandExpert () {
param = new G4UIparameter ("z1", 'd', true);
param -> SetDefaultValue (0.);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
//////////////////////////////////// /vis~/expert/draw_marks_and_show ////
//expert \hline
@@ -115,7 +115,7 @@ void G4VisManMessenger::AddCommandExpert () {
param = new G4UIparameter ("size", 'd', true);
param -> SetDefaultValue (10.);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/***************************************
//////////////////////////////////// /vis~/expert/draw_physical_volume ////
@@ -128,7 +128,7 @@ void G4VisManMessenger::AddCommandExpert () {
(
"A test of G4VisManager::Draw (const G4VPhysicalVolume&,..."
);
fCommandList.append (command);
fCommandList.push_back (command);
**************************************/
//////////////////////////////////////// /vis~/expert/draw_polymarkers ////
@@ -144,7 +144,7 @@ void G4VisManMessenger::AddCommandExpert () {
param -> SetGuidance ("0/1/2/3 = line/dots/circles/squares");
param -> SetDefaultValue (0);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
//////////////////////////////////////// /vis~/expert/draw_spiral ////
//expert \hline
@@ -155,7 +155,7 @@ void G4VisManMessenger::AddCommandExpert () {
(
"Draws a G4Polyline in the form of a spiral."
);
fCommandList.append (command);
fCommandList.push_back (command);
//////////////////////////////////////// /vis~/expert/draw_spirals ////
//expert \hline
@@ -169,7 +169,7 @@ void G4VisManMessenger::AddCommandExpert () {
param = new G4UIparameter ("no. of spirals", 'i', true);
param -> SetDefaultValue (1);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
//////////////////////////////////////// /vis~/expert/draw_square ////
//expert \hline
@@ -189,7 +189,7 @@ void G4VisManMessenger::AddCommandExpert () {
param = new G4UIparameter ("size", 'd', true);
param -> SetDefaultValue (10.);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
}
@@ -198,6 +198,8 @@ void G4VisManMessenger::DoCommandExpert (const G4String& commandPath,
/////////////////////////////////////// /vis~/expert/draw_circle ////
if (commandPath == "/vis~/expert/draw_circle") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
if (ViewValid ()) {
G4double x, y, z, worldSize;
const char* aString = newValues;
@@ -213,6 +215,8 @@ void G4VisManMessenger::DoCommandExpert (const G4String& commandPath,
/////////////////////////////////////// /vis~/expert/draw_line ////
if (commandPath == "/vis~/expert/draw_line") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
if (ViewValid ()) {
G4double x0, y0, z0;
G4double x1, y1, z1;
@@ -232,6 +236,8 @@ void G4VisManMessenger::DoCommandExpert (const G4String& commandPath,
//////////////////////////////////// /vis~/expert/draw_marks_and_show ////
if (commandPath == "/vis~/expert/draw_marks_and_show") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
const G4int num_each_marks = 100 ;
const G4double mark_step = 1000.0 ;
@@ -281,6 +287,8 @@ void G4VisManMessenger::DoCommandExpert (const G4String& commandPath,
/****************************************
////////////////////////////////// /vis~/expert/draw_physical_volume ////
if (commandPath == "/vis~/expert/draw_physical_volume") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
if (ViewValid ()) {
// Given a physical volume...
@@ -328,6 +336,8 @@ void G4VisManMessenger::DoCommandExpert (const G4String& commandPath,
/////////////////////////////////////// /vis~/expert/draw_polymarkers ////
if (commandPath == "/vis~/expert/draw_polymarkers") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
if (ViewValid ()) {
int nPolyMarkers, type;
const char* aString = newValues;
@@ -371,6 +381,8 @@ void G4VisManMessenger::DoCommandExpert (const G4String& commandPath,
/////////////////////////////////////// /vis~/expert/draw_spiral ////
if (commandPath == "/vis~/expert/draw_spiral") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
if (ViewValid ()) {
G4Polyline line;
G4double t = 0., dt = M_PI / 50.;
@@ -385,6 +397,8 @@ void G4VisManMessenger::DoCommandExpert (const G4String& commandPath,
/////////////////////////////////////// /vis~/expert/draw_spirals ////
if (commandPath == "/vis~/expert/draw_spirals") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
if (ViewValid ()) {
int nSpirals;
const char* aString = newValues;
@@ -416,6 +430,8 @@ void G4VisManMessenger::DoCommandExpert (const G4String& commandPath,
/////////////////////////////////////// /vis~/expert/draw_square ////
if (commandPath == "/vis~/expert/draw_square") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
if (ViewValid ()) {
G4double x, y, z, worldSize;
const char* aString = newValues;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessLights.cc,v 1.5 2000/08/19 18:23:37 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisManMessLights.cc,v 1.7 2001/02/23 15:43:30 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -44,7 +44,7 @@ void G4VisManMessenger::AddCommandLights () {
param -> SetGuidance ("degrees");
param -> SetDefaultValue (0.0);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
}
void G4VisManMessenger::DoCommandLights (const G4String& commandPath,
@@ -52,6 +52,8 @@ void G4VisManMessenger::DoCommandLights (const G4String& commandPath,
//////////////////////////////////////// /vis~/lights/direction ////
if (commandPath == "/vis~/lights/direction") {
G4VisManager::PrintCommandDeprecation
("Use \"/vis/viewer/lightsThetaPhi\" or \"/vis/viewer/lightsVector\".");
G4double theta, phi ;
const char* aString = newValues;
G4std::istrstream is((char*) aString) ; is >> theta >> phi;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessSet.cc,v 1.7 2000/05/02 09:58:11 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisManMessSet.cc,v 1.11 2001/02/23 15:43:31 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -43,7 +43,7 @@ void G4VisManMessenger::AddCommandSet () {
param = new G4UIparameter ("density", 'd', true);
param -> SetDefaultValue (0.01);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/////////////////////////////////////////// /vis~/set/drawing_style ////
//set \hline
@@ -57,7 +57,7 @@ void G4VisManMessenger::AddCommandSet () {
param = new G4UIparameter ("Style selector", 'i', true);
param -> SetDefaultValue (-1);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/////////////////////////////////////////// /vis~/set/marker_choices ////
//set \hline
@@ -71,7 +71,7 @@ void G4VisManMessenger::AddCommandSet () {
param = new G4UIparameter ("Style selector", 'i', true);
param -> SetDefaultValue (-1);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/////////////////////////////////////////// /vis~/set/rep_style ////
//set \hline
@@ -87,7 +87,7 @@ void G4VisManMessenger::AddCommandSet () {
param = new G4UIparameter ("Style selector", 'i', true);
param -> SetDefaultValue (-1);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/////////////////////////////////////////// /vis~/set/scene ////
//set \hline
@@ -103,7 +103,7 @@ void G4VisManMessenger::AddCommandSet () {
param = new G4UIparameter ("Selector", 'i', true);
param -> SetDefaultValue (-1);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/////////////////////////////////////////// /vis~/set/section_plane ////
//set \hline
@@ -149,7 +149,7 @@ void G4VisManMessenger::AddCommandSet () {
param -> SetDefaultValue (0);
param -> SetGuidance ("Component of plane normal.");
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/////////////////////////////////////////// /vis~/set/sides ////
//set \hline
@@ -163,7 +163,7 @@ void G4VisManMessenger::AddCommandSet () {
param = new G4UIparameter ("No. of sides", 'i', true);
param -> SetDefaultValue (24);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/////////////////////////////////////////// /vis~/set/verbose //////
//set \hline
@@ -178,7 +178,7 @@ void G4VisManMessenger::AddCommandSet () {
param -> SetDefaultValue (-1);
param -> SetGuidance ("0: quiet, >0: verbose");
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
/////////////////////////////////////////// /vis~/set/view /////////
//set \hline
@@ -192,7 +192,7 @@ void G4VisManMessenger::AddCommandSet () {
param = new G4UIparameter ("View selector", 'i', true);
param -> SetDefaultValue (-1);
command -> SetParameter (param);
fCommandList.append (command);
fCommandList.push_back (command);
}
void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
@@ -200,6 +200,8 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
/////////////////////////////////////////// /vis~/set/cull_by_density ////
if (commandPath == "/vis~/set/cull_by_density") {
G4VisManager::PrintCommandDeprecation
("Use \"/vis/viewer/set/culling\".");
G4String choice;
G4double density; // Units in this section are g / cm3 - WARNING!!!
const char* t = newValues;
@@ -240,8 +242,6 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (getVP);
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << G4endl;
}
@@ -249,6 +249,7 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
/////////////////////////////////////////// /vis~/set/drawing_style ////
if (commandPath == "/vis~/set/drawing_style") {
G4VisManager::PrintCommandDeprecation("Use \"/vis/viewer/set/style\".");
G4int iStyle;
const char* aString = newValues;
G4std::istrstream is((char*) aString) ; is >> iStyle;
@@ -344,8 +345,6 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (getVP);
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << G4endl;
}
@@ -353,6 +352,8 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
//////////////////////////////////////// /vis~/set/marker_choices ////
if (commandPath == "/vis~/set/marker_choices") {
G4VisManager::PrintCommandDeprecation
("Use \"/vis/viewer/set/hiddenMarker\".");
G4int iChoice;
const char* aString = newValues;
G4std::istrstream is((char*) aString) ; is >> iChoice;
@@ -390,8 +391,6 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (getVP);
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << G4endl;
}
@@ -400,6 +399,8 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
/////////////////////////////////////////// /vis~/set/section_plane ////
if (commandPath == "/vis~/set/section_plane") {
G4VisManager::PrintCommandDeprecation
("Use \"/vis/viewer/set/section_plane\".");
G4String choice, unit;
G4double x, y, z, nx, ny, nz;
const char* t = newValues;
@@ -445,8 +446,6 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (getVP);
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << G4endl;
}
@@ -454,16 +453,27 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
/////////////////////////////////////////// /vis~/set/sides ////
if (commandPath == "/vis~/set/sides") {
G4VisManager::PrintCommandDeprecation
("Use \"/vis/viewer/set/lineSegmentsPerCircle\".");
G4int nSides;
const char* t = newValues;
G4std::istrstream is ((char*)t); is >> nSides;
G4cout << "Number of sides per circle in polygon approximation is "
<< nSides << G4endl;
fpVMan -> SetCurrentViewParameters ().SetNoOfSides (nSides);
const G4ViewParameters& getVP = fpVMan -> GetCurrentViewParameters ();
G4VViewer* pView = fpVMan -> GetCurrentViewer ();
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (getVP);
}
G4cout << "Issue Draw or refresh to see effect." << G4endl;
}
/////////////////////////////////////////// /vis~/set/rep_style ////
if (commandPath == "/vis~/set/rep_style") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
G4int iStyle;
const char* aString = newValues;
G4std::istrstream is((char*) aString) ; is >> iStyle;
@@ -492,8 +502,6 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
if (pView) {
// Copy current view parameters into current view.
pView -> SetViewParameters (fpVMan -> GetCurrentViewParameters ());
// Recalculate projection matrices, etc.
pView -> SetView ();
}
G4cout << "Issue Draw or refresh to see effect." << G4endl;
}
@@ -501,6 +509,8 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
/////////////////////////////////// /vis~/set/scene ////
if (commandPath == "/vis~/set/scene") {
G4VisManager::PrintCommandDeprecation
("This command will no longer be maintained.");
static G4int iState = 0;
static G4int nOptions = 2;
G4int iSelector;
@@ -616,6 +626,7 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
/////////////////////////////////////////// /vis~/set/verbose //////
if (commandPath == "/vis~/set/verbose") {
G4VisManager::PrintCommandDeprecation("Use \"/vis/verbose\".");
G4int vLevel;
const char* t = newValues;
G4std::istrstream is ((char*)t); is >> vLevel;
@@ -630,17 +641,18 @@ void G4VisManMessenger::DoCommandSet (const G4String& commandPath,
/////////////////////////////////////////// /vis~/set/view /////////
if (commandPath == "/vis~/set/view") {
G4VisManager::PrintCommandDeprecation("Use \"/vis/viewer/select\".");
// Make List of available views.
G4RWTPtrOrderedVector<G4VViewer> vList;
G4ViewerList vList; // Keep temporary list of viewers.
const G4SceneHandlerList& gml = fpVMan -> GetAvailableSceneHandlers ();
G4int nViewTotal = 0;
G4int iGM, nScenes = gml.entries ();
G4int iGM, nScenes = gml.size ();
for (iGM = 0; iGM < nScenes; iGM++) {
const G4ViewerList& views = gml [iGM] -> GetViewerList ();
int nViews = views.entries ();
int nViews = views.size ();
for (int iView = 0; iView < nViews; iView++) {
G4VViewer* pView = views [iView];
vList.append (pView);
vList.push_back (pView);
nViewTotal++;
}
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManMessenger.cc,v 1.3 1999/12/15 14:54:27 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisManMessenger.cc,v 1.4 2001/02/23 15:43:31 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// GEANT4 Visualization Manager Messenger - John Allison 22nd July 1996.
@@ -28,7 +28,7 @@ fpVMan (pVMan)
///////////////////////////////////////////////// /vis~/... ////
command = new G4UIcommand ("/vis~/", this);
command -> SetGuidance ("Deprecated visualization commands.");
fCommandList.append (command);
fCommandList.push_back (command);
////////////////////////////////////////////// /vis~/*/... ////
AddCommandCamera (); // Define the /vis~/camera/ sub-commands.
@@ -47,7 +47,12 @@ fpVMan (pVMan)
}
G4VisManMessenger::~G4VisManMessenger () {
fCommandList.clearAndDestroy ();
G4std::vector<G4UIcommand*>::iterator i;
for (i = fCommandList.begin();
i != fCommandList.end();
++i) {
delete *i;
}
}
void G4VisManMessenger::SetNewValue (G4UIcommand* command, G4String newValues)
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManager.cc,v 1.17 2000/05/04 08:52:10 johna Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisManager.cc,v 1.21 2001/02/23 15:43:32 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -72,12 +72,21 @@ G4VisManager::G4VisManager ():
G4VisManager::~G4VisManager () {
fpInstance = 0;
fSceneList.clearAndDestroy ();
fAvailableSceneHandlers.clearAndDestroy ();
fAvailableGraphicsSystems.clearAndDestroy ();
int i;
for (i = 0; i < fSceneList.size (); ++i) {
delete fSceneList[i];
}
for (i = 0; i < fAvailableSceneHandlers.size (); ++i) {
delete fAvailableSceneHandlers[i];
}
for (i = 0; i < fAvailableGraphicsSystems.size (); ++i) {
delete fAvailableGraphicsSystems[i];
}
G4cout << "Graphics systems deleted." << G4endl;
G4cout << "VisManager deleting." << G4endl;
fMessengerList.clearAndDestroy ();
for (i = 0; i < fMessengerList.size (); ++i) {
delete fMessengerList[i];
}
delete fpMessenger;
}
@@ -148,7 +157,7 @@ void G4VisManager::Initialise () {
fpMessenger = new G4VisManMessenger (this);
// TEMPORARY /vis/ -> /vis~/ equivalence.
fMessengerList.append (new G4VisToOldVisCommands);
fMessengerList.push_back (new G4VisToOldVisCommands);
fInitialised = true;
}
@@ -156,8 +165,28 @@ void G4VisManager::Initialise () {
// void G4VisManager::RegisterMessengers () - see separate file,
// G4VisManagerRegisterMessengers.cc.
void G4VisManager::Enable() {
if (IsValidView ()) {
G4cout << "G4VisManager::Enable: visualization enabled." << G4endl;
}
else {
G4cout <<
"G4VisManager::Enable: visualization remains disabled for above reasons."
"\n Rectifying with valid vis commands will automatically enable."
<< G4endl;
}
}
void G4VisManager::Disable() {
fpConcreteInstance = 0;
G4cout <<
"G4VisManager::Disable: visualization disabled."
"\n Note that it will become enabled after some valid vis commands."
<< G4endl;
}
const G4GraphicsSystemList& G4VisManager::GetAvailableGraphicsSystems () {
G4int nSystems = fAvailableGraphicsSystems.entries ();
G4int nSystems = fAvailableGraphicsSystems.size ();
if (nSystems == 0) {
G4cout << "G4VisManager::GetAvailableGraphicsSystems: WARNING: no graphics"
" system available!"
@@ -187,7 +216,7 @@ G4bool G4VisManager::RegisterGraphicsSystem (G4VGraphicsSystem* pSystem) {
return false;
}
else {
fAvailableGraphicsSystems.append (pSystem);
fAvailableGraphicsSystems.push_back (pSystem);
if (fVerbose > 0) {
G4cout << "G4VisManager::RegisterGraphicsSystem: "
<< pSystem -> GetName ();
@@ -438,7 +467,7 @@ void G4VisManager::CreateSceneHandler (G4String name) {
fpGraphicsSystem -> CreateSceneHandler (name);
G4VViewer* pViewer;
if (pSceneHandler) {
fAvailableSceneHandlers.append (pSceneHandler);
fAvailableSceneHandlers.push_back (pSceneHandler);
fpSceneHandler = pSceneHandler; // Make current.
}
else {
@@ -510,10 +539,10 @@ void G4VisManager::DeleteCurrentSceneHandler () {
delete fpSceneHandler;
}
const G4SceneHandlerList& sceneHandlerList = fAvailableSceneHandlers;
G4int nSH = sceneHandlerList.entries ();
G4int nSH = sceneHandlerList.size ();
G4int iSH;
for (iSH = 0; iSH < nSH; iSH++) {
if (sceneHandlerList [iSH] -> GetViewerList ().entries ()) break;
if (sceneHandlerList [iSH] -> GetViewerList ().size ()) break;
}
if (iSH < nSH) {
fpSceneHandler = sceneHandlerList [iSH];
@@ -556,7 +585,7 @@ void G4VisManager::DeleteCurrentViewer () {
delete fpViewer;
}
const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
if (viewerList.entries () > 0) {
if (viewerList.size () > 0) {
fpViewer = viewerList [0];
fpSceneHandler -> SetCurrentViewer (fpViewer);
if (IsValidView ()) {
@@ -592,34 +621,33 @@ void G4VisManager::GeometryHasChanged () {
// Check scenes.
G4SceneList& sceneList = fSceneList;
G4int iScene, nScenes = sceneList.entries ();
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
G4Scene* pScene = sceneList [iScene];
G4RWTPtrOrderedVector <G4VModel>& modelList =
pScene -> SetRunDurationModelList ();
G4std::vector<G4VModel*>& modelList = pScene -> SetRunDurationModelList ();
G4int nModels, iModel;
G4bool modelInvalid;
do { // Remove, if required, one at a time.
modelInvalid = false;
nModels = modelList.entries ();
for (iModel = 0; iModel < nModels; iModel++) {
if (modelInvalid = !(modelList [iModel] -> Validate ())) {
G4std::vector<G4VModel*>::iterator iterModel;
for (iterModel = modelList.begin();
iterModel != modelList.end();
++iterModel) {
if (modelInvalid = !((*iterModel) -> Validate ())) {
// Model invalid - remove and break.
G4cout << " Model \""
<< modelList [iModel] -> GetGlobalDescription ()
<< (*iterModel) -> GetGlobalDescription ()
<<
"\" is no longer valid - being removed\n from scene \""
<< pScene -> GetName () << "\""
<< G4endl;
modelList.removeAt (iModel);
modelList.erase (iterModel);
break;
}
}
} while (modelInvalid);
nModels = modelList.entries ();
if (nModels == 0) {
if (modelList.size () == 0) {
G4cout << " No models left in this scene \""
<< pScene -> GetName ()
<< "\"."
@@ -628,7 +656,7 @@ void G4VisManager::GeometryHasChanged () {
}
// Check the manager's current scene...
if (fpScene && fpScene -> GetRunDurationModelList ().entries () == 0) {
if (fpScene && fpScene -> GetRunDurationModelList ().size () == 0) {
G4cout << " The current scene \""
<< fpScene -> GetName ()
<< "\" has no models left."
@@ -645,7 +673,7 @@ void G4VisManager::SetCurrentGraphicsSystemAndCreateViewer
fpGraphicsSystem = pSystem;
if (!fpScene) {
fpScene = new G4Scene ("scene-vis~");
fSceneList.append (fpScene);
fSceneList.push_back (fpScene);
G4cout << "G4VisManager::SetCurrentGraphicsSystemAndCreateViewer:"
"\n Empty scene \"scene-vis~\" created."
<< G4endl;
@@ -663,7 +691,7 @@ void G4VisManager::SetCurrentGraphicsSystem (G4VGraphicsSystem* pSystem) {
// Or clear pointers.
if (!(fpSceneHandler && fpSceneHandler -> GetGraphicsSystem () == pSystem)) {
const G4SceneHandlerList& sceneHandlerList = fAvailableSceneHandlers;
G4int nSH = sceneHandlerList.entries (); // No. of scene handlers.
G4int nSH = sceneHandlerList.size (); // No. of scene handlers.
G4int iSH;
for (iSH = nSH - 1; iSH >= 0; iSH--) {
if (sceneHandlerList [iSH] -> GetGraphicsSystem () == pSystem) break;
@@ -673,7 +701,7 @@ void G4VisManager::SetCurrentGraphicsSystem (G4VGraphicsSystem* pSystem) {
G4cout << "\n Scene Handler now "
<< fpSceneHandler -> GetName ();
const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
if (viewerList.entries ()) {
if (viewerList.size ()) {
fpViewer = viewerList [0];
G4cout << "\n Viewer now " << fpViewer -> GetName ();
}
@@ -703,7 +731,7 @@ void G4VisManager::SetCurrentSceneHandler (G4VSceneHandler* pSceneHandler) {
<< fpGraphicsSystem -> GetName () << "\"";
}
const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
G4int nViewers = viewerList.entries ();
G4int nViewers = viewerList.size ();
if (nViewers) {
G4int iViewer;
for (iViewer = 0; iViewer < nViewers; iViewer++) {
@@ -737,7 +765,7 @@ void G4VisManager::SetCurrentViewer (G4VViewer* pViewer) {
void G4VisManager::PrintCurrentSystems () const {
if (fpGraphicsSystem && fpSceneHandler && fpViewer) {
G4int nSystems = fAvailableGraphicsSystems.entries ();
G4int nSystems = fAvailableGraphicsSystems.size ();
if (nSystems <= 0) {
G4cout << "No graphics systems available yet." << G4endl;
}
@@ -851,7 +879,7 @@ void G4VisManager::PrintInstalledGraphicsSystems () const {
}
void G4VisManager::PrintAvailableGraphicsSystems () const {
G4int nSystems = fAvailableGraphicsSystems.entries ();
G4int nSystems = fAvailableGraphicsSystems.size ();
G4cout << "Current available graphics systems are:";
if (nSystems) {
for (int i = 0; i < nSystems; i++) {
@@ -895,10 +923,10 @@ void G4VisManager::EndOfEvent () {
if (fpConcreteInstance && IsValidView ()) {
G4ModelingParameters* pMP =
fpSceneHandler -> CreateModelingParameters ();
const G4RWTPtrOrderedVector <G4VModel>& EOEModelList =
const G4std::vector<G4VModel*>& EOEModelList =
fpScene -> GetEndOfEventModelList ();
fpSceneHandler->ClearTransientStore(); //GB
for (int i = 0; i < EOEModelList.entries (); i++) {
for (int i = 0; i < EOEModelList.size (); i++) {
G4VModel* pModel = EOEModelList [i];
pModel -> SetModelingParameters (pMP);
pModel -> DescribeYourselfTo (*fpSceneHandler);
@@ -916,7 +944,7 @@ G4String G4VisManager::ViewerShortName (const G4String& viewerName) const {
G4VViewer* G4VisManager::GetViewer (const G4String& viewerName) const {
G4String viewerShortName = ViewerShortName (viewerName);
G4int nHandlers = fAvailableSceneHandlers.entries ();
G4int nHandlers = fAvailableSceneHandlers.size ();
G4int iHandler, iViewer;
G4VSceneHandler* sceneHandler;
G4VViewer* viewer;
@@ -924,7 +952,7 @@ G4VViewer* G4VisManager::GetViewer (const G4String& viewerName) const {
for (iHandler = 0; iHandler < nHandlers; iHandler++) {
sceneHandler = fAvailableSceneHandlers [iHandler];
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
for (iViewer = 0; iViewer < viewerList.entries (); iViewer++) {
for (iViewer = 0; iViewer < viewerList.size (); iViewer++) {
viewer = viewerList [iViewer];
if (viewerShortName == viewer -> GetShortName ()) {
found = true;
@@ -990,7 +1018,7 @@ G4bool G4VisManager::IsValidView () {
}
const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
if (viewerList.entries () == 0) {
if (viewerList.size () == 0) {
G4cout << "G4VisManager::IsValidView (): the current scene handler\n \""
<< fpSceneHandler -> GetName ()
<< "\" has no viewers. Do /vis/viewer/create."
@@ -1023,6 +1051,14 @@ G4bool G4VisManager::IsValidView () {
return isValid;
}
void G4VisManager::PrintCommandDeprecation(const G4String& message) {
G4cout <<
"**** DEPRECATED COMMAND ***"
"\n**** Will be discontinued as a \"/vis/\" command after Geant4 3.0."
"\n**** Will still be available as a \"/vis~/\" command for a while."
"\n**** " << message << G4endl;
}
// "No functionality" graphics systems to trap accidental attempt to
// use unbuilt systems.
@@ -5,14 +5,15 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisManagerRegisterMessengers.cc,v 1.21 2000/10/18 14:03:08 allison Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisManagerRegisterMessengers.cc,v 1.27 2001/02/23 15:43:32 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// G4VisManager::RegisterMessengers - John Allison 30/July/1998.
#include "G4VisManager.hh"
#include "G4VVisCommand.hh"
#include "G4VisCommands.hh"
#include "G4VisCommandsCompound.hh"
#include "G4VisCommandsScene.hh"
#include "G4VisCommandsSceneAdd.hh"
@@ -47,7 +48,7 @@ void G4VisManager::RegisterMessengers () {
(Extract for working note.)
* means "not implemented yet".
NI means "not implemented yet".
Introduction
@@ -97,7 +98,7 @@ The G4VisManager has a list of scenes.
default: current scene name
This scene becomes current.
* /vis/scene/edit
NI /vis/scene/edit
/vis/scene/remove <scene-name>
Current scene can change or become invalid.
@@ -106,16 +107,16 @@ The G4VisManager has a list of scenes.
default: all
Adds to current scene.
* /vis/scene/add/ghost [<particle>] [<physical-volume-name>]
* [<copy-no>] [<depth>]
NI /vis/scene/add/ghost [<particle>] [<physical-volume-name>]
NI [<copy-no>] [<depth>]
/vis/scene/add/logicalVolume <logical-volume-name> [<depth>]
default: 1
Adds to current scene.
Adds logical volume to current scene.
/vis/scene/add/volume [<physical-volume-name>] [<copy-no>] [<depth>]
default: world 0 -1
Adds to current scene.
Adds physical volume to current scene.
/vis/scene/add/hits [<sensitive-volume-name>]
default: (argument not impl'd yet.)
@@ -127,26 +128,26 @@ The G4VisManager has a list of scenes.
Causes trajectories, if any, to be drawn at the end of processiing an event.
Adds to current scene.
* /vis/scene/add/transientObjects
NI /vis/scene/add/transientObjects
Adds in current scene.
* /vis/scene/set/hitOption accumulate|byEvent
NI /vis/scene/set/hitOption accumulate|byEvent
Affects current scene.
* /vis/scene/set/notifyOption immediate|delayed
NI /vis/scene/set/notifyOption immediate|delayed
Affects current scene.
* /vis/scene/set/modelingStyle [<modeling-style>]
NI /vis/scene/set/modelingStyle [<modeling-style>]
Affects current scene.
/vis/scene/notifyHandlers
Refreshes all viewers of current scene.
Does not issue "update" (see /vis/viewer/update).
* /vis/scene/add/axes
NI /vis/scene/add/axes
Adds to current scene.
* /vis/scene/add/text
NI /vis/scene/add/text
Adds to current scene.
@@ -161,8 +162,9 @@ viewers.
The G4VisManager has a list of scene handlers.
/vis/sceneHandler/create <graphics-system-name> [<scene-handler-name>]
default: auto-generated name
/vis/sceneHandler/create [<graphics-system-name>] [<scene-handler-name>]
default: error auto-generated name
(The first default simply triggers a list of possibilities.)
This scene handler becomes current.
The current scene, if any, is attached.
@@ -181,11 +183,11 @@ The G4VisManager has a list of scene handlers.
/vis/sceneHandler/remove <scene-handler-name>
Current scene handler can change or become invalid.
* /vis/sceneHandler/processScene
NI /vis/sceneHandler/processScene
Refreshes all viewers of current scene handler.
Does not issue "update" (see /vis/viewer/update).
* /vis/sceneHandler/notifyEndOfProcessing
NI /vis/sceneHandler/notifyEndOfProcessing
Issues "update" for each viewer of current scene handler.
@@ -201,10 +203,10 @@ Most viewer commands respond to the viewer "short name", which is the
name up to the first space character, if any. Thus, a viewer name can
contain spaces but must be unique up to the first space.
* /vis/viewer/clear
/vis/viewer/clear
Affects current viewer.
* /vis/viewer/clone
NI /vis/viewer/clone
Creates a clone. Clone becomes current viewer.
/vis/viewer/create [<scene-handler>] [<viewer-name>] [<pixels>]
@@ -212,10 +214,37 @@ contain spaces but must be unique up to the first space.
Pixel size of square window (hint only).
This viewer becomes current.
/vis/viewer/dolly [<increment>] [<unit>]
default: current-value m
Moves the camera incrementally in by this distance.
Affects current viewer.
/vis/viewer/dollyTo [<distance>] [<unit>]
default: current-value m
Moves the camera in this distance relative to standard target point.
Affects current viewer.
/vis/viewer/lightsThetaPhi [<theta>] [<phi>] [deg|rad]
default: current as default.
/vis/viewer/lightsVector [<x>] [<y>] [<z>]
default: current as default.
Affects current viewer.
/vis/viewer/list [<viewer-name>] [<verbosity>]
default: all 0
Current viewer remains current.
/vis/viewer/pan [<right-increment>] [<up-increment>] [<unit>]
default: 0 0
Moves the camera incrementally right and up by these amounts.
Affects current viewer.
/vis/viewer/panTo [<right>] [<up>] [<unit>]
default: 0 0
Moves the camera to this position right and up relative to standard target
point.
Affects current viewer.
/vis/viewer/select <viewer-name>
default: no default
This viewer becomes current.
@@ -235,9 +264,27 @@ contain spaces but must be unique up to the first space.
Resets view parameters to defaults.
This viewer becomes current.
/vis/viewer/viewpointThetaPhi [<theta>] [<phi>] [deg|rad]
default: current as default.
/vis/viewer/viewpointVector [<x>] [<y>] [<z>]
default: current as default.
Set direction from target to camera. Also changes lightpoint direction if
lights are set to move with camera.
Affects current viewer.
/vis/viewer/set/zoom [<factor>]
default: 1
Multiplies magnification by this factor.
Affects current viewer.
/vis/viewer/set/zoomTo [<factor>]
default: 1
Magnifies by this factor relative to standard view.
Affects current viewer.
(Now follow some viewer/set commands. A possible syntax is:
* /vis/viewer/set <parameter-name> <parameter-value> [<parameter-value>]...
NI /vis/viewer/set <parameter-name> <parameter-value> [<parameter-value>]...
but this would mean re-inventing parameter parsing which is already
contained in many G4UIcommand subclasses. To re-use this code we have
@@ -247,7 +294,19 @@ to know the type of the parameter, so we need separate commands.)
Copies view parameters from from-viewer to current viewer.
Affects current viewer.
/vis/viewer/set/style w[ireframe]|s[urface]
/vis/viewer/set/autoRefresh [true|false]
default: false
View is automatically refreshed after a change of view parameters.
Affects current viewer.
/vis/viewer/set/culling
g[lobal]|c[overedDaughters]|i[nvisible]|d[ensity] [true|false]
[density] [unit]
default: none true 0.01 g/cm3
Affects current viewer.
NI /vis/viewer/set/cutawayPlane ...
Set plane(s) for cutaway views.
Affects current viewer.
/vis/viewer/set/edge [true|false]
@@ -258,109 +317,47 @@ to know the type of the parameter, so we need separate commands.)
default: true
Affects current viewer.
/vis/viewer/set/culling
g[lobal]|c[overedDaughters]|i[nvisible]|d[ensity] [true|false]
[density] [unit]
default: none true 0.01 g/cm3
Affects current viewer.
* /vis/viewer/set/hiddenMarker [true|false]
/vis/viewer/set/hiddenMarker [true|false]
default: true
Affects current viewer.
* /vis/viewer/set/sectionPlane ...
Set plane for drawing section (DCUT). Specify plane by x y z units nx ny nz,
e.g., for a y-z plane at x = 1 cm:
/vis/viewer/set/section_plane on 1 0 0 cm 1 0 0
/vis/viewer/set/lightsMove with-camera|with-object
Affects current viewer.
* /vis/viewer/set/cutawayPlane ...
Set plane(s) for cutaway views.
Affects current viewer.
* /vis/viewer/set/circleApproximationParameter [<number-of-sides-per-circle>]
*or* lineSegmentsPerCircle [<number-of-sides-per-circle>]
/vis/viewer/set/lineSegmentsPerCircle [<number-of-sides-per-circle>]
default: 24
Number of sides per circle in polygon/polyhedron graphical representation
of objects with curved lines/surfaces.
Affects current viewer.
* /vis/viewer/set/dolly [<increment>]
*or* /vis/viewer/dolly [<increment>]
default: 0
Moves the camera incrementally in by this distance.
/vis/viewer/set/projection
o[rthogonal]|p[erspective] [<field-half-angle>] [deg|rad]
default: none 30 deg
Affects current viewer.
* /vis/viewer/set/dollyTo [<distance>]
*or* /vis/viewer/dollyTo [<distance>]
default: 0
Moves the camera in this distance relative to standard target point.
Affects current viewer.
*special* /vis/viewer/set/orbit (parameters)
#specialNI /vis/viewer/set/orbit (parameters)
Orbits the scene about the up-vector, lights fixed to the scene. Draws N
frames, the camera rotated Delta-beta about the up-vector each frame.
Affects current viewer.
* /vis/viewer/set/pan [<x-increment>] [<y-increment>]
*or* /vis/viewer/pan [<x-increment>] [<y-increment>]
default: 0 0
Moves the camera incrementatly right and up by these amounts.
/vis/viewer/set/sectionPlane ...
Set plane for drawing section (DCUT). Specify plane by x y z units nx ny nz,
e.g., for a y-z plane at x = 1 cm:
/vis/viewer/set/section_plane on 1 0 0 cm 1 0 0
Affects current viewer.
* /vis/viewer/set/panTo [<x>] [<y>]
*or* /vis/viewer/panTo [<x>] [<y>]
default: 0 0
Moves the camera to this position right and up relative to standard target
point.
Affects current viewer.
* /vis/viewer/set/projection_style
o[rthogonal]|p[erspective] [<field-angle>] [deg|rad]
default: none 30 deg
*or* /vis/viewer/set/orthgonal
*or* /vis/viewer/set/perspective [<field-angle>] [deg|rad]
default: 30 deg
Affects current viewer.
*special* /vis/viewer/set/spin (parameters)
*or* /vis/viewer/advanced?
#specialNI /vis/viewer/set/spin (parameters)
#orNI /vis/viewer/advanced?
Spins the scene about the up-vector, lights fixed to the camera. Draws N
frames, the scene rotated Delta-beta about the up-vector each frame.
Affects current viewer.
* /vis/viewer/set/viewpoint <theta> <phi> [deg|rad]
default: 0 0 deg
*or* /vis/viewer/set/viewpointVector [<x>] [<y>] [<z>]
default: 0 0 1
Set direction from target to camera. Also changes lightpoint direction if
lights are set to move with camera.
/vis/viewer/set/style w[ireframe]|s[urface]
Affects current viewer.
* /vis/viewer/set/zoom [<factor>]
default: 1
Multiplies magnification by this factor.
Affects current viewer.
NI /vis/viewer/notifyOption immediate|delayed ?Issue of "update" after "set"?
* /vis/viewer/set/zoomTo [<factor>]
default: 1
Magnifies by this factor relative to standard view.
Affects current viewer.
* /vis/viewer/set/lights move-with-camera|move-with-object
*or* /vis/viewer/set/lightsMoveWithCamera ) ( Opposites, i.e., one
*or* /vis/viewer/set/lightsMoveWithObject ) ( negates the other.
Affects current viewer.
* /vis/viewer/set/lights <theta> <phi> [deg|rad]
default: 0 0 deg
* /vis/viewer/set/lightsVector [<x>] [<y>] [<z>]
default: 0 0 1
Affects current viewer.
* /vis/viewer/notifyOption immediate|delayed ?Issue of "update" after "set"?
* /vis/viewer/notifyHandler ??
NI /vis/viewer/notifyHandler ??
/vis/viewer/update [<viewer-name>]
default: current viewer name
@@ -373,17 +370,17 @@ Attributes (nothing implemented yet)
The G4VisManager also keeps a list of visualization attributes which can
be created and changed and attributed to visualizable objects.
* /vis/attributes/create [<vis-attributes-name>]
NI /vis/attributes/create [<vis-attributes-name>]
default: auto-generated name
These attributes become current.
* /vis/attributes/set/colour [<vis-attributes-name>] [<r>] [<g>] [<b>] [<o>]
* /vis/attributes/set/color [<vis-attributes-name>] [<r>] [<g>] [<b>] [<o>]
NI /vis/attributes/set/colour [<vis-attributes-name>] [<r>] [<g>] [<b>] [<o>]
NI /vis/attributes/set/color [<vis-attributes-name>] [<r>] [<g>] [<b>] [<o>]
default: current attributes name 1 1 1 1
Sets colour (red, green, blue, opacity).
Affects current vis attributes.
* /vis/scene/set/attributes <logical-volume-name>
NI /vis/scene/set/attributes <logical-volume-name>
Associates current vis attributes with logical volume. (Do we need to
provide possibility of resetting to original attributes?)
(Move to scene when implemented.)
@@ -392,34 +389,47 @@ be created and changed and attributed to visualizable objects.
General Commands
================
* /vis/verbose [<verbosity-integer>]
default: 0
* /vis/activate [true|false]
/vis/enable [true|false]
default: true
Activates/deactivates visualization system.
(Should this apply to user code only or all vis commands?)
/vis/disable
Enables/disables visualization system.
/vis/verbose [<verbosity-integer>]
default: 0
Compound Commands
=================
/vis/open <graphics-system-name> /vis/sceneHandler/create $1
/vis/viewer/create
/vis/open [<graphics-system-name>] [<[pixels>]
default: error 600
/vis/sceneHandler/create $1
/vis/viewer/create ! ! $2
* /vis/draw <physical-volume-name> but this clashes with old /vis~/draw/, so...
/vis/drawVolume <physical-volume-name> /vis/scene/create
Default: world /vis/scene/add/volume $1
/vis/sceneHandler/attach
/vis/viewer/refresh
/vis/viewer/update
NI /vis/draw <physical-volume-name> clashes with old /vis~/draw/, so...
/vis/drawVolume [<physical-volume-name>]
default: world
/vis/scene/create
/vis/scene/add/volume $1
/vis/sceneHandler/attach
/vis/viewer/refresh
/vis/specify <logical-volume-name> /vis/scene/create
/vis/scene/add/logicalVolume $1
/vis/sceneHandler/attach
/vis/viewer/refresh
/vis/viewer/update
/geometry/print $1
/vis/drawView [<theta-deg>] [<phi-deg>]
[<pan-right>] [<pan-up>] [<pan-unit>]
[<zoom-factor>]
[<dolly>] [<dolly-unit>]
default: 0 0 0 0 cm 1 0 cm
/vis/viewer/viewpointThetaPhi $1 $2 deg
/vis/viewer/panTo $3 $4 $5
/vis/viewer/zoomTo $6
/vis/viewer/dollyTo $7 $8
/vis/specify <logical-volume-name>
/geometry/print $1
/vis/scene/create
/vis/scene/add/logicalVolume $1
/vis/sceneHandler/attach
/vis/viewer/refresh
******************************************************************/
@@ -431,139 +441,148 @@ Default: world /vis/scene/add/volume $1
G4UIcommand* command;
command = new G4UIdirectory ("/vis/");
command -> SetGuidance ("Visualization commands.");
fMessengerList.push_back (new G4VisCommandEnable);
fMessengerList.push_back (new G4VisCommandVerbose);
command = new G4UIdirectory ("/vis/scene/");
command -> SetGuidance ("Operations on Geant4 scenes.");
fMessengerList.append (new G4VisCommandSceneCreate);
fMessengerList.append (new G4VisCommandSceneList);
fMessengerList.append (new G4VisCommandSceneNotifyHandlers);
fMessengerList.append (new G4VisCommandSceneSelect);
fMessengerList.append (new G4VisCommandSceneRemove);
fMessengerList.push_back (new G4VisCommandSceneCreate);
fMessengerList.push_back (new G4VisCommandSceneList);
fMessengerList.push_back (new G4VisCommandSceneNotifyHandlers);
fMessengerList.push_back (new G4VisCommandSceneSelect);
fMessengerList.push_back (new G4VisCommandSceneRemove);
command = new G4UIdirectory ("/vis/scene/add/");
command -> SetGuidance ("Add model to current scene.");
fMessengerList.append (new G4VisCommandSceneAddGhosts);
fMessengerList.append (new G4VisCommandSceneAddHits);
fMessengerList.append (new G4VisCommandSceneAddLogicalVolume);
fMessengerList.append (new G4VisCommandSceneAddTrajectories);
fMessengerList.append (new G4VisCommandSceneAddVolume);
fMessengerList.push_back (new G4VisCommandSceneAddGhosts);
fMessengerList.push_back (new G4VisCommandSceneAddHits);
fMessengerList.push_back (new G4VisCommandSceneAddLogicalVolume);
fMessengerList.push_back (new G4VisCommandSceneAddTrajectories);
fMessengerList.push_back (new G4VisCommandSceneAddVolume);
command = new G4UIdirectory ("/vis/scene/include/");
command -> SetGuidance ("Deprecated commands; now in /vis/scene/add/.");
fMessengerList.append (new G4VisCommandSceneIncludeHits);
fMessengerList.append (new G4VisCommandSceneIncludeTrajectories);
fMessengerList.push_back (new G4VisCommandSceneIncludeHits);
fMessengerList.push_back (new G4VisCommandSceneIncludeTrajectories);
command = new G4UIdirectory ("/vis/sceneHandler/");
command -> SetGuidance ("Operations on Geant4 scene handlers.");
fMessengerList.append (new G4VisCommandSceneHandlerAttach);
fMessengerList.append (new G4VisCommandSceneHandlerCreate);
fMessengerList.append (new G4VisCommandSceneHandlerList);
fMessengerList.append (new G4VisCommandSceneHandlerSelect);
fMessengerList.append (new G4VisCommandSceneHandlerRemove);
fMessengerList.push_back (new G4VisCommandSceneHandlerAttach);
fMessengerList.push_back (new G4VisCommandSceneHandlerCreate);
fMessengerList.push_back (new G4VisCommandSceneHandlerList);
fMessengerList.push_back (new G4VisCommandSceneHandlerSelect);
fMessengerList.push_back (new G4VisCommandSceneHandlerRemove);
command = new G4UIdirectory ("/vis/viewer/");
command -> SetGuidance ("Operations on Geant4 viewers.");
fMessengerList.append (new G4VisCommandViewerCreate);
fMessengerList.append (new G4VisCommandViewerList);
fMessengerList.append (new G4VisCommandViewerRefresh);
fMessengerList.append (new G4VisCommandViewerRemove);
fMessengerList.append (new G4VisCommandViewerReset);
fMessengerList.append (new G4VisCommandViewerSelect);
fMessengerList.append (new G4VisCommandViewerUpdate);
fMessengerList.push_back (new G4VisCommandViewerClear);
fMessengerList.push_back (new G4VisCommandViewerCreate);
fMessengerList.push_back (new G4VisCommandViewerDolly);
fMessengerList.push_back (new G4VisCommandViewerLights);
fMessengerList.push_back (new G4VisCommandViewerList);
fMessengerList.push_back (new G4VisCommandViewerPan);
fMessengerList.push_back (new G4VisCommandViewerRefresh);
fMessengerList.push_back (new G4VisCommandViewerRemove);
fMessengerList.push_back (new G4VisCommandViewerReset);
fMessengerList.push_back (new G4VisCommandViewerSelect);
fMessengerList.push_back (new G4VisCommandViewerUpdate);
fMessengerList.push_back (new G4VisCommandViewerViewpoint);
fMessengerList.push_back (new G4VisCommandViewerZoom);
command = new G4UIdirectory ("/vis/viewer/set/");
command -> SetGuidance ("Set view parameters of current viewer.");
fMessengerList.append (new G4VisCommandsViewerSet);
fMessengerList.push_back (new G4VisCommandsViewerSet);
// Compound commands...
fMessengerList.append (new G4VisCommandOpen);
fMessengerList.append (new G4VisCommandDrawVolume);
fMessengerList.append (new G4VisCommandSpecify);
fMessengerList.push_back (new G4VisCommandDrawVolume);
fMessengerList.push_back (new G4VisCommandDrawView);
fMessengerList.push_back (new G4VisCommandOpen);
fMessengerList.push_back (new G4VisCommandSpecify);
// Camera - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandCamera>);
fMessengerList.append
fMessengerList.push_back
(new G4VisSimpleCommandMessenger <G4VisCommandCameraReset>);
// Clear - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandClear>);
// fMessengerList.append
// fMessengerList.push_back
// (new G4VisSimpleCommandMessenger <G4VisCommandClearScene>);
fMessengerList.append
fMessengerList.push_back
(new G4VisSimpleCommandMessenger <G4VisCommandClearView>);
// fMessengerList.append
// fMessengerList.push_back
// (new G4VisSimpleCommandMessenger <G4VisCommandClearViewAndScene>);
// Copy - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandCopy>);
// fMessengerList.append
// fMessengerList.push_back
// (new G4VisSimpleCommandMessenger <G4VisCommandCopyAll>);
// fMessengerList.append
// fMessengerList.push_back
// (new G4VisSimpleCommandMessenger <G4VisCommandCopyScene>);
fMessengerList.append
fMessengerList.push_back
(new G4VisSimpleCommandMessenger <G4VisCommandCopyView>);
// Create Scene - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandCreateScene>);
fMessengerList.append
fMessengerList.push_back
(new G4VisSimpleCommandMessenger <G4VisCommandCreateSceneClear>);
// Create View - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandCreateView>);
fMessengerList.append
fMessengerList.push_back
(new G4VisSimpleCommandMessenger <G4VisCommandCreateViewNewScene>);
fMessengerList.append
fMessengerList.push_back
(new G4VisSimpleCommandMessenger <G4VisCommandCreateViewNewView>);
// Delete - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandDelete>);
fMessengerList.append
fMessengerList.push_back
(new G4VisSimpleCommandMessenger <G4VisCommandDeleteScene>);
fMessengerList.append
fMessengerList.push_back
(new G4VisSimpleCommandMessenger <G4VisCommandDeleteView>);
// Draw - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandDraw>);
fMessengerList.append
fMessengerList.push_back
(new G4VisSimpleCommandMessenger <G4VisCommandDrawCurrent>);
// Lights - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandLights>);
fMessengerList.append
fMessengerList.push_back
(new G4VisButtonCommandMessenger <G4VisCommandLightsMoveWithCamera>);
// Print - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandPrint>);
// Refresh - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandRefresh>);
fMessengerList.append
fMessengerList.push_back
(new G4VisSimpleCommandMessenger <G4VisCommandRefreshView>);
// Set - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandSet>);
fMessengerList.append
fMessengerList.push_back
(new G4VisButtonCommandMessenger <G4VisCommandSetCulling>);
fMessengerList.append
fMessengerList.push_back
(new G4VisButtonCommandMessenger <G4VisCommandSetCullCoveredDaughters>);
fMessengerList.append
fMessengerList.push_back
(new G4VisButtonCommandMessenger <G4VisCommandSetCullInvisible>);
// Show - OLD STYLE!!
fMessengerList.append
fMessengerList.push_back
(new G4VisCommandDirectoryMessenger <G4VisCommandShow>);
fMessengerList.append
fMessengerList.push_back
(new G4VisSimpleCommandMessenger <G4VisCommandShowView>);
}
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VisStateDependent.cc,v 1.2 1999/12/15 14:54:27 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
#include "G4VisStateDependent.hh"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VisToOldVisCommands.cc,v 1.4 1999/12/15 14:54:27 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4VisToOldVisCommands.cc,v 1.5 2001/02/05 02:34:45 johna Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Implements some /vis/ commands as /vis~/ temporarily.
@@ -41,6 +41,12 @@ G4VisToOldVisCommands::G4VisToOldVisCommands () {
// G4cout << "NewSubCommandPath: " << newCommandPath << G4endl;
G4UIcommand* newCommand = new G4UIcommand (newCommandPath, this);
newCommand -> SetRange (command -> GetRange ());
newCommand -> SetGuidance
("**** DEPRECATED COMMAND ****"
" Will be discontinued after Geant4 3.0.");
newCommand -> SetGuidance
("**** DEPRECATED COMMAND ****"
" Will still be available under /vis~/ for a while.");
G4int nGuidances = command -> GetGuidanceEntries ();
int k;
for (k = 0; k < nGuidances; k++) {