Salome HOME
Import polyline from shape (Feature #228).
[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
7 #include <TopoDS_Face.hxx>
8
9 #include <QStringList>
10
11 class Handle(HYDROData_PolylineXY);
12
13 /**
14  * \class HYDROData_SplitToZonesTool
15  * \brief This class contains methods used for splitting geometry objects
16  *        into non-intersected regions.
17  */
18 class HYDRODATA_EXPORT HYDROData_SplitToZonesTool
19 {
20 public:
21   struct HYDRODATA_EXPORT SplitData
22   {
23     enum SplitObjectType
24     {
25       Data_None,
26       Data_Zone,
27       Data_Edge
28     };
29
30     TopoDS_Shape    Shape;
31     QStringList     ObjectNames;
32     SplitObjectType Type;
33
34     SplitData() :
35      Type( Data_None ) {}
36     
37     SplitData( const SplitObjectType& theType,
38                const TopoDS_Shape&    theShape,
39                const QStringList&     theObjectNames ) :
40       Type( theType ), Shape( theShape ), ObjectNames( theObjectNames ) {}
41
42     SplitData( const SplitObjectType& theType,
43                const TopoDS_Shape&    theShape,
44                const QString&         theObjectName ) :
45       Type( theType ), Shape( theShape ), ObjectNames( theObjectName ) {}
46
47     TopoDS_Face Face() const;
48   };
49
50   typedef QList        <SplitData> SplitDataList;
51   typedef QListIterator<SplitData> SplitDataListIterator;
52
53 public:
54
55   static SplitDataList       Split( const HYDROData_SequenceOfObjects&  theObjectList,
56                                     const HYDROData_SequenceOfObjects&  theGroupsList,
57                                     const Handle(HYDROData_PolylineXY)& thePolyline );
58
59 private:
60
61   static bool                SplitTwoData( const SplitData& theData1,
62                                            const SplitData& theData2,
63                                            SplitData& theData1Subtracted,
64                                            SplitData& theData2Subtracted,
65                                            SplitData& theDataIntersected );
66
67   static SplitDataList       ExtractSeparateData( const SplitData& theData );
68
69 };
70
71 #endif