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

#include <G4VisCommandsViewer.hh>

Inheritance diagram for G4VisCommandViewerList:
G4VVisCommandViewer G4VVisCommand G4UImessenger

Public Member Functions

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

Constructor & Destructor Documentation

G4VisCommandViewerList::G4VisCommandViewerList ( )

Definition at line 912 of file G4VisCommandsViewer.cc.

912  {
913  G4bool omitable;
914  fpCommand = new G4UIcommand ("/vis/viewer/list", this);
915  fpCommand -> SetGuidance ("Lists viewers(s).");
916  fpCommand -> SetGuidance
917  ("See \"/vis/verbose\" for definition of verbosity.");
918  G4UIparameter* parameter;
919  parameter = new G4UIparameter("viewer-name", 's',
920  omitable = true);
921  parameter -> SetDefaultValue ("all");
922  fpCommand -> SetParameter (parameter);
923  parameter = new G4UIparameter ("verbosity", 's',
924  omitable = true);
925  parameter -> SetDefaultValue ("warnings");
926  fpCommand -> SetParameter (parameter);
927 }
bool G4bool
Definition: G4Types.hh:79
G4VisCommandViewerList::~G4VisCommandViewerList ( )
virtual

Definition at line 929 of file G4VisCommandsViewer.cc.

929  {
930  delete fpCommand;
931 }

Member Function Documentation

G4String G4VisCommandViewerList::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 933 of file G4VisCommandsViewer.cc.

933  {
934  return "";
935 }
void G4VisCommandViewerList::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 937 of file G4VisCommandsViewer.cc.

References G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetVerbosityValue(), and G4VisManager::parameters.

937  {
938  G4String name, verbosityString;
939  std::istringstream is (newValue);
940  is >> name >> verbosityString;
941  G4String shortName = fpVisManager -> ViewerShortName (name);
942  G4VisManager::Verbosity verbosity =
943  fpVisManager->GetVerbosityValue(verbosityString);
944 
945  const G4VViewer* currentViewer = fpVisManager -> GetCurrentViewer ();
946  G4String currentViewerShortName;
947  if (currentViewer) {
948  currentViewerShortName = currentViewer -> GetShortName ();
949  }
950  else {
951  currentViewerShortName = "none";
952  }
953 
954  const G4SceneHandlerList& sceneHandlerList =
955  fpVisManager -> GetAvailableSceneHandlers ();
956  G4int nHandlers = sceneHandlerList.size ();
957  G4bool found = false;
958  G4bool foundCurrent = false;
959  for (int iHandler = 0; iHandler < nHandlers; iHandler++) {
960  G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
961  const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
962  G4cout << "Scene handler \"" << sceneHandler -> GetName ();
963  const G4Scene* pScene = sceneHandler -> GetScene ();
964  if (pScene) {
965  G4cout << "\", scene \"" << pScene -> GetName () << "\":";
966  }
967  G4int nViewers = viewerList.size ();
968  if (nViewers == 0) {
969  G4cout << "\n No viewers for this scene handler." << G4endl;
970  }
971  else {
972  for (int iViewer = 0; iViewer < nViewers; iViewer++) {
973  const G4VViewer* thisViewer = viewerList [iViewer];
974  G4String thisName = thisViewer -> GetName ();
975  G4String thisShortName = thisViewer -> GetShortName ();
976  if (name != "all") {
977  if (thisShortName != shortName) continue;
978  }
979  found = true;
980  G4cout << "\n ";
981  if (thisShortName == currentViewerShortName) {
982  foundCurrent = true;
983  G4cout << "(current)";
984  }
985  else {
986  G4cout << " ";
987  }
988  G4cout << " viewer \"" << thisName << "\"";
989  if (verbosity >= G4VisManager::parameters) {
990  G4cout << "\n " << *thisViewer;
991  }
992  }
993  }
994  G4cout << G4endl;
995  }
996 
997  if (!foundCurrent) {
998  G4cout << "No valid current viewer - please create or select one."
999  << G4endl;
1000  }
1001 
1002  if (!found) {
1003  G4cout << "No viewers";
1004  if (name != "all") {
1005  G4cout << " of name \"" << name << "\"";
1006  }
1007  G4cout << " found." << G4endl;
1008  }
1009 }
const XML_Char * name
int G4int
Definition: G4Types.hh:78
static Verbosity GetVerbosityValue(const G4String &)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
static G4VisManager * fpVisManager

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