PageRenderTime 76ms CodeModel.GetById 12ms app.highlight 59ms RepoModel.GetById 1ms app.codeStats 0ms

/src/contrib/geom-5.1.2.7/inc_pythonocc/GEOMImpl_IShapesOperations.hxx

http://pythonocc.googlecode.com/
C++ Header | 455 lines | 208 code | 65 blank | 182 comment | 0 complexity | 455f4d82dea95593a2d9e532d90646ca MD5 | raw file
  1//  Copyright (C) 2007-2008  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.
 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_IShapesOperations.hxx
 24// Created   : 
 25// Author    : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007
 26// Project   : SALOME
 27// $Header: /home/server/cvs/GEOM/GEOM_SRC/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx,v 1.13.2.3 2008/11/27 10:36:56 abd Exp $
 28//=============================================================================
 29//
 30#ifndef _GEOMImpl_IShapesOperations_HXX_
 31#define _GEOMImpl_IShapesOperations_HXX_
 32
 33#include "SGEOM_IOperations.hxx"
 34
 35#include "GEOMAlgo_State.hxx"
 36
 37#include <TopTools_ListOfShape.hxx>
 38#include <TColStd_HSequenceOfTransient.hxx>
 39#include <TColStd_HSequenceOfInteger.hxx>
 40
 41#include <list>
 42#include <Handle_Geom_Surface.hxx>
 43
 44#include <gp_Pnt.hxx>
 45
 46class GEOM_Engine;
 47class Handle(GEOM_Object);
 48class Handle(TColStd_HArray1OfInteger);
 49
 50class GEOMImpl_IShapesOperations : public GEOM_IOperations
 51{
 52 public:
 53  Standard_EXPORT GEOMImpl_IShapesOperations(GEOM_Engine* theEngine, int theDocID);
 54  Standard_EXPORT ~GEOMImpl_IShapesOperations();
 55
 56  Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1,
 57                                Handle(GEOM_Object) thePoint2);
 58
 59  Standard_EXPORT Handle(GEOM_Object) MakeWire (std::list<Handle(GEOM_Object)> theEdgesAndWires,
 60                                                const Standard_Real            theTolerance);
 61
 62  Standard_EXPORT Handle(GEOM_Object) MakeFace (Handle(GEOM_Object) theWire, const bool isPlanarWanted);
 63
 64  Standard_EXPORT Handle(GEOM_Object) MakeFaceWires (std::list<Handle(GEOM_Object)> theWires,
 65                                     const bool isPlanarWanted);
 66
 67  Standard_EXPORT Handle(GEOM_Object) MakeShell (std::list<Handle(GEOM_Object)> theShapes);
 68
 69  Standard_EXPORT Handle(GEOM_Object) MakeSolidShell (Handle(GEOM_Object) theShell);
 70
 71  Standard_EXPORT Handle(GEOM_Object) MakeSolidShells (std::list<Handle(GEOM_Object)> theShells);
 72
 73  Standard_EXPORT Handle(GEOM_Object) MakeCompound (std::list<Handle(GEOM_Object)> theShapes);
 74
 75  Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape,
 76						     const Standard_Real theTolerance,
 77                                                     const Standard_Boolean doKeepNonSolids);
 78
 79  Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape,
 80								     const Standard_Real theTolerance);
 81
 82  Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
 83							   const Standard_Real theTolerance,
 84							   std::list<Handle(GEOM_Object)> theFaces,
 85                                                           const Standard_Boolean doKeepNonSolids);
 86
 87  Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object)    theShape,
 88                                                                    const Standard_Integer theShapeType,
 89                                                                    const Standard_Boolean isSorted);
 90
 91  Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs (Handle(GEOM_Object)    theShape,
 92                                                                     const Standard_Integer theShapeType,
 93                                                                     const Standard_Boolean isSorted);
 94
 95  Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object)    theMainShape,
 96                                                   const Standard_Integer theID);
 97
 98  Standard_EXPORT Standard_Integer GetSubShapeIndex (Handle(GEOM_Object) theMainShape,
 99                                                     Handle(GEOM_Object) theSubShape);
100
101  Standard_EXPORT Standard_Integer GetTopologyIndex (Handle(GEOM_Object) theMainShape,
102                                                     Handle(GEOM_Object) theSubShape);
103
104  Standard_EXPORT TCollection_AsciiString GetShapeTypeString (Handle(GEOM_Object) theShape);
105
106  Standard_EXPORT Standard_Integer NumberOfSubShapes (Handle(GEOM_Object)    theShape,
107                                                      const Standard_Integer theShapeType);
108
109  Standard_EXPORT Handle(GEOM_Object) ReverseShape(Handle(GEOM_Object) theShapes);
110
111  Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetFreeFacesIDs (Handle(GEOM_Object) theShape);
112
113  Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetSharedShapes (Handle(GEOM_Object)    theShape1,
114                                                        Handle(GEOM_Object)    theShape2,
115                                                        const Standard_Integer theShapeType);
116
117  Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnPlane (const Handle(GEOM_Object)& theShape,
118                                                         const Standard_Integer     theShapeType,
119                                                         const Handle(GEOM_Object)& theAx1,
120                                                         const GEOMAlgo_State       theState);
121
122  Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
123    GetShapesOnPlaneWithLocation (const Handle(GEOM_Object)& theShape,
124                                  const Standard_Integer     theShapeType,
125                                  const Handle(GEOM_Object)& theAx1,
126                                  const Handle(GEOM_Object)& thePnt,
127                                  const GEOMAlgo_State       theState);
128
129
130  Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
131    GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
132                         const Standard_Integer     theShapeType,
133                         const Handle(GEOM_Object)& theAxis,
134                         const Standard_Real        theRadius,
135                         const GEOMAlgo_State       theState);
136
137  Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
138    GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
139                       const Standard_Integer     theShapeType,
140                       const Handle(GEOM_Object)& theCenter,
141                       const Standard_Real        theRadius,
142                       const GEOMAlgo_State       theState);
143
144  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
145    GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape,
146                         const Standard_Integer     theShapeType,
147                         const Handle(GEOM_Object)& theAx1,
148                         const GEOMAlgo_State       theState);
149
150  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
151    GetShapesOnPlaneWithLocationIDs (const Handle(GEOM_Object)& theShape,
152                                     const Standard_Integer     theShapeType,
153                                     const Handle(GEOM_Object)& theAx1,
154                                     const Handle(GEOM_Object)& thePnt,
155                                     const GEOMAlgo_State       theState);
156
157  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
158    GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape,
159                            const Standard_Integer     theShapeType,
160                            const Handle(GEOM_Object)& theAxis,
161                            const Standard_Real        theRadius,
162                            const GEOMAlgo_State       theState);
163
164  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
165    GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape,
166                          const Standard_Integer     theShapeType,
167                          const Handle(GEOM_Object)& theCenter,
168                          const Standard_Real        theRadius,
169                          const GEOMAlgo_State       theState);
170
171  /*!
172   * \brief Find 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
181   */
182  Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
183    GetShapesOnQuadrangle (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);
190
191  /*!
192   * \brief Find IDs of subshapes complying with given status about quadrangle
193    * \param theShape - the shape to explore
194    * \param theShapeType - type of subshape of theShape
195    * \param theTopLeftPoint - top left quadrangle corner
196    * \param theTopRigthPoint - top right quadrangle corner
197    * \param theBottomLeftPoint - bottom left quadrangle corner
198    * \param theBottomRigthPoint - bottom right quadrangle corner
199    * \param theState - required state
200    * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
201   */
202  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
203    GetShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
204                              const Standard_Integer     theShapeType,
205                              const Handle(GEOM_Object)& theTopLeftPoint,
206                              const Handle(GEOM_Object)& theTopRigthPoint,
207                              const Handle(GEOM_Object)& theBottomLeftPoint,
208                              const Handle(GEOM_Object)& theBottomRigthPoint,
209                              const GEOMAlgo_State       theState);
210
211  Standard_EXPORT Handle(GEOM_Object) GetShapesOnCylinderOld (Handle(GEOM_Object)    theShape,
212                                              const Standard_Integer theShapeType,
213                                              Handle(GEOM_Object)    theAxis,
214                                              const Standard_Real    theRadius);
215
216  Standard_EXPORT Handle(GEOM_Object) GetShapesOnSphereOld (Handle(GEOM_Object)    theShape,
217                                            const Standard_Integer theShapeType,
218                                            Handle(GEOM_Object)    theCenter,
219                                            const Standard_Real    theRadius);
220
221  void GetShapeProperties(const TopoDS_Shape aShape, Standard_Real propertiesArray[], gp_Pnt & aPnt);
222
223  Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere,
224                                                  Handle(GEOM_Object) theShapeWhat);
225
226  Standard_EXPORT Handle(GEOM_Object) GetInPlaceByHistory (Handle(GEOM_Object) theShapeWhere,
227                                                           Handle(GEOM_Object) theShapeWhat);
228
229  /*!
230   * \brief Searches a shape equal to theWhat in the context of theWhere
231   * \param theShapeWhere - a context shap
232   * \param theShapeWhat - a sample shape
233   * \retval Handle(GEOM_Object) - found shape
234   */
235  Standard_EXPORT Handle(GEOM_Object) GetSame(const Handle(GEOM_Object)& theShapeWhere,
236                                              const Handle(GEOM_Object)& theShapeWhat);
237
238  /*!
239   * \brief Find IDs of subshapes complying with given status about surface
240    * \param theBox - the box to check state of subshapes against
241    * \param theShape - the shape to explore
242    * \param theShapeType - type of subshape of theShape
243    * \param theState - required state
244    * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
245   */
246  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
247                              GetShapesOnBoxIDs(const Handle(GEOM_Object)& theBox,
248                                                const Handle(GEOM_Object)& theShape,
249                                                const Standard_Integer theShapeType,
250                                                GEOMAlgo_State theState);
251
252  /*!
253   * \brief Find subshapes complying with given status about surface
254   * \param theBox - the box to check state of subshapes against
255   * \param theShape - the shape to explore
256   * \param theShapeType - type of subshape of theShape
257   * \param theState - required state
258   * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
259   */
260  Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
261                                GetShapesOnBox(const Handle(GEOM_Object)& theBox,
262                                               const Handle(GEOM_Object)& theShape,
263                                               const Standard_Integer theShapeType,
264                                               GEOMAlgo_State theState);
265
266  /*!
267   * \brief Find IDs of subshapes complying with given status about surface
268   * \param theCheckShape - the shape to check state of subshapes against
269   * \param theShape - the shape to explore
270   * \param theShapeType - type of subshape of theShape
271   * \param theState - required state
272   * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
273   */
274  Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
275                   GetShapesOnShapeIDs(const Handle(GEOM_Object)& theCheckShape,
276                                       const Handle(GEOM_Object)& theShape,
277                                       const Standard_Integer theShapeType,
278                                       GEOMAlgo_State theState);
279
280  /*!
281   * \brief Find subshapes complying with given status about surface
282   * \param theCheckShape - the shape to check state of subshapes against
283   * \param theShape - the shape to explore
284   * \param theShapeType - type of subshape of theShape
285   * \param theState - required state
286   * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
287   */
288  Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
289                      GetShapesOnShape(const Handle(GEOM_Object)& theCheckShape,
290                                       const Handle(GEOM_Object)& theShape,
291                                       const Standard_Integer theShapeType,
292                                       GEOMAlgo_State theState);
293  Standard_EXPORT Handle(GEOM_Object)
294            GetShapesOnShapeAsCompound(const Handle(GEOM_Object)& theCheckShape,
295                                       const Handle(GEOM_Object)& theShape,
296                                       const Standard_Integer theShapeType,
297                                       GEOMAlgo_State theState);
298
299 public:
300  /*!
301   * \brief Sort shapes in the list by their coordinates.
302   * \param SL The list of shapes to sort.
303   */
304  Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL);
305
306  /*!
307   * \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND.
308   *
309   * If the argument shape is not of type TopoDS_COMPSOLID, this method returns it as is.
310   *
311   * \param theCompsolid The compsolid to be converted.
312   * \retval TopoDS_Shape Returns the resulting compound.
313   */
314  Standard_EXPORT static TopoDS_Shape CompsolidToCompound (const TopoDS_Shape& theCompsolid);
315
316  /*!
317   * \brief Build a triangulation on \a theShape if it is absent.
318   * \param theShape The shape to check/build triangulation on.
319   * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
320   */
321  Standard_EXPORT static bool CheckTriangulation (const TopoDS_Shape& theShape);
322
323 private:
324  Handle(GEOM_Object) MakeShape (std::list<Handle(GEOM_Object)>      theShapes,
325                                 const Standard_Integer         theObjectType,
326                                 const Standard_Integer         theFunctionType,
327                                 const TCollection_AsciiString& theMethodName);
328
329// ----------------------------------------------------
330// methods common for all GetShapesOnXXX() functions
331// ----------------------------------------------------
332
333  /*!
334   * \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK
335   * \param theShapeType - the shape type to check
336   * \retval bool  - result of the check
337   */
338  bool checkTypeShapesOn(const Standard_Integer theShapeType);
339
340  /*!
341   * \brief Creates Geom_Plane
342    * \param theAx1 - edge defining plane normal
343    * \retval Handle(Geom_Surface) - resulting surface
344   */
345  Handle(Geom_Surface) makePlane(const TopoDS_Shape& theAx1);
346
347  /*!
348   * \brief Creates Geom_CylindricalSurface
349   * \param theAx1 - edge defining cylinder axis
350   * \param theRadius - cylinder radius
351   * \retval Handle(Geom_Surface) - resulting surface
352   */
353  Handle(Geom_Surface) makeCylinder(const TopoDS_Shape& theAx1,
354                                    const Standard_Real theRadius);
355
356  /*!
357   * \brief Find IDs of subshapes complying with given status about surface
358   * \param theSurface - the surface to check state of subshapes against
359   * \param theShape - the shape to explore
360   * \param theShapeType - type of subshape of theShape
361   * \param theState - required state
362   * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
363   */
364  Handle(TColStd_HSequenceOfInteger)
365    getShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
366                          const TopoDS_Shape&         theShape,
367                          TopAbs_ShapeEnum            theShapeType,
368                          GEOMAlgo_State              theState);
369
370  /*!
371   * \brief Find subshapes complying with given status about surface
372   * \param theSurface - the surface to check state of subshapes against
373   * \param theShape - the shape to explore
374   * \param theShapeType - type of subshape of theShape
375   * \param theState - required state
376   * \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
377   * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
378   */
379  Handle(TColStd_HSequenceOfTransient)
380    getShapesOnSurface(const Handle(Geom_Surface)& theSurface,
381                       const Handle(GEOM_Object)&  theShape,
382                       TopAbs_ShapeEnum            theShapeType,
383                       GEOMAlgo_State              theState,
384                       TCollection_AsciiString &   theShapeEntries);
385
386  /*!
387   * \brief Find IDs of subshapes complying with given status about quadrangle
388   * \param theShape - the shape to explore
389   * \param theShapeType - type of subshape of theShape
390   * \param theTopLeftPoint - top left quadrangle corner
391   * \param theTopRigthPoint - top right quadrangle corner
392   * \param theBottomLeftPoint - bottom left quadrangle corner
393   * \param theBottomRigthPoint - bottom right quadrangle corner
394   * \param theState - required state
395   * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
396   */
397  Handle(TColStd_HSequenceOfInteger)
398    getShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
399                              const Standard_Integer     theShapeType,
400                              const Handle(GEOM_Object)& theTopLeftPoint,
401                              const Handle(GEOM_Object)& theTopRigthPoint,
402                              const Handle(GEOM_Object)& theBottomLeftPoint,
403                              const Handle(GEOM_Object)& theBottomRigthPoint,
404                              const GEOMAlgo_State       theState);
405
406  /*!
407   * \brief Find IDs of subshapes complying with given status about surface
408    * \param theBox - the box to check state of subshapes against
409    * \param theShape - the shape to explore
410    * \param theShapeType - type of subshape of theShape
411    * \param theState - required state
412    * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
413   */
414  Handle(TColStd_HSequenceOfInteger) getShapesOnBoxIDs(const Handle(GEOM_Object)& theBox,
415                                                       const Handle(GEOM_Object)& theShape,
416                                                       const Standard_Integer theShapeType,
417                                                       GEOMAlgo_State theState);
418
419  /*!
420   * \brief Find IDs of subshapes complying with given status about surface
421   * \param theCheckShape - the shape to check state of subshapes against
422   * \param theShape - the shape to explore
423   * \param theShapeType - type of subshape of theShape
424   * \param theState - required state
425   * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
426   */
427  Handle(TColStd_HSequenceOfInteger) getShapesOnShapeIDs
428                                      (const Handle(GEOM_Object)& theCheckShape,
429                                       const Handle(GEOM_Object)& theShape,
430                                       const Standard_Integer theShapeType,
431                                       GEOMAlgo_State theState);
432
433  /*!
434   * \brief Find shape objects and their entries by their ids
435   * \param theShape - the main shape
436   * \param theShapeIDs - theShapeIDs - incoming shape ids
437   * \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
438   * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
439   */
440  Handle(TColStd_HSequenceOfTransient)
441    getObjectsShapesOn(const Handle(GEOM_Object)&                theShape,
442                       const Handle(TColStd_HSequenceOfInteger)& theShapeIDs,
443                       TCollection_AsciiString &                 theShapeEntries);
444
445  /*!
446   * \brief Select the object created last
447   * \param theObj1 - Object 1
448   * \param theObj2 - Object 2
449   * \retval Handle(GEOM_Object) - selected object
450   */
451  static Handle(GEOM_Object) getCreatedLast(const Handle(GEOM_Object)& theObj1,
452                                            const Handle(GEOM_Object)& theObj2);
453};
454
455#endif