Import Geant4 4.0.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsViewerSet.cc,v 1.12.2.1 2001/06/28 19:16:16 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4VisCommandsViewerSet.cc,v 1.17 2001/11/12 18:22:12 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
|
||||
// /vis/viewer/set commands - John Allison 16th May 2000
|
||||
|
||||
@@ -35,7 +35,11 @@
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VisManager.hh"
|
||||
|
||||
G4VisCommandsViewerSet::G4VisCommandsViewerSet () {
|
||||
G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
|
||||
fLightsVector (G4ThreeVector(1.,1.,1.)),
|
||||
fUpVector (G4ThreeVector(0.,1.,0.)),
|
||||
fViewpointVector (G4ThreeVector(0.,0.,1.))
|
||||
{
|
||||
G4bool omitable;
|
||||
G4UIparameter* parameter;
|
||||
|
||||
@@ -47,9 +51,9 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet () {
|
||||
viewerNameCommands.push_back (fpCommandAll);
|
||||
|
||||
fpCommandAutoRefresh = new G4UIcmdWithABool
|
||||
("/vis/viewer/set/autorefresh",this);
|
||||
("/vis/viewer/set/autoRefresh",this);
|
||||
fpCommandAutoRefresh->SetGuidance
|
||||
("/vis/viewer/set/autorefresh [true|false]");
|
||||
("/vis/viewer/set/autoRefresh [true|false]");
|
||||
fpCommandAutoRefresh->SetGuidance
|
||||
("View is automatically refreshed after a change of view parameters.");
|
||||
fpCommandAutoRefresh->SetParameterName("auto-refresh",omitable = true);
|
||||
@@ -105,6 +109,38 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet () {
|
||||
// fpCommandLightsMove->SetCandidates("move-with-camera move-with-object");
|
||||
// Own parsing.
|
||||
|
||||
fpCommandLightsThetaPhi = new G4UIcommand
|
||||
("/vis/viewer/set/lightsThetaPhi", this);
|
||||
fpCommandLightsThetaPhi -> SetGuidance
|
||||
("/vis/viewer/set/lightsThetaPhi [<theta>] [<phi>] [deg|rad]");
|
||||
fpCommandLightsThetaPhi -> SetGuidance
|
||||
("Set direction from target to lights.");
|
||||
parameter = new G4UIparameter("theta", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandLightsThetaPhi -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter("phi", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandLightsThetaPhi -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter ("unit", 's', omitable = true);
|
||||
parameter -> SetDefaultValue ("deg");
|
||||
fpCommandLightsThetaPhi -> SetParameter (parameter);
|
||||
|
||||
fpCommandLightsVector = new G4UIcommand
|
||||
("/vis/viewer/set/lightsVector", this);
|
||||
fpCommandLightsVector -> SetGuidance
|
||||
("/vis/viewer/set/lightsVector [<x>] [<y>] [<z>]");
|
||||
fpCommandLightsVector -> SetGuidance
|
||||
("Set direction from target to lights.");
|
||||
parameter = new G4UIparameter("x", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandLightsVector -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter("y", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandLightsVector -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter ("z", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandLightsVector -> SetParameter (parameter);
|
||||
|
||||
fpCommandLineSegments = new G4UIcmdWithAnInteger
|
||||
("/vis/viewer/set/lineSegmentsPerCircle",this);
|
||||
fpCommandLineSegments->SetGuidance
|
||||
@@ -178,6 +214,74 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet () {
|
||||
("Note: parameter will be parsed for first character \"w\" or \"s\".");
|
||||
fpCommandStyle->SetParameterName ("style",omitable = false);
|
||||
// fpCommandStyle->SetCandidates("wireframe surface"); // Own parsing.
|
||||
|
||||
fpCommandUpThetaPhi = new G4UIcommand
|
||||
("/vis/viewer/set/upThetaPhi", this);
|
||||
fpCommandUpThetaPhi -> SetGuidance
|
||||
("/vis/viewer/set/upThetaPhi [<theta>] [<phi>] [deg|rad]");
|
||||
fpCommandUpThetaPhi -> SetGuidance
|
||||
("Set up vector. Viewer will attempt always to show"
|
||||
" this direction upwards.");
|
||||
parameter = new G4UIparameter("theta", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandUpThetaPhi -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter("phi", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandUpThetaPhi -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter ("unit", 's', omitable = true);
|
||||
parameter -> SetDefaultValue ("deg");
|
||||
fpCommandUpThetaPhi -> SetParameter (parameter);
|
||||
|
||||
fpCommandUpVector = new G4UIcommand
|
||||
("/vis/viewer/set/upVector", this);
|
||||
fpCommandUpVector -> SetGuidance
|
||||
("/vis/viewer/set/upVector [<x>] [<y>] [<z>]");
|
||||
fpCommandUpVector -> SetGuidance
|
||||
("Set up vector. Viewer will attempt always to show"
|
||||
" this direction upwards.");
|
||||
parameter = new G4UIparameter("x", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandUpVector -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter("y", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandUpVector -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter ("z", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandUpVector -> SetParameter (parameter);
|
||||
|
||||
fpCommandViewpointThetaPhi = new G4UIcommand
|
||||
("/vis/viewer/set/viewpointThetaPhi", this);
|
||||
fpCommandViewpointThetaPhi -> SetGuidance
|
||||
("/vis/viewer/set/viewpointThetaPhi [<theta>] [<phi>] [deg|rad]");
|
||||
fpCommandViewpointThetaPhi -> SetGuidance
|
||||
("Set direction from target to camera. Also changes lightpoint direction"
|
||||
"\nif lights are set to move with camera.");
|
||||
parameter = new G4UIparameter("theta", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandViewpointThetaPhi -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter("phi", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandViewpointThetaPhi -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter ("unit", 's', omitable = true);
|
||||
parameter -> SetDefaultValue ("deg");
|
||||
fpCommandViewpointThetaPhi -> SetParameter (parameter);
|
||||
|
||||
fpCommandViewpointVector = new G4UIcommand
|
||||
("/vis/viewer/set/viewpointVector", this);
|
||||
fpCommandViewpointVector -> SetGuidance
|
||||
("/vis/viewer/set/viewpointVector [<x>] [<y>] [<z>]");
|
||||
fpCommandViewpointVector -> SetGuidance
|
||||
("Set direction from target to camera. Also changes lightpoint direction"
|
||||
"\nif lights are set to move with camera.");
|
||||
parameter = new G4UIparameter("x", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandViewpointVector -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter("y", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandViewpointVector -> SetParameter (parameter);
|
||||
parameter = new G4UIparameter ("z", 'd', omitable = true);
|
||||
parameter -> SetCurrentAsDefault (true);
|
||||
fpCommandViewpointVector -> SetParameter (parameter);
|
||||
}
|
||||
|
||||
G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
|
||||
@@ -189,22 +293,51 @@ G4VisCommandsViewerSet::~G4VisCommandsViewerSet() {
|
||||
delete fpCommandHiddenMarker;
|
||||
delete fpCommandLineSegments;
|
||||
delete fpCommandLightsMove;
|
||||
delete fpCommandLightsThetaPhi;
|
||||
delete fpCommandLightsVector;
|
||||
delete fpCommandProjection;
|
||||
delete fpCommandSectionPlane;
|
||||
delete fpCommandStyle;
|
||||
delete fpCommandUpThetaPhi;
|
||||
delete fpCommandUpVector;
|
||||
delete fpCommandViewpointThetaPhi;
|
||||
delete fpCommandViewpointVector;
|
||||
}
|
||||
|
||||
G4String G4VisCommandsViewerSet::GetCurrentValue(G4UIcommand* command) {
|
||||
return "invalid";
|
||||
G4String currentValue;
|
||||
if (command == fpCommandLightsThetaPhi) {
|
||||
currentValue = ConvertToString(fLightsVector.theta(),
|
||||
fLightsVector.phi(), "deg");
|
||||
}
|
||||
else if (command == fpCommandLightsVector) {
|
||||
currentValue = ConvertToString(fLightsVector);
|
||||
}
|
||||
else if (command == fpCommandViewpointThetaPhi) {
|
||||
currentValue = ConvertToString(fViewpointVector.theta(),
|
||||
fViewpointVector.phi(), "deg");
|
||||
}
|
||||
else if (command == fpCommandViewpointVector) {
|
||||
currentValue = ConvertToString(fViewpointVector);
|
||||
}
|
||||
else {
|
||||
currentValue = "invalid";
|
||||
}
|
||||
return currentValue;
|
||||
}
|
||||
|
||||
void G4VisCommandsViewerSet::SetNewValue
|
||||
(G4UIcommand* command,G4String newValue) {
|
||||
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
|
||||
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
|
||||
if (!currentViewer) {
|
||||
G4cout << "G4VisCommandsViewerSet::SetNewValue: no current viewer."
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout <<
|
||||
"ERROR: G4VisCommandsViewerSet::SetNewValue: no current viewer."
|
||||
<< G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -213,32 +346,41 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
if (command == fpCommandAll) {
|
||||
G4VViewer* fromViewer = fpVisManager->GetViewer(newValue);
|
||||
if (!fromViewer) {
|
||||
G4cout <<
|
||||
"G4VisCommandsViewerSet::SetNewValue: all: unrecognised from-viewer."
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout <<
|
||||
"ERROR: G4VisCommandsViewerSet::SetNewValue: all:"
|
||||
"\n unrecognised from-viewer."
|
||||
<< G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (fromViewer == currentViewer) {
|
||||
if (verbosity >= G4VisManager::warnings) {
|
||||
G4cout <<
|
||||
"G4VisCommandsViewerSet::SetNewValue: all:"
|
||||
"WARNING: G4VisCommandsViewerSet::SetNewValue: all:"
|
||||
"\n from-viewer and current viewer are identical."
|
||||
<< G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
vp = fromViewer->GetViewParameters();
|
||||
G4cout << "View parameters of viewer \"" << currentViewer->GetName()
|
||||
<< "\"\n set to those of viewer \"" << fromViewer->GetName()
|
||||
<< "\"."
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "View parameters of viewer \"" << currentViewer->GetName()
|
||||
<< "\"\n set to those of viewer \"" << fromViewer->GetName()
|
||||
<< "\"."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandAutoRefresh) {
|
||||
G4bool autoRefresh = GetNewBoolValue(newValue);
|
||||
vp.SetAutoRefresh(autoRefresh);
|
||||
G4cout << "Views will ";
|
||||
if (!vp.IsAutoRefresh()) G4cout << "not ";
|
||||
G4cout << "be automatically refreshed after a change of view parameters."
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Views will ";
|
||||
if (!vp.IsAutoRefresh()) G4cout << "not ";
|
||||
G4cout << "be automatically refreshed after a change of view parameters."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandCulling) {
|
||||
@@ -250,34 +392,40 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
boolFlag = GetNewBoolValue(stringFlag);
|
||||
if (cullingOption == "global") {
|
||||
vp.SetCulling(boolFlag);
|
||||
G4cout <<
|
||||
"G4VisCommandsViewerSet::SetNewValue: culling: global culling flag"
|
||||
" set to " << ConvertToString(boolFlag) <<
|
||||
".\n Does not change specific culling flags."
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout <<
|
||||
"G4VisCommandsViewerSet::SetNewValue: culling: global culling flag"
|
||||
" set to " << ConvertToString(boolFlag) <<
|
||||
".\n Does not change specific culling flags."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
else if (cullingOption == "coveredDaughters") {
|
||||
vp.SetCullingCovered(boolFlag);
|
||||
G4cout <<
|
||||
"G4VisCommandsViewerSet::SetNewValue: culling: culling covered"
|
||||
"\n daughters flag set to "
|
||||
<< ConvertToString(boolFlag) <<
|
||||
". Daughters covered by opaque mothers"
|
||||
"\n will be culled, i.e., not drawn, if this flag is true."
|
||||
"\n Note: this is only effective in surface drawing style,"
|
||||
"\n and then only if the volumes are visible and opaque, and then"
|
||||
"\n only if no sections or cutways are in operation."
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout <<
|
||||
"G4VisCommandsViewerSet::SetNewValue: culling: culling covered"
|
||||
"\n daughters flag set to "
|
||||
<< ConvertToString(boolFlag) <<
|
||||
". Daughters covered by opaque mothers"
|
||||
"\n will be culled, i.e., not drawn, if this flag is true."
|
||||
"\n Note: this is only effective in surface drawing style,"
|
||||
"\n and then only if the volumes are visible and opaque, and then"
|
||||
"\n only if no sections or cutways are in operation."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
else if (cullingOption == "invisible") {
|
||||
vp.SetCullingInvisible(boolFlag);
|
||||
G4cout <<
|
||||
"G4VisCommandsViewerSet::SetNewValue: culling: culling invisible"
|
||||
"\n flag set to "
|
||||
<< boolFlag << ConvertToString(boolFlag) <<
|
||||
". Volumes marked invisible will be culled,"
|
||||
"\n i.e., not drawn, if this flag is true."
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout <<
|
||||
"G4VisCommandsViewerSet::SetNewValue: culling: culling invisible"
|
||||
"\n flag set to "
|
||||
<< boolFlag << ConvertToString(boolFlag) <<
|
||||
". Volumes marked invisible will be culled,"
|
||||
"\n i.e., not drawn, if this flag is true."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
else if (cullingOption == "density") {
|
||||
vp.SetDensityCulling(boolFlag);
|
||||
@@ -288,18 +436,23 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
else {
|
||||
density = vp.GetVisibleDensity();
|
||||
}
|
||||
G4cout <<
|
||||
"G4VisCommandsViewerSet::SetNewValue: culling: culling by density"
|
||||
"\n flag set to " << ConvertToString(boolFlag) <<
|
||||
". Volumes with density less than " <<
|
||||
G4BestUnit(density,"Volumic Mass") <<
|
||||
"\n will be culled, i.e., not drawn, if this flag is true."
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout <<
|
||||
"G4VisCommandsViewerSet::SetNewValue: culling: culling by density"
|
||||
"\n flag set to " << ConvertToString(boolFlag) <<
|
||||
". Volumes with density less than " <<
|
||||
G4BestUnit(density,"Volumic Mass") <<
|
||||
"\n will be culled, i.e., not drawn, if this flag is true."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
G4cout <<
|
||||
"G4VisCommandsViewerSet::SetNewValue: culling: option not recognised."
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout <<
|
||||
"ERROR: G4VisCommandsViewerSet::SetNewValue: culling:"
|
||||
"\n option not recognised."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,9 +484,11 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
break;
|
||||
}
|
||||
}
|
||||
G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
|
||||
<< "\" set to " << vp.GetDrawingStyle()
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
|
||||
<< "\" set to " << vp.GetDrawingStyle()
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandHiddenEdge) {
|
||||
@@ -366,18 +521,22 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
break;
|
||||
}
|
||||
}
|
||||
G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
|
||||
<< "\" set to " << vp.GetDrawingStyle()
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
|
||||
<< "\" set to " << vp.GetDrawingStyle()
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandHiddenMarker) {
|
||||
G4bool hidden = GetNewBoolValue(newValue);
|
||||
if (hidden) vp.SetMarkerHidden();
|
||||
else vp.SetMarkerNotHidden();
|
||||
G4cout << "Markers will ";
|
||||
if (vp.IsMarkerNotHidden()) G4cout << "not ";
|
||||
G4cout << "be hidden under solid objects." << G4endl;
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Markers will ";
|
||||
if (vp.IsMarkerNotHidden()) G4cout << "not ";
|
||||
G4cout << "be hidden under solid objects." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandLightsMove) {
|
||||
@@ -385,22 +544,51 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
if (s.find("cam") != G4String::npos) vp.SetLightsMoveWithCamera(true);
|
||||
else if(s.find("obj") != G4String::npos) vp.SetLightsMoveWithCamera(false);
|
||||
else {
|
||||
G4cout << "\"" << newValue << "\" not recognised."
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout << "ERROR: \"" << newValue << "\" not recognised."
|
||||
" Looking for \"cam\" or \"obj\" in string." << G4endl;
|
||||
}
|
||||
}
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Lights move with ";
|
||||
if (vp.GetLightsMoveWithCamera())
|
||||
G4cout << "camera (object appears to rotate).";
|
||||
else G4cout << "object (the viewer appears to be moving).";
|
||||
G4cout << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandLightsThetaPhi) {
|
||||
G4double theta, phi;
|
||||
GetNewDoublePairValue(newValue, theta, phi);
|
||||
G4double x = sin (theta) * cos (phi);
|
||||
G4double y = sin (theta) * sin (phi);
|
||||
G4double z = cos (theta);
|
||||
fLightsVector = G4ThreeVector (x, y, z);
|
||||
vp.SetLightpointDirection(fLightsVector);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Lights direction set to "
|
||||
<< vp.GetLightpointDirection() << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandLightsVector) {
|
||||
fLightsVector = GetNew3VectorValue(newValue);
|
||||
vp.SetLightpointDirection(fLightsVector);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Lights direction set to "
|
||||
<< vp.GetLightpointDirection() << G4endl;
|
||||
}
|
||||
G4cout << "Lights move with ";
|
||||
if (vp.GetLightsMoveWithCamera())
|
||||
G4cout << "camera (object appears to rotate).";
|
||||
else G4cout << "object (the viewer appears to be moving).";
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
else if (command == fpCommandLineSegments) {
|
||||
G4int nSides = GetNewIntValue(newValue);
|
||||
G4cout <<
|
||||
"Number of line segements per circle in polygon approximation is "
|
||||
<< nSides << G4endl;
|
||||
vp.SetNoOfSides(nSides);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout <<
|
||||
"Number of line segements per circle in polygon approximation is "
|
||||
<< nSides << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandProjection) {
|
||||
@@ -416,27 +604,34 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
is >> dummy >> fieldHalfAngle >> unit;
|
||||
fieldHalfAngle *= ValueOf(unit);
|
||||
if (fieldHalfAngle > 89.5 * deg || fieldHalfAngle <= 0.0) {
|
||||
G4cout << "Field half angle should be 0 < angle <= 89.5 degrees.";
|
||||
G4cout << G4endl;
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout <<
|
||||
"ERROR: Field half angle should be 0 < angle <= 89.5 degrees.";
|
||||
G4cout << G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
G4cout << "\"" << newValue << "\" not recognised."
|
||||
" Looking for 'o' or 'p' first character." << G4endl;
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout << "ERROR: \"" << newValue << "\" not recognised."
|
||||
" Looking for 'o' or 'p' first character." << G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
vp.SetFieldHalfAngle(fieldHalfAngle);
|
||||
G4cout << "Projection style of viewer \"" << currentViewer->GetName()
|
||||
<< "\" set to ";
|
||||
if (fieldHalfAngle == 0.) {
|
||||
G4cout << "orthogonal.";
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Projection style of viewer \"" << currentViewer->GetName()
|
||||
<< "\" set to ";
|
||||
if (fieldHalfAngle == 0.) {
|
||||
G4cout << "orthogonal.";
|
||||
}
|
||||
else {
|
||||
G4cout << "perspective\n with half angle " << fieldHalfAngle / deg
|
||||
<< " degrees.";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
else {
|
||||
G4cout << "perspective\n with half angle " << fieldHalfAngle / deg
|
||||
<< " degrees.";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
else if (command == fpCommandSectionPlane) {
|
||||
@@ -450,13 +645,15 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
if (choice.compareTo("off",G4String::ignoreCase) == 0) iSelector = 0;
|
||||
if (choice.compareTo("on",G4String::ignoreCase) == 0) iSelector = 1;
|
||||
if (iSelector < 0) {
|
||||
G4cout << "Choice not recognised (on/off)." << G4endl;
|
||||
G4cout << "Section drawing is currently: ";
|
||||
if (vp.IsSection ()) G4cout << "on";
|
||||
else G4cout << "off";
|
||||
G4cout << ".\nSection plane is currently: "
|
||||
<< vp.GetSectionPlane ();
|
||||
G4cout << G4endl;
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout << "Choice not recognised (on/off)." << G4endl;
|
||||
G4cout << "Section drawing is currently: ";
|
||||
if (vp.IsSection ()) G4cout << "on";
|
||||
else G4cout << "off";
|
||||
G4cout << ".\nSection plane is currently: "
|
||||
<< vp.GetSectionPlane ();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -472,15 +669,22 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
G4Point3D(x,y,z)));
|
||||
vp.SetViewpointDirection(G4Normal3D(nx,ny,nz));
|
||||
break;
|
||||
default: G4cout << "Choice not recognised (on/off).\n"; break;
|
||||
default:
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout << "ERROR: Choice not recognised (on/off)."
|
||||
<< G4endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
G4cout << "Section drawing is now: ";
|
||||
if (vp.IsSection ()) G4cout << "on";
|
||||
else G4cout << "off";
|
||||
G4cout << ".\nSection plane is now: "
|
||||
<< vp.GetSectionPlane ();
|
||||
G4cout << G4endl;
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Section drawing is now: ";
|
||||
if (vp.IsSection ()) G4cout << "on";
|
||||
else G4cout << "off";
|
||||
G4cout << ".\nSection plane is now: "
|
||||
<< vp.GetSectionPlane ();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandStyle) {
|
||||
@@ -515,18 +719,77 @@ void G4VisCommandsViewerSet::SetNewValue
|
||||
}
|
||||
}
|
||||
else {
|
||||
G4cout << "\"" << newValue << "\" not recognised."
|
||||
" Looking for 'w' or 's' first character." << G4endl;
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout << "ERROR: \"" << newValue << "\" not recognised."
|
||||
" Looking for 'w' or 's' first character." << G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
|
||||
<< "\" set to " << vp.GetDrawingStyle()
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Drawing style of viewer \"" << currentViewer->GetName()
|
||||
<< "\" set to " << vp.GetDrawingStyle()
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandUpThetaPhi) {
|
||||
G4double theta, phi;
|
||||
GetNewDoublePairValue(newValue, theta, phi);
|
||||
G4double x = sin (theta) * cos (phi);
|
||||
G4double y = sin (theta) * sin (phi);
|
||||
G4double z = cos (theta);
|
||||
fUpVector = G4ThreeVector (x, y, z);
|
||||
vp.SetUpVector(fUpVector);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Up direction set to " << vp.GetUpVector() << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandUpVector) {
|
||||
fUpVector = GetNew3VectorValue(newValue);
|
||||
vp.SetUpVector(fUpVector);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Up direction set to " << vp.GetUpVector() << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandViewpointThetaPhi) {
|
||||
G4double theta, phi;
|
||||
GetNewDoublePairValue(newValue, theta, phi);
|
||||
G4double x = sin (theta) * cos (phi);
|
||||
G4double y = sin (theta) * sin (phi);
|
||||
G4double z = cos (theta);
|
||||
fViewpointVector = G4ThreeVector (x, y, z);
|
||||
vp.SetViewAndLights(fViewpointVector);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Viewpoint direction set to "
|
||||
<< vp.GetViewpointDirection() << G4endl;
|
||||
if (vp.GetLightsMoveWithCamera ()) {
|
||||
G4cout << "Lightpoint direction set to "
|
||||
<< vp.GetActualLightpointDirection () << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (command == fpCommandViewpointVector) {
|
||||
fViewpointVector = GetNew3VectorValue(newValue);
|
||||
vp.SetViewAndLights(fViewpointVector);
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Viewpoint direction set to "
|
||||
<< vp.GetViewpointDirection() << G4endl;
|
||||
if (vp.GetLightsMoveWithCamera ()) {
|
||||
G4cout << "Lightpoint direction set to "
|
||||
<< vp.GetActualLightpointDirection () << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
G4cout << "G4VisCommandsViewerSet::SetNewValue: unrecognised command."
|
||||
<< G4endl;
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cout <<
|
||||
"ERROR: G4VisCommandsViewerSet::SetNewValue: unrecognised command."
|
||||
<< G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user