Salome HOME
5b8a1d37d6a615562f4aa1ff319288f524582a40
[modules/geom.git] / src / SKETCHER / Sketcher_Utils.hxx
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  File   : Sketcher_Utils.h
24 //  Author : Sergey KHROMOV
25
26
27 #ifndef _Sketcher_Utils_HXX_
28 #define _Sketcher_Utils_HXX_
29
30
31 #include "Sketcher.hxx"
32
33 #include <gp_Pnt.hxx>
34 #include <TopoDS_Shape.hxx>
35
36 #include <list>
37
38
39 class gp_Ax3;
40
41
42 /**
43  * This class represents a set of utils needed to compute sketcher geometry.
44  */
45 class SKETCHER_SALOME_EXPORT Sketcher_Utils
46 {
47
48 public:
49
50   /**
51    * This method makes a shape from the list of 2D coordinates on the working
52    * plane. The result represents a vertex if there is only one point
53    * in the contour. If there are more then one points the result is a wire
54    * consisting of linear segments between points. It is either closed or not
55    * depending on the flag IsClosed. In case of failure the result is a null
56    * shape.
57    *
58    * \param theCoords2D is the list of coordinates in the form x1, y1, x2, y2,
59    *        ..., xN, yN for N 2D points.
60    * \param IsClosed if Standard_True the first and last points are connected
61    *        to form the closed contour.
62    * \param thePlane the working plane coordinate system.
63    * \return the result polyline.
64    */
65   static TopoDS_Shape MakePolyline(const std::list <double> &theCoords2D,
66                                    const Standard_Boolean    IsClosed,
67                                    const gp_Ax3             &thePlane);
68
69   /**
70    * This method makes a shape from the list of 2D coordinates on the working
71    * plane. The result represents a vertex if there is only one point
72    * in the contour. If there are more then one points the result is a wire
73    * consisting of a points interpolation BSpline curve. It is either closed
74    * or not depending on the flag IsClosed. In case of failure the result is
75    * a null shape.
76    *
77    * \param theCoords2D is the list of coordinates in the form x1, y1, x2, y2,
78    *        ..., xN, yN for N 2D points.
79    * \param IsClosed if Standard_True the first and last points are connected
80    *        to form the closed contour.
81    * \param thePlane the working plane coordinate system.
82    * \return the result interpolation wire.
83    */
84   static TopoDS_Shape MakeInterpolation(const std::list <double> &theCoords2D,
85                                         const Standard_Boolean    IsClosed,
86                                         const gp_Ax3             &thePlane);
87
88   /**
89    * This method converts the list of 2D point coordinates into 3D points
90    * basing on the working plane. The result list contains not confused points.
91    *
92    * \param theCoords2D is the list of coordinates in the form x1, y1, x2, y2,
93    *        ..., xN, yN for N 2D points.
94    * \param thePlane the working plane coordinate system.
95    * \param thePoints the list of 3D points.
96    */
97   static void To3D(const std::list <double> &theCoords2D,
98                    const gp_Ax3             &thePlane,
99                          std::list <gp_Pnt> &thePoints);
100
101 };
102
103 #endif