]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_LandCoverMap.h
Salome HOME
refs #673: Strickler coefficient should be written for Telemac instead of Strickler...
[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 #include <NCollection_IndexedDataMap.hxx>
25 #include <QString>
26 #include <TopoDS_Face.hxx>
27
28 class Handle_HYDROData_StricklerTable;
29
30 typedef NCollection_IndexedDataMap<TopoDS_Face, QString> HYDROData_MapOfFaceToStricklerType;
31
32 DEFINE_STANDARD_HANDLE( HYDROData_LandCoverMap, HYDROData_Entity )
33
34 class TopoDS_Shape;
35 class TopoDS_Wire;
36 class TopoDS_Iterator;
37 class TopTools_ListOfShape;
38 class Handle( HYDROData_PolylineXY );
39 class Handle( HYDROData_Object );
40 class gp_Pnt2d;
41
42 class HYDROData_LandCoverMap : public HYDROData_Entity
43 {
44 protected:
45   friend class HYDROData_Iterator;
46
47   enum DataTag
48   {
49     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
50     DataTag_Shape,                                         ///< the shape presentation of the land cover map
51     DataTag_Types,
52     DataTag_Transparency,
53   };
54
55 public:
56   class Iterator
57   {
58   public:
59     Iterator( const HYDROData_LandCoverMap& );
60     HYDRODATA_EXPORT Iterator( const Handle( HYDROData_LandCoverMap )& );
61     HYDRODATA_EXPORT ~Iterator();
62
63     void Init( const HYDROData_LandCoverMap& );
64     HYDRODATA_EXPORT bool More() const;
65     HYDRODATA_EXPORT void Next();
66     
67     int Index() const;
68     HYDRODATA_EXPORT TopoDS_Face Face() const;
69     HYDRODATA_EXPORT QString StricklerType() const;
70     void SetStricklerType( const QString& );
71
72   private:
73     TopoDS_Iterator* myIterator;
74     int              myIndex;
75     Handle(TDataStd_ExtStringArray) myArray;
76   };
77
78   enum DBFStatus
79   {
80     DBFStatus_OK,
81     DBFStatus_DIFF_SIZE_ERROR,
82     DBFStatus_OPEN_FILE_ERROR,
83     DBFStatus_NO_SUCH_FIELD_ERROR,
84     DBFStatus_NO_DBFVALUES_CORRESPONDENCE_WARNING
85   };
86
87   HYDRODATA_EXPORT HYDROData_LandCoverMap();
88   HYDRODATA_EXPORT virtual ~HYDROData_LandCoverMap();
89
90   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const;
91
92   HYDRODATA_EXPORT DBFStatus ImportDBF( const QString& theDBFFileName, 
93                                         const QString& theFieldName, 
94                                         const QStringList& DBFValues,
95                                         const QStringList& StricklerTypes,
96                                         const QList<int>& theIndices = QList<int>() );
97  
98   HYDRODATA_EXPORT void ExportDBF( const QString& theDBFFileName,
99                                    const QString& theFieldName, 
100                                    const QStringList& theDBFValues,
101                                    const QStringList& theStricklerTypes ) const;
102
103   HYDRODATA_EXPORT bool ExportTelemac( const QString& theFileName,
104                                        double theDeflection,
105                                        const Handle_HYDROData_StricklerTable& theTable ) const;
106
107   HYDRODATA_EXPORT bool Add( const Handle( HYDROData_Object )&, const QString& theType );
108   HYDRODATA_EXPORT bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType );
109
110   HYDRODATA_EXPORT bool Remove( const TopoDS_Face& );
111   HYDRODATA_EXPORT bool Remove( const TopTools_ListOfShape& );
112
113   HYDRODATA_EXPORT bool Split( const Handle( HYDROData_PolylineXY )& );
114   HYDRODATA_EXPORT bool Split( const TopoDS_Shape& );
115   HYDRODATA_EXPORT bool Merge( const TopTools_ListOfShape&, const QString& theType );
116
117   HYDRODATA_EXPORT bool ChangeType( const TopTools_ListOfShape&, const QString& theType );
118
119   HYDRODATA_EXPORT TopoDS_Face FindByPoint( const gp_Pnt2d&, QString& theType ) const;
120
121   HYDRODATA_EXPORT TopoDS_Shape GetShape() const;
122
123   HYDRODATA_EXPORT QString StricklerType( const TopoDS_Face& ) const;
124
125   HYDRODATA_EXPORT virtual QStringList DumpToPython( const QString& thePyScriptPath,
126                                                      MapOfTreatedObjects& theTreatedObjects ) const;
127
128   HYDRODATA_EXPORT int GetLCCount() const;
129   HYDRODATA_EXPORT bool IsEmpty() const;
130
131   HYDRODATA_EXPORT void StoreLandCovers( const HYDROData_MapOfFaceToStricklerType& );
132
133   HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
134
135   HYDRODATA_EXPORT void SetTransparency( double );
136   HYDRODATA_EXPORT double GetTransparency() const;
137
138   HYDRODATA_EXPORT TopoDS_Shape RemoveInternal(const TopoDS_Shape& InSh);
139
140 protected:
141   void SetShape( const TopoDS_Shape& );
142
143   bool Add( const TopoDS_Wire&, const QString& );
144   bool LocalPartition( const TopoDS_Shape&, const QString& theNewType );
145   static TopoDS_Shape MergeFaces(const TopTools_ListOfShape& theFaces,
146                       bool IsToUnify, double theTolerance = 1E-5 );
147
148 public:
149   DEFINE_STANDARD_RTTI( HYDROData_LandCoverMap );
150
151 private:
152   friend class Iterator;
153   friend class test_HYDROData_LandCoverMap;
154 };
155
156 #endif