]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_SplitToZonesTool.h
Salome HOME
copyrights in HYDRO files are updated
[modules/hydro.git] / src / HYDROData / HYDROData_SplitToZonesTool.h
1 // Copyright (C) 2007-2015  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 HYDROData_SplitToZonesTool_H
24 #define HYDROData_SplitToZonesTool_H
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 <NCollection_IndexedDataMap.hxx>
34 #include <TopTools_ListOfShape.hxx>
35 #include <QStringList>
36
37 class Handle(HYDROData_PolylineXY);
38
39 /**
40  * \class HYDROData_SplitToZonesTool
41  * \brief This class contains methods used for splitting geometry objects
42  *        into non-intersected regions.
43  */
44 class HYDRODATA_EXPORT HYDROData_SplitToZonesTool
45 {
46 public:
47   struct HYDRODATA_EXPORT SplitData
48   {
49     enum SplitObjectType
50     {
51       Data_None,
52       Data_Zone,
53       Data_Edge
54     };
55
56     TopoDS_Shape    Shape;
57     QStringList     ObjectNames;
58     SplitObjectType Type;
59
60     SplitData() :
61      Type( Data_None ) {}
62     
63     SplitData( const SplitObjectType& theType,
64                const TopoDS_Shape&    theShape,
65                const QStringList&     theObjectNames ) :
66       Type( theType ), Shape( theShape ), ObjectNames( theObjectNames ) {}
67
68     SplitData( const SplitObjectType& theType,
69                const TopoDS_Shape&    theShape,
70                const QString&         theObjectName ) :
71       Type( theType ), Shape( theShape ), ObjectNames( theObjectName ) {}
72
73     TopoDS_Face Face() const;
74   };
75
76   typedef QList        <SplitData> SplitDataList;
77   typedef QListIterator<SplitData> SplitDataListIterator;  
78   typedef NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> HYDROData_MapOfShape;
79   typedef HYDROData_MapOfShape::Iterator HYDROData_MapIteratorOfMapOfShape;
80   typedef NCollection_IndexedDataMap<TopoDS_Shape, TopTools_ListOfShape, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfShape;
81   typedef HYDROData_DataMapOfShapeListOfShape::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape;
82   typedef NCollection_IndexedDataMap<TopoDS_Shape,  QStringList, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfString;
83   typedef HYDROData_DataMapOfShapeListOfString::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfString;
84   #undef _NCollection_MapHasher
85
86 public:
87
88   static SplitDataList       Split( const HYDROData_SequenceOfObjects&  theObjectList,
89                                     const HYDROData_SequenceOfObjects&  theGroupsList,
90                                     const Handle(HYDROData_PolylineXY)& thePolyline );
91
92   static void SetFileNames(const QString& theNameBefore, const QString& theNameAfter);
93
94 private:
95
96   /**
97    * Split input faces.
98    */
99   static Standard_Integer SplitFaces(const TopoDS_Compound& theComp, HYDROData_Transform& theTool);
100 };
101
102 #endif