From: isn Date: Mon, 16 Nov 2015 12:14:08 +0000 (+0300) Subject: bug fixes/improvements (678, 681, 679, etc..) X-Git-Tag: v1.5~37^2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1e2e53d3b9cf6c62ed41e72a0685f7fbb115906c;p=modules%2Fhydro.git bug fixes/improvements (678, 681, 679, etc..) --- diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index 227405ca..951f77d3 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -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 diff --git a/src/HYDROData/HYDROData_ShapeFile.cxx b/src/HYDROData/HYDROData_ShapeFile.cxx index 987b1f3d..c968e72c 100644 --- a/src/HYDROData/HYDROData_ShapeFile.cxx +++ b/src/HYDROData/HYDROData_ShapeFile.cxx @@ -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"); diff --git a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx index d47a03a7..82e4b9d7 100644 --- a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapDlg.cxx @@ -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() ) { diff --git a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx index 9708f656..3e77bd37 100644 --- a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx @@ -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(); diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index bc48132d..1b5df3ea 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -2322,7 +2322,7 @@ file cannot be correctly imported for an Obstacle definition. Shape files (*.shp) - IMPORT_LANDCOVERMAP_FROM_FILE + IMPORT_LANDCOVER_MAP_FROM_FILE Import land cover map from file diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h index 041b705f..36c8f6bd 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h @@ -21,7 +21,7 @@ #endif #include -//#define SHP_TESTS +#define SHP_TESTS class test_HYDROData_LandCoverMap : public CppUnit::TestFixture {