189 {
190
193
195 if (!currentViewer) {
198 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
200 }
201 return;
202 }
203
206 std::istringstream is (newValue);
207 is >> pvName >> copyNo;
208
209
212 std::size_t nWorlds = transportationManager->
GetNoWorlds();
213 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
214 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
216 for (std::size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
219 searchModel.SetModelingParameters (&mp);
220
222 searchModel.DescribeYourselfTo (searchScene);
223 for (const auto& findings: searchScene.GetFindings()) {
224 findingsVector.push_back(findings);
225 }
226 }
227
228 if (findingsVector.empty()) {
231 << "WARNING: Volume \"" << pvName << "\" ";
232 if (copyNo > 0) {
233 G4warn <<
"copy number " << copyNo;
234 }
236 }
237 return;
238 }
239
240
241 std::vector<std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>> foundPaths;
242
243
244 G4Scene tempScene(
"Centre Scene");
245 G4bool successfullyAdded =
true;
246 for (const auto& findings: findingsVector) {
247
248 findings.fpFoundPV->SetCopyNo(findings.fFoundPVCopyNo);
249
250
251
253 (findings.fpFoundPV,
254 0,
255 findings.fFoundObjectTransformation,
256 0,
257 true,
258 findings.fFoundBasePVPath);
259
260 auto successful = tempScene.AddRunDurationModel(tempPVModel,warn);
261 if (!successful) {
262 successfullyAdded = false;
263 continue;
264 }
266 G4cout <<
"\"" << findings.fpFoundPV->GetName()
267 << "\", copy no. " << findings.fFoundPVCopyNo
268 << ",\n found in searched volume \""
269 << findings.fpSearchPV->GetName()
270 << "\" at depth " << findings.fFoundDepth
271 << ",\n base path: \"" << findings.fFoundBasePVPath
272 << ",\n has been added to temporary scene \"" << tempScene.GetName() << "\"."
274 }
275 foundPaths.push_back(findings.fFoundFullPVPath);
276 }
277
278 for (const auto& sceneModel: tempScene.GetRunDurationModelList()) {
279 delete sceneModel.fpModel;
280 }
281 if (!successfullyAdded) return;
282
283
284 const G4VisExtent& newExtent = tempScene.GetExtent();
286
290 if (command == fpCommandCentreAndZoomInOn) {
291
295 }
296
299
300
302
306
307 Twinkle(currentViewer,newVP,foundPaths);
309 }
310
313 <<
"Viewer \"" << currentViewer->
GetName()
314 << "\" centred ";
315 if (fpCommandCentreAndZoomInOn) {
316 G4cout <<
"and zoomed in";
317 }
318 G4cout <<
" on physical volume(s) \"" << pvName <<
'\"'
320 }
321
323}
G4GLOB_DLL std::ostream G4cout
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
std::size_t GetNoWorlds() const
G4Scene * GetScene() const
const G4String & GetName() const
const G4ViewParameters & GetViewParameters() const
G4double GetKernelVisitElapsedTimeSeconds() const
G4VSceneHandler * GetSceneHandler() const
static G4VisManager * fpVisManager
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)
void Twinkle(G4VViewer *currentViewer, const G4ViewParameters &baseVP, const std::vector< std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > > &paths)
void SetCurrentTargetPoint(const G4Point3D ¤tTargetPoint)
void SetZoomFactor(G4double zoomFactor)
G4double GetExtentRadius() const
const G4Point3D & GetExtentCentre() const
static Verbosity GetVerbosity()
void SetVerboseLevel(G4int)