Salome HOME
updated copyright message
[modules/shaper.git] / src / GeomAPI / GeomAPI_Curve.h
1 // Copyright (C) 2014-2023  CEA, EDF
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();
67
68   /// Returns end parameter of the curve
69   GEOMAPI_EXPORT
70   double endParam();
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   /// Project point on curve
86   GEOMAPI_EXPORT const std::shared_ptr<GeomAPI_Pnt> project(
87       const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
88
89 public:
90   /// \brief Compare addresses of curves
91   class Comparator
92   {
93   public:
94     /// Return \c true if the address of the first curve is less than the address of the second
95     GEOMAPI_EXPORT
96     bool operator ()(const std::shared_ptr<GeomAPI_Curve>& theCurve1,
97                      const std::shared_ptr<GeomAPI_Curve>& theCurve2) const;
98   };
99
100 private:
101   double myStart;
102   double myEnd;
103 };
104
105 //! Pointer on the object
106 typedef std::shared_ptr<GeomAPI_Curve> GeomCurvePtr;
107
108 #endif