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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROData_LANDCOVER_MAP_HeaderFile
20 #define HYDROData_LANDCOVER_MAP_HeaderFile
22 #include <HYDROData_Entity.h>
23 #include <TDataStd_ExtStringArray.hxx>
25 DEFINE_STANDARD_HANDLE( HYDROData_LandCoverMap, HYDROData_Entity )
29 class TopoDS_Iterator;
30 class TopTools_ListOfShape;
31 class Handle( HYDROData_PolylineXY );
32 class Handle( HYDROData_Object );
33 class HYDROData_MapOfFaceToStricklerType;
36 class HYDROData_LandCoverMap : public HYDROData_Entity
39 friend class HYDROData_Iterator;
43 DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
44 DataTag_Shape, ///< the shape presentation of the land cover map
52 Iterator( const HYDROData_LandCoverMap& );
53 HYDRODATA_EXPORT Iterator( const Handle( HYDROData_LandCoverMap )& );
54 HYDRODATA_EXPORT ~Iterator();
56 void Init( const HYDROData_LandCoverMap& );
57 HYDRODATA_EXPORT bool More() const;
58 HYDRODATA_EXPORT void Next();
61 HYDRODATA_EXPORT TopoDS_Face Face() const;
62 HYDRODATA_EXPORT QString StricklerType() const;
63 void SetStricklerType( const QString& );
66 TopoDS_Iterator* myIterator;
68 Handle(TDataStd_ExtStringArray) myArray;
74 DBFStatus_DIFF_SIZE_ERROR,
75 DBFStatus_OPEN_FILE_ERROR,
76 DBFStatus_NO_SUCH_FIELD_ERROR,
77 DBFStatus_NO_DBFVALUES_CORRESPONDENCE_WARNING
80 HYDRODATA_EXPORT HYDROData_LandCoverMap();
81 HYDRODATA_EXPORT virtual ~HYDROData_LandCoverMap();
83 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const;
85 HYDRODATA_EXPORT DBFStatus ImportDBF( const QString& theDBFFileName,
86 const QString& theFieldName,
87 const QStringList& DBFValues,
88 const QStringList& StricklerTypes,
89 const QList<int>& theIndices );
91 HYDRODATA_EXPORT void ExportDBF( const QString& theDBFFileName,
92 const QString& theFieldName,
93 const QStringList& theDBFValues,
94 const QStringList& theStricklerTypes ) const;
96 HYDRODATA_EXPORT bool ExportTelemac( const QString& theFileName, double theDeflection ) const;
98 HYDRODATA_EXPORT bool Add( const Handle( HYDROData_Object )&, const QString& theType );
99 HYDRODATA_EXPORT bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType );
101 HYDRODATA_EXPORT bool Remove( const TopoDS_Face& );
102 HYDRODATA_EXPORT bool Remove( const TopTools_ListOfShape& );
104 HYDRODATA_EXPORT bool Split( const Handle( HYDROData_PolylineXY )& );
105 HYDRODATA_EXPORT bool Merge( const TopTools_ListOfShape&, const QString& theType );
107 HYDRODATA_EXPORT TopoDS_Face FindByPoint( const gp_Pnt2d&, QString& theType ) const;
109 HYDRODATA_EXPORT TopoDS_Shape GetShape() const;
111 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
114 void SetShape( const TopoDS_Shape& );
116 bool LocalPartition( const TopoDS_Shape&, const QString& theNewType );
117 static TopoDS_Shape MergeFaces(const TopTools_ListOfShape& theFaces,
118 bool IsToUnify, double theTolerance = 1E-3 );
119 void StoreLandCovers( const HYDROData_MapOfFaceToStricklerType& );
122 DEFINE_STANDARD_RTTI( HYDROData_LandCoverMap );
125 friend class Iterator;
126 friend class test_HYDROData_LandCoverMap;