@@ -394,7 +394,7 @@ ViewSceneDialog::ViewSceneDialog(const std::string& name, ModuleStateHandle stat
394394 state->connectSpecificStateChanged (Parameters::GeomData,[this ](){Q_EMIT newGeometryValueForwarder ();});
395395 connect (this , SIGNAL (newGeometryValueForwarder ()), this , SLOT (updateModifiedGeometriesAndSendScreenShot ()));
396396
397- state->connectSpecificStateChanged (Parameters::CameraRotation1 ,[this ](){Q_EMIT cameraRotationChangeForwarder ();});
397+ state->connectSpecificStateChanged (Parameters::CameraRotation ,[this ](){Q_EMIT cameraRotationChangeForwarder ();});
398398 connect (this , SIGNAL (cameraRotationChangeForwarder ()), this , SLOT (pullCameraRotation ()));
399399
400400 state->connectSpecificStateChanged (Parameters::CameraLookAt,[this ](){Q_EMIT cameraLookAtChangeForwarder ();});
@@ -771,9 +771,9 @@ void ViewSceneDialog::pullCameraRotation()
771771 return ;
772772
773773 glm::quat q;
774- auto rotVariable = state_->getValue (Parameters::CameraRotation1 );
774+ auto rotVariable = state_->getValue (Parameters::CameraRotation );
775775 if (rotVariable.value ().type () == typeid (std::string)) // Legacy interpreter for networks that have this stored as string
776- q = ViewSceneUtility::stringToQuat (state_->getValue (Parameters::CameraRotation1 ).toString ());
776+ q = ViewSceneUtility::stringToQuat (state_->getValue (Parameters::CameraRotation ).toString ());
777777 else
778778 {
779779 auto rotation = toDoubleVector (rotVariable.toVector ());
@@ -864,7 +864,7 @@ void ViewSceneDialog::pushCameraRotation()
864864 if (!spire) return ;
865865
866866 auto q = spire->getCameraRotation ();
867- state_->setValue (Parameters::CameraRotation1 , makeAnonymousVariableList (q.w , q.x , q.y , q.z ));
867+ state_->setValue (Parameters::CameraRotation , makeAnonymousVariableList (q.w , q.x , q.y , q.z ));
868868 pushingCameraState_ = false ;
869869}
870870
@@ -1340,20 +1340,20 @@ void ViewSceneDialog::mouseMoveEvent(QMouseEvent* event)
13401340 auto spire = mSpire .lock ();
13411341 if (!spire) return ;
13421342
1343- int x_window = event->x () - mGLWidget ->pos ().x ();
1344- int y_window = event->y () - mGLWidget ->pos ().y ();
1343+ const int x_window = event->x () - mGLWidget ->pos ().x ();
1344+ const int y_window = event->y () - mGLWidget ->pos ().y ();
13451345
1346- auto btn = getSpireButton (event);
1346+ const auto btn = getSpireButton (event);
13471347
13481348 if (selectedWidget_)
13491349 {
13501350 spire->widgetMouseMove (x_window, y_window);
13511351 }
1352- else if (!shiftdown_)
1352+ else if (!shiftdown_)
13531353 {
13541354 float x_ss, y_ss;
13551355 spire->calculateScreenSpaceCoords (x_window, y_window, x_ss, y_ss);
1356- for (auto vsd : viewScenesToUpdate)
1356+ for (auto * vsd : viewScenesToUpdate)
13571357 vsd->inputMouseMoveHelper (btn, x_ss, y_ss);
13581358 }
13591359 else
@@ -1366,7 +1366,7 @@ void ViewSceneDialog::mouseMoveEvent(QMouseEvent* event)
13661366// --------------------------------------------------------------------------------------------------
13671367bool ViewSceneDialog::needToWaitForWidgetSelection ()
13681368{
1369- auto lastExec = transient_value_cast<unsigned long >(state_->getTransientValue (Modules::Render::ViewScene ::TimeExecutionFinished));
1369+ const auto lastExec = transient_value_cast<unsigned long >(state_->getTransientValue (Parameters ::TimeExecutionFinished));
13701370
13711371 return previousWidgetInfo_->timeSince (lastExec) < delayAfterModuleExecution_
13721372 || previousWidgetInfo_->timeSinceWidgetColorRestored () < delayAfterWidgetColorRestored_
@@ -1390,7 +1390,7 @@ void ViewSceneDialog::mousePressEvent(QMouseEvent* event)
13901390 if (!clickedInViewer (event))
13911391 return ;
13921392
1393- auto btn = getSpireButton (event);
1393+ const auto btn = getSpireButton (event);
13941394 if (!tryWidgetSelection (event->x (), event->y (), btn))
13951395 {
13961396 auto spire = mSpire .lock ();
@@ -1402,7 +1402,6 @@ void ViewSceneDialog::mousePressEvent(QMouseEvent* event)
14021402 float x_ss, y_ss;
14031403 spire->calculateScreenSpaceCoords (x_window, y_window, x_ss, y_ss);
14041404
1405-
14061405 for (auto vsd : viewScenesToUpdate)
14071406 vsd->inputMouseDownHelper (x_ss, y_ss);
14081407 }
@@ -1440,7 +1439,8 @@ void ViewSceneDialog::mouseReleaseEvent(QMouseEvent* event)
14401439 }
14411440 else if (!shiftdown_)
14421441 {
1443- for (auto vsd : viewScenesToUpdate) vsd->inputMouseUpHelper ();
1442+ for (auto * vsd : viewScenesToUpdate)
1443+ vsd->inputMouseUpHelper ();
14441444 }
14451445
14461446 mouseButtonPressed_ = false ;
@@ -1467,6 +1467,7 @@ void ViewSceneDialog::keyPressEvent(QKeyEvent* event)
14671467 shiftdown_ = true ;
14681468 updateCursor ();
14691469 break ;
1470+ default : ;
14701471 }
14711472}
14721473
@@ -1479,6 +1480,7 @@ void ViewSceneDialog::keyReleaseEvent(QKeyEvent* event)
14791480 shiftdown_ = false ;
14801481 updateCursor ();
14811482 break ;
1483+ default : ;
14821484 }
14831485}
14841486
@@ -1508,7 +1510,6 @@ void ViewSceneDialog::updateCursor()
15081510// ---------------- Camera --------------------------------------------------------------------------
15091511// --------------------------------------------------------------------------------------------------
15101512
1511- // --------------------------------------------------------------------------------------------------
15121513void ViewSceneDialog::viewAxisSelected (const QString& name)
15131514{
15141515 mUpVectorBox ->clear ();
@@ -1531,7 +1532,6 @@ void ViewSceneDialog::viewAxisSelected(const QString& name)
15311532 mUpVectorBox ->setEnabled (true );
15321533}
15331534
1534- // --------------------------------------------------------------------------------------------------
15351535void ViewSceneDialog::viewVectorSelected (const QString& name)
15361536{
15371537 if (name.isEmpty ())
@@ -1548,7 +1548,6 @@ void ViewSceneDialog::viewVectorSelected(const QString& name)
15481548 pushCameraState ();
15491549}
15501550
1551- // --------------------------------------------------------------------------------------------------
15521551void ViewSceneDialog::autoViewClicked ()
15531552{
15541553 auto spire = mSpire .lock ();
@@ -1559,7 +1558,6 @@ void ViewSceneDialog::autoViewClicked()
15591558 pushCameraState ();
15601559}
15611560
1562- // --------------------------------------------------------------------------------------------------
15631561void ViewSceneDialog::menuMouseControlChanged (int index)
15641562{
15651563 auto spire = mSpire .lock ();
@@ -1579,51 +1577,44 @@ void ViewSceneDialog::menuMouseControlChanged(int index)
15791577 mConfigurationDock ->updateZoomOptionVisibility ();
15801578}
15811579
1582- // --------------------------------------------------------------------------------------------------
15831580void ViewSceneDialog::invertZoomClicked (bool value)
15841581{
15851582 auto spire = mSpire .lock ();
15861583 spire->setZoomInverted (value);
15871584 Preferences::Instance ().invertMouseZoom .setValue (value);
15881585}
15891586
1590- // --------------------------------------------------------------------------------------------------
15911587void ViewSceneDialog::adjustZoomSpeed (int value)
15921588{
15931589 auto spire = mSpire .lock ();
15941590 spire->setZoomSpeed (value);
15951591}
15961592
1597- // --------------------------------------------------------------------------------------------------
15981593void ViewSceneDialog::toggleLockColor (bool locked)
15991594{
16001595 QString color = locked ? " red" : " rgb(66,66,69)" ;
16011596 controlLock_->setStyleSheet (" QPushButton { background-color: " + color + " ; }" );
16021597 autoViewButton_->setDisabled (locked);
16031598}
16041599
1605- // --------------------------------------------------------------------------------------------------
16061600void ViewSceneDialog::lockRotationToggled ()
16071601{
16081602 mGLWidget ->setLockRotation (lockRotation_->isChecked ());
16091603 toggleLockColor (lockRotation_->isChecked () || lockPan_->isChecked () || lockZoom_->isChecked ());
16101604}
16111605
1612- // --------------------------------------------------------------------------------------------------
16131606void ViewSceneDialog::lockPanningToggled ()
16141607{
16151608 mGLWidget ->setLockPanning (lockPan_->isChecked ());
16161609 toggleLockColor (lockRotation_->isChecked () || lockPan_->isChecked () || lockZoom_->isChecked ());
16171610}
16181611
1619- // --------------------------------------------------------------------------------------------------
16201612void ViewSceneDialog::lockZoomToggled ()
16211613{
16221614 mGLWidget ->setLockZoom (lockZoom_->isChecked ());
16231615 toggleLockColor (lockRotation_->isChecked () || lockPan_->isChecked () || lockZoom_->isChecked ());
16241616}
16251617
1626- // --------------------------------------------------------------------------------------------------
16271618void ViewSceneDialog::lockAllTriggered ()
16281619{
16291620 lockRotation_->setChecked (true );
@@ -1635,7 +1626,6 @@ void ViewSceneDialog::lockAllTriggered()
16351626 toggleLockColor (true );
16361627}
16371628
1638- // --------------------------------------------------------------------------------------------------
16391629void ViewSceneDialog::unlockAllTriggered ()
16401630{
16411631 lockRotation_->setChecked (false );
@@ -1685,7 +1675,6 @@ void ViewSceneDialog::autoRotateDown()
16851675// ---------------- Widgets -------------------------------------------------------------------------
16861676// --------------------------------------------------------------------------------------------------
16871677
1688- // --------------------------------------------------------------------------------------------------
16891678void ViewSceneDialog::updateMeshComponentSelection (const QString& showFieldName, const QString& component, bool selected)
16901679{
16911680 auto name = showFieldName.toStdString ();
@@ -1697,8 +1686,7 @@ void ViewSceneDialog::updateMeshComponentSelection(const QString& showFieldName,
16971686 state_->setTransientValue (Parameters::MeshComponentSelection, sel);
16981687}
16991688
1700- // --------------------------------------------------------------------------------------------------
1701- static std::vector<WidgetHandle> filterGeomObjectsForWidgets (SCIRun::Modules::Render::ViewScene::GeomListPtr geomData, ViewSceneControlsDock* mConfigurationDock )
1689+ static std::vector<WidgetHandle> filterGeomObjectsForWidgets (ViewScene::GeomListPtr geomData, ViewSceneControlsDock* mConfigurationDock )
17021690{
17031691 // getting geom list
17041692 std::vector<WidgetHandle> objList;
@@ -1751,7 +1739,7 @@ ViewScene::GeomListPtr ViewSceneDialog::getGeomData()
17511739
17521740void ViewSceneDialog::selectObject (const int x, const int y, MouseButton button)
17531741{
1754- bool geomDataPresent = false ;
1742+ auto geomDataPresent = false ;
17551743 {
17561744 LOG_DEBUG (" ViewSceneDialog::asyncExecute before locking" );
17571745 Guard lock (Modules::Render::ViewScene::mutex_.get ());
@@ -1760,22 +1748,22 @@ void ViewSceneDialog::selectObject(const int x, const int y, MouseButton button)
17601748 auto spire = mSpire .lock ();
17611749 if (!spire) return ;
17621750
1763- auto geomData = getGeomData ();
1751+ const auto geomData = getGeomData ();
17641752 if (geomData)
17651753 {
17661754 geomDataPresent = true ;
17671755 // Search for new widgets if geometry has changed
1768- bool newGeometry = state_->getValue (Modules::Render::ViewScene ::HasNewGeometry).toBool ();
1756+ const bool newGeometry = state_->getValue (Parameters ::HasNewGeometry).toBool ();
17691757 if (newGeometry)
17701758 {
17711759 widgetHandles_ = filterGeomObjectsForWidgets (geomData, mConfigurationDock );
1772- state_->setValue (Modules::Render::ViewScene ::HasNewGeometry, false );
1760+ state_->setValue (Parameters ::HasNewGeometry, false );
17731761 }
17741762
17751763 // Search for new widget unless mouse and camera wasn't moved
1776- auto adjustedX = x - mGLWidget ->pos ().x ();
1777- auto adjustedY = y - mGLWidget ->pos ().y ();
1778- auto currentCameraTransform = spire->getWorldToProjection ();
1764+ const auto adjustedX = x - mGLWidget ->pos ().x ();
1765+ const auto adjustedY = y - mGLWidget ->pos ().y ();
1766+ const auto currentCameraTransform = spire->getWorldToProjection ();
17791767 // TODO: extract function
17801768 const bool reuseWidget = !newGeometry && previousWidgetInfo_->hasSameMousePosition (x, y)
17811769 && previousWidgetInfo_->hasSameCameraTansform (currentCameraTransform);
@@ -1813,13 +1801,12 @@ void ViewSceneDialog::selectObject(const int x, const int y, MouseButton button)
18131801
18141802bool ViewSceneDialog::checkForSelectedWidget (WidgetHandle widget)
18151803{
1816- auto geomData = getGeomData ();
1804+ const auto geomData = getGeomData ();
18171805 if (geomData)
18181806 {
1819- auto id = widget->uniqueID ();
1820- for (auto it = geomData-> begin (); it != geomData-> end (); ++it )
1807+ const auto id = widget->uniqueID ();
1808+ for (const auto & obj : * geomData)
18211809 {
1822- auto obj = *it;
18231810 if (obj->uniqueID () == id)
18241811 return true ;
18251812 }
0 commit comments