From: isn Date: Thu, 12 Oct 2017 13:19:24 +0000 (+0300) Subject: loadImage() for py scripts X-Git-Tag: v2.1~66^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8d4dba4a45855249f5eb022e9cc7dcff202bce3c;p=modules%2Fhydro.git loadImage() for py scripts --- diff --git a/src/HYDROData/HYDROData_Image.cxx b/src/HYDROData/HYDROData_Image.cxx index fa024b5a..ff649a20 100644 --- a/src/HYDROData/HYDROData_Image.cxx +++ b/src/HYDROData/HYDROData_Image.cxx @@ -43,6 +43,7 @@ #include #include +#include #ifdef WIN32 #pragma warning ( default: 4251 ) @@ -310,10 +311,19 @@ void HYDROData_Image::SetImage(const QImage& theImage) bool HYDROData_Image::LoadImage( const QString& theFilePath ) { - QImage anImage( theFilePath ); + QFileInfo aFI(theFilePath); + QImage anImage; + HYDROData_Image::ECW_FileInfo* theECWInfo; + if (aFI.suffix().toLower() == "ecw") + { + theECWInfo = new HYDROData_Image::ECW_FileInfo; + HYDROData_Image::OpenECW(theFilePath.toLatin1().data(), anImage, theECWInfo); + } + else + anImage = QImage(theFilePath); SetImage( anImage ); SetFilePath( theFilePath ); - return !anImage.isNull(); //TODO open ecw from this func! + return !anImage.isNull(); } bool HYDROData_Image::OpenECW(char* theFileName, QImage& theImage, ECW_FileInfo* theECWInfo) diff --git a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx index 8116bfd5..8ad0fcbd 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx @@ -813,7 +813,7 @@ void HYDROGUI_ImportImageDlg::ActivateFile( const QString& theFileName, bool isE QFileInfo aFI( theFileName ); QImage anImage; HYDROData_Image::ECW_FileInfo* theECWInfo = NULL; - if (aFI.completeSuffix().toLower() == "ecw") + if (aFI.suffix().toLower() == "ecw") { theECWInfo = new HYDROData_Image::ECW_FileInfo; HYDROData_Image::OpenECW(theFileName.toLatin1().data(), anImage, theECWInfo);