Salome HOME
Task #3005 : To be able to create a group on a whole result
[modules/shaper.git] / src / GeomAPI / GeomAPI_Curve.h
1 // Copyright (C) 2014-2019  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
18 //
19
20 #ifndef GeomAPI_Curve_H_
21 #define GeomAPI_Curve_H_
22
23 #include <GeomAPI_Shape.h>
24 #include <memory>
25
26 class GeomAPI_Pnt;
27
28 /**\class GeomAPI_Curve
29  * \ingroup DataModel
30  * \brief Interface to the generic curve object
31  */
32
33 class GeomAPI_Curve : public GeomAPI_Interface
34 {
35  public:
36   /// Creation of empty (null) shape
37   GEOMAPI_EXPORT
38   GeomAPI_Curve();
39
40   /// Creates a curve from the shape (edge)
41   GEOMAPI_EXPORT
42   GeomAPI_Curve(const std::shared_ptr<GeomAPI_Shape>& theShape);
43
44   /// Returns true if curve is not initialized
45   GEOMAPI_EXPORT
46   bool isNull() const;
47
48   /// Returns \c true if curves are equal
49   GEOMAPI_EXPORT
50   bool isEqual(const std::shared_ptr<GeomAPI_Curve>& theOther) const;
51
52   /// Returns whether the curve is linear
53   GEOMAPI_EXPORT
54   virtual bool isLine() const;
55
56   /// Returns whether the curve is circular
57   GEOMAPI_EXPORT
58   virtual bool isCircle() const;
59
60   /// Returns start parameter of the curve
61   GEOMAPI_EXPORT
62   double startParam() const { return myStart; }
63
64   /// Returns end parameter of the curve
65   GEOMAPI_EXPORT
66   double endParam() const { return myEnd; }
67
68   /// Returns \c true if the curve is trimmed
69   GEOMAPI_EXPORT
70   virtual bool isTrimmed() const;
71
72   /// Returns basis for the trimmed curve
73   GEOMAPI_EXPORT
74   virtual std::shared_ptr<GeomAPI_Curve> basisCurve() const;
75
76   /// Returns point on the curve by parameter
77   /// \param theParam parameter on the curve
78   GEOMAPI_EXPORT
79   std::shared_ptr<GeomAPI_Pnt> getPoint(double theParam);
80
81 public:
82   /// \brief Compare addresses of curves
83   class Comparator
84   {
85   public:
86     /// Return \c true if the address of the first curve is less than the address of the second
87     GEOMAPI_EXPORT
88     bool operator ()(const std::shared_ptr<GeomAPI_Curve>& theCurve1,
89                      const std::shared_ptr<GeomAPI_Curve>& theCurve2) const;
90   };
91
92 private:
93   double myStart;
94   double myEnd;
95 };
96
97 //! Pointer on the object
98 typedef std::shared_ptr<GeomAPI_Curve> GeomCurvePtr;
99
100 #endif