Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
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)
 
- Public Member Functions inherited from G4VVisCommandViewer
 G4VVisCommandViewer ()
 
virtual ~G4VVisCommandViewer ()
 
- Public Member Functions inherited from G4VVisCommand
 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *)
 
- Protected Member Functions inherited from G4VVisCommandViewer
void SetViewParameters (G4VViewer *, const G4ViewParameters &)
 
void RefreshIfRequired (G4VViewer *)
 
- Protected Member Functions inherited from G4VVisCommand
void UpdateVisManagerScene (const G4String &sceneName="")
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Static Protected Member Functions inherited from G4VVisCommand
static G4String ConvertToString (G4double x, G4double y, const char *unitName)
 
static void ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentLineWidth = 1.
 
static
G4ModelingParameters::PVNameCopyNoPath 
fCurrentTouchablePath
 

Detailed Description

Definition at line 197 of file G4VisCommandsViewer.hh.

Constructor & Destructor Documentation

G4VisCommandViewerPan::G4VisCommandViewerPan ( )

Definition at line 1013 of file G4VisCommandsViewer.cc.

1013  :
1014  fPanIncrementRight (0.),
1015  fPanIncrementUp (0.),
1016  fPanToRight (0.),
1017  fPanToUp (0.)
1018 {
1019  G4bool omitable;
1020 
1021  fpCommandPan = new G4UIcommand
1022  ("/vis/viewer/pan", this);
1023  fpCommandPan -> SetGuidance
1024  ("Incremental pan.");
1025  fpCommandPan -> SetGuidance
1026  ("Moves the camera incrementally right and up by these amounts (as seen"
1027  "\nfrom viewpoint direction).");
1028  G4UIparameter* parameter;
1029  parameter = new G4UIparameter("right-increment", 'd', omitable = true);
1030  parameter -> SetCurrentAsDefault (true);
1031  fpCommandPan -> SetParameter (parameter);
1032  parameter = new G4UIparameter("up-increment", 'd', omitable = true);
1033  parameter -> SetCurrentAsDefault (true);
1034  fpCommandPan -> SetParameter (parameter);
1035  parameter = new G4UIparameter ("unit", 's', omitable = true);
1036  parameter -> SetDefaultValue ("m");
1037  fpCommandPan -> SetParameter (parameter);
1038 
1039  fpCommandPanTo = new G4UIcommand
1040  ("/vis/viewer/panTo", this);
1041  fpCommandPanTo -> SetGuidance
1042  ("Pan to specific coordinate.");
1043  fpCommandPanTo -> SetGuidance
1044  ("Places the camera in this position right and up relative to standard"
1045  "\ntarget point (as seen from viewpoint direction).");
1046  parameter = new G4UIparameter("right", 'd', omitable = true);
1047  parameter -> SetCurrentAsDefault (true);
1048  fpCommandPanTo -> SetParameter (parameter);
1049  parameter = new G4UIparameter("up", 'd', omitable = true);
1050  parameter -> SetCurrentAsDefault (true);
1051  fpCommandPanTo -> SetParameter (parameter);
1052  parameter = new G4UIparameter ("unit", 's', omitable = true);
1053  parameter -> SetDefaultValue ("m");
1054  fpCommandPanTo -> SetParameter (parameter);
1055 }
bool G4bool
Definition: G4Types.hh:79
G4VisCommandViewerPan::~G4VisCommandViewerPan ( )
virtual

Definition at line 1057 of file G4VisCommandsViewer.cc.

1057  {
1058  delete fpCommandPan;
1059  delete fpCommandPanTo;
1060 }

Member Function Documentation

G4String G4VisCommandViewerPan::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1062 of file G4VisCommandsViewer.cc.

References G4VVisCommand::ConvertToString().

1062  {
1063  G4String currentValue;
1064  if (command == fpCommandPan) {
1065  currentValue = ConvertToString(fPanIncrementRight, fPanIncrementUp, "m");
1066  }
1067  else if (command == fpCommandPanTo) {
1068  currentValue = ConvertToString(fPanToRight, fPanToUp, "m");
1069  }
1070  return currentValue;
1071 }
static G4String ConvertToString(G4double x, G4double y, const char *unitName)
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().

1074  {
1075 
1076 
1078 
1079  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
1080  if (!currentViewer) {
1081  if (verbosity >= G4VisManager::errors) {
1082  G4cout <<
1083  "ERROR: G4VisCommandsViewerPan::SetNewValue: no current viewer."
1084  << G4endl;
1085  }
1086  return;
1087  }
1088 
1089  G4ViewParameters vp = currentViewer->GetViewParameters();
1090 
1091  if (command == fpCommandPan) {
1092  ConvertToDoublePair(newValue, fPanIncrementRight, fPanIncrementUp);
1093  vp.IncrementPan(fPanIncrementRight, fPanIncrementUp);
1094  }
1095  else if (command == fpCommandPanTo) {
1096  ConvertToDoublePair(newValue, fPanToRight, fPanToUp);
1097  vp.SetPan(fPanToRight, fPanToUp);
1098  }
1099 
1100  if (verbosity >= G4VisManager::confirmations) {
1101  G4cout << "Current target point now " << vp.GetCurrentTargetPoint()
1102  << G4endl;
1103  }
1104 
1105  SetViewParameters(currentViewer, vp);
1106 }
void IncrementPan(G4double right, G4double up)
void SetPan(G4double right, G4double up)
const G4ViewParameters & GetViewParameters() const
void SetViewParameters(G4VViewer *, const G4ViewParameters &)
const G4Point3D & GetCurrentTargetPoint() const
G4GLOB_DLL std::ostream G4cout
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
G4VViewer * GetCurrentViewer() const
static void ConvertToDoublePair(const G4String &paramString, G4double &xval, G4double &yval)
static G4VisManager * fpVisManager

The documentation for this class was generated from the following files: