From 55b90c28248cba37e6d70a62c0e7c0435615d14b Mon Sep 17 00:00:00 2001 From: isn Date: Tue, 10 Oct 2017 16:42:53 +0300 Subject: [PATCH] import ECW files #1 --- src/HYDROData/CMakeLists.txt | 13 ++- src/HYDROData/HYDROData_Entity.h | 12 +++ src/HYDROData/HYDROData_Image.cxx | 97 +++++++++++++++++- src/HYDROData/HYDROData_Image.h | 28 ++++++ src/HYDROData/HYDROData_Tool.cxx | 3 +- src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx | 115 +++++++++++++++++++++- src/HYDROGUI/HYDROGUI_ImportImageDlg.h | 7 +- src/HYDROGUI/HYDROGUI_ImportImageOp.cxx | 12 ++- src/HYDROGUI/HYDROGUI_ImportImageOp.h | 2 +- src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 2 +- src/HYDROPy/CMakeLists.txt | 2 +- src/HYDRO_tests/CMakeLists.txt | 11 ++- 12 files changed, 289 insertions(+), 15 deletions(-) diff --git a/src/HYDROData/CMakeLists.txt b/src/HYDROData/CMakeLists.txt index e831498a..1d507ef4 100644 --- a/src/HYDROData/CMakeLists.txt +++ b/src/HYDROData/CMakeLists.txt @@ -128,6 +128,15 @@ set(PROJECT_SOURCES HYDROData_DTM.cxx ) +SET( ECW_INCLUDES $ENV{ECWLIB_ROOT_DIR}/include ) +link_directories( $ENV{ECWLIB_ROOT_DIR}/lib ) + +IF( ${WIN32} ) + SET( ECW_LIBRARIES libecwj2 ) +ELSE() + SET( ECW_LIBRARIES libecwj2 ) +ENDIF() + add_definitions( -DHYDRODATA_EXPORTS ${CAS_DEFINITIONS} @@ -145,12 +154,14 @@ include_directories( ${KERNEL_INCLUDE_DIRS} ${GUI_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/../shapelib + ${ECW_INCLUDES} ) add_library(HYDROData SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) +set_target_properties( HYDROData PROPERTIES LINK_INTERFACE_LIBRARIES "" ) target_link_libraries(HYDROData shapelib ${GEOM_GEOMUtils} ${CAS_OCAF} ${CAS_OCAFVIS} ${CAS_TKG3d} ${CAS_TKGeomBase} ${CAS_TKGeomAlgo} ${CAS_TKBrep} ${CAS_TKIGES} ${CAS_TKSTEP} ${CAS_TKTopAlgo} ${CAS_TKBO} ${CAS_TKBool} ${CAS_TKOffset} ${VTK_LIBRARIES} - ${QT_LIBRARIES} ${GUI_ImageComposer} ${CAS_TKHLR} ${GEOM_GEOM} ${GEOM_GEOMBase} ${GEOM_CurveCreator} ) + ${QT_LIBRARIES} ${GUI_ImageComposer} ${CAS_TKHLR} ${GEOM_GEOM} ${GEOM_GEOMBase} ${GEOM_CurveCreator} ${ECW_LIBRARIES} ) INSTALL(TARGETS HYDROData EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) set(PROJECT_LIBRARIES shapelib HYDROData) diff --git a/src/HYDROData/HYDROData_Entity.h b/src/HYDROData/HYDROData_Entity.h index 7042b8d0..a135d939 100644 --- a/src/HYDROData/HYDROData_Entity.h +++ b/src/HYDROData/HYDROData_Entity.h @@ -19,6 +19,9 @@ #ifndef HYDROData_Entity_HeaderFile #define HYDROData_Entity_HeaderFile +#pragma comment(lib, "C:/libecw-master/lib/NCSUtild.lib") +#pragma comment(lib, "C:/libecw-master/lib/NCSEcwd.lib") + #include "HYDROData.h" #include #include @@ -26,6 +29,15 @@ #include #include + +#ifdef NONLS +#undef NONLS +#endif + +#ifdef NOMINMAX +#undef NOMINMAX +#endif + class QColor; class QVariant; class QStringList; diff --git a/src/HYDROData/HYDROData_Image.cxx b/src/HYDROData/HYDROData_Image.cxx index 74c278b4..fa024b5a 100644 --- a/src/HYDROData/HYDROData_Image.cxx +++ b/src/HYDROData/HYDROData_Image.cxx @@ -31,6 +31,9 @@ #include #include +#include +#include + #ifdef WIN32 #pragma warning ( disable: 4251 ) #endif @@ -309,9 +312,101 @@ bool HYDROData_Image::LoadImage( const QString& theFilePath ) { QImage anImage( theFilePath ); SetImage( anImage ); - SetFilePath( theFilePath ); + return !anImage.isNull(); //TODO open ecw from this func! +} + +bool HYDROData_Image::OpenECW(char* theFileName, QImage& theImage, ECW_FileInfo* theECWInfo) +{ + NCSFileView *pNCSFileView; + NCSFileViewFileInfo *pNCSFileInfo; + NCSError eError = NCS_SUCCESS; + UINT32 band, nBands; + UINT32 XSize, YSize; + NCSecwInit(); + + eError = NCScbmOpenFileView(theFileName, &pNCSFileView, NULL); + if(eError != NCS_SUCCESS) + return false; + + eError = NCScbmGetViewFileInfo(pNCSFileView, &pNCSFileInfo); + if(eError != NCS_SUCCESS) + return false; + + XSize = pNCSFileInfo->nSizeX; + YSize = pNCSFileInfo->nSizeY; + nBands = pNCSFileInfo->nBands; + if (theECWInfo) + { + //ECW_CellUnits myCellSizeUnits; + CellSizeUnits aCellUnits = pNCSFileInfo->eCellSizeUnits; + if (aCellUnits == ECW_CELL_UNITS_METERS) + theECWInfo->myCellSizeUnits = ECW_CellUnits_Meters; + else if (aCellUnits == ECW_CELL_UNITS_DEGREES) + theECWInfo->myCellSizeUnits = ECW_CellUnits_Deg; + else if (aCellUnits == ECW_CELL_UNITS_FEET) + theECWInfo->myCellSizeUnits = ECW_CellUnits_Feet; + else + theECWInfo->myCellSizeUnits = ECW_CellUnits_Unknown; + theECWInfo->myCellIncrementX = pNCSFileInfo->fCellIncrementX; + theECWInfo->myCellIncrementY = pNCSFileInfo->fCellIncrementY; + theECWInfo->myOriginX = pNCSFileInfo->fOriginX; + theECWInfo->myOriginY = pNCSFileInfo->fOriginY; + theECWInfo->myXSize = pNCSFileInfo->nSizeX; + theECWInfo->myYSize = pNCSFileInfo->nSizeY; + } + + std::vector band_list(nBands); + for( band = 0; band < nBands; band++ ) + band_list[band] = band; + + eError = NCScbmSetFileView(pNCSFileView, nBands, &band_list[0], 0, 0, XSize - 1, YSize - 1, XSize, YSize); //view an image into the original size + + if(eError != NCS_SUCCESS) + { + NCScbmCloseFileView(pNCSFileView); + return false; + } + + UINT8 *pRGBTriplets; + pRGBTriplets = (UINT8 *) malloc(XSize*3); + + QImage anImage(XSize, YSize, QImage::Format_RGB32); + for(UINT32 line = 0; line < YSize; line++) + { + NCSEcwReadStatus eStatus; + eStatus = NCScbmReadViewLineRGB(pNCSFileView, pRGBTriplets); + if(eStatus == NCSECW_READ_OK) + { + QRgb* crp = (QRgb*)anImage.scanLine(line); + for(UINT32 j = 0; j < XSize; j++) + { + QRgb val = qRgb((int)pRGBTriplets[j*3],(int)pRGBTriplets[j*3+1],(int)pRGBTriplets[j*3+2]); + memcpy((void*)(crp+j), &val, sizeof(QRgb)); + } + } + else + { + free(pRGBTriplets); + NCScbmCloseFileView(pNCSFileView); + return false; + } + } + + free(pRGBTriplets); + NCScbmCloseFileView(pNCSFileView); + theImage = anImage; +} + +bool HYDROData_Image::LoadImageECW( const QString& theFilePath ) +{ + QImage anImage; + if (HYDROData_Image::OpenECW(theFilePath.toLatin1().data(), anImage, NULL)) + { + SetImage( anImage ); + SetFilePath( theFilePath ); + } return !anImage.isNull(); } diff --git a/src/HYDROData/HYDROData_Image.h b/src/HYDROData/HYDROData_Image.h index 5be02dee..31e5b691 100644 --- a/src/HYDROData/HYDROData_Image.h +++ b/src/HYDROData/HYDROData_Image.h @@ -51,6 +51,25 @@ public: ReferenceImage }; + enum ECW_CellUnits + { + ECW_CellUnits_Meters = 1, + ECW_CellUnits_Deg = 2, + ECW_CellUnits_Feet = 3, + ECW_CellUnits_Unknown = -1 + }; + + struct ECW_FileInfo + { + ECW_CellUnits myCellSizeUnits; + double myCellIncrementX; + double myCellIncrementY; + double myOriginX; + double myOriginY; + int myXSize; + int myYSize; + }; + protected: /** * Enumeration of tags corresponding to the persistent object parameters. @@ -117,6 +136,15 @@ public: */ HYDRODATA_EXPORT bool LoadImage(const QString& theFilePath); + /** + * Load the ECW image from file + * \param theFilePath path to image + */ + HYDRODATA_EXPORT bool LoadImageECW( const QString& theFilePath ); + + + HYDRODATA_EXPORT static bool OpenECW(char* theFileName, QImage& theImage, ECW_FileInfo* theECWInfo); + /** * Returns the kept image */ diff --git a/src/HYDROData/HYDROData_Tool.cxx b/src/HYDROData/HYDROData_Tool.cxx index 417b7156..b45c2970 100644 --- a/src/HYDROData/HYDROData_Tool.cxx +++ b/src/HYDROData/HYDROData_Tool.cxx @@ -54,8 +54,7 @@ #include #include -static int aMaxNameId = std::numeric_limits::max(); - +static int aMaxNameId = INT_MAX; void HYDROData_Tool::WriteStringsToFile( QFile& theFile, const QStringList& theStrings, const QString& theSep ) diff --git a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx index 2a65913e..8116bfd5 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx @@ -661,6 +661,108 @@ void HYDROGUI_ImportImageDlg::initializePointSelection() blockSignalsCartesian( false ); } +void HYDROGUI_ImportImageDlg::ECW_initializePointSelection(HYDROData_Image::ECW_FileInfo* theECW_FileInfo) +{ + if( myIsInitialized ) + return; + + myIsInitialized = true; + + myPointBtnMap[ HYDROGUI_PrsImage::PointA ]->setChecked( true ); + myPointBtnMap[ HYDROGUI_PrsImage::PointB ]->setChecked( true ); + myPointBtnMap[ HYDROGUI_PrsImage::PointC ]->setChecked( true ); + + setByTwoPoints(false); + + HYDROData_Image::ECW_CellUnits Units = theECW_FileInfo->myCellSizeUnits; + + if (Units == HYDROData_Image::ECW_CellUnits::ECW_CellUnits_Deg) + { + blockSignalsGeodesic( true ); + double Xa, Ya, Xb, Yb, Xc, Yc; + Xa = theECW_FileInfo->myOriginX; + Ya = theECW_FileInfo->myOriginY; + Xb = theECW_FileInfo->myOriginX; + Yb = theECW_FileInfo->myOriginY + theECW_FileInfo->myCellIncrementY * theECW_FileInfo->myYSize; + Xc = theECW_FileInfo->myOriginX + theECW_FileInfo->myCellIncrementX * theECW_FileInfo->myXSize; + Yc = theECW_FileInfo->myOriginY; + + int Deg = 0, Min = 0; + double Sec = 0.0; + // + HYDROData_Lambert93::degToDMS( Xa, Deg, Min, Sec ); + myPointXDegMap[HYDROGUI_PrsImage::PointA]->setValue(Deg); + myPointXMinMap[HYDROGUI_PrsImage::PointA]->setValue(Min); + myPointXSecMap[HYDROGUI_PrsImage::PointA]->setValue(Sec); + HYDROData_Lambert93::degToDMS( Ya, Deg, Min, Sec ); + myPointYDegMap[HYDROGUI_PrsImage::PointA]->setValue(Deg); + myPointYMinMap[HYDROGUI_PrsImage::PointA]->setValue(Min); + myPointYSecMap[HYDROGUI_PrsImage::PointA]->setValue(Sec); + // + HYDROData_Lambert93::degToDMS( Xb, Deg, Min, Sec ); + myPointXDegMap[HYDROGUI_PrsImage::PointB]->setValue(Deg); + myPointXMinMap[HYDROGUI_PrsImage::PointB]->setValue(Min); + myPointXSecMap[HYDROGUI_PrsImage::PointB]->setValue(Sec); + HYDROData_Lambert93::degToDMS( Yb, Deg, Min, Sec ); + myPointYDegMap[HYDROGUI_PrsImage::PointB]->setValue(Deg); + myPointYMinMap[HYDROGUI_PrsImage::PointB]->setValue(Min); + myPointYSecMap[HYDROGUI_PrsImage::PointB]->setValue(Sec); + // + HYDROData_Lambert93::degToDMS( Xc, Deg, Min, Sec ); + myPointXDegMap[HYDROGUI_PrsImage::PointC]->setValue(Deg); + myPointXMinMap[HYDROGUI_PrsImage::PointC]->setValue(Min); + myPointXSecMap[HYDROGUI_PrsImage::PointC]->setValue(Sec); + HYDROData_Lambert93::degToDMS( Yc, Deg, Min, Sec ); + myPointYDegMap[HYDROGUI_PrsImage::PointC]->setValue(Deg); + myPointYMinMap[HYDROGUI_PrsImage::PointC]->setValue(Min); + myPointYSecMap[HYDROGUI_PrsImage::PointC]->setValue(Sec); + // + for( int aPointType = HYDROGUI_PrsImage::PointA; aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ ) + onGeodesicCoordChanged( aPointType ); + blockSignalsGeodesic( false ); + setTransformationMode( HYDROData_Image::ManualGeodesic ); + } + if (Units == HYDROData_Image::ECW_CellUnits::ECW_CellUnits_Meters || + Units == HYDROData_Image::ECW_CellUnits::ECW_CellUnits_Feet ) + { + double Coeff = 1; + if (Units == HYDROData_Image::ECW_CellUnits::ECW_CellUnits_Feet) + Coeff = 0.3048; //feets + blockSignalsCartesian( true ); + double X1 = 0, Y1 = 0, X2 = 0, Y2 = 0, X3 = 0, Y3 = 0; + X1 = theECW_FileInfo->myOriginX; + Y1 = theECW_FileInfo->myOriginY; + X2 = theECW_FileInfo->myOriginX; + Y2 = theECW_FileInfo->myOriginY + Coeff * theECW_FileInfo->myCellIncrementY * theECW_FileInfo->myXSize; + X3 = theECW_FileInfo->myOriginX + Coeff * theECW_FileInfo->myCellIncrementX * theECW_FileInfo->myYSize; + Y3 = theECW_FileInfo->myOriginY; + + //extract to A-point (top-left), B-point (bottom-left), C-Point (top-right) + double Xa = 0, Ya = 0, Xb = 0, Yb = 0, Xc = 0, Yc = 0; + Xa = Min(X1, Min(X2, X3)); + Ya = Max(Y1, Max(Y2, Y3)); + Xb = Max(X1, Max(X2, X3)); + Yb = Ya; + Xc = Xa; + Yc = Min(Y1, Min(Y2, Y3)); + + myCartPointXMap[HYDROGUI_PrsImage::PointA]->setValue(Xa); + myCartPointYMap[HYDROGUI_PrsImage::PointA]->setValue(Ya); + // + myCartPointXMap[HYDROGUI_PrsImage::PointB]->setValue(Xb); + myCartPointYMap[HYDROGUI_PrsImage::PointB]->setValue(Yb); + // + myCartPointXMap[HYDROGUI_PrsImage::PointC]->setValue(Xc); + myCartPointYMap[HYDROGUI_PrsImage::PointC]->setValue(Yc); + // + for( int aPointType = HYDROGUI_PrsImage::PointA; aPointType <= HYDROGUI_PrsImage::PointC; aPointType++ ) + onCartesianCoordChanged( aPointType ); + blockSignalsCartesian( false ); + setTransformationMode( HYDROData_Image::ManualCartesian ); + } +} + + HYDROGUI_ImportImageDlg::TransformationData HYDROGUI_ImportImageDlg::ComputeTrsfData( const int theMode, const QPoint& theLocalPoint, @@ -708,7 +810,16 @@ void HYDROGUI_ImportImageDlg::ActivateFile( const QString& theFileName, bool isE if( !theFileName.isEmpty() ) { - QImage anImage( theFileName ); + QFileInfo aFI( theFileName ); + QImage anImage; + HYDROData_Image::ECW_FileInfo* theECWInfo = NULL; + if (aFI.completeSuffix().toLower() == "ecw") + { + theECWInfo = new HYDROData_Image::ECW_FileInfo; + HYDROData_Image::OpenECW(theFileName.toLatin1().data(), anImage, theECWInfo); + } + else + anImage = QImage(theFileName); if( anImage.isNull() ) { QString aTitle = QObject::tr( "INPUT_VALID_DATA" ); @@ -720,7 +831,7 @@ void HYDROGUI_ImportImageDlg::ActivateFile( const QString& theFileName, bool isE { setFileName( theFileName ); setImageName( "" ); - emit createPreview( anImage ); + emit createPreview( anImage, theECWInfo ); } } } diff --git a/src/HYDROGUI/HYDROGUI_ImportImageDlg.h b/src/HYDROGUI/HYDROGUI_ImportImageDlg.h index 2adcb895..8e5e5e9c 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageDlg.h +++ b/src/HYDROGUI/HYDROGUI_ImportImageDlg.h @@ -20,6 +20,7 @@ #define HYDROGUI_IMPORTIMAGEDLG_H #include "HYDROGUI_InputPanel.h" +#include #include @@ -106,6 +107,10 @@ public: void initializePointSelection(); + + void ECW_initializePointSelection(HYDROData_Image::ECW_FileInfo* theECW_FileInfo); + + void ActivateFile( const QString& theFileName, bool isEnableFilesChoice ); public: @@ -136,7 +141,7 @@ private: bool blockSignalsCartesian( const bool theState ); signals: - void createPreview( QImage ); + void createPreview( QImage, HYDROData_Image::ECW_FileInfo* ); void activatePointSelection( int ); void pointCoordChanged( bool theIsRef, int thePointType, diff --git a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx index 15c73fde..eef9bd9a 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx @@ -85,7 +85,7 @@ void HYDROGUI_ImportImageOp::startOperation() myEditedObject->GetLocalPoints( aLocalPointA, aLocalPointB, aLocalPointC ); // Create the edited image preview presentation in the viewer - onCreatePreview( anImage ); + onCreatePreview( anImage, NULL ); //TODO // Set transformation local points A,B,C to the image preview presentation setPresentationTrsfPoints( myPreviewPrs, anIsByTwoPoints, aLocalPointA, @@ -268,7 +268,8 @@ void HYDROGUI_ImportImageOp::commitOperation() HYDROGUI_InputPanel* HYDROGUI_ImportImageOp::createInputPanel() const { HYDROGUI_InputPanel* aPanel = new HYDROGUI_ImportImageDlg( module(), getName() ); - connect( aPanel, SIGNAL( createPreview( QImage ) ), SLOT( onCreatePreview( QImage ) ) ); + connect( aPanel, SIGNAL( createPreview( QImage, HYDROData_Image::ECW_FileInfo* ) ), + SLOT( onCreatePreview( QImage, HYDROData_Image::ECW_FileInfo* ) ) ); connect( aPanel, SIGNAL( activatePointSelection( int ) ), SLOT( onActivatePointSelection( int ) ) ); connect( aPanel, SIGNAL( pointCoordChanged( bool, int, bool, int ) ), SLOT( onPointCoordChanged( bool, int, bool, int ) ) ); @@ -589,7 +590,7 @@ void HYDROGUI_ImportImageOp::apply() } } -void HYDROGUI_ImportImageOp::onCreatePreview( QImage theImage ) +void HYDROGUI_ImportImageOp::onCreatePreview( QImage theImage, HYDROData_Image::ECW_FileInfo* theFileInfo ) { HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel(); @@ -688,7 +689,10 @@ void HYDROGUI_ImportImageOp::onCreatePreview( QImage theImage ) aPanel->setImageSize( myImage.size() ); - aPanel->initializePointSelection(); + if (!theFileInfo) + aPanel->initializePointSelection(); + else + aPanel->ECW_initializePointSelection(theFileInfo); onPointSelected( false ); onSetCIsUsed( !aPanel->isByTwoPoints() ); } diff --git a/src/HYDROGUI/HYDROGUI_ImportImageOp.h b/src/HYDROGUI/HYDROGUI_ImportImageOp.h index e6b68ce8..32b1853c 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageOp.h +++ b/src/HYDROGUI/HYDROGUI_ImportImageOp.h @@ -55,7 +55,7 @@ protected: virtual void apply(); protected slots: - void onCreatePreview( QImage ); + void onCreatePreview( QImage, HYDROData_Image::ECW_FileInfo* ); void onActivatePointSelection( int ); void onPointCoordChanged( bool, int, bool, int ); void onModeActivated( int ); diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 82ce2e0f..dc0001b1 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -134,7 +134,7 @@ does not exist or you have not enough permissions to open it. IMAGE_FILTER - Image files (*.bmp *.jpg *.jpeg *.png *.tif);;All files (*.* *) + Image files (*.bmp *.jpg *.jpeg *.png *.tif *.ecw);;All files (*.* *) INCORRECT_OBJECT_NAME diff --git a/src/HYDROPy/CMakeLists.txt b/src/HYDROPy/CMakeLists.txt index 9ed9e053..bf8f72c4 100644 --- a/src/HYDROPy/CMakeLists.txt +++ b/src/HYDROPy/CMakeLists.txt @@ -86,7 +86,7 @@ PYQT_WRAP_SIP( _sip_SOURCES HYDROData.sip ) # sources / to compile ADD_LIBRARY( HYDROPy ${_sip_SOURCES} ${_add_SOURCES} ) -TARGET_LINK_LIBRARIES(HYDROPy ${_link_LIBRARIES}) +TARGET_LINK_LIBRARIES(HYDROPy ${_link_LIBRARIES} ${CAS_OCAF} ${CAS_TKKernel} ${CAS_TKBRep} ${QT_LIBRARIES} ${OMNIORB_LIBRARIES} ${GEOM_GEOM} ${GEOM_GEOMBase}) INSTALL(TARGETS HYDROPy EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) IF(WIN32) diff --git a/src/HYDRO_tests/CMakeLists.txt b/src/HYDRO_tests/CMakeLists.txt index 1a6f2cf8..149ddf24 100644 --- a/src/HYDRO_tests/CMakeLists.txt +++ b/src/HYDRO_tests/CMakeLists.txt @@ -73,6 +73,7 @@ SET( QT_INCLUDES $ENV{QT_ROOT_DIR}/include $ENV{QT_ROOT_DIR}/include/QtCore $ENV SET( KERNEL_INCLUDES $ENV{KERNEL_ROOT_DIR}/include/salome ) SET( GUI_INCLUDES $ENV{GUI_ROOT_DIR}/include/salome ) SET( GEOM_INCLUDES $ENV{GEOM_ROOT_DIR}/include/salome ) +SET( ECW_INCLUDES $ENV{ECWLIB_ROOT_DIR}/include ) IF( ${WIN32} ) link_directories( $ENV{CASROOT}/win64/vc10/lib ) @@ -99,6 +100,13 @@ link_directories( $ENV{KERNEL_ROOT_DIR}/lib/salome $ENV{GUI_ROOT_DIR}/lib/salome SET( GUI_LIBRARIES ImageComposer qtx suit LightApp CAM OCCViewer ) SET( GEOM_LIBRARIES CurveCreator GEOMUtils GEOMUtils ) +link_directories( $ENV{ECWLIB_ROOT_DIR}/lib ) +IF( ${WIN32} ) + SET( ECW_LIBRARIES libecwj2 ) +ELSE() + SET( ECW_LIBRARIES libecwj2 ) +ENDIF() + include_directories( ${CAS_INCLUDES} ${QT_INCLUDES} @@ -109,11 +117,12 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../HYDROData ${CMAKE_CURRENT_SOURCE_DIR}/../HYDROGUI ${CMAKE_CURRENT_SOURCE_DIR}/../shapelib + ${ECW_INCLUDES} ) source_group( "External files" FILES ${EXTERNAL_FILES} ) add_executable( HYDROData_tests ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${EXTERNAL_FILES} ${PROJECT_MOC_HEADERS} ) -target_link_libraries( HYDROData_tests ${GUI_LIBRARIES} ${GEOM_LIBRARIES} ${CAS_LIBRARIES} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} shapelib HYDROData ) +target_link_libraries( HYDROData_tests ${GUI_LIBRARIES} ${GEOM_LIBRARIES} ${CAS_LIBRARIES} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} shapelib HYDROData ${ECW_LIBRARIES} ) INSTALL(TARGETS HYDROData_tests EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS}) -- 2.39.2