else {
if (getPoint2d(aView, aShape, aX, aY))
setPoint(aX, aY);
- bool anOrphanPoint = isOrphanPoint(aSelectedFeature, mySketch);
+ bool anOrphanPoint = isOrphanPoint(aSelectedFeature, mySketch, aX, aY);
setConstraintWith(aObject);
if (!anOrphanPoint)
emit vertexSelected();
setPoint(aX, aY);
}
else {
- bool anOrphanPoint = isOrphanPoint(aSelectedFeature, mySketch);
+ bool anOrphanPoint = isOrphanPoint(aSelectedFeature, mySketch, aX, aY);
// do not set a coincidence constraint in the attribute if the feature contains a point
// with the same coordinates. It is important for line creation in order to do not set
// the same constraints for the same points, oterwise the result line has zero length.
}
bool PartSet_WidgetPoint2D::isOrphanPoint(const FeaturePtr& theFeature,
- const CompositeFeaturePtr& theSketch)
+ const CompositeFeaturePtr& theSketch,
+ double theX, double theY)
{
bool anOrphanPoint = false;
if (theFeature.get()) {
aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
theFeature->attribute(SketchPlugin_Arc::CENTER_ID()));
+ /// check that the geometry point with the given coordinates is the checked point
+ /// e.g. in arc the (x,y) point can not coicide to the center point and it automatically
+ /// means that this point is not an orphant one.
+ if (aPointAttr.get()) {
+ std::shared_ptr<GeomAPI_Pnt2d> aCheckedPoint = std::shared_ptr<GeomAPI_Pnt2d>(
+ new GeomAPI_Pnt2d(theX, theY));
+ if (!aCheckedPoint->isEqual(aPointAttr->pnt()))
+ return anOrphanPoint;
+ }
+
if (aPointAttr.get()) {
std::shared_ptr<GeomAPI_Pnt2d> aPoint = aPointAttr->pnt();
FeaturePtr aCoincidence = PartSet_Tools::findFirstCoincidence(theFeature, aPoint);
void setConstraintWith(const ObjectPtr& theObject);
/// Returns if the feature is an orphan point, circle or an arc. Returns true if it
- /// has no a coincident to other lines. In Circle and arc only center points are processed.
+ /// has no a coincident to other lines. It processes point, circle and arc features
+ /// In circle an arc features, only centers are processed, for other points, it returns
+ /// that the point is not an orphan.
/// \param theFeature a checked feature
/// \param theSketch a sketch
+ /// \param theX an X coordinate of the point
+ /// \param theY an Y coordinate of the point
/// \return boolean result
- static bool isOrphanPoint(const FeaturePtr& theFeature, const CompositeFeaturePtr& theSketch);
+ static bool isOrphanPoint(const FeaturePtr& theFeature, const CompositeFeaturePtr& theSketch,
+ double theX, double theY);
protected:
ModuleBase_IWorkshop* myWorkshop; ///< workshop