]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
LCM // Import/Export of SHP p.5
authorisn <isn@opencascade.com>
Tue, 3 Nov 2015 12:41:34 +0000 (15:41 +0300)
committerisn <isn@opencascade.com>
Tue, 3 Nov 2015 12:55:42 +0000 (15:55 +0300)
20 files changed:
src/HYDROData/HYDROData_LandCoverMap.h
src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx
src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.h
src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx
src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.h
src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx
src/HYDRO_tests/TestViewer.cxx
src/HYDRO_tests/reference_data/CLC_decoupe.prj [new file with mode: 0644]
src/HYDRO_tests/reference_data/CLC_decoupe.qpj [new file with mode: 0644]
src/HYDRO_tests/reference_data/CLC_decoupe.shp [new file with mode: 0644]
src/HYDRO_tests/reference_data/CLC_decoupe.shx [new file with mode: 0644]
src/HYDRO_tests/reference_data/NLD_water_areas_dcw.dbf [new file with mode: 0644]
src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/NLD_water_areas_dcw.prj [new file with mode: 0644]
src/HYDRO_tests/reference_data/NLD_water_areas_dcw.shp [new file with mode: 0644]
src/HYDRO_tests/reference_data/NLD_water_areas_dcw.shx [new file with mode: 0644]
src/HYDRO_tests/reference_data/clc_dec_150_350.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/cyprus_natural_all.png [new file with mode: 0644]
src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx
src/HYDRO_tests/test_HYDROData_LandCoverMap.h

index 8fa16c225fd83b5569791a719fb4c1b9e59e2fc5..f3492f17da8de64034bea85198b03f15afbdcf02 100644 (file)
@@ -123,7 +123,7 @@ protected:
 
   bool LocalPartition( const TopoDS_Shape&, const QString& theNewType );
   static TopoDS_Shape MergeFaces(const TopTools_ListOfShape& theFaces,
-                      bool IsToUnify, double theTolerance = 1E-3 );
+                      bool IsToUnify, double theTolerance = 1E-5 );
 
 public:
   DEFINE_STANDARD_RTTI( HYDROData_LandCoverMap );
index 6b96578ccf18eaf9cc33234c64f1d0eb697a0d81..7fd79557c4c827b2032a45c13dcea70c17cc8e2d 100644 (file)
@@ -46,6 +46,7 @@ HYDROGUI_ImportLandCoverMapDlg::HYDROGUI_ImportLandCoverMapDlg( HYDROGUI_Module*
   addPage( createPage2() );
   addPage( createPage3() );
   myFirstPageState = false;
+  myDbfState = false;
 }
 
 QWizardPage* HYDROGUI_ImportLandCoverMapDlg::createPage1() {
@@ -160,6 +161,8 @@ QWizardPage* HYDROGUI_ImportLandCoverMapDlg::createPage3() {
 
 HYDROGUI_ImportLandCoverMapDlg::~HYDROGUI_ImportLandCoverMapDlg()
 {
+  myPolygons->clear();
+  myDBFAttr->clear();
 }
 
 void HYDROGUI_ImportLandCoverMapDlg::reset()
@@ -215,9 +218,8 @@ QStringList HYDROGUI_ImportLandCoverMapDlg::getSelectedPolygonNames() const
   QStringList aSelectedNames;
 
   QList<QListWidgetItem*> aSelectedItems = myPolygons->selectedItems();
-  foreach( const QListWidgetItem* anItem, aSelectedItems ) {
+  foreach( const QListWidgetItem* anItem, aSelectedItems )
     aSelectedNames << anItem->text();
-  }
 
   return aSelectedNames;
 }
@@ -319,7 +321,7 @@ void HYDROGUI_ImportLandCoverMapDlg::setFirstPageState(bool bState)
 
 bool HYDROGUI_ImportLandCoverMapDlg::acceptCurrent() const
 {
-  //Check the state of curent page
+  //Check the state of the current page
   int CurrPage = wizard()->currentIndex();
   switch ( CurrPage )
   {
@@ -335,6 +337,11 @@ bool HYDROGUI_ImportLandCoverMapDlg::acceptCurrent() const
         SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), "Polygons isn't selected");
         return false;
       }
+      if (getAttrCheckBoxState() && !getDbfState())
+      {
+         SUIT_MessageBox::critical( module()->getApp()->desktop(), tr( "DBF_LOAD_ERROR" ), "Cant open DBF file or it's corrupted");
+         return false;
+      }
       break;
     }
     case 1:
@@ -347,7 +354,6 @@ bool HYDROGUI_ImportLandCoverMapDlg::acceptCurrent() const
      return false;
   }
   return true;
-
 }
 
 void HYDROGUI_ImportLandCoverMapDlg::GetAttribute2StricklerCorr(QStringList& AttrValues, QStringList& ST)
@@ -395,7 +401,17 @@ bool HYDROGUI_ImportLandCoverMapDlg::getAttrCheckBoxState() const
 
 void HYDROGUI_ImportLandCoverMapDlg::OnComboBoxColorChanged(int theInd)
 {
-  QComboBox* CB = qobject_cast<QComboBox *> (myTableW->cellWidget(theInd, 1));
+  QComboBox* CB = qobject_cast<QComboBox*> (myTableW->cellWidget(theInd, 1));
   int CurIndOfCB = CB->currentIndex();
   myTableW->item(theInd, 2)->setBackground(myStrColors[CurIndOfCB]);
+}
+
+void HYDROGUI_ImportLandCoverMapDlg::setDbfState(bool _state)
+{
+  myDbfState = _state;
+}
+
+bool HYDROGUI_ImportLandCoverMapDlg::getDbfState() const
+{
+  return myDbfState;
 }
\ No newline at end of file
index 68cbaa6a87dc51fd260a4a93d277b0937b2fdf15..22c3dea38c085cc5fee4178c09d3617d75487753 100644 (file)
@@ -43,12 +43,8 @@ public:
   void                  reset();
 
   void                  setPolygonNames( const QStringList& theNames );
-  //void                  removePolygonNames( const QStringList& theNames );
-
   void                  setSelectedPolygonNames( const QStringList& theNames );
-
   void                  setAttributeNames( const QStringList& theAttrNames );
-
   void                  FillCorrTable(const QStringList& theFirstColumn, 
                                       const QStringList& theSecondColumn,
                                       const QVector<QColor> theColors);
@@ -67,6 +63,9 @@ public:
   void                  GetAttribute2StricklerCorr(QStringList& AttrValues, QStringList& ST);
   QVector<int>          getSelectedPolygonIndices() const;
 
+  void                  setDbfState(bool _state);
+  bool                  getDbfState() const;
+
 signals:
   void                  FileSelected( const QString& theFileName );
   void                  selectionChanged( const QStringList& );
@@ -104,8 +103,8 @@ private:
 
   //State of the first page
   bool                  myFirstPageState;
-
   QVector<QColor>       myStrColors;
+  bool                  myDbfState;
 };
 
 #endif
index d410018fb9d69426e6c65c38e2c31dd94ee5b922..14c7e04ba85e2ea04369a3453788e270d2de1088 100644 (file)
@@ -178,6 +178,7 @@ void HYDROGUI_ImportLandCoverMapOp::onFileSelected()
           myPolygonName2PrsShape.insert( "polygon_" + QString::number(i), aShape);
         }
       }
+
       if ( !aCtx.IsNull() ) 
       {
         UpdateZLayersOfHilightPresentationsOfDisplayedObjects( aCtx, Graphic3d_ZLayerId_TopOSD );
@@ -186,6 +187,19 @@ void HYDROGUI_ImportLandCoverMapOp::onFileSelected()
       //
       QApplication::restoreOverrideCursor();
       aPanel->setFirstPageState(true); 
+      //
+      //Try to load DBF-database...
+      QString theDBFFileName;
+      theDBFFileName = myFileName.simplified().replace( ".shp", ".dbf", Qt::CaseInsensitive);
+      bool DBF_Stat = myImporter.DBF_OpenDBF(theDBFFileName);
+      // TODO:
+      // add MSG BOX if stat is bad
+      if (DBF_Stat)
+      {
+        myFieldList = myImporter.DBF_GetFieldList();
+        aPanel->setAttributeNames(myFieldList);
+      }
+      aPanel->setDbfState(DBF_Stat);
     }
     else
     {
@@ -193,7 +207,7 @@ void HYDROGUI_ImportLandCoverMapOp::onFileSelected()
       aPanel->setPolygonNames(QStringList());
       aPanel->setObjectName("");
       QApplication::restoreOverrideCursor();
-      QString aMess = "Cannot import land cover;\n";
+      QString aMess = "Cannot import content of this file as land cover map;\n";
       if (aStat == -1)
         aMess += "Cannot open SHP file";
       else if (aStat == -2)
@@ -223,16 +237,15 @@ HYDROGUI_InputPanel* HYDROGUI_ImportLandCoverMapOp::createInputPanel() const
 }
 
 bool HYDROGUI_ImportLandCoverMapOp::processApply( int& theUpdateFlags,
-                                                QString& theErrorMsg,
-                                                QStringList& theBrowseObjectsEntries )
+                                                  QString& theErrorMsg,
+                                                  QStringList& theBrowseObjectsEntries )
 {
 
   HYDROGUI_ImportLandCoverMapDlg* aPanel = ::qobject_cast<HYDROGUI_ImportLandCoverMapDlg*>( inputPanel() );
-  if ( !aPanel ) {
+  if ( !aPanel ) 
     return false;
-  }
 
-  Handle(HYDROData_LandCoverMap) aLCM =  Handle(HYDROData_LandCoverMap)::DownCast( doc()->CreateObject( KIND_LAND_COVER_MAP ) );
+  myLCM = Handle(HYDROData_LandCoverMap)::DownCast( doc()->CreateObject( KIND_LAND_COVER_MAP ) );
   HYDROData_MapOfFaceToStricklerType aMapFace2ST;
 
   QStringList aAttrV_T;
@@ -257,18 +270,18 @@ bool HYDROGUI_ImportLandCoverMapOp::processApply( int& theUpdateFlags,
   }
 
   //
-  aLCM->StoreLandCovers(aMapFace2ST);
+  myLCM->StoreLandCovers(aMapFace2ST);
 
   QString ObjName;
   if ( !aPanel->getFileName().isEmpty() )
     ObjName = aPanel->getObjectName();
 
-  if( !aLCM.IsNull() ) 
+  if( !myLCM.IsNull() ) 
   {
-    aLCM->SetName( ObjName );
-    aLCM->SetColor( Qt::gray );
-    aLCM->Show();
-    module()->setIsToUpdate( aLCM );
+    myLCM->SetName( ObjName );
+    myLCM->SetColor( Qt::gray );
+    myLCM->Show();
+    module()->setIsToUpdate( myLCM );
   }
   
   module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init );
@@ -362,26 +375,12 @@ void HYDROGUI_ImportLandCoverMapOp::onNext( const int theIndex )
   if ( !aPanel )
     return;
 
-  if (theIndex == 1)
-  {
-      //Try to load DBF-database...
-      QString theDBFFileName;
-      theDBFFileName = myFileName.simplified().replace( ".shp", ".dbf", Qt::CaseInsensitive);
-      bool DBF_Stat = myImporter.DBF_OpenDBF(theDBFFileName);
-      // TODO:
-      // add MSG BOX if stat is bad
-      myFieldList = myImporter.DBF_GetFieldList();
-      aPanel->setAttributeNames(myFieldList);
-  }
-
   if (theIndex == 2)
   {
     //std::vector<HYDROData_ShapeFile::DBF_AttrValue> myAttrV;
     int Ind = myFieldList.indexOf(aPanel->getSelectedFieldName());
     if (Ind == -1)
-    {
       return;
-    }
     //aPanel->setSecondPageState(true);
     myAttrV.clear();
     myImporter.DBF_GetAttributeList(Ind, myAttrV ); 
@@ -454,6 +453,9 @@ void HYDROGUI_ImportLandCoverMapOp::onApply()
   }
   else
   {
+    Handle(HYDROData_Entity) LCM = Handle(HYDROData_Entity)::DownCast( myLCM );
+    LCM->Remove();
+    module()->setObjectRemoved( myLCM );
     abort();
   }
 }
index d342380d15a73a39b8d2c5834d220f5e4047a35d..b8cfad97aaf38f3421edef0758bfde088b328dc3 100644 (file)
@@ -34,6 +34,8 @@
 class SUIT_FileDlg;
 class HYDROGUI_Shape;
 class TopoDS_Face;
+//class HYDROData_LandCoverMap;
+#include <HYDROData_LandCoverMap.h>
 
 class HYDROGUI_ImportLandCoverMapOp : public HYDROGUI_Operation
 {
@@ -66,7 +68,8 @@ private:
   HYDROData_ShapeFile myImporter;
   QString myFileName;
   QStringList myFieldList;
-  std::vector<HYDROData_ShapeFile::DBF_AttrValue> myAttrV;;
+  std::vector<HYDROData_ShapeFile::DBF_AttrValue> myAttrV;
+  Handle(HYDROData_LandCoverMap) myLCM;
 };
 
 #endif
index 766f51fe6b47998bc52bc5c3b629d877d3de36df..1bf21c52f6bbaf27d2ef9008a52826573537115a 100644 (file)
@@ -96,7 +96,7 @@ void HYDROGUI_ImportPolylineOp::onApply()
         UpdateView(theEntities);
       else
       {
-        QString aMess = "Cannot import polyline;\n";
+        QString aMess = "Cannot import content of this file as polyline;\n";
         if (aStat == -1)
           aMess += "Cannot open SHP file";
         else if (aStat == -2)
index ce1f8eb516db757642b375b903439c573328af30..fd031b6d4e69a84472e978e1bfa219dd391d6953 100644 (file)
@@ -100,7 +100,16 @@ QColor TestViewer::GetColor(int i)
          << QColor(100,100,20) 
          << QColor(10,100,150);
   }
-  return aCV[i];
+  if (i < aCV.size())
+    return aCV[i];
+  else
+  {
+    QColor TestColor = aCV[i % aCV.size()];
+    QColor NewColor((TestColor.red() + i * 41) % 256, 
+      (TestColor.green() + i * 13) % 256, 
+      (TestColor.blue() + i * 23) % 256);
+    return NewColor;
+  }
 }
 
 void TestViewer::show( const Handle(AIS_InteractiveObject)& theObject,
diff --git a/src/HYDRO_tests/reference_data/CLC_decoupe.prj b/src/HYDRO_tests/reference_data/CLC_decoupe.prj
new file mode 100644 (file)
index 0000000..5adb2a9
--- /dev/null
@@ -0,0 +1 @@
+PROJCS["RGF93_Lambert_93",GEOGCS["GCS_RGF93",DATUM["D_RGF_1993",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",44],PARAMETER["latitude_of_origin",46.5],PARAMETER["central_meridian",3],PARAMETER["false_easting",700000],PARAMETER["false_northing",6600000],UNIT["Meter",1]]
\ No newline at end of file
diff --git a/src/HYDRO_tests/reference_data/CLC_decoupe.qpj b/src/HYDRO_tests/reference_data/CLC_decoupe.qpj
new file mode 100644 (file)
index 0000000..52a60bf
--- /dev/null
@@ -0,0 +1 @@
+PROJCS["RGF93 / Lambert-93",GEOGCS["RGF93",DATUM["Reseau_Geodesique_Francais_1993",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6171"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4171"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",44],PARAMETER["latitude_of_origin",46.5],PARAMETER["central_meridian",3],PARAMETER["false_easting",700000],PARAMETER["false_northing",6600000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","2154"]]
diff --git a/src/HYDRO_tests/reference_data/CLC_decoupe.shp b/src/HYDRO_tests/reference_data/CLC_decoupe.shp
new file mode 100644 (file)
index 0000000..1628967
Binary files /dev/null and b/src/HYDRO_tests/reference_data/CLC_decoupe.shp differ
diff --git a/src/HYDRO_tests/reference_data/CLC_decoupe.shx b/src/HYDRO_tests/reference_data/CLC_decoupe.shx
new file mode 100644 (file)
index 0000000..6a89e3a
Binary files /dev/null and b/src/HYDRO_tests/reference_data/CLC_decoupe.shx differ
diff --git a/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.dbf b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.dbf
new file mode 100644 (file)
index 0000000..e635c1b
Binary files /dev/null and b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.dbf differ
diff --git a/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png
new file mode 100644 (file)
index 0000000..8c12579
Binary files /dev/null and b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png differ
diff --git a/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.prj b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.prj
new file mode 100644 (file)
index 0000000..f45cbad
--- /dev/null
@@ -0,0 +1 @@
+GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
\ No newline at end of file
diff --git a/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.shp b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.shp
new file mode 100644 (file)
index 0000000..241ace7
Binary files /dev/null and b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.shp differ
diff --git a/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.shx b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.shx
new file mode 100644 (file)
index 0000000..9dff31e
Binary files /dev/null and b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.shx differ
diff --git a/src/HYDRO_tests/reference_data/clc_dec_150_350.png b/src/HYDRO_tests/reference_data/clc_dec_150_350.png
new file mode 100644 (file)
index 0000000..85a6800
Binary files /dev/null and b/src/HYDRO_tests/reference_data/clc_dec_150_350.png differ
diff --git a/src/HYDRO_tests/reference_data/cyprus_natural_all.png b/src/HYDRO_tests/reference_data/cyprus_natural_all.png
new file mode 100644 (file)
index 0000000..b7cbfd9
Binary files /dev/null and b/src/HYDRO_tests/reference_data/cyprus_natural_all.png differ
index 2cb5dead698d3bd5a70225e65891b0cb008c7193..fb7e80535a2dc07a0abcef6e004055e826da2336 100644 (file)
 #include <HYDROData_PolylineXY.h>
 #include <HYDROData_StricklerTable.h>
 #include <HYDROData_Tool.h>
+#include <HYDROData_ShapeFile.h>
 #include <HYDROGUI_LandCoverMapPrs.h>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Wire.hxx>
 #include <TopoDS_Face.hxx>
+#include <TopoDS.hxx>
 #include <TestViewer.h>
 #include <TestShape.h>
 #include <TopTools_ListOfShape.hxx>
@@ -678,3 +680,94 @@ void test_HYDROData_LandCoverMap::test_assign_to_calc_case()
 
   aDoc->Close();
 }
+
+void test_HYDROData_LandCoverMap::test_shp_import_cyp()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  QString myFileName = REF_DATA_PATH + "/cyprus_natural.shp";
+  HYDROData_ShapeFile anImporter;
+  QStringList PolygonList;
+  TopTools_SequenceOfShape PolygonFaces;
+  int Type = -1;
+  int aStat = anImporter.ImportPolygons(myFileName, PolygonList, PolygonFaces, Type);
+  CPPUNIT_ASSERT(aStat == 1);
+  CPPUNIT_ASSERT_EQUAL(5, Type);
+  CPPUNIT_ASSERT_EQUAL(268, PolygonFaces.Length());
+  
+  Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+  HYDROData_MapOfFaceToStricklerType aMapFace2ST;
+
+  for ( int i = 1; i <= PolygonFaces.Length(); i++ )
+  {
+    TopoDS_Shape aShape = PolygonFaces(i);
+    if ( aShape.IsNull() ) 
+      continue;
+    aMapFace2ST.Add( TopoDS::Face( aShape ), "" );
+  }
+
+  LCM->StoreLandCovers(aMapFace2ST);
+  TestViewer::show( LCM->GetShape(), AIS_Shaded, true, "cyprus_natural_all" );
+  CPPUNIT_ASSERT_IMAGES
+  aDoc->Close();
+}
+
+void test_HYDROData_LandCoverMap::test_shp_import_clc_dec()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  QString myFileName = REF_DATA_PATH + "/CLC_decoupe.shp";
+  HYDROData_ShapeFile anImporter;
+  QStringList PolygonList;
+  TopTools_SequenceOfShape PolygonFaces;
+  int Type = -1;
+  int aStat = anImporter.ImportPolygons(myFileName, PolygonList, PolygonFaces, Type);
+  CPPUNIT_ASSERT(aStat == 1);
+  CPPUNIT_ASSERT_EQUAL(5, Type);
+  CPPUNIT_ASSERT_EQUAL(625, PolygonFaces.Length());
+  
+  Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+  HYDROData_MapOfFaceToStricklerType aMapFace2ST;
+
+  for ( int i = 150; i <= 350; i++ )
+  {
+    TopoDS_Shape aShape = PolygonFaces(i);
+    if ( aShape.IsNull() ) 
+      continue;
+    aMapFace2ST.Add( TopoDS::Face( aShape ), "" );
+  }
+
+  LCM->StoreLandCovers(aMapFace2ST);
+  TestViewer::show( LCM->GetShape(), AIS_Shaded, true, "clc_dec_150_350" );
+  CPPUNIT_ASSERT_IMAGES
+  aDoc->Close();
+}
+
+void test_HYDROData_LandCoverMap::test_shp_import_nld_areas()
+{
+  Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1);
+  QString myFileName = REF_DATA_PATH + "/NLD_water_areas_dcw.shp";
+  HYDROData_ShapeFile anImporter;
+  QStringList PolygonList;
+  TopTools_SequenceOfShape PolygonFaces;
+  int Type = -1;
+  int aStat = anImporter.ImportPolygons(myFileName, PolygonList, PolygonFaces, Type);
+  CPPUNIT_ASSERT(aStat == 1);
+  CPPUNIT_ASSERT_EQUAL(5, Type);
+  CPPUNIT_ASSERT_EQUAL(127, PolygonFaces.Length());
+  
+  Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) );
+  HYDROData_MapOfFaceToStricklerType aMapFace2ST;
+
+  for ( int i = 1; i <= PolygonFaces.Length(); i++ )
+  {
+    TopoDS_Shape aShape = PolygonFaces(i);
+    if ( aShape.IsNull() ) 
+      continue;
+    aMapFace2ST.Add( TopoDS::Face( aShape ), "" );
+  }
+
+  LCM->StoreLandCovers(aMapFace2ST);
+  TestViewer::show( LCM->GetShape(), AIS_Shaded, true, "NLD_water_areas_dcw" );
+  CPPUNIT_ASSERT_IMAGES
+  aDoc->Close();
+}
+
index 4d0ccc9e5c7c6ff7c1806814534b8a8d31778990..7d5a88aa31fc3a4d760f47037ba48c7fc8d08e21 100644 (file)
@@ -21,6 +21,7 @@
 #endif
 
 #include <cppunit/extensions/HelperMacros.h>
+#define SHP_TESTS
 
 class test_HYDROData_LandCoverMap : public CppUnit::TestFixture
 {
@@ -39,6 +40,11 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture
   CPPUNIT_TEST( test_dump_python );
   CPPUNIT_TEST( test_transparent_prs );
   CPPUNIT_TEST( test_assign_to_calc_case );
+#ifdef SHP_TESTS
+  CPPUNIT_TEST( test_shp_import_cyp );
+  CPPUNIT_TEST( test_shp_import_clc_dec );
+  CPPUNIT_TEST( test_shp_import_nld_areas );
+#endif
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -56,6 +62,9 @@ public:
   void test_dump_python();
   void test_transparent_prs();
   void test_assign_to_calc_case();
+  void test_shp_import_cyp();
+  void test_shp_import_clc_dec();
+  void test_shp_import_nld_areas();
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap );