Salome HOME
updated copyright message
[modules/geom.git] / src / GEOMImpl / GEOMImpl_PolylineDumper.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   : GEOMImpl_PolylineDumper.h
24 //  Author : Sergey KHROMOV
25
26
27 #ifndef _GEOMImpl_PolylineDumper_HXX_
28 #define _GEOMImpl_PolylineDumper_HXX_
29
30
31 #include "GEOM_GEOMImpl.hxx"
32
33 #include <GEOM_Object.hxx>
34
35 #include <TColStd_HArray1OfExtendedString.hxx>
36 #include <TColStd_HArray1OfByte.hxx>
37 #include <TColStd_HArray1OfReal.hxx>
38
39 #include <list>
40
41
42 /**
43  * This is a helper class to form a dump of a polyline 2d curves creation
44  * algorithm.
45  */
46 class GEOMIMPL_EXPORT GEOMImpl_PolylineDumper
47 {
48
49 public:
50
51   /**
52    * This constructor initializes the object with 2D polyline creation
53    * parameters.
54    *
55    *  \param theCoords the list of coordinates list. theCoordsList[0]
56    *         is the coordinates list of the first section. theCoordsList[1]
57    *         is for the second section etc.
58    *  \param theNames the list of names. The order corresponds to theCoords.
59    *  \param theTypes the list of curve types. The order corresponds to
60    *         theCoords.
61    *  \param theCloseds the list of Closed flags. The order corresponds to
62    *         theCoords.
63    *  \param thePlnCoords 9 double values, defining origin,
64    *         OZ and OX directions of the working plane.
65    */
66   GEOMImpl_PolylineDumper
67             (const std::list <std::list <double> >        &theCoords,
68              const Handle(TColStd_HArray1OfExtendedString) &theNames,
69              const Handle(TColStd_HArray1OfByte)           &theTypes,
70              const Handle(TColStd_HArray1OfByte)           &theCloseds,
71              const Handle(TColStd_HArray1OfReal)           &thePlnCoords);
72
73   /**
74    * This constructor initializes the object with 2D polyline creation
75    * parameters.
76    *
77    *  \param theCoords the list of coordinates list. theCoordsList[0]
78    *         is the coordinates list of the first section. theCoordsList[1]
79    *         is for the second section etc.
80    *  \param theNames the list of names. The order corresponds to theCoords.
81    *  \param theTypes the list of curve types. The order corresponds to
82    *         theCoords.
83    *  \param theCloseds the list of Closed flags. The order corresponds to
84    *         theCoords.
85    *  \param theWorkingPlane planar Face or LCS(Marker) of the working plane.
86    */
87   GEOMImpl_PolylineDumper
88             (const std::list <std::list <double> >        &theCoords,
89              const Handle(TColStd_HArray1OfExtendedString) &theNames,
90              const Handle(TColStd_HArray1OfByte)           &theTypes,
91              const Handle(TColStd_HArray1OfByte)           &theCloseds,
92              const Handle(GEOM_Object)                     &theWorkingPlane);
93
94   /**
95    * This method returns Standard_True if the dump description is created
96    * successfully.
97    *
98    * \return Standard_True in case of success; Standard_False otherwise.
99    */
100   Standard_Boolean IsDone() const
101   { return myIsDone; }
102
103   /**
104    * This method performs dump of the polyline.
105    *
106    * \param theObject the newly created object.
107    * \return Standard_True in case of success; Standard_False otherwise.
108    */
109   Standard_Boolean Dump(const Handle(GEOM_Object) &theObject);
110
111 protected:
112
113   /**
114    * This method generates the description required for python dump.
115    * It is called from constructor.
116    */
117   void init();
118
119 private:
120
121   const std::list <std::list <double> >  &myCoords;
122   Handle(TColStd_HArray1OfExtendedString)  myNames;
123   Handle(TColStd_HArray1OfByte)            myTypes;
124   Handle(TColStd_HArray1OfByte)            myCloseds;
125   Handle(TColStd_HArray1OfReal)            myPlnCoords;
126   Handle(GEOM_Object)                      myWorkingPlane;
127   Standard_Boolean                        myIsDone;
128   TCollection_ExtendedString              myDescr;
129
130 };
131
132 #endif