#include <G4VisCommandsViewer.hh>
Inheritance diagram for G4VisCommandViewerChangeCutawayPlane:
Public Member Functions | |
G4VisCommandViewerChangeCutawayPlane () | |
virtual | ~G4VisCommandViewerChangeCutawayPlane () |
G4String | GetCurrentValue (G4UIcommand *command) |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Definition at line 69 of file G4VisCommandsViewer.hh.
G4VisCommandViewerChangeCutawayPlane::G4VisCommandViewerChangeCutawayPlane | ( | ) |
Definition at line 158 of file G4VisCommandsViewer.cc.
References G4UIcommand::SetParameter().
00158 { 00159 G4bool omitable; 00160 fpCommand = new G4UIcommand ("/vis/viewer/changeCutawayPlane", this); 00161 fpCommand -> SetGuidance("Change cutaway plane."); 00162 G4UIparameter* parameter; 00163 parameter = new G4UIparameter("index",'i',omitable = false); 00164 parameter -> SetGuidance ("Index of plane: 0, 1, 2."); 00165 fpCommand->SetParameter(parameter); 00166 parameter = new G4UIparameter("x",'d',omitable = true); 00167 parameter -> SetDefaultValue (0); 00168 parameter -> SetGuidance ("Coordinate of point on the plane."); 00169 fpCommand->SetParameter(parameter); 00170 parameter = new G4UIparameter("y",'d',omitable = true); 00171 parameter -> SetDefaultValue (0); 00172 parameter -> SetGuidance ("Coordinate of point on the plane."); 00173 fpCommand->SetParameter(parameter); 00174 parameter = new G4UIparameter("z",'d',omitable = true); 00175 parameter -> SetDefaultValue (0); 00176 parameter -> SetGuidance ("Coordinate of point on the plane."); 00177 fpCommand->SetParameter(parameter); 00178 parameter = new G4UIparameter("unit",'s',omitable = true); 00179 parameter -> SetDefaultValue ("m"); 00180 parameter -> SetGuidance ("Unit of point on the plane."); 00181 fpCommand->SetParameter(parameter); 00182 parameter = new G4UIparameter("nx",'d',omitable = true); 00183 parameter -> SetDefaultValue (1); 00184 parameter -> SetGuidance ("Component of plane normal."); 00185 fpCommand->SetParameter(parameter); 00186 parameter = new G4UIparameter("ny",'d',omitable = true); 00187 parameter -> SetDefaultValue (0); 00188 parameter -> SetGuidance ("Component of plane normal."); 00189 fpCommand->SetParameter(parameter); 00190 parameter = new G4UIparameter("nz",'d',omitable = true); 00191 parameter -> SetDefaultValue (0); 00192 parameter -> SetGuidance ("Component of plane normal."); 00193 fpCommand->SetParameter(parameter); 00194 }
G4VisCommandViewerChangeCutawayPlane::~G4VisCommandViewerChangeCutawayPlane | ( | ) | [virtual] |
G4String G4VisCommandViewerChangeCutawayPlane::GetCurrentValue | ( | G4UIcommand * | command | ) | [virtual] |
void G4VisCommandViewerChangeCutawayPlane::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 204 of file G4VisCommandsViewer.cc.
References G4ViewParameters::ChangeCutawayPlane(), G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fpVisManager, G4cout, G4endl, G4ViewParameters::GetCutawayPlanes(), G4VViewer::GetName(), G4VisManager::GetVerbosity(), G4VViewer::GetViewParameters(), G4VVisCommandViewer::SetViewParameters(), and G4UIcommand::ValueOf().
00204 { 00205 00206 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 00207 00208 G4VViewer* viewer = fpVisManager -> GetCurrentViewer (); 00209 if (!viewer) { 00210 if (verbosity >= G4VisManager::errors) { 00211 G4cout << 00212 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities." 00213 << G4endl; 00214 } 00215 return; 00216 } 00217 00218 size_t index; 00219 G4double x, y, z, nx, ny, nz; 00220 G4String unit; 00221 std::istringstream is (newValue); 00222 is >> index >> x >> y >> z >> unit >> nx >> ny >> nz; 00223 G4double F = G4UIcommand::ValueOf(unit); 00224 x *= F; y *= F; z *= F; 00225 00226 G4ViewParameters vp = viewer->GetViewParameters(); 00227 vp.ChangeCutawayPlane(index, 00228 G4Plane3D(G4Normal3D(nx,ny,nz), G4Point3D(x,y,z))); 00229 if (verbosity >= G4VisManager::confirmations) { 00230 G4cout << "Cutaway planes for viewer \"" << viewer->GetName() << "\" now:"; 00231 const G4Planes& cutaways = vp.GetCutawayPlanes(); 00232 for (size_t i = 0; i < cutaways.size(); ++i) 00233 G4cout << "\n " << i << ": " << cutaways[i]; 00234 G4cout << G4endl; 00235 } 00236 00237 SetViewParameters(viewer, vp); 00238 }