if (!checkFeatureValidity(theFeature))
return false;
- myStorage->blockEvents(true);
+ bool isBlocked = myStorage->isEventsBlocked();
+ if (!isBlocked)
+ myStorage->blockEvents(true);
+
myStorage->refresh(true);
bool isUpdated = myStorage->update(theFeature);
updateMultiConstraints(myConstraints, theFeature);
+
+ // events were not blocked before, the feature has not been updated,
+ // so it is necessary to revert blocking
+ if (!isUpdated && !isBlocked)
+ myStorage->blockEvents(false);
return isUpdated;
}
for (; aCIt != theSolverConstraints.end(); ++aCIt)
update(*aCIt);
}
- myConstraintMap[theConstraint] = theSolverConstraints;
+
+ if (!theSolverConstraints.empty() || aFound == myConstraintMap.end())
+ myConstraintMap[theConstraint] = theSolverConstraints;
// block events if necessary
if (myEventsBlocked && theConstraint->data() && theConstraint->data()->isValid())
theConstraint->data()->blockSendAttributeUpdated(myEventsBlocked);
theFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
std::list<AttributePtr>::const_iterator anAttrIt = aPntAttrs.begin();
for (; anAttrIt != aPntAttrs.end(); ++anAttrIt)
- addEntity(*anAttrIt, EntityWrapperPtr());
+ addEntity(*anAttrIt, EntityWrapperPtr());
if (aFound == myFeatureMap.end())
myFeatureMap[theFeature] = theSolverEntity;
} else
/// \brief Block or unblock events when refreshing features
SKETCHSOLVER_EXPORT void blockEvents(bool isBlocked);
+ /// \brief Shows the events are blocked for the features in the storage
+ bool isEventsBlocked() const
+ { return myEventsBlocked; }
protected:
/// \brief Change mapping feature from SketchPlugin and
if (!isUpd[1]) aCoords[1] = aPoint2D->y();
aPoint2D->setValue(aCoords[0], aCoords[1]);
// Find points coincident with this one (probably not in GID_OUTOFGROUP)
- std::map<AttributePtr, EntityWrapperPtr>::const_iterator aLocIt =
- theFixedOnly ? myAttributeMap.begin() : anIt;
- for (++aLocIt; aLocIt != myAttributeMap.end(); ++aLocIt)
+ std::map<AttributePtr, EntityWrapperPtr>::const_iterator aLocIt;
+ if (theFixedOnly)
+ aLocIt = myAttributeMap.begin();
+ else {
+ aLocIt = anIt;
+ ++aLocIt;
+ }
+ for (; aLocIt != myAttributeMap.end(); ++aLocIt) {
+ if (!aLocIt->second)
+ continue;
+ std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(aLocIt->first->owner());
+ if (aSketchFeature && aSketchFeature->isExternal())
+ continue;
if (anIt->second->id() == aLocIt->second->id()) {
aPoint2D = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aLocIt->first);
aPoint2D->setValue(aCoords[0], aCoords[1]);
}
+ }
}
continue;
}