Salome HOME
Merge with OCC_development_01
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IBlocksOperations.hxx
1
2 #ifndef _GEOMImpl_IBlocksOperations_HXX_
3 #define _GEOMImpl_IBlocksOperations_HXX_
4
5 #include "GEOM_IOperations.hxx"
6
7 #include <TopTools_ListOfShape.hxx>
8 #include <TColStd_HSequenceOfTransient.hxx>
9
10 #include <list>
11
12 class GEOM_Engine;
13 class Handle(GEOM_Object);
14 class Handle(TColStd_HArray1OfInteger);
15
16 class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
17  public:
18   GEOMImpl_IBlocksOperations(GEOM_Engine* theEngine, int theDocID);
19   ~GEOMImpl_IBlocksOperations();
20
21   // Creation of blocks and block faces
22   Handle(GEOM_Object) MakeQuad (Handle(GEOM_Object) theEdge1,
23                                 Handle(GEOM_Object) theEdge2,
24                                 Handle(GEOM_Object) theEdge3,
25                                 Handle(GEOM_Object) theEdge4);
26
27   Handle(GEOM_Object) MakeQuad2Edges (Handle(GEOM_Object) theEdge1,
28                                       Handle(GEOM_Object) theEdge2);
29
30   Handle(GEOM_Object) MakeQuad4Vertices (Handle(GEOM_Object) thePoint1,
31                                          Handle(GEOM_Object) thePoint2,
32                                          Handle(GEOM_Object) thePoint3,
33                                          Handle(GEOM_Object) thePoint4);
34
35   Handle(GEOM_Object) MakeHexa (Handle(GEOM_Object) theFace1,
36                                 Handle(GEOM_Object) theFace2,
37                                 Handle(GEOM_Object) theFace3,
38                                 Handle(GEOM_Object) theFace4,
39                                 Handle(GEOM_Object) theFace5,
40                                 Handle(GEOM_Object) theFace6);
41
42   Handle(GEOM_Object) MakeHexa2Faces (Handle(GEOM_Object) theFace1,
43                                       Handle(GEOM_Object) theFace2);
44
45   Handle(GEOM_Object) MakeBlockCompound (Handle(GEOM_Object) theCompound);
46
47   // Extract elements of blocks and blocks compounds
48   Handle(GEOM_Object) GetPoint (Handle(GEOM_Object) theShape,
49                                 const Standard_Real theX,
50                                 const Standard_Real theY,
51                                 const Standard_Real theZ,
52                                 const Standard_Real theEpsilon);
53
54   Handle(GEOM_Object) GetEdge (Handle(GEOM_Object) theShape,
55                                Handle(GEOM_Object) thePoint1,
56                                Handle(GEOM_Object) thePoint2);
57
58   Handle(GEOM_Object) GetEdgeNearPoint (Handle(GEOM_Object) theBlock,
59                                         Handle(GEOM_Object) thePoint);
60
61   Handle(GEOM_Object) GetFaceByPoints (Handle(GEOM_Object) theShape,
62                                        Handle(GEOM_Object) thePoint1,
63                                        Handle(GEOM_Object) thePoint2,
64                                        Handle(GEOM_Object) thePoint3,
65                                        Handle(GEOM_Object) thePoint4);
66
67   Handle(GEOM_Object) GetFaceByEdges (Handle(GEOM_Object) theShape,
68                                       Handle(GEOM_Object) theEdge1,
69                                       Handle(GEOM_Object) theEdge2);
70
71   Handle(GEOM_Object) GetOppositeFace (Handle(GEOM_Object) theBlock,
72                                        Handle(GEOM_Object) theFace);
73
74   Handle(GEOM_Object) GetFaceNearPoint (Handle(GEOM_Object) theBlock,
75                                         Handle(GEOM_Object) thePoint);
76
77   Handle(GEOM_Object) GetFaceByNormale (Handle(GEOM_Object) theBlock,
78                                         Handle(GEOM_Object) theVector);
79
80   // Check blocks compounds
81   Standard_Boolean IsCompoundOfBlocks (Handle(GEOM_Object)    theCompound,
82                                        const Standard_Integer theMinNbFaces,
83                                        const Standard_Integer theMaxNbFaces,
84                                        Standard_Integer&      theNbBlocks);
85
86   enum BCErrorType {
87     NOT_BLOCK,
88     EXTRA_EDGE,
89     INVALID_CONNECTION,
90     NOT_CONNECTED,
91     NOT_GLUED
92   };
93
94   struct BCError {
95     BCErrorType error;
96     list<int>   incriminated;
97   };
98
99   Standard_Boolean CheckCompoundOfBlocksOld (Handle(GEOM_Object) theCompound,
100                                              list<BCError>&      theErrors);
101
102   Standard_Boolean CheckCompoundOfBlocks (Handle(GEOM_Object) theCompound,
103                                           list<BCError>&      theErrors);
104
105   TCollection_AsciiString PrintBCErrors (Handle(GEOM_Object)  theCompound,
106                                          const list<BCError>& theErrors);
107
108   Handle(GEOM_Object) RemoveExtraEdges (Handle(GEOM_Object) theShape);
109
110   Handle(GEOM_Object) CheckAndImprove (Handle(GEOM_Object) theCompound);
111
112   static void AddBlocksFrom (const TopoDS_Shape&   theShape,
113                              TopTools_ListOfShape& BLO,
114                              TopTools_ListOfShape& NOT,
115                              TopTools_ListOfShape& EXT);
116
117   // Extract blocks from blocks compounds
118   Handle(TColStd_HSequenceOfTransient) ExplodeCompoundOfBlocks
119                                       (Handle(GEOM_Object)    theCompound,
120                                        const Standard_Integer theMinNbFaces,
121                                        const Standard_Integer theMaxNbFaces);
122
123   Handle(GEOM_Object) GetBlockNearPoint (Handle(GEOM_Object) theCompound,
124                                          Handle(GEOM_Object) thePoint);
125
126   Handle(GEOM_Object) GetBlockByParts
127                      (Handle(GEOM_Object)                         theCompound,
128                       const Handle(TColStd_HSequenceOfTransient)& theParts);
129
130   Handle(TColStd_HSequenceOfTransient) GetBlocksByParts
131                      (Handle(GEOM_Object)                         theCompound,
132                       const Handle(TColStd_HSequenceOfTransient)& theParts);
133
134   // Operations on blocks with gluing of result
135   Handle(GEOM_Object) MakeMultiTransformation1D (Handle(GEOM_Object)    theBlock,
136                                                  const Standard_Integer theDirFace1,
137                                                  const Standard_Integer theDirFace2,
138                                                  const Standard_Integer theNbTimes);
139
140   Handle(GEOM_Object) MakeMultiTransformation2D (Handle(GEOM_Object)    theBlock,
141                                                  const Standard_Integer theDirFace1U,
142                                                  const Standard_Integer theDirFace2U,
143                                                  const Standard_Integer theNbTimesU,
144                                                  const Standard_Integer theDirFace1V,
145                                                  const Standard_Integer theDirFace2V,
146                                                  const Standard_Integer theNbTimesV);
147
148   // Build groups for Propagation of 1D hypotheses
149   Handle(TColStd_HSequenceOfTransient) Propagate (Handle(GEOM_Object) theShape);
150 };
151
152 #endif