Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4VisCommandViewerZoom Class Reference

#include <G4VisCommandsViewer.hh>

Inheritance diagram for G4VisCommandViewerZoom:
G4VVisCommandViewer G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandViewerZoom ()
 
virtual ~G4VisCommandViewerZoom ()
 
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 299 of file G4VisCommandsViewer.hh.

Constructor & Destructor Documentation

G4VisCommandViewerZoom::G4VisCommandViewerZoom ( )

Definition at line 1638 of file G4VisCommandsViewer.cc.

1638  :
1639  fZoomMultiplier (1.),
1640  fZoomTo (1.)
1641 {
1642  G4bool omitable, currentAsDefault;
1643 
1644  fpCommandZoom = new G4UIcmdWithADouble
1645  ("/vis/viewer/zoom", this);
1646  fpCommandZoom -> SetGuidance ("Incremental zoom.");
1647  fpCommandZoom -> SetGuidance
1648  ("Multiplies current magnification by this factor.");
1649  fpCommandZoom -> SetParameterName("multiplier",
1650  omitable=true,
1651  currentAsDefault=true);
1652 
1653  fpCommandZoomTo = new G4UIcmdWithADouble
1654  ("/vis/viewer/zoomTo", this);
1655  fpCommandZoomTo -> SetGuidance ("Absolute zoom.");
1656  fpCommandZoomTo -> SetGuidance
1657  ("Magnifies standard magnification by this factor.");
1658  fpCommandZoomTo -> SetParameterName("factor",
1659  omitable=true,
1660  currentAsDefault=true);
1661 }
bool G4bool
Definition: G4Types.hh:79
G4VisCommandViewerZoom::~G4VisCommandViewerZoom ( )
virtual

Definition at line 1663 of file G4VisCommandsViewer.cc.

1663  {
1664  delete fpCommandZoom;
1665  delete fpCommandZoomTo;
1666 }

Member Function Documentation

G4String G4VisCommandViewerZoom::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1668 of file G4VisCommandsViewer.cc.

References G4UIcommand::ConvertToString().

1668  {
1669  G4String currentValue;
1670  if (command == fpCommandZoom) {
1671  currentValue = fpCommandZoom->ConvertToString(fZoomMultiplier);
1672  }
1673  else if (command == fpCommandZoomTo) {
1674  currentValue = fpCommandZoomTo->ConvertToString(fZoomTo);
1675  }
1676  return currentValue;
1677 }
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
void G4VisCommandViewerZoom::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 1679 of file G4VisCommandsViewer.cc.

References G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetCurrentViewer(), G4UIcmdWithADouble::GetNewDoubleValue(), G4VisManager::GetVerbosity(), G4VViewer::GetViewParameters(), G4ViewParameters::GetZoomFactor(), G4ViewParameters::MultiplyZoomFactor(), G4VVisCommandViewer::SetViewParameters(), and G4ViewParameters::SetZoomFactor().

1680  {
1681 
1682 
1684 
1685  G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
1686  if (!currentViewer) {
1687  if (verbosity >= G4VisManager::errors) {
1688  G4cout <<
1689  "ERROR: G4VisCommandsViewerZoom::SetNewValue: no current viewer."
1690  << G4endl;
1691  }
1692  return;
1693  }
1694 
1695  G4ViewParameters vp = currentViewer->GetViewParameters();
1696 
1697  if (command == fpCommandZoom) {
1698  fZoomMultiplier = fpCommandZoom->GetNewDoubleValue(newValue);
1699  vp.MultiplyZoomFactor(fZoomMultiplier);
1700  }
1701  else if (command == fpCommandZoomTo) {
1702  fZoomTo = fpCommandZoom->GetNewDoubleValue(newValue);
1703  vp.SetZoomFactor(fZoomTo);
1704  }
1705 
1706  if (verbosity >= G4VisManager::confirmations) {
1707  G4cout << "Zoom factor changed to " << vp.GetZoomFactor() << G4endl;
1708  }
1709 
1710  SetViewParameters(currentViewer, vp);
1711 }
G4double GetZoomFactor() const
const G4ViewParameters & GetViewParameters() const
void SetViewParameters(G4VViewer *, const G4ViewParameters &)
G4GLOB_DLL std::ostream G4cout
void SetZoomFactor(G4double zoomFactor)
static G4double GetNewDoubleValue(const char *paramString)
void MultiplyZoomFactor(G4double zoomFactorMultiplier)
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
G4VViewer * GetCurrentViewer() const
static G4VisManager * fpVisManager

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