X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Trim.h;h=610ae1e1c7800e3405496f93ffcc4a2a085fd0ba;hb=b5893b0a30fac08134c24de4565cb513a43affa6;hp=6b95dd51bf3c2202cbe0adc27d063bfb8a43ec4f;hpb=b707e7178424958f7dc1ed87a0aabd813f671d88;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Trim.h b/src/SketchPlugin/SketchPlugin_Trim.h index 6b95dd51b..610ae1e1c 100644 --- a/src/SketchPlugin/SketchPlugin_Trim.h +++ b/src/SketchPlugin/SketchPlugin_Trim.h @@ -7,13 +7,16 @@ #ifndef SketchPlugin_Trim_H_ #define SketchPlugin_Trim_H_ +#include + #include "SketchPlugin.h" -#include #include "SketchPlugin_ConstraintBase.h" +#include class GeomDataAPI_Point2D; class ModelAPI_Feature; class ModelAPI_Result; +class ModelAPI_Object; typedef std::pair > IdToPointPair; @@ -21,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 @@ -88,16 +92,25 @@ 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; - static void fillObjectShapes(const ObjectPtr& theObject, - ObjectPtr& theSketch, - std::map >& theCashedShapes, - std::map& theObjectToPoints); + static void fillObjectShapes(const std::shared_ptr& theObject, + const std::shared_ptr& theSketch, + std::map, std::set >& theCashedShapes, + 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); @@ -113,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 @@ -130,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 ObjectPtr& 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 @@ -142,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, @@ -267,9 +288,8 @@ private: std::shared_ptr convertPoint(const std::shared_ptr& thePoint); private: - std::map > myCashedShapes; - - std::map myObjectToPoints; + std::map, std::set > myCashedShapes; + std::map, PointToRefsMap> myObjectToPoints; }; #endif