X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Trim.h;h=610ae1e1c7800e3405496f93ffcc4a2a085fd0ba;hb=b5893b0a30fac08134c24de4565cb513a43affa6;hp=db43d5fa6ec903bf4cb8e8523075357faa573149;hpb=a7fb6a3aa39361d4773c6dc54e7c30683b322014;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Trim.h b/src/SketchPlugin/SketchPlugin_Trim.h index db43d5fa6..610ae1e1c 100644 --- a/src/SketchPlugin/SketchPlugin_Trim.h +++ b/src/SketchPlugin/SketchPlugin_Trim.h @@ -7,9 +7,11 @@ #ifndef SketchPlugin_Trim_H_ #define SketchPlugin_Trim_H_ +#include + #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include class GeomDataAPI_Point2D; class ModelAPI_Feature; @@ -22,7 +24,8 @@ typedef std::pair > IdToPointP * \ingroup Plugins * \brief Feature for creation of a new constraint trimming object. Entities for split: */ -class SketchPlugin_Trim : public SketchPlugin_Feature, public GeomAPI_IPresentable +class SketchPlugin_Trim : public SketchPlugin_Feature, public GeomAPI_IPresentable, + public ModelAPI_IReentrant { public: /// Split constraint kind @@ -89,6 +92,9 @@ class SketchPlugin_Trim : public SketchPlugin_Feature, public GeomAPI_IPresentab /// Moves the feature : Empty SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) {}; + /// Apply information of the message to current object. It fills selected point and object + virtual std::string processEvent(const std::shared_ptr& theMessage); + typedef std::map, std::pair >, std::list > > > PointToRefsMap; @@ -99,6 +105,12 @@ class SketchPlugin_Trim : public SketchPlugin_Feature, public GeomAPI_IPresentab std::map, PointToRefsMap>& theObjectToPoints); private: + bool setCoincidenceToAttribute(const AttributePtr& theAttribute, + const std::set >& theFurtherCoincidences); + + bool replaceCoincidenceAttribute(const AttributePtr& theCoincidenceAttribute, + const std::set>& theModifiedAttributes); + GeomShapePtr getSubShape(const std::string& theObjectAttributeId, const std::string& thePointAttributeId); @@ -114,7 +126,9 @@ private: /// Obtains those constraints of the feature that should be modified. output maps contain /// point of coincidence and attribute id to be modified after split /// \param theFeaturesToDelete [out] constrains that will be deleted after split - void getConstraints(std::set>& theFeaturesToDelete); + /// \param theFeaturesToUpdate [out] constrains that will be updated after split + void getConstraints(std::set>& theFeaturesToDelete, + std::set& theFeaturesToUpdate); /// Obtains references to feature point attributes and to feature, /// e.g. for feature line: 1st container is @@ -131,8 +145,8 @@ private: /// by the coincident attribute /// \param theObject an investigated object /// \param theCoincidencesToBaseFeature a container of list of referenced attributes - void getCoincidencesToObject(const std::shared_ptr& theObject, - std::map& theCoincidencesToBaseFeature); + //void getCoincidencesToObject(const std::shared_ptr& theObject, + // std::map& theCoincidencesToBaseFeature); /// Move constraints from attribute of base feature to attribute after modification /// \param theBaseRefAttributes container of references to the attributes of base feature @@ -143,32 +157,38 @@ private: const std::set >& theModifiedAttributes, std::set>& theFeaturesToDelete); + /// Remove references constraints from attribute of base feature refer to the given attribute + /// \param theAttribute an attribute + /// \param theModifiedAttributes modifiable container of attributes + void removeReferencesToAttribute(const AttributePtr& theAttribute, + std::map >& theBaseRefAttributes); + + /// Updates line length if it exist in the list + /// \param theFeaturesToUpdate a constraints container + void updateFeaturesAfterTrim(const std::set& theFeaturesToUpdate); + /// Make the base object is splitted by the point attributes - /// \param theSplitFeature a result split feature - /// \param theBeforeFeature a feature between start point and the 1st point of split feature - /// \param theAfterFeature a feature between last point of split feature and the end point + /// \param theBaseRefAttributes container of references to the attributes of base feature /// \param thePoints a list of points where coincidences will be build /// \param theModifiedAttributes a container of attribute on base /// feature to attribute on new feature - void trimLine(const std::shared_ptr& theStartShapePoint, + /// \return new line if it was created + FeaturePtr trimLine(const std::shared_ptr& theStartShapePoint, const std::shared_ptr& theLastShapePoint, + std::map >& theBaseRefAttributes, std::set >& thePoints, std::set>& theModifiedAttributes); /// Make the base object is splitted by the point attributes - /// \param theSplitFeature a result split feature - /// \param theBeforeFeature a feature between start point and the 1st point of split feature - /// \param theAfterFeature a feature between last point of split feature and the end point /// \param thePoints a list of points where coincidences will be build - void trimArc(const std::shared_ptr& theStartShapePoint, + /// \return new line if it was created + FeaturePtr trimArc(const std::shared_ptr& theStartShapePoint, const std::shared_ptr& theLastShapePoint, + std::map >& theBaseRefAttributes, std::set >& thePoints, std::set>& theModifiedAttributes); /// Make the base object is splitted by the point attributes - /// \param theSplitFeature a result split feature - /// \param theBeforeFeature a feature between start point and the 1st point of split feature - /// \param theAfterFeature a feature between last point of split feature and the end point /// \param thePoints a list of points where coincidences will be build FeaturePtr trimCircle(const std::shared_ptr& theStartShapePoint, const std::shared_ptr& theLastShapePoint,