Salome HOME
test on types after operations
[modules/hydro.git] / src / HYDROData / HYDROData_LandCoverMap.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_LANDCOVER_MAP_HeaderFile
20 #define HYDROData_LANDCOVER_MAP_HeaderFile
21
22 #include <HYDROData_Entity.h>
23 #include <TDataStd_ExtStringArray.hxx>
24
25 DEFINE_STANDARD_HANDLE( HYDROData_LandCoverMap, HYDROData_Entity )
26
27 class TopoDS_Face;
28 class TopoDS_Shape;
29 class TopoDS_Iterator;
30 class TopTools_ListOfShape;
31 class Handle( HYDROData_PolylineXY );
32 class Handle( HYDROData_Object );
33 class HYDROData_MapOfFaceToStricklerType;
34
35 class HYDROData_LandCoverMap : public HYDROData_Entity
36 {
37 protected:
38   friend class HYDROData_Iterator;
39
40   enum DataTag
41   {
42     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
43     DataTag_Shape,                                         ///< the shape presentation of the land cover map
44     DataTag_Types,
45   };
46
47 public:
48   class Iterator
49   {
50   public:
51     Iterator( const HYDROData_LandCoverMap& );
52     Iterator( const Handle( HYDROData_LandCoverMap )& );
53     ~Iterator();
54
55     void Init( const HYDROData_LandCoverMap& );
56     bool More() const;
57     void Next();
58     
59     TopoDS_Face Face() const;
60     QString StricklerType() const;
61
62   private:
63     TopoDS_Iterator* myIterator;
64     int              myIndex;
65     Handle(TDataStd_ExtStringArray) myArray;
66   };
67
68   HYDROData_LandCoverMap();
69   ~HYDROData_LandCoverMap();
70
71   virtual const ObjectKind GetKind() const;
72
73   bool ImportQGIS( const QString& theFileName );
74   bool ExportQGIS( const QString& theFileName ) const;
75   bool ExportTelemac( const QString& theFileName ) const;
76
77   bool Add( const Handle( HYDROData_Object )&, const QString& theType );
78   bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType );
79
80   bool Remove( const TopoDS_Face& );
81   bool Remove( const TopTools_ListOfShape& );
82
83   bool Split( const Handle( HYDROData_PolylineXY )& );
84   bool Merge( const TopTools_ListOfShape&, const QString& theType );
85
86 protected:
87   TopoDS_Shape GetShape() const;
88   void SetShape( const TopoDS_Shape& );
89
90   bool LocalPartition( const TopoDS_Shape&, const QString& theNewType );
91   void StoreLandCovers( const HYDROData_MapOfFaceToStricklerType& );
92
93 public:
94   DEFINE_STANDARD_RTTI( HYDROData_LandCoverMap );
95
96 private:
97   friend class Iterator;
98   friend class test_HYDROData_LandCoverMap;
99 };
100
101 #endif