Back to index

salome-geom  6.5.0
GEOMImpl_IBlocksOperations.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef _GEOMImpl_IBlocksOperations_HXX_
00024 #define _GEOMImpl_IBlocksOperations_HXX_
00025 
00026 #include "GEOM_IOperations.hxx"
00027 
00028 #include <TopTools_ListOfShape.hxx>
00029 #include <TColStd_HSequenceOfTransient.hxx>
00030 
00031 #include <list>
00032 
00033 class GEOM_Engine;
00034 class Handle(GEOM_Object);
00035 class Handle(TColStd_HArray1OfInteger);
00036 
00037 class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
00038  public:
00039   Standard_EXPORT GEOMImpl_IBlocksOperations(GEOM_Engine* theEngine, int theDocID);
00040   Standard_EXPORT ~GEOMImpl_IBlocksOperations();
00041 
00042   // Creation of blocks and block faces
00043   Standard_EXPORT Handle(GEOM_Object) MakeQuad (Handle(GEOM_Object) theEdge1,
00044                                                 Handle(GEOM_Object) theEdge2,
00045                                                 Handle(GEOM_Object) theEdge3,
00046                                                 Handle(GEOM_Object) theEdge4);
00047 
00048   Standard_EXPORT Handle(GEOM_Object) MakeQuad2Edges (Handle(GEOM_Object) theEdge1,
00049                                                       Handle(GEOM_Object) theEdge2);
00050 
00051   Standard_EXPORT Handle(GEOM_Object) MakeQuad4Vertices (Handle(GEOM_Object) thePoint1,
00052                                                          Handle(GEOM_Object) thePoint2,
00053                                                          Handle(GEOM_Object) thePoint3,
00054                                                          Handle(GEOM_Object) thePoint4);
00055 
00056   Standard_EXPORT Handle(GEOM_Object) MakeHexa (Handle(GEOM_Object) theFace1,
00057                                                 Handle(GEOM_Object) theFace2,
00058                                                 Handle(GEOM_Object) theFace3,
00059                                                 Handle(GEOM_Object) theFace4,
00060                                                 Handle(GEOM_Object) theFace5,
00061                                                 Handle(GEOM_Object) theFace6);
00062 
00063   Standard_EXPORT Handle(GEOM_Object) MakeHexa2Faces (Handle(GEOM_Object) theFace1,
00064                                                       Handle(GEOM_Object) theFace2);
00065 
00066   Standard_EXPORT Handle(GEOM_Object) MakeBlockCompound (Handle(GEOM_Object) theCompound);
00067 
00068   // Extract elements of blocks and blocks compounds
00069   Standard_EXPORT Handle(GEOM_Object) GetPoint (Handle(GEOM_Object) theShape,
00070                                                 const Standard_Real theX,
00071                                                 const Standard_Real theY,
00072                                                 const Standard_Real theZ,
00073                                                 const Standard_Real theEpsilon);
00074 
00075   Standard_EXPORT Handle(GEOM_Object) GetVertexNearPoint (Handle(GEOM_Object) theShape,
00076                                                           Handle(GEOM_Object) thePoint);
00077 
00078   Standard_EXPORT Handle(GEOM_Object) GetEdge (Handle(GEOM_Object) theShape,
00079                                                Handle(GEOM_Object) thePoint1,
00080                                                Handle(GEOM_Object) thePoint2);
00081 
00082   Standard_EXPORT Handle(GEOM_Object) GetEdgeNearPoint (Handle(GEOM_Object) theBlock,
00083                                                         Handle(GEOM_Object) thePoint);
00084 
00085   Standard_EXPORT Handle(GEOM_Object) GetFaceByPoints (Handle(GEOM_Object) theShape,
00086                                                        Handle(GEOM_Object) thePoint1,
00087                                                        Handle(GEOM_Object) thePoint2,
00088                                                        Handle(GEOM_Object) thePoint3,
00089                                                        Handle(GEOM_Object) thePoint4);
00090 
00091   Standard_EXPORT Handle(GEOM_Object) GetFaceByEdges (Handle(GEOM_Object) theShape,
00092                                                       Handle(GEOM_Object) theEdge1,
00093                                                       Handle(GEOM_Object) theEdge2);
00094 
00095   Standard_EXPORT Handle(GEOM_Object) GetOppositeFace (Handle(GEOM_Object) theBlock,
00096                                                        Handle(GEOM_Object) theFace);
00097 
00098   Standard_EXPORT Handle(GEOM_Object) GetFaceNearPoint (Handle(GEOM_Object) theBlock,
00099                                                         Handle(GEOM_Object) thePoint);
00100 
00101   Standard_EXPORT Handle(GEOM_Object) GetFaceByNormale (Handle(GEOM_Object) theBlock,
00102                                                         Handle(GEOM_Object) theVector);
00103 
00104   Standard_EXPORT Handle(GEOM_Object) GetShapesNearPoint (Handle(GEOM_Object)    theShape,
00105                                                           Handle(GEOM_Object)    thePoint,
00106                                                           const Standard_Integer theShapeType,
00107                                                           const Standard_Real    theTolerance);
00108 
00109   // Check blocks compounds
00110   Standard_EXPORT Standard_Boolean IsCompoundOfBlocks (Handle(GEOM_Object)    theCompound,
00111                                                        const Standard_Integer theMinNbFaces,
00112                                                        const Standard_Integer theMaxNbFaces,
00113                                                        Standard_Integer&      theNbBlocks);
00114 
00115   enum BCErrorType {
00116     NOT_BLOCK,
00117     EXTRA_EDGE,
00118     INVALID_CONNECTION,
00119     NOT_CONNECTED,
00120     NOT_GLUED
00121   };
00122 
00123   struct BCError {
00124     BCErrorType error;
00125     std::list<int>   incriminated;
00126   };
00127 
00128   Standard_EXPORT Standard_Boolean CheckCompoundOfBlocksOld (Handle(GEOM_Object) theCompound,
00129                                                              std::list<BCError>&      theErrors);
00130 
00131   Standard_EXPORT Standard_Boolean CheckCompoundOfBlocks (Handle(GEOM_Object) theCompound,
00132                                                           std::list<BCError>&      theErrors);
00133 
00134   Standard_EXPORT TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object)  theCompound,
00135                                                          const std::list<BCError>& theErrors);
00136 
00137   Standard_EXPORT Handle(GEOM_Object) RemoveExtraEdges (Handle(GEOM_Object) theShape,
00138                                                         const Standard_Integer theOptimumNbFaces = 6);
00139 
00140   Standard_EXPORT Handle(GEOM_Object) CheckAndImprove (Handle(GEOM_Object) theCompound);
00141 
00142   Standard_EXPORT static void AddBlocksFrom (const TopoDS_Shape&   theShape,
00143                                              TopTools_ListOfShape& BLO,
00144                                              TopTools_ListOfShape& NOT,
00145                                              TopTools_ListOfShape& EXT);
00146 
00147   // Extract blocks from blocks compounds
00148   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks
00149                                       (Handle(GEOM_Object)    theCompound,
00150                                        const Standard_Integer theMinNbFaces,
00151                                        const Standard_Integer theMaxNbFaces);
00152 
00153   Standard_EXPORT Handle(GEOM_Object) GetBlockNearPoint (Handle(GEOM_Object) theCompound,
00154                                                          Handle(GEOM_Object) thePoint);
00155 
00156   Standard_EXPORT Handle(GEOM_Object) GetBlockByParts
00157                      (Handle(GEOM_Object)                         theCompound,
00158                       const Handle(TColStd_HSequenceOfTransient)& theParts);
00159 
00160   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetBlocksByParts
00161                      (Handle(GEOM_Object)                         theCompound,
00162                       const Handle(TColStd_HSequenceOfTransient)& theParts);
00163 
00164   // Operations on blocks with gluing of result
00165   Standard_EXPORT Handle(GEOM_Object) MakeMultiTransformation1D (Handle(GEOM_Object)    theBlock,
00166                                                                  const Standard_Integer theDirFace1,
00167                                                                  const Standard_Integer theDirFace2,
00168                                                                  const Standard_Integer theNbTimes);
00169 
00170   Standard_EXPORT Handle(GEOM_Object) MakeMultiTransformation2D (Handle(GEOM_Object)    theBlock,
00171                                                                  const Standard_Integer theDirFace1U,
00172                                                                  const Standard_Integer theDirFace2U,
00173                                                                  const Standard_Integer theNbTimesU,
00174                                                                  const Standard_Integer theDirFace1V,
00175                                                                  const Standard_Integer theDirFace2V,
00176                                                                  const Standard_Integer theNbTimesV);
00177 
00178   // Build groups for Propagation of 1D hypotheses
00179   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Propagate (Handle(GEOM_Object) theShape);
00180 };
00181 
00182 #endif