From 892513f8f0c00df94686fb815f9aabca4a660ded Mon Sep 17 00:00:00 2001 From: Riccardo Maria Bianchi <riccardo.maria.bianchi@cern.ch> Date: Thu, 29 Jul 2021 13:20:21 +0200 Subject: [PATCH] Speed up the 'reset filters' process, important for large systems like Muons --- .../VP1GeometrySystems/src/VP1GeometrySystem.cxx | 15 +++++++++++---- .../VP1GeometrySystems/src/VolumeHandle.cxx | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx b/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx index 5bd4f4b29..ca37a4331 100644 --- a/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx +++ b/GeoModelVisualization/VP1GeometrySystems/src/VP1GeometrySystem.cxx @@ -1638,8 +1638,10 @@ GeoPhysVol *VP1GeometrySystem::newWorld() const { void VP1GeometrySystem::filterVolumes(QString targetname, bool bymatname, int maxDepth = 1, bool stopAtFirst = true, bool visitChildren = false, bool resetView = false) { + // initialize the regular expression QRegExp selregexp(targetname, Qt::CaseSensitive, QRegExp::RegExp); // VP1Msg::messageDebug("RegExp pattern: " + selregexp.pattern() ); + QStringList ll; ll << "VP1GeometrySystem::filterVolumes" << "RegExp pattern:" << selregexp.pattern() << "- maxDepth:" << QString::number(maxDepth) @@ -1711,6 +1713,7 @@ void VP1GeometrySystem::filterVolumes(QString targetname, bool bymatname, int ma //break; //} if (resetView) { + VP1Msg::messageDebug("'expanding' and 'contracting' the root volume..."); // in the call to 'filterVolumesRec' above, when resetting the view, // we have 'contracted' the root volume and all the children we had 'zapped' before. // So, now we need to open ('expand'), and then close ('contract') the root volume again, @@ -1728,12 +1731,15 @@ void VP1GeometrySystem::filterVolumes(QString targetname, bool bymatname, int ma } // loop over root handles // give feedback to the user - //m_d->controller->ui_misc.textOut->setText("# of matching volumes: " + QString::number(nFound)); message("[filter volumes] # of matching volumes: " + QString::number(nFound)); + + //if user chose to visit children of matching volumes, + //then we change transparency type to 'Sorted Object Blend', usually better to visualize nested volumes if (visitChildren && (nFound>0) ) { - //if user chose to visit children of matching volumes, - //then we change transoparency type to '' - message("[filter volumes] NOTE: to show both matching mother and matching daughter volumes, transparency has been set to 50% and transparency type has been changed to 'Sorted Object Blend', which is usually better to visualize nested geometry volumes. You can disable this auto-setting by checking the 'lock'."); + message( QString("[filter volumes] NOTE: to show both matching mother and matching daughter volumes, ") + + QString("transparency has been set to 50% and transparency type has been changed to 'Sorted Object Blend', ") + + QString("which is usually better to visualize nested geometry volumes. ") + + QString("You can disable this auto-setting by checking the 'lock'.") ); if ( ! m_d->controller->isTranspLocked()) { m_d->controller->setTransparency(50); emit updateTransparencyType( VP1QtInventorUtils::transparencyTypeToInt(SoGLRenderAction::SORTED_OBJECT_BLEND) ); @@ -1741,6 +1747,7 @@ void VP1GeometrySystem::filterVolumes(QString targetname, bool bymatname, int ma } + VP1Msg::messageDebug("largeChangesEnding..."); m_d->phisectormanager->updateRepresentationsOfVolsAroundZAxis(); m_d->phisectormanager->largeChangesEnd(); if (save) { diff --git a/GeoModelVisualization/VP1GeometrySystems/src/VolumeHandle.cxx b/GeoModelVisualization/VP1GeometrySystems/src/VolumeHandle.cxx index 3f439f123..d40b20423 100644 --- a/GeoModelVisualization/VP1GeometrySystems/src/VolumeHandle.cxx +++ b/GeoModelVisualization/VP1GeometrySystems/src/VolumeHandle.cxx @@ -182,7 +182,7 @@ bool VolumeHandle::hasName(const std::string& n) const //____________________________________________________________________ SoMaterial * VolumeHandle::material() { - VP1Msg::messageDebug("VolumeHandle::material() - LogVol name: " + QString::fromStdString(m_d->pV->getLogVol()->getName())); + VP1Msg::messageDebug2("VolumeHandle::material() - LogVol name: " + QString::fromStdString(m_d->pV->getLogVol()->getName())); // if it's not the first time here and // the material has been assigned already, then return that if (m_d->material) -- GitLab