Salome HOME
65ba0d5b755150c8178be3b69b48d4bc09db87dd
[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 whether the curve is elliptic
61   GEOMAPI_EXPORT
62   virtual bool isEllipse() const;
63
64   /// Returns start parameter of the curve
65   GEOMAPI_EXPORT
66   double startParam() const { return myStart; }
67
68   /// Returns end parameter of the curve
69   GEOMAPI_EXPORT
70   double endParam() const { return myEnd; }
71
72   /// Returns \c true if the curve is trimmed
73   GEOMAPI_EXPORT
74   virtual bool isTrimmed() const;
75
76   /// Returns basis for the trimmed curve
77   GEOMAPI_EXPORT
78   virtual std::shared_ptr<GeomAPI_Curve> basisCurve() const;
79
80   /// Returns point on the curve by parameter
81   /// \param theParam parameter on the curve
82   GEOMAPI_EXPORT
83   std::shared_ptr<GeomAPI_Pnt> getPoint(double theParam);
84
85 public:
86   /// \brief Compare addresses of curves
87   class Comparator
88   {
89   public:
90     /// Return \c true if the address of the first curve is less than the address of the second
91     GEOMAPI_EXPORT
92     bool operator ()(const std::shared_ptr<GeomAPI_Curve>& theCurve1,
93                      const std::shared_ptr<GeomAPI_Curve>& theCurve2) const;
94   };
95
96 private:
97   double myStart;
98   double myEnd;
99 };
100
101 //! Pointer on the object
102 typedef std::shared_ptr<GeomAPI_Curve> GeomCurvePtr;
103
104 #endif