From: vsv Date: Tue, 12 May 2015 16:26:51 +0000 (+0300) Subject: Create line with coincidence on an other line X-Git-Tag: V_1.2.0~157 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=21ff88e65971f33cd0810381093b6ddc77780f74;p=modules%2Fshaper.git Create line with coincidence on an other line --- diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index b49330a6b..3d8c89ad1 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -212,8 +213,7 @@ void PartSet_WidgetPoint2D::activateCustom() QIntList aModes; aModes << TopAbs_VERTEX; - if (isEditingMode()) - aModes << TopAbs_EDGE; + aModes << TopAbs_EDGE; myWorkshop->moduleConnector()->activateSubShapesSelection(aModes); } @@ -281,6 +281,25 @@ void PartSet_WidgetPoint2D::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMous emit vertexSelected(); emit focusOutWidget(this); return; + } else if (aShape.ShapeType() == TopAbs_EDGE) { + // Create point-edge coincedence + FeaturePtr aFeature = mySketch->addFeature(SketchPlugin_ConstraintCoincidence::ID()); + std::shared_ptr aData = aFeature->data(); + + std::shared_ptr aRef1 = std::dynamic_pointer_cast< + ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A())); + AttributePtr aThisAttr = feature()->data()->attribute(attributeID()); + std::shared_ptr aThisPoint = + std::dynamic_pointer_cast(aThisAttr); + aRef1->setAttr(aThisPoint); + + std::shared_ptr aRef2 = std::dynamic_pointer_cast< + ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B())); + aRef2->setObject(aObject); + aFeature->execute(); + emit vertexSelected(); + emit focusOutWidget(this); + return; } } // End of Bug dependent fragment