]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
minor changes of ImportPolygons() API
authorisn <isn@opencascade.com>
Mon, 18 Feb 2019 17:17:51 +0000 (20:17 +0300)
committerisn <isn@opencascade.com>
Mon, 18 Feb 2019 17:24:56 +0000 (20:24 +0300)
src/HYDROData/HYDROData_LandCoverMap.cxx
src/HYDROData/HYDROData_ShapeFile.cxx
src/HYDROData/HYDROData_ShapeFile.h
src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx

index f80ad2506a2fc1d176b3e980c4563bb044701611..f069df13dd3880cf3c01e1909df4564575e9186b 100755 (executable)
@@ -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;
index 4d7519ac0cf16a6c1edbfb8b37abb094f1689861..fc09314676e99f62905d66bc3fc6a250454fc19b 100644 (file)
@@ -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);
index 586c5c20ef9755093e72fad770b2bae6974cb0e0..17996338f5caa5f01aa7333fe9f0ba66ff15bddd 100644 (file)
@@ -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();
 
index c4a5a0d5f851756953061a3ce8aad9cf2e8f28d3..7b8fedb099aefe2f2552dd754f93ab076b9ce576 100644 (file)
@@ -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);
index 922a7c3351494a23936556333d809795d3ffc286..b1eb3e1a6e58335323f5f3df18a6c698d906f4e1 100644 (file)
@@ -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;