]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Merge remote-tracking branch 'origin/BR_1323_0' into BR_2017
authorasl <asl@opencascade.com>
Tue, 7 Nov 2017 12:29:06 +0000 (15:29 +0300)
committerasl <asl@opencascade.com>
Tue, 7 Nov 2017 12:29:06 +0000 (15:29 +0300)
# Conflicts:
# src/HYDROGUI/CMakeLists.txt
# src/HYDROGUI/HYDROGUI_Operations.cxx
# src/HYDROGUI/HYDROGUI_Operations.h

37 files changed:
CMakeLists.txt
src/HYDROData/CMakeLists.txt
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_BathymetryOp.cxx
src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx
src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx
src/HYDROGUI/HYDROGUI_DataObject.cxx
src/HYDROGUI/HYDROGUI_DataObject.h
src/HYDROGUI/HYDROGUI_ListSelector.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Module.h
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_Overview.cxx
src/HYDROGUI/HYDROGUI_PolylineStyleDlg.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_PolylineStyleDlg.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_PolylineStyleOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_PolylineStyleOp.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Shape.cxx
src/HYDROGUI/HYDROGUI_ShapeImage.cxx
src/HYDROGUI/HYDROGUI_ShapeImage.h
src/HYDROGUI/HYDROGUI_ViewerDlg.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDRO_tests/CMakeLists.txt
src/HYDRO_tests/ExternalFiles.cmake
src/HYDRO_tests/reference_data/CMakeLists.txt
src/HYDRO_tests/reference_data/overview_drag.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/overview_empty.png
src/HYDRO_tests/reference_data/overview_panned_1.png
src/HYDRO_tests/reference_data/overview_rotated_1.png
src/HYDRO_tests/reference_data/overview_selection.png
src/HYDRO_tests/reference_data/overview_selection_a.png [new file with mode: 0644]
src/HYDRO_tests/reference_data/overview_zoomed_1.png
src/HYDRO_tests/reference_data/overview_zoomed_2.png
src/HYDRO_tests/test_HYDROData_CalcCase.cxx
src/HYDRO_tests/test_HYDROData_Main.cxx
src/HYDRO_tests/test_Overview.cxx

index ea8542758f6d0aeb03c3447b419c7d125d50ff66..f2d38cf7afdcdbacf5867fc296ffb237300f9af9 100644 (file)
@@ -88,7 +88,7 @@ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm/cmake")
 # User options
 # ============
 # (some options may have already been defined in KERNEL)
-OPTION(SALOME_BUILD_DOC "Generate HYDRO documentation" ON)
+OPTION(SALOME_BUILD_DOC "Generate HYDRO documentation" OFF)
 OPTION(SALOME_BUILD_TESTS "Build HYDRO tests" ON)
 
 # Prerequisites
@@ -197,11 +197,11 @@ MARK_AS_ADVANCED(
 # Sources
 # ========
 ADD_SUBDIRECTORY (src/shapelib)
+ADD_SUBDIRECTORY (src/HYDRO_tests)
 ADD_SUBDIRECTORY (src/HYDROData)
 ADD_SUBDIRECTORY (src/HYDROGUI)
 ADD_SUBDIRECTORY (src/HYDROPy)
 ADD_SUBDIRECTORY (src/HYDROTools)
-ADD_SUBDIRECTORY (src/HYDRO_tests)
 IF(SALOME_BUILD_DOC)
   ADD_SUBDIRECTORY(doc)
 ENDIF()
index 1d507ef4f7296bd8b998ce657fe2952ef07bb96a..d82add816944c54cbb8886d81869aaaa9cfc7970 100644 (file)
@@ -134,7 +134,7 @@ link_directories( $ENV{ECWLIB_ROOT_DIR}/lib )
 IF( ${WIN32} )
   SET( ECW_LIBRARIES libecwj2 )
 ELSE()
-  SET( ECW_LIBRARIES libecwj2 )
+  SET( ECW_LIBRARIES ecwj2 )
 ENDIF()
 
 add_definitions(
index 130135bdbbc2280a83d6226843681c1e33d5358c..e090945181dfcf802fc75b6f68e52c49d99570e4 100644 (file)
@@ -148,6 +148,8 @@ set(PROJECT_HEADERS
     HYDROGUI_SetTransparencyOp.h
     HYDROGUI_TransparencyDlg.h
     HYDROGUI_Overview.h
+    HYDROGUI_PolylineStyleOp.h
+    HYDROGUI_PolylineStyleDlg.h
     HYDROGUI_ZoneTool.h
        HYDROGUI_RegenerateRegionColorsOp.h
 )
@@ -300,6 +302,8 @@ set(PROJECT_SOURCES
     HYDROGUI_SetTransparencyOp.cxx
     HYDROGUI_TransparencyDlg.cxx
     HYDROGUI_Overview.cxx
+    HYDROGUI_PolylineStyleOp.cxx
+    HYDROGUI_PolylineStyleDlg.cxx
     HYDROGUI_ZoneTool.cxx
        HYDROGUI_RegenerateRegionColorsOp.cxx
 )
index 0c45c2d72ba45b79a7a23f224a26f69d75245389..68178b587a5980ee6b1d7677060ba34a231bd781 100644 (file)
@@ -30,6 +30,7 @@
 #include <SUIT_Desktop.h>
 #include <QLayout>
 #include <QPushButton>
+#include <QApplication>
 
 HYDROGUI_BathymetryLimitsDlg::HYDROGUI_BathymetryLimitsDlg( QWidget* theParent )
   : QDialog( theParent )
@@ -130,6 +131,9 @@ void HYDROGUI_BathymetryOp::activate( bool isActivate )
   QList<Handle(HYDROGUI_BathymetryPrs)> baths = getShownBathymetries( module() );
   bool isUpdateCS = false;
 
+  if( myMode!=BathymetryRescaleUserId )
+    qApp->setOverrideCursor( Qt::WaitCursor );
+
   switch( myMode )
   {
   case BathymetryTextId:
@@ -183,6 +187,8 @@ void HYDROGUI_BathymetryOp::activate( bool isActivate )
         dlg.SetMinMax( min, max );
         if( dlg.exec()==QDialog::Accepted )
         {
+          qApp->setOverrideCursor( Qt::WaitCursor );
+
           min = dlg.GetMin();
           max = dlg.GetMax();
           foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
@@ -212,4 +218,6 @@ void HYDROGUI_BathymetryOp::activate( bool isActivate )
 
   if( isUpdateCS )
     module()->getOCCDisplayer()->UpdateColorScale( getViewer( module() ) );
+
+  qApp->restoreOverrideCursor();
 }
index bf7f53b367e5804a7c5b8e309f08fd118030f711..e8772e7a5ba1de5215efb1b1df32f82b0413ae61 100644 (file)
@@ -17,6 +17,8 @@
 //
 
 #include <HYDROGUI_BathymetryPrs.h>
+#include <HYDROGUI_Tool.h>
+
 #include <Prs3d_Root.hxx>
 #include <Prs3d_LineAspect.hxx>
 #include <Prs3d_Text.hxx>
 #include <Select3D_SensitivePoint.hxx>
 #include <Graphic3d_ArrayOfPolylines.hxx>
 #include <Graphic3d_ArrayOfPoints.hxx>
+#include <Image_PixMap.hxx>
+#include <Graphic3d_MarkerImage.hxx>
+
+#include <QImage>
 
 const int BATH_HIGHLIGHT_MODE = 10;
 
@@ -126,7 +132,13 @@ void HYDROGUI_BathymetryPrs::Compute( const Handle(PrsMgr_PresentationManager3d)
   }
   else
   {
+       Handle(Graphic3d_AspectMarker3d) anAspect = new Graphic3d_AspectMarker3d( Aspect_TOM_USERDEFINED, Quantity_NOC_WHITE, 1.0 );
+       QImage qtMark( 4, 4, QImage::Format_RGB888 );
+       Handle(Image_PixMap) aMark = HYDROGUI_Tool::Pixmap( qtMark ); 
+       Handle(Graphic3d_MarkerImage) gMark = new Graphic3d_MarkerImage(aMark);
+       anAspect->SetMarkerImage(gMark);
     AIS_PointCloud::Compute( thePresentationManager, thePresentation, theMode );
+       aGroup->SetGroupPrimitivesAspect( anAspect );
 
     Handle(Graphic3d_ArrayOfPoints) points = GetPoints();
     if( !myTextIndices.empty() && !points.IsNull() )
index 9786506dd70a346157cd5b4e80d65e1ac1ce33e8..8c843cd2f3f45a71a3ec060f35687768ab7ec2a6 100644 (file)
@@ -46,6 +46,7 @@ void HYDROGUI_BathymetrySelectionOp::abortOperation()
   activateSelection( false );
 
   module()->action( BathymetrySelectionId )->setChecked( false );
+  module()->action( BathymetryTextId )->setChecked( false );
 }
 
 bool HYDROGUI_BathymetrySelectionOp::isValid( SUIT_Operation* theOtherOp ) const
index 181c591b33cd392ad0b4eee76dbd84916aadc206..116afcc2ee641cd2b2aa1a816ef9c668384788b3 100644 (file)
@@ -42,7 +42,9 @@ HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent,
                                           const QString& theParentEntry,
                                           const bool theIsInOperation )
 : CAM_DataObject( theParent ),
+#ifndef TEST_MODE
   LightApp_DataObject( theParent ),
+#endif
   myData( theData ),
   myParentEntry( theParentEntry ),
   myIsValid( true ),
@@ -53,7 +55,7 @@ HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent,
 QString HYDROGUI_DataObject::entry() const
 {
   QString anEntry = HYDROGUI_DataObject::dataObjectEntry( modelObject() );
-  if( isReference() )
+  if( !refEntry().isEmpty() )
     anEntry.prepend( myParentEntry + "_" );
   return anEntry;
 }
@@ -74,7 +76,7 @@ QString HYDROGUI_DataObject::name() const
 
 QFont HYDROGUI_DataObject::font( const int theId ) const
 {
-  QFont aFont = LightApp_DataObject::font( theId );
+  QFont aFont = PARENT::font( theId );
   if( theId == NameId )
   {
     Handle(HYDROData_Entity) aDataObject = modelObject();
@@ -133,7 +135,7 @@ QColor HYDROGUI_DataObject::color( const ColorRole theRole, const int theId ) co
   }
 
   if ( !aColor.isValid() ) {
-    aColor = LightApp_DataObject::color( theRole, theId );
+    aColor = PARENT::color( theRole, theId );
   }
 
   return aColor;
@@ -201,7 +203,7 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const
 
     return aResMgr->loadPixmap( "HYDRO", anIcon );
   }
-  return LightApp_DataObject::icon( theId );
+  return PARENT::icon( theId );
 }
 
 QString HYDROGUI_DataObject::dataObjectEntry( const Handle(HYDROData_Entity)& theObject,
@@ -246,7 +248,7 @@ bool HYDROGUI_DataObject::renameAllowed( const int theColumnId ) const
   }
   else
   {
-    aRes = LightApp_DataObject::renameAllowed( theColumnId );
+    aRes = PARENT::renameAllowed( theColumnId );
   }
   return aRes;
 }
@@ -270,7 +272,9 @@ HYDROGUI_NamedObject::HYDROGUI_NamedObject( SUIT_DataObject* theParent,
                                             const QString&   theParentEntry,
                                             const bool       theIsInOperation  )
 : CAM_DataObject( theParent ),
+#ifndef TEST_MODE
   LightApp_DataObject( theParent ),
+#endif
   myName( theName ),
   myParentEntry( theParentEntry ),
   myIsInOperation( theIsInOperation )
@@ -297,12 +301,12 @@ QPixmap HYDROGUI_NamedObject::icon( const int theId ) const
   {
     return aResMgr->loadPixmap( "HYDRO", QObject::tr( "PARTITION_ICO" ) );
   }
-  return LightApp_DataObject::icon( theId );
+  return PARENT::icon( theId );
 }
 
 QFont HYDROGUI_NamedObject::font( const int theId ) const
 {
-  QFont aFont = LightApp_DataObject::font( theId );
+  QFont aFont = PARENT::font( theId );
   if( theId == NameId )
   {
   if ( dynamic_cast<CAM_ModuleObject*>( parent() ) )
index caa5eba4e653cc20cfd8020602cda67a9e17b4e7..12dfa7102db85e2164635dc314327b44b68441c6 100644 (file)
   #pragma warning( disable: 4251 )
 #endif
 
-#include <LightApp_DataObject.h>
+#ifdef TEST_MODE
+  #include <CAM_DataObject.h>
+  enum { 
+    EntryId = CAM_DataObject::VisibilityId + 1,    //!< entry column
+    RefEntryId                     //!< reference entry column
+  };
+  #define PARENT CAM_DataObject
+#else
+  #include <LightApp_DataObject.h>
+  #define PARENT LightApp_DataObject
+#endif
+
 #include <QString>
 #include <QMap>
 #include <QPixmap>
@@ -47,7 +58,7 @@
  * This class inherits CAM_DataObject virtually, so it is necessary to call in the class
  * constructor the CAM object constructor manually for the correct initialization
  */
-class HYDROGUI_DataObject : public LightApp_DataObject
+class HYDROGUI_DataObject : public PARENT
 {
 public:
   //! Column id
@@ -166,7 +177,7 @@ protected:
  * This class inherits CAM_DataObject virtually, so it is necessary to call in the class
  * constructor the CAM object constructor manually for the correct initialization
  */
-class HYDROGUI_NamedObject : public virtual LightApp_DataObject
+class HYDROGUI_NamedObject : public virtual PARENT
 {
 public:
   /**
index a973b0351ff7cecfc83cf754a3d94945c1476125..7ae11a62ba7c1bc2905c77b7a9874eb851435abc 100644 (file)
 
 #include "HYDROGUI_OrderedListWidget.h"
 
-#include <LightApp_DataOwner.h>
+#ifdef TEST_MODE
+  #include <SUIT_DataOwner.h>
+  class TestOwner : public SUIT_DataOwner
+  {
+  public:
+    TestOwner( const QString& entry ) { myEntry = entry; }
+    virtual ~TestOwner() {}
+
+    QString keyString() const { return myEntry; }
+    QString entry() const { return myEntry; }
+
+  private:
+    QString myEntry;
+  };
+  #define OWNER_CLASS TestOwner
+
+#else
+  #include <LightApp_DataOwner.h>
+  #define OWNER_CLASS LightApp_DataOwner
+#endif
 
 
 HYDROGUI_ListSelector::HYDROGUI_ListSelector( HYDROGUI_OrderedListWidget* theListWidget,
@@ -57,7 +76,7 @@ void HYDROGUI_ListSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const
 
   foreach ( const QString& anEntry, aSelectedEntries ) {
     if ( !anEntry.isEmpty() ) {
-      theList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( anEntry ) ) );
+      theList.append( SUIT_DataOwnerPtr( new OWNER_CLASS( anEntry ) ) );
     }
   }
 }
@@ -73,7 +92,7 @@ void HYDROGUI_ListSelector::setSelection( const SUIT_DataOwnerPtrList& theList )
   QStringList aSelectedEntries;
   SUIT_DataOwnerPtrList::const_iterator anIt = theList.begin();
   for ( ; anIt != theList.end(); ++anIt ) {
-    const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>( (*anIt).operator->() );
+    const OWNER_CLASS* anOwner = dynamic_cast<const OWNER_CLASS*>( (*anIt).operator->() );
     if ( anOwner ) {
       aSelectedEntries << anOwner->entry();
     }
index ab02eb40e4a7f26a80008a0112bc17c3de7fb8dc..c21abdfc7e6d1919df266a149ed60ac297ff0233 100644 (file)
@@ -316,8 +316,8 @@ void HYDROGUI_Module::windows( QMap<int, int>& theMap ) const
   {
     const_cast<HYDROGUI_Module*>( this )->myOverview = 
       new HYDROGUI_Overview( tr( "OVERVIEW" ), 0, app->desktop() );
-    myOverview->setGeometry( 0, 0, 320, 240 );
     app->insertDockWindow( OverviewWindow, myOverview );
+    app->placeDockWindow( OverviewWindow, Qt::LeftDockWidgetArea );
   }
   inWindows = false;
 }
@@ -751,8 +751,8 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       theMenu->addSeparator();
     }
 
-    bool anIsPoly = anIsPolyline || anIsPolyline3D;
-    if (anIsPoly && !anIsLandCoverMap)
+    bool isPoly = anIsPolyline || anIsPolyline3D;
+    if (isPoly  && !anIsLandCoverMap)
       theMenu->addAction( action( ExportToShapeFileID ) );
 
     // Add copy action
@@ -849,6 +849,11 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       }
     }
   }
+
+  theMenu->addSeparator();
+  QAction* a = action( ShowHideArrows );
+  a->setText( arrowsVisible() ? tr( "HIDE_ARROWS" ) : tr( "SHOW_ARROWS" ) );
+  theMenu->addAction( a );
 }
 
 void HYDROGUI_Module::createPreferences()
index edf520d70832c5158c97fd18649d59091ca77cc9..ba0f8ba5457a41d081dae1951d0127947e00a1f2 100644 (file)
@@ -258,6 +258,9 @@ public:
 
   void                            enableLCMActions();
 
+  bool arrowsVisible() const;
+  void setArrowsVisible( bool );
+
 protected:
   CAM_DataModel*                  createDataModel();
 
index 2a817f47b0f4e0abe1ec86256f371b4a16b67937..259ac301301ba35c5e44a68a781a1906cee16030 100644 (file)
@@ -73,6 +73,7 @@
 #include "HYDROGUI_ImportLandCoverMapOp.h"
 #include "HYDROGUI_BathymetrySelectionOp.h"
 #include "HYDROGUI_BathymetryOp.h"
+#include "HYDROGUI_PolylineStyleOp.h"
 #include "HYDROGUI_RegenerateRegionColorsOp.h"
 
 #include <HYDROData_Document.h>
@@ -245,6 +246,7 @@ void HYDROGUI_Module::createActions()
   createAction( LandCoverScalarMapModeOnId, "LC_SCALARMAP_COLORING_ON" );
   createAction( LandCoverScalarMapModeOffId, "LC_SCALARMAP_COLORING_OFF" );
 
+  createAction( ShowHideArrows, "SHOW_HIDE_ARROWS" );
   createAction( RegenerateRegionColorsId, "REGENERATE_REGION_COLORS" );
 
 }
@@ -457,6 +459,50 @@ void HYDROGUI_Module::onOperation()
   int anId = actionId( anAction );
   if( anId >= 0 )
     startOperation( anId );
+
+  if( anId==ShowHideArrows )
+  {
+    setArrowsVisible( !arrowsVisible() );
+  }
+}
+
+bool HYDROGUI_Module::arrowsVisible() const
+{
+  int aType;
+  SUIT_ResourceMgr* resMgr = application()->resourceMgr();
+  if( resMgr )
+  {
+    resMgr->value( "polyline", "arrow_type", aType );
+    return aType>0;
+  }
+  else
+    return false;
+}
+
+void HYDROGUI_Module::setArrowsVisible( bool isVisible )
+{
+  SUIT_ResourceMgr* resMgr = application()->resourceMgr();
+
+  int aType=-1;
+  if( !resMgr )
+    return;
+
+  if( isVisible )
+  {
+    if( resMgr->hasValue( "polyline", "prev_arrow_type" ) )
+      resMgr->value( "polyline", "prev_arrow_type", aType );
+
+    if( aType<=0 )
+      aType = 1;
+    resMgr->setValue( "polyline", "arrow_type", aType );
+  }
+  else
+  {
+    resMgr->value( "polyline", "arrow_type", aType );
+    resMgr->setValue( "polyline", "prev_arrow_type", aType );
+    resMgr->setValue( "polyline", "arrow_type", 0 );
+  }
+  preferencesChanged( "polyline", "arrow_type" );
 }
 
 void HYDROGUI_Module::onDelete()
index 50ec909ea09929c373de6089019be3bdfe2d180e..88afbe3cd3e11cb9b3f160987739651e0605afd2 100644 (file)
@@ -145,6 +145,7 @@ enum OperationId
   BathymetryRescaleUserId,
   BathymetryRescaleDefaultId,
 
+  ShowHideArrows,
   RegenerateRegionColorsId
 };
 
index 2077f91f27d1f52f504c4fba4b20f6b63791d65f..f7185a2fa587e21e7bfc29fc0612b1cf77eef8aa 100644 (file)
@@ -190,11 +190,41 @@ void HYDROGUI_OverviewBand::update( bool isFromMain )
     QPoint c = center();
     double x1, y1, z1, x2, y2, z2;
     main->getView()->Convert( main->width()/2, main->height()/2, x1, y1, z1 );
+
+    // Patch for OCCT 6.9.1, on 7.0.0 the moving of point to plane XY is not necessary
+    gp_Dir dm = main->getView()->Camera()->Direction();
+    double t1 = -z1/dm.Z();
+    x1 += dm.X()*t1;
+    y1 += dm.Y()*t1;
+    z1 += dm.Z()*t1;
+
     overview->getView()->Convert( c.x(), c.y(), x2, y2, z2 );
+    gp_Dir dov = overview->getView()->Camera()->Direction();
+    double t2 = -z2/dov.Z();
+    x2 += dov.X()*t2;
+    y2 += dov.Y()*t2;
+    z2 += dov.Z()*t2;
 
     gp_Trsf aTrsf;
     aTrsf.SetTranslation( gp_Pnt( x1, y1, z1 ), gp_Pnt( x2, y2, z2 ) );
-    main->getView()->Camera()->Transform( aTrsf );
+
+    // Temporary patch for bug in OCCT 6.9.1
+    Handle(Graphic3d_Camera) cam = main->getView()->Camera();
+    gp_Dir u = cam->Up(), nu = u.Transformed (aTrsf);
+    gp_Pnt e = cam->Eye(), ne = e.Transformed (aTrsf);
+    gp_Pnt cen = cam->Center(), ncen = cen.Transformed (aTrsf);
+
+    if (!nu.IsEqual (u, 0.0))
+      cam->SetUp(nu);
+
+    if (!ne.IsEqual (e, 0.0))
+      cam->SetEye(ne);
+
+    if (!ncen.IsEqual(cen, 0.0))
+      cam->SetCenter (ncen);
+
+    //version for new OCCT:
+    //main->getView()->Camera()->Transform( aTrsf );
     main->repaint();
   }
 }
@@ -285,7 +315,7 @@ void HYDROGUI_Overview::setMainView( OCCViewer_ViewFrame* theMainView )
   if( !myViewPort )
   {
     myViewPort = new OCCViewer_ViewPort3d( this, myMainView->getViewPort()->getViewer(), V3d_ORTHOGRAPHIC );
-    //myViewPort->setBackgroundColor( Qt::white );
+    myViewPort->setBackgroundColor( myMainView->getViewPort()->backgroundColor() );
 
     connect( myViewPort, SIGNAL( vpMouseEvent( QMouseEvent* ) ), 
             this,       SLOT( OnMouseEvent( QMouseEvent* ) ) );
diff --git a/src/HYDROGUI/HYDROGUI_PolylineStyleDlg.cxx b/src/HYDROGUI/HYDROGUI_PolylineStyleDlg.cxx
new file mode 100644 (file)
index 0000000..092d7e3
--- /dev/null
@@ -0,0 +1,68 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROGUI_PolylineStyleDlg.h"
+#include <QFrame>
+#include <QLayout>
+#include <QComboBox>
+#include <QSpinBox>
+#include <QLabel>
+#include <QGroupBox>
+
+HYDROGUI_PolylineStyleDlg::HYDROGUI_PolylineStyleDlg( HYDROGUI_Module* theModule )
+  : HYDROGUI_InputPanel( theModule, tr( "POLYLINE_STYLE" ) )
+{
+  QGroupBox* group = new QGroupBox( tr( "POLYLINE_STYLE" ), mainFrame() );
+
+  QGridLayout* lay = new QGridLayout( group );
+
+  myShape = new QComboBox( mainFrame() );
+  myShape->addItem( "???" );
+  myShape->addItem( tr( "No" ) );
+  myShape->addItem( tr( "Triangle" ) );
+  myShape->addItem( tr( "Cone" ) );
+
+  mySize = new QSpinBox( mainFrame() );
+  mySize->setRange( -1, 50 );
+  mySize->setSpecialValueText( "   " );
+
+  lay->addWidget( new QLabel( tr( "PREF_POLYLINE_ARROW" ) ), 0, 0 );
+  lay->addWidget( myShape, 0, 1 );
+  lay->addWidget( new QLabel( tr( "PREF_POLYLINE_ARROW_SIZE" ) ), 1, 0 );
+  lay->addWidget( mySize, 1, 1 );
+  lay->setRowStretch( 2, 1 );
+
+  addWidget( group );
+}
+
+HYDROGUI_PolylineStyleDlg::~HYDROGUI_PolylineStyleDlg()
+{
+}
+
+void HYDROGUI_PolylineStyleDlg::getStyle( int& theShape, int& theSize ) const
+{
+  theShape = myShape->currentIndex();
+  theSize = mySize->value();
+}
+
+void HYDROGUI_PolylineStyleDlg::setStyle( int theShape, int theSize )
+{
+  myShape->setCurrentIndex( theShape );
+  mySize->setValue( theSize );
+}
+
diff --git a/src/HYDROGUI/HYDROGUI_PolylineStyleDlg.h b/src/HYDROGUI/HYDROGUI_PolylineStyleDlg.h
new file mode 100644 (file)
index 0000000..e529a73
--- /dev/null
@@ -0,0 +1,44 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+
+#ifndef HYDROGUI_PolylineStyleDlg_H
+#define HYDROGUI_PolylineStyleDlg_H
+
+#include "HYDROGUI_InputPanel.h"
+
+class QComboBox;
+class QSpinBox;
+
+class HYDROGUI_PolylineStyleDlg : public HYDROGUI_InputPanel
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_PolylineStyleDlg( HYDROGUI_Module* theModule );
+  virtual ~HYDROGUI_PolylineStyleDlg();
+
+  void getStyle( int&, int& ) const;
+  void setStyle( int, int );
+
+private:
+  QComboBox* myShape;
+  QSpinBox*  mySize;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_PolylineStyleOp.cxx b/src/HYDROGUI/HYDROGUI_PolylineStyleOp.cxx
new file mode 100644 (file)
index 0000000..b57733e
--- /dev/null
@@ -0,0 +1,108 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <HYDROGUI_PolylineStyleOp.h>
+#include <HYDROGUI_PolylineStyleDlg.h>
+#include <HYDROGUI_UpdateFlags.h>
+#include <AIS_InteractiveContext.hxx>
+
+HYDROGUI_PolylineStyleOp::HYDROGUI_PolylineStyleOp( HYDROGUI_Module* theModule )
+  : HYDROGUI_Operation( theModule )
+{
+}
+
+HYDROGUI_PolylineStyleOp::~HYDROGUI_PolylineStyleOp()
+{
+}
+
+HYDROGUI_InputPanel* HYDROGUI_PolylineStyleOp::createInputPanel() const
+{
+  return new HYDROGUI_PolylineStyleDlg( module() );
+}
+
+Handle(AIS_InteractiveContext) getContext( HYDROGUI_Module* theModule );
+
+QList<Handle(HYDROGUI_Arrow)> getSelectedArrows( HYDROGUI_Module* theModule )
+{
+  QList<Handle(HYDROGUI_Arrow)> arrows;
+  Handle(AIS_InteractiveContext) ctx = getContext( theModule );
+
+  AIS_ListOfInteractive objs;
+  ctx->DisplayedObjects( objs );
+  AIS_ListIteratorOfListOfInteractive it( objs );
+  for( ; it.More(); it.Next() )
+  {
+    Handle(HYDROGUI_Arrow) arrow = Handle(HYDROGUI_Arrow)::DownCast( it.Value() );
+    Handle(AIS_InteractiveObject) obj = arrow;
+    if( !obj.IsNull() && ctx->IsSelected( obj ) )
+      arrows.append( arrow );
+  }
+  return arrows;
+}
+
+void HYDROGUI_PolylineStyleOp::startOperation()
+{
+  HYDROGUI_Operation::startOperation();
+
+  myArrows = getSelectedArrows( module() );
+
+  int aCommonType=-1, aCommonSize=-1;
+  bool isInit = false;
+  foreach( Handle(HYDROGUI_Arrow) arrow, myArrows )
+  {
+    if( !isInit )
+    {
+      aCommonType = arrow->GetType();
+      aCommonSize = arrow->GetSize();
+    }
+    else
+    {
+      if( aCommonType != -1 && aCommonType != arrow->GetType() )
+        aCommonType = -1;
+      if( aCommonSize != -1 && aCommonSize != arrow->GetSize() )
+        aCommonSize = -1;
+    }
+
+    isInit = true;
+  }
+
+  HYDROGUI_PolylineStyleDlg* dlg = dynamic_cast<HYDROGUI_PolylineStyleDlg*>( inputPanel() );
+  dlg->setStyle( aCommonType+1, aCommonSize );
+}
+
+bool HYDROGUI_PolylineStyleOp::processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                             QStringList& theBrowseObjectsEntries )
+{
+  Handle(AIS_InteractiveContext) ctx = getContext( module() );
+
+  int aType, aSize;
+  HYDROGUI_PolylineStyleDlg* dlg = dynamic_cast<HYDROGUI_PolylineStyleDlg*>( inputPanel() );
+  dlg->getStyle( aType, aSize );
+  aType--;
+  
+  foreach( Handle(HYDROGUI_Arrow) arrow, myArrows )
+  {
+    if( aType>=0 )
+      arrow->SetType( (HYDROGUI_Arrow::Type)aType );
+    if( aSize>=0 )
+      arrow->SetSize( aSize );
+    ctx->Redisplay( arrow, Standard_False );
+  }
+  theUpdateFlags = UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+  return true;
+}
diff --git a/src/HYDROGUI/HYDROGUI_PolylineStyleOp.h b/src/HYDROGUI/HYDROGUI_PolylineStyleOp.h
new file mode 100644 (file)
index 0000000..d855c0e
--- /dev/null
@@ -0,0 +1,42 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_POLYLINE_STYLE_OP_H
+#define HYDROGUI_POLYLINE_STYLE_OP_H
+
+#include <HYDROGUI_Operation.h>
+#include <HYDROGUI_Polyline.h>
+
+class HYDROGUI_PolylineStyleOp : public HYDROGUI_Operation
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_PolylineStyleOp( HYDROGUI_Module* theModule );
+  virtual ~HYDROGUI_PolylineStyleOp();
+
+protected:
+  virtual void startOperation();
+  virtual HYDROGUI_InputPanel* createInputPanel() const;
+  virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries );
+
+private:
+  QList<Handle(HYDROGUI_Arrow)> myArrows;
+};
+
+#endif
index 964df94c41e6e121859167af5477eef6ef255e0d..36df440ae9e560501645f7ee652419bcd20f8979 100644 (file)
@@ -509,7 +509,17 @@ QList<Handle(AIS_InteractiveObject)> HYDROGUI_Shape::createShape() const
 
     int aType = -1;
     int aSize = -1;
-    if( aResMgr )
+
+    if( myShapes.length()>1 )
+    {
+      Handle(HYDROGUI_Arrow) arrow = Handle(HYDROGUI_Arrow)::DownCast( myShapes[1] );
+      if( !arrow.IsNull() )
+      {
+        aType = arrow->GetType();
+        aSize = arrow->GetSize();
+      }
+    }
+    if( aResMgr && ( aType<0 || aSize < 0 ) )
     {
       aResMgr->value( "polyline", "arrow_type", aType );
       aResMgr->value( "polyline", "arrow_size", aSize );
index d57f726dac12cf044c2699d731436a6d89e14984..765e75d615d7f9e3751439d8b9386f1b7b672c8f 100644 (file)
@@ -25,6 +25,9 @@
 #include <HYDROData_Document.h>
 
 #include <gp_Pnt.hxx>
+#include <QMessageBox>
+#include <QApplication>
+#include <QDesktopWidget>
 
 HYDROGUI_ShapeImage::HYDROGUI_ShapeImage( const Handle(AIS_InteractiveContext)& theContext,
                                           const Handle(HYDROData_Image)&         theImage,
@@ -55,14 +58,17 @@ QList<Handle(AIS_InteractiveObject)> HYDROGUI_ShapeImage::createShape() const
   Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast( getObject() );
   if ( !anImageObj.IsNull() )
   {
-    aPrs = new HYDROGUI_ImagePrs( imagePixMap( anImageObj ), imageContour( anImageObj ) );
+       QString aMsg;
+    aPrs = new HYDROGUI_ImagePrs( imagePixMap( anImageObj, aMsg ), imageContour( anImageObj ) );
+       if( !aMsg.isEmpty() )
+               QMessageBox::warning( qApp->desktop(), "Warning", aMsg ); 
     shapes.append( aPrs );
   }
 
   return shapes;
 }
 
-Handle(Image_PixMap) HYDROGUI_ShapeImage::imagePixMap( const Handle(HYDROData_Image)& theImageObj ) const
+Handle(Image_PixMap) HYDROGUI_ShapeImage::imagePixMap( const Handle(HYDROData_Image)& theImageObj, QString& theMessage ) const
 {
     Handle(Image_PixMap) aPix;
     if ( !theImageObj.IsNull() )
@@ -79,7 +85,14 @@ Handle(Image_PixMap) HYDROGUI_ShapeImage::imagePixMap( const Handle(HYDROData_Im
             if ( aDelta > 0 )
                 aTrsfWidth += ( 4 - aDelta );
       
+                       const int maxWidth = 7000;
+                       if( aTrsfWidth>maxWidth )
+                       {
+                               aTrsfWidth = maxWidth;
+                               theMessage = QString( "The size of image is scaled to %0" ).arg( aTrsfWidth );
+                       }
             anImage = anImage.scaledToWidth( aTrsfWidth );
+                       int pix = anImage.width() * anImage.height();
 
             aPix = HYDROGUI_Tool::Pixmap( anImage );
         }
index 17c6dec0437a70a99bf2d0af6058d0f5c15a334b..71941262a5e3717889878fc778fc32fb01bf308c 100644 (file)
@@ -37,7 +37,7 @@ public:
 
 protected:
   virtual QList<Handle(AIS_InteractiveObject)> createShape() const;
-  Handle(Image_PixMap)                  imagePixMap( const Handle(HYDROData_Image)& ) const;
+  Handle(Image_PixMap)                  imagePixMap( const Handle(HYDROData_Image)&, QString& theMessage ) const;
   QPolygonF                             imageContour( const Handle(HYDROData_Image)& ) const;
 };
 
index f82ae06ef5f00b4471e6992379e494a218bdc9f5..bf82bf405205ee3362f331f8af8032a645843a07 100644 (file)
@@ -47,7 +47,7 @@ HYDROGUI_ViewerDlg::HYDROGUI_ViewerDlg( HYDROGUI_Module* theModule, const QStrin
 : HYDROGUI_InputPanel( theModule, theTitle, true, isSplitter )
 {
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
-  SUIT_Study* aStudy = theModule ? theModule->getApp()->activeStudy() : 0;
+  SUIT_Study* aStudy = theModule ? theModule->application()->activeStudy() : 0;
 
   myViewManager = new OCCViewer_ViewManager( aStudy, 0 );
   OCCViewer_Viewer* aViewer = new OCCViewer_Viewer( true );
@@ -144,6 +144,10 @@ OCCViewer_ViewManager* HYDROGUI_ViewerDlg::viewManager() const
 
 SUIT_SelectionMgr* HYDROGUI_ViewerDlg::selectionMgr() const
 {
+#ifdef TEST_MODE
+  static SUIT_SelectionMgr* mgr = new SUIT_SelectionMgr();
+  return mgr;
+#else
     SUIT_SelectionMgr* aSelMgr = 0;
     if ( module() )
     {
@@ -152,6 +156,7 @@ SUIT_SelectionMgr* HYDROGUI_ViewerDlg::selectionMgr() const
             aSelMgr = app->selectionMgr();
     }
     return aSelMgr;
+#endif
 }
 
 void HYDROGUI_ViewerDlg::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
index 95df64460cea956c35789919dc66524952960b98..35ff9864d9b6aa96dae0b8329392db1b0896b4ec 100644 (file)
@@ -995,6 +995,10 @@ Would you like to remove all references from the image?</translation>
       <source>DSK_BATHYMETRY_RESCALE_DEFAULT</source>
       <translation>Default rescale bathymetry</translation>
     </message>
+    <message>
+      <source>DSK_SHOW_HIDE_ARROWS</source>
+      <translation>Show/hide arrows</translation>
+    </message>
     <message>
       <source>DSK_IMPORT_IMAGE</source>
       <translation>Import image</translation>
@@ -1368,6 +1372,18 @@ Would you like to remove all references from the image?</translation>
       <source>MEN_BATHYMETRY_RESCALE_DEFAULT</source>
       <translation>Default rescale bathymetry</translation>
     </message>
+    <message>
+      <source>MEN_SHOW_HIDE_ARROWS</source>
+      <translation>Show/hide arrows</translation>
+    </message>
+    <message>
+      <source>HIDE_ARROWS</source>
+      <translation>Hide arrows</translation>
+    </message>
+    <message>
+      <source>SHOW_ARROWS</source>
+      <translation>Show arrows</translation>
+    </message>
     <message>
       <source>MEN_IMPORT_IMAGE</source>
       <translation>Import image</translation>
@@ -1690,27 +1706,23 @@ Would you like to remove all references from the image?</translation>
       <translation>Selection on bathymetry</translation>
     </message>
     <message>
-      <source>
-        STB_BATHYMETRY_RESCALE_SELECTION
-      </source>
+      <source>STB_BATHYMETRY_RESCALE_SELECTION</source>
       <translation>Rescale bathymetry by selection</translation>
     </message>
     <message>
-      <source>
-        STB_BATHYMETRY_RESCALE_VISIBLE
-      </source>
+      <source>STB_POLYLINE_STYLE</source>
+      <translation>Change polyline style</translation>
+    </message>
+    <message>
+      <source>STB_BATHYMETRY_RESCALE_VISIBLE</source>
       <translation>Rescale bathymetry by visible range</translation>
     </message>
     <message>
-      <source>
-        STB_BATHYMETRY_RESCALE_USER
-      </source>
+      <source>STB_BATHYMETRY_RESCALE_USER</source>
       <translation>Custom rescale bathymetry</translation>
     </message>
     <message>
-      <source>
-        STB_BATHYMETRY_RESCALE_DEFAULT
-      </source>
+      <source>STB_BATHYMETRY_RESCALE_DEFAULT</source>
       <translation>Default rescale bathymetry</translation>
     </message>
     <message>
@@ -3511,4 +3523,20 @@ Polyline should consist from one not closed curve.</translation>
     </message>
   </context>
 
+  <context>
+    <name>HYDROGUI_PolylineStyleDlg</name>
+    <message>
+      <source>POLYLINE_STYLE</source>
+      <translation>Polyline style</translation>
+    </message>
+    <message>
+      <source>PREF_POLYLINE_ARROW</source>
+      <translation>Polyline arrow</translation>
+    </message>
+    <message>
+      <source>PREF_POLYLINE_ARROW_SIZE</source>
+      <translation>Polyline arrow size</translation>
+    </message>
+  </context>
+
 </TS>
index 0dde980c6f03ed950df1a2bf763834a6e8307adb..9c940fb6ba63362697c47293bf32a827b7d40626 100644 (file)
@@ -3,6 +3,8 @@ ADD_SUBDIRECTORY(reference_data)
 include(../../CMake/Common.cmake)
 include(ExternalFiles.cmake)
 
+set (CMAKE_POSITION_INDEPENDENT_CODE ON)
+
 set(PROJECT_HEADERS
   test_HYDROData_Bathymetry.h
   test_HYDROData_Channel.h
@@ -68,7 +70,7 @@ set(PROJECT_SOURCES
   TestLib_Runner.cxx
 )
 
-add_definitions( -DLIGHT_MODE -DHYDRODATA_STATIC -DHYDROGUI_STATIC -DTEST_MODE )
+add_definitions( -DLIGHT_MODE -DHYDRODATA_STATIC -DHYDROGUI_STATIC -DTEST_MODE -DQT_GUI_LIB -DQT_WIDGETS_LIB )
 
 IF( ${WIN32} )
   add_definitions( -DWNT -D__WIN32__ -D__x86__ -D_WIN64 -D_WIN32_WINNT=0x0400 -D__NT__ -D__OSVERSION__=4 )
@@ -76,30 +78,27 @@ ENDIF()
 
 SET( CPPUNIT_INCLUDES $ENV{CPPUNIT_ROOT_DIR}/include )
 SET( CAS_INCLUDES $ENV{CASROOT}/inc )
-SET( QT_INCLUDES $ENV{QT_ROOT_DIR}/include $ENV{QT_ROOT_DIR}/include/QtCore $ENV{QT_ROOT_DIR}/include/QtGui $ENV{QT_ROOT_DIR}/include/QtTest )
+SET( QT_INCLUDES $ENV{QTDIR}/include $ENV{QT_ROOT_DIR}/include $ENV{QT_ROOT_DIR}/include/QtCore $ENV{QT_ROOT_DIR}/include/QtGui $ENV{QT_ROOT_DIR}/include/QtTest )
 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 )
+  link_directories( $ENV{CASROOT}/win64/vc10/lib $ENV{GL2PS_DIR}/lib )
 ELSE()
   link_directories( $ENV{CASROOT}/lib $ENV{TBB_ROOT_DIR}/lib/intel64/gcc4.4 )
 ENDIF()
-SET( CAS_LIBRARIES TKernel TKLCAF TKCAF TKCDF TKMath TKG2d TKG3d TKBRep TKGeomBase TKTopAlgo TKGeomAlgo TKBool TKShHealing TKXSBase TKOffset TKHLR TKBO TKV3d TKService TKMesh )
+SET( CAS_LIBRARIES TKernel TKLCAF TKCAF TKCDF TKMath TKG2d TKG3d TKBRep TKGeomBase TKTopAlgo TKGeomAlgo TKBool TKShHealing TKXSBase TKOffset TKHLR TKBO TKV3d TKService TKMesh gl2ps )
 
-link_directories( $ENV{QT_ROOT_DIR}/lib )
+link_directories( $ENV{QT_ROOT_DIR}/lib $ENV{QTDIR}/lib )
 IF( ${WIN32} )
-  IF( CMAKE_BUILD_TYPE MATCHES Debug )
-    SET( QT_LIBRARIES Qt5Cored Qt5Guid Qt5Testd )
-  ELSE()
-    SET( QT_LIBRARIES Qt5Core Qt5Gui Qt5Test )
-  ENDIF()
+  SET( QT_LIBRARIES Qt5Cored Qt5Guid Qt5Testd )
 ELSE()
-  SET( QT_LIBRARIES QtCore QtGui QtTest )
+  SET( QT_LIBRARIES Qt5Core Qt5Gui Qt5Test )
 ENDIF()
 
+
 link_directories( $ENV{CPPUNIT_ROOT_DIR}/lib )
 IF( ${WIN32} )
   IF( CMAKE_BUILD_TYPE MATCHES Debug )
@@ -112,14 +111,17 @@ ELSE()
 ENDIF()
 
 link_directories( $ENV{KERNEL_ROOT_DIR}/lib/salome $ENV{GUI_ROOT_DIR}/lib/salome $ENV{GEOM_ROOT_DIR}/lib/salome )
-SET( GUI_LIBRARIES ImageComposer qtx suit LightApp CAM OCCViewer )
-SET( GEOM_LIBRARIES CurveCreator GEOMUtils GEOMUtils )
+
+SET( GUI_LIBRARIES ImageComposer qtx suit CAM OCCViewer GraphicsView )
+# Please do not link with LightApp since in the full SALOME it is linked with CORBA (omniORB)
+
+SET( GEOM_LIBRARIES CurveCreator GEOMUtils )
 
 link_directories( $ENV{ECWLIB_ROOT_DIR}/lib )
 IF( ${WIN32} )
   SET( ECW_LIBRARIES libecwj2 )
 ELSE()
-  SET( ECW_LIBRARIES libecwj2 )
+  SET( ECW_LIBRARIES ecwj2 )
 ENDIF()
 
 include_directories(
@@ -138,6 +140,7 @@ include_directories(
 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 ${ECW_LIBRARIES} )
+set_target_properties( HYDROData_tests PROPERTIES LINK_INTERFACE_LIBRARIES "" )
+target_link_libraries( HYDROData_tests ${GUI_LIBRARIES} ${GEOM_LIBRARIES} ${CAS_LIBRARIES} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} shapelib ${ECW_LIBRARIES} )
 
 INSTALL(TARGETS HYDROData_tests EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
index 0071a1d3770f7f7cff3bc53ca7d8806830a41bbd..2b207f3c03f9757f15bb402d02f7bf09a26857e5 100644 (file)
@@ -1,6 +1,7 @@
 
 find_package( Qt5Core )
 find_package( Qt5Widgets )
+set(CMAKE_AUTOMOC ON)
 
 set( EXTERNAL_FILES
   ../HYDROData/HYDROData_AltitudeObject.cxx
@@ -97,4 +98,4 @@ set( MOC_HEADERS
   ../HYDROGUI/HYDROGUI_ViewerDlg.h
 )
 
-QT_WRAP_MOC( PROJECT_MOC_HEADERS ${MOC_HEADERS} )
+#QT5_WRAP_MOC( PROJECT_MOC_HEADERS ${MOC_HEADERS} )
index c3651f279ff8ed9409689eb482e84693c623a6a7..db6539765ae8e1107693251a3ec06b96d7040b29 100644 (file)
@@ -135,10 +135,12 @@ SET(REFERENCE_DATA
     overview_empty.png
     overview_prs.png
     overview_selection.png
+    overview_selection_a.png
     overview_zoomed_1.png
     overview_zoomed_2.png
     overview_panned_1.png
     overview_rotated_1.png
+    overview_drag.png
     bathy_rescaled_user.png
     bathy_rescaled_visible.png
     bathy_text_labels.png
diff --git a/src/HYDRO_tests/reference_data/overview_drag.png b/src/HYDRO_tests/reference_data/overview_drag.png
new file mode 100644 (file)
index 0000000..e4f5a91
Binary files /dev/null and b/src/HYDRO_tests/reference_data/overview_drag.png differ
index fa9022f66b5b823322458a5a169ab2b587c1a086..49120672f71aa3bcd788ff6aad2018776b847827 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/overview_empty.png and b/src/HYDRO_tests/reference_data/overview_empty.png differ
index cf482f4498a5b996b5e25fe9adb45a0a898c193d..d1cdf9dd9723762b36ed4ea51a4e9135a6986152 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/overview_panned_1.png and b/src/HYDRO_tests/reference_data/overview_panned_1.png differ
index bc6b07abeaf839d2667eb86be4bd6ef549270475..703c3602bd5db41a78256e33f233861bdc11f907 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/overview_rotated_1.png and b/src/HYDRO_tests/reference_data/overview_rotated_1.png differ
index 18e18296532b766e971250439f2bc65a70e29064..bff97cc5713fee6671a75fa5d7e89a6c73209a48 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/overview_selection.png and b/src/HYDRO_tests/reference_data/overview_selection.png differ
diff --git a/src/HYDRO_tests/reference_data/overview_selection_a.png b/src/HYDRO_tests/reference_data/overview_selection_a.png
new file mode 100644 (file)
index 0000000..18e1829
Binary files /dev/null and b/src/HYDRO_tests/reference_data/overview_selection_a.png differ
index e8a1339909f0b2b45adaeefbf47f4f6fc8e1584f..50051a2cd533b433c733bea8aed11f7c77927171 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/overview_zoomed_1.png and b/src/HYDRO_tests/reference_data/overview_zoomed_1.png differ
index 169f8a792067a0574dcfb59d29541e2d6e52f566..1d58bc4f41fbfb4829519e1a1858c490cb68f9ad 100644 (file)
Binary files a/src/HYDRO_tests/reference_data/overview_zoomed_2.png and b/src/HYDRO_tests/reference_data/overview_zoomed_2.png differ
index 1d4b877c16cebb466cb58339d3b647b4d13ad1f6..2719ca7bffd38b864983cbf634434f204e38ef83 100644 (file)
@@ -33,9 +33,7 @@
 #include <BRep_Builder.hxx>
 #include <BRepTools.hxx>
 
-
-QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
-
+extern QString REF_DATA_PATH;
 
 void test_HYDROData_CalcCase::test_add_int_wires()
 {
index 96072a1b82e48ca409dcf1171f1d86e3e39f9655..3b4d053f4ddf0198a7a3a0b269d81f71323b73b9 100644 (file)
@@ -33,6 +33,8 @@
 #define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
+QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO";
+
 int main( int argc, char* argv[] )
 {
   QApplication anApp( argc, argv );
index 3850853de1bc2589651be036e7b2e34e0c313afe..d01de7cf7a012027e229357daf3a6a00c6aea30b 100644 (file)
@@ -37,7 +37,7 @@ HYDROGUI_Overview* test_Overview::myOverview = 0;
   {                                                                      \
     QString aMessage;                                                    \
     QImage aDump = dumpViews();                                          \
-    if( !TestViewer::AssertImages( aMessage, &aDump, theCase ) )         \
+    if( !TestViewer::AssertImages( aMessage, &aDump, theCase, false ) )  \
     {                                                                    \
       TestViewer::showColorScale( false );                               \
       std::string aMessageStl = aMessage.toStdString();                  \
@@ -57,7 +57,7 @@ QImage test_Overview::dumpViews()
   QImage aMain = TestViewer::viewWindow()->getView(OCCViewer_ViewFrame::MAIN_VIEW)->dumpView();
   QImage anOverview = myOverview->dump();
 
-  aMain = aMain.rgbSwapped();            //PATCH for image came from OCCT dump
+  aMain = aMain.rgbSwapped();              //PATCH for image came from OCCT dump
   //anOverview = anOverview.rgbSwapped();  //overview dump already normalizes the image, the line is not necessary!!!
 
   int w1 = aMain.width();
@@ -96,6 +96,7 @@ void test_Overview::create()
   myOverview->show();
   myOverview->setMainView( TestViewer::viewWindow() );
   TestViewer::viewWindow()->setGeometry( 400, 100, 800, 800 );
+  TestViewer::viewWindow()->onTopView();
   myOverview->setGeometry( 100, 100, 200, 200 );
 
   isPassed = true;
@@ -138,6 +139,7 @@ void fitAllWithRestore( OCCViewer_ViewPort3d* vp )
 void test_Overview::test_default()
 {
   create();
+  //QTest::qWait( 50000 );
   CPPUNIT_ASSERT_OVERVIEW( "overview_empty" );
 }
 
@@ -155,14 +157,15 @@ void test_Overview::test_actions_in_main()
 {
   create();
   showShape();
-
-  OCCViewer_ViewWindow* aMain = TestViewer::viewWindow()->getView( OCCViewer_ViewFrame::MAIN_VIEW );
-  OCCViewer_ViewPort3d* vp = aMain->getViewPort();
+  TestViewer::viewWindow()->onTopView();
 
   // 1. selection in main view
   QTest::mouseMove( TestViewer::viewWindow() );
   CPPUNIT_ASSERT_OVERVIEW( "overview_selection" );
 
+  OCCViewer_ViewWindow* aMain = TestViewer::viewWindow()->getView( OCCViewer_ViewFrame::MAIN_VIEW );
+  OCCViewer_ViewPort3d* vp = aMain->getViewPort();
+
   // 2. mouse wheel zoom
   QWheelEvent we( QPoint( 243, 416 ), 120*20, Qt::NoButton, Qt::NoModifier );
   qApp->sendEvent( vp, &we );
@@ -207,10 +210,29 @@ void test_Overview::test_set_mainview_2_times()
   myOverview->setMainView( TestViewer::viewWindow() );
   qApp->processEvents();
 
-  CPPUNIT_ASSERT_OVERVIEW( "overview_selection" );
+  CPPUNIT_ASSERT_OVERVIEW( "overview_selection_a" );
 }
 
 void test_Overview::test_actions_in_overview()
 {
-  //TODO
+  create();
+  showShape();
+  TestViewer::viewWindow()->onTopView();
+  QTest::mouseMove( TestViewer::viewWindow() );
+
+  OCCViewer_ViewWindow* aMain = TestViewer::viewWindow()->getView( OCCViewer_ViewFrame::MAIN_VIEW );
+  OCCViewer_ViewPort3d* vp = aMain->getViewPort();
+
+  QWheelEvent we( QPoint( 243, 416 ), 120*20, Qt::NoButton, Qt::NoModifier );
+  qApp->sendEvent( vp, &we );
+  qApp->processEvents();
+  CPPUNIT_ASSERT_OVERVIEW( "overview_zoomed_1" );
+
+  QTest::mouseMove( myOverview->getViewPort(false), QPoint( 150, 50 ) );
+  QTest::mouseClick( myOverview->getViewPort(false), Qt::LeftButton, Qt::KeyboardModifiers(), QPoint( 150, 50 ) );
+  qApp->processEvents();
+
+  CPPUNIT_ASSERT_OVERVIEW( "overview_drag" );
+
+  //QTest::qWait( 50000 );
 }