From d0ae3d1c1788330238fa4acfc35790e0ee0e0ab0 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 30 Dec 2014 08:06:30 +0300 Subject: [PATCH] A modification to move a list of attributes(at the first version only the first one is moved). --- src/PartSet/PartSet_SketcherMgr.cpp | 32 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 2dd071fb5..2b0b5e121 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -271,24 +271,26 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve // 4. the features and attributes modification(move) for (; anIt != aLast; anIt++) { FeaturePtr aFeature = anIt.key(); - AttributePtr anAttr; AttributeList anAttributes = anIt.value(); - if (!anAttributes.empty()) { - anAttr = anAttributes.first(); - } // Process selection by attribute: the priority to the attribute - if (anAttr.get() != NULL) { - std::string aAttrId = anAttr->id(); - DataPtr aData = aFeature->data(); - if (aData.get() != NULL) { - std::shared_ptr aPoint = - std::dynamic_pointer_cast(aData->attribute(aAttrId)); - if (aPoint.get() != NULL) { - bool isImmutable = aPoint->setImmutable(true); - aPoint->move(dX, dY); - ModelAPI_EventCreator::get()->sendUpdated(aFeature, aMoveEvent); - aPoint->setImmutable(isImmutable); + if (!anAttributes.empty()) { + AttributeList::const_iterator anAttIt = anAttributes.begin(), anAttLast = anAttributes.end(); + for (; anAttIt != anAttLast; anAttIt++) { + AttributePtr anAttr = *anAttIt; + if (anAttr.get() == NULL) + continue; + std::string aAttrId = anAttr->id(); + DataPtr aData = aFeature->data(); + if (aData.get() != NULL) { + std::shared_ptr aPoint = + std::dynamic_pointer_cast(aData->attribute(aAttrId)); + if (aPoint.get() != NULL) { + bool isImmutable = aPoint->setImmutable(true); + aPoint->move(dX, dY); + ModelAPI_EventCreator::get()->sendUpdated(aFeature, aMoveEvent); + aPoint->setImmutable(isImmutable); + } } } } else { -- 2.39.2