G4VisCommandViewerPan Class Reference

#include <G4VisCommandsViewer.hh>

Inheritance diagram for G4VisCommandViewerPan:

G4VVisCommandViewer G4VVisCommand G4UImessenger

Public Member Functions

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

Detailed Description

Definition at line 197 of file G4VisCommandsViewer.hh.


Constructor & Destructor Documentation

G4VisCommandViewerPan::G4VisCommandViewerPan (  ) 

Definition at line 1013 of file G4VisCommandsViewer.cc.

01013                                              :
01014   fPanIncrementRight  (0.),
01015   fPanIncrementUp  (0.),
01016   fPanToRight (0.),
01017   fPanToUp (0.)
01018 {
01019   G4bool omitable;
01020 
01021   fpCommandPan = new G4UIcommand
01022     ("/vis/viewer/pan", this);
01023   fpCommandPan -> SetGuidance
01024     ("Incremental pan.");
01025   fpCommandPan -> SetGuidance
01026     ("Moves the camera incrementally right and up by these amounts (as seen"
01027      "\nfrom viewpoint direction).");
01028   G4UIparameter* parameter;
01029   parameter = new G4UIparameter("right-increment", 'd', omitable = true);
01030   parameter -> SetCurrentAsDefault (true);
01031   fpCommandPan -> SetParameter (parameter);
01032   parameter = new G4UIparameter("up-increment", 'd', omitable = true);
01033   parameter -> SetCurrentAsDefault (true);
01034   fpCommandPan -> SetParameter (parameter);
01035   parameter = new G4UIparameter ("unit", 's', omitable = true);
01036   parameter -> SetDefaultValue ("m");
01037   fpCommandPan -> SetParameter (parameter);
01038 
01039   fpCommandPanTo = new G4UIcommand
01040     ("/vis/viewer/panTo", this);
01041   fpCommandPanTo -> SetGuidance
01042     ("Pan to specific coordinate.");
01043   fpCommandPanTo -> SetGuidance
01044     ("Places the camera in this position right and up relative to standard"
01045      "\ntarget point (as seen from viewpoint direction).");
01046   parameter = new G4UIparameter("right", 'd', omitable = true);
01047   parameter -> SetCurrentAsDefault (true);
01048   fpCommandPanTo -> SetParameter (parameter);
01049   parameter = new G4UIparameter("up", 'd', omitable = true);
01050   parameter -> SetCurrentAsDefault (true);
01051   fpCommandPanTo -> SetParameter (parameter);
01052   parameter = new G4UIparameter ("unit", 's', omitable = true);
01053   parameter -> SetDefaultValue ("m");
01054   fpCommandPanTo -> SetParameter (parameter);
01055 }

G4VisCommandViewerPan::~G4VisCommandViewerPan (  )  [virtual]

Definition at line 1057 of file G4VisCommandsViewer.cc.

01057                                                {
01058   delete fpCommandPan;
01059   delete fpCommandPanTo;
01060 }


Member Function Documentation

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

Reimplemented from G4UImessenger.

Definition at line 1062 of file G4VisCommandsViewer.cc.

References G4VVisCommand::ConvertToString().

01062                                                                      {
01063   G4String currentValue;
01064   if (command == fpCommandPan) {
01065     currentValue = ConvertToString(fPanIncrementRight, fPanIncrementUp, "m");
01066   }
01067   else if (command == fpCommandPanTo) {
01068     currentValue = ConvertToString(fPanToRight, fPanToUp, "m");
01069   }
01070   return currentValue;
01071 }

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

Reimplemented from G4UImessenger.

Definition at line 1073 of file G4VisCommandsViewer.cc.

References G4VisManager::confirmations, G4VVisCommand::ConvertToDoublePair(), G4VisManager::errors, G4VVisCommand::fpVisManager, G4cout, G4endl, G4ViewParameters::GetCurrentTargetPoint(), G4VisManager::GetCurrentViewer(), G4VisManager::GetVerbosity(), G4VViewer::GetViewParameters(), G4ViewParameters::IncrementPan(), G4ViewParameters::SetPan(), and G4VVisCommandViewer::SetViewParameters().

01074                                                             {
01075 
01076 
01077   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
01078 
01079   G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
01080   if (!currentViewer) {
01081     if (verbosity >= G4VisManager::errors) {
01082       G4cout <<
01083         "ERROR: G4VisCommandsViewerPan::SetNewValue: no current viewer."
01084              << G4endl;
01085     }
01086     return;
01087   }
01088 
01089   G4ViewParameters vp = currentViewer->GetViewParameters();
01090 
01091   if (command == fpCommandPan) {
01092     ConvertToDoublePair(newValue, fPanIncrementRight, fPanIncrementUp);
01093     vp.IncrementPan(fPanIncrementRight, fPanIncrementUp);
01094   }
01095   else if (command == fpCommandPanTo) {
01096     ConvertToDoublePair(newValue, fPanToRight, fPanToUp);
01097     vp.SetPan(fPanToRight, fPanToUp);
01098   }
01099 
01100   if (verbosity >= G4VisManager::confirmations) {
01101     G4cout << "Current target point now " << vp.GetCurrentTargetPoint()
01102            << G4endl;
01103   }
01104 
01105   SetViewParameters(currentViewer, vp);
01106 }


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