]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1781 Split circles into arcs leads to arcs with different centers
authornds <nds@opencascade.com>
Fri, 9 Dec 2016 04:42:30 +0000 (07:42 +0300)
committernds <nds@opencascade.com>
Fri, 9 Dec 2016 04:42:30 +0000 (07:42 +0300)
Correction to avoid previous workaround.

src/Model/Model_AttributeRefAttr.cpp
src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp

index 034620126a2020a307538db37c3225f105d2dcf2..eff39c6f7167ad1e7ad33ffe30a2c12946f6cae3 100644 (file)
@@ -20,9 +20,10 @@ void Model_AttributeRefAttr::setAttr(std::shared_ptr<ModelAPI_Attribute> theAttr
   std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
       theAttr->owner()->data());
   std::string anID = aData->id(theAttr);
-  if (myIsInitialized && object() == theAttr->owner() && myID->Get().IsEqual(anID.c_str()))
+  ObjectPtr anObj = object();
+  if (myIsInitialized && anObj == theAttr->owner() && myID->Get().IsEqual(anID.c_str()))
     return;  // nothing is changed
-  REMOVE_BACK_REF(theAttr->owner());
+  REMOVE_BACK_REF(anObj);
   myRef->Set(aData->label().Father());
   myID->Set(aData->id(theAttr).c_str());
   ADD_BACK_REF(theAttr->owner());
index b83431b196a5b911a6dfdca73a9323ac1c40a385..e0b26898bc8ebb42c65038ce39a6bc2cf40341e6 100755 (executable)
@@ -48,8 +48,6 @@
 #include <iostream>
 #endif
 
-#define CIRCLE_FEATURE_DELETE_WITHOUT_REFERENCES
-
 static const double PI = 3.141592653589793238463;
 
 SketchPlugin_ConstraintSplit::SketchPlugin_ConstraintSplit()
@@ -95,9 +93,6 @@ void SketchPlugin_ConstraintSplit::execute()
   FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value());
   ResultPtr aBaseFeatureResult = getFeatureResult(aBaseFeature);
   std::set<FeaturePtr> aFeaturesToDelete, aFeaturesToUpdate;
-  #ifdef CIRCLE_FEATURE_DELETE_WITHOUT_REFERENCES
-  FeaturePtr aCircleFeatureToDelete;
-  #endif
 
   std::map<FeaturePtr, IdToPointPair> aTangentFeatures;
   std::map<FeaturePtr, IdToPointPair> aCoincidenceToFeature;
@@ -223,11 +218,7 @@ void SketchPlugin_ConstraintSplit::execute()
     updateRefFeatureConstraints(getFeatureResult(aBaseFeature), aRefsToFeature);
 
     AttributePtr aCenterAttr = aCircleFeature->attribute(SketchPlugin_Circle::CENTER_ID());
-#ifdef CIRCLE_FEATURE_DELETE_WITHOUT_REFERENCES
-    aCircleFeatureToDelete = aCircleFeature;
-#else
     aFeaturesToDelete.insert(aCircleFeature);
-#endif
     // as circle is removed, temporary fill this attribute*/
     aBaseObjectAttr->setObject(ResultPtr());
   }
@@ -306,11 +297,6 @@ void SketchPlugin_ConstraintSplit::execute()
   }
 #endif
   ModelAPI_Tools::removeFeaturesAndReferences(aFeaturesToDelete);
-#ifdef CIRCLE_FEATURE_DELETE_WITHOUT_REFERENCES
-  std::set<FeaturePtr> aCircleFeatures;
-  aCircleFeatures.insert(aCircleFeatureToDelete);
-  ModelAPI_Tools::removeFeatures(aCircleFeatures, false);
-#endif
 
 #ifdef DEBUG_SPLIT
   std::cout << "update features after split:" << std::endl;