1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_WidgetPoint2D.cpp
4 // Created: 25 Apr 2014
5 // Author: Natalia ERMOLAEVA
7 #include "PartSet_WidgetPoint2d.h"
8 #include <PartSet_Tools.h>
9 #include <PartSet_Module.h>
11 #include <ModuleBase_ParamSpinBox.h>
12 #include <ModuleBase_Tools.h>
13 #include <ModuleBase_IViewer.h>
14 #include <ModuleBase_IViewWindow.h>
15 #include <ModuleBase_ISelection.h>
17 #include <Config_Keywords.h>
18 #include <Config_WidgetAPI.h>
20 #include <Events_Loop.h>
21 #include <ModelAPI_Events.h>
22 #include <ModelAPI_AttributeBoolean.h>
24 #include <ModelAPI_Feature.h>
25 #include <ModelAPI_Data.h>
26 #include <ModelAPI_Object.h>
27 #include <GeomDataAPI_Point2D.h>
28 #include <GeomAPI_Pnt2d.h>
30 #include <SketchPlugin_Feature.h>
31 #include <SketchPlugin_ConstraintCoincidence.h>
32 #include <SketchPlugin_Line.h>
33 #include <SketchPlugin_Arc.h>
34 #include <SketchPlugin_Circle.h>
35 #include <SketchPlugin_Point.h>
38 #include <QGridLayout>
41 #include <QMouseEvent>
42 #include <QApplication>
45 #include <TopoDS_Vertex.hxx>
46 #include <BRep_Tool.hxx>
51 const double MaxCoordinate = 1e12;
53 static QStringList MyFeaturesForCoincedence;
55 PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent,
56 ModuleBase_IWorkshop* theWorkshop,
57 const Config_WidgetAPI* theData,
58 const std::string& theParentId)
59 : ModuleBase_ModelWidget(theParent, theData, theParentId), myWorkshop(theWorkshop)
61 if (MyFeaturesForCoincedence.isEmpty()) {
62 MyFeaturesForCoincedence << SketchPlugin_Line::ID().c_str()
63 << SketchPlugin_Arc::ID().c_str()
64 << SketchPlugin_Point::ID().c_str()
65 << SketchPlugin_Circle::ID().c_str();
68 // the control should accept the focus, so the boolean flag is corrected to be true
69 myIsObligatory = true;
70 //myOptionParam = theData->getProperty(PREVIOUS_FEATURE_PARAM);
71 QString aPageName = QString::fromStdString(theData->getProperty(CONTAINER_PAGE_NAME));
72 myGroupBox = new QGroupBox(aPageName, theParent);
73 myGroupBox->setFlat(false);
75 bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true);
77 QGridLayout* aGroupLay = new QGridLayout(myGroupBox);
78 ModuleBase_Tools::adjustMargins(aGroupLay);
79 aGroupLay->setSpacing(2);
80 aGroupLay->setColumnStretch(1, 1);
82 QLabel* aLabel = new QLabel(myGroupBox);
83 aLabel->setText(tr("X "));
84 aGroupLay->addWidget(aLabel, 0, 0);
86 myXSpin = new ModuleBase_ParamSpinBox(myGroupBox);
87 myXSpin->setAcceptVariables(aAcceptVariables);
88 myXSpin->setMinimum(-DBL_MAX);
89 myXSpin->setMaximum(DBL_MAX);
90 myXSpin->setToolTip(tr("X"));
91 aGroupLay->addWidget(myXSpin, 0, 1);
93 connect(myXSpin, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
96 QLabel* aLabel = new QLabel(myGroupBox);
97 aLabel->setText(tr("Y "));
98 aGroupLay->addWidget(aLabel, 1, 0);
100 myYSpin = new ModuleBase_ParamSpinBox(myGroupBox);
101 myYSpin->setAcceptVariables(aAcceptVariables);
102 myYSpin->setMinimum(-DBL_MAX);
103 myYSpin->setMaximum(DBL_MAX);
104 myYSpin->setToolTip(tr("Y"));
105 aGroupLay->addWidget(myYSpin, 1, 1);
107 connect(myYSpin, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
109 QVBoxLayout* aLayout = new QVBoxLayout(this);
110 ModuleBase_Tools::zeroMargins(aLayout);
111 aLayout->addWidget(myGroupBox);
115 bool PartSet_WidgetPoint2D::resetCustom()
118 if (!isUseReset() || isComputedDefault() || myXSpin->hasVariable() || myYSpin->hasVariable()) {
123 double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk);
124 // it is important to block the spin box control in order to do not through out the
125 // locking of the validating state.
126 ModuleBase_Tools::setSpinValue(myXSpin, isOk ? aDefValue : 0.0);
127 ModuleBase_Tools::setSpinValue(myYSpin, isOk ? aDefValue : 0.0);
134 PartSet_WidgetPoint2D::~PartSet_WidgetPoint2D()
138 bool PartSet_WidgetPoint2D::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
139 const bool theToValidate)
142 if (theValues.empty())
145 ModuleBase_ViewerPrs aValue = theValues.takeFirst();
146 TopoDS_Shape aShape = aValue.shape();
147 if (!aShape.IsNull()) {
148 Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
150 if (getPoint2d(aView, aShape, aX, aY)) {
151 isDone = setPoint(aX, aY);
152 PartSet_Tools::setConstraints(mySketch, feature(), attributeID(), aX, aY);
155 else if (canBeActivatedByMove()) {
156 if (feature()->getKind() == SketchPlugin_Line::ID()) {
157 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aValue.object());
158 // Initialize new line with first point equal to end of previous
159 if (aFeature.get()) {
160 std::shared_ptr<ModelAPI_Data> aData = aFeature->data();
161 std::shared_ptr<GeomDataAPI_Point2D> aPoint =
162 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
163 aData->attribute(SketchPlugin_Line::END_ID()));
165 setPoint(aPoint->x(), aPoint->y());
166 PartSet_Tools::setConstraints(mySketch, feature(), attributeID(), aPoint->x(),
176 void PartSet_WidgetPoint2D::selectContent()
178 myXSpin->selectAll();
181 bool PartSet_WidgetPoint2D::setPoint(double theX, double theY)
183 if (fabs(theX) >= MaxCoordinate)
185 if (fabs(theY) >= MaxCoordinate)
188 ModuleBase_Tools::setSpinValue(myXSpin, theX);
189 ModuleBase_Tools::setSpinValue(myYSpin, theY);
195 bool PartSet_WidgetPoint2D::storeValueCustom() const
197 std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
198 if (!aData) // can be on abort of sketcher element
200 std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
201 aData->attribute(attributeID()));
203 PartSet_WidgetPoint2D* that = (PartSet_WidgetPoint2D*) this;
204 bool isBlocked = that->blockSignals(true);
205 bool isImmutable = aPoint->setImmutable(true);
207 // if text is not empty then setValue will be ignored
208 // so we should set the text at first
209 aPoint->setText(myXSpin->hasVariable() ? myXSpin->text().toStdString() : "",
210 myYSpin->hasVariable() ? myYSpin->text().toStdString() : "");
211 aPoint->setValue(!myXSpin->hasVariable() ? myXSpin->value() : aPoint->x(),
212 !myYSpin->hasVariable() ? myYSpin->value() : aPoint->y());
214 // after movement the solver will call the update event: optimization
215 moveObject(myFeature);
216 aPoint->setImmutable(isImmutable);
217 that->blockSignals(isBlocked);
222 bool PartSet_WidgetPoint2D::restoreValueCustom()
224 std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
225 std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
226 aData->attribute(attributeID()));
227 QString aTextX = QString::fromStdString(aPoint->textX());
228 QString aTextY = QString::fromStdString(aPoint->textY());
230 bool isDouble = false;
232 if (aTextX.isEmpty()) {
233 ModuleBase_Tools::setSpinValue(myXSpin, aPoint->x());
235 aVal = aTextX.toDouble(&isDouble);
237 ModuleBase_Tools::setSpinValue(myXSpin, aVal);
239 ModuleBase_Tools::setSpinText(myXSpin, aTextX);
241 if (aTextY.isEmpty()) {
242 ModuleBase_Tools::setSpinValue(myYSpin, aPoint->y());
244 aVal = aTextY.toDouble(&isDouble);
246 ModuleBase_Tools::setSpinValue(myYSpin, aVal);
248 ModuleBase_Tools::setSpinText(myYSpin, aTextY);
250 //if (aTextX.empty() || aTextY.empty()) {
251 // ModuleBase_Tools::setSpinValue(myXSpin, aPoint->x());
252 // ModuleBase_Tools::setSpinValue(myYSpin, aPoint->y());
254 // ModuleBase_Tools::setSpinText(myXSpin, QString::fromStdString(aTextX));
255 // ModuleBase_Tools::setSpinText(myYSpin, QString::fromStdString(aTextY));
260 QList<QWidget*> PartSet_WidgetPoint2D::getControls() const
262 QList<QWidget*> aControls;
263 aControls.append(myXSpin);
264 aControls.append(myYSpin);
269 void PartSet_WidgetPoint2D::activateCustom()
271 ModuleBase_IViewer* aViewer = myWorkshop->viewer();
272 connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)),
273 this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*)));
274 connect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)),
275 this, SLOT(onMouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)));
278 aModes << TopAbs_VERTEX;
279 aModes << TopAbs_EDGE;
280 myWorkshop->activateSubShapesSelection(aModes);
282 if (!isEditingMode()) {
283 FeaturePtr aFeature = feature();
284 if (aFeature.get() && aFeature->getKind() == SketchPlugin_Point::ID())
289 bool PartSet_WidgetPoint2D::canBeActivatedByMove()
291 bool aCanBeActivated = false;
292 if (feature()->getKind() == SketchPlugin_Line::ID() &&
293 attributeID() == SketchPlugin_Line::START_ID())
294 aCanBeActivated = true;
296 return aCanBeActivated;
299 void PartSet_WidgetPoint2D::deactivate()
301 // the value of the control should be stored to model if it was not
302 // initialized yet. It is important when we leave this control by Tab key.
303 // It should not be performed by the widget activation as the preview
304 // is visualized with default value. Line point is moved to origin.
305 AttributePtr anAttribute = myFeature->data()->attribute(attributeID());
306 if (anAttribute && !anAttribute->isInitialized())
309 ModuleBase_ModelWidget::deactivate();
310 ModuleBase_IViewer* aViewer = myWorkshop->viewer();
311 disconnect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)),
312 this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*)));
313 disconnect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)),
314 this, SLOT(onMouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)));
316 myWorkshop->deactivateSubShapesSelection();
319 bool PartSet_WidgetPoint2D::getPoint2d(const Handle(V3d_View)& theView,
320 const TopoDS_Shape& theShape,
321 double& theX, double& theY) const
323 if (!theShape.IsNull()) {
324 if (theShape.ShapeType() == TopAbs_VERTEX) {
325 const TopoDS_Vertex& aVertex = TopoDS::Vertex(theShape);
326 if (!aVertex.IsNull()) {
327 // A case when point is taken from existing vertex
328 gp_Pnt aPoint = BRep_Tool::Pnt(aVertex);
329 PartSet_Tools::convertTo2D(aPoint, mySketch, theView, theX, theY);
337 void PartSet_WidgetPoint2D::setConstraintWith(const ObjectPtr& theObject)
339 // Create point-edge coincedence
340 FeaturePtr aFeature = mySketch->addFeature(SketchPlugin_ConstraintCoincidence::ID());
341 std::shared_ptr<ModelAPI_Data> aData = aFeature->data();
343 std::shared_ptr<ModelAPI_AttributeRefAttr> aRef1 = std::dynamic_pointer_cast<
344 ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
345 AttributePtr aThisAttr = feature()->data()->attribute(attributeID());
346 std::shared_ptr<GeomDataAPI_Point2D> aThisPoint =
347 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aThisAttr);
348 aRef1->setAttr(aThisPoint);
350 std::shared_ptr<ModelAPI_AttributeRefAttr> aRef2 = std::dynamic_pointer_cast<
351 ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
352 aRef2->setObject(theObject);
357 void PartSet_WidgetPoint2D::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
359 // the contex menu release by the right button should not be processed by this widget
360 if (theEvent->button() != Qt::LeftButton)
363 ModuleBase_ISelection* aSelection = myWorkshop->selection();
364 Handle(V3d_View) aView = theWnd->v3dView();
365 // TODO: This fragment doesn't work because bug in OCC Viewer. It can be used after fixing.
366 NCollection_List<TopoDS_Shape> aShapes;
367 std::list<ObjectPtr> aObjects;
368 aSelection->selectedShapes(aShapes, aObjects);
369 // if we have selection and use it
370 if (aShapes.Extent() > 0 && useSelectedShapes()) {
371 TopoDS_Shape aShape = aShapes.First();
372 ObjectPtr aObject = aObjects.front();
373 FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(aObject);
374 bool anExternal = false;
375 std::shared_ptr<SketchPlugin_Feature> aSPFeature;
376 if (aSelectedFeature.get() != NULL)
377 aSPFeature = std::dynamic_pointer_cast<SketchPlugin_Feature>(aSelectedFeature);
378 if ((!aSPFeature && !aShape.IsNull()) ||
379 (aSPFeature.get() && aSPFeature->isExternal())) {
381 ResultPtr aFixedObject = PartSet_Tools::findFixedObjectByExternal(aShape, aObject, mySketch);
382 if (!aFixedObject.get())
383 aFixedObject = PartSet_Tools::createFixedObjectByExternal(aShape, aObject, mySketch);
386 if (getPoint2d(aView, aShape, aX, aY) && isFeatureContainsPoint(myFeature, aX, aY)) {
387 // do not create a constraint to the point, which already used by the feature
388 // if the feature contains the point, focus is not switched
392 if (getPoint2d(aView, aShape, aX, aY))
395 setValueState(Stored); // in case of edge selection, Apply state should also be updated
396 bool anOrphanPoint = aShape.ShapeType() == TopAbs_VERTEX ||
397 isOrphanPoint(aSelectedFeature, mySketch, aX, aY);
399 anOrphanPoint = true; // we should not stop reentrant operation on external objects because
400 // they are not participate in the contour creation excepting external vertices
401 if (aShape.ShapeType() == TopAbs_VERTEX) {
402 FeaturePtr aFixedFeature = ModelAPI_Feature::feature(aFixedObject);
403 if (aFixedFeature.get() && aFixedFeature->getKind() == SketchPlugin_Point::ID()) {
404 anOrphanPoint = isOrphanPoint(aFixedFeature, mySketch, aX, aY, true);
409 setConstraintWith(aFixedObject);
410 // fignal updated should be flushed in order to visualize possible created external objects
411 // e.g. selection of trihedron axis when input end arc point
412 updateObject(feature());
415 emit vertexSelected(); // it stops the reentrant operation
417 emit focusOutWidget(this);
422 bool isProcessed = false;
423 if (getPoint2d(aView, aShape, aX, aY) && isFeatureContainsPoint(myFeature, aX, aY)) {
424 // when the point is selected, the coordinates of the point should be set into the attribute
425 // if the feature contains the point, focus is not switched
429 bool anOrphanPoint = isOrphanPoint(aSelectedFeature, mySketch, aX, aY);
430 // do not set a coincidence constraint in the attribute if the feature contains a point
431 // with the same coordinates. It is important for line creation in order to do not set
432 // the same constraints for the same points, oterwise the result line has zero length.
433 bool isAuxiliaryFeature = false;
434 if (getPoint2d(aView, aShape, aX, aY)) {
436 PartSet_Tools::setConstraints(mySketch, feature(), attributeID(), aX, aY);
438 else if (aShape.ShapeType() == TopAbs_EDGE) {
439 if (MyFeaturesForCoincedence.contains(myFeature->getKind().c_str())) {
440 setConstraintWith(aObject);
441 setValueState(Stored); // in case of edge selection, Apply state should also be updated
443 FeaturePtr anObjectFeature = ModelAPI_Feature::feature(aObject);
444 std::string anAuxiliaryAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID();
445 AttributeBooleanPtr anAuxiliaryAttr = std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
446 anObjectFeature->data()->attribute(anAuxiliaryAttribute));
447 if (anAuxiliaryAttr.get())
448 isAuxiliaryFeature = anAuxiliaryAttr->value();
451 // it is important to perform updateObject() in order to the current value is
452 // processed by Sketch Solver. Test case: line is created from a previous point
453 // to some distance, but in the area of the highlighting of the point. Constraint
454 // coincidence is created, after the solver is performed, the distance between the
455 // points of the line becomes less than the tolerance. Validator of the line returns
456 // false, the line will be aborted, but sketch stays valid.
457 updateObject(feature());
458 if (!anOrphanPoint && !anExternal && !isAuxiliaryFeature)
459 emit vertexSelected();
460 emit focusOutWidget(this);
464 // End of Bug dependent fragment
466 // A case when point is taken from mouse event
467 gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWnd->v3dView());
469 PartSet_Tools::convertTo2D(aPoint, mySketch, aView, aX, anY);
471 // if the feature contains the point, focus is not switched
472 if (!setPoint(aX, anY) || isFeatureContainsPoint(myFeature, aX, anY))
475 /// Start alternative code
476 //std::shared_ptr<GeomDataAPI_Point2D> aFeaturePoint = std::dynamic_pointer_cast<
477 // GeomDataAPI_Point2D>(feature()->data()->attribute(attributeID()));
478 //QList<FeaturePtr> aIgnore;
479 //aIgnore.append(feature());
481 //double aTolerance = aView->Convert(7);
482 //std::shared_ptr<GeomDataAPI_Point2D> aAttrPnt =
483 // PartSet_Tools::findAttributePoint(mySketch, aX, anY, aTolerance, aIgnore);
484 //if (aAttrPnt.get() != NULL) {
485 // aFeaturePoint->setValue(aAttrPnt->pnt());
486 // PartSet_Tools::createConstraint(mySketch, aAttrPnt, aFeaturePoint);
487 // emit vertexSelected();
489 /// End alternative code
490 emit focusOutWidget(this);
495 void PartSet_WidgetPoint2D::onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
500 gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWnd->v3dView());
503 PartSet_Tools::convertTo2D(aPoint, mySketch, theWnd->v3dView(), aX, anY);
504 // we need to block the value state change
505 bool isBlocked = blockValueState(true);
507 blockValueState(isBlocked);
508 setValueState(ModifiedInViewer);
511 double PartSet_WidgetPoint2D::x() const
513 return myXSpin->value();
516 double PartSet_WidgetPoint2D::y() const
518 return myYSpin->value();
522 bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr& theFeature,
523 double theX, double theY)
525 bool aPointIsFound = false;
527 if (feature()->getKind() != SketchPlugin_Line::ID())
528 return aPointIsFound;
530 AttributePtr aWidgetAttribute = myFeature->attribute(attributeID());
532 std::shared_ptr<GeomAPI_Pnt2d> aPnt2d =
533 std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY));
534 std::list<AttributePtr> anAttributes =
535 myFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
536 std::list<AttributePtr>::iterator anIter = anAttributes.begin();
537 for(; anIter != anAttributes.end() && !aPointIsFound; anIter++) {
538 AttributePoint2DPtr aPoint2DAttribute =
539 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIter);
540 if (aPoint2DAttribute == aWidgetAttribute)
542 if (aPoint2DAttribute.get() && aPoint2DAttribute->isInitialized()) {
543 aPointIsFound = aPoint2DAttribute->pnt()->isEqual(aPnt2d);
546 return aPointIsFound;
549 void PartSet_WidgetPoint2D::initializeValueByActivate()
553 /*void PartSet_WidgetPoint2D::onValuesChanged()
555 emit valuesChanged();
558 bool PartSet_WidgetPoint2D::processEnter()
560 bool isModified = getValueState() == ModifiedInPP;
562 bool isXModified = myXSpin->hasFocus();
563 emit valuesChanged();
565 myXSpin->selectAll();
567 myYSpin->selectAll();
572 bool PartSet_WidgetPoint2D::useSelectedShapes() const
577 bool PartSet_WidgetPoint2D::isOrphanPoint(const FeaturePtr& theFeature,
578 const CompositeFeaturePtr& theSketch,
579 double theX, double theY, const bool theSearchInResults)
581 bool anOrphanPoint = false;
582 if (theFeature.get()) {
583 std::shared_ptr<GeomDataAPI_Point2D> aPointAttr;
584 std::string aFeatureKind = theFeature->getKind();
585 if (aFeatureKind == SketchPlugin_Point::ID())
586 aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
587 theFeature->attribute(SketchPlugin_Point::COORD_ID()));
588 else if (aFeatureKind == SketchPlugin_Circle::ID())
589 aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
590 theFeature->attribute(SketchPlugin_Circle::CENTER_ID()));
592 else if (aFeatureKind == SketchPlugin_Arc::ID())
593 aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
594 theFeature->attribute(SketchPlugin_Arc::CENTER_ID()));
596 /// check that the geometry point with the given coordinates is the checked point
597 /// e.g. in arc the (x,y) point can not coicide to the center point and it automatically
598 /// means that this point is not an orphant one.
599 if (aPointAttr.get()) {
600 std::shared_ptr<GeomAPI_Pnt2d> aCheckedPoint = std::shared_ptr<GeomAPI_Pnt2d>(
601 new GeomAPI_Pnt2d(theX, theY));
602 if (!aCheckedPoint->isEqual(aPointAttr->pnt()))
603 return anOrphanPoint;
606 if (aPointAttr.get()) {
607 std::shared_ptr<GeomAPI_Pnt2d> aPoint = aPointAttr->pnt();
608 // we need to find coincidence features in results also, because external object(point)
609 // uses refs to me in another feature.
610 FeaturePtr aCoincidence = PartSet_Tools::findFirstCoincidence(theFeature, aPoint, theSearchInResults);
611 anOrphanPoint = true;
612 // if there is at least one concident line to the point, the point is not an orphant
613 if (aCoincidence.get()) {
614 QList<FeaturePtr> aCoinsideLines;
615 PartSet_Tools::findCoincidences(aCoincidence, aCoinsideLines,
616 SketchPlugin_ConstraintCoincidence::ENTITY_A());
617 PartSet_Tools::findCoincidences(aCoincidence, aCoinsideLines,
618 SketchPlugin_ConstraintCoincidence::ENTITY_B());
619 QList<FeaturePtr>::const_iterator anIt = aCoinsideLines.begin(),
620 aLast = aCoinsideLines.end();
621 for (; anIt != aLast && anOrphanPoint; anIt++) {
622 anOrphanPoint = (*anIt)->getKind() != SketchPlugin_Line::ID();
627 return anOrphanPoint;