1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #ifndef _GEOMImpl_IShapesOperations_HXX_
22 #define _GEOMImpl_IShapesOperations_HXX_
24 #include "GEOM_IOperations.hxx"
26 #include "GEOMAlgo_State.hxx"
28 #include <TopTools_ListOfShape.hxx>
29 #include <TColStd_HSequenceOfTransient.hxx>
30 #include <TColStd_HSequenceOfInteger.hxx>
33 #include <Handle_Geom_Surface.hxx>
36 class Handle(GEOM_Object);
37 class Handle(TColStd_HArray1OfInteger);
39 class GEOMImpl_IShapesOperations : public GEOM_IOperations {
41 Standard_EXPORT GEOMImpl_IShapesOperations(GEOM_Engine* theEngine, int theDocID);
42 Standard_EXPORT ~GEOMImpl_IShapesOperations();
44 Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1,
45 Handle(GEOM_Object) thePoint2);
47 Standard_EXPORT Handle(GEOM_Object) MakeWire (list<Handle(GEOM_Object)> theEdgesAndWires);
49 Standard_EXPORT Handle(GEOM_Object) MakeFace (Handle(GEOM_Object) theWire, const bool isPlanarWanted);
51 Standard_EXPORT Handle(GEOM_Object) MakeFaceWires (list<Handle(GEOM_Object)> theWires,
52 const bool isPlanarWanted);
54 Standard_EXPORT Handle(GEOM_Object) MakeShell (list<Handle(GEOM_Object)> theShapes);
56 Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell);
58 Standard_EXPORT Handle(GEOM_Object) MakeSolidShells (list<Handle(GEOM_Object)> theShells);
60 Standard_EXPORT Handle(GEOM_Object) MakeCompound (list<Handle(GEOM_Object)> theShapes);
62 Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape,
63 const Standard_Real theTolerance);
65 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape,
66 const Standard_Real theTolerance);
68 Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
69 const Standard_Real theTolerance,
70 list<Handle(GEOM_Object)> theFaces);
72 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape,
73 const Standard_Integer theShapeType,
74 const Standard_Boolean isSorted);
76 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object) theShape,
77 const Standard_Integer theShapeType,
78 const Standard_Boolean isSorted);
80 Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object) theMainShape,
81 const Standard_Integer theID);
83 Standard_EXPORT Standard_Integer GetSubShapeIndex (Handle(GEOM_Object) theMainShape,
84 Handle(GEOM_Object) theSubShape);
86 Standard_EXPORT Standard_Integer GetTopologyIndex (Handle(GEOM_Object) theMainShape,
87 Handle(GEOM_Object) theSubShape);
89 Standard_EXPORT TCollection_AsciiString GetShapeTypeString (Handle(GEOM_Object) theShape);
91 Standard_EXPORT Standard_Integer NumberOfFaces (Handle(GEOM_Object) theShape);
92 Standard_EXPORT Standard_Integer NumberOfEdges (Handle(GEOM_Object) theShape);
94 Standard_EXPORT Handle(GEOM_Object) ReverseShape(Handle(GEOM_Object) theShapes);
96 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetFreeFacesIDs (Handle(GEOM_Object) theShape);
98 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetSharedShapes (Handle(GEOM_Object) theShape1,
99 Handle(GEOM_Object) theShape2,
100 const Standard_Integer theShapeType);
102 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnPlane (const Handle(GEOM_Object)& theShape,
103 const Standard_Integer theShapeType,
104 const Handle(GEOM_Object)& theAx1,
105 const GEOMAlgo_State theState);
107 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
108 GetShapesOnPlaneWithLocation (const Handle(GEOM_Object)& theShape,
109 const Standard_Integer theShapeType,
110 const Handle(GEOM_Object)& theAx1,
111 const Handle(GEOM_Object)& thePnt,
112 const GEOMAlgo_State theState);
115 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
116 const Standard_Integer theShapeType,
117 const Handle(GEOM_Object)& theAxis,
118 const Standard_Real theRadius,
119 const GEOMAlgo_State theState);
121 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
122 const Standard_Integer theShapeType,
123 const Handle(GEOM_Object)& theCenter,
124 const Standard_Real theRadius,
125 const GEOMAlgo_State theState);
127 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape,
128 const Standard_Integer theShapeType,
129 const Handle(GEOM_Object)& theAx1,
130 const GEOMAlgo_State theState);
132 Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
133 GetShapesOnPlaneWithLocationIDs (const Handle(GEOM_Object)& theShape,
134 const Standard_Integer theShapeType,
135 const Handle(GEOM_Object)& theAx1,
136 const Handle(GEOM_Object)& thePnt,
137 const GEOMAlgo_State theState);
139 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape,
140 const Standard_Integer theShapeType,
141 const Handle(GEOM_Object)& theAxis,
142 const Standard_Real theRadius,
143 const GEOMAlgo_State theState);
145 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape,
146 const Standard_Integer theShapeType,
147 const Handle(GEOM_Object)& theCenter,
148 const Standard_Real theRadius,
149 const GEOMAlgo_State theState);
152 * \brief Find subshapes complying with given status about quadrangle
153 * \param theShape - the shape to explore
154 * \param theShapeType - type of subshape of theShape
155 * \param theTopLeftPoint - top left quadrangle corner
156 * \param theTopRigthPoint - top right quadrangle corner
157 * \param theBottomLeftPoint - bottom left quadrangle corner
158 * \param theBottomRigthPoint - bottom right quadrangle corner
159 * \param theState - required state
160 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
162 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
163 GetShapesOnQuadrangle (const Handle(GEOM_Object)& theShape,
164 const Standard_Integer theShapeType,
165 const Handle(GEOM_Object)& theTopLeftPoint,
166 const Handle(GEOM_Object)& theTopRigthPoint,
167 const Handle(GEOM_Object)& theBottomLeftPoint,
168 const Handle(GEOM_Object)& theBottomRigthPoint,
169 const GEOMAlgo_State theState);
172 * \brief Find IDs of subshapes complying with given status about quadrangle
173 * \param theShape - the shape to explore
174 * \param theShapeType - type of subshape of theShape
175 * \param theTopLeftPoint - top left quadrangle corner
176 * \param theTopRigthPoint - top right quadrangle corner
177 * \param theBottomLeftPoint - bottom left quadrangle corner
178 * \param theBottomRigthPoint - bottom right quadrangle corner
179 * \param theState - required state
180 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
182 Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
183 GetShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
184 const Standard_Integer theShapeType,
185 const Handle(GEOM_Object)& theTopLeftPoint,
186 const Handle(GEOM_Object)& theTopRigthPoint,
187 const Handle(GEOM_Object)& theBottomLeftPoint,
188 const Handle(GEOM_Object)& theBottomRigthPoint,
189 const GEOMAlgo_State theState);
191 Standard_EXPORT Handle(GEOM_Object) GetShapesOnCylinderOld (Handle(GEOM_Object) theShape,
192 const Standard_Integer theShapeType,
193 Handle(GEOM_Object) theAxis,
194 const Standard_Real theRadius);
196 Standard_EXPORT Handle(GEOM_Object) GetShapesOnSphereOld (Handle(GEOM_Object) theShape,
197 const Standard_Integer theShapeType,
198 Handle(GEOM_Object) theCenter,
199 const Standard_Real theRadius);
201 Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere,
202 Handle(GEOM_Object) theShapeWhat);
204 Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL);
207 * \brief Searches a shape equal to theWhat in the context of theWhere
208 * \param theShapeWhere - a context shap
209 * \param theShapeWhat - a sample shape
210 * \retval Handle(GEOM_Object) - found shape
212 Standard_EXPORT Handle(GEOM_Object) GetSame(const Handle(GEOM_Object)& theShapeWhere,
213 const Handle(GEOM_Object)& theShapeWhat);
216 * \brief Find IDs of subshapes complying with given status about surface
217 * \param theBox - the box to check state of subshapes against
218 * \param theShape - the shape to explore
219 * \param theShapeType - type of subshape of theShape
220 * \param theState - required state
221 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
223 Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
224 GetShapesOnBoxIDs(const Handle(GEOM_Object)& theBox,
225 const Handle(GEOM_Object)& theShape,
226 const Standard_Integer theShapeType,
227 GEOMAlgo_State theState);
230 * \brief Find subshapes complying with given status about surface
231 * \param theBox - the box to check state of subshapes against
232 * \param theShape - the shape to explore
233 * \param theShapeType - type of subshape of theShape
234 * \param theState - required state
235 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
237 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
238 GetShapesOnBox(const Handle(GEOM_Object)& theBox,
239 const Handle(GEOM_Object)& theShape,
240 const Standard_Integer theShapeType,
241 GEOMAlgo_State theState);
244 Handle(GEOM_Object) MakeShape (list<Handle(GEOM_Object)> theShapes,
245 const Standard_Integer theObjectType,
246 const Standard_Integer theFunctionType,
247 const TCollection_AsciiString& theMethodName);
249 // ----------------------------------------------------
250 // methods common for all GetShapesOnXXX() functions
251 // ----------------------------------------------------
253 bool CheckTriangulation (const TopoDS_Shape& aShape);
256 * \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK
257 * \param theShapeType - the shape type to check
258 * \retval bool - result of the check
260 bool checkTypeShapesOn(const Standard_Integer theShapeType);
263 * \brief Creates Geom_Plane
264 * \param theAx1 - edge defining plane normal
265 * \retval Handle(Geom_Surface) - resulting surface
267 Handle(Geom_Surface) makePlane(const TopoDS_Shape& theAx1);
270 * \brief Creates Geom_CylindricalSurface
271 * \param theAx1 - edge defining cylinder axis
272 * \param theRadius - cylinder radius
273 * \retval Handle(Geom_Surface) - resulting surface
275 Handle(Geom_Surface) makeCylinder(const TopoDS_Shape& theAx1,
276 const Standard_Real theRadius);
279 * \brief Find IDs of subshapes complying with given status about surface
280 * \param theSurface - the surface to check state of subshapes against
281 * \param theShape - the shape to explore
282 * \param theShapeType - type of subshape of theShape
283 * \param theState - required state
284 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
286 Handle(TColStd_HSequenceOfInteger)
287 getShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
288 const TopoDS_Shape& theShape,
289 TopAbs_ShapeEnum theShapeType,
290 GEOMAlgo_State theState);
293 * \brief Find subshapes complying with given status about surface
294 * \param theSurface - the surface to check state of subshapes against
295 * \param theShape - the shape to explore
296 * \param theShapeType - type of subshape of theShape
297 * \param theState - required state
298 * \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
299 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
301 Handle(TColStd_HSequenceOfTransient)
302 getShapesOnSurface(const Handle(Geom_Surface)& theSurface,
303 const Handle(GEOM_Object)& theShape,
304 TopAbs_ShapeEnum theShapeType,
305 GEOMAlgo_State theState,
306 TCollection_AsciiString & theShapeEntries);
309 * \brief Find IDs of subshapes complying with given status about quadrangle
310 * \param theShape - the shape to explore
311 * \param theShapeType - type of subshape of theShape
312 * \param theTopLeftPoint - top left quadrangle corner
313 * \param theTopRigthPoint - top right quadrangle corner
314 * \param theBottomLeftPoint - bottom left quadrangle corner
315 * \param theBottomRigthPoint - bottom right quadrangle corner
316 * \param theState - required state
317 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
319 Handle(TColStd_HSequenceOfInteger)
320 getShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
321 const Standard_Integer theShapeType,
322 const Handle(GEOM_Object)& theTopLeftPoint,
323 const Handle(GEOM_Object)& theTopRigthPoint,
324 const Handle(GEOM_Object)& theBottomLeftPoint,
325 const Handle(GEOM_Object)& theBottomRigthPoint,
326 const GEOMAlgo_State theState);
329 * \brief Find IDs of subshapes complying with given status about surface
330 * \param theBox - the box to check state of subshapes against
331 * \param theShape - the shape to explore
332 * \param theShapeType - type of subshape of theShape
333 * \param theState - required state
334 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
336 Handle(TColStd_HSequenceOfInteger) getShapesOnBoxIDs(const Handle(GEOM_Object)& theBox,
337 const Handle(GEOM_Object)& theShape,
338 const Standard_Integer theShapeType,
339 GEOMAlgo_State theState);
342 * \brief Find shape objects and their entries by their ids
343 * \param theShape - the main shape
344 * \param theShapeIDs - theShapeIDs - incoming shape ids
345 * \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
346 * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
348 Handle(TColStd_HSequenceOfTransient)
349 getObjectsShapesOn(const Handle(GEOM_Object)& theShape,
350 const Handle(TColStd_HSequenceOfInteger)& theShapeIDs,
351 TCollection_AsciiString & theShapeEntries);
354 * \brief Select the object created last
355 * \param theObj1 - Object 1
356 * \param theObj2 - Object 2
357 * \retval Handle(GEOM_Object) - selected object
359 static Handle(GEOM_Object) getCreatedLast(const Handle(GEOM_Object)& theObj1,
360 const Handle(GEOM_Object)& theObj2);