Salome HOME
f9b077a9fc18571cf34f56f97449909ed581e097
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IShapesOperations.hxx
1
2 #ifndef _GEOMImpl_IShapesOperations_HXX_
3 #define _GEOMImpl_IShapesOperations_HXX_
4
5 #include "GEOM_IOperations.hxx"
6
7 #include "GEOMAlgo_State.hxx"
8
9 #include <TopTools_ListOfShape.hxx>
10 #include <TColStd_HSequenceOfTransient.hxx>
11 #include <TColStd_HSequenceOfInteger.hxx>
12
13 #include <list>
14 #include <Handle_Geom_Surface.hxx>
15
16 class GEOM_Engine;
17 class Handle(GEOM_Object);
18 class Handle(TColStd_HArray1OfInteger);
19
20 class GEOMImpl_IShapesOperations : public GEOM_IOperations {
21  public:
22   Standard_EXPORT GEOMImpl_IShapesOperations(GEOM_Engine* theEngine, int theDocID);
23   Standard_EXPORT ~GEOMImpl_IShapesOperations();
24
25   Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1,
26                                 Handle(GEOM_Object) thePoint2);
27
28   Standard_EXPORT Handle(GEOM_Object) MakeWire (list<Handle(GEOM_Object)> theEdgesAndWires);
29
30   Standard_EXPORT Handle(GEOM_Object) MakeFace (Handle(GEOM_Object) theWire, const bool isPlanarWanted);
31
32   Standard_EXPORT Handle(GEOM_Object) MakeFaceWires (list<Handle(GEOM_Object)> theWires,
33                                      const bool isPlanarWanted);
34
35   Standard_EXPORT Handle(GEOM_Object) MakeShell (list<Handle(GEOM_Object)> theShapes);
36
37   Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell);
38
39   Standard_EXPORT Handle(GEOM_Object) MakeSolidShells (list<Handle(GEOM_Object)> theShells);
40
41   Standard_EXPORT Handle(GEOM_Object) MakeCompound (list<Handle(GEOM_Object)> theShapes);
42
43   Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape,
44                                      const Standard_Real theTolerance);
45
46   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object)    theShape,
47                                                     const Standard_Integer theShapeType,
48                                                     const Standard_Boolean isSorted);
49
50   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object)    theShape,
51                                                      const Standard_Integer theShapeType,
52                                                      const Standard_Boolean isSorted);
53
54   Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object)    theMainShape,
55                                    const Standard_Integer theID);
56
57   Standard_EXPORT Standard_Integer NumberOfFaces (Handle(GEOM_Object) theShape);
58   Standard_EXPORT Standard_Integer NumberOfEdges (Handle(GEOM_Object) theShape);
59
60   Standard_EXPORT Handle(GEOM_Object) ReverseShape(Handle(GEOM_Object) theShapes);
61
62   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetFreeFacesIDs (Handle(GEOM_Object) theShape);
63
64   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetSharedShapes (Handle(GEOM_Object)    theShape1,
65                                                         Handle(GEOM_Object)    theShape2,
66                                                         const Standard_Integer theShapeType);
67
68   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnPlane (const Handle(GEOM_Object)& theShape,
69                                                          const Standard_Integer     theShapeType,
70                                                          const Handle(GEOM_Object)& theAx1,
71                                                          const GEOMAlgo_State       theState);
72
73   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
74                                                             const Standard_Integer     theShapeType,
75                                                             const Handle(GEOM_Object)& theAxis,
76                                                             const Standard_Real        theRadius,
77                                                             const GEOMAlgo_State       theState);
78
79   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
80                                                           const Standard_Integer     theShapeType,
81                                                           const Handle(GEOM_Object)& theCenter,
82                                                           const Standard_Real        theRadius,
83                                                           const GEOMAlgo_State       theState);
84
85   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape,
86                                                           const Standard_Integer     theShapeType,
87                                                           const Handle(GEOM_Object)& theAx1,
88                                                           const GEOMAlgo_State       theState);
89
90   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape,
91                                                              const Standard_Integer     theShapeType,
92                                                              const Handle(GEOM_Object)& theAxis,
93                                                              const Standard_Real        theRadius,
94                                                              const GEOMAlgo_State       theState);
95
96   Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape,
97                                                            const Standard_Integer     theShapeType,
98                                                            const Handle(GEOM_Object)& theCenter,
99                                                            const Standard_Real        theRadius,
100                                                            const GEOMAlgo_State       theState);
101
102   /*!
103    * \brief Find subshapes complying with given status about quadrangle
104     * \param theShape - the shape to explore
105     * \param theShapeType - type of subshape of theShape
106     * \param theTopLeftPoint - top left quadrangle corner
107     * \param theTopRigthPoint - top right quadrangle corner
108     * \param theBottomLeftPoint - bottom left quadrangle corner
109     * \param theBottomRigthPoint - bottom right quadrangle corner
110     * \param theState - required state
111     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
112    */
113   Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
114     GetShapesOnQuadrangle (const Handle(GEOM_Object)& theShape,
115                            const Standard_Integer     theShapeType,
116                            const Handle(GEOM_Object)& theTopLeftPoint,
117                            const Handle(GEOM_Object)& theTopRigthPoint,
118                            const Handle(GEOM_Object)& theBottomLeftPoint,
119                            const Handle(GEOM_Object)& theBottomRigthPoint,
120                            const GEOMAlgo_State       theState);
121
122   /*!
123    * \brief Find IDs of subshapes complying with given status about quadrangle
124     * \param theShape - the shape to explore
125     * \param theShapeType - type of subshape of theShape
126     * \param theTopLeftPoint - top left quadrangle corner
127     * \param theTopRigthPoint - top right quadrangle corner
128     * \param theBottomLeftPoint - bottom left quadrangle corner
129     * \param theBottomRigthPoint - bottom right quadrangle corner
130     * \param theState - required state
131     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
132    */
133   Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
134     GetShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
135                               const Standard_Integer     theShapeType,
136                               const Handle(GEOM_Object)& theTopLeftPoint,
137                               const Handle(GEOM_Object)& theTopRigthPoint,
138                               const Handle(GEOM_Object)& theBottomLeftPoint,
139                               const Handle(GEOM_Object)& theBottomRigthPoint,
140                               const GEOMAlgo_State       theState);
141
142   Standard_EXPORT Handle(GEOM_Object) GetShapesOnCylinderOld (Handle(GEOM_Object)    theShape,
143                                               const Standard_Integer theShapeType,
144                                               Handle(GEOM_Object)    theAxis,
145                                               const Standard_Real    theRadius);
146
147   Standard_EXPORT Handle(GEOM_Object) GetShapesOnSphereOld (Handle(GEOM_Object)    theShape,
148                                             const Standard_Integer theShapeType,
149                                             Handle(GEOM_Object)    theCenter,
150                                             const Standard_Real    theRadius);
151
152   Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere,
153                                   Handle(GEOM_Object) theShapeWhat);
154
155   Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL);
156
157  private:
158   Handle(GEOM_Object) MakeShape (list<Handle(GEOM_Object)>      theShapes,
159                                  const Standard_Integer         theObjectType,
160                                  const Standard_Integer         theFunctionType,
161                                  const TCollection_AsciiString& theMethodName);
162
163 // ----------------------------------------------------
164   // methods common for all GetShapesOnXXX() functions
165 // ----------------------------------------------------
166
167   bool CheckTriangulation (const TopoDS_Shape& aShape);
168
169   /*!
170    * \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK
171     * \param theShapeType - the shape type to check
172     * \retval bool  - result of the check
173    */
174   bool checkTypeShapesOn(const Standard_Integer theShapeType);
175
176   /*!
177    * \brief Creates Geom_Plane
178     * \param theAx1 - edge defining plane normal
179     * \retval Handle(Geom_Surface) - resulting surface
180    */
181   Handle(Geom_Surface) makePlane(const TopoDS_Shape& theAx1);
182
183   /*!
184    * \brief Creates Geom_CylindricalSurface
185     * \param theAx1 - edge defining cylinder axis
186     * \param theRadius - cylinder radius
187     * \retval Handle(Geom_Surface) - resulting surface
188    */
189   Handle(Geom_Surface) makeCylinder(const TopoDS_Shape& theAx1,
190                                     const Standard_Real theRadius);
191
192   /*!
193    * \brief Find IDs of subshapes complying with given status about surface
194     * \param theSurface - the surface to check state of subshapes against
195     * \param theShape - the shape to explore
196     * \param theShapeType - type of subshape of theShape
197     * \param theState - required state
198     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
199    */
200   Handle(TColStd_HSequenceOfInteger)
201     getShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
202                           const TopoDS_Shape&         theShape,
203                           TopAbs_ShapeEnum            theShapeType,
204                           GEOMAlgo_State              theState);
205
206   /*!
207    * \brief Find subshapes complying with given status about surface
208     * \param theSurface - the surface to check state of subshapes against
209     * \param theShape - the shape to explore
210     * \param theShapeType - type of subshape of theShape
211     * \param theState - required state
212     * \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
213     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
214    */
215   Handle(TColStd_HSequenceOfTransient)
216     getShapesOnSurface(const Handle(Geom_Surface)& theSurface,
217                        const Handle(GEOM_Object)&  theShape,
218                        TopAbs_ShapeEnum            theShapeType,
219                        GEOMAlgo_State              theState,
220                        TCollection_AsciiString &   theShapeEntries
221                        );
222
223   /*!
224    * \brief Find IDs of subshapes complying with given status about quadrangle
225     * \param theShape - the shape to explore
226     * \param theShapeType - type of subshape of theShape
227     * \param theTopLeftPoint - top left quadrangle corner
228     * \param theTopRigthPoint - top right quadrangle corner
229     * \param theBottomLeftPoint - bottom left quadrangle corner
230     * \param theBottomRigthPoint - bottom right quadrangle corner
231     * \param theState - required state
232     * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
233    */
234   Handle(TColStd_HSequenceOfInteger)
235     getShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
236                               const Standard_Integer     theShapeType,
237                               const Handle(GEOM_Object)& theTopLeftPoint,
238                               const Handle(GEOM_Object)& theTopRigthPoint,
239                               const Handle(GEOM_Object)& theBottomLeftPoint,
240                               const Handle(GEOM_Object)& theBottomRigthPoint,
241                               const GEOMAlgo_State       theState);
242
243   /*!
244    * \brief Find shape objects and their entries by their ids
245     * \param theShape - the main shape
246     * \param theShapeIDs - theShapeIDs - incoming shape ids
247     * \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
248     * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
249    */
250   Handle(TColStd_HSequenceOfTransient)
251     getObjectsShapesOn(const Handle(GEOM_Object)&                theShape,
252                        const Handle(TColStd_HSequenceOfInteger)& theShapeIDs,
253                        TCollection_AsciiString &                 theShapeEntries);
254
255   /*!
256    * \brief Select the object created last
257     * \param theObj1 - Object 1
258     * \param theObj2 - Object 2
259     * \retval Handle(GEOM_Object) - selected object
260    */
261   static Handle(GEOM_Object) getCreatedLast(const Handle(GEOM_Object)& theObj1,
262                                             const Handle(GEOM_Object)& theObj2);
263 };
264
265 #endif