#include <QStringList>
#include <QFile>
+#include <QFileInfo>
#ifdef WIN32
#pragma warning ( default: 4251 )
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)
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);