Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4VisCommandViewerRefresh Class Reference

#include <G4VisCommandsViewer.hh>

Inheritance diagram for G4VisCommandViewerRefresh:
Collaboration diagram for G4VisCommandViewerRefresh:

Public Member Functions

 G4VisCommandViewerRefresh ()
 
virtual ~G4VisCommandViewerRefresh ()
 
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
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *)
 
static const G4ColourGetCurrentColour ()
 
static G4double GetCurrentLineWidth ()
 
static const G4ColourGetCurrentTextColour ()
 
static G4Text::Layout GetCurrentTextLayout ()
 
static G4double GetCurrentTextSize ()
 
- 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
 
G4bool commandsShouldBeInMaster
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4int fErrorCode = 0
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4double fCurrentLineWidth = 1.
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentTextSize = 12.
 
static
G4ModelingParameters::PVNameCopyNoPath 
fCurrentTouchablePath
 

Detailed Description

Definition at line 248 of file G4VisCommandsViewer.hh.

Constructor & Destructor Documentation

G4VisCommandViewerRefresh::G4VisCommandViewerRefresh ( )

Definition at line 1465 of file G4VisCommandsViewer.cc.

1465  {
1466  G4bool omitable, currentAsDefault;
1467  fpCommand = new G4UIcmdWithAString ("/vis/viewer/refresh", this);
1468  fpCommand -> SetGuidance
1469  ("Refreshes viewer.");
1470  fpCommand -> SetGuidance
1471  ("By default, acts on current viewer. \"/vis/viewer/list\""
1472  "\nto see possible viewers. Viewer becomes current.");
1473  fpCommand -> SetParameterName ("viewer-name",
1474  omitable = true,
1475  currentAsDefault = true);
1476 }
bool G4bool
Definition: G4Types.hh:79
G4VisCommandViewerRefresh::~G4VisCommandViewerRefresh ( )
virtual

Definition at line 1478 of file G4VisCommandsViewer.cc.

1478  {
1479  delete fpCommand;
1480 }

Member Function Documentation

G4String G4VisCommandViewerRefresh::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 1482 of file G4VisCommandsViewer.cc.

1482  {
1483  G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
1484  return viewer ? viewer -> GetName () : G4String("none");
1485 }
static G4VisManager * fpVisManager
void G4VisCommandViewerRefresh::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 1487 of file G4VisCommandsViewer.cc.

1487  {
1488 
1490  G4bool warn(verbosity >= G4VisManager::warnings);
1491 
1492  G4String& refreshName = newValue;
1493  G4VViewer* viewer = fpVisManager -> GetViewer (refreshName);
1494  if (!viewer) {
1495  if (verbosity >= G4VisManager::errors) {
1496  G4cerr << "ERROR: Viewer \"" << refreshName << "\"" <<
1497  " not found - \"/vis/viewer/list\"\n to see possibilities."
1498  << G4endl;
1499  }
1500  return;
1501  }
1502 
1503  G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
1504  if (!sceneHandler) {
1505  if (verbosity >= G4VisManager::errors) {
1506  G4cerr << "ERROR: Viewer \"" << refreshName << "\"" <<
1507  " has no scene handler - report serious bug."
1508  << G4endl;
1509  }
1510  return;
1511  }
1512 
1513  G4Scene* scene = sceneHandler->GetScene();
1514  if (!scene) {
1515  if (verbosity >= G4VisManager::confirmations) {
1516  G4cout << "NOTE: SceneHandler \"" << sceneHandler->GetName()
1517  << "\", to which viewer \"" << refreshName << "\"" <<
1518  "\n is attached, has no scene - \"/vis/scene/create\" and"
1519  " \"/vis/sceneHandler/attach\""
1520  "\n (or use compound command \"/vis/drawVolume\")."
1521  << G4endl;
1522  }
1523  return;
1524  }
1525  if (scene->GetRunDurationModelList().empty()) {
1526  G4bool successful = scene -> AddWorldIfEmpty (warn);
1527  if (!successful) {
1528  if (verbosity >= G4VisManager::warnings) {
1529  G4cout <<
1530  "WARNING: Scene is empty. Perhaps no geometry exists."
1531  "\n Try /run/initialize."
1532  << G4endl;
1533  }
1534  return;
1535  }
1536  // Scene has changed. UpdateVisManagerScene issues
1537  // /vis/scene/notifyHandlers, which does a refresh anyway, so the
1538  // ordinary refresh becomes part of the else phrase...
1539  UpdateVisManagerScene(scene->GetName());
1540  } else {
1541  if (verbosity >= G4VisManager::confirmations) {
1542  G4cout << "Refreshing viewer \"" << viewer -> GetName () << "\"..."
1543  << G4endl;
1544  }
1545  viewer -> SetView ();
1546  viewer -> ClearView ();
1547  viewer -> DrawView ();
1548  if (verbosity >= G4VisManager::confirmations) {
1549  G4cout << "Viewer \"" << viewer -> GetName () << "\"" << " refreshed."
1550  "\n (You might also need \"/vis/viewer/update\".)" << G4endl;
1551  }
1552  }
1553 }
void UpdateVisManagerScene(const G4String &sceneName="")
const G4String & GetName() const
const G4String & GetName() const
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
const std::vector< Model > & GetRunDurationModelList() const
G4Scene * GetScene() const
G4VSceneHandler * GetSceneHandler() const
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
static G4VisManager * fpVisManager

Here is the call graph for this function:


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