]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_SplitToZonesTool.h
Salome HOME
export of calc case -- groups def.
[modules/hydro.git] / src / HYDROData / HYDROData_SplitToZonesTool.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROData_SplitToZonesTool_H
20 #define HYDROData_SplitToZonesTool_H
21
22 #ifdef WIN32
23   #pragma warning ( disable: 4251 )
24 #endif
25
26 #include <HYDROData_Object.h>
27 #include <HYDROData_Transform.h>
28 #include <TopoDS_Shape.hxx>
29 #include <TopoDS_Compound.hxx>
30 #include <TopoDS_Face.hxx>
31 #include <TopTools_ShapeMapHasher.hxx>
32 #include <NCollection_IndexedMap.hxx>
33 #include <TopTools_IndexedDataMapOfShapeShape.hxx>
34 #include <TopTools_ListOfShape.hxx>
35 #include <QStringList>
36 #include <NCollection_DataMap.hxx>
37
38 class Handle(HYDROData_PolylineXY);
39
40 /**
41  * \class HYDROData_SplitToZonesTool
42  * \brief This class contains methods used for splitting geometry objects
43  *        into non-intersected regions.
44  */
45 class HYDRODATA_EXPORT HYDROData_SplitToZonesTool
46 {
47 public:
48   struct HYDRODATA_EXPORT SplitData
49   {
50     enum SplitObjectType
51     {
52       Data_None,
53       Data_Zone,
54       Data_Edge,
55       Data_IntEdge
56     };
57
58     TopoDS_Shape    Shape;
59     QStringList     ObjectNames;
60     SplitObjectType Type;
61
62     SplitData() :
63      Type( Data_None ) {}
64     
65     SplitData( const SplitObjectType& theType,
66                const TopoDS_Shape&    theShape,
67                const QStringList&     theObjectNames ) :
68       Type( theType ), Shape( theShape ), ObjectNames( theObjectNames ) {}
69
70     SplitData( const SplitObjectType& theType,
71                const TopoDS_Shape&    theShape,
72                const QString&         theObjectName ) :
73       Type( theType ), Shape( theShape ), ObjectNames( theObjectName ) {}
74
75     TopoDS_Face Face() const;
76   };
77
78   typedef QList        <SplitData> SplitDataList;
79   typedef QListIterator<SplitData> SplitDataListIterator;  
80   typedef NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> HYDROData_MapOfShape;
81   typedef HYDROData_MapOfShape::Iterator HYDROData_MapIteratorOfMapOfShape;
82   typedef NCollection_IndexedDataMap<TopoDS_Shape, TopTools_ListOfShape, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfShape;
83   typedef HYDROData_DataMapOfShapeListOfShape::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape;
84   typedef NCollection_IndexedDataMap<TopoDS_Shape,  QStringList, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfString;
85   typedef HYDROData_DataMapOfShapeListOfString::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfString;
86   #undef _NCollection_MapHasher
87
88 public:
89
90   static SplitDataList       Split( const HYDROData_SequenceOfObjects&  theObjectList,
91                                     const HYDROData_SequenceOfObjects&  theGroupsList,
92                                     const Handle(HYDROData_PolylineXY)& thePolyline,
93                                     const HYDROData_SequenceOfObjects& InterPolys );
94
95   static SplitDataList       Split( const HYDROData_SequenceOfObjects&  theObjectList );
96
97   static void AddInternalEdges(HYDROData_DataMapOfShapeListOfShape& DM,
98                                const HYDROData_SequenceOfObjects& thePolylines,
99                                NCollection_DataMap<TopoDS_Shape, Handle(HYDROData_PolylineXY), TopTools_ShapeMapHasher>* OutNE);
100
101   static void CutFaceByEdges(const TopoDS_Face& in, 
102                              TopTools_ListOfShape& out, 
103                              const HYDROData_SequenceOfObjects& thePolylines,
104                              NCollection_DataMap<TopoDS_Shape, Handle(HYDROData_PolylineXY), TopTools_ShapeMapHasher>* OutNE);
105
106   static int CutByEdges(const TopoDS_Shape& InSh, const TopTools_ListOfShape& InW,
107                         TopTools_ListOfShape& outShs,
108                         TopTools_IndexedDataMapOfShapeShape* OutNE2OE);
109
110   static void SetFileNames(const QString& theNameBefore, const QString& theNameAfter);
111
112 private:
113
114   /**
115    * Split input faces.
116    */
117   static Standard_Integer SplitFaces(const TopoDS_Compound& theComp, HYDROData_Transform& theTool);
118 };
119
120 #ifdef WIN32
121   #pragma warning ( default: 4251 )
122 #endif
123
124
125 #endif