From: isn Date: Mon, 18 Feb 2019 17:17:51 +0000 (+0300) Subject: minor changes of ImportPolygons() API X-Git-Tag: SH_V2_2_0~99^2~28^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7cab246ebbb070a51bad8f933a3166ad36a2aa73;p=modules%2Fhydro.git minor changes of ImportPolygons() API --- diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index f80ad250..f069df13 100755 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -1190,8 +1190,8 @@ bool HYDROData_LandCoverMap::ImportSHP( const QString& theSHPFileName, HYDROData_ShapeFile anImporter; QStringList aPolyList; TopTools_SequenceOfShape aFaces; - int aSHapeType = -1; - int Stat = anImporter.ImportPolygons(HYDROData_Document::Document(1), theSHPFileName, aPolyList, aFaces, aSHapeType); + //int aSHapeType = -1; + int Stat = anImporter.ImportPolygons(HYDROData_Document::Document(1), theSHPFileName, aPolyList, aFaces); // if (Stat != 1) return false; diff --git a/src/HYDROData/HYDROData_ShapeFile.cxx b/src/HYDROData/HYDROData_ShapeFile.cxx index 4d7519ac..fc093146 100644 --- a/src/HYDROData/HYDROData_ShapeFile.cxx +++ b/src/HYDROData/HYDROData_ShapeFile.cxx @@ -509,7 +509,8 @@ void HYDROData_ShapeFile::ReadSHPPolygon(Handle(HYDROData_Document) theDocument, F.Closed(Standard_True); } -int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, const QString theFileName, QStringList& thePolygonsList, TopTools_SequenceOfShape& theFaces, int& theShapeTypeOfFile) +int HYDROData_ShapeFile::ImportPolygons(Handle(HYDROData_Document) theDocument, const QString theFileName, + QStringList& thePolygonsList, TopTools_SequenceOfShape& theFaces) { Free(); int Stat = TryOpenShapeFile(theFileName); diff --git a/src/HYDROData/HYDROData_ShapeFile.h b/src/HYDROData/HYDROData_ShapeFile.h index 586c5c20..17996338 100644 --- a/src/HYDROData/HYDROData_ShapeFile.h +++ b/src/HYDROData/HYDROData_ShapeFile.h @@ -122,8 +122,7 @@ public: HYDRODATA_EXPORT int ImportPolygons(Handle(HYDROData_Document) theDocument, const QString theFileName, QStringList& thePolygonsList, - TopTools_SequenceOfShape& theFaces, - int& theShapeTypeOfFile); + TopTools_SequenceOfShape& theFaces); HYDRODATA_EXPORT void Free(); diff --git a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx index c4a5a0d5..7b8fedb0 100644 --- a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx @@ -127,12 +127,12 @@ void HYDROGUI_ImportLandCoverMapOp::onFileSelected() erasePreview(); Handle(AIS_InteractiveContext) aCtx = NULL; - int aShapeTypeOfFile = -1; //Import polygons from SHP file as faces //This faces should be added to the new LCM object - int aStat = myImporter.ImportPolygons(doc(), myFileName, aPolygonsList, myPolygonFaces, aShapeTypeOfFile); + int aStat = myImporter.ImportPolygons(doc(), myFileName, aPolygonsList, myPolygonFaces); + int aShapeTypeOfFile = myImporter.GetShapeType(); if (aStat == 1) { aPanel->setPolygonNames(aPolygonsList); diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 922a7c33..b1eb3e1a 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -835,8 +835,9 @@ void test_HYDROData_LandCoverMap::test_shp_import_cyp() HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; - int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces, Type); + + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces); + int Type = anImporter.GetShapeType(); CPPUNIT_ASSERT(aStat == 1); CPPUNIT_ASSERT_EQUAL(5, Type); CPPUNIT_ASSERT_EQUAL(268, PolygonFaces.Length()); @@ -865,8 +866,9 @@ void test_HYDROData_LandCoverMap::test_shp_import_clc_dec() HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; - int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces, Type); + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces); + int Type = anImporter.GetShapeType(); + CPPUNIT_ASSERT(aStat == 1); CPPUNIT_ASSERT_EQUAL(5, Type); CPPUNIT_ASSERT_EQUAL(625, PolygonFaces.Length()); @@ -895,8 +897,8 @@ void test_HYDROData_LandCoverMap::test_shp_import_nld_areas() HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; - int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces, Type); + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces); + int Type = anImporter.GetShapeType(); CPPUNIT_ASSERT(aStat == 1); CPPUNIT_ASSERT_EQUAL(5, Type); CPPUNIT_ASSERT_EQUAL(127, PolygonFaces.Length()); @@ -931,10 +933,9 @@ void test_HYDROData_LandCoverMap::test_shp_loop_back() HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; //import LCM from file (#2-4; #12-14 polygons) - CPPUNIT_ASSERT( anImporter.ImportPolygons(aDoc, aFFileName, PolygonList, PolygonFaces, Type)); + CPPUNIT_ASSERT( anImporter.ImportPolygons(aDoc, aFFileName, PolygonList, PolygonFaces)); Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); HYDROData_MapOfFaceToStricklerType aMapFace2ST; @@ -965,10 +966,8 @@ void test_HYDROData_LandCoverMap::test_shp_loop_back() HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; - //import all - CPPUNIT_ASSERT( anImporter.ImportPolygons(aDoc, aSFileName, PolygonList, PolygonFaces, Type)); + CPPUNIT_ASSERT( anImporter.ImportPolygons(aDoc, aSFileName, PolygonList, PolygonFaces)); Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); HYDROData_MapOfFaceToStricklerType aMapFace2ST; CPPUNIT_ASSERT_EQUAL(PolygonFaces.Length(), 6); @@ -1183,8 +1182,8 @@ void test_HYDROData_LandCoverMap::test_shp_clc_classification_perf() HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; - int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces, Type); + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces); + int Type = anImporter.GetShapeType(); CPPUNIT_ASSERT(aStat == 1); CPPUNIT_ASSERT_EQUAL(5, Type); CPPUNIT_ASSERT_EQUAL(625, PolygonFaces.Length()); @@ -1250,8 +1249,7 @@ void test_HYDROData_LandCoverMap::test_shp_clc_classification_check() HYDROData_ShapeFile anImporter; QStringList PolygonList; TopTools_SequenceOfShape PolygonFaces; - int Type = -1; - int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces, Type); + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces); CPPUNIT_ASSERT(aStat == 1); Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); HYDROData_MapOfFaceToStricklerType aMapFace2ST;