#include <ShapeFix_Shape.hxx>
#include <BRepCheck_Shell.hxx>
#include <BRepCheck_ListOfStatus.hxx>
+#include <TopTools_SequenceOfShape.hxx>
#include <QFile>
return anAttr->Get();
}
+
+bool HYDROData_LandCoverMap::ImportShp( const QString& theFileName,
+ const QList<int>& theIndices )
+{
+ HYDROData_ShapeFile anImporter;
+ QStringList aPolyList;
+ TopTools_SequenceOfShape aFaces;
+ int aSHapeType = -1;
+ int Stat = anImporter.ImportPolygons(theFileName, aPolyList, aFaces, aSHapeType);
+ //
+ if (Stat != 1)
+ return false;
+ //
+ HYDROData_MapOfFaceToStricklerType aMapFace2ST;
+ int maxInd = *std::max_element(theIndices.begin(), theIndices.end());
+ if (maxInd > aPolyList.length())
+ return false;
+ //
+ if (theIndices.empty())
+ {
+ //import all shapes
+ for ( int i = 1; i <=aFaces.Length(); i++ )
+ {
+ TopoDS_Shape aShape = aFaces(i);
+ if ( aShape.IsNull() )
+ continue;
+ aMapFace2ST.Add( TopoDS::Face( aShape ), "" );
+ }
+ }
+ else
+ {
+ //import given indices
+ foreach ( int Ind, theIndices )
+ {
+ TopoDS_Shape aShape = aFaces(Ind + 1);
+ if ( aShape.IsNull() )
+ continue;
+ aMapFace2ST.Add( TopoDS::Face( aShape ), "" );
+ }
+ }
+ //
+ StoreLandCovers(aMapFace2ST);
+ return true;
+}
+
+bool HYDROData_LandCoverMap::ExportShp( const QString& theFileName) const
+{
+ HYDROData_ShapeFile anExporter;
+ QStringList aList;
+ anExporter.Export(theFileName, this, aList);
+ if (aList.empty())
+ return true;
+ else
+ return false;
+}
+
const QStringList& theDBFValues,
const QStringList& theStricklerTypes ) const;
+ bool ImportShp( const QString& theFileName,
+ const QList<int>& theIndices = QList<int>());
+
+ bool ExportShp( const QString& theFileName) const;
+
HYDRODATA_EXPORT bool ExportTelemac( const QString& theFileName, double theDeflection ) const;
HYDRODATA_EXPORT bool Add( const Handle( HYDROData_Object )&, const QString& theType );
const QString& theFieldName,
const QStringList& theDBFValues,
const QStringList& theStricklerTypes ) const;
+
+ bool ImportShp( const QString& theFileName);
+
+ bool ExportShp( const QString& theFileName) const;
bool ExportTelemac( const QString& theFileName, double theDeflection ) const;