G4VisCommandSceneAddArrow2D Class Reference

#include <G4VisCommandsSceneAdd.hh>

Inheritance diagram for G4VisCommandSceneAddArrow2D:

G4VVisCommandScene G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandSceneAddArrow2D ()
virtual ~G4VisCommandSceneAddArrow2D ()
G4String GetCurrentValue (G4UIcommand *command)
void SetNewValue (G4UIcommand *command, G4String newValue)

Data Structures

struct  Arrow2D

Detailed Description

Definition at line 57 of file G4VisCommandsSceneAdd.hh.


Constructor & Destructor Documentation

G4VisCommandSceneAddArrow2D::G4VisCommandSceneAddArrow2D (  ) 

Definition at line 170 of file G4VisCommandsSceneAdd.cc.

00170                                                           {
00171   fpCommand = new G4UIcommand("/vis/scene/add/arrow2D", this);
00172   fpCommand -> SetGuidance ("Adds 2D arrow to current scene.");
00173   G4bool omitable;
00174   G4UIparameter* parameter;
00175   parameter = new G4UIparameter ("x1", 'd', omitable = false);
00176   fpCommand -> SetParameter (parameter);
00177   parameter = new G4UIparameter ("y1", 'd', omitable = false);
00178   fpCommand -> SetParameter (parameter);
00179   parameter = new G4UIparameter ("x2", 'd', omitable = false);
00180   fpCommand -> SetParameter (parameter);
00181   parameter = new G4UIparameter ("y2", 'd', omitable = false);
00182   fpCommand -> SetParameter (parameter);
00183 }

G4VisCommandSceneAddArrow2D::~G4VisCommandSceneAddArrow2D (  )  [virtual]

Definition at line 185 of file G4VisCommandsSceneAdd.cc.

00185                                                            {
00186   delete fpCommand;
00187 }


Member Function Documentation

G4String G4VisCommandSceneAddArrow2D::GetCurrentValue ( G4UIcommand command  )  [virtual]

Reimplemented from G4UImessenger.

Definition at line 189 of file G4VisCommandsSceneAdd.cc.

00189                                                                    {
00190   return "";
00191 }

void G4VisCommandSceneAddArrow2D::SetNewValue ( G4UIcommand command,
G4String  newValue 
) [virtual]

Reimplemented from G4UImessenger.

Definition at line 193 of file G4VisCommandsSceneAdd.cc.

References G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fCurrentColour, G4VVisCommand::fCurrentLineWidth, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetCurrentScene(), G4VisManager::GetVerbosity(), G4VModel::SetGlobalDescription(), G4VModel::SetGlobalTag(), G4VModel::SetType(), G4VVisCommand::UpdateVisManagerScene(), and G4VisManager::warnings.

00194 {
00195   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
00196   G4bool warn(verbosity >= G4VisManager::warnings);
00197 
00198   G4Scene* pScene = fpVisManager->GetCurrentScene();
00199   if (!pScene) {
00200     if (verbosity >= G4VisManager::errors) {
00201       G4cout << "ERROR: No current scene.  Please create one." << G4endl;
00202     }
00203     return;
00204   }
00205 
00206   G4double x1, y1, x2, y2;
00207   std::istringstream is(newValue);
00208   is >> x1 >> y1 >> x2 >> y2;
00209 
00210   Arrow2D* arrow2D = new Arrow2D
00211     (x1, y1, x2, y2, fCurrentLineWidth, fCurrentColour);
00212   G4VModel* model =
00213     new G4CallbackModel<G4VisCommandSceneAddArrow2D::Arrow2D>(arrow2D);
00214   model->SetType("Arrow2D");
00215   model->SetGlobalTag("Arrow2D");
00216   model->SetGlobalDescription("Arrow2D: " + newValue);
00217   const G4String& currentSceneName = pScene -> GetName ();
00218   G4bool successful = pScene -> AddRunDurationModel (model, warn);
00219   if (successful) {
00220     if (verbosity >= G4VisManager::confirmations) {
00221       G4cout << "A 2D arrow has been added to scene \""
00222              << currentSceneName << "\"."
00223              << G4endl;
00224     }
00225   }
00226   else G4VisCommandsSceneAddUnsuccessful(verbosity);
00227   UpdateVisManagerScene (currentSceneName);
00228 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:45 2013 for Geant4 by  doxygen 1.4.7