TopoDS_Vertex aVertex2 = TopoDS::Vertex(aInShape);
gp_Pnt aPoint2 = BRep_Tool::Pnt(aVertex2);
- return aPoint1.IsEqual(aPoint2, Precision::Confusion());
+ return aPoint1.IsEqual(aPoint2, Precision::Confusion()) == Standard_True;
}
// searching for deltas
int aVertexNum = 0;
if (aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA)) aVertexNum = 1;
- else if (aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA)) aVertexNum = 2;
+ else if (aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA * 2)) aVertexNum = 2;
// found the feature with appropriate edge
FeaturePtr aFeature = aComposite->subFeature(a);
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
#include <ModelAPI_Session.h>
#include <GeomAPI_Pnt2d.h>
-
+#include <GeomAPI_Vertex.h>
#include <GeomDataAPI_Point2D.h>
#include <GeomAlgoAPI_PointBuilder.h>
bool SketchPlugin_Point::isFixed() {
return data()->selection(EXTERNAL_ID())->context();
}
+
+void SketchPlugin_Point::attributeChanged(const std::string& theID) {
+ if (theID == EXTERNAL_ID()) {
+ std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(EXTERNAL_ID())->value();
+ // update arguments due to the selection value
+ if (aSelection && !aSelection->isNull() && aSelection->isVertex()) {
+ std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aSelection));
+ std::shared_ptr<GeomDataAPI_Point2D> aCoordAttr =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(COORD_ID()));
+ aCoordAttr->setValue(sketch()->to2D(aVertex->point()));
+ }
+ }
+}
/// \param thePoint the point
virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+ /// Called on change of any argument-attribute of this object: for external point
+ SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
+
/// Use plugin manager for features creation
SketchPlugin_Point();
};