]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
bug fixes/improvements (678, 681, 679, etc..)
authorisn <isn@opencascade.com>
Mon, 16 Nov 2015 12:14:08 +0000 (15:14 +0300)
committerisn <isn@opencascade.com>
Mon, 16 Nov 2015 12:53:53 +0000 (15:53 +0300)
src/HYDROData/HYDROData_LandCoverMap.cxx
src/HYDROData/HYDROData_ShapeFile.cxx
src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx
src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDRO_tests/test_HYDROData_LandCoverMap.h

index 227405ca4c7a7b457f0857e0564866e645721357..951f77d398cabb6c7426dc71c598d5124e8d215e 100644 (file)
@@ -939,7 +939,6 @@ QStringList HYDROData_LandCoverMap::DumpToPython( const QString&       thePyScri
   QString aDbfFileName = thePyScriptPath;
   aDbfFileName.replace( ".py", ".dbf" );
 
-  //TODO: export shape file
   ExportSHP( aShpFileName );
 
   QString anAttr = "CODE_06"; //TODO: some custom choice
index 987b1f3d2c42fa3a9dc99ae76d6e6ff3a699fbd8..c968e72c42eb46608d0ef826defc91aeab2cb661 100644 (file)
@@ -90,7 +90,7 @@ void HYDROData_ShapeFile::Export(const QString& aFileName,
     SHPClose( hSHPHandle );
     QString aFN = aFileName.simplified();
     remove (aFN.toStdString().c_str());
-    remove (aFN.replace( ".shp", ".shx", Qt::CaseInsensitive).toStdString().c_str());
+    remove ((aFN.simplified().replace( aFN.simplified().size() - 4, 4, ".shx")).toStdString().c_str());
   }
 }
 
@@ -116,7 +116,7 @@ void HYDROData_ShapeFile::Export(const QString& aFileName,
     SHPClose( hSHPHandle );
     QString aFN = aFileName.simplified();
     remove (aFN.toStdString().c_str());
-    remove (aFN.replace( ".shp", ".shx", Qt::CaseInsensitive).toStdString().c_str());
+    remove ((aFN.simplified().replace( aFN.simplified().size() - 4, 4, ".shx")).toStdString().c_str());
   }
 }
 
@@ -660,7 +660,7 @@ QString HYDROData_ShapeFile::GetShapeTypeName(int theType)
 int HYDROData_ShapeFile::TryOpenShapeFile(QString theFileName)
 {
   QString aSHPfile = theFileName.simplified();
-  QString aSHXfile = theFileName.simplified().replace( ".shp", ".shx", Qt::CaseInsensitive);
+  QString aSHXfile = theFileName.simplified().replace( theFileName.simplified().size() - 4, 4, ".shx");
   FILE* pFileSHP = NULL;
   pFileSHP = fopen (aSHPfile.toAscii().data(), "r");
   FILE* pFileSHX = NULL;
@@ -683,7 +683,7 @@ int HYDROData_ShapeFile::TryOpenShapeFile(QString theFileName)
 bool HYDROData_ShapeFile::CheckDBFFileExisting(const QString& theSHPFilePath, QString& thePathToDBFFile)
 {
   QString aSHPfile = theSHPFilePath.simplified();
-  QString aDBFfile = theSHPFilePath.simplified().replace( ".shp", ".dbf", Qt::CaseInsensitive);
+  QString aDBFfile = theSHPFilePath.simplified().replace( theSHPFilePath.simplified().size() - 4, 4, ".dbf");
   FILE* pFileDBF = NULL;
   pFileDBF = fopen (aDBFfile.toAscii().data(), "r");
 
index d47a03a71c63f57c52a1eec0f3cef162819d27f8..82e4b9d703bf2c846b771be3e8d2606d296cc23e 100644 (file)
@@ -55,7 +55,7 @@ QWizardPage* HYDROGUI_ImportLandCoverMapDlg::createPage1() {
 
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
 
-  myFileNameGroup = new QGroupBox( tr( "IMPORT_LANDCOVERMAP_FROM_FILE" ) );
+  myFileNameGroup = new QGroupBox( tr( "IMPORT_LANDCOVER_MAP_FROM_FILE" ) );
 
   QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), myFileNameGroup );
 
@@ -214,7 +214,7 @@ QStringList HYDROGUI_ImportLandCoverMapDlg::getSelectedPolygonNames() const
 void HYDROGUI_ImportLandCoverMapDlg::onBrowse()
 {
   QString aFilter( tr( "LANDCOVERMAP_FILTER" ) );
-  QString aFileName = SUIT_FileDlg::getFileName( this, "", aFilter, tr( "IMPORT_LANDCOVERMAP_FROM_FILE" ), true );
+  QString aFileName = SUIT_FileDlg::getFileName( this, "", aFilter, tr( "IMPORT_LANDCOVER_MAP_FROM_FILE" ), true );
 
   if( !aFileName.isEmpty() )
   {
index 9708f6563ee4437f6e19aac542ffec6a09aded9d..3e77bd374e1adc2b21688298ea200698fa9efa6f 100644 (file)
@@ -67,7 +67,7 @@
 HYDROGUI_ImportLandCoverMapOp::HYDROGUI_ImportLandCoverMapOp( HYDROGUI_Module* theModule )
 : HYDROGUI_Operation( theModule )
 {
-  setName( tr( "IMPORT_LANDCOVERMAP" ) );
+  setName( tr( "IMPORT_LANDCOVER_MAP" ) );
 }
 
 HYDROGUI_ImportLandCoverMapOp::~HYDROGUI_ImportLandCoverMapOp()
@@ -182,7 +182,7 @@ void HYDROGUI_ImportLandCoverMapOp::onFileSelected()
       //
       //Try to load DBF-database...
       QString aDBFFileName;
-      aDBFFileName = myFileName.simplified().replace( ".shp", ".dbf", Qt::CaseInsensitive);
+      aDBFFileName = myFileName.simplified().replace( myFileName.simplified().size() - 4, 4, ".dbf");
       bool DBF_Stat = myImporter.DBF_OpenDBF(aDBFFileName);
       // TODO:
       // add MSG BOX if stat is bad
@@ -206,7 +206,7 @@ void HYDROGUI_ImportLandCoverMapOp::onFileSelected()
         aMess += tr( "CANNT_OPEN_SHX" );
       else 
         aMess += tr ("SHP_TYPEFORMAT_MESS") + myImporter.GetShapeTypeName(aShapeTypeOfFile);
-      SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "IMPORT_LANDCOVER" ), aMess);
+      SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "IMPORT_LANDCOVER_MAP" ), aMess);
       commitDocOperation();
       myImporter.Free();
       //abort();
index bc48132d84956280752b5665c13476a6db7d0287..1b5df3eae3c915806156f7c955b61e724dff6bba 100644 (file)
@@ -2322,7 +2322,7 @@ file cannot be correctly imported for an Obstacle definition.</translation>
       <translation>Shape files (*.shp)</translation>
     </message>
     <message>
-      <source>IMPORT_LANDCOVERMAP_FROM_FILE</source>
+      <source>IMPORT_LANDCOVER_MAP_FROM_FILE</source>
       <translation>Import land cover map from file</translation>
     </message>
     <message>
index 041b705f04b0ab41c8f290a312a07ccdda5d6ad4..36c8f6bd8ca1cd81ff47233a18488baa67760fe4 100644 (file)
@@ -21,7 +21,7 @@
 #endif
 
 #include <cppunit/extensions/HelperMacros.h>
-//#define SHP_TESTS
+#define SHP_TESTS
 
 class test_HYDROData_LandCoverMap : public CppUnit::TestFixture
 {