]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
import ECW files #1
authorisn <isn@opencascade.com>
Tue, 10 Oct 2017 13:42:53 +0000 (16:42 +0300)
committerisn <isn@opencascade.com>
Tue, 10 Oct 2017 15:39:06 +0000 (18:39 +0300)
12 files changed:
src/HYDROData/CMakeLists.txt
src/HYDROData/HYDROData_Entity.h
src/HYDROData/HYDROData_Image.cxx
src/HYDROData/HYDROData_Image.h
src/HYDROData/HYDROData_Tool.cxx
src/HYDROGUI/HYDROGUI_ImportImageDlg.cxx
src/HYDROGUI/HYDROGUI_ImportImageDlg.h
src/HYDROGUI/HYDROGUI_ImportImageOp.cxx
src/HYDROGUI/HYDROGUI_ImportImageOp.h
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDROPy/CMakeLists.txt
src/HYDRO_tests/CMakeLists.txt

index e831498a3e37a1eecca2a0d019fa42384b04860d..1d507ef4f7296bd8b998ce657fe2952ef07bb96a 100644 (file)
@@ -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)
index 7042b8d06db4731f66b1c9ab1a60c16c27a1b02a..a135d93921f7abfe06e4f4d89cf7d22b718b0d2f 100644 (file)
@@ -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 <NCollection_Sequence.hxx>
 #include <TDF_Label.hxx>
 #include <QString>
 #include <Standard_Type.hxx>
 
+
+#ifdef NONLS
+#undef NONLS
+#endif
+
+#ifdef NOMINMAX
+#undef NOMINMAX
+#endif
+
 class QColor;
 class QVariant;
 class QStringList;
index 74c278b4c3328957c03c1145e96e9a075b9f4791..fa024b5ae1dd0b2b7f476cf40b18a4de4508427d 100644 (file)
@@ -31,6 +31,9 @@
 #include <TDataStd_UAttribute.hxx>
 #include <TDataStd_AsciiString.hxx>
 
+#include <NCSDefs.h>
+#include <NCSFile.h>
+
 #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<UINT32> 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();
 }
 
index 5be02deedd6b8dea9a93a0f8e6dd7eb42ce11a90..31e5b691b8199265d1d2ce49934dd6d04a901768 100644 (file)
@@ -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
    */
index 417b7156e731f33f1eab08ee48b9c12f605331ef..b45c2970d3c220b85e956b9e578b388318c434c3 100644 (file)
@@ -54,8 +54,7 @@
 #include <NCollection_List.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 
-static int aMaxNameId = std::numeric_limits<int>::max();
-
+static int aMaxNameId = INT_MAX;
 void HYDROData_Tool::WriteStringsToFile( QFile&             theFile,
                                          const QStringList& theStrings,
                                          const QString&     theSep )
index 2a65913e0af635fdbfcb97f1b48283a3c3d2421e..8116bfd5ddb43cf09809457da737a7d5b152e44f 100644 (file)
@@ -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 );
     }
   }
 }
index 2adcb89592d532a9bb874e9e6b2da8494969c923..8e5e5e9c09a4d4f49005a863f3ede2da4a4a4d08 100644 (file)
@@ -20,6 +20,7 @@
 #define HYDROGUI_IMPORTIMAGEDLG_H
 
 #include "HYDROGUI_InputPanel.h"
+#include <HYDROData_Image.h>
 
 #include <QMap>
 
@@ -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,
index 15c73fdecb3b1ce405a5f5bcad2abc2dea9d841c..eef9bd9a7a4dc810fff8fbc9e7962e50ea98dd41 100644 (file)
@@ -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() );
 }
index e6b68ce85138609f7883d2f2108c25fc548af757..32b1853caed74f89f92acc423697e79a3d95c29a 100644 (file)
@@ -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 );
index 82ce2e0f3f976d573a6453fa8db135b699b1052f..dc0001b1e73037a1116277cb413736fe93ee7702 100644 (file)
@@ -134,7 +134,7 @@ does not exist or you have not enough permissions to open it.</translation>
     </message>
     <message>
       <source>IMAGE_FILTER</source>
-      <translation>Image files (*.bmp *.jpg *.jpeg *.png *.tif);;All files (*.* *)</translation>
+      <translation>Image files (*.bmp *.jpg *.jpeg *.png *.tif *.ecw);;All files (*.* *)</translation>
     </message>
     <message>
       <source>INCORRECT_OBJECT_NAME</source>
index 9ed9e053a0a4ca8f1655963fb742da3fb4aeb5f7..bf8f72c42474aae0dca8294ef69620415aa9d44b 100644 (file)
@@ -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)
index 1a6f2cf8a01490268f91962bcb3852a42fe45a93..149ddf244aecdb11b01a4e1c7e599d41cc23c9be 100644 (file)
@@ -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})