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.");
124 fpCommandTwinkle->
SetGuidance(
"Cause touchable to twinkle.");
128 fpCommandVolumeForField =
new G4UIcmdWithABool(
"/vis/touchable/volumeForField",
this);
129 fpCommandVolumeForField->
SetGuidance(
"Set volume for field.");
130 fpCommandVolumeForField->
SetGuidance(
"If parameter == true, also draw.");
138 delete fpCommandVolumeForField;
139 delete fpCommandTwinkle;
140 delete fpCommandShowExtent;
141 delete fpCommandLocalAxes;
142 delete fpCommandFindPath;
143 delete fpCommandExtentForField;
144 delete fpCommandDump;
145 delete fpCommandDraw;
146 delete fpCommandCentreAndZoomInOn;
147 delete fpCommandCentreOn;
165 size_t nWorlds = transportationManager->
GetNoWorlds();
171 "ERROR: G4VisCommandsTouchable::SetNewValue:"
172 "\n No world. Maybe the geometry has not yet been defined."
173 "\n Try \"/run/initialize\""
180 if (!currentViewer) {
183 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
193 "ERROR: No current scene - \"/vis/scene/list\" to see possibilities."
199 if (command == fpCommandCentreOn || command == fpCommandCentreAndZoomInOn) {
202 std::vector<std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>> touchables;
218 G4Scene tempScene(
"Centre Scene");
220 if (!successful)
return;
224 <<
",\n has been added to temporary scene \"" << tempScene.
GetName() <<
"\"."
232 if (command == fpCommandCentreAndZoomInOn) {
247 Twinkle(currentViewer,newVP,touchables);
252 <<
"Viewer \"" << currentViewer->
GetName()
254 if (fpCommandCentreAndZoomInOn) {
255 G4cout <<
"and zoomed in";
266 }
else if (command == fpCommandDraw) {
288 const auto& extent = pvModel->
GetExtent();
289 const G4double halfX = (extent.GetXmax()-extent.GetXmin())/2.;
290 const G4double halfY = (extent.GetYmax()-extent.GetYmin())/2.;
291 const G4double halfZ = (extent.GetZmax()-extent.GetZmin())/2.;
292 G4Box extentBox(
"extent",halfX,halfY,halfZ);
299 <<
"\", copy no. " << properties.
fCopyNo <<
" drawn";
301 G4cout <<
" with extent box";
313 }
else if (command == fpCommandDump) {
327 const std::map<G4String,G4AttDef>* attDefs = tempPVModel.
GetAttDefs();
334 G4cout <<
"\nLocal polyhedron coordinates:\n" << *polyhedron;
336 polyhedron->Transform(transform);
337 G4cout <<
"\nGlobal polyhedron coordinates:\n" << *polyhedron;
343 }
else if (command == fpCommandExtentForField) {
354 G4cout <<
"Extent for field set to " << extent
355 <<
"\nVolume for field has been cleared."
366 }
else if (command == fpCommandFindPath) {
370 std::istringstream iss(newValue);
371 iss >> pvName >> copyNo;
372 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
373 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
375 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
382 for (
const auto& findings: searchScene.
GetFindings()) {
383 findingsVector.push_back(findings);
386 for (
const auto& findings: findingsVector) {
388 << findings.fFoundBasePVPath
389 <<
' ' << findings.fpFoundPV->GetName()
390 <<
' ' << findings.fFoundPVCopyNo
391 <<
" (mother logical volume: "
392 << findings.fpFoundPV->GetMotherLogical()->GetName()
396 if (findingsVector.size()) {
398 <<
"Use this to set a particular touchable with \"/vis/set/touchable <path>\""
399 <<
"\nor to see overlaps: \"/vis/drawLogicalVolume <mother-logical-volume-name>\""
403 if (copyNo >= 0)
G4warn <<
':' << copyNo;
408 }
else if (command == fpCommandLocalAxes) {
416 const G4double intLog10LengthMax = std::floor(std::log10(lengthMax));
417 G4double length = std::pow(10,intLog10LengthMax);
418 if (5.*length < lengthMax) length *= 5.;
419 else if (2.*length < lengthMax) length *= 2.;
429 }
else if (command == fpCommandShowExtent) {
444 }
else if (command == fpCommandTwinkle) {
449 std::vector<std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>> touchables;
462 }
else if (command == fpCommandVolumeForField) {
493 "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