]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMImpl/GEOMImpl_IShapesOperations.hxx
Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IShapesOperations.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/
19 //
20
21 #ifndef _GEOMImpl_IShapesOperations_HXX_
22 #define _GEOMImpl_IShapesOperations_HXX_
23
24 #include "GEOM_IOperations.hxx"
25
26 #include "GEOMAlgo_State.hxx"
27
28 #include <TopTools_ListOfShape.hxx>
29 #include <TColStd_HSequenceOfTransient.hxx>
30 #include <TColStd_HSequenceOfInteger.hxx>
31
32 #include <list>
33 #include <Handle_Geom_Surface.hxx>
34
35 class GEOM_Engine;
36 class Handle(GEOM_Object);
37 class Handle(TColStd_HArray1OfInteger);
38
39 class GEOMImpl_IShapesOperations : public GEOM_IOperations {
40  public:
41   Standard_EXPORT GEOMImpl_IShapesOperations(GEOM_Engine* theEngine, int theDocID);
42   Standard_EXPORT ~GEOMImpl_IShapesOperations();
43
44   Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1,
45                                 Handle(GEOM_Object) thePoint2);
46
47   Standard_EXPORT Handle(GEOM_Object) MakeWire (list<Handle(GEOM_Object)> theEdgesAndWires);
48
49   Standard_EXPORT Handle(GEOM_Object) MakeFace (Handle(GEOM_Object) theWire, const bool isPlanarWanted);
50
51   Standard_EXPORT Handle(GEOM_Object) MakeFaceWires (list<Handle(GEOM_Object)> theWires,
52                                      const bool isPlanarWanted);
53
54   Standard_EXPORT Handle(GEOM_Object) MakeShell (list<Handle(GEOM_Object)> theShapes);
55
56   Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell);
57
58   Standard_EXPORT Handle(GEOM_Object) MakeSolidShells (list<Handle(GEOM_Object)> theShells);
59
60   Standard_EXPORT Handle(GEOM_Object) MakeCompound (list<Handle(GEOM_Object)> theShapes);
61
62   Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape,
63                                      const Standard_Real theTolerance);
64
65   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object)    theShape,
66                                                     const Standard_Integer theShapeType,
67                                                     const Standard_Boolean isSorted);
68
69   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object)    theShape,
70                                                      const Standard_Integer theShapeType,
71                                                      const Standard_Boolean isSorted);
72
73   Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object)    theMainShape,
74                                    const Standard_Integer theID);
75
76   Standard_EXPORT Standard_Integer NumberOfFaces (Handle(GEOM_Object) theShape);
77   Standard_EXPORT Standard_Integer NumberOfEdges (Handle(GEOM_Object) theShape);
78
79   Standard_EXPORT Handle(GEOM_Object) ReverseShape(Handle(GEOM_Object) theShapes);
80
81   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetFreeFacesIDs (Handle(GEOM_Object) theShape);
82
83   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetSharedShapes (Handle(GEOM_Object)    theShape1,
84                                                         Handle(GEOM_Object)    theShape2,
85                                                         const Standard_Integer theShapeType);
86
87   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnPlane (const Handle(GEOM_Object)& theShape,
88                                                          const Standard_Integer     theShapeType,
89                                                          const Handle(GEOM_Object)& theAx1,
90                                                          const GEOMAlgo_State       theState);
91
92   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
93                                                             const Standard_Integer     theShapeType,
94                                                             const Handle(GEOM_Object)& theAxis,
95                                                             const Standard_Real        theRadius,
96                                                             const GEOMAlgo_State       theState);
97
98   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
99                                                           const Standard_Integer     theShapeType,
100                                                           const Handle(GEOM_Object)& theCenter,
101                                                           const Standard_Real        theRadius,
102                                                           const GEOMAlgo_State       theState);
103
104   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape,
105                                                           const Standard_Integer     theShapeType,
106                                                           const Handle(GEOM_Object)& theAx1,
107                                                           const GEOMAlgo_State       theState);
108
109   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape,
110                                                              const Standard_Integer     theShapeType,
111                                                              const Handle(GEOM_Object)& theAxis,
112                                                              const Standard_Real        theRadius,
113                                                              const GEOMAlgo_State       theState);
114
115   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape,
116                                                            const Standard_Integer     theShapeType,
117                                                            const Handle(GEOM_Object)& theCenter,
118                                                            const Standard_Real        theRadius,
119                                                            const GEOMAlgo_State       theState);
120
121   /*!
122    * \brief Find subshapes complying with given status about quadrangle
123     * \param theShape - the shape to explore
124     * \param theShapeType - type of subshape of theShape
125     * \param theTopLeftPoint - top left quadrangle corner
126     * \param theTopRigthPoint - top right quadrangle corner
127     * \param theBottomLeftPoint - bottom left quadrangle corner
128     * \param theBottomRigthPoint - bottom right quadrangle corner
129     * \param theState - required state
130     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
131    */
132   Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
133     GetShapesOnQuadrangle (const Handle(GEOM_Object)& theShape,
134                            const Standard_Integer     theShapeType,
135                            const Handle(GEOM_Object)& theTopLeftPoint,
136                            const Handle(GEOM_Object)& theTopRigthPoint,
137                            const Handle(GEOM_Object)& theBottomLeftPoint,
138                            const Handle(GEOM_Object)& theBottomRigthPoint,
139                            const GEOMAlgo_State       theState);
140
141   /*!
142    * \brief Find IDs of subshapes complying with given status about quadrangle
143     * \param theShape - the shape to explore
144     * \param theShapeType - type of subshape of theShape
145     * \param theTopLeftPoint - top left quadrangle corner
146     * \param theTopRigthPoint - top right quadrangle corner
147     * \param theBottomLeftPoint - bottom left quadrangle corner
148     * \param theBottomRigthPoint - bottom right quadrangle corner
149     * \param theState - required state
150     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
151    */
152   Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
153     GetShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
154                               const Standard_Integer     theShapeType,
155                               const Handle(GEOM_Object)& theTopLeftPoint,
156                               const Handle(GEOM_Object)& theTopRigthPoint,
157                               const Handle(GEOM_Object)& theBottomLeftPoint,
158                               const Handle(GEOM_Object)& theBottomRigthPoint,
159                               const GEOMAlgo_State       theState);
160
161   Standard_EXPORT Handle(GEOM_Object) GetShapesOnCylinderOld (Handle(GEOM_Object)    theShape,
162                                               const Standard_Integer theShapeType,
163                                               Handle(GEOM_Object)    theAxis,
164                                               const Standard_Real    theRadius);
165
166   Standard_EXPORT Handle(GEOM_Object) GetShapesOnSphereOld (Handle(GEOM_Object)    theShape,
167                                             const Standard_Integer theShapeType,
168                                             Handle(GEOM_Object)    theCenter,
169                                             const Standard_Real    theRadius);
170
171   Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere,
172                                   Handle(GEOM_Object) theShapeWhat);
173
174   Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL);
175
176  private:
177   Handle(GEOM_Object) MakeShape (list<Handle(GEOM_Object)>      theShapes,
178                                  const Standard_Integer         theObjectType,
179                                  const Standard_Integer         theFunctionType,
180                                  const TCollection_AsciiString& theMethodName);
181
182 // ----------------------------------------------------
183   // methods common for all GetShapesOnXXX() functions
184 // ----------------------------------------------------
185
186   bool CheckTriangulation (const TopoDS_Shape& aShape);
187
188   /*!
189    * \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK
190     * \param theShapeType - the shape type to check
191     * \retval bool  - result of the check
192    */
193   bool checkTypeShapesOn(const Standard_Integer theShapeType);
194
195   /*!
196    * \brief Creates Geom_Plane
197     * \param theAx1 - edge defining plane normal
198     * \retval Handle(Geom_Surface) - resulting surface
199    */
200   Handle(Geom_Surface) makePlane(const TopoDS_Shape& theAx1);
201
202   /*!
203    * \brief Creates Geom_CylindricalSurface
204     * \param theAx1 - edge defining cylinder axis
205     * \param theRadius - cylinder radius
206     * \retval Handle(Geom_Surface) - resulting surface
207    */
208   Handle(Geom_Surface) makeCylinder(const TopoDS_Shape& theAx1,
209                                     const Standard_Real theRadius);
210
211   /*!
212    * \brief Find IDs of subshapes complying with given status about surface
213     * \param theSurface - the surface to check state of subshapes against
214     * \param theShape - the shape to explore
215     * \param theShapeType - type of subshape of theShape
216     * \param theState - required state
217     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
218    */
219   Handle(TColStd_HSequenceOfInteger)
220     getShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
221                           const TopoDS_Shape&         theShape,
222                           TopAbs_ShapeEnum            theShapeType,
223                           GEOMAlgo_State              theState);
224
225   /*!
226    * \brief Find subshapes complying with given status about surface
227     * \param theSurface - the surface to check state of subshapes against
228     * \param theShape - the shape to explore
229     * \param theShapeType - type of subshape of theShape
230     * \param theState - required state
231     * \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
232     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
233    */
234   Handle(TColStd_HSequenceOfTransient)
235     getShapesOnSurface(const Handle(Geom_Surface)& theSurface,
236                        const Handle(GEOM_Object)&  theShape,
237                        TopAbs_ShapeEnum            theShapeType,
238                        GEOMAlgo_State              theState,
239                        TCollection_AsciiString &   theShapeEntries
240                        );
241
242   /*!
243    * \brief Find IDs of subshapes complying with given status about quadrangle
244     * \param theShape - the shape to explore
245     * \param theShapeType - type of subshape of theShape
246     * \param theTopLeftPoint - top left quadrangle corner
247     * \param theTopRigthPoint - top right quadrangle corner
248     * \param theBottomLeftPoint - bottom left quadrangle corner
249     * \param theBottomRigthPoint - bottom right quadrangle corner
250     * \param theState - required state
251     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
252    */
253   Handle(TColStd_HSequenceOfInteger)
254     getShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
255                               const Standard_Integer     theShapeType,
256                               const Handle(GEOM_Object)& theTopLeftPoint,
257                               const Handle(GEOM_Object)& theTopRigthPoint,
258                               const Handle(GEOM_Object)& theBottomLeftPoint,
259                               const Handle(GEOM_Object)& theBottomRigthPoint,
260                               const GEOMAlgo_State       theState);
261
262   /*!
263    * \brief Find shape objects and their entries by their ids
264     * \param theShape - the main shape
265     * \param theShapeIDs - theShapeIDs - incoming shape ids
266     * \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
267     * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
268    */
269   Handle(TColStd_HSequenceOfTransient)
270     getObjectsShapesOn(const Handle(GEOM_Object)&                theShape,
271                        const Handle(TColStd_HSequenceOfInteger)& theShapeIDs,
272                        TCollection_AsciiString &                 theShapeEntries);
273
274   /*!
275    * \brief Select the object created last
276     * \param theObj1 - Object 1
277     * \param theObj2 - Object 2
278     * \retval Handle(GEOM_Object) - selected object
279    */
280   static Handle(GEOM_Object) getCreatedLast(const Handle(GEOM_Object)& theObj1,
281                                             const Handle(GEOM_Object)& theObj2);
282 };
283
284 #endif