]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
loadImage() for py scripts
authorisn <isn@opencascade.com>
Thu, 12 Oct 2017 13:19:24 +0000 (16:19 +0300)
committerisn <isn@opencascade.com>
Thu, 12 Oct 2017 13:19:24 +0000 (16:19 +0300)
src/HYDROData/HYDROData_Image.cxx
src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx

index fa024b5ae1dd0b2b7f476cf40b18a4de4508427d..ff649a207f52e9b99862b84ce1c435db08eda780 100644 (file)
@@ -43,6 +43,7 @@
 
 #include <QStringList>
 #include <QFile>
+#include <QFileInfo>
 
 #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)
index 8116bfd5ddb43cf09809457da737a7d5b152e44f..8ad0fcbd95835e930d527bf9389e1113110211e7 100644 (file)
@@ -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);