Version: 6.3.1

src/GEOMImpl/GEOMImpl_Block6Explorer.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 //  File   : GEOMImpl_Block6Explorer.hxx
00024 //  Module : GEOMImpl
00025 //
00026 #ifndef GEOMImpl_Block6Explorer_HeaderFile
00027 #define GEOMImpl_Block6Explorer_HeaderFile
00028 
00029 #include <TopoDS_Shape.hxx>
00030 #include <TopoDS_Wire.hxx>
00031 #include <TopTools_Array1OfShape.hxx>
00032 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
00033 #include <gp_Trsf.hxx>
00034 
00035   //  Class GEOMImpl_Block6Explorer gives easy and fast access to a certain sub-elements of hexahedral solid
00036   //  Each face   can be accessed by its global ID [1-6]
00037   //  Each edge   can be accessed by its global ID [1-12] or by its local NB [1-4] inside certain face
00038   //  Each vertex can be accessed by its global ID [1-8] or  by its local NB [1-4] inside certain face
00039   //  Numeration of the sub-shapes is defined in constructors, see they comments
00040   //
00041   //                  face 2       face 4          |           4 face     2 face                   |
00042   //                       |           /           |            \         |                        |
00043   //                      \|/        |/_           |            _\|      \|/                       |
00044   //                       '         '             |              '       '                        |
00045   //                    8_______7__7               |               7__7_______8                    |
00046   //                   /|         /|               |               |\         |\                   |
00047   //                  8 12       6 11              |              11 6       12 8                  |
00048   //                 /  |       /  |               |               |  \       |  \                 |
00049   //               5/______5__6/   |               |               |   \6__5______\5               |
00050   //  face 5 --->  |    |     |    |  <--- 6 face  |  face 6 --->  |    |     |    |  <--- 5 face  |
00051   //               |    |__3__|____|               |               |____|__3__|    |               |
00052   //               |   /4     |   /3               |               3\   |     4\   |               |
00053   //               |  /       |  /                 |                 \  |       \  |               |
00054   //               9 4       10 2                  |                  2 10       4 9               |
00055   //               |/__1______|/                   |                   \|______1__\|               |
00056   //               1          2                    |                    2          1               |
00057   //            _.        .                        |                        .       ._             |
00058   //            /|       /|\                       |                       /|\      |\             |
00059   //           /          |                        |                        |         \            |
00060   //          3 face      1 face                   |                   face 1     face 3           |
00061   //                                               |                                               |
00062   //  Picture 1 (right orientation)                |  Picture 2 (left orientation)                 |
00063   //                                                                                               |
00064   //  For the moment, the orientation of numbering is not controlled
00065 
00066   // Faces: 1 - bottom, 2 - top, 3 - front, 4 - back, 5 - left (right), 6 - right (left)
00067 
00068   //
00069   //                             4_______3__3         2 ______2__3
00070   //                            /          /          |          |
00071   //                           4          2           1          3
00072   //                          /          /            |          |
00073   //                        1/______1__2/             |          |
00074   //                                                  |          |
00075   //                                                  | __4______|
00076   //                           face 2       face 4    1          4
00077   //                                |           /
00078   //                               \|/        |/_
00079   //                                '         '
00080   //        3                    8_______7__7                    3
00081   //       /|                   /|         /|                   /|
00082   //      3 2                  8 12       6 11                 3 2
00083   //     /  |                 /  |       /  |                 /  |
00084   //   4/   |               5/______5__6/   |               4/   |
00085   //   |    |  face 5 --->  |    |     |    |  <--- 6 face  |    |
00086   //   |    |               |    |__3__|____|               |    |
00087   //   |   /2               |   /4     |   /3               |   /2
00088   //   |  /                 |  /       |  /                 |  /
00089   //   4 1                  9 4       10 2                  4 1
00090   //   |/                   |/__1______|/                   |/
00091   //   1                    1          2                    1
00092   //                     _.        .
00093   //                     /|       /|\
00094   //                    /          |
00095   //   2 ______2__3    3 face      1 face
00096   //   |          |
00097   //   |          |               __3_______
00098   //   |          |             /4         /3
00099   //   |          |            /          /
00100   //   1          3           4          2
00101   //   | __4______|          /__1______ /
00102   //   1          4         1          2
00103   //
00104   //  Picture 3 (On periferal pictures the local
00105   //  numeration of edges and vertices is shown)
00106 
00107 class GEOMImpl_Block6Explorer
00108 {
00109  public:
00110   // ---------- PUBLIC METHODS ----------
00111 
00112   GEOMImpl_Block6Explorer ();
00113   // Constructor.
00114 
00115   // Initialization by existing solid,
00116   // sub-elements regulate numeration
00117 
00118   void InitByBlock (const TopoDS_Shape& theBlock);
00119   // Init by hexahedral solid. First face, edge and vertex is defined randomly
00120 
00121   void InitByBlockAndFace (const TopoDS_Shape& theBlock,
00122                            const TopoDS_Shape& theFace);
00123   // Constructor from hexahedral solid, making theFace the first face.
00124   // First edge and vertex is defined randomly from theFace entities
00125 
00126   void InitByBlockAndEdges (const TopoDS_Shape& theBlock,
00127                             const TopoDS_Shape& theEdge1,
00128                             const TopoDS_Shape& theEdge2);
00129   // Init by hexahedral solid, making theEdge1 the first, theEdge2 the fird.
00130   // First vertex is defined randomly from theEdge1 vertices
00131   // (Picture 1 and Picture 2 shows two possible cases)
00132 
00133   void InitByBlockAndVertices (const TopoDS_Shape& theBlock,
00134                                const TopoDS_Shape& theVertex1,
00135                                const TopoDS_Shape& theVertex2,
00136                                const TopoDS_Shape& theVertex3);
00137   // Init by hexahedral solid, making theVertex1 the first,
00138   // theVertex2 the second and theVertex3 the fird vertices.
00139 
00140   // Initialization by parts of solid to be built
00141 
00142   void InitByTwoFaces (const TopoDS_Shape& theFace1,
00143                        const TopoDS_Shape& theFace2);
00144   // Init by two faces. TheFace1 will be the first,
00145   // theFace2 will be the second.
00146   // First edge and vertex is defined randomly from theFace1 entities.
00147 
00148   // Access to vertices
00149   TopoDS_Shape GetVertex (const Standard_Integer theVertexID); // [1-8]
00150 
00151   Standard_Integer GetVertexID (const TopoDS_Shape& theVertex);
00152 
00153   Standard_Integer GetVertexID (const Standard_Integer theFaceID, // [1-6]
00154                                 const Standard_Integer theVertexNB); // [1-4]
00155 
00156   Standard_Integer GetVertexOnEdgeID (const Standard_Integer theEdgeID, // [1-12]
00157                                       const Standard_Integer theVertexNB); // [1-2]
00158 
00159   // Access to edges
00160   TopoDS_Shape GetEdge (const Standard_Integer theEdgeID, // [1-12]
00161                         const Standard_Boolean doMake = Standard_False);
00162 
00163   Standard_Integer GetEdgeID (const TopoDS_Shape& theEdge);
00164 
00165   Standard_Integer GetEdgeID (const Standard_Integer theFaceID, // [1-6]
00166                               const Standard_Integer theEdgeNB); // [1-4]
00167 
00168   Standard_Integer FindEdgeID (const Standard_Integer theVertex1ID,
00169                                const Standard_Integer theVertex2ID);
00170 
00171   Standard_Integer FindCommonEdgeID (const Standard_Integer theFace1ID,
00172                                      const Standard_Integer theFace2ID);
00173 
00174   // Access to faces
00175   TopoDS_Shape GetFace (const Standard_Integer theFaceID, // [1-6]
00176                         const Standard_Boolean doMake = Standard_False);
00177 
00178   Standard_Integer GetFaceID (const TopoDS_Shape& theFace);
00179 
00180   Standard_Integer FindFaceID (const Standard_Integer theEdge1ID,
00181                                const Standard_Integer theEdge2ID);
00182 
00183   Standard_Integer GetOppositeFaceID (const Standard_Integer theFaceID);
00184 
00185   // Check Block
00186   Standard_Boolean IsSimilarFaces (const Standard_Integer theFace1ID,
00187                                    const Standard_Integer theFace2ID,
00188                                    const gp_Trsf          theTransformation);
00189   // returns true, if theFace1, transformed
00190   // by theTransformation, coincides with theFace2
00191  public:
00192   // ---------- STATIC PUBLIC METHODS ----------
00193   static void MapShapesAndAncestors (const TopoDS_Shape& S,
00194                                      const TopAbs_ShapeEnum TS,
00195                                      const TopAbs_ShapeEnum TA,
00196                                      TopTools_IndexedDataMapOfShapeListOfShape& M);
00197 
00198   static Standard_Boolean IsSimilarEdges (const TopoDS_Shape& E1, 
00199                                           const TopoDS_Shape& E2);
00200 
00201   static Standard_Integer FindEdge (TopoDS_Shape&       theResult,
00202                                     const TopoDS_Shape& V1,
00203                                     const TopoDS_Shape& V2,
00204                                     const TopTools_IndexedDataMapOfShapeListOfShape& MVE,
00205                                     const Standard_Boolean findAll = Standard_False);
00206   // returns number of found edges
00207 
00208   static Standard_Integer FindFace (TopoDS_Shape&       theResult,
00209                                     const TopoDS_Shape& V1,
00210                                     const TopoDS_Shape& V2,
00211                                     const TopoDS_Shape& V3,
00212                                     const TopoDS_Shape& V4,
00213                                     const TopTools_IndexedDataMapOfShapeListOfShape& MVF,
00214                                     const Standard_Boolean findAll = Standard_False);
00215   // returns number of found faces
00216 
00217   static void MakeFace (const TopoDS_Wire&     theWire,
00218                         const Standard_Boolean isPlanarWanted,
00219                         TopoDS_Shape&          theResult);
00220 
00221  private:
00222   // ---------- PRIVATE FIELDS ----------
00223 
00224   TopTools_Array1OfShape myFaces;
00225   TopTools_Array1OfShape myEdges;
00226   TopTools_Array1OfShape myVertices;
00227 };
00228 
00229 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS