51 fpCommandCentreAndZoomInOn->
SetGuidance (
"Centre and zoom in on the current touchable.");
53 (
"Use \"/vis/set/touchable\" to set current touchable.");
55 (
"You may also need \"/vis/touchable/findPath\".");
57 (
"Use \"/vis/touchable/set\" to set attributes.");
60 fpCommandCentreOn->
SetGuidance (
"Centre the view on the current touchable.");
67 (
"If parameter == true, also draw extent as a white wireframe box.");
74 fpCommandDump->
SetGuidance(
"Dump touchable attributes.");
78 fpCommandExtentForField =
new G4UIcmdWithABool(
"/vis/touchable/extentForField",
this);
79 fpCommandExtentForField->
SetGuidance(
"Set extent for field.");
80 fpCommandExtentForField->
SetGuidance(
"If parameter == true, also draw.");
86 fpCommandFindPath =
new G4UIcommand(
"/vis/touchable/findPath",
this);
88 (
"Prints the path to touchable and its logical volume mother"
89 "\ngiven a physical volume name and copy no.");
90 fpCommandFindPath -> SetGuidance
91 (
"A search of all worlds is made and all physical volume names are"
92 "\nmatched against the argument of this command. If this is of the"
93 "\nform \"/regexp/\", where regexp is a regular expression (see C++ regex),"
94 "\nthe physical volume name is matched against regexp by the usual rules"
95 "\nof regular expression matching. Otherwise an exact match is required."
96 "\nFor example, \"/Shap/\" matches \"Shape1\" and \"Shape2\".");
97 fpCommandFindPath -> SetGuidance
98 (
"It may help to see a textual representation of the geometry hierarchy of"
99 "\nthe worlds. Try \"/vis/drawTree [worlds]\" or one of the driver/browser"
100 "\ncombinations that have the required functionality, e.g., HepRep.");
102 parameter =
new G4UIparameter (
"physical-volume-name",
's', omitable =
true);
103 parameter -> SetDefaultValue (
"world");
104 fpCommandFindPath -> SetParameter (parameter);
105 parameter =
new G4UIparameter (
"copy-no",
'i', omitable =
true);
106 parameter -> SetGuidance (
"If negative, matches any copy no.");
107 parameter -> SetDefaultValue (-1);
108 fpCommandFindPath -> SetParameter (parameter);
111 fpCommandLocalAxes->
SetGuidance(
"Draw local axes.");
115 fpCommandShowExtent =
new G4UIcmdWithABool(
"/vis/touchable/showExtent",
this);
116 fpCommandShowExtent->
SetGuidance(
"Print extent of touchable.");
117 fpCommandShowExtent->
SetGuidance(
"If parameter == true, also draw.");
123 fpCommandVolumeForField =
new G4UIcmdWithABool(
"/vis/touchable/volumeForField",
this);
124 fpCommandVolumeForField->
SetGuidance(
"Set volume for field.");
125 fpCommandVolumeForField->
SetGuidance(
"If parameter == true, also draw.");
133 delete fpCommandVolumeForField;
134 delete fpCommandShowExtent;
135 delete fpCommandLocalAxes;
136 delete fpCommandFindPath;
137 delete fpCommandExtentForField;
138 delete fpCommandDump;
139 delete fpCommandDraw;
140 delete fpCommandCentreAndZoomInOn;
141 delete fpCommandCentreOn;
159 size_t nWorlds = transportationManager->
GetNoWorlds();
165 "ERROR: G4VisCommandsTouchable::SetNewValue:"
166 "\n No world. Maybe the geometry has not yet been defined."
167 "\n Try \"/run/initialize\""
174 if (!currentViewer) {
177 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
187 "ERROR: No current scene - \"/vis/scene/list\" to see possibilities."
193 if (command == fpCommandCentreOn || command == fpCommandCentreAndZoomInOn) {
196 std::vector<std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>> touchables;
212 G4Scene tempScene(
"Centre Scene");
214 if (!successful)
return;
218 <<
",\n has been added to temporary scene \"" << tempScene.
GetName() <<
"\"."
226 if (command == fpCommandCentreAndZoomInOn) {
241 Twinkle(currentViewer,newVP,touchables);
246 <<
"Viewer \"" << currentViewer->
GetName()
248 if (fpCommandCentreAndZoomInOn) {
249 G4cout <<
"and zoomed in";
261 }
else if (command == fpCommandDraw) {
283 const auto& extent = pvModel->
GetExtent();
284 const G4double halfX = (extent.GetXmax()-extent.GetXmin())/2.;
285 const G4double halfY = (extent.GetYmax()-extent.GetYmin())/2.;
286 const G4double halfZ = (extent.GetZmax()-extent.GetZmin())/2.;
287 G4Box extentBox(
"extent",halfX,halfY,halfZ);
294 <<
"\", copy no. " << properties.
fCopyNo <<
" drawn";
296 G4cout <<
" with extent box";
308 }
else if (command == fpCommandDump) {
322 const std::map<G4String,G4AttDef>* attDefs = tempPVModel.
GetAttDefs();
329 G4cout <<
"\nLocal polyhedron coordinates:\n" << *polyhedron;
331 polyhedron->Transform(transform);
332 G4cout <<
"\nGlobal polyhedron coordinates:\n" << *polyhedron;
338 }
else if (command == fpCommandExtentForField) {
349 G4cout <<
"Extent for field set to " << extent
350 <<
"\nVolume for field has been cleared."
361 }
else if (command == fpCommandFindPath) {
365 std::istringstream iss(newValue);
366 iss >> pvName >> copyNo;
367 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
368 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
370 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
377 for (
const auto& findings: searchScene.
GetFindings()) {
378 findingsVector.push_back(findings);
381 for (
const auto& findings: findingsVector) {
383 << findings.fFoundBasePVPath
384 <<
' ' << findings.fpFoundPV->GetName()
385 <<
' ' << findings.fFoundPVCopyNo
386 <<
" (mother logical volume: "
387 << findings.fpFoundPV->GetMotherLogical()->GetName()
391 if (findingsVector.size()) {
393 <<
"Use this to set a particular touchable with \"/vis/set/touchable <path>\""
394 <<
"\nor to see overlaps: \"/vis/drawLogicalVolume <mother-logical-volume-name>\""
398 if (copyNo >= 0)
G4warn <<
':' << copyNo;
402 }
else if (command == fpCommandLocalAxes) {
407 const G4double intLog10LengthMax = std::floor(std::log10(lengthMax));
408 G4double length = std::pow(10,intLog10LengthMax);
409 if (5.*length < lengthMax) length *= 5.;
410 else if (2.*length < lengthMax) length *= 2.;
415 }
else if (command == fpCommandShowExtent) {
430 }
else if (command == fpCommandVolumeForField) {
461 "ERROR: G4VisCommandsTouchable::SetNewValue: unrecognised command."
G4GLOB_DLL std::ostream G4cout
void DescribeYourselfTo(G4VGraphicsScene &) override
G4VSolid * GetSolid() const
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()
std::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)
static G4UImanager * GetUIpointer()
void SetModelingParameters(const G4ModelingParameters *)
void SetGlobalTag(const G4String &)
const G4VisExtent & GetExtent() const
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 Twinkle(G4VViewer *currentViewer, const G4ViewParameters &baseVP, const std::vector< std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > > &paths)
void CopyGuidanceFrom(const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
void SetCurrentTargetPoint(const G4Point3D ¤tTargetPoint)
void SetZoomFactor(G4double zoomFactor)
void SetForceWireframe(G4bool=true)
virtual ~G4VisCommandsTouchable()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4double GetExtentRadius() const
G4VisExtent & Transform(const G4Transform3D &)
const G4Point3D & GetExtentCentre() const
void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())
G4Scene * GetCurrentScene() const
G4VSceneHandler * GetCurrentSceneHandler() const
static Verbosity GetVerbosity()
void SetVerboseLevel(G4int)
void SetVisAttributes(const G4VisAttributes *)
G4PhysicalVolumeModel::TouchableProperties FindTouchableProperties(G4ModelingParameters::PVNameCopyNoPath path)
G4ModelingParameters::PVNameCopyNoPath fTouchablePath
G4VPhysicalVolume * fpTouchablePV
std::vector< G4PhysicalVolumeNodeID > fTouchableFullPVPath
std::vector< G4PhysicalVolumeNodeID > fTouchableBaseFullPVPath
G4Transform3D fTouchableGlobalTransform