48 fpCommandCentreAndZoomInOn->
SetGuidance (
"Centre and zoom in on the current touchable.");
50 (
"Use \"/vis/set/touchable\" to set current touchable.");
52 (
"You may also need \"/vis/touchable/findPath\".");
54 (
"Use \"/vis/touchable/set\" to set attributes.");
57 fpCommandCentreOn->
SetGuidance (
"Centre the view on the current touchable.");
67 fpCommandDump->
SetGuidance(
"Dump touchable attributes.");
71 fpCommandExtentForField =
new G4UIcmdWithABool(
"/vis/touchable/extentForField",
this);
72 fpCommandExtentForField->
SetGuidance(
"Set extent for field.");
73 fpCommandExtentForField->
SetGuidance(
"If parameter == true, also draw.");
79 fpCommandFindPath =
new G4UIcommand(
"/vis/touchable/findPath",
this);
81 (
"Prints the path to touchable and its logical volume mother"
82 "\ngiven a physical volume name and copy no.");
83 fpCommandFindPath -> SetGuidance
84 (
"A search of all worlds is made and all physical volume names are"
85 "\nmatched against the argument of this command. If this is of the"
86 "\nform \"/regexp/\", where regexp is a regular expression (see C++ regex),"
87 "\nthe physical volume name is matched against regexp by the usual rules"
88 "\nof regular expression matching. Otherwise an exact match is required."
89 "\nFor example, \"/Shap/\" matches \"Shape1\" and \"Shape2\".");
90 fpCommandFindPath -> SetGuidance
91 (
"It may help to see a textual representation of the geometry hierarchy of"
92 "\nthe worlds. Try \"/vis/drawTree [worlds]\" or one of the driver/browser"
93 "\ncombinations that have the required functionality, e.g., HepRep.");
95 parameter =
new G4UIparameter (
"physical-volume-name",
's', omitable =
true);
96 parameter -> SetDefaultValue (
"world");
97 fpCommandFindPath -> SetParameter (parameter);
98 parameter =
new G4UIparameter (
"copy-no",
'i', omitable =
true);
99 parameter -> SetGuidance (
"If negative, matches any copy no.");
100 parameter -> SetDefaultValue (-1);
101 fpCommandFindPath -> SetParameter (parameter);
103 fpCommandShowExtent =
new G4UIcmdWithABool(
"/vis/touchable/showExtent",
this);
104 fpCommandShowExtent->
SetGuidance(
"Print extent of touchable.");
105 fpCommandShowExtent->
SetGuidance(
"If parameter == true, also draw.");
111 fpCommandVolumeForField =
new G4UIcmdWithABool(
"/vis/touchable/volumeForField",
this);
112 fpCommandVolumeForField->
SetGuidance(
"Set volume for field.");
113 fpCommandVolumeForField->
SetGuidance(
"If parameter == true, also draw.");
121 delete fpCommandVolumeForField;
122 delete fpCommandShowExtent;
123 delete fpCommandFindPath;
124 delete fpCommandExtentForField;
125 delete fpCommandDump;
126 delete fpCommandDraw;
127 delete fpCommandCentreAndZoomInOn;
128 delete fpCommandCentreOn;
146 size_t nWorlds = transportationManager->
GetNoWorlds();
152 "ERROR: G4VisCommandsTouchable::SetNewValue:"
153 "\n No world. Maybe the geometry has not yet been defined."
154 "\n Try \"/run/initialize\""
161 if (!currentViewer) {
164 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
174 "ERROR: No current scene - \"/vis/scene/list\" to see possibilities."
180 if (command == fpCommandCentreOn || command == fpCommandCentreAndZoomInOn) {
195 G4Scene tempScene(
"Centre Scene");
201 <<
",\n has been added to temporary scene \"" << tempScene.
GetName() <<
"\"."
209 if (command == fpCommandCentreAndZoomInOn) {
222 <<
"Viewer \"" << currentViewer->
GetName()
224 if (fpCommandCentreAndZoomInOn) {
225 G4cout <<
"and zoomed in";
236 }
else if (command == fpCommandDraw) {
265 <<
"\", copy no. " << properties.
fCopyNo <<
" drawn"
276 }
else if (command == fpCommandDump) {
290 const std::map<G4String,G4AttDef>* attDefs = tempPVModel.
GetAttDefs();
296 G4cout <<
"\nLocal polyhedron coordinates:\n" << *polyhedron;
299 G4cout <<
"\nGlobal polyhedron coordinates:\n" << *polyhedron;
305 }
else if (command == fpCommandExtentForField) {
316 G4cout <<
"Extent for field set to " << extent
317 <<
"\nVolume for field has been cleared."
328 }
else if (command == fpCommandFindPath) {
332 std::istringstream iss(newValue);
333 iss >> pvName >> copyNo;
334 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
335 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
337 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
343 for (
const auto& findings: searchScene.
GetFindings()) {
344 findingsVector.push_back(findings);
347 for (
const auto& findings: findingsVector) {
349 << findings.fFoundBasePVPath
350 <<
' ' << findings.fpFoundPV->GetName()
351 <<
' ' << findings.fFoundPVCopyNo
352 <<
" (mother logical volume: "
353 << findings.fpFoundPV->GetMotherLogical()->GetName()
357 if (findingsVector.size()) {
359 <<
"Use this to set a particular touchable with \"/vis/set/touchable <path>\""
360 <<
"\nor to see overlaps: \"/vis/drawLogicalVolume <mother-logical-volume-name>\""
364 if (copyNo >= 0)
G4cout <<
':' << copyNo;
368 }
else if (command == fpCommandShowExtent) {
383 }
else if (command == fpCommandVolumeForField) {
414 "ERROR: G4VisCommandsTouchable::SetNewValue: unrecognised command."
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
G4VSolid * GetSolid() const
G4Transform3D * GetCurrentTransform() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
void DescribeYourselfTo(G4VGraphicsScene &)
const std::map< G4String, G4AttDef > * GetAttDefs() const
const std::vector< Findings > & GetFindings() const
G4bool AddRunDurationModel(G4VModel *, G4bool warn=false)
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
const G4String & GetName() const
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
size_t GetNoWorlds() const
static G4bool GetNewBoolValue(const char *paramString)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetGuidance(const char *aGuidance)
G4int ApplyCommand(const char *aCommand)
G4int GetVerboseLevel() const
static G4UImanager * GetUIpointer()
void SetVerboseLevel(G4int val)
void SetModelingParameters(const G4ModelingParameters *)
virtual void SetCopyNo(G4int CopyNo)=0
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
virtual G4VisExtent GetExtent() const
virtual G4Polyhedron * GetPolyhedron() const
const G4String & GetName() const
const G4ViewParameters & GetViewParameters() const
void G4VisCommandsSceneAddUnsuccessful(G4VisManager::Verbosity verbosity)
static std::vector< G4PhysicalVolumesSearchScene::Findings > fCurrrentPVFindingsForField
static G4VisManager * fpVisManager
static G4VisExtent fCurrentExtentForField
void DrawExtent(const G4VisExtent &)
void InterpolateToNewView(G4VViewer *currentViewer, const G4ViewParameters &oldVP, const G4ViewParameters &newVP, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
void SetViewParameters(G4VViewer *viewer, const G4ViewParameters &viewParams)
static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
void CopyGuidanceFrom(const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
void SetCurrentTargetPoint(const G4Point3D ¤tTargetPoint)
void SetZoomFactor(G4double zoomFactor)
virtual ~G4VisCommandsTouchable()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4double GetExtentRadius() const
G4VisExtent & Transform(const G4Transform3D &)
const G4Point3D & GetExtentCentre() const
G4Scene * GetCurrentScene() const
static Verbosity GetVerbosity()
HepPolyhedron & Transform(const G4Transform3D &t)
G4PhysicalVolumeModel::TouchableProperties FindTouchableProperties(G4ModelingParameters::PVNameCopyNoPath path)
G4ModelingParameters::PVNameCopyNoPath fTouchablePath
G4VPhysicalVolume * fpTouchablePV
std::vector< G4PhysicalVolumeNodeID > fTouchableBaseFullPVPath
G4Transform3D fTouchableGlobalTransform