]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/SketchPlugin_Feature.h
Salome HOME
Initial version of redesign of working with results
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Feature.h
1 // File:        SketchPlugin_Feature.h
2 // Created:     27 Mar 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef SketchPlugin_Feature_HeaderFile
6 #define SketchPlugin_Feature_HeaderFile
7
8 #include "SketchPlugin.h"
9 #include <ModelAPI_Feature.h>
10 #include <GeomAPI_Shape.h>
11 #include <GeomAPI_AISObject.h>
12 #include <ModelAPI_Document.h>
13
14 class SketchPlugin_Sketch;
15 class GeomAPI_Pnt2d;
16 class Handle_AIS_InteractiveObject;
17
18 /**\class SketchPlugin_Feature
19  * \ingroup DataModel
20  * \brief Feature for creation of the new feature in PartSet. This is an abstract class to give
21  * an interface to create the sketch feature preview.
22  */
23 class SketchPlugin_Feature: public ModelAPI_Feature
24 {
25 public:
26   /// Returns the type of the feature result: it is allways construction element
27   virtual const std::string& getResultType() {return CONSTRUCTIONS_GROUP;}
28
29   /// Returns the AIS preview
30   SKETCHPLUGIN_EXPORT virtual boost::shared_ptr<GeomAPI_AISObject> getAISObject(
31                                 boost::shared_ptr<GeomAPI_AISObject> thePrevious) = 0;
32
33   /// Adds sub-feature of the higher level feature (sub-element of the sketch)
34   /// \param theFeature sub-feature
35   SKETCHPLUGIN_EXPORT virtual const void addSub(
36     const FeaturePtr& theFeature) = 0;
37
38   /// Returns true if this feature must be displayed in the history (top level of Part tree)
39   SKETCHPLUGIN_EXPORT virtual bool isInHistory() {return false;}
40
41   /// Moves the feature
42   /// \param theDeltaX the delta for X coordinate is moved
43   /// \param theDeltaY the delta for Y coordinate is moved
44   SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) = 0;
45
46   /// Return the distance between the feature and the point
47   /// \param thePoint the point
48   virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) = 0;
49
50 protected:
51   /// Sets the higher-level feature for the sub-feature (sketch for line)
52   void setSketch(SketchPlugin_Sketch* theSketch) {mySketch = theSketch;}
53   /// Returns the sketch of this feature
54   SketchPlugin_Sketch* sketch();
55   /// initializes mySketch
56   SketchPlugin_Feature();
57
58   friend class SketchPlugin_Sketch;
59
60 private:
61   boost::shared_ptr<GeomAPI_Shape> myPreview; ///< the preview shape
62   SketchPlugin_Sketch* mySketch; /// sketch that contains this feature
63 };
64
65 #endif