]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_SplitToZonesTool.h
Salome HOME
Access methods for object groups added.
[modules/hydro.git] / src / HYDROData / HYDROData_SplitToZonesTool.h
1
2 #ifndef HYDROData_SplitToZonesTool_H
3 #define HYDROData_SplitToZonesTool_H
4
5 #include <HYDROData_Object.h>
6 #include <HYDROData_Transform.h>
7 #include <TopoDS_Shape.hxx>
8 #include <TopoDS_Compound.hxx>
9 #include <TopoDS_Face.hxx>
10 #include <TopTools_ShapeMapHasher.hxx>
11 #include <NCollection_Map.hxx>
12 #include <NCollection_DataMap.hxx>
13 #include <TopTools_ListOfShape.hxx>
14 #include <QStringList>
15
16 class Handle(HYDROData_PolylineXY);
17
18 /**
19  * \class HYDROData_SplitToZonesTool
20  * \brief This class contains methods used for splitting geometry objects
21  *        into non-intersected regions.
22  */
23 class HYDRODATA_EXPORT HYDROData_SplitToZonesTool
24 {
25 public:
26   struct HYDRODATA_EXPORT SplitData
27   {
28     enum SplitObjectType
29     {
30       Data_None,
31       Data_Zone,
32       Data_Edge
33     };
34
35     TopoDS_Shape    Shape;
36     QStringList     ObjectNames;
37     SplitObjectType Type;
38
39     SplitData() :
40      Type( Data_None ) {}
41     
42     SplitData( const SplitObjectType& theType,
43                const TopoDS_Shape&    theShape,
44                const QStringList&     theObjectNames ) :
45       Type( theType ), Shape( theShape ), ObjectNames( theObjectNames ) {}
46
47     SplitData( const SplitObjectType& theType,
48                const TopoDS_Shape&    theShape,
49                const QString&         theObjectName ) :
50       Type( theType ), Shape( theShape ), ObjectNames( theObjectName ) {}
51
52     TopoDS_Face Face() const;
53   };
54
55   typedef QList        <SplitData> SplitDataList;
56   typedef QListIterator<SplitData> SplitDataListIterator;  
57   typedef NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> HYDROData_MapOfShape;
58   typedef HYDROData_MapOfShape::Iterator HYDROData_MapIteratorOfMapOfShape;
59   typedef NCollection_DataMap<TopoDS_Shape, TopTools_ListOfShape, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfShape;
60   typedef HYDROData_DataMapOfShapeListOfShape::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape;
61   typedef NCollection_DataMap<TopoDS_Shape,  QStringList, TopTools_ShapeMapHasher> HYDROData_DataMapOfShapeListOfString;
62   typedef HYDROData_DataMapOfShapeListOfString::Iterator HYDROData_DataMapIteratorOfDataMapOfShapeListOfString;
63   #undef _NCollection_MapHasher
64
65 public:
66
67   static SplitDataList       Split( const HYDROData_SequenceOfObjects&  theObjectList,
68                                     const HYDROData_SequenceOfObjects&  theGroupsList,
69                                     const Handle(HYDROData_PolylineXY)& thePolyline );
70
71   static void SetFileNames(const QString& theNameBefore, const QString& theNameAfter);
72
73 private:
74
75   static bool                SplitTwoData( const SplitData& theData1,
76                                            const SplitData& theData2,
77                                            SplitData& theData1Subtracted,
78                                            SplitData& theData2Subtracted,
79                                            SplitData& theDataIntersected );
80
81   static SplitDataList       ExtractSeparateData( const SplitData& theData );
82
83    /**
84    * Split input faces.
85    */
86   static Standard_Integer SplitFaces(const TopoDS_Compound& theComp, HYDROData_Transform& theTool);
87 };
88
89 #endif