Import Geant4 9.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:46:55 +02:00
parent 89a9605df1
commit b1eb5424d2
10957 changed files with 888481 additions and 160139 deletions
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4GraphicsSystemList.cc,v 1.4 2006/06/29 21:29:14 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4GraphicsSystemList.cc,v 1.4 2006-06-29 21:29:14 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
#include "G4GraphicsSystemList.hh"
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Scene.cc,v 1.24 2009/11/04 12:49:16 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4Scene.cc,v 1.24 2009-11-04 12:49:16 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Scene data John Allison 19th July 1996.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4SceneHandlerList.cc,v 1.4 2006/06/29 21:29:18 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4SceneHandlerList.cc,v 1.4 2006-06-29 21:29:18 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
#include "G4SceneHandlerList.hh"
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4SceneList.cc,v 1.6 2006/06/29 21:29:20 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4SceneList.cc,v 1.6 2006-06-29 21:29:20 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
#include "G4SceneList.hh"
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VGraphicsSystem.cc,v 1.11 2006/06/29 21:29:22 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VGraphicsSystem.cc,v 1.11 2006-06-29 21:29:22 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 27th March 1996
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VSceneHandler.cc,v 1.96 2010/11/05 16:00:11 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4VSceneHandler.cc,v 1.96 2010-11-05 16:00:11 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 19th July 1996
@@ -148,14 +148,17 @@ void G4VSceneHandler::BeginPrimitives
(const G4Transform3D& objectTransformation) {
fNestingDepth++;
if (fNestingDepth > 1)
G4Exception("G4VSceneHandler::BeginPrimitives: Nesting detected."
"\n It is illegal to nest Begin/EndPrimitives.");
G4Exception
("G4VSceneHandler::BeginPrimitives",
"visman0003", FatalException,
"Nesting detected. It is illegal to nest Begin/EndPrimitives.");
fpObjectTransformation = &objectTransformation;
}
void G4VSceneHandler::EndPrimitives () {
if (fNestingDepth <= 0)
G4Exception("G4VSceneHandler::EndPrimitives: Nesting error");
G4Exception("G4VSceneHandler::EndPrimitives",
"visman0004", FatalException, "Nesting error.");
fNestingDepth--;
fpObjectTransformation = 0;
if (fReadyForTransients) {
@@ -168,14 +171,17 @@ void G4VSceneHandler::BeginPrimitives2D
(const G4Transform3D& objectTransformation) {
fNestingDepth++;
if (fNestingDepth > 1)
G4Exception("G4VSceneHandler::BeginPrimitives2D: Nesting detected."
"\n It is illegal to nest Begin/EndPrimitives.");
G4Exception
("G4VSceneHandler::BeginPrimitives2D",
"visman0005", FatalException,
"Nesting detected. It is illegal to nest Begin/EndPrimitives.");
fpObjectTransformation = &objectTransformation;
}
void G4VSceneHandler::EndPrimitives2D () {
if (fNestingDepth <= 0)
G4Exception("G4VSceneHandler::EndPrimitives2D: Nesting error");
G4Exception("G4VSceneHandler::EndPrimitives2D",
"visman0006", FatalException, "Nesting error.");
fNestingDepth--;
fpObjectTransformation = 0;
if (fReadyForTransients) {
@@ -262,7 +268,8 @@ void G4VSceneHandler::AddCompound (const G4VTrajectory& traj) {
G4TrajectoriesModel* trajectoriesModel =
dynamic_cast<G4TrajectoriesModel*>(fpModel);
if (!trajectoriesModel) G4Exception
("G4VSceneHandler::AddCompound(const G4VTrajectory&): Not a G4TrajectoriesModel.");
("G4VSceneHandler::AddCompound(const G4VTrajectory&)",
"visman0007", FatalException, "Not a G4TrajectoriesModel.");
else {
if (trajectoriesModel->IsDrawingModeSet()) {
traj.DrawTrajectory(trajectoriesModel->GetDrawingMode());
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VViewer.cc,v 1.26 2009/11/17 14:37:06 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VViewer.cc,v 1.26 2009-11-17 14:37:06 lgarnier Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 27th March 1996
@@ -60,6 +60,9 @@ fNeedKernelVisit (true)
}
fShortName = fName (0, fName.find (' '));
fShortName.strip ();
fVP = G4VisManager::GetInstance()->GetDefaultViewParameters();
fDefaultVP = fVP;
}
G4VViewer::~G4VViewer () {
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VVisCommand.cc,v 1.18 2006/06/29 21:29:28 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VVisCommand.cc,v 1.18 2006-06-29 21:29:28 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// Base class for visualization commands - John Allison 9th August 1998
// It is really a messenger - we have one command per messenger.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ViewParameters.cc,v 1.38 2010/11/05 16:00:11 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4ViewParameters.cc,v 1.38 2010-11-05 16:00:11 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 19th July 1996
@@ -87,7 +87,8 @@ G4ViewParameters::G4ViewParameters ():
fWindowLocationHintYNegative(false),
fAutoRefresh (false),
fBackgroundColour (G4Colour(0.,0.,0.)), // Black
fPicking (false)
fPicking (false),
fRotationStyle (constrainUpDirection)
{
fDefaultMarker.SetScreenSize (5.);
// Markers are 5 pixels "overall" size, i.e., diameter.
@@ -293,7 +294,8 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
(fXGeometryString != v.fXGeometryString) ||
(fAutoRefresh != v.fAutoRefresh) ||
(fBackgroundColour != v.fBackgroundColour) ||
(fPicking != v.fPicking)
(fPicking != v.fPicking) ||
(fRotationStyle != v.fRotationStyle)
)
G4cout << "Difference in 1st batch." << G4endl;
@@ -341,7 +343,18 @@ std::ostream& operator << (std::ostream& os,
std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
os << "View parameters and options:";
os << "\n Drawing style: " << v.fDrawingStyle;
os << "\n Drawing style: ";
switch (v.fDrawingStyle) {
case G4ViewParameters::wireframe:
os << "edges, wireframe"; break;
case G4ViewParameters::hlr:
os << "edges, hidden line removal"; break;
case G4ViewParameters::hsr:
os << "surfaces, hidden surface removal"; break;
case G4ViewParameters::hlhsr:
os << "surfaces and edges, hidden line and surface removal"; break;
default: os << "unrecognised"; break;
}
os << "\n Auxiliary edges: ";
if (!v.fAuxEdgeVisible) os << "in";
@@ -465,6 +478,15 @@ std::ostream& operator << (std::ostream& os, const G4ViewParameters& v) {
if (v.fPicking) os << "true";
else os << "false";
os << "\n Rotation style: ";
switch (v.fRotationStyle) {
case G4ViewParameters::constrainUpDirection:
os << "constrainUpDirection (conventional HEP view)"; break;
case G4ViewParameters::freeRotation:
os << "freeRotation (Google-like rotation, using mouse-grab)"; break;
default: os << "unrecognised"; break;
}
return os;
}
@@ -506,7 +528,8 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
(fXGeometryString != v.fXGeometryString) ||
(fAutoRefresh != v.fAutoRefresh) ||
(fBackgroundColour != v.fBackgroundColour) ||
(fPicking != v.fPicking)
(fPicking != v.fPicking) ||
(fRotationStyle != v.fRotationStyle)
)
return true;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ViewerList.cc,v 1.4 2006/06/29 21:29:32 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ViewerList.cc,v 1.4 2006-06-29 21:29:32 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
#include "G4ViewerList.hh"
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommands.cc,v 1.24 2009/03/09 12:42:00 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VisCommands.cc,v 1.24 2009-03-09 12:42:00 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/ top level commands - John Allison 5th February 2001
@@ -147,6 +147,8 @@ void G4VisCommandList::SetNewValue (G4UIcommand*, G4String newValue)
G4cout << G4endl;
fpVisManager->PrintAvailableModels(verbosity);
G4cout << G4endl;
fpVisManager->PrintAvailableColours(verbosity);
G4cout << G4endl;
G4UImanager* UImanager = G4UImanager::GetUIpointer();
UImanager->ApplyCommand(G4String("/vis/viewer/list ! ") + verbosityString);
if (verbosity < G4VisManager::parameters)
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsCompound.cc,v 1.40 2010/05/20 07:54:01 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
// $Id: G4VisCommandsCompound.cc,v 1.40 2010-05-20 07:54:01 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// Compound /vis/ commands - John Allison 15th May 2000
@@ -0,0 +1,181 @@
//
// ********************************************************************
// * 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: G4VisCommandsDefault.cc,v 1.4 2007-01-05 16:29:38 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/default commands - John Allison 30th October 2011
#include "G4VisCommandsDefault.hh"
#include "G4VisManager.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
////////////// /vis/default/hiddenEdge ///////////////////////////////////////
G4VisCommandDefaultHiddenEdge::G4VisCommandDefaultHiddenEdge()
{
G4bool omitable;
fpCommand = new G4UIcmdWithABool("/vis/default/hiddenEdge", this);
fpCommand->SetGuidance("Default hiddenEdge drawing for future viewers.");
fpCommand->SetGuidance
("Edges become hidden/seen in wireframe or surface mode.");
fpCommand->SetParameterName("hidden-edge",omitable = true);
fpCommand->SetDefaultValue(true);
}
G4VisCommandDefaultHiddenEdge::~G4VisCommandDefaultHiddenEdge()
{
delete fpCommand;
}
G4String G4VisCommandDefaultHiddenEdge::GetCurrentValue(G4UIcommand*)
{
return "";
}
void G4VisCommandDefaultHiddenEdge::SetNewValue(G4UIcommand*, G4String newValue)
{
// Follows /vis/viewer/set/hiddenEdge
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4ViewParameters vp = fpVisManager->GetDefaultViewParameters();
G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
if (G4UIcommand::ConvertToBool(newValue)) {
switch (existingStyle) {
case G4ViewParameters::wireframe:
vp.SetDrawingStyle(G4ViewParameters::hlr);
break;
case G4ViewParameters::hlr:
break;
case G4ViewParameters::hsr:
vp.SetDrawingStyle(G4ViewParameters::hlhsr);
break;
case G4ViewParameters::hlhsr:
break;
}
}
else {
switch (existingStyle) {
case G4ViewParameters::wireframe:
break;
case G4ViewParameters::hlr:
vp.SetDrawingStyle(G4ViewParameters::wireframe);
break;
case G4ViewParameters::hsr:
break;
case G4ViewParameters::hlhsr:
vp.SetDrawingStyle(G4ViewParameters::hsr);
break;
}
}
fpVisManager->SetDefaultViewParameters(vp);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Default drawing style set to " << vp.GetDrawingStyle()
<< G4endl;
}
}
////////////// /vis/default/style ///////////////////////////////////////
G4VisCommandDefaultStyle::G4VisCommandDefaultStyle()
{
G4bool omitable;
fpCommand = new G4UIcmdWithAString("/vis/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\".)");
fpCommand->SetParameterName ("style",omitable = false);
}
G4VisCommandDefaultStyle::~G4VisCommandDefaultStyle()
{
delete fpCommand;
}
G4String G4VisCommandDefaultStyle::GetCurrentValue(G4UIcommand*)
{
return "";
}
void G4VisCommandDefaultStyle::SetNewValue(G4UIcommand*, G4String newValue)
{
// Follows /vis/viewer/set/style
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4ViewParameters vp = fpVisManager->GetDefaultViewParameters();
G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
const size_t iPos0 = 0;
if (newValue[iPos0] == 'w') { // "wireframe"
switch (existingStyle) {
case G4ViewParameters::wireframe:
break;
case G4ViewParameters::hlr:
break;
case G4ViewParameters::hsr:
vp.SetDrawingStyle(G4ViewParameters::wireframe);
break;
case G4ViewParameters::hlhsr:
vp.SetDrawingStyle(G4ViewParameters::hlr);
break;
}
}
else if (newValue[iPos0] == 's') { // "surface"
switch (existingStyle) {
case G4ViewParameters::wireframe:
vp.SetDrawingStyle(G4ViewParameters::hsr);
break;
case G4ViewParameters::hlr:
vp.SetDrawingStyle(G4ViewParameters::hlhsr);
break;
case G4ViewParameters::hsr:
break;
case G4ViewParameters::hlhsr:
break;
}
}
else {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: \"" << newValue << "\" not recognised."
" Looking for 'w' or 's' first character." << G4endl;
}
return;
}
fpVisManager->SetDefaultViewParameters(vp);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Default drawing style set to " << vp.GetDrawingStyle()
<< G4endl;
}
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsGeometry.cc,v 1.4 2007/01/05 16:29:38 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisCommandsGeometry.cc,v 1.4 2007-01-05 16:29:38 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/geometry commands - John Allison 31st January 2006
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsGeometrySet.cc,v 1.8 2010/06/15 16:34:30 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
// $Id: G4VisCommandsGeometrySet.cc,v 1.8 2010-06-15 16:34:30 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/geometry commands - John Allison 31st January 2006
@@ -605,3 +605,26 @@ void G4VisCommandGeometrySetVisibility::SetNewValue
}
}
}
void G4VisCommandGeometrySetVisibility::SetNewValueOnLV
(G4LogicalVolume* pLV, G4int requestedDepth,G4bool visibility)
{
if (!pLV) return;
G4VisCommandGeometrySetVisibilityFunction setVisibility(visibility);
SetLVVisAtts(pLV, setVisibility, 0, requestedDepth);
G4VViewer* pViewer = fpVisManager->GetCurrentViewer();
if (pViewer) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
const G4ViewParameters& viewParams = pViewer->GetViewParameters();
if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) {
if (!viewParams.IsCulling() ||
!viewParams.IsCullingInvisible()) {
G4cout <<
"Culling must be on - \"/vis/viewer/set/culling global true\" and"
"\n \"/vis/viewer/set/culling invisible true\" - to see effect."
<< G4endl;
}
}
}
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsScene.cc,v 1.70 2010/11/13 10:52:00 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4VisCommandsScene.cc,v 1.71 2010-12-11 16:53:20 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/scene commands - John Allison 9th August 1998
@@ -544,6 +544,8 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
const G4int nViewers = viewerList.size ();
for (G4int iV = 0; iV < nViewers; iV++) {
G4VViewer* aViewer = viewerList [iV];
// Force rebuild of graphical database, if any.
aViewer -> NeedKernelVisit();
if (aViewer->GetViewParameters().IsAutoRefresh()) {
aSceneHandler -> SetCurrentViewer (aViewer);
// Ensure consistency of vis manager...
@@ -561,8 +563,6 @@ void G4VisCommandSceneNotifyHandlers::SetNewValue (G4UIcommand*,
// to work for all viewers. If it's a problem for you,
// uncomment the next line.
//aSceneHandler->ClearTransientStore();
// Now, force rebuild of graphical database, if any, and re-draw.
aViewer -> NeedKernelVisit();
aViewer -> SetView ();
aViewer -> ClearView ();
aViewer -> DrawView ();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsSceneAdd.cc,v 1.84 2010/11/06 18:34:26 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4VisCommandsSceneAdd.cc,v 1.85 2010-12-11 16:50:10 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/scene commands - John Allison 9th August 1998
#include "G4VisCommandsSceneAdd.hh"
@@ -65,8 +65,12 @@
#include "G4IdentityTrajectoryFilter.hh"
#include "G4TransportationManager.hh"
#include "G4PropagatorInField.hh"
#include "G4Trajectory.hh"
#include "G4TrajectoryPoint.hh"
#include "G4RichTrajectory.hh"
#include "G4RichTrajectoryPoint.hh"
#include "G4SmoothTrajectory.hh"
#include "G4SmoothTrajectoryPoint.hh"
#include "G4AttDef.hh"
#include "G4ios.hh"
#include <sstream>
@@ -794,6 +798,10 @@ void G4VisCommandSceneAddLogo::SetNewValue (G4UIcommand*, G4String newValue) {
break;
}
}
/* sxmin, etc., not actually used. Comment out to prevent compiler
warnings but keep in case need in future. Extract transform into
reduced code below.
G4double sxmin(sxmid), sxmax(sxmid);
G4double symin(symid), symax(symid);
G4double szmin(szmid), szmax(szmid);
@@ -814,6 +822,15 @@ void G4VisCommandSceneAddLogo::SetNewValue (G4UIcommand*, G4String newValue) {
transform = G4RotateY3D(halfpi);
break;
}
*/
G4Transform3D transform;
switch (logoDirection) {
case G4Scale::x: break;
case G4Scale::y: break;
case G4Scale::z:
transform = G4RotateY3D(halfpi);
break;
}
transform = G4Translate3D(sxmid,symid,szmid) * transform;
G4VisAttributes visAtts(G4Colour(red, green, blue));
@@ -1202,6 +1219,10 @@ void G4VisCommandSceneAddScale::SetNewValue (G4UIcommand*, G4String newValue) {
break;
}
}
/* sxmin, etc., not actually used. Comment out to prevent compiler
warnings but keep in case need in future. Extract transform and
scaleExtent into reduced code below.
G4double sxmin(sxmid), sxmax(sxmid);
G4double symin(symid), symax(symid);
G4double szmin(szmid), szmax(szmid);
@@ -1226,8 +1247,24 @@ void G4VisCommandSceneAddScale::SetNewValue (G4UIcommand*, G4String newValue) {
scaleExtent = G4VisExtent(0,0,0,0,-halfLength,halfLength);
break;
}
*/
G4Transform3D transform;
G4VisExtent scaleExtent;
switch (scaleDirection) {
case G4Scale::x:
scaleExtent = G4VisExtent(-halfLength,halfLength,0,0,0,0);
break;
case G4Scale::y:
transform = G4RotateZ3D(halfpi);
scaleExtent = G4VisExtent(0,0,-halfLength,halfLength,0,0);
break;
case G4Scale::z:
transform = G4RotateY3D(halfpi);
scaleExtent = G4VisExtent(0,0,0,0,-halfLength,halfLength);
break;
}
transform = G4Translate3D(sxmid,symid,szmid) * transform;
////////// G4VisExtent scaleExtent(sxmin, sxmax, symin, symax, szmin, szmax);
///////// G4VisExtent scaleExtent(sxmin, sxmax, symin, symax, szmin, szmax);
model->SetTransformation(transform);
@@ -1458,14 +1495,21 @@ void G4VisCommandSceneAddTrajectories::SetNewValue (G4UIcommand*,
}
UImanager->SetVerboseLevel(keepVerbose);
if (rich) {
if (verbosity >= G4VisManager::warnings) {
G4cout <<
"Attributes available for modeling and filtering with"
"\n\"/vis/modeling/trajectories/create/drawByAttribute\" and"
"\n\"/vis/filtering/trajectories/create/attributeFilter\" commands:\n"
<< G4RichTrajectory().GetAttDefs()
if (verbosity >= G4VisManager::errors) {
G4cout <<
"Attributes available for modeling and filtering with"
"\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
"\n \"/vis/filtering/trajectories/create/attributeFilter\" commands:"
<< G4endl;
if (rich) {
G4cout << G4RichTrajectory().GetAttDefs()
<< G4RichTrajectoryPoint().GetAttDefs();
} else if (smooth) {
G4cout << G4SmoothTrajectory().GetAttDefs()
<< G4SmoothTrajectoryPoint().GetAttDefs();
} else {
G4cout << G4Trajectory().GetAttDefs()
<< G4TrajectoryPoint().GetAttDefs();
}
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsSceneHandler.cc,v 1.32 2006/06/29 21:29:46 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisCommandsSceneHandler.cc,v 1.32 2006-06-29 21:29:46 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/sceneHandler commands - John Allison 10th October 1998
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewer.cc,v 1.77 2010/11/07 11:14:07 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4VisCommandsViewer.cc,v 1.77 2010-11-07 11:14:07 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/viewer commands - John Allison 25th October 1998
@@ -51,9 +51,14 @@ G4VVisCommandViewer::~G4VVisCommandViewer () {}
void G4VVisCommandViewer::SetViewParameters
(G4VViewer* viewer, const G4ViewParameters& viewParams) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
viewer->SetViewParameters(viewParams);
RefreshIfRequired(viewer);
}
void G4VVisCommandViewer::RefreshIfRequired(G4VViewer* viewer) {
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
const G4ViewParameters& viewParams = viewer->GetViewParameters();
if (sceneHandler && sceneHandler->GetScene()) {
if (viewParams.IsAutoRefresh()) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
@@ -1078,9 +1083,8 @@ void G4VisCommandViewerRebuild::SetNewValue (G4UIcommand*, G4String newValue) {
viewer->ClearView();
viewer->DrawView();
// Check auto-refresh and print confirmations, but without changing
// view paramters...
SetViewParameters(viewer, viewer->GetViewParameters());
// Check auto-refresh and print confirmations.
RefreshIfRequired(viewer);
}
////////////// /vis/viewer/refresh ///////////////////////////////////////
@@ -1218,7 +1222,8 @@ void G4VisCommandViewerReset::SetNewValue (G4UIcommand*, G4String newValue) {
return;
}
SetViewParameters(viewer, viewer->GetDefaultViewParameters());
viewer->ResetView();
RefreshIfRequired(viewer);
}
////////////// /vis/viewer/scale and scaleTo ////////////////////////////
@@ -1347,7 +1352,7 @@ void G4VisCommandViewerSelect::SetNewValue (G4UIcommand*, G4String newValue) {
fpVisManager -> SetCurrentViewer (viewer); // Prints confirmation.
SetViewParameters(viewer, viewer->GetViewParameters());
RefreshIfRequired(viewer);
}
////////////// /vis/viewer/update ///////////////////////////////////////
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisCommandsViewerSet.cc,v 1.53 2010/11/05 15:57:20 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4VisCommandsViewerSet.cc,v 1.53 2010-11-05 15:57:20 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// /vis/viewer/set commands - John Allison 16th May 2000
@@ -319,6 +319,17 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
//parameter->SetCurrentAsDefault(true);
fpCommandProjection->SetParameter(parameter);
fpCommandRotationStyle = new G4UIcmdWithAString
("/vis/viewer/set/rotationStyle",this);
fpCommandRotationStyle->SetGuidance
("Set style of rotation - constrainUpDirection or freeRotation.");
fpCommandRotationStyle->SetGuidance
("constrainUpDirection: conventional HEP view.");
fpCommandRotationStyle->SetGuidance
("freeRotation: Google-like rotation, using mouse-grab.");
fpCommandRotationStyle->SetParameterName ("style",omitable = false);
fpCommandRotationStyle->SetCandidates("constrainUpDirection freeRotation");
fpCommandSectionPlane = new G4UIcommand("/vis/viewer/set/sectionPlane",this);
fpCommandSectionPlane -> SetGuidance
("Set plane for drawing section (DCUT).");
@@ -462,6 +473,7 @@ G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
delete fpCommandLightsVector;
delete fpCommandPicking;
delete fpCommandProjection;
delete fpCommandRotationStyle;
delete fpCommandSectionPlane;
delete fpCommandStyle;
delete fpCommandTargetPoint;
@@ -527,6 +539,18 @@ void G4VisCommandsViewerSet::SetNewValue
else if (command == fpCommandAutoRefresh) {
G4bool autoRefresh = G4UIcommand::ConvertToBool(newValue);
const G4ViewParameters& defaultVP =
currentViewer->GetDefaultViewParameters();
if (autoRefresh && !defaultVP.IsAutoRefresh()) {
if (verbosity >= G4VisManager::warnings) {
G4cout
<< "WARNING: "
<< currentViewer->GetName() << " is NOT auto-refesh by default"
<< "\n so cannot be set to auto-refresh."
<< G4endl;
return;
}
}
vp.SetAutoRefresh(autoRefresh);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Views will ";
@@ -536,7 +560,7 @@ void G4VisCommandsViewerSet::SetNewValue
}
if (!vp.IsAutoRefresh()) {
currentViewer->SetViewParameters(vp);
return; // Avoid a refresh id auto-refresh has been set to off...
return; // Avoid a refresh if auto-refresh has been set to off...
} // ...otherwise take normal action.
}
@@ -958,8 +982,8 @@ void G4VisCommandsViewerSet::SetNewValue
}
G4double F = 1.;
// iSelector can only be 0 or 1
switch (iSelector) {
default:
case 0:
vp.UnsetSectionPlane();
break;
@@ -981,6 +1005,26 @@ void G4VisCommandsViewerSet::SetNewValue
}
}
else if (command == fpCommandRotationStyle) {
G4ViewParameters::RotationStyle style;
if (newValue == "constrainUpDirection")
style = G4ViewParameters::constrainUpDirection;
else if (newValue == "freeRotation")
style = G4ViewParameters::freeRotation;
else {
if (verbosity >= G4VisManager::errors) {
G4cout << "ERROR: \"" << newValue << "\" not recognised." << G4endl;
}
return;
}
vp.SetRotationStyle(style);
if (verbosity >= G4VisManager::confirmations) {
G4cout << "Rotation style of viewer \"" << currentViewer->GetName()
<< "\" set to " << vp.GetRotationStyle()
<< G4endl;
}
}
else if (command == fpCommandStyle) {
G4ViewParameters::DrawingStyle existingStyle = vp.GetDrawingStyle();
const size_t iPos0 = 0;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.6 2006/06/29 21:29:52 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisFeaturesOfDAWNFILE.cc,v 1.6 2006-06-29 21:29:52 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
#include "G4VisFeaturesOfDAWNFILE.hh"
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.5 2006/06/29 21:29:54 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisFeaturesOfFukuiRenderer.cc,v 1.5 2006-06-29 21:29:54 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisFeaturesOfOpenGL.cc,v 1.6 2007/10/03 14:21:55 lgarnier Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisFeaturesOfOpenGL.cc,v 1.6 2007-10-03 14:21:55 lgarnier Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
@@ -100,3 +100,8 @@ G4String G4VisFeaturesOfOpenGLSQt () {
return
"\n It runs everywhere ";
}
G4String G4VisFeaturesOfOpenGLIWt () {
return
"\n It runs everywhere";
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisFeaturesOfOpenInventor.cc,v 1.5 2006/06/29 21:29:58 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisFeaturesOfOpenInventor.cc,v 1.5 2006-06-29 21:29:58 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
@@ -23,8 +23,8 @@
// * 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: geant4-09-04 $
// $Id: G4VisManager.cc,v 1.131 2010-12-14 15:53:28 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
@@ -33,6 +33,7 @@
#include "G4VisCommands.hh"
#include "G4VisCommandsCompound.hh"
#include "G4VisCommandsDefault.hh"
#include "G4VisCommandsGeometry.hh"
#include "G4VisCommandsGeometrySet.hh"
#include "G4VisCommandsScene.hh"
@@ -122,7 +123,9 @@ G4VisManager::G4VisManager (const G4String& verbosityString):
if (fpInstance) {
G4Exception
("G4VisManager: attempt to Construct more than one VisManager.");
("G4VisManager::G4VisManager",
"visman0001", FatalException,
"Attempt to Construct more than one VisManager");
}
fpInstance = this;
@@ -212,7 +215,8 @@ G4VisManager::~G4VisManager () {
G4VisManager* G4VisManager::GetInstance () {
if (!fpInstance) {
G4Exception
("G4VisManager::GetInstance: VisManager not yet instantiated!");
("G4VisManager::GetInstance",
"visman0002", FatalException, "VisManager not yet instantiated");
}
return fpInstance;
}
@@ -310,11 +314,16 @@ void G4VisManager::Initialise () {
if (fVerbosity >= startup) {
G4cout <<
"\nYou have successfully registered the following model factories."
<< G4endl;
<< G4endl;
PrintAvailableModels (fVerbosity);
G4cout << G4endl;
}
if (fVerbosity >= startup) {
PrintAvailableColours (fVerbosity);
G4cout << G4endl;
}
fInitialised = true;
}
@@ -1118,6 +1127,12 @@ void G4VisManager::RegisterMessengers () {
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);
@@ -1297,6 +1312,19 @@ void G4VisManager::PrintAvailableModels (Verbosity verbosity) const
}
}
void G4VisManager::PrintAvailableColours (Verbosity) const {
G4cout <<
"Some /vis commands (optionally) take a string to specify colour."
"\nAvailable colours:\n ";
const std::map<G4String, G4Colour>& map = G4Colour::GetMap();
for (std::map<G4String, G4Colour>::const_iterator i = map.begin();
i != map.end();) {
G4cout << i->first;
if (++i != map.end()) G4cout << ", ";
}
G4cout << G4endl;
}
void G4VisManager::PrintInvalidPointers () const {
if (fVerbosity >= errors) {
G4cout << "ERROR: G4VisManager::PrintInvalidPointers:";
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VisStateDependent.cc,v 1.6 2006/06/29 21:30:02 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VisStateDependent.cc,v 1.6 2006-06-29 21:30:02 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
#include "G4VisStateDependent.hh"