+
+bool PartSet_WidgetPoint2D::isOrphanPoint(const FeaturePtr& theFeature,
+ const CompositeFeaturePtr& theSketch)
+{
+ bool anOrphanPoint = false;
+ if (theFeature.get()) {
+ std::shared_ptr<GeomDataAPI_Point2D> aPointAttr;
+ std::string aFeatureKind = theFeature->getKind();
+ if (aFeatureKind == SketchPlugin_Point::ID())
+ aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ theFeature->attribute(SketchPlugin_Point::COORD_ID()));
+ else if (aFeatureKind == SketchPlugin_Circle::ID())
+ aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ theFeature->attribute(SketchPlugin_Circle::CENTER_ID()));
+
+ else if (aFeatureKind == SketchPlugin_Arc::ID())
+ aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ theFeature->attribute(SketchPlugin_Arc::CENTER_ID()));
+
+ if (aPointAttr.get()) {
+ std::shared_ptr<GeomAPI_Pnt2d> aPoint = aPointAttr->pnt();
+ FeaturePtr aCoincidence = PartSet_Tools::findFirstCoincidence(theFeature, aPoint);
+ anOrphanPoint = true;
+ // if there is at least one concident line to the point, the point is not an orphant
+ if (aCoincidence.get()) {
+ QList<FeaturePtr> aCoinsideLines;
+ PartSet_Tools::findCoincidences(aCoincidence, aCoinsideLines,
+ SketchPlugin_ConstraintCoincidence::ENTITY_A());
+ PartSet_Tools::findCoincidences(aCoincidence, aCoinsideLines,
+ SketchPlugin_ConstraintCoincidence::ENTITY_B());
+ QList<FeaturePtr>::const_iterator anIt = aCoinsideLines.begin(),
+ aLast = aCoinsideLines.end();
+ for (; anIt != aLast && anOrphanPoint; anIt++) {
+ anOrphanPoint = (*anIt)->getKind() != SketchPlugin_Line::ID();
+ }
+ }
+ }
+ }
+ return anOrphanPoint;
+}