MODEL_EXPORT virtual bool isPrecedingAttribute(const std::string& theAttribute1,
const std::string& theAttribute2) const;
- friend class Model_Objects;
};
/// Generic method to register back reference, used in referencing attributes.
aFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
std::list<AttributePtr>::const_iterator anIt = anAttiributes.begin(),
aLast = anAttiributes.end();
+ double aMinDistance = 1.e-6; // searching for point with minimal distance and < 1.e-6
for (; anIt != aLast && !anAttribute; anIt++) {
std::shared_ptr<GeomDataAPI_Point2D> aCurPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
std::shared_ptr<GeomAPI_Pnt> aPnt =
convertTo3D(aCurPoint->x(), aCurPoint->y(), theSketch);
- if (aPnt && (aPnt->distance(aValue) < Precision::Confusion())) {
- anAttribute = aCurPoint;
- break;
+ if (aPnt) {
+ double aDistance = aPnt->distance(aValue);
+ if (aDistance < aMinDistance) {
+ anAttribute = aCurPoint;
+ aMinDistance = aPnt->distance(aValue);
+ }
}
}
}