G4VisCommandViewerScale Class Reference

#include <G4VisCommandsViewer.hh>

Inheritance diagram for G4VisCommandViewerScale:

G4VVisCommandViewer G4VVisCommand G4UImessenger

Public Member Functions

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

Detailed Description

Definition at line 260 of file G4VisCommandsViewer.hh.


Constructor & Destructor Documentation

G4VisCommandViewerScale::G4VisCommandViewerScale (  ) 

Definition at line 1421 of file G4VisCommandsViewer.cc.

01421                                                  :
01422   fScaleMultiplier (G4Vector3D (1., 1., 1.)),
01423   fScaleTo         (G4Vector3D (1., 1., 1.))
01424 {
01425   G4bool omitable, currentAsDefault;
01426 
01427   fpCommandScale = new G4UIcmdWith3Vector
01428     ("/vis/viewer/scale", this);
01429   fpCommandScale -> SetGuidance ("Incremental (non-uniform) scaling.");
01430   fpCommandScale -> SetGuidance
01431     ("Multiplies components of current scaling by components of this factor."
01432      "\n Scales (x,y,z) by corresponding components of the resulting factor.");
01433   fpCommandScale -> SetGuidance
01434     ("");
01435   fpCommandScale -> SetParameterName
01436     ("x-scale-multiplier","y-scale-multiplier","z-scale-multiplier",
01437      omitable=true, currentAsDefault=true);
01438 
01439   fpCommandScaleTo = new G4UIcmdWith3Vector
01440     ("/vis/viewer/scaleTo", this);
01441   fpCommandScaleTo -> SetGuidance ("Absolute (non-uniform) scaling.");
01442   fpCommandScaleTo -> SetGuidance
01443     ("Scales (x,y,z) by corresponding components of this factor.");
01444   fpCommandScaleTo -> SetParameterName
01445     ("x-scale-factor","y-scale-factor","z-scale-factor",
01446      omitable=true, currentAsDefault=true);
01447 }

G4VisCommandViewerScale::~G4VisCommandViewerScale (  )  [virtual]

Definition at line 1449 of file G4VisCommandsViewer.cc.

01449                                                    {
01450   delete fpCommandScale;
01451   delete fpCommandScaleTo;
01452 }


Member Function Documentation

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

Reimplemented from G4UImessenger.

Definition at line 1454 of file G4VisCommandsViewer.cc.

References G4UIcommand::ConvertToString().

01454                                                                        {
01455   G4String currentValue;
01456   if (command == fpCommandScale) {
01457     currentValue = fpCommandScale->ConvertToString(G4ThreeVector(fScaleMultiplier));
01458   }
01459   else if (command == fpCommandScaleTo) {
01460     currentValue = fpCommandScaleTo->ConvertToString(G4ThreeVector(fScaleTo));
01461   }
01462   return currentValue;
01463 }

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

Reimplemented from G4UImessenger.

Definition at line 1465 of file G4VisCommandsViewer.cc.

References G4VisManager::confirmations, G4VisManager::errors, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetCurrentViewer(), G4UIcmdWith3Vector::GetNew3VectorValue(), G4ViewParameters::GetScaleFactor(), G4VisManager::GetVerbosity(), G4VViewer::GetViewParameters(), G4ViewParameters::MultiplyScaleFactor(), G4ViewParameters::SetScaleFactor(), and G4VVisCommandViewer::SetViewParameters().

01466                                                               {
01467 
01468 
01469   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
01470 
01471   G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
01472   if (!currentViewer) {
01473     if (verbosity >= G4VisManager::errors) {
01474       G4cout <<
01475         "ERROR: G4VisCommandsViewerScale::SetNewValue: no current viewer."
01476              << G4endl;
01477     }
01478     return;
01479   }
01480 
01481   G4ViewParameters vp = currentViewer->GetViewParameters();
01482 
01483   if (command == fpCommandScale) {
01484     fScaleMultiplier = fpCommandScale->GetNew3VectorValue(newValue);
01485     vp.MultiplyScaleFactor(fScaleMultiplier);
01486   }
01487   else if (command == fpCommandScaleTo) {
01488     fScaleTo = fpCommandScale->GetNew3VectorValue(newValue);
01489     vp.SetScaleFactor(fScaleTo);
01490   }
01491 
01492   if (verbosity >= G4VisManager::confirmations) {
01493     G4cout << "Scale factor changed to " << vp.GetScaleFactor() << G4endl;
01494   }
01495 
01496   SetViewParameters(currentViewer, vp);
01497 }


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