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

#include <G4VisCommandsSceneAdd.hh>

Inheritance diagram for G4VisCommandSceneAddLogicalVolume:
G4VVisCommandScene G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandSceneAddLogicalVolume ()
 
virtual ~G4VisCommandSceneAddLogicalVolume ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4VVisCommandScene
 G4VVisCommandScene ()
 
virtual ~G4VVisCommandScene ()
 
- 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 G4VVisCommandScene
G4String CurrentSceneName ()
 
- 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 241 of file G4VisCommandsSceneAdd.hh.

Constructor & Destructor Documentation

G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume ( )

Definition at line 944 of file G4VisCommandsSceneAdd.cc.

944  {
945  G4bool omitable;
946  fpCommand = new G4UIcommand ("/vis/scene/add/logicalVolume", this);
947  fpCommand -> SetGuidance ("Adds a logical volume to the current scene,");
948  fpCommand -> SetGuidance
949  ("Shows boolean components (if any), voxels (if any) and readout geometry"
950  "\n(if any). Note: voxels are not constructed until start of run -"
951  "\n \"/run/beamOn\".");
952  G4UIparameter* parameter;
953  parameter = new G4UIparameter ("logical-volume-name", 's', omitable = false);
954  fpCommand -> SetParameter (parameter);
955  parameter = new G4UIparameter ("depth-of-descent", 'i', omitable = true);
956  parameter -> SetGuidance ("Depth of descent of geometry hierarchy.");
957  parameter -> SetDefaultValue (1);
958  fpCommand -> SetParameter (parameter);
959  parameter = new G4UIparameter ("booleans-flag", 'b', omitable = true);
960  parameter -> SetDefaultValue (true);
961  fpCommand -> SetParameter (parameter);
962  parameter = new G4UIparameter ("voxels-flag", 'b', omitable = true);
963  parameter -> SetDefaultValue (true);
964  fpCommand -> SetParameter (parameter);
965  parameter = new G4UIparameter ("readout-flag", 'b', omitable = true);
966  parameter -> SetDefaultValue (true);
967  fpCommand -> SetParameter (parameter);
968 }
bool G4bool
Definition: G4Types.hh:79
G4VisCommandSceneAddLogicalVolume::~G4VisCommandSceneAddLogicalVolume ( )
virtual

Definition at line 970 of file G4VisCommandsSceneAdd.cc.

970  {
971  delete fpCommand;
972 }

Member Function Documentation

G4String G4VisCommandSceneAddLogicalVolume::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 974 of file G4VisCommandsSceneAdd.cc.

974  {
975  return "";
976 }
void G4VisCommandSceneAddLogicalVolume::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 978 of file G4VisCommandsSceneAdd.cc.

References G4VisManager::confirmations, G4UIcommand::ConvertToBool(), G4VisManager::errors, G4VVisCommand::fpVisManager, G4cout, G4endl, G4VisManager::GetCurrentScene(), G4LogicalVolumeStore::GetInstance(), G4VisManager::GetVerbosity(), G4VVisCommand::UpdateVisManagerScene(), and G4VisManager::warnings.

979  {
980 
982  G4bool warn(verbosity >= G4VisManager::warnings);
983 
984  G4Scene* pScene = fpVisManager->GetCurrentScene();
985  if (!pScene) {
986  if (verbosity >= G4VisManager::errors) {
987  G4cout << "ERROR: No current scene. Please create one." << G4endl;
988  }
989  return;
990  }
991 
992  G4String name;
993  G4int requestedDepthOfDescent;
994  G4String booleansString, voxelsString, readoutString;
995  std::istringstream is (newValue);
996  is >> name >> requestedDepthOfDescent
997  >> booleansString >> voxelsString >> readoutString;
998  G4bool booleans = G4UIcommand::ConvertToBool(booleansString);
999  G4bool voxels = G4UIcommand::ConvertToBool(voxelsString);
1000  G4bool readout = G4UIcommand::ConvertToBool(readoutString);
1001 
1003  int nLV = pLVStore -> size ();
1004  int iLV;
1005  G4LogicalVolume* pLV = 0;
1006  for (iLV = 0; iLV < nLV; iLV++ ) {
1007  pLV = (*pLVStore) [iLV];
1008  if (pLV -> GetName () == name) break;
1009  }
1010  if (iLV == nLV) {
1011  if (verbosity >= G4VisManager::errors) {
1012  G4cout << "ERROR: Logical volume " << name
1013  << " not found in logical volume store." << G4endl;
1014  }
1015  return;
1016  }
1017 
1018  const std::vector<G4Scene::Model>& rdModelList = pScene -> GetRunDurationModelList();
1019  std::vector<G4Scene::Model>::const_iterator i;
1020  for (i = rdModelList.begin(); i != rdModelList.end(); ++i) {
1021  if (i->fpModel->GetGlobalDescription().find("Volume") != std::string::npos) break;
1022  }
1023  if (i != rdModelList.end()) {
1024  if (verbosity >= G4VisManager::errors) {
1025  G4cout << "There is already a volume, \""
1026  << i->fpModel->GetGlobalDescription()
1027  << "\",\n in the run-duration model list of scene \""
1028  << pScene -> GetName()
1029  << "\".\n Your logical volume must be the only volume in the scene."
1030  << "\n Create a new scene and try again:"
1031  << "\n /vis/specify " << name
1032  << "\n or"
1033  << "\n /vis/scene/create"
1034  << "\n /vis/scene/add/logicalVolume " << name
1035  << "\n /vis/sceneHandler/attach"
1036  << "\n (and also, if necessary, /vis/viewer/flush)"
1037  << G4endl;
1038  }
1039  }
1040 
1042  (pLV, requestedDepthOfDescent, booleans, voxels, readout);
1043  const G4String& currentSceneName = pScene -> GetName ();
1044  G4bool successful = pScene -> AddRunDurationModel (model, warn);
1045  if (successful) {
1046  if (verbosity >= G4VisManager::confirmations) {
1047  G4cout << "Logical volume \"" << pLV -> GetName ()
1048  << " with requested depth of descent "
1049  << requestedDepthOfDescent
1050  << ",\n with";
1051  if (!booleans) G4cout << "out";
1052  G4cout << " boolean components, with";
1053  if (!voxels) G4cout << "out";
1054  G4cout << " voxels and with";
1055  if (!readout) G4cout << "out";
1056  G4cout << " readout geometry,"
1057  << "\n has been added to scene \"" << currentSceneName << "\"."
1058  << G4endl;
1059  }
1060  }
1061  else {
1062  G4VisCommandsSceneAddUnsuccessful(verbosity);
1063  return;
1064  }
1065 
1066  UpdateVisManagerScene (currentSceneName);
1067 }
void UpdateVisManagerScene(const G4String &sceneName="")
const XML_Char * name
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:411
bool G4bool
Definition: G4Types.hh:79
static G4LogicalVolumeStore * GetInstance()
const XML_Char XML_Content * model
static Verbosity GetVerbosity()
#define G4endl
Definition: G4ios.hh:61
G4Scene * GetCurrentScene() const
static G4VisManager * fpVisManager

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