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>
24 #include <NCollection_IndexedDataMap.hxx>
26 #include <TopoDS_Face.hxx>
27 #include <TopExp_Explorer.hxx>
29 class Handle_HYDROData_StricklerTable;
30 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
32 typedef NCollection_IndexedDataMap<TopoDS_Face, QString> HYDROData_MapOfFaceToStricklerType;
34 DEFINE_STANDARD_HANDLE( HYDROData_LandCoverMap, HYDROData_Entity )
38 class TopoDS_Iterator;
39 class TopTools_ListOfShape;
40 class Handle( HYDROData_PolylineXY );
41 class Handle( HYDROData_Object );
44 class HYDROData_LandCoverMap : public HYDROData_Entity
47 friend class HYDROData_Iterator;
51 DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
52 DataTag_Shape, ///< the shape presentation of the land cover map
61 Explorer( const HYDROData_LandCoverMap& );
62 HYDRODATA_EXPORT Explorer( const Handle( HYDROData_LandCoverMap )& );
63 HYDRODATA_EXPORT ~Explorer();
65 void Init( const HYDROData_LandCoverMap& );
66 HYDRODATA_EXPORT bool More() const;
67 HYDRODATA_EXPORT void Next();
70 HYDRODATA_EXPORT TopoDS_Face Face() const;
71 HYDRODATA_EXPORT QString StricklerType() const;
72 void SetStricklerType( const QString& );
75 TopExp_Explorer* myExplorer;
77 Handle(TDataStd_ExtStringArray) myArray;
83 DBFStatus_DIFF_SIZE_ERROR,
84 DBFStatus_OPEN_FILE_ERROR,
85 DBFStatus_NO_SUCH_FIELD_ERROR,
86 DBFStatus_NO_DBFVALUES_CORRESPONDENCE_WARNING
89 HYDRODATA_EXPORT HYDROData_LandCoverMap();
90 HYDRODATA_EXPORT virtual ~HYDROData_LandCoverMap();
92 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const;
94 HYDRODATA_EXPORT bool ImportSHP( const QString& theSHPFileName,
95 const QList<int>& theIndices = QList<int>() );
97 HYDRODATA_EXPORT bool ExportSHP( const QString& theSHPFileName, bool bUseDiscr = false, double theDefl = 0.1) const;
99 HYDRODATA_EXPORT DBFStatus ImportDBF( const QString& theDBFFileName,
100 const QString& theFieldName,
101 const QStringList& DBFValues,
102 const QStringList& StricklerTypes,
103 const QList<int>& theIndices = QList<int>() );
105 HYDRODATA_EXPORT void ExportDBF( const QString& theDBFFileName,
106 const QString& theFieldName,
107 const QStringList& theDBFValues,
108 const QStringList& theStricklerTypes ) const;
110 HYDRODATA_EXPORT bool ExportTelemac( const QString& theFileName,
111 double theDeflection,
112 const Handle_HYDROData_StricklerTable& theTable ) const;
114 HYDRODATA_EXPORT bool Add( const Handle( HYDROData_Object )&, const QString& theType );
115 HYDRODATA_EXPORT bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType );
117 HYDRODATA_EXPORT bool Remove( const TopoDS_Face& );
118 HYDRODATA_EXPORT bool Remove( const TopTools_ListOfShape& );
120 HYDRODATA_EXPORT bool Split( const Handle( HYDROData_PolylineXY )& );
121 HYDRODATA_EXPORT bool Split( const TopoDS_Shape& );
122 HYDRODATA_EXPORT bool Merge( const TopTools_ListOfShape&, const QString& theType );
124 HYDRODATA_EXPORT bool ChangeType( const TopTools_ListOfShape&, const QString& theType );
126 HYDRODATA_EXPORT TopoDS_Face FindByPoint( const gp_Pnt2d&, QString& theType ) const;
128 HYDRODATA_EXPORT TopoDS_Shape GetShape() const;
130 HYDRODATA_EXPORT QString StricklerType( const TopoDS_Face& ) const;
132 HYDRODATA_EXPORT virtual QStringList DumpToPython( const QString& thePyScriptPath,
133 MapOfTreatedObjects& theTreatedObjects ) const;
135 HYDRODATA_EXPORT int GetLCCount() const;
136 HYDRODATA_EXPORT bool IsEmpty() const;
138 HYDRODATA_EXPORT void StoreLandCovers( const HYDROData_MapOfFaceToStricklerType& );
140 HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
142 HYDRODATA_EXPORT void SetTransparency( double );
143 HYDRODATA_EXPORT double GetTransparency() const;
145 HYDRODATA_EXPORT void RemoveInternal(TopoDS_Shape& ShToRebuild, NCollection_IndexedDataMap<TopoDS_Face, TopoDS_Face>* aF2FReplace);
147 HYDRODATA_EXPORT bool CheckLinear();
149 HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
152 void SetShape( const TopoDS_Shape& );
154 bool Add( const TopoDS_Wire&, const QString& );
156 bool LocalPartition( const TopoDS_Shape&, const QString& theNewType );
158 static TopoDS_Shape MergeFaces(const TopTools_ListOfShape& theFaces,
160 TopTools_IndexedDataMapOfShapeListOfShape* theShHistory = NULL,
161 double theTolerance = 1E-5 );
164 DEFINE_STANDARD_RTTI( HYDROData_LandCoverMap );
167 friend class Explorer;
168 friend class test_HYDROData_LandCoverMap;