Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisCommandViewerZoom Class Reference

#include <G4VisCommandsViewer.hh>

+ Inheritance diagram for G4VisCommandViewerZoom:

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)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
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)
 
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::G4VisCommandViewerZoom ( )

Definition at line 1629 of file G4VisCommandsViewer.cc.

1629 :
1630 fZoomMultiplier (1.),
1631 fZoomTo (1.)
1632{
1633 G4bool omitable, currentAsDefault;
1634
1635 fpCommandZoom = new G4UIcmdWithADouble
1636 ("/vis/viewer/zoom", this);
1637 fpCommandZoom -> SetGuidance ("Incremental zoom.");
1638 fpCommandZoom -> SetGuidance
1639 ("Multiplies current magnification by this factor.");
1640 fpCommandZoom -> SetParameterName("multiplier",
1641 omitable=true,
1642 currentAsDefault=true);
1643
1644 fpCommandZoomTo = new G4UIcmdWithADouble
1645 ("/vis/viewer/zoomTo", this);
1646 fpCommandZoomTo -> SetGuidance ("Absolute zoom.");
1647 fpCommandZoomTo -> SetGuidance
1648 ("Magnifies standard magnification by this factor.");
1649 fpCommandZoomTo -> SetParameterName("factor",
1650 omitable=true,
1651 currentAsDefault=true);
1652}
bool G4bool
Definition: G4Types.hh:67

◆ ~G4VisCommandViewerZoom()

G4VisCommandViewerZoom::~G4VisCommandViewerZoom ( )
virtual

Definition at line 1654 of file G4VisCommandsViewer.cc.

1654 {
1655 delete fpCommandZoom;
1656 delete fpCommandZoomTo;
1657}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandViewerZoom::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1659 of file G4VisCommandsViewer.cc.

1659 {
1660 G4String currentValue;
1661 if (command == fpCommandZoom) {
1662 currentValue = fpCommandZoom->ConvertToString(fZoomMultiplier);
1663 }
1664 else if (command == fpCommandZoomTo) {
1665 currentValue = fpCommandZoomTo->ConvertToString(fZoomTo);
1666 }
1667 return currentValue;
1668}
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:349

◆ SetNewValue()

void G4VisCommandViewerZoom::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 1670 of file G4VisCommandsViewer.cc.

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

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