]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/SketchPlugin_Fillet.h
Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Fillet.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
18 //
19
20 #ifndef SketchPlugin_Fillet_H_
21 #define SketchPlugin_Fillet_H_
22
23 #include "SketchPlugin.h"
24
25 #include "SketchPlugin_SketchEntity.h"
26
27 #include <GeomAPI_IPresentable.h>
28 #include <GeomDataAPI_Point2D.h>
29
30 class GeomAPI_XY;
31
32 /// \class SketchPlugin_Fillet
33 /// \ingroup Plugins
34 /// \brief Feature for creation of a new arc filleting two objects which have
35 /// coincident point.
36 class SketchPlugin_Fillet: public SketchPlugin_SketchEntity, public GeomAPI_IPresentable
37 {
38  public:
39   /// Feature kind.
40   inline static const std::string& ID()
41   {
42     static const std::string MY_FEATURE_ID("SketchFillet");
43     return MY_FEATURE_ID;
44   }
45
46   /// Attribute name of fillet point.
47   inline static const std::string& FILLET_POINT_ID()
48   {
49     static const std::string ID("fillet_point");
50     return ID;
51   }
52
53   /// \return the kind of a feature.
54   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
55   {
56     static std::string MY_KIND = SketchPlugin_Fillet::ID();
57     return MY_KIND;
58   }
59
60   /// \brief Creates a new part document if needed.
61   SKETCHPLUGIN_EXPORT virtual void execute();
62
63   /// \brief Request for initialization of data model of the feature: adding all attributes.
64   SKETCHPLUGIN_EXPORT virtual void initAttributes();
65
66   /// Returns the AIS preview
67   SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
68
69   /// Reimplemented from ModelAPI_Feature::isMacro().
70   /// \returns true
71   SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}
72
73   SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}
74
75   /// Reimplemented from SketchPlugin_Feature::move().
76   /// Do nothing.
77   SKETCHPLUGIN_EXPORT virtual void move(const double, const double) {}
78
79   /// \brief Use plugin manager for features creation
80   SketchPlugin_Fillet();
81
82 private:
83   bool calculateFilletParameters();
84
85   bool findFeaturesContainingFilletPoint(std::shared_ptr<GeomDataAPI_Point2D> theFilletPoint);
86
87 private:
88     FeaturePtr myBaseFeatures[2];
89     std::string myFeatAttributes[4]; // attributes of features
90     bool myIsReversed;
91     bool myIsNotInversed[2]; // indicates which point the features share
92     bool myFilletCreated;
93     std::shared_ptr<GeomAPI_XY> myCenterXY;
94     std::shared_ptr<GeomAPI_XY> myTangentXY1;
95     std::shared_ptr<GeomAPI_XY> myTangentXY2;
96 };
97
98 #endif