Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GraphicsSystemList.cc,v 1.4 2006-06-29 21:29:14 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
#include "G4GraphicsSystemList.hh"
+137 -47
View File
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Scene.cc,v 1.24 2009-11-04 12:49:16 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// Scene data John Allison 19th July 1996.
@@ -48,11 +47,11 @@ G4Scene::G4Scene (const G4String& name):
G4Scene::~G4Scene () {}
G4bool G4Scene::AddRunDurationModel (G4VModel* pModel, G4bool warn) {
std::vector<G4VModel*>::const_iterator i;
std::vector<Model>::const_iterator i;
for (i = fRunDurationModelList.begin ();
i != fRunDurationModelList.end (); ++i) {
if (pModel -> GetGlobalDescription () ==
(*i) -> GetGlobalDescription ()) break;
i->fpModel->GetGlobalDescription ()) break;
}
if (i != fRunDurationModelList.end ()) {
if (warn) {
@@ -65,24 +64,91 @@ G4bool G4Scene::AddRunDurationModel (G4VModel* pModel, G4bool warn) {
}
return false;
}
fRunDurationModelList.push_back (pModel);
fRunDurationModelList.push_back (Model(pModel));
CalculateExtent ();
return true;
}
void G4Scene::CalculateExtent () {
G4int nModels = fRunDurationModelList.size ();
void G4Scene::CalculateExtent ()
{
G4BoundingSphereScene boundingSphereScene;
for (G4int i = 0; i < nModels; i++) {
const G4VisExtent& thisExtent =
fRunDurationModelList[i] -> GetExtent ();
G4Point3D thisCentre = thisExtent.GetExtentCentre ();
G4double thisRadius = thisExtent.GetExtentRadius ();
thisCentre.transform (fRunDurationModelList[i] -> GetTransformation ());
boundingSphereScene.AccrueBoundingSphere (thisCentre, thisRadius);
for (size_t i = 0; i < fRunDurationModelList.size(); i++) {
if (fRunDurationModelList[i].fActive) {
G4VModel* model = fRunDurationModelList[i].fpModel;
if (model -> Validate()) { // Validates and also recomputes extent.
const G4VisExtent& thisExtent = model -> GetExtent ();
G4double thisRadius = thisExtent.GetExtentRadius ();
if (thisRadius > 0.) {
G4Point3D thisCentre = thisExtent.GetExtentCentre ();
thisCentre.transform (model -> GetTransformation ());
boundingSphereScene.AccrueBoundingSphere (thisCentre, thisRadius);
}
} else {
G4ExceptionDescription ed;
ed << "Invalid model \"" << model->GetGlobalDescription()
<< "\".\n Not included in extent calculation.";
G4Exception
("G4Scene::CalculateExtent",
"visman0201", JustWarning, ed);
}
}
}
for (size_t i = 0; i < fEndOfEventModelList.size(); i++) {
if (fEndOfEventModelList[i].fActive) {
G4VModel* model = fEndOfEventModelList[i].fpModel;
if (model -> Validate()) { // Validates and also recomputes extent.
const G4VisExtent& thisExtent = model -> GetExtent ();
G4double thisRadius = thisExtent.GetExtentRadius ();
if (thisRadius > 0.) {
G4Point3D thisCentre = thisExtent.GetExtentCentre ();
thisCentre.transform (model -> GetTransformation ());
boundingSphereScene.AccrueBoundingSphere (thisCentre, thisRadius);
}
} else {
G4ExceptionDescription ed;
ed << "Invalid model \"" << model->GetGlobalDescription()
<< "\".\n Not included in extent calculation.";
G4Exception
("G4Scene::CalculateExtent",
"visman0201", JustWarning, ed);
}
}
}
for (size_t i = 0; i < fEndOfRunModelList.size(); i++) {
if (fEndOfRunModelList[i].fActive) {
G4VModel* model = fEndOfRunModelList[i].fpModel;
if (model -> Validate()) { // Validates and also recomputes extent.
const G4VisExtent& thisExtent = model -> GetExtent ();
G4double thisRadius = thisExtent.GetExtentRadius ();
if (thisRadius > 0.) {
G4Point3D thisCentre = thisExtent.GetExtentCentre ();
thisCentre.transform (model -> GetTransformation ());
boundingSphereScene.AccrueBoundingSphere (thisCentre, thisRadius);
}
} else {
G4ExceptionDescription ed;
ed << "Invalid model \"" << model->GetGlobalDescription()
<< "\".\n Not included in extent calculation.";
G4Exception
("G4Scene::CalculateExtent",
"visman0201", JustWarning, ed);
}
}
}
fExtent = boundingSphereScene.GetBoundingSphereExtent ();
fStandardTargetPoint = fExtent.GetExtentCentre ();
if (fExtent.GetExtentRadius() <= 0.) {
G4Exception
("G4Scene::CalculateExtent",
"visman0202", JustWarning,
"Scene has no extent. Please activate or add something."
"\nThe camera needs to have something to point at!"
"\n\"/vis/scene/list\" to see list of models.");
}
}
G4bool G4Scene::AddWorldIfEmpty (G4bool warn) {
@@ -125,22 +191,19 @@ G4bool G4Scene::AddEndOfEventModel (G4VModel* pModel, G4bool warn) {
G4int i, nModels = fEndOfEventModelList.size ();
for (i = 0; i < nModels; i++) {
if (pModel -> GetGlobalDescription () ==
fEndOfEventModelList [i] -> GetGlobalDescription ()) break;
fEndOfEventModelList[i].fpModel -> GetGlobalDescription ()) break;
}
if (i < nModels) {
delete fEndOfEventModelList[i];
fEndOfEventModelList[i] = pModel;
if (warn) {
G4cout << "G4Scene::AddEndOfEventModel: a model \""
<< pModel -> GetGlobalDescription ()
<< "\"\n is already in the end-of-event list of scene \""
<< fName <<
"\".\n The old model has been deleted; this new model replaces it."
<< fName << "\"."
<< G4endl;
}
return true; // Model replaced sucessfully.
return false;
}
fEndOfEventModelList.push_back (pModel);
fEndOfEventModelList.push_back (Model(pModel));
return true;
}
@@ -148,82 +211,109 @@ G4bool G4Scene::AddEndOfRunModel (G4VModel* pModel, G4bool warn) {
G4int i, nModels = fEndOfRunModelList.size ();
for (i = 0; i < nModels; i++) {
if (pModel -> GetGlobalDescription () ==
fEndOfRunModelList [i] -> GetGlobalDescription ()) break;
fEndOfRunModelList[i].fpModel -> GetGlobalDescription ()) break;
}
if (i < nModels) {
delete fEndOfRunModelList[i];
fEndOfRunModelList[i] = pModel;
if (warn) {
G4cout << "G4Scene::AddEndOfRunModel: a model \""
<< pModel -> GetGlobalDescription ()
<< "\"\n is already in the end-of-run list of scene \""
<< fName <<
"\".\n The old model has been deleted; this new model replaces it."
<< fName << "\"."
<< G4endl;
}
return true; // Model replaced sucessfully.
return false;
}
fEndOfRunModelList.push_back (pModel);
return true;
}
std::ostream& operator << (std::ostream& os, const G4Scene& s) {
std::ostream& operator << (std::ostream& os, const G4Scene& scene) {
size_t i;
os << "Scene data:";
os << "\n Run-duration model list:";
for (i = 0; i < s.fRunDurationModelList.size (); i++) {
os << "\n " << *(s.fRunDurationModelList[i]);
for (i = 0; i < scene.fRunDurationModelList.size (); i++) {
if (scene.fRunDurationModelList[i].fActive) os << "\n Active: ";
else os << "\n Inactive: ";
os << *(scene.fRunDurationModelList[i].fpModel);
}
os << "\n End-of-event model list:";
for (i = 0; i < s.fEndOfEventModelList.size (); i++) {
os << "\n " << *(s.fEndOfEventModelList[i]);
for (i = 0; i < scene.fEndOfEventModelList.size (); i++) {
if (scene.fEndOfEventModelList[i].fActive) os << "\n Active: ";
else os << "\n Inactive: ";
os << *(scene.fEndOfEventModelList[i].fpModel);
}
os << "\n End-of-run model list:";
for (i = 0; i < s.fEndOfRunModelList.size (); i++) {
os << "\n " << *(s.fEndOfRunModelList[i]);
for (i = 0; i < scene.fEndOfRunModelList.size (); i++) {
if (scene.fEndOfRunModelList[i].fActive) os << "\n Active: ";
else os << "\n Inactive: ";
os << *(scene.fEndOfRunModelList[i].fpModel);
}
os << "\n Extent or bounding box: " << s.fExtent;
os << "\n Extent or bounding box: " << scene.fExtent;
os << "\n Standard target point: " << s.fStandardTargetPoint;
os << "\n Standard target point: " << scene.fStandardTargetPoint;
os << "\n End of event action set to \"";
if (s.fRefreshAtEndOfEvent) os << "refresh\"";
if (scene.fRefreshAtEndOfEvent) os << "refresh\"";
else {
os << "accumulate (maximum number of kept events: ";
if (s.fMaxNumberOfKeptEvents >= 0) os << s.fMaxNumberOfKeptEvents;
if (scene.fMaxNumberOfKeptEvents >= 0) os << scene.fMaxNumberOfKeptEvents;
else os << "unlimited";
os << ")";
}
os << "\n End of run action set to \"";
if (s.fRefreshAtEndOfRun) os << "refresh";
if (scene.fRefreshAtEndOfRun) os << "refresh";
else os << "accumulate";
os << "\"";
return os;
}
G4bool G4Scene::operator != (const G4Scene& s) const {
G4bool G4Scene::operator != (const G4Scene& scene) const {
if (
(fRunDurationModelList.size () !=
s.fRunDurationModelList.size ()) ||
(fExtent != s.fExtent) ||
!(fStandardTargetPoint == s.fStandardTargetPoint) ||
fRefreshAtEndOfEvent != s.fRefreshAtEndOfEvent ||
fRefreshAtEndOfRun != s.fRefreshAtEndOfRun ||
fMaxNumberOfKeptEvents != s.fMaxNumberOfKeptEvents
scene.fRunDurationModelList.size ()) ||
(fEndOfEventModelList.size () !=
scene.fEndOfEventModelList.size ()) ||
(fEndOfRunModelList.size () !=
scene.fEndOfRunModelList.size ()) ||
(fExtent != scene.fExtent) ||
!(fStandardTargetPoint == scene.fStandardTargetPoint) ||
fRefreshAtEndOfEvent != scene.fRefreshAtEndOfEvent ||
fRefreshAtEndOfRun != scene.fRefreshAtEndOfRun ||
fMaxNumberOfKeptEvents != scene.fMaxNumberOfKeptEvents
) return true;
/* A complete comparison should, perhaps, include a comparison of
individual models, but it is not easy to implement operator!= for
all models. Also, it would be unfeasible to ask users to
implement opeerator!= if we ever get round to allowing
user-defined models. Moreover, there is no editing of G4Scene
objects, apart from changing fRefreshAtEndOfEvent, etc; as far as
models are concerned, all you can ever do is add them, so a test
on size (above) is enough.
for (size_t i = 0; i < fRunDurationModelList.size (); i++) {
if (fRunDurationModelList[i] != s.fRunDurationModelList[i])
if (fRunDurationModelList[i] != scene.fRunDurationModelList[i])
return true;
}
for (size_t i = 0; i < fEndOfEventModelList.size (); i++) {
if (fEndOfEventModelList[i] != scene.fEndOfEventModelList[i])
return true;
}
for (size_t i = 0; i < fEndOfRunModelList.size (); i++) {
if (fEndOfRunModelList[i] != scene.fEndOfRunModelList[i])
return true;
}
*/
return false;
}
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4SceneHandlerList.cc,v 1.4 2006-06-29 21:29:18 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
#include "G4SceneHandlerList.hh"
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4SceneList.cc,v 1.6 2006-06-29 21:29:20 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
#include "G4SceneList.hh"
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VGraphicsSystem.cc,v 1.11 2006-06-29 21:29:22 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 27th March 1996
@@ -61,6 +60,11 @@ G4VGraphicsSystem::G4VGraphicsSystem (const G4String& name,
fDescription (description),
fFunctionality (f) {}
G4bool G4VGraphicsSystem::IsUISessionCompatible () const
{
return true;
}
std::ostream& operator << (std::ostream& os, const G4VGraphicsSystem& gs) {
G4VisManager* pVMan = G4VisManager::GetInstance ();
const G4SceneHandlerList& scenes = pVMan -> GetAvailableSceneHandlers ();
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VSceneHandler.cc,v 1.96 2010-11-05 16:00:11 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 19th July 1996
@@ -84,6 +83,7 @@
#include "G4Transform3D.hh"
#include "G4AttHolder.hh"
#include "G4AttDef.hh"
#include "G4PhysicalConstants.hh"
G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4String& name):
fSystem (system),
@@ -97,10 +97,8 @@ G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4S
// G4VisManager.cc).
fReadyForTransients (true), // Only false while processing scene.
fProcessingSolid (false),
fSecondPassRequested (false),
fSecondPass (false),
fProcessing2D (false),
fpModel (0),
fpObjectTransformation (0),
fNestingDepth (0),
fpVisAttribs (0)
{
@@ -128,14 +126,13 @@ G4VSceneHandler::~G4VSceneHandler () {
}
void G4VSceneHandler::PreAddSolid (const G4Transform3D& objectTransformation,
const G4VisAttributes& visAttribs) {
fpObjectTransformation = &objectTransformation;
const G4VisAttributes& visAttribs) {
fObjectTransformation = objectTransformation;
fpVisAttribs = &visAttribs;
fProcessingSolid = true;
}
void G4VSceneHandler::PostAddSolid () {
fpObjectTransformation = 0;
fpVisAttribs = 0;
fProcessingSolid = false;
if (fReadyForTransients) {
@@ -146,21 +143,22 @@ void G4VSceneHandler::PostAddSolid () {
void G4VSceneHandler::BeginPrimitives
(const G4Transform3D& objectTransformation) {
//static G4int count = 0;
//G4cout << "G4VSceneHandler::BeginPrimitives: " << count++ << G4endl;
fNestingDepth++;
if (fNestingDepth > 1)
G4Exception
("G4VSceneHandler::BeginPrimitives",
"visman0003", FatalException,
"visman0101", FatalException,
"Nesting detected. It is illegal to nest Begin/EndPrimitives.");
fpObjectTransformation = &objectTransformation;
fObjectTransformation = objectTransformation;
}
void G4VSceneHandler::EndPrimitives () {
if (fNestingDepth <= 0)
G4Exception("G4VSceneHandler::EndPrimitives",
"visman0004", FatalException, "Nesting error.");
"visman0102", FatalException, "Nesting error.");
fNestingDepth--;
fpObjectTransformation = 0;
if (fReadyForTransients) {
fTransientsDrawnThisEvent = true;
fTransientsDrawnThisRun = true;
@@ -173,21 +171,22 @@ void G4VSceneHandler::BeginPrimitives2D
if (fNestingDepth > 1)
G4Exception
("G4VSceneHandler::BeginPrimitives2D",
"visman0005", FatalException,
"visman0103", FatalException,
"Nesting detected. It is illegal to nest Begin/EndPrimitives.");
fpObjectTransformation = &objectTransformation;
fObjectTransformation = objectTransformation;
fProcessing2D = true;
}
void G4VSceneHandler::EndPrimitives2D () {
if (fNestingDepth <= 0)
G4Exception("G4VSceneHandler::EndPrimitives2D",
"visman0006", FatalException, "Nesting error.");
"visman0104", FatalException, "Nesting error.");
fNestingDepth--;
fpObjectTransformation = 0;
if (fReadyForTransients) {
fTransientsDrawnThisEvent = true;
fTransientsDrawnThisRun = true;
}
fProcessing2D = false;
}
void G4VSceneHandler::BeginModeling () {
@@ -198,16 +197,9 @@ void G4VSceneHandler::EndModeling ()
fpModel = 0;
}
void G4VSceneHandler::ClearStore () {
// if (fpViewer) fpViewer -> NeedKernelVisit (true);
// ?? Viewer is supposed to be smart enough to know when to visit
// kernel, but a problem in OpenGL Stored seems to require a forced
// kernel visit triggered by the above code. John Allison Aug 2001
// Feb 2005 - commented out. Let's fix OpenGL if necessary.
}
void G4VSceneHandler::ClearStore () {}
void G4VSceneHandler::ClearTransientStore () {
}
void G4VSceneHandler::ClearTransientStore () {}
void G4VSceneHandler::AddSolid (const G4Box& box) {
RequestPrimitives (box);
@@ -269,7 +261,7 @@ void G4VSceneHandler::AddCompound (const G4VTrajectory& traj) {
dynamic_cast<G4TrajectoriesModel*>(fpModel);
if (!trajectoriesModel) G4Exception
("G4VSceneHandler::AddCompound(const G4VTrajectory&)",
"visman0007", FatalException, "Not a G4TrajectoriesModel.");
"visman0105", FatalException, "Not a G4TrajectoriesModel.");
else {
if (trajectoriesModel->IsDrawingModeSet()) {
traj.DrawTrajectory(trajectoriesModel->GetDrawingMode());
@@ -295,8 +287,8 @@ void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) {
G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManagerIfExist();
if (scoringManager) {
size_t nMeshes = scoringManager->GetNumberOfMesh();
for (size_t i = 0; i < nMeshes; ++i) {
G4VScoringMesh* mesh = scoringManager->GetMesh(i);
for (size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
G4VScoringMesh* mesh = scoringManager->GetMesh(iMesh);
if (mesh && mesh->IsActive()) {
MeshScoreMap scoreMap = mesh->GetScoreMap();
for(MeshScoreMap::const_iterator i = scoreMap.begin();
@@ -486,13 +478,22 @@ void G4VSceneHandler::SetScene (G4Scene* pScene) {
}
void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
BeginPrimitives (*fpObjectTransformation);
BeginPrimitives (fObjectTransformation);
G4NURBS* pNURBS = 0;
G4Polyhedron* pPolyhedron = 0;
switch (fpViewer -> GetViewParameters () . GetRepStyle ()) {
case G4ViewParameters::nurbs:
pNURBS = solid.CreateNURBS ();
if (pNURBS) {
static G4bool warned = false;
if (!warned) {
warned = true;
G4cout <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
"!!!!! NURBS are deprecated and will be removed in the next major release."
"\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
<< G4endl;
}
pNURBS -> SetVisAttributes (fpVisAttribs);
AddPrimitive (*pNURBS);
delete pNURBS;
@@ -533,7 +534,10 @@ void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
EndPrimitives ();
}
void G4VSceneHandler::ProcessScene (G4VViewer&) {
void G4VSceneHandler::ProcessScene () {
// Assumes graphics database store has already been cleared if
// relevant for the particular scene handler.
if (!fpScene) return;
@@ -545,11 +549,7 @@ void G4VSceneHandler::ProcessScene (G4VViewer&) {
fReadyForTransients = false;
// Clear stored scene, if any, i.e., display lists, scene graphs.
ClearStore ();
// Reset fMarkForClearingTransientStore. No need to clear transient
// store since it has just been cleared above. (Leaving
// Reset fMarkForClearingTransientStore. (Leaving
// fMarkForClearingTransientStore true causes problems with
// recomputing transients below.) Restore it again at end...
G4bool tmpMarkForClearingTransientStore = fMarkForClearingTransientStore;
@@ -557,7 +557,7 @@ void G4VSceneHandler::ProcessScene (G4VViewer&) {
// Traverse geometry tree and send drawing primitives to window(s).
const std::vector<G4VModel*>& runDurationModelList =
const std::vector<G4Scene::Model>& runDurationModelList =
fpScene -> GetRunDurationModelList ();
if (runDurationModelList.size ()) {
@@ -571,38 +571,23 @@ void G4VSceneHandler::ProcessScene (G4VViewer&) {
G4ModelingParameters* pMP = CreateModelingParameters ();
for (size_t i = 0; i < runDurationModelList.size (); i++) {
G4VModel* pModel = runDurationModelList[i];
// Note: this is not the place to take action on
// pModel->GetTransformation(). The model must take care of
// this in pModel->DescribeYourselfTo(*this). See, for example,
// G4PhysicalVolumeModel and /vis/scene/add/logo.
pModel -> SetModelingParameters (pMP);
SetModel (pModel); // Store for use by derived class.
pModel -> DescribeYourselfTo (*this);
pModel -> SetModelingParameters (0);
}
// Repeat if required...
if (fSecondPassRequested) {
fSecondPass = true;
for (size_t i = 0; i < runDurationModelList.size (); i++) {
G4VModel* pModel = runDurationModelList[i];
if (runDurationModelList[i].fActive) {
G4VModel* pModel = runDurationModelList[i].fpModel;
// Note: this is not the place to take action on
// pModel->GetTransformation(). The model must take care of
// this in pModel->DescribeYourselfTo(*this). See, for example,
// G4PhysicalVolumeModel and /vis/scene/add/logo.
pModel -> SetModelingParameters (pMP);
SetModel (pModel); // Store for use by derived class.
pModel -> DescribeYourselfTo (*this);
pModel -> SetModelingParameters (0);
}
fSecondPass = false;
fSecondPassRequested = false;
}
delete pMP;
EndModeling ();
}
fpViewer->FinishView(); // Flush streams and/or swap buffers.
fReadyForTransients = true;
// Refresh event from end-of-event model list.
@@ -672,18 +657,20 @@ void G4VSceneHandler::ProcessScene (G4VViewer&) {
void G4VSceneHandler::DrawEvent(const G4Event* event)
{
const std::vector<G4VModel*>& EOEModelList =
const std::vector<G4Scene::Model>& EOEModelList =
fpScene -> GetEndOfEventModelList ();
size_t nModels = EOEModelList.size();
if (nModels) {
G4ModelingParameters* pMP = CreateModelingParameters();
pMP->SetEvent(event);
for (size_t i = 0; i < nModels; i++) {
G4VModel* pModel = EOEModelList [i];
pModel -> SetModelingParameters(pMP);
SetModel (pModel);
pModel -> DescribeYourselfTo (*this);
pModel -> SetModelingParameters(0);
if (EOEModelList[i].fActive) {
G4VModel* pModel = EOEModelList[i].fpModel;
pModel -> SetModelingParameters(pMP);
SetModel (pModel);
pModel -> DescribeYourselfTo (*this);
pModel -> SetModelingParameters(0);
}
}
delete pMP;
SetModel (0);
@@ -692,18 +679,20 @@ void G4VSceneHandler::DrawEvent(const G4Event* event)
void G4VSceneHandler::DrawEndOfRunModels()
{
const std::vector<G4VModel*>& EORModelList =
const std::vector<G4Scene::Model>& EORModelList =
fpScene -> GetEndOfRunModelList ();
size_t nModels = EORModelList.size();
if (nModels) {
G4ModelingParameters* pMP = CreateModelingParameters();
pMP->SetEvent(0);
for (size_t i = 0; i < nModels; i++) {
G4VModel* pModel = EORModelList [i];
pModel -> SetModelingParameters(pMP);
SetModel (pModel);
pModel -> DescribeYourselfTo (*this);
pModel -> SetModelingParameters(0);
if (EORModelList[i].fActive) {
G4VModel* pModel = EORModelList[i].fpModel;
pModel -> SetModelingParameters(pMP);
SetModel (pModel);
pModel -> DescribeYourselfTo (*this);
pModel -> SetModelingParameters(0);
}
}
delete pMP;
SetModel (0);
@@ -761,6 +750,8 @@ G4ModelingParameters* G4VSceneHandler::CreateModelingParameters ()
pModelingParams->SetSectionSolid(CreateSectionSolid());
pModelingParams->SetCutawaySolid(CreateCutawaySolid());
// The polyhedron objects are deleted in the modeling parameters destructor.
pModelingParams->SetVisAttributesModifiers(vp.GetVisAttributesModifiers());
return pModelingParams;
}
@@ -774,11 +765,11 @@ G4VSolid* G4VSceneHandler::CreateSectionSolid()
G4double safe = radius + fpScene->GetExtent().GetExtentCentre().mag();
G4VSolid* sectionBox =
new G4Box("_sectioner", safe, safe, 1.e-5 * radius); // Thin in z-plane.
const G4Plane3D& s = vp.GetSectionPlane ();
G4double a = s.a();
G4double b = s.b();
G4double c = s.c();
G4double d = s.d();
const G4Plane3D& sp = vp.GetSectionPlane ();
G4double a = sp.a();
G4double b = sp.b();
G4double c = sp.c();
G4double d = sp.d();
G4Transform3D transform = G4TranslateZ3D(-d);
const G4Normal3D normal(a,b,c);
if (normal != G4Normal3D(0,0,1)) {
@@ -813,26 +804,31 @@ void G4VSceneHandler::LoadAtts(const G4Visible& visible, G4AttHolder* holder)
dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
if (pPVModel) {
// Load G4Atts from G4PhysicalVolumeModel...
const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
if (defs) {
holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
const std::map<G4String,G4AttDef>* pvDefs = pPVModel->GetAttDefs();
if (pvDefs) {
holder->AddAtts(pPVModel->CreateCurrentAttValues(), pvDefs);
}
}
G4TrajectoriesModel* trajModel = dynamic_cast<G4TrajectoriesModel*>(fpModel);
if (trajModel) {
// Load G4Atts from trajectory model...
const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->GetAttDefs();
if (trajModelDefs) {
holder->AddAtts(trajModel->CreateCurrentAttValues(), trajModelDefs);
}
// Load G4Atts from trajectory...
const G4VTrajectory* traj = trajModel->GetCurrentTrajectory();
const std::map<G4String,G4AttDef>* defs = traj->GetAttDefs();
if (defs) {
holder->AddAtts(traj->CreateAttValues(), defs);
const std::map<G4String,G4AttDef>* trajDefs = traj->GetAttDefs();
if (trajDefs) {
holder->AddAtts(traj->CreateAttValues(), trajDefs);
}
G4int nPoints = traj->GetPointEntries();
for (G4int i = 0; i < nPoints; ++i) {
G4VTrajectoryPoint* trajPoint = traj->GetPoint(i);
const std::map<G4String,G4AttDef>* defs = trajPoint->GetAttDefs();
if (defs) {
holder->AddAtts(trajPoint->CreateAttValues(), defs);
const std::map<G4String,G4AttDef>* pointDefs = trajPoint->GetAttDefs();
if (pointDefs) {
holder->AddAtts(trajPoint->CreateAttValues(), pointDefs);
}
}
}
@@ -841,9 +837,9 @@ void G4VSceneHandler::LoadAtts(const G4Visible& visible, G4AttHolder* holder)
if (hitsModel) {
// Load G4Atts from hit...
const G4VHit* hit = hitsModel->GetCurrentHit();
const std::map<G4String,G4AttDef>* defs = hit->GetAttDefs();
if (defs) {
holder->AddAtts(hit->CreateAttValues(), defs);
const std::map<G4String,G4AttDef>* hitsDefs = hit->GetAttDefs();
if (hitsDefs) {
holder->AddAtts(hit->CreateAttValues(), hitsDefs);
}
}
}
@@ -938,9 +934,8 @@ G4double G4VSceneHandler::GetMarkerSize
// Draw in screen coordinates.
markerSizeType = screen;
}
if (size <= 1.) size = 1.;
size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
if (size <= 1.) size = 1.;
if (markerSizeType == screen && size < 1.) size = 1.;
return size;
}
@@ -965,16 +960,16 @@ G4int G4VSceneHandler::GetNoOfSides(const G4VisAttributes* pVisAttribs)
return lineSegmentsPerCircle;
}
std::ostream& operator << (std::ostream& os, const G4VSceneHandler& s) {
std::ostream& operator << (std::ostream& os, const G4VSceneHandler& sh) {
os << "Scene handler " << s.fName << " has "
<< s.fViewerList.size () << " viewer(s):";
for (size_t i = 0; i < s.fViewerList.size (); i++) {
os << "\n " << *(s.fViewerList [i]);
os << "Scene handler " << sh.fName << " has "
<< sh.fViewerList.size () << " viewer(s):";
for (size_t i = 0; i < sh.fViewerList.size (); i++) {
os << "\n " << *(sh.fViewerList [i]);
}
if (s.fpScene) {
os << "\n " << *s.fpScene;
if (sh.fpScene) {
os << "\n " << *sh.fpScene;
}
else {
os << "\n This scene handler currently has no scene.";
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VViewer.cc,v 1.26 2009-11-17 14:37:06 lgarnier Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 27th March 1996
@@ -115,16 +114,16 @@ void G4VViewer::ShowView () {}
void G4VViewer::ProcessView ()
{
// If ClearStore has been requested, e.g., if the scene has changed,
// or if the concrete viewer has decided that it necessary to visit
// the kernel, perhaps because the view parameters have changed
// significantly (this should be done in the concrete viewer's
// DrawView)...
// If the scene has changed, or if the concrete viewer has decided
// that it necessary to visit the kernel, perhaps because the view
// parameters have changed significantly (this should be done in the
// concrete viewer's DrawView)...
if (fNeedKernelVisit) {
// Reset flag. This must be done before ProcessScene to prevent
// recursive calls when recomputing transients...
fNeedKernelVisit = false;
fSceneHandler.ProcessScene (*this);
fSceneHandler.ClearStore ();
fSceneHandler.ProcessScene ();
}
}
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VVisCommand.cc,v 1.18 2006-06-29 21:29:28 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
@@ -37,6 +36,17 @@
#include "G4UnitsTable.hh"
#include <sstream>
G4Colour G4VVisCommand::fCurrentColour = G4Colour::White();
G4Colour G4VVisCommand::fCurrentTextColour = G4Colour::Blue();
G4Text::Layout G4VVisCommand::fCurrentTextLayout = G4Text::left;
G4double G4VVisCommand::fCurrentLineWidth = 1.;
// Not yet used: G4VisAttributes::LineStyle G4VVisCommand::fCurrentLineStyle = G4VisAttributes::unbroken;
// Not yet used: G4VMarker::FillStyle G4VVisCommand::fCurrentFillStyle = G4VMarker::filled;
// Not yet used: G4VMarker::SizeType G4VVisCommand::fCurrentSizeType = G4VMarker::screen;
G4ModelingParameters::PVNameCopyNoPath G4VVisCommand::fCurrentTouchablePath;
G4VVisCommand::G4VVisCommand () {}
G4VVisCommand::~G4VVisCommand () {}
G4VisManager* G4VVisCommand::fpVisManager = 0;
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ViewParameters.cc,v 1.38 2010-11-05 16:00:11 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 19th July 1996
@@ -37,18 +36,10 @@
#include "G4VisManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
G4ViewParameters::G4ViewParameters ():
fNoValue(0x0000),
fXValue(0x0001),
fYValue(0x0002),
fWidthValue(0x0004),
fHeightValue(0x0008),
fAllValues(0x000F),
fXNegative(0x0010),
fYNegative(0x0020),
fGeometryMask(0),
fDrawingStyle (wireframe),
fAuxEdgeVisible (false),
fRepStyle (polyhedron),
@@ -85,6 +76,7 @@ G4ViewParameters::G4ViewParameters ():
fWindowLocationHintY(0),
fWindowLocationHintXNegative(true),
fWindowLocationHintYNegative(false),
fGeometryMask(0),
fAutoRefresh (false),
fBackgroundColour (G4Colour(0.,0.,0.)), // Black
fPicking (false),
@@ -257,6 +249,330 @@ void G4ViewParameters::IncrementPan (G4double right, G4double up, G4double dista
fCurrentTargetPoint += right * unitRight + up * unitUp + distance * fViewpointDirection;
}
G4String G4ViewParameters::CameraAndLightingCommands
(const G4Point3D standardTargetPoint) const
{
std::ostringstream oss;
oss << "#\n# Camera and lights commands";
oss << "\n/vis/viewer/set/viewpointVector "
<< fViewpointDirection.x()
<< ' ' << fViewpointDirection.y()
<< ' ' << fViewpointDirection.z();
oss << "\n/vis/viewer/set/upVector "
<< fUpVector.x()
<< ' ' << fUpVector.y()
<< ' ' << fUpVector.z();
oss << "\n/vis/viewer/set/projection ";
if (fFieldHalfAngle == 0.) {
oss
<< "orthogonal";
} else {
oss
<< "perspective "
<< fFieldHalfAngle/deg
<< " deg";
}
oss << "\n/vis/viewer/zoomTo "
<< fZoomFactor;
oss << "\n/vis/viewer/scaleTo "
<< fScaleFactor.x()
<< ' ' << fScaleFactor.y()
<< ' ' << fScaleFactor.z();
oss << "\n/vis/viewer/set/targetPoint "
<< G4BestUnit(standardTargetPoint+fCurrentTargetPoint,"Length")
<< "\n# Note that if you have not set a target point, the vis system sets"
<< "\n# a target point based on the scene - plus any panning and dollying -"
<< "\n# so don't be alarmed by strange coordinates here.";
oss << "\n/vis/viewer/dollyTo "
<< G4BestUnit(fDolly,"Length");
oss << "\n/vis/viewer/set/lightsMove ";
if (fLightsMoveWithCamera) {
oss << "camera";
} else {
oss << "object";
}
oss << "\n/vis/viewer/set/lightsVector "
<< fRelativeLightpointDirection.x()
<< ' ' << fRelativeLightpointDirection.y()
<< ' ' << fRelativeLightpointDirection.z();
oss << "\n/vis/viewer/set/rotationStyle ";
if (fRotationStyle == constrainUpDirection) {
oss << "constrainUpDirection";
} else {
oss << "freeRotation";
}
G4Colour c = fBackgroundColour;
oss << "\n/vis/viewer/set/background "
<< c.GetRed()
<< ' ' << c.GetGreen()
<< ' ' << c.GetBlue()
<< ' ' << c.GetAlpha();
c = fDefaultVisAttributes.GetColour();
oss << "\n/vis/viewer/set/defaultColour "
<< c.GetRed()
<< ' ' << c.GetGreen()
<< ' ' << c.GetBlue()
<< ' ' << c.GetAlpha();
c = fDefaultTextVisAttributes.GetColour();
oss << "\n/vis/viewer/set/defaultTextColour "
<< c.GetRed()
<< ' ' << c.GetGreen()
<< ' ' << c.GetBlue()
<< ' ' << c.GetAlpha();
oss << std::endl;
return oss.str();
}
G4String G4ViewParameters::DrawingStyleCommands() const
{
std::ostringstream oss;
oss << "#\n# Drawing style commands";
oss << "\n/vis/viewer/set/style ";
if (fDrawingStyle == wireframe || fDrawingStyle == hlr) {
oss << "wireframe";
} else {
oss << "surface";
}
oss << "\n/vis/viewer/set/hiddenEdge ";
if (fDrawingStyle == hlr || fDrawingStyle == hlhsr) {
oss << "true";
} else {
oss << "false";
}
oss << "\n/vis/viewer/set/auxiliaryEdge ";
if (fAuxEdgeVisible) {
oss << "true";
} else {
oss << "false";
}
oss << "\n/vis/viewer/set/hiddenMarker ";
if (fMarkerNotHidden) {
oss << "false";
} else {
oss << "true";
}
oss << "\n/vis/viewer/set/globalLineWidthScale "
<< fGlobalLineWidthScale;
oss << "\n/vis/viewer/set/globalMarkerScale "
<< fGlobalMarkerScale;
oss << std::endl;
return oss.str();
}
G4String G4ViewParameters::SceneModifyingCommands() const
{
std::ostringstream oss;
oss << "#\n# Scene-modifying commands";
oss << "\n/vis/viewer/set/culling global ";
if (fCulling) {
oss << "true";
} else {
oss << "false";
}
oss << "\n/vis/viewer/set/culling invisible ";
if (fCullInvisible) {
oss << "true";
} else {
oss << "false";
}
oss << "\n/vis/viewer/set/culling density ";
if (fDensityCulling) {
oss << "true " << fVisibleDensity/(g/cm3) << " g/cm3";
} else {
oss << "false";
}
oss << "\n/vis/viewer/set/culling coveredDaughters ";
if (fCullCovered) {
oss << "true";
} else {
oss << "false";
}
oss << "\n/vis/viewer/set/sectionPlane ";
if (fSection) {
oss << "on "
<< G4BestUnit(fSectionPlane.point(),"Length")
<< fSectionPlane.normal().x()
<< ' ' << fSectionPlane.normal().y()
<< ' ' << fSectionPlane.normal().z();
} else {
oss << "off";
}
oss << "\n/vis/viewer/set/cutawayMode ";
if (fCutawayMode == cutawayUnion) {
oss << "union";
} else {
oss << "intersection";
}
oss << "\n/vis/viewer/clearCutawayPlanes";
if (fCutawayPlanes.size()) {
for (size_t i = 0; i < fCutawayPlanes.size(); i++) {
oss << "\n/vis/viewer/addCutawayPlane "
<< G4BestUnit(fCutawayPlanes[i].point(),"Length")
<< fCutawayPlanes[i].normal().x()
<< ' ' << fCutawayPlanes[i].normal().y()
<< ' ' << fCutawayPlanes[i].normal().z();
}
} else {
oss << "\n# No cutaway planes defined.";
}
oss << "\n/vis/viewer/set/explodeFactor "
<< fExplodeFactor
<< ' ' << G4BestUnit(fExplodeCentre,"Length");
oss << "\n/vis/viewer/set/lineSegmentsPerCircle "
<< fNoOfSides;
oss << std::endl;
return oss.str();
}
G4String G4ViewParameters::TouchableCommands() const
{
std::ostringstream oss;
oss << "#\n# Touchable commands";
const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
fVisAttributesModifiers;
if (vams.empty()) {
oss << "\n# None";
oss << std::endl;
return oss.str();
}
std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
iModifier;
for (iModifier = vams.begin();
iModifier != vams.end();
++iModifier) {
oss << "\n/vis/set/touchable";
const G4ModelingParameters::PVNameCopyNoPath& vamPath =
iModifier->GetPVNameCopyNoPath();
G4ModelingParameters::PVNameCopyNoPathConstIterator iVAM;
for (iVAM = vamPath.begin();
iVAM != vamPath.end();
++iVAM) {
oss << ' ' << iVAM->GetName() << ' ' << iVAM->GetCopyNo();
}
const G4VisAttributes& vamVisAtts = iModifier->GetVisAttributes();
const G4Colour& c = vamVisAtts.GetColour();
switch (iModifier->GetVisAttributesSignifier()) {
case G4ModelingParameters::VASVisibility:
oss << "\n/vis/touchable/set/visibility ";
if (vamVisAtts.IsVisible()) {
oss << "true";
} else {
oss << "false";
}
break;
case G4ModelingParameters::VASDaughtersInvisible:
oss << "\n/vis/touchable/set/daughtersInvisible ";
if (vamVisAtts.IsDaughtersInvisible()) {
oss << "true";
} else {
oss << "false";
}
break;
case G4ModelingParameters::VASColour:
oss << "\n/vis/touchable/set/colour "
<< c.GetRed()
<< ' ' << c.GetGreen()
<< ' ' << c.GetBlue()
<< ' ' << c.GetAlpha();
break;
case G4ModelingParameters::VASLineStyle:
oss << "\n/vis/touchable/set/lineStyle ";
switch (vamVisAtts.GetLineStyle()) {
case G4VisAttributes::unbroken:
oss << "unbroken";
break;
case G4VisAttributes::dashed:
oss << "dashed";
break;
case G4VisAttributes::dotted:
oss << "dotted";
}
break;
case G4ModelingParameters::VASLineWidth:
oss << "\n/vis/touchable/set/lineWidth "
<< vamVisAtts.GetLineWidth();
break;
case G4ModelingParameters::VASForceWireframe:
if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::wireframe) {
oss << "\n/vis/touchable/set/forceWireframe ";
if (vamVisAtts.IsForceDrawingStyle()) {
oss << "true";
} else {
oss << "false";
}
}
break;
case G4ModelingParameters::VASForceSolid:
if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::solid) {
oss << "\n/vis/touchable/set/forceSolid ";
if (vamVisAtts.IsForceDrawingStyle()) {
oss << "true";
} else {
oss << "false";
}
}
break;
case G4ModelingParameters::VASForceAuxEdgeVisible:
oss << "\n/vis/touchable/set/forceAuxEdgeVisible ";
if (vamVisAtts.IsForceAuxEdgeVisible()) {
oss << "true";
} else {
oss << "false";
}
break;
case G4ModelingParameters::VASForceLineSegmentsPerCircle:
oss << "\n/vis/touchable/set/lineSegmentsPerCircle "
<< vamVisAtts.GetForcedLineSegmentsPerCircle();
break;
}
}
oss << std::endl;
return oss.str();
}
void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
// Put performance-sensitive parameters first.
@@ -292,6 +608,7 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
(fWindowSizeHintX != v.fWindowSizeHintX) ||
(fWindowSizeHintY != v.fWindowSizeHintY) ||
(fXGeometryString != v.fXGeometryString) ||
(fGeometryMask != v.fGeometryMask) ||
(fAutoRefresh != v.fAutoRefresh) ||
(fBackgroundColour != v.fBackgroundColour) ||
(fPicking != v.fPicking) ||
@@ -467,6 +784,9 @@ std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
<< v.fWindowSizeHintX << 'x'<< v.fWindowSizeHintX;
os << "\n X geometry string: " << v.fXGeometryString;
os << "\n X geometry mask: "
<< std::showbase << std::hex << v.fGeometryMask
<< std::noshowbase << std::dec;
os << "\n Auto refresh: ";
if (v.fAutoRefresh) os << "true";
@@ -487,6 +807,15 @@ std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
default: os << "unrecognised"; break;
}
os << "\n Vis attributes modifiers: ";
const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
v.fVisAttributesModifiers;
if (vams.empty()) {
os << "None";
} else {
os << vams;
}
return os;
}
@@ -526,6 +855,7 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
(fWindowSizeHintX != v.fWindowSizeHintX) ||
(fWindowSizeHintY != v.fWindowSizeHintY) ||
(fXGeometryString != v.fXGeometryString) ||
(fGeometryMask != v.fGeometryMask) ||
(fAutoRefresh != v.fAutoRefresh) ||
(fBackgroundColour != v.fBackgroundColour) ||
(fPicking != v.fPicking) ||
@@ -553,6 +883,10 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
((fExplodeFactor != v.fExplodeFactor) ||
(fExplodeCentre != v.fExplodeCentre))) return true;
if (G4ModelingParameters::VAMSNotEqual
(fVisAttributesModifiers, v.fVisAttributesModifiers))
return true;
return false;
}
@@ -784,4 +1118,3 @@ G4int G4ViewParameters::ReadInteger(char *string, char **NextString)
else
return (-Result);
}
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ViewerList.cc,v 1.4 2006-06-29 21:29:32 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
#include "G4ViewerList.hh"
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommands.cc,v 1.24 2009-03-09 12:42:00 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
// /vis/ top level commands - John Allison 5th February 2001
@@ -39,6 +38,14 @@
#include "G4RunManager.hh"
#include "G4Run.hh"
#include "G4UIsession.hh"
#include "G4Trajectory.hh"
#include "G4TrajectoryPoint.hh"
#include "G4RichTrajectory.hh"
#include "G4RichTrajectoryPoint.hh"
#include "G4SmoothTrajectory.hh"
#include "G4SmoothTrajectoryPoint.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4AttDef.hh"
////////////// /vis/abortReviewKeptEvents /////////////////////////////
@@ -147,15 +154,39 @@ void G4VisCommandList::SetNewValue (G4UIcommand*, G4String newValue)
G4cout << G4endl;
fpVisManager->PrintAvailableModels(verbosity);
G4cout << G4endl;
fpVisManager->PrintAvailableUserVisActions(verbosity);
G4cout << G4endl;
fpVisManager->PrintAvailableColours(verbosity);
G4cout << G4endl;
G4UImanager* UImanager = G4UImanager::GetUIpointer();
UImanager->ApplyCommand(G4String("/vis/viewer/list ! ") + verbosityString);
UImanager->ApplyCommand("/vis/scene/list ! c");
UImanager->ApplyCommand("/vis/viewer/list ! c");
G4cout <<
"\nAttributes available for modeling and filtering with"
"\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
"\n \"/vis/filtering/trajectories/create/attributeFilter\" commands"
"\nand by picking:"
<< G4endl;
G4cout << G4TrajectoriesModel().GetAttDefs();
G4cout << G4RichTrajectory().GetAttDefs()
<< G4RichTrajectoryPoint().GetAttDefs();
G4cout << G4SmoothTrajectory().GetAttDefs()
<< G4SmoothTrajectoryPoint().GetAttDefs();
G4cout << G4Trajectory().GetAttDefs()
<< G4TrajectoryPoint().GetAttDefs();
G4cout <<
"\nAttributes available for touchables by picking:"
<< G4endl;
G4cout << G4PhysicalVolumeModel().GetAttDefs();
if (verbosity < G4VisManager::parameters)
G4cout <<
"\nTo get more information, \"/vis/list all all\" or use individual commands"
"\n such as (use \"ls\" or \"help\"):"
"\n /vis/viewer/list"
"\n /vis/scene/list all all"
"\n /vis/viewer/list all all"
"\n /vis/modeling/trajectories/list"
"\n /vis/filtering/trajectories/list"
<< G4endl;
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsCompound.cc,v 1.40 2010-05-20 07:54:01 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
// Compound /vis/ commands - John Allison 15th May 2000
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsGeometry.cc,v 1.4 2007-01-05 16:29:38 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
// /vis/geometry commands - John Allison 31st January 2006
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsGeometrySet.cc,v 1.8 2010-06-15 16:34:30 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
// /vis/geometry commands - John Allison 31st January 2006
@@ -153,7 +152,13 @@ void G4VisCommandGeometrySetColour::SetNewValue
G4Colour colour(1,1,1,1); // Default white and opaque.
const size_t iPos0 = 0;
if (std::isalpha(redOrString[iPos0])) {
G4Colour::GetColour(redOrString, colour); // Remains if not found.
if (!G4Colour::GetColour(redOrString, colour)) {
if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
G4cout << "WARNING: Colour \"" << redOrString
<< "\" not found. Defaulting to white and opaque."
<< G4endl;
}
}
} else {
colour = G4Colour(G4UIcommand::ConvertToDouble(redOrString), green, blue);
}
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsScene.cc,v 1.71 2010-12-11 16:53:20 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
// /vis/scene commands - John Allison 9th August 1998
@@ -49,11 +48,144 @@ G4VVisCommandScene::~G4VVisCommandScene () {}
G4String G4VVisCommandScene::CurrentSceneName () {
const G4Scene* pScene = fpVisManager -> GetCurrentScene ();
G4String currentSceneName;
G4String currentSceneName = "none";
if (pScene) currentSceneName = pScene -> GetName ();
return currentSceneName;
}
////////////// /vis/scene/activateModel ////////////////////////////
G4VisCommandSceneActivateModel::G4VisCommandSceneActivateModel () {
G4bool omitable;
fpCommand = new G4UIcommand ("/vis/scene/activateModel", this);
fpCommand -> SetGuidance
("Activate or de-activate model.");
fpCommand -> SetGuidance
("Attempts to match search string to name of model - use unique sub-string.");
fpCommand -> SetGuidance
("Use \"/vis/scene/list\" to see model names.");
fpCommand -> SetGuidance
("If name == \"all\" (default), all models are activated.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("search-string", 's', omitable = true);
parameter -> SetDefaultValue ("all");
fpCommand -> SetParameter (parameter);
parameter = new G4UIparameter ("activate", 'b', omitable = true);
parameter -> SetDefaultValue (true);
fpCommand -> SetParameter (parameter);
}
G4VisCommandSceneActivateModel::~G4VisCommandSceneActivateModel () {
delete fpCommand;
}
G4String G4VisCommandSceneActivateModel::GetCurrentValue(G4UIcommand*) {
return "";
}
void G4VisCommandSceneActivateModel::SetNewValue (G4UIcommand*,
G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4String searchString, activateString;
std::istringstream is (newValue);
is >> searchString >> activateString;
G4bool activate = G4UIcommand::ConvertToBool(activateString);
G4Scene* pScene = fpVisManager->GetCurrentScene();
if (!pScene) {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: No current scene. Please create one." << G4endl;
}
return;
}
G4VSceneHandler* pSceneHandler = fpVisManager->GetCurrentSceneHandler();
if (!pSceneHandler) {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: No current sceneHandler. Please create one." << G4endl;
}
return;
}
if (searchString == "all" && !activate) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
"WARNING: You are not allowed to de-activate all models."
"\n Command ignored."
<< G4endl;
}
return;
}
G4bool any = false;
std::vector<G4Scene::Model>& runDurationModelList =
pScene->SetRunDurationModelList();
for (size_t i = 0; i < runDurationModelList.size(); i++) {
const G4String& modelName =
runDurationModelList[i].fpModel->GetGlobalDescription();
if (searchString == "all" || modelName.find(searchString)
!= std::string::npos) {
any = true;
runDurationModelList[i].fActive = activate;
if (verbosity >= G4VisManager::warnings) {
G4cout << "Model \"" << modelName;
if (activate) G4cout << "\" activated.";
else G4cout << "\" de-activated.";
G4cout << G4endl;
}
}
}
std::vector<G4Scene::Model>& endOfEventModelList =
pScene->SetEndOfEventModelList();
for (size_t i = 0; i < endOfEventModelList.size(); i++) {
const G4String& modelName =
endOfEventModelList[i].fpModel->GetGlobalDescription();
if (searchString == "all" || modelName.find(searchString)
!= std::string::npos) {
any = true;
endOfEventModelList[i].fActive = activate;
if (verbosity >= G4VisManager::warnings) {
G4cout << "Model \"" << modelName;
if (activate) G4cout << "\" activated.";
else G4cout << "\" de-activated.";
G4cout << G4endl;
}
}
}
std::vector<G4Scene::Model>& endOfRunModelList =
pScene->SetEndOfRunModelList();
for (size_t i = 0; i < endOfRunModelList.size(); i++) {
const G4String& modelName =
endOfRunModelList[i].fpModel->GetGlobalDescription();
if (searchString == "all" || modelName.find(searchString)
!= std::string::npos) {
any = true;
endOfRunModelList[i].fActive = activate;
if (verbosity >= G4VisManager::warnings) {
G4cout << "Model \"" << modelName;
if (activate) G4cout << "\" activated.";
else G4cout << "\" de-activated.";
G4cout << G4endl;
}
}
}
if (!any) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: No match found." << G4endl;
}
return;
}
const G4String& currentSceneName = pScene -> GetName ();
UpdateVisManagerScene (currentSceneName);
}
////////////// /vis/scene/create ///////////////////////////////////////
G4VisCommandSceneCreate::G4VisCommandSceneCreate (): fId (0) {
@@ -393,7 +525,7 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand*, G4String newValue) {
G4cout << " ";
}
G4cout << " scene \"" << iName << "\"";
if (verbosity >= G4VisManager::confirmations) {
if (verbosity >= G4VisManager::warnings) {
G4int i;
G4cout << "\n Run-duration models:";
G4int nRunModels = pScene -> GetRunDurationModelList ().size ();
@@ -401,8 +533,11 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand*, G4String newValue) {
G4cout << " none.";
}
for (i = 0; i < nRunModels; i++) {
G4VModel* pModel = pScene -> GetRunDurationModelList () [i];
G4cout << "\n " << pModel -> GetGlobalDescription ();
if (pScene -> GetRunDurationModelList()[i].fActive)
G4cout << "\n Active: ";
else G4cout << "\n Inactive: ";
G4VModel* pModel = pScene -> GetRunDurationModelList()[i].fpModel;
G4cout << pModel -> GetGlobalDescription ();
}
G4cout << "\n End-of-event models:";
G4int nEOEModels = pScene -> GetEndOfEventModelList ().size ();
@@ -410,8 +545,23 @@ void G4VisCommandSceneList::SetNewValue (G4UIcommand*, G4String newValue) {
G4cout << " none.";
}
for (i = 0; i < nEOEModels; i++) {
G4VModel* pModel = pScene -> GetEndOfEventModelList () [i];
G4cout << "\n " << pModel -> GetGlobalDescription ();
if (pScene -> GetEndOfEventModelList()[i].fActive)
G4cout << "\n Active: ";
else G4cout << "\n Inactive: ";
G4VModel* pModel = pScene -> GetEndOfEventModelList()[i].fpModel;
G4cout << pModel -> GetGlobalDescription ();
}
G4cout << "\n End-of-run models:";
G4int nEORModels = pScene -> GetEndOfRunModelList ().size ();
if (nEORModels == 0) {
G4cout << " none.";
}
for (i = 0; i < nEORModels; i++) {
if (pScene -> GetEndOfRunModelList()[i].fActive)
G4cout << "\n Active: ";
else G4cout << "\n Inactive: ";
G4VModel* pModel = pScene -> GetEndOfRunModelList()[i].fpModel;
G4cout << pModel -> GetGlobalDescription ();
}
}
if (verbosity >= G4VisManager::parameters) {
@@ -525,6 +675,7 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
}
return;
}
G4VisManager::Verbosity currentVerbosity = fpVisManager -> GetVerbosity();
// Suppress messages during this process (only print errors)...
@@ -540,6 +691,7 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
if (aScene) {
const G4String& aSceneName = aScene -> GetName ();
if (sceneName == aSceneName) {
aScene->CalculateExtent(); // Check and recalculate extent
G4ViewerList& viewerList = aSceneHandler -> SetViewerList ();
const G4int nViewers = viewerList.size ();
for (G4int iV = 0; iV < nViewers; iV++) {
@@ -552,17 +704,6 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
fpVisManager -> SetCurrentViewer(aViewer);
fpVisManager -> SetCurrentSceneHandler(aSceneHandler);
fpVisManager -> SetCurrentScene(aScene);
// ClearTransientStore. This clears the transient, e.g.,
// trajectories part of the store/graphical database but
// also re-draws the permanent part (detector) and thus
// has the effect of clearing trajectories from the view.
// This should not be necessary since NeedKernelVisit,
// ClearView and DrawView should have the effect of
// deleting the whole store and re-creating it, then
// clearing and re-drawing. But ClearView does not seem
// to work for all viewers. If it's a problem for you,
// uncomment the next line.
//aSceneHandler->ClearTransientStore();
aViewer -> SetView ();
aViewer -> ClearView ();
aViewer -> DrawView ();
@@ -577,8 +718,8 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
<< "\"." << G4endl;
}
} else {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: The scene, \""
if (verbosity >= G4VisManager::confirmations) {
G4cout << "NOTE: The scene, \""
<< sceneName
<< "\", of viewer \""
<< aViewer -> GetName ()
File diff suppressed because it is too large Load Diff
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsSceneHandler.cc,v 1.32 2006-06-29 21:29:46 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
// /vis/sceneHandler commands - John Allison 10th October 1998
@@ -244,7 +243,32 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand*,
}
return;
}
// Valid index. Set current graphics system in preparation for
// Check UI session compatibility.
if (!gsl[iGS]->IsUISessionCompatible()) {
G4String fallbackNickname = gsl[iGS]->GetNickname() + "_FALLBACK";
for (iGS = 0; iGS < nSystems; iGS++) {
if (fallbackNickname.compareTo (gsl [iGS] -> GetNickname (),
G4String::ignoreCase) == 0) {
break; // Match found.
}
}
if (iGS < 0 || iGS >= nSystems) {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: G4VisCommandSceneHandlerCreate::SetNewValue:"
" could not find fallback graphics system."
<< G4endl;
}
return;
}
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: G4VisCommandSceneHandlerCreate::SetNewValue:"
" using fallback graphics system."
<< G4endl;
}
}
// Set current graphics system in preparation for
// creating scene handler.
G4VGraphicsSystem* pSystem = gsl [iGS];
fpVisManager -> SetCurrentGraphicsSystem (pSystem);
@@ -0,0 +1,354 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VisCommands.cc,v 1.24 2009-03-09 12:42:00 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/set - John Allison 21st March 2012
// Set quantities for use in appropriate future commands.
#include "G4VisCommandsSet.hh"
#include "G4UIcommand.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithAString.hh"
#include <cctype>
#include <sstream>
////////////// /vis/set/colour ////////////////////////////////////
G4VisCommandSetColour::G4VisCommandSetColour ()
{
G4bool omitable;
fpCommand = new G4UIcommand("/vis/set/colour", this);
fpCommand->SetGuidance
("Defines colour and opacity for future \"/vis/scene/add/\" commands.");
fpCommand->SetGuidance
("(Except \"/vis/scene/add/text\" commands - see \"/vis/set/textColour\".)");
fpCommand->SetGuidance("Default: white and opaque.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("red", 's', omitable = true);
parameter->SetGuidance
("Red component or a string, e.g., \"cyan\" (green and blue parameters are ignored).");
parameter->SetDefaultValue ("1.");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("green", 'd', omitable = true);
parameter->SetDefaultValue (1.);
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("blue", 'd', omitable = true);
parameter->SetDefaultValue (1.);
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("alpha", 'd', omitable = true);
parameter->SetDefaultValue (1.);
parameter->SetGuidance ("Opacity");
fpCommand->SetParameter (parameter);
}
G4VisCommandSetColour::~G4VisCommandSetColour ()
{
delete fpCommand;
}
G4String G4VisCommandSetColour::GetCurrentValue (G4UIcommand*)
{
return G4String();
}
void G4VisCommandSetColour::SetNewValue (G4UIcommand*, G4String newValue)
{
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4String redOrString;
G4double green, blue, opacity;
std::istringstream iss(newValue);
iss >> redOrString >> green >> blue >> opacity;
G4Colour colour(1,1,1,1); // Default white and opaque.
if (std::isalpha(redOrString(0))) {
if (!G4Colour::GetColour(redOrString, colour)) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Colour \"" << redOrString
<< "\" not found. Defaulting to white and opaque."
<< G4endl;
}
}
} else {
colour = G4Colour
(G4UIcommand::ConvertToDouble(redOrString), green, blue);
}
// Add opacity
fCurrentColour = G4Colour
(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
if (verbosity >= G4VisManager::confirmations) {
G4cout <<
"Colour for future \"/vis/scene/add/\" commands has been set to "
<< fCurrentColour <<
".\n(Except \"/vis/scene/add/text\" commands - use \"/vis/set/textColour\".)"
<< G4endl;
}
}
////////////// /vis/set/lineWidth ////////////////////////////////////
G4VisCommandSetLineWidth::G4VisCommandSetLineWidth ()
{
G4bool omitable;
fpCommand = new G4UIcmdWithADouble("/vis/set/lineWidth", this);
fpCommand->SetGuidance
("Defines lineWidth for future \"/vis/scene/add/\" commands.");
fpCommand->SetParameterName ("lineWidth", omitable = true);
fpCommand->SetDefaultValue (1.);
fpCommand->SetRange("lineWidth >= 1.");
}
G4VisCommandSetLineWidth::~G4VisCommandSetLineWidth ()
{
delete fpCommand;
}
G4String G4VisCommandSetLineWidth::GetCurrentValue (G4UIcommand*)
{
return G4String();
}
void G4VisCommandSetLineWidth::SetNewValue (G4UIcommand*, G4String newValue)
{
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
fCurrentLineWidth = fpCommand->GetNewDoubleValue(newValue);
if (verbosity >= G4VisManager::confirmations) {
G4cout <<
"Line width for future \"/vis/scene/add/\" commands has been set to "
<< fCurrentLineWidth
<< G4endl;
}
}
////////////// /vis/set/textColour ////////////////////////////////////
G4VisCommandSetTextColour::G4VisCommandSetTextColour ()
{
G4bool omitable;
fpCommand = new G4UIcommand("/vis/set/textColour", this);
fpCommand->SetGuidance
("Defines colour and opacity for future \"/vis/scene/add/text\" commands.");
fpCommand->SetGuidance("Default: blue and opaque.");
G4UIparameter* parameter;
parameter = new G4UIparameter ("red", 's', omitable = true);
parameter->SetGuidance
("Red component or a string, e.g., \"cyan\" (green and blue parameters are ignored).");
parameter->SetDefaultValue ("0.");
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("green", 'd', omitable = true);
parameter->SetDefaultValue (0.);
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("blue", 'd', omitable = true);
parameter->SetDefaultValue (1.);
fpCommand->SetParameter (parameter);
parameter = new G4UIparameter ("alpha", 'd', omitable = true);
parameter->SetDefaultValue (1.);
parameter->SetGuidance ("Opacity");
fpCommand->SetParameter (parameter);
}
G4VisCommandSetTextColour::~G4VisCommandSetTextColour ()
{
delete fpCommand;
}
G4String G4VisCommandSetTextColour::GetCurrentValue (G4UIcommand*)
{
return G4String();
}
void G4VisCommandSetTextColour::SetNewValue (G4UIcommand*, G4String newValue)
{
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4String redOrString;
G4double green, blue, opacity;
std::istringstream iss(newValue);
iss >> redOrString >> green >> blue >> opacity;
G4Colour colour(0,0,1,1); // Default blue and opaque.
if (std::isalpha(redOrString(0))) {
if (!G4Colour::GetColour(redOrString, colour)) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Text colour \"" << redOrString
<< "\" not found. Defaulting to blue and opaque."
<< G4endl;
}
}
} else {
colour = G4Colour
(G4UIcommand::ConvertToDouble(redOrString), green, blue);
}
// Add opacity
fCurrentTextColour = G4Colour
(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
if (verbosity >= G4VisManager::confirmations) {
G4cout <<
"Colour for future \"/vis/scene/add/text\" commands has been set to "
<< fCurrentTextColour << '.'
<< G4endl;
}
}
////////////// /vis/set/textLayout ////////////////////////////////////
G4VisCommandSetTextLayout::G4VisCommandSetTextLayout ()
{
G4bool omitable;
fpCommand = new G4UIcmdWithAString("/vis/set/textLayout", this);
fpCommand->SetGuidance
("Defines layout future \"/vis/scene/add/text\" commands.");
fpCommand->SetGuidance
("\"left\" (default) for left justification to provided coordinate.");
fpCommand->SetGuidance
("\"centre\" or \"center\" for text centered on provided coordinate.");
fpCommand->SetGuidance
("\"right\" for right justification to provided coordinate.");
fpCommand->SetGuidance("Default: left.");
fpCommand->SetParameterName("layout", omitable = true);
fpCommand->SetCandidates ("left centre center right");
fpCommand->SetDefaultValue ("left");
}
G4VisCommandSetTextLayout::~G4VisCommandSetTextLayout ()
{
delete fpCommand;
}
G4String G4VisCommandSetTextLayout::GetCurrentValue (G4UIcommand*)
{
return G4String();
}
void G4VisCommandSetTextLayout::SetNewValue (G4UIcommand*, G4String newValue)
{
G4Text::Layout layout = G4Text::left;
if (newValue == "left") layout = G4Text::left;
else if (newValue == "centre" || newValue == "center")
layout = G4Text::centre;
else if (newValue == "right") layout = G4Text::right;
fCurrentTextLayout = layout;
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Text layout (for future \"text\" commands) has been set to \""
<< fCurrentTextLayout << "\"."
<< G4endl;
}
}
////////////// /vis/set/touchable ////////////////////////////////////
G4VisCommandSetTouchable::G4VisCommandSetTouchable ()
{
G4bool omitable;
G4UIparameter* parameter;
fpCommand = new G4UIcommand("/vis/set/touchable", this);
fpCommand->SetGuidance
("Defines touchable for future \"/vis/touchable/set/\" commands.");
fpCommand->SetGuidance
("Please provide a list of space-separated physical volume names and"
"\ncopy number pairs starting at the world volume, e.g:"
"\n/vis/set/touchable World 0 Envelope 0 Shape1 0");
parameter = new G4UIparameter ("list", 's', omitable = false);
parameter->SetGuidance
("List of physical volume names and copy number pairs");
fpCommand->SetParameter (parameter);
}
G4VisCommandSetTouchable::~G4VisCommandSetTouchable ()
{
delete fpCommand;
}
G4String G4VisCommandSetTouchable::GetCurrentValue (G4UIcommand*)
{
return G4String();
}
void G4VisCommandSetTouchable::SetNewValue (G4UIcommand*, G4String newValue)
{
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4ModelingParameters::PVNameCopyNoPath currentTouchablePath;
// Algorithm from Josuttis p.476.
G4String::size_type iBegin, iEnd;
iBegin = newValue.find_first_not_of(' ');
while (iBegin != G4String::npos) {
iEnd = newValue.find_first_of(' ',iBegin);
if (iEnd == G4String::npos) {
iEnd = newValue.length();
}
G4String name(newValue.substr(iBegin,iEnd-iBegin));
iBegin = newValue.find_first_not_of(' ',iEnd);
if (iBegin == G4String::npos) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
"WARNING: G4VisCommandSetTouchable::SetNewValue"
"\n A pair not found. (Did you have an even number of parameters?)"
"\n Command ignored."
<< G4endl;
return;
}
}
iEnd = newValue.find_first_of(' ',iBegin);
if (iEnd == G4String::npos) {
iEnd = newValue.length();
}
G4int copyNo;
std::istringstream iss(newValue.substr(iBegin,iEnd-iBegin));
if (!(iss >> copyNo)) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
"WARNING: G4VisCommandSetTouchable::SetNewValue"
"\n Error reading copy number - it was not numeric?"
"\n Command ignored."
<< G4endl;
return;
}
}
currentTouchablePath.push_back
(G4ModelingParameters::PVNameCopyNo(name,copyNo));
iBegin = newValue.find_first_not_of(' ',iEnd);
}
fCurrentTouchablePath = currentTouchablePath;
if (verbosity >= G4VisManager::confirmations) {
G4cout << fCurrentTouchablePath
<< G4endl;
}
}
@@ -0,0 +1,300 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id$
// /vis/touchable/set commands - John Allison 8th October 2012
#include "G4VisCommandsTouchableSet.hh"
#include "G4UIcommand.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include <sstream>
#include <cctype>
////////////// /vis/touchable/set/colour ///////////////////////////////////////
G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
{
G4bool omitable;
G4UIparameter* parameter;
fpCommandSetColour = new G4UIcommand
("/vis/touchable/set/colour", this);
fpCommandSetColour->SetGuidance("Set colour of current touchable.");
fpCommandSetColour->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
parameter = new G4UIparameter("red", 's', omitable = true);
parameter->SetDefaultValue("1.");
parameter->SetGuidance
("Red component or a string, e.g., \"blue\", in which case succeeding colour"
"\ncomponents are ignored.");
fpCommandSetColour->SetParameter(parameter);
parameter = new G4UIparameter("green", 'd', omitable = true);
parameter->SetDefaultValue(1.);
fpCommandSetColour->SetParameter(parameter);
parameter = new G4UIparameter("blue", 'd', omitable = true);
parameter->SetDefaultValue(1.);
fpCommandSetColour->SetParameter(parameter);
parameter = new G4UIparameter("opacity", 'd', omitable = true);
parameter->SetDefaultValue(1.);
fpCommandSetColour->SetParameter(parameter);
fpCommandSetDaughtersInvisible = new G4UIcmdWithABool
("/vis/touchable/set/daughtersInvisible", this);
fpCommandSetDaughtersInvisible->SetGuidance
("Daughters of current touchable invisible: true/false.");
fpCommandSetDaughtersInvisible->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetDaughtersInvisible->SetParameterName("daughtersInvisible", omitable = true);
fpCommandSetDaughtersInvisible->SetDefaultValue(false);
fpCommandSetForceAuxEdgeVisible = new G4UIcmdWithABool
("/vis/touchable/set/forceAuxEdgeVisible", this);
fpCommandSetForceAuxEdgeVisible->SetGuidance
("Force auxiliary (soft) edges of current touchable to be visible:"
" true/false.");
fpCommandSetForceAuxEdgeVisible->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetForceAuxEdgeVisible->SetParameterName("forceAuxEdgeVisible", omitable = true);
fpCommandSetForceAuxEdgeVisible->SetDefaultValue(false);
fpCommandSetLineSegmentsPerCircle = new G4UIcmdWithAnInteger
("/vis/touchable/set/lineSegmentsPerCircle", this);
fpCommandSetLineSegmentsPerCircle->SetGuidance
("For current touchable, set number of line segments per circle, the"
"\nprecision with which a curved line or surface is represented by a"
"\npolygon or polyhedron, regardless of the view parameters."
"\nNegative to pick up G4Polyhedron default value.");
fpCommandSetLineSegmentsPerCircle->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetLineSegmentsPerCircle->SetParameterName("lineSegmentsPerCircle", omitable = true);
fpCommandSetLineSegmentsPerCircle->SetDefaultValue(-1);
fpCommandSetForceSolid = new G4UIcmdWithABool
("/vis/touchable/set/forceSolid", this);
fpCommandSetForceSolid->SetGuidance
("Force current touchable always to be drawn solid (surface drawing).");
fpCommandSetForceSolid->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetForceSolid->SetParameterName("forceSolid", omitable = true);
fpCommandSetForceSolid->SetDefaultValue(false);
fpCommandSetForceWireframe = new G4UIcmdWithABool
("/vis/touchable/set/forceWireframe", this);
fpCommandSetForceWireframe->SetGuidance
("Force current touchable always to be drawn as wireframe.");
fpCommandSetForceWireframe->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetForceWireframe->SetParameterName("forceWireframe", omitable = true);
fpCommandSetForceWireframe->SetDefaultValue(false);
fpCommandSetLineStyle = new G4UIcmdWithAString
("/vis/touchable/set/lineStyle", this);
fpCommandSetLineStyle->SetGuidance("Set line style of current touchable drawing.");
fpCommandSetLineStyle->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetLineStyle->SetParameterName("lineStyle", omitable = true);
fpCommandSetLineStyle->SetCandidates("unbroken dashed dotted");
fpCommandSetLineStyle->SetDefaultValue("unbroken");
fpCommandSetLineWidth = new G4UIcmdWithADouble
("/vis/touchable/set/lineWidth", this);
fpCommandSetLineWidth->SetGuidance("Set line width of current touchable.");
fpCommandSetLineWidth->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetLineWidth->SetParameterName("lineWidth", omitable = true);
fpCommandSetLineWidth->SetDefaultValue(1.);
fpCommandSetVisibility = new G4UIcmdWithABool
("/vis/touchable/set/visibility", this);
fpCommandSetVisibility->SetGuidance
("Set visibility of current touchable: true/false.");
fpCommandSetVisibility->SetGuidance
("Use \"/vis/set/touchable\" to set current touchable.");
fpCommandSetVisibility->SetParameterName("visibility", omitable = true);
fpCommandSetVisibility->SetDefaultValue(false);
}
G4VisCommandsTouchableSet::~G4VisCommandsTouchableSet() {
delete fpCommandSetVisibility;
delete fpCommandSetLineWidth;
delete fpCommandSetLineStyle;
delete fpCommandSetForceWireframe;
delete fpCommandSetForceSolid;
delete fpCommandSetLineSegmentsPerCircle;
delete fpCommandSetForceAuxEdgeVisible;
delete fpCommandSetDaughtersInvisible;
delete fpCommandSetColour;
}
G4String G4VisCommandsTouchableSet::GetCurrentValue(G4UIcommand*) {
return "";
}
void G4VisCommandsTouchableSet::SetNewValue
(G4UIcommand* command,G4String newValue)
{
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VisCommandsTouchableSet::SetNewValue: no current viewer."
<< G4endl;
}
return;
}
G4ViewParameters workingVP = currentViewer->GetViewParameters();
G4VisAttributes workingVisAtts;
if (command == fpCommandSetColour)
{
G4String redOrString;
G4double green, blue, opacity;
std::istringstream iss(newValue);
iss >> redOrString >> green >> blue >> opacity;
G4Colour colour(1,1,1,1); // Default white and opaque.
const size_t iPos0 = 0;
if (std::isalpha(redOrString[iPos0])) {
if (!G4Colour::GetColour(redOrString, colour)) {
if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
G4cout << "WARNING: Colour \"" << redOrString
<< "\" not found. Defaulting to white and opaque."
<< G4endl;
}
}
} else {
colour = G4Colour(G4UIcommand::ConvertToDouble(redOrString), green, blue);
}
colour = G4Colour
(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
workingVisAtts.SetColour(colour);
workingVP.AddVisAttributesModifier
(G4ModelingParameters::VisAttributesModifier
(workingVisAtts,
G4ModelingParameters::VASColour,
fCurrentTouchablePath));
}
else if (command == fpCommandSetDaughtersInvisible) {
workingVisAtts.SetDaughtersInvisible(G4UIcommand::ConvertToBool(newValue));
workingVP.AddVisAttributesModifier
(G4ModelingParameters::VisAttributesModifier
(workingVisAtts,
G4ModelingParameters::VASDaughtersInvisible,
fCurrentTouchablePath));
}
else if (command == fpCommandSetForceAuxEdgeVisible) {
workingVisAtts.SetForceAuxEdgeVisible(G4UIcommand::ConvertToBool(newValue));
workingVP.AddVisAttributesModifier
(G4ModelingParameters::VisAttributesModifier
(workingVisAtts,
G4ModelingParameters::VASForceAuxEdgeVisible,
fCurrentTouchablePath));
}
else if (command == fpCommandSetLineSegmentsPerCircle) {
workingVisAtts.SetForceLineSegmentsPerCircle
(G4UIcommand::ConvertToInt(newValue));
workingVP.AddVisAttributesModifier
(G4ModelingParameters::VisAttributesModifier
(workingVisAtts,
G4ModelingParameters::VASForceLineSegmentsPerCircle,
fCurrentTouchablePath));
}
else if (command == fpCommandSetForceSolid) {
workingVisAtts.SetForceSolid(G4UIcommand::ConvertToBool(newValue));
workingVP.AddVisAttributesModifier
(G4ModelingParameters::VisAttributesModifier
(workingVisAtts,
G4ModelingParameters::VASForceSolid,
fCurrentTouchablePath));
}
else if (command == fpCommandSetForceWireframe) {
workingVisAtts.SetForceWireframe(G4UIcommand::ConvertToBool(newValue));
workingVP.AddVisAttributesModifier
(G4ModelingParameters::VisAttributesModifier
(workingVisAtts,
G4ModelingParameters::VASForceWireframe,
fCurrentTouchablePath));
}
else if (command == fpCommandSetLineStyle) {
G4VisAttributes::LineStyle lineStyle = G4VisAttributes::unbroken;
if (newValue == "dashed") {
lineStyle = G4VisAttributes::dashed;
} else if (newValue == "dotted") {
lineStyle = G4VisAttributes::dotted;
}
// All other values are "unbroken".
workingVisAtts.SetLineStyle(lineStyle);
workingVP.AddVisAttributesModifier
(G4ModelingParameters::VisAttributesModifier
(workingVisAtts,
G4ModelingParameters::VASLineStyle,
fCurrentTouchablePath));
}
else if (command == fpCommandSetLineWidth) {
workingVisAtts.SetLineWidth(G4UIcommand::ConvertToDouble(newValue));
workingVP.AddVisAttributesModifier
(G4ModelingParameters::VisAttributesModifier
(workingVisAtts,
G4ModelingParameters::VASLineWidth,
fCurrentTouchablePath));
}
else if (command == fpCommandSetVisibility) {
workingVisAtts.SetVisibility(G4UIcommand::ConvertToBool(newValue));
workingVP.AddVisAttributesModifier
(G4ModelingParameters::VisAttributesModifier
(workingVisAtts,
G4ModelingParameters::VASVisibility,
fCurrentTouchablePath));
}
else {
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VisCommandsTouchableSet::SetNewValue: unrecognised command."
<< G4endl;
}
return;
}
SetViewParameters(currentViewer,workingVP);
}
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewer.cc,v 1.77 2010-11-07 11:14:07 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
// /vis/viewer commands - John Allison 25th October 1998
@@ -41,9 +40,11 @@
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWith3Vector.hh"
#include "G4Point3D.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
#include <sstream>
#include <fstream>
G4VVisCommandViewer::G4VVisCommandViewer () {}
@@ -64,8 +65,9 @@ void G4VVisCommandViewer::RefreshIfRequired(G4VViewer* viewer) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
}
else {
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Issue /vis/viewer/refresh to see effect." << G4endl;
if (verbosity >= G4VisManager::warnings) {
G4cout << "Issue /vis/viewer/refresh or flush to see effect."
<< G4endl;
}
}
}
@@ -504,6 +506,84 @@ void G4VisCommandViewerClone::SetNewValue (G4UIcommand*, G4String newValue) {
}
}
////////////// /vis/viewer/copyViewFrom //////////////////////////
G4VisCommandViewerCopyViewFrom::G4VisCommandViewerCopyViewFrom () {
G4bool omitable;
fpCommand = new G4UIcmdWithAString ("/vis/viewer/copyViewFrom", this);
fpCommand -> SetGuidance
("Copy the camera-specific parameters from the specified viewer.");
fpCommand -> SetGuidance
("Note: To copy scene modifications - style, etc. - please use"
"\n\"/vis/viewer/set/all\"");
fpCommand -> SetParameterName ("from-viewer-name", omitable = false);
}
G4VisCommandViewerCopyViewFrom::~G4VisCommandViewerCopyViewFrom () {
delete fpCommand;
}
G4String G4VisCommandViewerCopyViewFrom::GetCurrentValue (G4UIcommand*) {
return "";
}
void G4VisCommandViewerCopyViewFrom::SetNewValue (G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VisCommandsViewerCopyViewFrom::SetNewValue: no current viewer."
<< G4endl;
}
return;
}
const G4String& fromViewerName = newValue;
G4VViewer* fromViewer = fpVisManager -> GetViewer (fromViewerName);
if (!fromViewer) {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: Viewer \"" << fromViewerName
<< "\" not found - \"/vis/viewer/list\" to see possibilities."
<< G4endl;
}
return;
}
if (fromViewer == currentViewer) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
"WARNING: G4VisCommandsViewerSet::SetNewValue:"
"\n from-viewer and current viewer are identical."
<< G4endl;
}
return;
}
// Copy camera-specific view parameters
G4ViewParameters vp = currentViewer->GetViewParameters();
const G4ViewParameters& fromVP = fromViewer->GetViewParameters();
vp.SetViewpointDirection (fromVP.GetViewpointDirection());
vp.SetLightpointDirection (fromVP.GetLightpointDirection());
vp.SetLightsMoveWithCamera(fromVP.GetLightsMoveWithCamera());
vp.SetUpVector (fromVP.GetUpVector());
vp.SetFieldHalfAngle (fromVP.GetFieldHalfAngle());
vp.SetZoomFactor (fromVP.GetZoomFactor());
vp.SetScaleFactor (fromVP.GetScaleFactor());
vp.SetCurrentTargetPoint (fromVP.GetCurrentTargetPoint());
vp.SetDolly (fromVP.GetDolly());
SetViewParameters(currentViewer, vp);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Camera parameters of viewer \"" << currentViewer->GetName()
<< "\"\n set to those of viewer \"" << fromViewer->GetName()
<< "\"."
<< G4endl;
}
}
////////////// /vis/viewer/create ///////////////////////////////////////
G4VisCommandViewerCreate::G4VisCommandViewerCreate (): fId (0) {
@@ -640,9 +720,9 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand*, G4String newValue) {
if (newName == nextName) fId++;
G4String newShortName = fpVisManager -> ViewerShortName (newName);
for (iHandler = 0; iHandler < nHandlers; iHandler++) {
G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
for (G4int ih = 0; ih < nHandlers; ih++) {
G4VSceneHandler* sh = sceneHandlerList [ih];
const G4ViewerList& viewerList = sh -> GetViewerList ();
for (size_t iViewer = 0; iViewer < viewerList.size (); iViewer++) {
if (viewerList [iViewer] -> GetShortName () == newShortName ) {
if (verbosity >= G4VisManager::errors) {
@@ -681,8 +761,9 @@ void G4VisCommandViewerCreate::SetNewValue (G4UIcommand*, G4String newValue) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
}
else {
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Issue /vis/viewer/refresh to see effect." << G4endl;
if (verbosity >= G4VisManager::warnings) {
G4cout << "Issue /vis/viewer/refresh or flush to see effect."
<< G4endl;
}
}
}
@@ -870,7 +951,8 @@ void G4VisCommandViewerList::SetNewValue (G4UIcommand*, G4String newValue) {
currentViewerShortName = "none";
}
const G4SceneHandlerList& sceneHandlerList = fpVisManager -> GetAvailableSceneHandlers ();
const G4SceneHandlerList& sceneHandlerList =
fpVisManager -> GetAvailableSceneHandlers ();
G4int nHandlers = sceneHandlerList.size ();
G4bool found = false;
G4bool foundCurrent = false;
@@ -1226,6 +1308,114 @@ void G4VisCommandViewerReset::SetNewValue (G4UIcommand*, G4String newValue) {
RefreshIfRequired(viewer);
}
////////////// /vis/viewer/save ///////////////////////////////////////
G4VisCommandViewerSave::G4VisCommandViewerSave () {
G4bool omitable;
fpCommand = new G4UIcmdWithAString ("/vis/viewer/save", this);
fpCommand -> SetGuidance
("Write commands that define the current view to file.");
fpCommand -> SetParameterName ("file-name", omitable = true);
fpCommand -> SetDefaultValue ("G4cout");
}
G4VisCommandViewerSave::~G4VisCommandViewerSave () {
delete fpCommand;
}
G4String G4VisCommandViewerSave::GetCurrentValue
(G4UIcommand*) {
return "";
}
namespace {
void WriteCommands
(std::ostream& os,
const G4ViewParameters& vp,
const G4Point3D& stp)
{
os
<< vp.CameraAndLightingCommands(stp)
<< vp.DrawingStyleCommands()
<< vp.SceneModifyingCommands()
<< vp.TouchableCommands()
<< std::endl;
}
}
void G4VisCommandViewerSave::SetNewValue (G4UIcommand*, G4String newValue) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
const G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
if (!currentViewer) {
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VisCommandsViewerSave::SetNewValue: no current viewer."
<< G4endl;
}
return;
}
const G4Scene* currentScene = currentViewer->GetSceneHandler()->GetScene();
if (!currentScene) {
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VisCommandsViewerSave::SetNewValue: no current scene."
<< G4endl;
}
return;
}
std::ofstream ofs;
if (newValue != "G4cout") {
// Check if file exists
std::ifstream ifs(newValue);
if (ifs) {
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VisCommandsViewerSave::SetNewValue: File \""
<< newValue << "\" already exists."
<< G4endl;
}
ifs.close();
return;
}
ofs.open(newValue);
if (!ofs) {
if (verbosity >= G4VisManager::errors) {
G4cout <<
"ERROR: G4VisCommandsViewerSave::SetNewValue: Trouble opening file \""
<< newValue << "\"."
<< G4endl;
}
ofs.close();
return;
}
}
const G4ViewParameters& vp = currentViewer->GetViewParameters();
const G4Point3D& stp = currentScene->GetStandardTargetPoint();
if (newValue == "G4cout") {
WriteCommands(G4cout,vp,stp);
} else {
WriteCommands(ofs,vp,stp);
ofs.close();
}
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Viewer \"" << currentViewer -> GetName ()
<< "\"" << " saved to ";
if (newValue == "G4cout") {
G4cout << "G4cout.";
} else {
G4cout << "file \'" << newValue << "\".";
}
G4cout << G4endl;
}
}
////////////// /vis/viewer/scale and scaleTo ////////////////////////////
G4VisCommandViewerScale::G4VisCommandViewerScale ():
@@ -29,18 +29,18 @@
// /vis/default commands - John Allison 30th October 2011
#include "G4VisCommandsDefault.hh"
#include "G4VisCommandsViewerDefault.hh"
#include "G4VisManager.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
////////////// /vis/default/hiddenEdge ///////////////////////////////////////
////////////// /vis/viewer/default/hiddenEdge ///////////////////////////////////////
G4VisCommandDefaultHiddenEdge::G4VisCommandDefaultHiddenEdge()
G4VisCommandViewerDefaultHiddenEdge::G4VisCommandViewerDefaultHiddenEdge()
{
G4bool omitable;
fpCommand = new G4UIcmdWithABool("/vis/default/hiddenEdge", this);
fpCommand = new G4UIcmdWithABool("/vis/viewer/default/hiddenEdge", this);
fpCommand->SetGuidance("Default hiddenEdge drawing for future viewers.");
fpCommand->SetGuidance
("Edges become hidden/seen in wireframe or surface mode.");
@@ -48,17 +48,17 @@ G4VisCommandDefaultHiddenEdge::G4VisCommandDefaultHiddenEdge()
fpCommand->SetDefaultValue(true);
}
G4VisCommandDefaultHiddenEdge::~G4VisCommandDefaultHiddenEdge()
G4VisCommandViewerDefaultHiddenEdge::~G4VisCommandViewerDefaultHiddenEdge()
{
delete fpCommand;
}
G4String G4VisCommandDefaultHiddenEdge::GetCurrentValue(G4UIcommand*)
G4String G4VisCommandViewerDefaultHiddenEdge::GetCurrentValue(G4UIcommand*)
{
return "";
}
void G4VisCommandDefaultHiddenEdge::SetNewValue(G4UIcommand*, G4String newValue)
void G4VisCommandViewerDefaultHiddenEdge::SetNewValue(G4UIcommand*, G4String newValue)
{
// Follows /vis/viewer/set/hiddenEdge
@@ -103,31 +103,31 @@ void G4VisCommandDefaultHiddenEdge::SetNewValue(G4UIcommand*, G4String newValue)
}
}
////////////// /vis/default/style ///////////////////////////////////////
////////////// /vis/viewer/default/style ///////////////////////////////////////
G4VisCommandDefaultStyle::G4VisCommandDefaultStyle()
G4VisCommandViewerDefaultStyle::G4VisCommandViewerDefaultStyle()
{
G4bool omitable;
fpCommand = new G4UIcmdWithAString("/vis/default/style", this);
fpCommand = new G4UIcmdWithAString("/vis/viewer/default/style", this);
fpCommand->SetGuidance("Default drawing style for future viewers.");
fpCommand->SetGuidance
("Set style of drawing - w[ireframe] or s[urface].");
fpCommand->SetGuidance
("(Default hidden line drawing is controlled by \"/vis/default/hiddenEdge\".)");
("(Default hidden line drawing is controlled by \"/vis/viewer/default/hiddenEdge\".)");
fpCommand->SetParameterName ("style",omitable = false);
}
G4VisCommandDefaultStyle::~G4VisCommandDefaultStyle()
G4VisCommandViewerDefaultStyle::~G4VisCommandViewerDefaultStyle()
{
delete fpCommand;
}
G4String G4VisCommandDefaultStyle::GetCurrentValue(G4UIcommand*)
G4String G4VisCommandViewerDefaultStyle::GetCurrentValue(G4UIcommand*)
{
return "";
}
void G4VisCommandDefaultStyle::SetNewValue(G4UIcommand*, G4String newValue)
void G4VisCommandViewerDefaultStyle::SetNewValue(G4UIcommand*, G4String newValue)
{
// Follows /vis/viewer/set/style
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewerSet.cc,v 1.53 2010-11-05 15:57:20 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -40,6 +39,7 @@
#include "G4UnitsTable.hh"
#include "G4VisManager.hh"
#include "G4Polyhedron.hh"
#include "G4SystemOfUnits.hh"
#include <sstream>
#include <cctype>
@@ -298,8 +298,11 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
("/vis/viewer/set/picking",this);
fpCommandPicking->SetGuidance("Sets picking, if available.");
fpCommandPicking->SetGuidance
("If true, view is set up for picking, if available."
"\nFor required actions, watch for instructions for viewer.");
("If true, view is set up for picking, if available.");
fpCommandPicking->SetGuidance
("You may need to issue \"/vis/viewer/update\".");
fpCommandPicking->SetGuidance
("For required actions, watch for instructions for viewer.");
fpCommandPicking->SetParameterName("picking",omitable = true);
fpCommandPicking->SetDefaultValue(true);
@@ -581,11 +584,17 @@ void G4VisCommandsViewerSet::SetNewValue
G4Colour colour(0.,0.,0.); // Default black and opaque.
const size_t iPos0 = 0;
if (std::isalpha(redOrString[iPos0])) {
G4Colour::GetColour(redOrString, colour); // Remains default (black) if
// not found.
if (!G4Colour::GetColour(redOrString, colour)) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Text colour \"" << redOrString
<< "\" not found. Defaulting to black and opaque."
<< G4endl;
}
}
} else {
colour = G4Colour(G4UIcommand::ConvertTo3Vector(newValue));
}
// Add opacity
colour = G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
vp.SetBackgroundColour(colour);
if (verbosity >= G4VisManager::confirmations) {
@@ -692,11 +701,17 @@ void G4VisCommandsViewerSet::SetNewValue
G4Colour colour(1.,1.,1.); // Default white and opaque.
const size_t iPos0 = 0;
if (std::isalpha(redOrString[iPos0])) {
G4Colour::GetColour(redOrString, colour); // Remains default (white) if
// not found.
if (!G4Colour::GetColour(redOrString, colour)) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Text colour \"" << redOrString
<< "\" not found. Defaulting to white and opaque."
<< G4endl;
}
}
} else {
colour = G4Colour(G4UIcommand::ConvertTo3Vector(newValue));
}
// Add opacity
colour = G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
G4VisAttributes va = vp.GetDefaultVisAttributes();
va.SetColour(colour);
@@ -717,11 +732,17 @@ void G4VisCommandsViewerSet::SetNewValue
G4Colour colour(1.,1.,1.); // Default white and opaque.
const size_t iPos0 = 0;
if (std::isalpha(redOrString[iPos0])) {
G4Colour::GetColour(redOrString, colour); // Remains default (white) if
// not found.
if (!G4Colour::GetColour(redOrString, colour)) {
if (verbosity >= G4VisManager::warnings) {
G4cout << "WARNING: Text colour \"" << redOrString
<< "\" not found. Defaulting to white and opaque."
<< G4endl;
}
}
} else {
colour = G4Colour(G4UIcommand::ConvertTo3Vector(newValue));
}
// Add opacity
colour = G4Colour(colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity);
G4VisAttributes va = vp.GetDefaultTextVisAttributes();
va.SetColour(colour);
@@ -853,9 +874,10 @@ void G4VisCommandsViewerSet::SetNewValue
}
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);
if (newValue.find("cam") != G4String::npos)
vp.SetLightsMoveWithCamera(true);
else if(newValue.find("obj") != G4String::npos)
vp.SetLightsMoveWithCamera(false);
else {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: \"" << newValue << "\" not recognised."
@@ -912,6 +934,10 @@ void G4VisCommandsViewerSet::SetNewValue
else G4cout << "inhibited.";
G4cout << G4endl;
}
if (verbosity >= G4VisManager::warnings) {
G4cout << "You may need to issue \"/vis/viewer/update\"."
<< G4endl;
}
}
else if (command == fpCommandProjection) {
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.6 2006-06-29 21:29:52 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
#include "G4VisFeaturesOfDAWNFILE.hh"
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.5 2006-06-29 21:29:54 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisFeaturesOfOpenGL.cc,v 1.6 2007-10-03 14:21:55 lgarnier Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisFeaturesOfOpenInventor.cc,v 1.5 2006-06-29 21:29:58 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VisManager.cc,v 1.131 2010-12-14 15:53:28 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -33,21 +32,19 @@
#include "G4VisCommands.hh"
#include "G4VisCommandsCompound.hh"
#include "G4VisCommandsDefault.hh"
#include "G4VisCommandsGeometry.hh"
#include "G4VisCommandsGeometrySet.hh"
#include "G4VisCommandsSet.hh"
#include "G4VisCommandsScene.hh"
#include "G4VisCommandsSceneAdd.hh"
#include "G4VisCommandsSceneHandler.hh"
#include "G4VisCommandsTouchableSet.hh"
#include "G4VisCommandsViewer.hh"
#include "G4VisCommandsViewerDefault.hh"
#include "G4VisCommandsViewerSet.hh"
#include "G4UImanager.hh"
#include "G4VisStateDependent.hh"
#include "G4UIdirectory.hh"
#include "G4VisFeaturesOfFukuiRenderer.hh"
#include "G4VisFeaturesOfDAWNFILE.hh"
#include "G4VisFeaturesOfOpenGL.hh"
#include "G4VisFeaturesOfOpenInventor.hh"
#include "G4VGraphicsSystem.hh"
#include "G4VSceneHandler.hh"
#include "G4VViewer.hh"
@@ -75,6 +72,9 @@
#include "G4EventManager.hh"
#include "G4Run.hh"
#include "G4Event.hh"
#include <map>
#include <set>
#include <vector>
#include <sstream>
G4VisManager* G4VisManager::fpInstance = 0;
@@ -84,7 +84,6 @@ G4VisManager::Verbosity G4VisManager::fVerbosity = G4VisManager::warnings;
G4VisManager::G4VisManager (const G4String& verbosityString):
fVerbose (1),
fInitialised (false),
fpUserVisAction (0),
fpGraphicsSystem (0),
fpScene (0),
fpSceneHandler (0),
@@ -96,7 +95,9 @@ G4VisManager::G4VisManager (const G4String& verbosityString):
fEventKeepingSuspended (false),
fKeptLastEvent (false),
fpRequestedEvent (0),
fAbortReviewKeptEvents (false)
fAbortReviewKeptEvents (false),
fIsDrawGroup (false),
fDrawGroupNestingDepth (0)
// All other objects use default constructors.
{
fpTrajDrawModelMgr = new G4VisModelManager<G4VTrajectoryModel>("/vis/modeling/trajectories");
@@ -173,7 +174,10 @@ G4VisManager::G4VisManager (const G4String& verbosityString):
directory -> SetGuidance ("Visualization commands.");
fDirectoryList.push_back (directory);
// Instantiate top level basic commands
// Instantiate *basic* top level commands so that they can be used
// immediately after instantiation of the vis manager. Other top
// level and lower level commands are instantiated later in
// RegisterMessengers.
G4VVisCommand::SetVisManager (this); // Sets shared pointer
RegisterMessenger(new G4VisCommandVerbose);
RegisterMessenger(new G4VisCommandInitialize);
@@ -319,6 +323,11 @@ void G4VisManager::Initialise () {
G4cout << G4endl;
}
if (fVerbosity >= startup) {
PrintAvailableUserVisActions (fVerbosity);
G4cout << G4endl;
}
if (fVerbosity >= startup) {
PrintAvailableColours (fVerbosity);
G4cout << G4endl;
@@ -327,6 +336,171 @@ void G4VisManager::Initialise () {
fInitialised = true;
}
void G4VisManager::RegisterMessengers () {
// Instantiate individual messengers/commands (often - but not
// always - one command per messenger).
G4UIcommand* directory;
// *Basic* top level commands were instantiated in the constructor
// so that they can be used immediately after instantiation of the
// vis manager. Other top level and lower level commands are
// instantiated here.
// Other top level commands...
RegisterMessenger(new G4VisCommandAbortReviewKeptEvents);
RegisterMessenger(new G4VisCommandEnable);
RegisterMessenger(new G4VisCommandList);
RegisterMessenger(new G4VisCommandReviewKeptEvents);
// Compound commands...
RegisterMessenger(new G4VisCommandDrawTree);
RegisterMessenger(new G4VisCommandDrawView);
RegisterMessenger(new G4VisCommandDrawVolume);
RegisterMessenger(new G4VisCommandOpen);
RegisterMessenger(new G4VisCommandSpecify);
directory = new G4UIdirectory ("/vis/geometry/");
directory -> SetGuidance("Operations on vis attributes of Geant4 geometry.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandGeometryList);
RegisterMessenger(new G4VisCommandGeometryRestore);
directory = new G4UIdirectory ("/vis/geometry/set/");
directory -> SetGuidance("Set vis attributes of Geant4 geometry.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandGeometrySetColour);
RegisterMessenger(new G4VisCommandGeometrySetDaughtersInvisible);
RegisterMessenger(new G4VisCommandGeometrySetLineStyle);
RegisterMessenger(new G4VisCommandGeometrySetLineWidth);
RegisterMessenger(new G4VisCommandGeometrySetForceAuxEdgeVisible);
RegisterMessenger(new G4VisCommandGeometrySetForceLineSegmentsPerCircle);
RegisterMessenger(new G4VisCommandGeometrySetForceSolid);
RegisterMessenger(new G4VisCommandGeometrySetForceWireframe);
RegisterMessenger(new G4VisCommandGeometrySetVisibility);
directory = new G4UIdirectory ("/vis/set/");
directory -> SetGuidance
("Set quantities for use in future commands where appropriate.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandSetColour);
RegisterMessenger(new G4VisCommandSetLineWidth);
RegisterMessenger(new G4VisCommandSetTextColour);
RegisterMessenger(new G4VisCommandSetTextLayout);
RegisterMessenger(new G4VisCommandSetTouchable);
directory = new G4UIdirectory ("/vis/scene/");
directory -> SetGuidance ("Operations on Geant4 scenes.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandSceneActivateModel);
RegisterMessenger(new G4VisCommandSceneCreate);
RegisterMessenger(new G4VisCommandSceneEndOfEventAction);
RegisterMessenger(new G4VisCommandSceneEndOfRunAction);
RegisterMessenger(new G4VisCommandSceneList);
RegisterMessenger(new G4VisCommandSceneNotifyHandlers);
RegisterMessenger(new G4VisCommandSceneSelect);
directory = new G4UIdirectory ("/vis/scene/add/");
directory -> SetGuidance ("Add model to current scene.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandSceneAddArrow);
RegisterMessenger(new G4VisCommandSceneAddArrow2D);
RegisterMessenger(new G4VisCommandSceneAddAxes);
RegisterMessenger(new G4VisCommandSceneAddDate);
RegisterMessenger(new G4VisCommandSceneAddDigis);
RegisterMessenger(new G4VisCommandSceneAddEventID);
RegisterMessenger(new G4VisCommandSceneAddFrame);
RegisterMessenger(new G4VisCommandSceneAddGhosts);
RegisterMessenger(new G4VisCommandSceneAddHits);
RegisterMessenger(new G4VisCommandSceneAddLine);
RegisterMessenger(new G4VisCommandSceneAddLine2D);
RegisterMessenger(new G4VisCommandSceneAddLogicalVolume);
RegisterMessenger(new G4VisCommandSceneAddLogo);
RegisterMessenger(new G4VisCommandSceneAddLogo2D);
RegisterMessenger(new G4VisCommandSceneAddPSHits);
RegisterMessenger(new G4VisCommandSceneAddScale);
RegisterMessenger(new G4VisCommandSceneAddText);
RegisterMessenger(new G4VisCommandSceneAddText2D);
RegisterMessenger(new G4VisCommandSceneAddTrajectories);
RegisterMessenger(new G4VisCommandSceneAddUserAction);
RegisterMessenger(new G4VisCommandSceneAddVolume);
directory = new G4UIdirectory ("/vis/sceneHandler/");
directory -> SetGuidance ("Operations on Geant4 scene handlers.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandSceneHandlerAttach);
RegisterMessenger(new G4VisCommandSceneHandlerCreate);
RegisterMessenger(new G4VisCommandSceneHandlerList);
RegisterMessenger(new G4VisCommandSceneHandlerSelect);
directory = new G4UIdirectory ("/vis/touchable/");
directory -> SetGuidance ("Operations on touchables.");
directory = new G4UIdirectory ("/vis/touchable/set/");
directory -> SetGuidance ("Set vis attributes of current touchable.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandsTouchableSet);
directory = new G4UIdirectory ("/vis/viewer/");
directory -> SetGuidance ("Operations on Geant4 viewers.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandViewerAddCutawayPlane);
RegisterMessenger(new G4VisCommandViewerChangeCutawayPlane);
RegisterMessenger(new G4VisCommandViewerClear);
RegisterMessenger(new G4VisCommandViewerClearCutawayPlanes);
RegisterMessenger(new G4VisCommandViewerClearTransients);
RegisterMessenger(new G4VisCommandViewerClone);
RegisterMessenger(new G4VisCommandViewerCopyViewFrom);
RegisterMessenger(new G4VisCommandViewerCreate);
RegisterMessenger(new G4VisCommandViewerDolly);
RegisterMessenger(new G4VisCommandViewerFlush);
RegisterMessenger(new G4VisCommandViewerList);
RegisterMessenger(new G4VisCommandViewerPan);
RegisterMessenger(new G4VisCommandViewerRebuild);
RegisterMessenger(new G4VisCommandViewerRefresh);
RegisterMessenger(new G4VisCommandViewerReset);
RegisterMessenger(new G4VisCommandViewerSave);
RegisterMessenger(new G4VisCommandViewerScale);
RegisterMessenger(new G4VisCommandViewerSelect);
RegisterMessenger(new G4VisCommandViewerUpdate);
RegisterMessenger(new G4VisCommandViewerZoom);
directory = new G4UIdirectory ("/vis/viewer/default/");
directory -> SetGuidance("Set default values for future viewers.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandViewerDefaultHiddenEdge);
RegisterMessenger(new G4VisCommandViewerDefaultStyle);
directory = new G4UIdirectory ("/vis/viewer/set/");
directory -> SetGuidance ("Set view parameters of current viewer.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandsViewerSet);
// List manager commands
RegisterMessenger(new G4VisCommandListManagerList< G4VisModelManager<G4VTrajectoryModel> >
(fpTrajDrawModelMgr, fpTrajDrawModelMgr->Placement()));
RegisterMessenger(new G4VisCommandListManagerSelect< G4VisModelManager<G4VTrajectoryModel> >
(fpTrajDrawModelMgr, fpTrajDrawModelMgr->Placement()));
// Trajectory filter manager commands
RegisterMessenger(new G4VisCommandListManagerList< G4VisFilterManager<G4VTrajectory> >
(fpTrajFilterMgr, fpTrajFilterMgr->Placement()));
RegisterMessenger(new G4VisCommandManagerMode< G4VisFilterManager<G4VTrajectory> >
(fpTrajFilterMgr, fpTrajFilterMgr->Placement()));
// Hit filter manager commands
RegisterMessenger(new G4VisCommandListManagerList< G4VisFilterManager<G4VHit> >
(fpHitFilterMgr, fpHitFilterMgr->Placement()));
RegisterMessenger(new G4VisCommandManagerMode< G4VisFilterManager<G4VHit> >
(fpHitFilterMgr, fpHitFilterMgr->Placement()));
// Digi filter manager commands
RegisterMessenger(new G4VisCommandListManagerList< G4VisFilterManager<G4VDigi> >
(fpDigiFilterMgr, fpDigiFilterMgr->Placement()));
RegisterMessenger(new G4VisCommandManagerMode< G4VisFilterManager<G4VDigi> >
(fpDigiFilterMgr, fpDigiFilterMgr->Placement()));
}
void G4VisManager::Enable() {
if (IsValidView ()) {
if (fVerbosity >= confirmations) {
@@ -471,184 +645,233 @@ void G4VisManager::SelectTrajectoryModel(const G4String& model)
fpTrajDrawModelMgr->SetCurrent(model);
}
void G4VisManager::Draw (const G4Circle& circle,
const G4Transform3D& objectTransform) {
void G4VisManager::BeginDraw (const G4Transform3D& objectTransform)
{
fDrawGroupNestingDepth++;
if (fDrawGroupNestingDepth > 1) {
G4Exception
("G4VSceneHandler::BeginDraw",
"visman0008", JustWarning,
"Nesting detected. It is illegal to nest Begin/EndDraw."
"\n Ignored");
return;
}
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (circle);
fIsDrawGroup = true;
}
}
void G4VisManager::EndDraw ()
{
fDrawGroupNestingDepth--;
if (fDrawGroupNestingDepth != 0) {
if (fDrawGroupNestingDepth < 0) fDrawGroupNestingDepth = 0;
return;
}
if (IsValidView ()) {
fpSceneHandler -> EndPrimitives ();
}
fIsDrawGroup = false;
}
void G4VisManager::BeginDraw2D (const G4Transform3D& objectTransform)
{
fDrawGroupNestingDepth++;
if (fDrawGroupNestingDepth > 1) {
G4Exception
("G4VSceneHandler::BeginDraw2D",
"visman0009", JustWarning,
"Nesting detected. It is illegal to nest Begin/EndDraw2D."
"\n Ignored");
return;
}
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives2D (objectTransform);
fIsDrawGroup = true;
}
}
void G4VisManager::EndDraw2D ()
{
fDrawGroupNestingDepth--;
if (fDrawGroupNestingDepth != 0) {
if (fDrawGroupNestingDepth < 0) fDrawGroupNestingDepth = 0;
return;
}
if (IsValidView ()) {
fpSceneHandler -> EndPrimitives2D ();
}
fIsDrawGroup = false;
}
template <class T> void G4VisManager::DrawT
(const T& graphics_primitive, const G4Transform3D& objectTransform) {
if (fIsDrawGroup) {
if (objectTransform != fpSceneHandler->GetObjectTransformation()) {
G4Exception
("G4VSceneHandler::DrawT",
"visman0010", FatalException,
"Different transform detected in Begin/EndDraw group.");
}
fpSceneHandler -> AddPrimitive (graphics_primitive);
} else {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (graphics_primitive);
fpSceneHandler -> EndPrimitives ();
}
}
}
template <class T> void G4VisManager::DrawT2D
(const T& graphics_primitive, const G4Transform3D& objectTransform) {
if (fIsDrawGroup) {
if (objectTransform != fpSceneHandler->GetObjectTransformation()) {
G4Exception
("G4VSceneHandler::DrawT",
"visman0011", FatalException,
"Different transform detected in Begin/EndDraw2D group.");
}
fpSceneHandler -> AddPrimitive (graphics_primitive);
} else {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives2D (objectTransform);
fpSceneHandler -> AddPrimitive (graphics_primitive);
fpSceneHandler -> EndPrimitives2D ();
}
}
}
void G4VisManager::Draw (const G4Circle& circle,
const G4Transform3D& objectTransform)
{
DrawT (circle, objectTransform);
}
void G4VisManager::Draw (const G4NURBS& nurbs,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (nurbs);
fpSceneHandler -> EndPrimitives ();
}
const G4Transform3D& objectTransform)
{
DrawT (nurbs, objectTransform);
}
void G4VisManager::Draw (const G4Polyhedron& polyhedron,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (polyhedron);
fpSceneHandler -> EndPrimitives ();
}
const G4Transform3D& objectTransform)
{
DrawT (polyhedron, objectTransform);
}
void G4VisManager::Draw (const G4Polyline& line,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (line);
fpSceneHandler -> EndPrimitives ();
}
const G4Transform3D& objectTransform)
{
DrawT (line, objectTransform);
}
void G4VisManager::Draw (const G4Polymarker& polymarker,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (polymarker);
fpSceneHandler -> EndPrimitives ();
}
const G4Transform3D& objectTransform)
{
DrawT (polymarker, objectTransform);
}
void G4VisManager::Draw (const G4Scale& scale,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (scale);
fpSceneHandler -> EndPrimitives ();
}
const G4Transform3D& objectTransform)
{
DrawT (scale, objectTransform);
}
void G4VisManager::Draw (const G4Square& square,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (square);
fpSceneHandler -> EndPrimitives ();
}
const G4Transform3D& objectTransform)
{
DrawT (square, objectTransform);
}
void G4VisManager::Draw (const G4Text& text,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives (objectTransform);
fpSceneHandler -> AddPrimitive (text);
fpSceneHandler -> EndPrimitives ();
}
const G4Transform3D& objectTransform)
{
DrawT (text, objectTransform);
}
void G4VisManager::Draw2D (const G4Circle& circle,
const G4Transform3D& objectTransform)
{
if (IsValidView()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives2D(objectTransform);
fpSceneHandler -> AddPrimitive(circle);
fpSceneHandler -> EndPrimitives2D();
}
DrawT2D (circle, objectTransform);
}
void G4VisManager::Draw2D (const G4NURBS& nurbs,
const G4Transform3D& objectTransform)
{
if (IsValidView()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives2D(objectTransform);
fpSceneHandler -> AddPrimitive(nurbs);
fpSceneHandler -> EndPrimitives2D();
}
DrawT2D (nurbs, objectTransform);
}
void G4VisManager::Draw2D (const G4Polyhedron& polyhedron,
const G4Transform3D& objectTransform)
{
if (IsValidView()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives2D(objectTransform);
fpSceneHandler -> AddPrimitive(polyhedron);
fpSceneHandler -> EndPrimitives2D();
}
DrawT2D (polyhedron, objectTransform);
}
void G4VisManager::Draw2D (const G4Polyline& line,
const G4Transform3D& objectTransform)
{
if (IsValidView()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives2D(objectTransform);
fpSceneHandler -> AddPrimitive(line);
fpSceneHandler -> EndPrimitives2D();
}
DrawT2D (line, objectTransform);
}
void G4VisManager::Draw2D (const G4Polymarker& polymarker,
const G4Transform3D& objectTransform)
{
if (IsValidView()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives2D(objectTransform);
fpSceneHandler -> AddPrimitive(polymarker);
fpSceneHandler -> EndPrimitives2D();
}
DrawT2D (polymarker, objectTransform);
}
void G4VisManager::Draw2D (const G4Square& square,
const G4Transform3D& objectTransform)
{
if (IsValidView()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives2D(objectTransform);
fpSceneHandler -> AddPrimitive(square);
fpSceneHandler -> EndPrimitives2D();
}
DrawT2D (square, objectTransform);
}
void G4VisManager::Draw2D (const G4Text& text,
const G4Transform3D& objectTransform)
{
if (IsValidView()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> BeginPrimitives2D(objectTransform);
fpSceneHandler -> AddPrimitive(text);
fpSceneHandler -> EndPrimitives2D();
}
DrawT2D (text, objectTransform);
}
void G4VisManager::Draw (const G4VHit& hit) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
if (fIsDrawGroup) {
fpSceneHandler -> AddCompound (hit);
} else {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> AddCompound (hit);
}
}
}
void G4VisManager::Draw (const G4VDigi& digi) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
if (fIsDrawGroup) {
fpSceneHandler -> AddCompound (digi);
} else {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> AddCompound (digi);
}
}
}
void G4VisManager::Draw (const G4VTrajectory& traj,
G4int i_mode) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
if (fIsDrawGroup) {
fpSceneHandler -> SetModel (&dummyTrajectoriesModel);
dummyTrajectoriesModel.SetDrawingMode(i_mode);
fpSceneHandler -> AddCompound (traj);
} else {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> SetModel (&dummyTrajectoriesModel);
dummyTrajectoriesModel.SetDrawingMode(i_mode);
fpSceneHandler -> AddCompound (traj);
}
}
}
@@ -663,11 +886,17 @@ void G4VisManager::Draw (const G4LogicalVolume& logicalVol,
void G4VisManager::Draw (const G4VSolid& solid,
const G4VisAttributes& attribs,
const G4Transform3D& objectTransform) {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
if (fIsDrawGroup) {
fpSceneHandler -> PreAddSolid (objectTransform, attribs);
solid.DescribeYourselfTo (*fpSceneHandler);
fpSceneHandler -> PostAddSolid ();
} else {
if (IsValidView ()) {
ClearTransientStoreIfMarked();
fpSceneHandler -> PreAddSolid (objectTransform, attribs);
solid.DescribeYourselfTo (*fpSceneHandler);
fpSceneHandler -> PostAddSolid ();
}
}
}
@@ -802,22 +1031,21 @@ void G4VisManager::GeometryHasChanged () {
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
G4Scene* pScene = sceneList [iScene];
std::vector<G4VModel*>& modelList = pScene -> SetRunDurationModelList ();
std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
if (modelList.size ()) {
G4bool modelInvalid;
do { // Remove, if required, one at a time.
modelInvalid = false;
std::vector<G4VModel*>::iterator iterModel;
std::vector<G4Scene::Model>::iterator iterModel;
for (iterModel = modelList.begin();
iterModel != modelList.end();
++iterModel) {
modelInvalid = !((*iterModel) -> Validate (fVerbosity >= warnings));
modelInvalid = !(iterModel->fpModel->Validate(fVerbosity>=warnings));
if (modelInvalid) {
// Model invalid - remove and break.
if (fVerbosity >= warnings) {
G4cout << "WARNING: Model \""
<< (*iterModel) -> GetGlobalDescription ()
<< iterModel->fpModel->GetGlobalDescription ()
<<
"\" is no longer valid - being removed\n from scene \""
<< pScene -> GetName () << "\""
@@ -867,7 +1095,7 @@ void G4VisManager::NotifyHandlers () {
G4int iScene, nScenes = sceneList.size ();
for (iScene = 0; iScene < nScenes; iScene++) {
G4Scene* pScene = sceneList [iScene];
std::vector<G4VModel*>& modelList = pScene -> SetRunDurationModelList ();
std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
if (modelList.size ()) {
pScene->CalculateExtent();
@@ -964,16 +1192,48 @@ void G4VisManager::DispatchToModel(const G4VTrajectory& trajectory, G4int i_mode
}
}
void G4VisManager::SetUserAction
(G4VUserVisAction* pVisAction,
void G4VisManager::RegisterRunDurationUserVisAction
(const G4String& name,
G4VUserVisAction* pVisAction,
const G4VisExtent& extent) {
fpUserVisAction = pVisAction;
fUserVisActionExtent = extent;
fRunDurationUserVisActions.push_back(UserVisAction(name,pVisAction));
if (extent.GetExtentRadius() > 0.) {
fUserVisActionExtents[pVisAction] = extent;
} else {
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: No extent set for user vis action \"" << name << "\"."
<< G4endl;
}
}
}
void G4VisManager::RegisterEndOfEventUserVisAction
(const G4String& name,
G4VUserVisAction* pVisAction,
const G4VisExtent& extent) {
fEndOfEventUserVisActions.push_back(UserVisAction(name,pVisAction));
if (extent.GetExtentRadius() > 0.) {
fUserVisActionExtents[pVisAction] = extent;
} else {
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: No extent set for user vis action \"" << name << "\"."
<< G4endl;
}
}
}
void G4VisManager::RegisterEndOfRunUserVisAction
(const G4String& name,
G4VUserVisAction* pVisAction,
const G4VisExtent& extent) {
fEndOfRunUserVisActions.push_back(UserVisAction(name,pVisAction));
fUserVisActionExtents[pVisAction] = extent;
if (extent.GetExtentRadius() <= 0.) {
if (fVerbosity >= warnings) {
G4cout <<
"WARNING: No extent set for user vis action. (You may"
"\n set it later when adding with /vis/scene/add/userAction.)"
"WARNING: No extent set for user vis action \"" << name << "\"."
<< G4endl;
}
}
@@ -1107,148 +1367,36 @@ void G4VisManager::SetCurrentViewer (G4VViewer* pViewer) {
}
}
void G4VisManager::RegisterMessengers () {
// Instantiate individual messengers/commands (often - but not
// always - one command per messenger).
G4UIcommand* directory;
// Top level commands...
RegisterMessenger(new G4VisCommandAbortReviewKeptEvents);
RegisterMessenger(new G4VisCommandEnable);
RegisterMessenger(new G4VisCommandList);
RegisterMessenger(new G4VisCommandReviewKeptEvents);
// Compound commands...
RegisterMessenger(new G4VisCommandDrawTree);
RegisterMessenger(new G4VisCommandDrawView);
RegisterMessenger(new G4VisCommandDrawVolume);
RegisterMessenger(new G4VisCommandOpen);
RegisterMessenger(new G4VisCommandSpecify);
directory = new G4UIdirectory ("/vis/default/");
directory -> SetGuidance("Set default values for future operations.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandDefaultHiddenEdge);
RegisterMessenger(new G4VisCommandDefaultStyle);
directory = new G4UIdirectory ("/vis/geometry/");
directory -> SetGuidance("Operations on vis attributes of Geant4 geometry.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandGeometryList);
RegisterMessenger(new G4VisCommandGeometryRestore);
directory = new G4UIdirectory ("/vis/geometry/set/");
directory -> SetGuidance("Set vis attributes of Geant4 geometry.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandGeometrySetColour);
RegisterMessenger(new G4VisCommandGeometrySetDaughtersInvisible);
RegisterMessenger(new G4VisCommandGeometrySetLineStyle);
RegisterMessenger(new G4VisCommandGeometrySetLineWidth);
RegisterMessenger(new G4VisCommandGeometrySetForceAuxEdgeVisible);
RegisterMessenger(new G4VisCommandGeometrySetForceLineSegmentsPerCircle);
RegisterMessenger(new G4VisCommandGeometrySetForceSolid);
RegisterMessenger(new G4VisCommandGeometrySetForceWireframe);
RegisterMessenger(new G4VisCommandGeometrySetVisibility);
directory = new G4UIdirectory ("/vis/scene/");
directory -> SetGuidance ("Operations on Geant4 scenes.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandSceneCreate);
RegisterMessenger(new G4VisCommandSceneEndOfEventAction);
RegisterMessenger(new G4VisCommandSceneEndOfRunAction);
RegisterMessenger(new G4VisCommandSceneList);
RegisterMessenger(new G4VisCommandSceneNotifyHandlers);
RegisterMessenger(new G4VisCommandSceneSelect);
directory = new G4UIdirectory ("/vis/scene/add/");
directory -> SetGuidance ("Add model to current scene.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandSceneAddAxes);
RegisterMessenger(new G4VisCommandSceneAddEventID);
RegisterMessenger(new G4VisCommandSceneAddGhosts);
RegisterMessenger(new G4VisCommandSceneAddHits);
RegisterMessenger(new G4VisCommandSceneAddDigis);
RegisterMessenger(new G4VisCommandSceneAddLogicalVolume);
RegisterMessenger(new G4VisCommandSceneAddLogo);
RegisterMessenger(new G4VisCommandSceneAddPSHits);
RegisterMessenger(new G4VisCommandSceneAddScale);
RegisterMessenger(new G4VisCommandSceneAddText);
RegisterMessenger(new G4VisCommandSceneAddTrajectories);
RegisterMessenger(new G4VisCommandSceneAddUserAction);
RegisterMessenger(new G4VisCommandSceneAddVolume);
directory = new G4UIdirectory ("/vis/sceneHandler/");
directory -> SetGuidance ("Operations on Geant4 scene handlers.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandSceneHandlerAttach);
RegisterMessenger(new G4VisCommandSceneHandlerCreate);
RegisterMessenger(new G4VisCommandSceneHandlerList);
RegisterMessenger(new G4VisCommandSceneHandlerSelect);
directory = new G4UIdirectory ("/vis/viewer/");
directory -> SetGuidance ("Operations on Geant4 viewers.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandViewerAddCutawayPlane);
RegisterMessenger(new G4VisCommandViewerChangeCutawayPlane);
RegisterMessenger(new G4VisCommandViewerClear);
RegisterMessenger(new G4VisCommandViewerClearCutawayPlanes);
RegisterMessenger(new G4VisCommandViewerClearTransients);
RegisterMessenger(new G4VisCommandViewerClone);
RegisterMessenger(new G4VisCommandViewerCreate);
RegisterMessenger(new G4VisCommandViewerDolly);
RegisterMessenger(new G4VisCommandViewerFlush);
RegisterMessenger(new G4VisCommandViewerList);
RegisterMessenger(new G4VisCommandViewerPan);
RegisterMessenger(new G4VisCommandViewerRebuild);
RegisterMessenger(new G4VisCommandViewerRefresh);
RegisterMessenger(new G4VisCommandViewerReset);
RegisterMessenger(new G4VisCommandViewerScale);
RegisterMessenger(new G4VisCommandViewerSelect);
RegisterMessenger(new G4VisCommandViewerUpdate);
RegisterMessenger(new G4VisCommandViewerZoom);
directory = new G4UIdirectory ("/vis/viewer/set/");
directory -> SetGuidance ("Set view parameters of current viewer.");
fDirectoryList.push_back (directory);
RegisterMessenger(new G4VisCommandsViewerSet);
// List manager commands
RegisterMessenger(new G4VisCommandListManagerList< G4VisModelManager<G4VTrajectoryModel> >
(fpTrajDrawModelMgr, fpTrajDrawModelMgr->Placement()));
RegisterMessenger(new G4VisCommandListManagerSelect< G4VisModelManager<G4VTrajectoryModel> >
(fpTrajDrawModelMgr, fpTrajDrawModelMgr->Placement()));
// Trajectory filter manager commands
RegisterMessenger(new G4VisCommandListManagerList< G4VisFilterManager<G4VTrajectory> >
(fpTrajFilterMgr, fpTrajFilterMgr->Placement()));
RegisterMessenger(new G4VisCommandManagerMode< G4VisFilterManager<G4VTrajectory> >
(fpTrajFilterMgr, fpTrajFilterMgr->Placement()));
// Hit filter manager commands
RegisterMessenger(new G4VisCommandListManagerList< G4VisFilterManager<G4VHit> >
(fpHitFilterMgr, fpHitFilterMgr->Placement()));
RegisterMessenger(new G4VisCommandManagerMode< G4VisFilterManager<G4VHit> >
(fpHitFilterMgr, fpHitFilterMgr->Placement()));
// Digi filter manager commands
RegisterMessenger(new G4VisCommandListManagerList< G4VisFilterManager<G4VDigi> >
(fpDigiFilterMgr, fpDigiFilterMgr->Placement()));
RegisterMessenger(new G4VisCommandManagerMode< G4VisFilterManager<G4VDigi> >
(fpDigiFilterMgr, fpDigiFilterMgr->Placement()));
namespace {
struct NicknameComparison {
bool operator() (const G4String& lhs, const G4String& rhs) const
{return lhs.length()<rhs.length();}
};
}
void G4VisManager::PrintAvailableGraphicsSystems () const {
G4int nSystems = fAvailableGraphicsSystems.size ();
G4cout << "Current available graphics systems are:";
if (nSystems) {
for (int i = 0; i < nSystems; i++) {
const G4VGraphicsSystem* pSystem = fAvailableGraphicsSystems [i];
G4cout << "\n " << pSystem -> GetName ();
if (pSystem -> GetNickname () != "") {
G4cout << " (" << pSystem -> GetNickname () << ")";
// Make a map of graphics systems names (there may be repeated systems)
// and for each name a set of nicknames. The nicknames are ordered
// by length - see struct NicknameComparison above.
std::map<G4String,std::set<G4String,NicknameComparison> > systemMap;
for (G4int i = 0; i < nSystems; i++) {
const G4VGraphicsSystem* pSystem = fAvailableGraphicsSystems[i];
systemMap[pSystem->GetName()].insert(pSystem->GetNickname());
}
// Print the map.
std::map<G4String,std::set<G4String,NicknameComparison> >::const_iterator i;
for (i = systemMap.begin(); i != systemMap.end(); ++i) {
G4cout << "\n " << i->first << " (";
const std::set<G4String,NicknameComparison>& nicknames = i->second;
std::set<G4String,NicknameComparison>::const_iterator j;
for (j = nicknames.begin(); j != nicknames.end(); ++j) {
if (j != nicknames.begin()) G4cout << ", ";
G4cout << *j;
}
G4cout << ')';
}
}
else {
@@ -1312,6 +1460,42 @@ void G4VisManager::PrintAvailableModels (Verbosity verbosity) const
}
}
void G4VisManager::PrintAvailableUserVisActions (Verbosity) const
{
G4cout <<
"You have successfully registered the following user vis actions."
<< G4endl;
G4cout << "Run Duration User Vis Actions:";
if (fRunDurationUserVisActions.empty()) G4cout << " none" << G4endl;
else {
G4cout << G4endl;
for (size_t i = 0; i < fRunDurationUserVisActions.size(); i++) {
const G4String& name = fRunDurationUserVisActions[i].fName;
G4cout << " " << name << G4endl;
}
}
G4cout << "End of Event User Vis Actions:";
if (fEndOfEventUserVisActions.empty()) G4cout << " none" << G4endl;
else {
G4cout << G4endl;
for (size_t i = 0; i < fEndOfEventUserVisActions.size(); i++) {
const G4String& name = fEndOfEventUserVisActions[i].fName;
G4cout << " " << name << G4endl;
}
}
G4cout << "End of Run User Vis Actions:";
if (fEndOfRunUserVisActions.empty()) G4cout << " none" << G4endl;
else {
G4cout << G4endl;
for (size_t i = 0; i < fEndOfRunUserVisActions.size(); i++) {
const G4String& name = fEndOfRunUserVisActions[i].fName;
G4cout << " " << name << G4endl;
}
}
}
void G4VisManager::PrintAvailableColours (Verbosity) const {
G4cout <<
"Some /vis commands (optionally) take a string to specify colour."
@@ -1383,7 +1567,17 @@ void G4VisManager::EndOfEvent ()
const G4Event* currentEvent = eventManager->GetConstCurrentEvent();
if (!currentEvent) return;
// We are about to draw the event (trajectories, etc.), but first we
// have to clear the previous event(s) if necessary. If this event
// needs to be drawn afresh, e.g., the first event or any event when
// "accumulate" is not requested, the old event has to be cleared.
// We have postponed this so that, for normal viewers like OGL, the
// previous event(s) stay on screen until this new event comes
// along. For a file-writing viewer the geometry has to be drawn.
// See, for example, G4HepRepFileSceneHandler::ClearTransientStore.
ClearTransientStoreIfMarked();
// Now draw the event...
fpSceneHandler->DrawEvent(currentEvent);
G4int nEventsToBeProcessed = 0;
@@ -1401,8 +1595,10 @@ void G4VisManager::EndOfEvent ()
// Unless last event (in which case wait end of run)...
if (eventID < nEventsToBeProcessed - 1) {
// ShowView guarantees the view comes to the screen. No action
// is taken for normal viewers like OGL, but file-writing
// viewers have to close the file.
fpViewer->ShowView();
fpViewer->DrawView();
fpSceneHandler->SetMarkForClearingTransientStore(true);
} else { // Last event...
// Keep, but only if user has not kept any...
@@ -1447,7 +1643,14 @@ void G4VisManager::EndOfRun ()
if (!fpSceneHandler->GetMarkForClearingTransientStore()) {
if (fpScene->GetRefreshAtEndOfRun()) {
fpSceneHandler->DrawEndOfRunModels();
// ShowView guarantees the view comes to the screen. No
// action is taken for normal viewers like OGL, but
// file-writing viewers have to close the file.
fpViewer->ShowView();
// An extra refresh for auto-refresh viewers
if (fpViewer->GetViewParameters().IsAutoRefresh()) {
fpViewer->RefreshView();
}
fpSceneHandler->SetMarkForClearingTransientStore(true);
}
}
@@ -1557,33 +1760,33 @@ G4VViewer* G4VisManager::GetViewer (const G4String& viewerName) const {
std::vector<G4String> G4VisManager::VerbosityGuidanceStrings;
G4String G4VisManager::VerbosityString(Verbosity verbosity) {
G4String s;
G4String rs;
switch (verbosity) {
case quiet: s = "quiet (0)"; break;
case startup: s = "startup (1)"; break;
case errors: s = "errors (2)"; break;
case warnings: s = "warnings (3)"; break;
case confirmations: s = "confirmations (4)"; break;
case parameters: s = "parameters (5)"; break;
case all: s = "all (6)"; break;
case quiet: rs = "quiet (0)"; break;
case startup: rs = "startup (1)"; break;
case errors: rs = "errors (2)"; break;
case warnings: rs = "warnings (3)"; break;
case confirmations: rs = "confirmations (4)"; break;
case parameters: rs = "parameters (5)"; break;
case all: rs = "all (6)"; break;
}
return s;
return rs;
}
G4VisManager::Verbosity
G4VisManager::GetVerbosityValue(const G4String& verbosityString) {
G4String s(verbosityString); s.toLower();
G4String ss(verbosityString); ss.toLower();
Verbosity verbosity;
if (s(0) == 'q') verbosity = quiet;
else if (s(0) == 's') verbosity = startup;
else if (s(0) == 'e') verbosity = errors;
else if (s(0) == 'w') verbosity = warnings;
else if (s(0) == 'c') verbosity = confirmations;
else if (s(0) == 'p') verbosity = parameters;
else if (s(0) == 'a') verbosity = all;
if (ss(0) == 'q') verbosity = quiet;
else if (ss(0) == 's') verbosity = startup;
else if (ss(0) == 'e') verbosity = errors;
else if (ss(0) == 'w') verbosity = warnings;
else if (ss(0) == 'c') verbosity = confirmations;
else if (ss(0) == 'p') verbosity = parameters;
else if (ss(0) == 'a') verbosity = all;
else {
G4int intVerbosity;
std::istringstream is(s);
std::istringstream is(ss);
is >> intVerbosity;
if (!is) {
G4cout << "ERROR: G4VisManager::GetVerbosityValue: invalid verbosity \""
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VisStateDependent.cc,v 1.6 2006-06-29 21:30:02 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
#include "G4VisStateDependent.hh"