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)

Detailed Description

Definition at line 299 of file G4VisCommandsViewer.hh.


Constructor & Destructor Documentation

G4VisCommandViewerZoom::G4VisCommandViewerZoom (  ) 

Definition at line 1629 of file G4VisCommandsViewer.cc.

01629                                                :
01630   fZoomMultiplier (1.),
01631   fZoomTo         (1.)
01632 {
01633   G4bool omitable, currentAsDefault;
01634 
01635   fpCommandZoom = new G4UIcmdWithADouble
01636     ("/vis/viewer/zoom", this);
01637   fpCommandZoom -> SetGuidance ("Incremental zoom.");
01638   fpCommandZoom -> SetGuidance
01639     ("Multiplies current magnification by this factor.");
01640   fpCommandZoom -> SetParameterName("multiplier",
01641                                      omitable=true,
01642                                      currentAsDefault=true);
01643 
01644   fpCommandZoomTo = new G4UIcmdWithADouble
01645     ("/vis/viewer/zoomTo", this);
01646   fpCommandZoomTo -> SetGuidance ("Absolute zoom.");
01647   fpCommandZoomTo -> SetGuidance
01648     ("Magnifies standard magnification by this factor.");
01649   fpCommandZoomTo -> SetParameterName("factor",
01650                                        omitable=true,
01651                                        currentAsDefault=true);
01652 }

G4VisCommandViewerZoom::~G4VisCommandViewerZoom (  )  [virtual]

Definition at line 1654 of file G4VisCommandsViewer.cc.

01654                                                  {
01655   delete fpCommandZoom;
01656   delete fpCommandZoomTo;
01657 }


Member Function Documentation

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

Reimplemented from G4UImessenger.

Definition at line 1659 of file G4VisCommandsViewer.cc.

References G4UIcommand::ConvertToString().

01659                                                                       {
01660   G4String currentValue;
01661   if (command == fpCommandZoom) {
01662     currentValue = fpCommandZoom->ConvertToString(fZoomMultiplier);
01663   }
01664   else if (command == fpCommandZoomTo) {
01665     currentValue = fpCommandZoomTo->ConvertToString(fZoomTo);
01666   }
01667   return currentValue;
01668 }

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

Reimplemented from G4UImessenger.

Definition at line 1670 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().

01671                                                              {
01672 
01673 
01674   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
01675 
01676   G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
01677   if (!currentViewer) {
01678     if (verbosity >= G4VisManager::errors) {
01679       G4cout <<
01680         "ERROR: G4VisCommandsViewerZoom::SetNewValue: no current viewer."
01681              << G4endl;
01682     }
01683     return;
01684   }
01685 
01686   G4ViewParameters vp = currentViewer->GetViewParameters();
01687 
01688   if (command == fpCommandZoom) {
01689     fZoomMultiplier = fpCommandZoom->GetNewDoubleValue(newValue);
01690     vp.MultiplyZoomFactor(fZoomMultiplier);
01691   }
01692   else if (command == fpCommandZoomTo) {
01693     fZoomTo = fpCommandZoom->GetNewDoubleValue(newValue);
01694     vp.SetZoomFactor(fZoomTo);
01695   }
01696 
01697   if (verbosity >= G4VisManager::confirmations) {
01698     G4cout << "Zoom factor changed to " << vp.GetZoomFactor() << G4endl;
01699   }
01700 
01701   SetViewParameters(currentViewer, vp);
01702 }


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