From: mpv Date: Fri, 24 Oct 2014 07:48:03 +0000 (+0400) Subject: The references to the external edge attribute is added X-Git-Tag: V_0.5~79^2~1^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=99d0c1c3d9f58d92daa2e507f7d5bc05601896c1;p=modules%2Fshaper.git The references to the external edge attribute is added --- diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index f919cecd6..9c71730a0 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -85,6 +85,7 @@ void Model_AttributeSelection::setObject(const boost::shared_ptrgroupName() == ModelAPI_ResultBody::group()) { // body: just a named shape, use selection mechanism from OCCT TNaming_Selector aSelector(myRef.myRef->Label()); diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index 21e616aef..ec9d227de 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -6,6 +6,8 @@ #include "SketchPlugin_Sketch.h" #include #include +#include +#include #include #include @@ -24,9 +26,11 @@ SketchPlugin_Arc::SketchPlugin_Arc() void SketchPlugin_Arc::initAttributes() { - data()->addAttribute(SketchPlugin_Arc::CENTER_ID(), GeomDataAPI_Point2D::type()); - data()->addAttribute(SketchPlugin_Arc::START_ID(), GeomDataAPI_Point2D::type()); - data()->addAttribute(SketchPlugin_Arc::END_ID(), GeomDataAPI_Point2D::type()); + data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::type()); + data()->addAttribute(START_ID(), GeomDataAPI_Point2D::type()); + data()->addAttribute(END_ID(), GeomDataAPI_Point2D::type()); + data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::type()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); } void SketchPlugin_Arc::execute() @@ -138,3 +142,7 @@ double SketchPlugin_Arc::distanceToPoint(const boost::shared_ptr& return aDelta; } + +bool SketchPlugin_Arc::isFixed() { + return data()->selection(EXTERNAL_ID())->context(); +} diff --git a/src/SketchPlugin/SketchPlugin_Arc.h b/src/SketchPlugin/SketchPlugin_Arc.h index 00ada99b0..3ee2ba8e7 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.h +++ b/src/SketchPlugin/SketchPlugin_Arc.h @@ -50,6 +50,9 @@ class SketchPlugin_Arc : public SketchPlugin_Feature //, public GeomAPI_IPresen return MY_KIND; } + /// Returns true is sketch element is under the rigid constraint + SKETCHPLUGIN_EXPORT virtual bool isFixed(); + /// Creates an arc-shape SKETCHPLUGIN_EXPORT virtual void execute(); diff --git a/src/SketchPlugin/SketchPlugin_Circle.cpp b/src/SketchPlugin/SketchPlugin_Circle.cpp index 635214f42..4828a0f7b 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.cpp +++ b/src/SketchPlugin/SketchPlugin_Circle.cpp @@ -6,6 +6,8 @@ #include "SketchPlugin_Sketch.h" #include #include +#include +#include #include #include @@ -24,6 +26,8 @@ void SketchPlugin_Circle::initAttributes() { data()->addAttribute(SketchPlugin_Circle::CENTER_ID(), GeomDataAPI_Point2D::type()); data()->addAttribute(SketchPlugin_Circle::RADIUS_ID(), ModelAPI_AttributeDouble::type()); + data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::type()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); } void SketchPlugin_Circle::execute() @@ -98,3 +102,7 @@ double SketchPlugin_Circle::distanceToPoint(const boost::shared_ptrpnt()->distance(thePoint); } + +bool SketchPlugin_Circle::isFixed() { + return data()->selection(EXTERNAL_ID())->context(); +} diff --git a/src/SketchPlugin/SketchPlugin_Circle.h b/src/SketchPlugin/SketchPlugin_Circle.h index c489f1014..11311dcb0 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.h +++ b/src/SketchPlugin/SketchPlugin_Circle.h @@ -45,6 +45,9 @@ class SketchPlugin_Circle : public SketchPlugin_Feature //, public GeomAPI_IPre return MY_KIND; } + /// Returns true is sketch element is under the rigid constraint + SKETCHPLUGIN_EXPORT virtual bool isFixed(); + /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); diff --git a/src/SketchPlugin/SketchPlugin_Feature.h b/src/SketchPlugin/SketchPlugin_Feature.h index 49bcc1320..97a2d423b 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.h +++ b/src/SketchPlugin/SketchPlugin_Feature.h @@ -27,6 +27,13 @@ class SketchPlugin_Feature : public ModelAPI_Feature static AISObjectPtr simpleAISObject(boost::shared_ptr theRes, AISObjectPtr thePrevious); + /// Reference to the external edge or vertex as a AttributeSelection + inline static const std::string& EXTERNAL_ID() + { + static const std::string MY_EXTERNAL_ID("External"); + return MY_EXTERNAL_ID; + } + /// Returns true if this feature must be displayed in the history (top level of Part tree) SKETCHPLUGIN_EXPORT virtual bool isInHistory() { @@ -45,6 +52,9 @@ class SketchPlugin_Feature : public ModelAPI_Feature /// Construction result is allways recomuted on the fly SKETCHPLUGIN_EXPORT virtual bool isPersistentResult() {return false;} + /// Returns true is sketch element is under the rigid constraint + SKETCHPLUGIN_EXPORT virtual bool isFixed() {return false;} + /// Returns the sketch of this feature inline SketchPlugin_Sketch* sketch() {return mySketch;} protected: diff --git a/src/SketchPlugin/SketchPlugin_Line.cpp b/src/SketchPlugin/SketchPlugin_Line.cpp index 8ae5384bb..72a20f861 100644 --- a/src/SketchPlugin/SketchPlugin_Line.cpp +++ b/src/SketchPlugin/SketchPlugin_Line.cpp @@ -6,6 +6,8 @@ #include "SketchPlugin_Sketch.h" #include #include +#include +#include #include #include @@ -25,6 +27,8 @@ void SketchPlugin_Line::initAttributes() { data()->addAttribute(SketchPlugin_Line::START_ID(), GeomDataAPI_Point2D::type()); data()->addAttribute(SketchPlugin_Line::END_ID(), GeomDataAPI_Point2D::type()); + data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::type()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); } void SketchPlugin_Line::execute() @@ -88,3 +92,7 @@ double SketchPlugin_Line::distanceToPoint(const boost::shared_ptr return aDelta; } + +bool SketchPlugin_Line::isFixed() { + return data()->selection(EXTERNAL_ID())->context(); +} diff --git a/src/SketchPlugin/SketchPlugin_Line.h b/src/SketchPlugin/SketchPlugin_Line.h index d2656e5d8..d24f1af52 100644 --- a/src/SketchPlugin/SketchPlugin_Line.h +++ b/src/SketchPlugin/SketchPlugin_Line.h @@ -43,6 +43,9 @@ class SketchPlugin_Line : public SketchPlugin_Feature return MY_KIND; } + /// Returns true is sketch element is under the rigid constraint + SKETCHPLUGIN_EXPORT virtual bool isFixed(); + /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); diff --git a/src/SketchPlugin/SketchPlugin_Point.cpp b/src/SketchPlugin/SketchPlugin_Point.cpp index 5e8f2a65e..c198e9b90 100644 --- a/src/SketchPlugin/SketchPlugin_Point.cpp +++ b/src/SketchPlugin/SketchPlugin_Point.cpp @@ -7,6 +7,8 @@ #include #include +#include +#include #include @@ -22,6 +24,8 @@ SketchPlugin_Point::SketchPlugin_Point() void SketchPlugin_Point::initAttributes() { data()->addAttribute(SketchPlugin_Point::COORD_ID(), GeomDataAPI_Point2D::type()); + data()->addAttribute(EXTERNAL_ID(), ModelAPI_AttributeSelection::type()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXTERNAL_ID()); } void SketchPlugin_Point::execute() @@ -61,3 +65,7 @@ double SketchPlugin_Point::distanceToPoint(const boost::shared_ptrpnt()->distance(thePoint); } + +bool SketchPlugin_Point::isFixed() { + return data()->selection(EXTERNAL_ID())->context(); +} diff --git a/src/SketchPlugin/SketchPlugin_Point.h b/src/SketchPlugin/SketchPlugin_Point.h index 14f587402..48415b18c 100644 --- a/src/SketchPlugin/SketchPlugin_Point.h +++ b/src/SketchPlugin/SketchPlugin_Point.h @@ -36,6 +36,9 @@ class SketchPlugin_Point : public SketchPlugin_Feature return MY_KIND; } + /// Returns true is sketch element is under the rigid constraint + SKETCHPLUGIN_EXPORT virtual bool isFixed(); + /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute();