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 size_t nWorlds = transportationManager->
GetNoWorlds();
213 std::vector<G4PhysicalVolumesSearchScene::Findings> findingsVector;
214 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
216 for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
219 searchModel.SetModelingParameters (&mp);
221 searchModel.DescribeYourselfTo (searchScene);
222 for (const auto& findings: searchScene.GetFindings()) {
223 findingsVector.push_back(findings);
224 }
225 }
226
227 if (findingsVector.empty()) {
230 << "WARNING: Volume \"" << pvName << "\" ";
231 if (copyNo > 0) {
232 G4cerr <<
"copy number " << copyNo;
233 }
235 }
236 return;
237 }
238
239
240 G4Scene tempScene(
"Centre Scene");
241 for (const auto& findings: findingsVector) {
242
243 findings.fpFoundPV->SetCopyNo(findings.fFoundPVCopyNo);
244
245
246
248 (findings.fpFoundPV,
249 0,
250 findings.fFoundObjectTransformation,
251 0,
252 true,
253 findings.fFoundBasePVPath);
254
255 G4bool successful = tempScene.AddRunDurationModel(tempPVModel,warn);
256 if (successful) {
258 G4cout <<
"\"" << findings.fpFoundPV->GetName()
259 << "\", copy no. " << findings.fFoundPVCopyNo
260 << ",\n found in searched volume \""
261 << findings.fpSearchPV->GetName()
262 << "\" at depth " << findings.fFoundDepth
263 << ",\n base path: \"" << findings.fFoundBasePVPath
264 << ",\n has been added to temporary scene \"" << tempScene.GetName() << "\"."
266 }
267 }
268 }
269
270 for (const auto& sceneModel: tempScene.GetRunDurationModelList()) {
271 delete sceneModel.fpModel;
272 }
273
274
275 const G4VisExtent& newExtent = tempScene.GetExtent();
277
281 if (command == fpCommandCentreAndZoomInOn) {
282
286 }
287
290
292
295 <<
"Viewer \"" << currentViewer->
GetName()
296 << "\" centred ";
297 if (fpCommandCentreAndZoomInOn) {
298 G4cout <<
"and zoomed in";
299 }
300 G4cout <<
" on physical volume(s) \"" << pvName <<
'\"'
302 }
303
305}
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
static G4TransportationManager * GetTransportationManager()
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
size_t GetNoWorlds() const
G4Scene * GetScene() const
const G4String & GetName() const
const G4ViewParameters & GetViewParameters() 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 SetCurrentTargetPoint(const G4Point3D ¤tTargetPoint)
void SetZoomFactor(G4double zoomFactor)
G4double GetExtentRadius() const
const G4Point3D & GetExtentCentre() const
static Verbosity GetVerbosity()