20 #ifndef SketchPlugin_Split_H_
21 #define SketchPlugin_Split_H_
23 #include "SketchPlugin.h"
24 #include "SketchPlugin_Tools.h"
26 #include <GeomAPI_IPresentable.h>
27 #include <ModelAPI_IReentrant.h>
29 #include <SketchPlugin_Sketch.h>
35 typedef std::pair<std::string, std::shared_ptr<GeomDataAPI_Point2D> > IdToPointPair;
68 inline static const std::string&
ID()
70 static const std::string MY_SPLIT_ID(
"SketchSplit");
74 SKETCHPLUGIN_EXPORT
virtual const std::string&
getKind()
82 static const std::string MY_SELECTED_OBJECT(
"SelectedObject");
83 return MY_SELECTED_OBJECT;
89 static const std::string MY_SELECTED_POINT(
"SelectedPoint");
90 return MY_SELECTED_POINT;
96 static const std::string MY_PREVIEW_OBJECT(
"PreviewObject");
97 return MY_PREVIEW_OBJECT;
103 static const std::string MY_PREVIEW_POINT(
"PreviewPoint");
104 return MY_PREVIEW_POINT;
108 SKETCHPLUGIN_EXPORT
virtual void execute();
115 SKETCHPLUGIN_EXPORT
virtual bool isMacro()
const {
return true; }
125 SKETCHPLUGIN_EXPORT
virtual AISObjectPtr
getAISObject(AISObjectPtr thePrevious);
128 virtual std::string
processEvent(
const std::shared_ptr<Events_Message>& theMessage);
138 void getConstraints(std::set<std::shared_ptr<ModelAPI_Feature>>& theFeaturesToDelete,
139 std::set<std::shared_ptr<ModelAPI_Feature>>& theFeaturesToUpdate,
140 std::map<std::shared_ptr<ModelAPI_Feature>, IdToPointPair>& theCoincidenceToFeature);
150 void updateCoincidenceConstraintsToFeature(
151 const std::map<std::shared_ptr<ModelAPI_Feature>, IdToPointPair>& theCoincidenceToFeature,
152 const std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theFurtherCoincidences,
153 const std::set<ResultPtr>& theFeatureResults,
154 const FeaturePtr& theSplitFeature,
155 std::set<FeaturePtr>& theFeaturesToDelete);
160 void updateRefFeatureConstraints(
const std::shared_ptr<ModelAPI_Result>& theFeatureBaseResult,
161 const std::list<AttributePtr>& theRefsToFeature);
172 FeaturePtr splitLine(std::shared_ptr<ModelAPI_Feature>& theSplitFeature,
173 std::shared_ptr<ModelAPI_Feature>& theBeforeFeature,
174 std::shared_ptr<ModelAPI_Feature>& theAfterFeature,
175 std::set<std::shared_ptr<GeomDataAPI_Point2D> >& thePoints,
176 std::set<std::shared_ptr<ModelAPI_Feature>>& theCreatedFeatures,
177 std::set<std::pair<AttributePtr, AttributePtr>>& theModifiedAttributes);
186 FeaturePtr splitArc(std::shared_ptr<ModelAPI_Feature>& theSplitFeature,
187 std::shared_ptr<ModelAPI_Feature>& theBeforeFeature,
188 std::shared_ptr<ModelAPI_Feature>& theAfterFeature,
189 std::set<std::shared_ptr<GeomDataAPI_Point2D> >& thePoints,
190 std::set<std::shared_ptr<ModelAPI_Feature>>& theCreatedFeatures,
191 std::set<std::pair<AttributePtr, AttributePtr>>& theModifiedAttributes);
200 FeaturePtr splitEllipticArc(std::shared_ptr<ModelAPI_Feature>& theSplitFeature,
201 std::shared_ptr<ModelAPI_Feature>& theBeforeFeature,
202 std::shared_ptr<ModelAPI_Feature>& theAfterFeature,
203 std::set<std::shared_ptr<GeomDataAPI_Point2D> >& thePoints,
204 std::set<std::shared_ptr<ModelAPI_Feature>>& theCreatedFeatures,
205 std::set<std::pair<AttributePtr, AttributePtr>>& theModifiedAttributes);
214 FeaturePtr splitClosed(std::shared_ptr<ModelAPI_Feature>& theSplitFeature,
215 std::shared_ptr<ModelAPI_Feature>& theBeforeFeature,
216 std::shared_ptr<ModelAPI_Feature>& theAfterFeature,
217 std::set<std::shared_ptr<GeomDataAPI_Point2D> >& thePoints,
218 std::set<std::shared_ptr<ModelAPI_Feature>>& theCreatedFeatures,
219 std::set<std::pair<AttributePtr, AttributePtr>>& theModifiedAttributes);
228 void arrangePointsOnLine(
const std::shared_ptr<GeomDataAPI_Point2D>& theStartPointAttr,
229 const std::shared_ptr<GeomDataAPI_Point2D>& theEndPointAttr,
230 std::shared_ptr<GeomDataAPI_Point2D>& theFirstPointAttr,
231 std::shared_ptr<GeomDataAPI_Point2D>& theSecondPointAttr)
const;
241 void arrangePointsOnArc(
const FeaturePtr& theArc,
242 const std::shared_ptr<GeomDataAPI_Point2D>& theStartPointAttr,
243 const std::shared_ptr<GeomDataAPI_Point2D>& theEndPointAttr,
244 std::shared_ptr<GeomDataAPI_Point2D>& theFirstPointAttr,
245 std::shared_ptr<GeomDataAPI_Point2D>& theSecondPointAttr)
const;
250 void fillAttribute(
const AttributePtr& theModifiedAttribute,
251 const AttributePtr& theSourceAttribute);
256 std::set<std::shared_ptr<ModelAPI_Attribute> > getEdgeAttributes(
257 const std::shared_ptr<ModelAPI_Feature>& theFeature);
262 std::shared_ptr<GeomDataAPI_Point2D> getPointAttribute(
const bool isFirstAttribute);
268 std::string getFeatureInfo(
const std::shared_ptr<ModelAPI_Feature>& theFeature,
269 const bool isUseAttributesInfo =
true);
273 std::map<std::shared_ptr<ModelAPI_Object>, std::set<GeomShapePtr> > myCashedShapes;
274 std::map<std::shared_ptr<ModelAPI_Object>,
275 GeomAlgoAPI_ShapeTools::PointToRefsMap> myCashedReferences;
A class which defines an interface of object which is able to create its own presentation.
Definition: GeomAPI_IPresentable.h:29
Attribute that contains 2D point coordinates.
Definition: GeomDataAPI_Point2D.h:37
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
Interface of a class which can process specific messages.
Definition: ModelAPI_IReentrant.h:35
The result of a feature.
Definition: ModelAPI_Result.h:35
Feature for creation of the new feature in PartSet.
Definition: SketchPlugin_Feature.h:40
Feature for creation of a new constraint splitting object.
Definition: SketchPlugin_Split.h:65
virtual bool isPreviewNeeded() const
Reimplemented from ModelAPI_Feature::isPreviewNeeded().
Definition: SketchPlugin_Split.h:119
virtual std::string processEvent(const std::shared_ptr< Events_Message > &theMessage)
Apply information of the message to current object. It fills selected point and object.
Definition: SketchPlugin_Split.cpp:423
static const std::string & SELECTED_OBJECT()
The value parameter for the constraint.
Definition: SketchPlugin_Split.h:80
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: SketchPlugin_Split.cpp:80
static const std::string & PREVIEW_OBJECT()
The value parameter for the preview object.
Definition: SketchPlugin_Split.h:94
SketchPlugin_Split()
Use plugin manager for features creation.
Definition: SketchPlugin_Split.cpp:76
virtual const std::string & getKind()
Returns the kind of a feature.
Definition: SketchPlugin_Split.h:74
virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
Returns the AIS preview.
Definition: SketchPlugin_Split.cpp:489
static const std::string & ID()
Split constraint kind.
Definition: SketchPlugin_Split.h:68
static const std::string & PREVIEW_POINT()
Start 2D point of the split segment.
Definition: SketchPlugin_Split.h:101
virtual void execute()
Creates a new part document if needed.
Definition: SketchPlugin_Split.cpp:96
static const std::string & SELECTED_POINT()
Start 2D point of the split segment.
Definition: SketchPlugin_Split.h:87
virtual bool isMacro() const
Reimplemented from ModelAPI_Feature::isMacro().
Definition: SketchPlugin_Split.h:115