]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMImpl/GEOMImpl_IBlocksOperations.hxx
Salome HOME
XAO test fixed to work in salome test
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IBlocksOperations.hxx
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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 #ifndef _GEOMImpl_IBlocksOperations_HXX_
24 #define _GEOMImpl_IBlocksOperations_HXX_
25
26 #include "GEOM_IOperations.hxx"
27
28 #include <TopTools_ListOfShape.hxx>
29 #include <TColStd_HSequenceOfTransient.hxx>
30 #include <TColStd_HArray1OfInteger.hxx>
31
32 #include <list>
33
34 class GEOM_Engine;
35 class GEOM_Object;
36
37 class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
38  public:
39   Standard_EXPORT GEOMImpl_IBlocksOperations(GEOM_Engine* theEngine, int theDocID);
40   Standard_EXPORT ~GEOMImpl_IBlocksOperations();
41
42   // Creation of blocks and block faces
43   Standard_EXPORT Handle(GEOM_Object) MakeQuad (Handle(GEOM_Object) theEdge1,
44                                                 Handle(GEOM_Object) theEdge2,
45                                                 Handle(GEOM_Object) theEdge3,
46                                                 Handle(GEOM_Object) theEdge4);
47
48   Standard_EXPORT Handle(GEOM_Object) MakeQuad2Edges (Handle(GEOM_Object) theEdge1,
49                                                       Handle(GEOM_Object) theEdge2);
50
51   Standard_EXPORT Handle(GEOM_Object) MakeQuad4Vertices (Handle(GEOM_Object) thePoint1,
52                                                          Handle(GEOM_Object) thePoint2,
53                                                          Handle(GEOM_Object) thePoint3,
54                                                          Handle(GEOM_Object) thePoint4);
55
56   Standard_EXPORT Handle(GEOM_Object) MakeHexa (Handle(GEOM_Object) theFace1,
57                                                 Handle(GEOM_Object) theFace2,
58                                                 Handle(GEOM_Object) theFace3,
59                                                 Handle(GEOM_Object) theFace4,
60                                                 Handle(GEOM_Object) theFace5,
61                                                 Handle(GEOM_Object) theFace6);
62
63   Standard_EXPORT Handle(GEOM_Object) MakeHexa2Faces (Handle(GEOM_Object) theFace1,
64                                                       Handle(GEOM_Object) theFace2);
65
66   Standard_EXPORT Handle(GEOM_Object) MakeBlockCompound (Handle(GEOM_Object) theCompound);
67
68   // Extract elements of blocks and blocks compounds
69   Standard_EXPORT Handle(GEOM_Object) GetPoint (Handle(GEOM_Object) theShape,
70                                                 const Standard_Real theX,
71                                                 const Standard_Real theY,
72                                                 const Standard_Real theZ,
73                                                 const Standard_Real theEpsilon);
74
75   Standard_EXPORT Handle(GEOM_Object) GetVertexNearPoint (Handle(GEOM_Object) theShape,
76                                                           Handle(GEOM_Object) thePoint);
77
78   Standard_EXPORT Handle(GEOM_Object) GetEdge (Handle(GEOM_Object) theShape,
79                                                Handle(GEOM_Object) thePoint1,
80                                                Handle(GEOM_Object) thePoint2);
81
82   Standard_EXPORT Handle(GEOM_Object) GetEdgeNearPoint (Handle(GEOM_Object) theBlock,
83                                                         Handle(GEOM_Object) thePoint);
84
85   Standard_EXPORT Handle(GEOM_Object) GetFaceByPoints (Handle(GEOM_Object) theShape,
86                                                        Handle(GEOM_Object) thePoint1,
87                                                        Handle(GEOM_Object) thePoint2,
88                                                        Handle(GEOM_Object) thePoint3,
89                                                        Handle(GEOM_Object) thePoint4);
90
91   Standard_EXPORT Handle(GEOM_Object) GetFaceByEdges (Handle(GEOM_Object) theShape,
92                                                       Handle(GEOM_Object) theEdge1,
93                                                       Handle(GEOM_Object) theEdge2);
94
95   Standard_EXPORT Handle(GEOM_Object) GetOppositeFace (Handle(GEOM_Object) theBlock,
96                                                        Handle(GEOM_Object) theFace);
97
98   Standard_EXPORT Handle(GEOM_Object) GetFaceNearPoint (Handle(GEOM_Object) theBlock,
99                                                         Handle(GEOM_Object) thePoint);
100
101   Standard_EXPORT Handle(GEOM_Object) GetFaceByNormale (Handle(GEOM_Object) theBlock,
102                                                         Handle(GEOM_Object) theVector);
103
104   Standard_EXPORT Handle(GEOM_Object) GetShapesNearPoint (Handle(GEOM_Object)    theShape,
105                                                           Handle(GEOM_Object)    thePoint,
106                                                           const Standard_Integer theShapeType,
107                                                           const Standard_Real    theTolerance);
108
109   // Check blocks compounds
110   Standard_EXPORT Standard_Boolean IsCompoundOfBlocks (Handle(GEOM_Object)    theCompound,
111                                                        const Standard_Integer theMinNbFaces,
112                                                        const Standard_Integer theMaxNbFaces,
113                                                        Standard_Integer&      theNbBlocks);
114
115   enum BCErrorType {
116     NOT_BLOCK,
117     EXTRA_EDGE,
118     INVALID_CONNECTION,
119     NOT_CONNECTED,
120     NOT_GLUED
121   };
122
123   struct BCError {
124     BCErrorType error;
125     std::list<int>   incriminated;
126   };
127
128   Standard_EXPORT Standard_Boolean CheckCompoundOfBlocks (Handle(GEOM_Object) theCompound,
129                                                           const Standard_Real theToleranceC1,
130                                                           std::list<BCError>& theErrors);
131
132   Standard_EXPORT TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object)       theCompound,
133                                                          const std::list<BCError>& theErrors);
134
135   Standard_EXPORT Handle(GEOM_Object) GetNonBlocks (Handle(GEOM_Object)  theShape,
136                                                     const Standard_Real  theToleranceC1,
137                                                     Handle(GEOM_Object)& theNonQuads);
138
139   Standard_EXPORT Handle(GEOM_Object) RemoveExtraEdges (Handle(GEOM_Object) theShape,
140                                                         const Standard_Integer theOptimumNbFaces = 6);
141
142   Standard_EXPORT Handle(GEOM_Object) UnionFaces (Handle(GEOM_Object) theShape);
143
144   Standard_EXPORT Handle(GEOM_Object) CheckAndImprove (Handle(GEOM_Object) theCompound);
145
146   Standard_EXPORT static void AddBlocksFrom (const TopoDS_Shape&   theShape,
147                                              TopTools_ListOfShape& BLO,
148                                              TopTools_ListOfShape& NOT,
149                                              TopTools_ListOfShape& EXT,
150                                              TopTools_ListOfShape& NOQ,
151                                              const Standard_Real  theToleranceC1 = -1.);
152
153   // Extract blocks from blocks compounds
154   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks
155                                       (Handle(GEOM_Object)    theCompound,
156                                        const Standard_Integer theMinNbFaces,
157                                        const Standard_Integer theMaxNbFaces);
158
159   Standard_EXPORT Handle(GEOM_Object) GetBlockNearPoint (Handle(GEOM_Object) theCompound,
160                                                          Handle(GEOM_Object) thePoint);
161
162   Standard_EXPORT Handle(GEOM_Object) GetBlockByParts
163                      (Handle(GEOM_Object)                         theCompound,
164                       const Handle(TColStd_HSequenceOfTransient)& theParts);
165
166   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetBlocksByParts
167                      (Handle(GEOM_Object)                         theCompound,
168                       const Handle(TColStd_HSequenceOfTransient)& theParts);
169
170   // Operations on blocks with gluing of result
171   Standard_EXPORT Handle(GEOM_Object) MakeMultiTransformation1D (Handle(GEOM_Object)    theBlock,
172                                                                  const Standard_Integer theDirFace1,
173                                                                  const Standard_Integer theDirFace2,
174                                                                  const Standard_Integer theNbTimes);
175
176   Standard_EXPORT Handle(GEOM_Object) MakeMultiTransformation2D (Handle(GEOM_Object)    theBlock,
177                                                                  const Standard_Integer theDirFace1U,
178                                                                  const Standard_Integer theDirFace2U,
179                                                                  const Standard_Integer theNbTimesU,
180                                                                  const Standard_Integer theDirFace1V,
181                                                                  const Standard_Integer theDirFace2V,
182                                                                  const Standard_Integer theNbTimesV);
183
184   // Build groups for Propagation of 1D hypotheses
185   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Propagate (Handle(GEOM_Object) theShape);
186 };
187
188 #endif