]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Draft version of "Find River Bottom", new viewer dialog base class, new component...
authorstv <stv@opencascade.com>
Thu, 26 Mar 2015 08:16:13 +0000 (11:16 +0300)
committerstv <stv@opencascade.com>
Fri, 27 Mar 2015 05:01:29 +0000 (08:01 +0300)
19 files changed:
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_ObjComboBox.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ObjComboBox.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_ProfileDlg.cxx
src/HYDROGUI/HYDROGUI_ProfileDlg.h
src/HYDROGUI/HYDROGUI_ProfileInterpolateDlg.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ProfileInterpolateDlg.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_RiverBottomDlg.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_RiverBottomDlg.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_RiverBottomOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_RiverBottomOp.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ViewerDlg.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ViewerDlg.h [new file with mode: 0644]
src/HYDROGUI/resources/HYDROGUI_images.ts
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index 937afe37cde38a897b3b751f0acfa7ba3d70880c..963da06712ab1426f27691de2403e0b5a8e19c36 100644 (file)
@@ -1,6 +1,6 @@
 #include(../../CMake/Common.cmake)
 include(../../CMake/UseQT4EXT.cmake)
-
 set(PROJECT_HEADERS 
     HYDROGUI.h
     HYDROGUI_AbstractDisplayer.h
@@ -48,6 +48,8 @@ set(PROJECT_HEADERS
     HYDROGUI_PolylineOp.h
     HYDROGUI_ProfileDlg.h
     HYDROGUI_ProfileOp.h
+    HYDROGUI_ProfileInterpolateDlg.h
+    HYDROGUI_ProfileInterpolateOp.h
     HYDROGUI_Prs.h
     HYDROGUI_PrsDriver.h
     HYDROGUI_PrsImage.h
@@ -100,7 +102,11 @@ set(PROJECT_HEADERS
     HYDROGUI_ListSelector.h
     HYDROGUI_ZLayers.h
     HYDROGUI_PriorityWidget.h
-       HYDROGUI_PriorityTableModel.h
+    HYDROGUI_PriorityTableModel.h
+    HYDROGUI_RiverBottomDlg.h
+    HYDROGUI_RiverBottomOp.h
+    HYDROGUI_ViewerDlg.h
+    HYDROGUI_ObjComboBox.h
 )
 
 QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
@@ -151,6 +157,8 @@ set(PROJECT_SOURCES
     HYDROGUI_PolylineOp.cxx
     HYDROGUI_ProfileDlg.cxx
     HYDROGUI_ProfileOp.cxx
+    HYDROGUI_ProfileInterpolateDlg.cxx
+    HYDROGUI_ProfileInterpolateOp.cxx
     HYDROGUI_Prs.cxx
     HYDROGUI_PrsDriver.cxx
     HYDROGUI_PrsImage.cxx
@@ -204,7 +212,11 @@ set(PROJECT_SOURCES
     HYDROGUI_ZLayers2.cxx
     HYDROGUI_ZLayers3.cxx
     HYDROGUI_PriorityWidget.cxx
-       HYDROGUI_PriorityTableModel.cxx
+    HYDROGUI_PriorityTableModel.cxx
+    HYDROGUI_RiverBottomDlg.cxx
+    HYDROGUI_RiverBottomOp.cxx
+    HYDROGUI_ViewerDlg.cxx
+    HYDROGUI_ObjComboBox.cxx
 )
 
 add_definitions(
diff --git a/src/HYDROGUI/HYDROGUI_ObjComboBox.cxx b/src/HYDROGUI/HYDROGUI_ObjComboBox.cxx
new file mode 100644 (file)
index 0000000..3b19930
--- /dev/null
@@ -0,0 +1,141 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_ObjComboBox.h"
+
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Module.h"
+
+#include <LightApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+
+#include <QLabel>
+#include <QLayout>
+#include <QComboBox>
+
+#include <HYDROData_Iterator.h>
+#include <HYDROData_Document.h>
+
+HYDROGUI_ObjComboBox::HYDROGUI_ObjComboBox( HYDROGUI_Module* theModule, const QString& theTitle, const ObjectKind& theType, QWidget* theParent )
+    : QWidget( theParent ),
+    myType( theType ),
+    myModule( theModule ),
+    myFilter( 0 )
+{
+    QBoxLayout* base = new QHBoxLayout( this );
+    base->setMargin( 0 );
+
+    base->addWidget( new QLabel( theTitle, this ) );
+    base->addWidget( myObject = new QComboBox( this ) );
+
+    myObject->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) );
+
+    // Connect signals and slots
+    connect( myObject, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onIndexChanged( int ) ) );
+    connect( selectionMgr(), SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
+}
+
+HYDROGUI_ObjComboBox::~HYDROGUI_ObjComboBox()
+{
+}
+
+HYDROGUI_Module* HYDROGUI_ObjComboBox::module() const
+{
+    return myModule;
+}
+
+ObjectKind HYDROGUI_ObjComboBox::objectType() const
+{
+    return myType;
+}
+
+HYDROGUI_ObjComboBoxFilter* HYDROGUI_ObjComboBox::objectFilter() const
+{
+    return myFilter;
+}
+
+void HYDROGUI_ObjComboBox::setObjectFilter( HYDROGUI_ObjComboBoxFilter* filter )
+{
+    myFilter = filter;
+}
+
+void HYDROGUI_ObjComboBox::reset()
+{
+    myObject->clear();
+    myObject->addItems( objectNames() );
+    onSelectionChanged();
+}
+
+void HYDROGUI_ObjComboBox::setSectedObject( const QString& theName )
+{
+    int aNewIdx = myObject->findText( theName );
+    if ( aNewIdx != myObject->currentIndex() )
+        myObject->setCurrentIndex( aNewIdx );
+}
+
+QString HYDROGUI_ObjComboBox::selectedObject() const
+{
+    return myObject->currentText();
+}
+
+SUIT_SelectionMgr* HYDROGUI_ObjComboBox::selectionMgr() const
+{
+    SUIT_SelectionMgr* aSelMgr = 0;
+    if ( module() )
+    {
+        LightApp_Application* app = module()->getApp();
+        if ( app )
+            aSelMgr = app->selectionMgr();
+    }
+    return aSelMgr;
+}
+
+QStringList HYDROGUI_ObjComboBox::objectNames() const
+{
+    QStringList aNames;
+    for ( HYDROData_Iterator it( HYDROData_Document::Document( module()->getStudyId() ), objectType() ); it.More(); it.Next() )
+    {
+        if ( !objectFilter() || objectFilter()->isOk( it.Current() ) )
+            aNames.append( it.Current()->GetName() );
+    }
+    return aNames;
+}
+
+void HYDROGUI_ObjComboBox::onIndexChanged( int idx )
+{
+    if ( idx < 0 )
+        return;
+
+    emit objectSelected( myObject->itemText( idx ) );
+}
+
+void HYDROGUI_ObjComboBox::onSelectionChanged()
+{
+    int idx = -1;
+    Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::GetSelectedObject( module() );
+    if ( !anObject.IsNull() )
+        idx = myObject->findText( anObject->GetName() );
+
+    myObject->setCurrentIndex( idx );
+    if ( idx >= 0 )
+        emit objectSelected( myObject->itemText( idx ) );
+}
diff --git a/src/HYDROGUI/HYDROGUI_ObjComboBox.h b/src/HYDROGUI/HYDROGUI_ObjComboBox.h
new file mode 100644 (file)
index 0000000..0cb5ca3
--- /dev/null
@@ -0,0 +1,82 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_OBJCOMBOBOX_H
+#define HYDROGUI_OBJCOMBOBOX_H
+
+#include <HYDROData_Entity.h>
+
+#include <QComboBox.h>
+
+class HYDROGUI_Module;
+class HYDROGUI_ObjComboBoxFilter;
+
+class SUIT_SelectionMgr;
+
+class HYDROGUI_ObjComboBox : public QWidget
+{
+    Q_OBJECT
+
+public:
+    HYDROGUI_ObjComboBox( HYDROGUI_Module* theModule, const QString& theTitle, const ObjectKind& = KIND_UNKNOWN, QWidget* = 0 );
+    virtual ~HYDROGUI_ObjComboBox();
+
+    HYDROGUI_Module*            module() const;
+
+    ObjectKind                  objectType() const;
+
+    HYDROGUI_ObjComboBoxFilter* objectFilter() const;
+    void                        setObjectFilter( HYDROGUI_ObjComboBoxFilter* );
+
+    QString                     selectedObject() const;
+    void                        setSectedObject( const QString& );
+
+    void                        reset();
+
+signals:
+    void                        objectSelected( const QString& );
+
+private slots:
+    void                        onSelectionChanged();
+    void                        onIndexChanged( int );
+
+protected:
+    QStringList                 objectNames() const;
+    SUIT_SelectionMgr*          selectionMgr() const;
+
+private:
+    ObjectKind                  myType;
+    QComboBox*                  myObject;
+    HYDROGUI_Module*            myModule;
+    HYDROGUI_ObjComboBoxFilter* myFilter;
+};
+
+class HYDROGUI_ObjComboBoxFilter
+{
+public:
+    HYDROGUI_ObjComboBoxFilter() {};
+    virtual ~HYDROGUI_ObjComboBoxFilter() {};
+
+    virtual bool isOk( const Handle(HYDROData_Entity)& ) const = 0;
+};
+
+#endif
index 2f96689b6bbf0e02fd856d0bdc08bde7e745fb0e..a5a4ea75dfff10c230e97ccba1910253186d1b44 100644 (file)
@@ -57,6 +57,7 @@
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_ZLevelsOp.h"
 #include "HYDROGUI_LocalCSOp.h"
+#include "HYDROGUI_RiverBottomOp.h"
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Obstacle.h>
@@ -180,6 +181,8 @@ void HYDROGUI_Module::createActions()
   createAction( ShowAllId, "SHOW_ALL" );
   createAction( HideId, "HIDE" );
   createAction( HideAllId, "HIDE_ALL" );
+
+  createAction( RiverBottom, "CREATE_RIVER_BOTTOM", "CREATE_RIVER_BOTTOM_ICO" );
 }
 
 void HYDROGUI_Module::createMenus()
@@ -202,6 +205,7 @@ void HYDROGUI_Module::createMenus()
   createMenu( ImportBathymetryId, aHydroId, -1, -1 );
   createMenu( CreatePolylineId, aHydroId, -1, -1 );
   createMenu( CreatePolyline3DId, aHydroId, -1, -1 );
+  createMenu( RiverBottom, aHydroId, -1, -1 );
   createMenu( EditLocalCSId, aHydroId, -1, -1 );
 
   int aNewProfileId = createMenu( tr( "MEN_DESK_PROFILE" ), aHydroId, -1 );
@@ -505,6 +509,9 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
   case EditLocalCSId:
     anOp = new HYDROGUI_LocalCSOp( aModule );
     break;
+  case RiverBottom:
+    anOp = new HYDROGUI_RiverBottomOp( aModule );
+    break;
   case ShowId:
   case ShowOnlyId:
   case ShowAllId:
index e7c348347a01dff717c483cb69af55ffeb05b5a2..8745e1078c11c68c367c5751c576113673abe991 100644 (file)
@@ -107,6 +107,7 @@ enum OperationId
   SetZLevelId,
   EditLocalCSId,
 
+  RiverBottom
 };
 
 #endif
index d5460cc4140ec49a6e435d2f99662b6048fe636d..ea9bfd8a00c8f91149fe38c99c5edeee0949f317 100644 (file)
@@ -46,7 +46,8 @@
 #include <QMouseEvent>
 
 HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QString& theTitle )
-: HYDROGUI_InputPanel( theModule, theTitle ), myName(NULL)
+: HYDROGUI_ViewerDlg( theModule, theTitle ),
+  myName( NULL )
 {
   QHBoxLayout* aNameLayout = new QHBoxLayout();
   QLabel* aNameLabel = new QLabel(tr("PROFILE_NAME_TLT"), this);
@@ -71,68 +72,17 @@ HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QStr
   anAddElementLayout->setMargin( 0 );
   anAddElementLayout->setSpacing( 5 );
 
-  myViewManager = new OCCViewer_ViewManager( theModule->getApp()->activeStudy(), 0 );
-  OCCViewer_Viewer* aViewer = new OCCViewer_Viewer( false /*erase trihedron*/);
-
-  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
-  aViewer->setBackground( OCCViewer_ViewFrame::TOP_LEFT,
-                     aResMgr->backgroundValue( "OCCViewer", "xz_background", aViewer->background(OCCViewer_ViewFrame::TOP_LEFT) ) );
-  aViewer->setBackground( OCCViewer_ViewFrame::TOP_RIGHT,
-                     aResMgr->backgroundValue( "OCCViewer", "yz_background", aViewer->background(OCCViewer_ViewFrame::TOP_RIGHT) ) );
-  aViewer->setBackground( OCCViewer_ViewFrame::BOTTOM_LEFT,
-                     aResMgr->backgroundValue( "OCCViewer", "xy_background", aViewer->background(OCCViewer_ViewFrame::BOTTOM_LEFT) ) );
-  aViewer->setBackground( OCCViewer_ViewFrame::BOTTOM_RIGHT,
-                     aResMgr->backgroundValue( "OCCViewer", "background", aViewer->background(OCCViewer_ViewFrame::MAIN_VIEW) ) );
-
-  aViewer->setTrihedronSize( aResMgr->doubleValue( "3DViewer", "trihedron_size", aViewer->trihedronSize() ),
-                        aResMgr->booleanValue( "3DViewer", "relative_size", aViewer->trihedronRelative() ));
-  aViewer->setInteractionStyle( aResMgr->integerValue( "3DViewer", "navigation_mode", aViewer->interactionStyle() ) );
-  aViewer->setZoomingStyle( aResMgr->integerValue( "3DViewer", "zooming_mode", aViewer->zoomingStyle() ) );
-  aViewer->enablePreselection( aResMgr->booleanValue( "OCCViewer", "enable_preselection", aViewer->isPreselectionEnabled() ) );
-  aViewer->enableSelection( aResMgr->booleanValue( "OCCViewer", "enable_selection", aViewer->isSelectionEnabled() ) );
-
-  myViewManager->setViewModel( aViewer );// custom view model, which extends SALOME_View interface
-  SUIT_ViewWindow* aViewWin = myViewManager->createViewWindow();
-  aViewer->setStaticTrihedronDisplayed( false );
-  Handle(AIS_Trihedron) aTrihedron = HYDROGUI_AISTrihedron::createTrihedron(
-                         aResMgr->doubleValue( "3DViewer", "trihedron_size",
-                                               aViewer->trihedronSize() ));
-  Handle(AIS_InteractiveContext) anAISContext = aViewer->getAISContext();
-  if ( !anAISContext.IsNull() ) {
-    anAISContext->Display( aTrihedron );
-    anAISContext->Deactivate( aTrihedron );
-  }
-
-  addWidget( aViewWin, 4 );
-  myEditorWidget->setOCCViewer( aViewer );
+  myEditorWidget->setOCCViewer( viewer() );
 
   connect( myEditorWidget, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
   connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*, bool) ), this, SLOT( processStartedSubOperation(QWidget*, bool) ) );
   connect( myEditorWidget, SIGNAL( subOperationFinished(QWidget*) ), this, SLOT( processFinishedSubOperation(QWidget*) ) );
 
   myAddElementBox->hide();
-
-  // Coordinates
-  connect( myViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
-           this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
-  if ( aViewWin ) {
-    OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( aViewWin );
-    if ( aViewFrame && aViewFrame->getViewPort() ) {
-      aViewFrame->getViewPort()->installEventFilter( this );
-    }
-  }
-
-  myCoordLabel = new QLabel( this );
-  QHBoxLayout* aCoordLayout = new QHBoxLayout();
-  aCoordLayout->addWidget( myCoordLabel );
-  aCoordLayout->addStretch();
-
-  addLayout( aCoordLayout );
 }
 
 HYDROGUI_ProfileDlg::~HYDROGUI_ProfileDlg()
 {
-  delete myViewManager;
 }
 
 void HYDROGUI_ProfileDlg::reset()
@@ -141,12 +91,6 @@ void HYDROGUI_ProfileDlg::reset()
   myEditorWidget->setActionMode( CurveCreator_Widget::AdditionMode );
 }
 
-Handle(AIS_InteractiveContext) HYDROGUI_ProfileDlg::getAISContext()
-{
-  OCCViewer_Viewer* aViewer = (OCCViewer_Viewer*)myViewManager->getViewModel();
-  return aViewer ? aViewer->getAISContext() : 0;
-}
-
 void HYDROGUI_ProfileDlg::setProfileName( const QString& theName )
 {
   myName->setText(theName);
@@ -210,31 +154,3 @@ void HYDROGUI_ProfileDlg::processFinishedSubOperation( QWidget* theWidget )
   theWidget->hide();
   myAddElementBox->hide();
 }
-
-void HYDROGUI_ProfileDlg::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
-{
-  OCCViewer_ViewWindow* anOCCViewWindow = 
-    dynamic_cast<OCCViewer_ViewWindow*>(theViewWindow);
-  if ( anOCCViewWindow && anOCCViewWindow->getViewPort() ) {
-    gp_Pnt aPnt = CurveCreator_Utils::ConvertClickToPoint( 
-      theEvent->x(), theEvent->y(), anOCCViewWindow->getViewPort()->getView() );
-
-    // Show the coordinates
-    QString aX = HYDROGUI_Tool::GetCoordinateString( aPnt.X(), true );
-    QString anY = HYDROGUI_Tool::GetCoordinateString( aPnt.Y(), true );
-    myCoordLabel->setText( tr("UZ_COORDINATES_INFO").arg( aX ).arg( anY ) );
-  }
-}
-
-bool HYDROGUI_ProfileDlg::eventFilter( QObject* theObj, QEvent* theEvent )
-{
-  if ( theObj->inherits( "OCCViewer_ViewPort" ) )
-  {
-    if ( theEvent->type() == QEvent::Leave )
-      myCoordLabel->clear();
-
-    return false;
-  }
-
-  return HYDROGUI_InputPanel::eventFilter( theObj, theEvent );
-}
index d8ec36bb944f449dd561adabcf863585a3a4f689..9f5969f425c864f2cf2409fc73390ad0d03bc6fb 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef HYDROGUI_PROFILEDLG_H
 #define HYDROGUI_PROFILEDLG_H
 
-#include "HYDROGUI_InputPanel.h"
+#include "HYDROGUI_ViewerDlg.h"
 
 #include <AIS_InteractiveContext.hxx>
 
@@ -35,7 +35,7 @@ class QGroupBox;
 class QLineEdit;
 class QLabel;
 
-class HYDROGUI_ProfileDlg : public HYDROGUI_InputPanel
+class HYDROGUI_ProfileDlg : public HYDROGUI_ViewerDlg
 {
   Q_OBJECT
 
@@ -43,8 +43,6 @@ public:
   HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QString& theTitle );
   virtual ~HYDROGUI_ProfileDlg();
 
-  Handle(AIS_InteractiveContext) getAISContext();
-
   void  setProfileName( const QString& theName );
   QString getProfileName() const;
        
@@ -57,27 +55,21 @@ public:
   void  deleteSelected();
   bool  deleteEnabled();
 
-protected:
-  virtual bool eventFilter( QObject*, QEvent* );
-
 protected slots:
   void processStartedSubOperation( QWidget*, bool );
   void processFinishedSubOperation( QWidget* );
 
-  void onMouseMove( SUIT_ViewWindow*, QMouseEvent* );
-
 signals:
   void                  createPreview( QString );
   void                  selectionChanged();
   void                  widgetCreated(QWidget*);
   void                  subOperationStarted(QWidget*);
   void                  subOperationFinished(QWidget*);
+
 private:
   QLineEdit*             myName;
   CurveCreator_Widget*   myEditorWidget;
   QGroupBox*             myAddElementBox;
-  OCCViewer_ViewManager* myViewManager;
-  QLabel*                myCoordLabel;
 };
 
 #endif
diff --git a/src/HYDROGUI/HYDROGUI_ProfileInterpolateDlg.cxx b/src/HYDROGUI/HYDROGUI_ProfileInterpolateDlg.cxx
new file mode 100644 (file)
index 0000000..04e6cee
--- /dev/null
@@ -0,0 +1,240 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_ProfileInterpolateDlg.h"
+
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_AISTrihedron.h"
+
+#include <CurveCreator_Widget.h>
+#include <CurveCreator_ICurve.hxx>
+#include <CurveCreator_Utils.hxx>
+
+#include <OCCViewer_ViewPort3d.h>
+#include <OCCViewer_Utilities.h>
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewFrame.h>
+#include <LightApp_Application.h>
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QMouseEvent>
+
+HYDROGUI_ProfileInterpolateDlg::HYDROGUI_ProfileInterpolateDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+: HYDROGUI_InputPanel( theModule, theTitle ), myName(NULL)
+{
+  QHBoxLayout* aNameLayout = new QHBoxLayout();
+  QLabel* aNameLabel = new QLabel(tr("PROFILE_NAME_TLT"), this);
+  aNameLayout->addWidget(aNameLabel);
+  myName = new QLineEdit(this);
+  aNameLayout->addWidget(myName);
+
+  addLayout(aNameLayout);
+
+  int anActionFlags = 
+    CurveCreator_Widget::DisableNewSection | CurveCreator_Widget::DisableDetectionMode |
+    CurveCreator_Widget::DisableClosedSection;
+  QStringList aCoordTitles;
+  aCoordTitles << tr( "U_TITLE" ) << tr( "Z_TITLE" );
+  myEditorWidget = new CurveCreator_Widget( this, NULL, anActionFlags, aCoordTitles );
+  addWidget( myEditorWidget, 3 );
+
+  myAddElementBox = new QGroupBox( tr( "ADD_ELEMENT" ), this );
+  addWidget( myAddElementBox, 2 );
+
+  QBoxLayout* anAddElementLayout = new QVBoxLayout( myAddElementBox );
+  anAddElementLayout->setMargin( 0 );
+  anAddElementLayout->setSpacing( 5 );
+
+  myViewManager = new OCCViewer_ViewManager( theModule->getApp()->activeStudy(), 0 );
+  OCCViewer_Viewer* aViewer = new OCCViewer_Viewer( false );
+
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  aViewer->setBackground( OCCViewer_ViewFrame::TOP_LEFT,
+                     aResMgr->backgroundValue( "OCCViewer", "xz_background", aViewer->background(OCCViewer_ViewFrame::TOP_LEFT) ) );
+  aViewer->setBackground( OCCViewer_ViewFrame::TOP_RIGHT,
+                     aResMgr->backgroundValue( "OCCViewer", "yz_background", aViewer->background(OCCViewer_ViewFrame::TOP_RIGHT) ) );
+  aViewer->setBackground( OCCViewer_ViewFrame::BOTTOM_LEFT,
+                     aResMgr->backgroundValue( "OCCViewer", "xy_background", aViewer->background(OCCViewer_ViewFrame::BOTTOM_LEFT) ) );
+  aViewer->setBackground( OCCViewer_ViewFrame::BOTTOM_RIGHT,
+                     aResMgr->backgroundValue( "OCCViewer", "background", aViewer->background(OCCViewer_ViewFrame::MAIN_VIEW) ) );
+
+  aViewer->setTrihedronSize( aResMgr->doubleValue( "3DViewer", "trihedron_size", aViewer->trihedronSize() ),
+                        aResMgr->booleanValue( "3DViewer", "relative_size", aViewer->trihedronRelative() ));
+  aViewer->setInteractionStyle( aResMgr->integerValue( "3DViewer", "navigation_mode", aViewer->interactionStyle() ) );
+  aViewer->setZoomingStyle( aResMgr->integerValue( "3DViewer", "zooming_mode", aViewer->zoomingStyle() ) );
+  aViewer->enablePreselection( aResMgr->booleanValue( "OCCViewer", "enable_preselection", aViewer->isPreselectionEnabled() ) );
+  aViewer->enableSelection( aResMgr->booleanValue( "OCCViewer", "enable_selection", aViewer->isSelectionEnabled() ) );
+
+  myViewManager->setViewModel( aViewer );// custom view model, which extends SALOME_View interface
+  SUIT_ViewWindow* aViewWin = myViewManager->createViewWindow();
+  aViewer->setStaticTrihedronDisplayed( false );
+  Handle(AIS_Trihedron) aTrihedron = HYDROGUI_AISTrihedron::createTrihedron(
+                         aResMgr->doubleValue( "3DViewer", "trihedron_size",
+                                               aViewer->trihedronSize() ));
+  Handle(AIS_InteractiveContext) anAISContext = aViewer->getAISContext();
+  if ( !anAISContext.IsNull() ) {
+    anAISContext->Display( aTrihedron );
+    anAISContext->Deactivate( aTrihedron );
+  }
+
+  addWidget( aViewWin, 4 );
+  myEditorWidget->setOCCViewer( aViewer );
+
+  connect( myEditorWidget, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
+  connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*, bool) ), this, SLOT( processStartedSubOperation(QWidget*, bool) ) );
+  connect( myEditorWidget, SIGNAL( subOperationFinished(QWidget*) ), this, SLOT( processFinishedSubOperation(QWidget*) ) );
+
+  myAddElementBox->hide();
+
+  // Coordinates
+  connect( myViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
+           this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
+  if ( aViewWin ) {
+    OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( aViewWin );
+    if ( aViewFrame && aViewFrame->getViewPort() ) {
+      aViewFrame->getViewPort()->installEventFilter( this );
+    }
+  }
+
+  myCoordLabel = new QLabel( this );
+  QHBoxLayout* aCoordLayout = new QHBoxLayout();
+  aCoordLayout->addWidget( myCoordLabel );
+  aCoordLayout->addStretch();
+
+  addLayout( aCoordLayout );
+}
+
+HYDROGUI_ProfileInterpolateDlg::~HYDROGUI_ProfileInterpolateDlg()
+{
+  delete myViewManager;
+}
+
+void HYDROGUI_ProfileInterpolateDlg::reset()
+{
+  myEditorWidget->reset();
+  myEditorWidget->setActionMode( CurveCreator_Widget::AdditionMode );
+}
+
+Handle(AIS_InteractiveContext) HYDROGUI_ProfileInterpolateDlg::getAISContext()
+{
+  OCCViewer_Viewer* aViewer = (OCCViewer_Viewer*)myViewManager->getViewModel();
+  return aViewer ? aViewer->getAISContext() : 0;
+}
+
+void HYDROGUI_ProfileInterpolateDlg::setProfileName( const QString& theName )
+{
+  myName->setText(theName);
+}
+
+QString HYDROGUI_ProfileInterpolateDlg::getProfileName() const
+{
+  return myName->text();
+}
+
+void HYDROGUI_ProfileInterpolateDlg::setProfile( CurveCreator_ICurve* theProfile )
+{
+  myEditorWidget->setCurve( theProfile );
+
+  // select the single section by default
+  QList<int> aSections;
+  aSections << 0;
+  myEditorWidget->setSelectedSections( aSections );
+}
+
+QList<int> HYDROGUI_ProfileInterpolateDlg::getSelectedSections()
+{
+  return myEditorWidget->getSelectedSections();
+}
+
+/**
+ * Redirect the delete action to editor widget
+ */
+void HYDROGUI_ProfileInterpolateDlg::deleteSelected()
+{
+  myEditorWidget->removeSelected();
+}
+
+/**
+ * Checks whether there are some to delete
+ */
+bool HYDROGUI_ProfileInterpolateDlg::deleteEnabled()
+{
+  return myEditorWidget->removeEnabled();
+}
+
+void HYDROGUI_ProfileInterpolateDlg::processStartedSubOperation( QWidget* theWidget, bool theIsEdit )
+{
+  myEditorWidget->setEnabled( false );
+
+  myAddElementBox->setTitle( theIsEdit ? tr( "EDIT_ELEMENT" ) : tr( "ADD_ELEMENT" ) );
+  QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( myAddElementBox->layout() );
+  anAddElementLayout->addWidget( theWidget );
+
+  theWidget->show();
+  myAddElementBox->show();
+}
+
+void HYDROGUI_ProfileInterpolateDlg::processFinishedSubOperation( QWidget* theWidget )
+{
+  myEditorWidget->setEnabled( true );
+
+  QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( myAddElementBox->layout() );
+  anAddElementLayout->removeWidget( theWidget );
+
+  theWidget->hide();
+  myAddElementBox->hide();
+}
+
+void HYDROGUI_ProfileInterpolateDlg::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
+{
+  OCCViewer_ViewWindow* anOCCViewWindow = 
+    dynamic_cast<OCCViewer_ViewWindow*>(theViewWindow);
+  if ( anOCCViewWindow && anOCCViewWindow->getViewPort() ) {
+    gp_Pnt aPnt = CurveCreator_Utils::ConvertClickToPoint( 
+      theEvent->x(), theEvent->y(), anOCCViewWindow->getViewPort()->getView() );
+
+    // Show the coordinates
+    QString aX = HYDROGUI_Tool::GetCoordinateString( aPnt.X(), true );
+    QString anY = HYDROGUI_Tool::GetCoordinateString( aPnt.Y(), true );
+    myCoordLabel->setText( tr("UZ_COORDINATES_INFO").arg( aX ).arg( anY ) );
+  }
+}
+
+bool HYDROGUI_ProfileInterpolateDlg::eventFilter( QObject* theObj, QEvent* theEvent )
+{
+  if ( theObj->inherits( "OCCViewer_ViewPort" ) )
+  {
+    if ( theEvent->type() == QEvent::Leave )
+      myCoordLabel->clear();
+
+    return false;
+  }
+
+  return HYDROGUI_InputPanel::eventFilter( theObj, theEvent );
+}
diff --git a/src/HYDROGUI/HYDROGUI_ProfileInterpolateDlg.h b/src/HYDROGUI/HYDROGUI_ProfileInterpolateDlg.h
new file mode 100644 (file)
index 0000000..a20a92b
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_PROFILEINTERPOLATEDLG_H
+#define HYDROGUI_PROFILEINTERPOLATEDLG_H
+
+#include "HYDROGUI_InputPanel.h"
+
+#include <AIS_InteractiveContext.hxx>
+
+class CurveCreator_Widget;
+class CurveCreator_ICurve;
+class OCCViewer_ViewManager;
+class SUIT_ViewWindow;
+class QGroupBox;
+class QLineEdit;
+class QLabel;
+
+class HYDROGUI_ProfileInterpolateDlg : public HYDROGUI_InputPanel
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_ProfileInterpolateDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+  virtual ~HYDROGUI_ProfileInterpolateDlg();
+
+  Handle(AIS_InteractiveContext) getAISContext();
+
+  void  setProfileName( const QString& theName );
+  QString getProfileName() const;
+       
+  void  setProfile( CurveCreator_ICurve* theProfile );
+
+  void  reset();
+
+  QList<int> getSelectedSections();
+
+  void  deleteSelected();
+  bool  deleteEnabled();
+
+protected:
+  virtual bool eventFilter( QObject*, QEvent* );
+
+protected slots:
+  void processStartedSubOperation( QWidget*, bool );
+  void processFinishedSubOperation( QWidget* );
+
+  void onMouseMove( SUIT_ViewWindow*, QMouseEvent* );
+
+signals:
+  void                  createPreview( QString );
+  void                  selectionChanged();
+  void                  widgetCreated(QWidget*);
+  void                  subOperationStarted(QWidget*);
+  void                  subOperationFinished(QWidget*);
+private:
+  QLineEdit*             myName;
+  CurveCreator_Widget*   myEditorWidget;
+  QGroupBox*             myAddElementBox;
+  OCCViewer_ViewManager* myViewManager;
+  QLabel*                myCoordLabel;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.cxx b/src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.cxx
new file mode 100644 (file)
index 0000000..169b628
--- /dev/null
@@ -0,0 +1,279 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_Module.h>
+#include <HYDROGUI_ProfileInterpolateOp.h>
+#include <HYDROGUI_ProfileDlg.h>
+#include <HYDROGUI_Tool.h>
+#include <HYDROGUI_UpdateFlags.h>
+#include <HYDROGUI_DataObject.h>
+#include <HYDROData_Document.h>
+#include <HYDROData_Profile.h>
+#include <HYDROGUI_CurveCreatorProfile.h>
+#include <CurveCreator_Displayer.hxx>
+
+#include <LightApp_Application.h>
+#include <LightApp_SelectionMgr.h>
+#include <LightApp_UpdateFlags.h>
+
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewModel.h>
+#include <OCCViewer_ViewWindow.h>
+
+#include <OCCViewer_AISSelector.h>
+
+#include <Precision.hxx>
+
+//static int ZValueIncrement = 0;
+
+HYDROGUI_ProfileInterpolateOp::HYDROGUI_ProfileInterpolateOp( HYDROGUI_Module* theModule, bool theIsEdit )
+: HYDROGUI_Operation( theModule ), myIsEdit(theIsEdit), myProfile(NULL)
+{
+  setName( theIsEdit ? tr( "EDIT_PROFILE" ) : tr( "CREATE_PROFILE" ) );
+}
+
+HYDROGUI_ProfileInterpolateOp::~HYDROGUI_ProfileInterpolateOp()
+{
+  erasePreview();
+}
+
+/**
+ * Redirect the delete action to input panel
+ */
+void HYDROGUI_ProfileInterpolateOp::deleteSelected()
+{
+  HYDROGUI_ProfileDlg* aPanel = (HYDROGUI_ProfileDlg*)inputPanel();
+  aPanel->deleteSelected();
+}
+
+/**
+ * Checks whether there are some to delete
+ */
+bool HYDROGUI_ProfileInterpolateOp::deleteEnabled()
+{
+  HYDROGUI_ProfileDlg* aPanel = (HYDROGUI_ProfileDlg*)inputPanel();
+  return aPanel->deleteEnabled();
+}
+
+void HYDROGUI_ProfileInterpolateOp::startOperation()
+{
+  if( myProfile )
+    delete myProfile;
+
+  myProfile = new HYDROGUI_CurveCreatorProfile();
+
+  HYDROGUI_Operation::startOperation();
+
+  HYDROGUI_ProfileDlg* aPanel = (HYDROGUI_ProfileDlg*)inputPanel();
+  aPanel->reset();
+
+  if( myIsEdit )
+    myEditedObject = Handle(HYDROData_Profile)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+
+  QString aProfileName;
+  if( !myEditedObject.IsNull() )
+  {
+    Handle(HYDROData_ProfileUZ) aProfileUZ = myEditedObject->GetProfileUZ( false );
+    if ( !aProfileUZ.IsNull() )
+    {
+      CurveCreator::Coordinates aCurveCoords;
+      CurveCreator::SectionsMap aSectionsMap;
+
+      HYDROData_ProfileUZ::PointsList aSectPointsList = aProfileUZ->GetPoints();
+      CurveCreator::PosPointsList aPoints;
+      for ( int k = 1, aNbPoints = aSectPointsList.Size(); k <= aNbPoints; ++k )
+      {
+        const HYDROData_ProfileUZ::Point& aSectPoint = aSectPointsList.Value( k );
+        aCurveCoords.clear();
+        aCurveCoords.push_back( aSectPoint.X() );
+        aCurveCoords.push_back( aSectPoint.Y() );
+
+        CurveCreator_PosPoint* aPosPoint = new CurveCreator_PosPoint( k, aCurveCoords );
+        aPoints.push_back( aPosPoint );
+      }
+
+      aSectionsMap[0] = aPoints;
+      myProfile->addPointsInternal( aSectionsMap );
+
+      HYDROData_ProfileUZ::SectionType aSectType = aProfileUZ->GetSectionType( 0 );
+
+      CurveCreator::SectionType aCurveType = CurveCreator::Polyline;
+      if( aSectType == HYDROData_ProfileUZ::SECTION_SPLINE )
+        aCurveType = CurveCreator::Spline;
+
+      myProfile->setSectionType( 0, aCurveType );
+    }
+
+    aProfileName = myEditedObject->GetName();
+  }
+  else
+  {
+    aProfileName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_PROFILE_NAME" ) );
+  }
+
+  aPanel->setProfileName( aProfileName );
+  aPanel->setProfile( myProfile );
+  displayPreview();
+}
+
+void HYDROGUI_ProfileInterpolateOp::abortOperation()
+{
+  erasePreview();
+
+  HYDROGUI_Operation::abortOperation();
+}
+
+void HYDROGUI_ProfileInterpolateOp::commitOperation()
+{
+  erasePreview();
+
+  HYDROGUI_Operation::commitOperation();
+}
+
+HYDROGUI_InputPanel* HYDROGUI_ProfileInterpolateOp::createInputPanel() const
+{
+  HYDROGUI_ProfileDlg* aDlg = new HYDROGUI_ProfileDlg( module(), getName() );
+  return aDlg;
+}
+
+bool HYDROGUI_ProfileInterpolateOp::processApply( int& theUpdateFlags,
+                                       QString& theErrorMsg,
+                                       QStringList& theBrowseObjectsEntries )
+{
+  HYDROGUI_ProfileDlg* aPanel = ::qobject_cast<HYDROGUI_ProfileDlg*>( inputPanel() );
+  if ( !aPanel )
+    return false;
+
+  QString aProfileName = aPanel->getProfileName().simplified();
+  if ( aProfileName.isEmpty() )
+  {
+    theErrorMsg = tr( "INCORRECT_OBJECT_NAME" );
+    return false;
+  }
+
+  if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != aProfileName ) )
+  {
+    // check that there are no other objects with the same name in the document
+    Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), aProfileName );
+    if( !anObject.IsNull() )
+    {
+      theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( aProfileName );
+      return false;
+    }
+  }
+
+  Handle(HYDROData_Profile) aProfileObj;
+  if( myIsEdit ){
+    aProfileObj = myEditedObject;
+  }
+  else{
+    aProfileObj = Handle(HYDROData_Profile)::DownCast( doc()->CreateObject( KIND_PROFILE ) );
+  }
+
+  if( aProfileObj.IsNull() )
+    return false;
+
+  Handle(HYDROData_ProfileUZ) aProfileUZ = aProfileObj->GetProfileUZ();
+  if ( aProfileUZ.IsNull() )
+    return false;
+
+  aProfileObj->SetName(aProfileName);
+
+  HYDROData_ProfileUZ::PointsList aProfileParamPoints;
+
+  CurveCreator::Coordinates aCurveCoords = myProfile->getPoints( 0 );
+  if ( aCurveCoords.size() <= 2 )
+  {
+    theErrorMsg = tr( "NUMBER_OF_PROFILE_POINTS_INCORRECT" );
+    return false;
+  }
+
+  for ( int k = 0 ; k + 1 < aCurveCoords.size() ; k++ )
+  {
+    HYDROData_ProfileUZ::Point aProfileParamPoint;
+
+    aProfileParamPoint.SetX( aCurveCoords.at( k ) );
+    k++;
+    aProfileParamPoint.SetY( aCurveCoords.at( k ) );
+
+    aProfileParamPoints.Append( aProfileParamPoint );
+  }
+  aProfileObj->SetParametricPoints( aProfileParamPoints );
+
+  HYDROData_ProfileUZ::SectionType aSectType = HYDROData_ProfileUZ::SECTION_POLYLINE;
+  if ( myProfile->getSectionType( 0 ) == CurveCreator::Spline )
+    aSectType = HYDROData_ProfileUZ::SECTION_SPLINE;
+
+  aProfileUZ->SetSectionType( 0, aSectType );
+
+  if ( !myIsEdit )
+  {
+    aProfileObj->SetBorderColor( HYDROData_Profile::DefaultBorderColor() );
+  }
+
+  // At first we update the child u,z profile object
+  aProfileUZ->SetToUpdate( true );
+  aProfileUZ->Update();
+
+  // And now we update our edited object
+  aProfileObj->Update();
+  module()->setIsToUpdate( aProfileObj );
+
+  theUpdateFlags = UF_Model;
+  if ( myIsEdit )
+    theUpdateFlags |= UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+  else
+  {
+    QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aProfileObj );
+    theBrowseObjectsEntries.append( anEntry );
+  }
+
+  return true;
+}
+
+void HYDROGUI_ProfileInterpolateOp::displayPreview()
+{
+  HYDROGUI_ProfileDlg* aPanel = dynamic_cast<HYDROGUI_ProfileDlg*>( inputPanel() );
+  if( aPanel )
+  {
+    Handle(AIS_InteractiveContext) aCtx = aPanel->getAISContext();
+    if( !aCtx.IsNull() )
+    {
+      CurveCreator_Displayer* aDisplayer = new CurveCreator_Displayer( aCtx );
+      myProfile->setDisplayer( aDisplayer );
+      aDisplayer->display( myProfile->getAISObject( true ), true );
+    }
+  }
+}
+
+void HYDROGUI_ProfileInterpolateOp::erasePreview()
+{
+  HYDROGUI_ProfileDlg* aPanel = dynamic_cast<HYDROGUI_ProfileDlg*>( inputPanel() );
+  CurveCreator_Displayer* aDisplayer = myProfile ? myProfile->getDisplayer() : 0;
+  if( aPanel && aDisplayer )
+  {
+    Handle(AIS_InteractiveContext) aCtx = aPanel->getAISContext();
+    if( !aCtx.IsNull() )
+    {
+      aDisplayer->eraseAll( true );
+    }
+  }
+}
diff --git a/src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.h b/src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.h
new file mode 100644 (file)
index 0000000..d437d55
--- /dev/null
@@ -0,0 +1,63 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_PROFILEINTERPOLATEOP_H
+#define HYDROGUI_PROFILEINTERPOLATEOP_H
+
+#include "HYDROGUI_Operation.h"
+
+#include <HYDROData_Profile.h>
+
+class HYDROGUI_CurveCreatorProfile;
+
+class HYDROGUI_ProfileInterpolateOp : public HYDROGUI_Operation
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_ProfileInterpolateOp( HYDROGUI_Module* theModule, bool isEdit );
+  virtual ~HYDROGUI_ProfileInterpolateOp();
+
+  void                       deleteSelected();
+  bool                       deleteEnabled();
+
+protected:
+  virtual void               startOperation();
+  virtual void               abortOperation();
+  virtual void               commitOperation();
+
+  virtual HYDROGUI_InputPanel* createInputPanel() const;
+
+  virtual bool               processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries );
+
+private:
+  void                       displayPreview();
+  void                       erasePreview();
+
+private:
+  bool                       myIsEdit;
+  Handle(HYDROData_Profile)  myEditedObject;
+  HYDROGUI_CurveCreatorProfile* myProfile;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_RiverBottomDlg.cxx b/src/HYDROGUI/HYDROGUI_RiverBottomDlg.cxx
new file mode 100644 (file)
index 0000000..0922662
--- /dev/null
@@ -0,0 +1,68 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_RiverBottomDlg.h"
+
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_ObjComboBox.h"
+
+#include <QLabel>
+#include <QLayout>
+#include <QComboBox>
+#include <QGroupBox>
+
+HYDROGUI_RiverBottomDlg::HYDROGUI_RiverBottomDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+    : HYDROGUI_InputPanel( theModule, theTitle )
+{
+    // Channel name
+    QGroupBox* group = new QGroupBox( mainFrame() );
+    QBoxLayout* base = new QVBoxLayout( group );
+
+    base->addWidget( myRivers = new HYDROGUI_ObjComboBox( theModule, tr( "RIVER_OBJECT" ), KIND_STREAM, group ) );
+
+    addWidget( group );
+
+    addStretch();
+}
+
+HYDROGUI_RiverBottomDlg::~HYDROGUI_RiverBottomDlg()
+{
+}
+
+void HYDROGUI_RiverBottomDlg::reset()
+{
+    bool isBlocked = blockSignals( true );
+
+    myRivers->reset();
+
+    blockSignals( isBlocked );
+}
+
+QString HYDROGUI_RiverBottomDlg::getRiverName() const
+{
+    return myRivers->selectedObject();
+}
+
+void HYDROGUI_RiverBottomDlg::setRiverName( const QString& theName )
+{
+    myRivers->setSectedObject( theName );
+}
diff --git a/src/HYDROGUI/HYDROGUI_RiverBottomDlg.h b/src/HYDROGUI/HYDROGUI_RiverBottomDlg.h
new file mode 100644 (file)
index 0000000..a59e71b
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_RIVERBOTTOMDlg_H
+#define HYDROGUI_RIVERBOTTOMDlg_H
+
+#include "HYDROGUI_InputPanel.h"
+
+class QComboBox;
+class HYDROGUI_ObjComboBox;
+
+class HYDROGUI_RiverBottomDlg : public HYDROGUI_InputPanel
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_RiverBottomDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+  virtual ~HYDROGUI_RiverBottomDlg();
+
+  void                       reset();
+
+  QString                    getRiverName() const;
+  void                       setRiverName( const QString& );
+
+protected:
+  HYDROGUI_ObjComboBox*      myRivers;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_RiverBottomOp.cxx b/src/HYDROGUI/HYDROGUI_RiverBottomOp.cxx
new file mode 100644 (file)
index 0000000..f031221
--- /dev/null
@@ -0,0 +1,149 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_RiverBottomOp.h"
+
+#include "HYDROGUI_RiverBottomDlg.h"
+
+#include "HYDROGUI_DataModel.h"
+#include "HYDROGUI_DataObject.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Shape.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_UpdateFlags.h"
+
+#include <HYDROData_River.h>
+#include <HYDROData_Iterator.h>
+
+/*
+#include <HYDROData_Profile.h>
+
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewModel.h>
+
+#include <LightApp_Application.h>
+#include <LightApp_UpdateFlags.h>
+
+#include <TopoDS.hxx>
+*/
+
+HYDROGUI_RiverBottomOp::HYDROGUI_RiverBottomOp( HYDROGUI_Module* theModule )
+: HYDROGUI_Operation( theModule )
+{
+  setName( tr( "FIND_RIVER_BOTTOM" ) );
+}
+
+HYDROGUI_RiverBottomOp::~HYDROGUI_RiverBottomOp()
+{
+}
+
+void HYDROGUI_RiverBottomOp::startOperation()
+{
+  HYDROGUI_Operation::startOperation();
+
+  HYDROGUI_RiverBottomDlg* aPanel = ::qobject_cast<HYDROGUI_RiverBottomDlg*>( inputPanel() );
+
+  aPanel->reset();
+  /*
+  QString aRiver;
+  Handle(HYDROData_River) aRiverObj = Handle(HYDROData_River)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+  if ( !aRiverObj.IsNull() )
+      aRiver = aRiverObj->GetName();
+
+  aPanel->setRiverName( aRiver );
+  */
+}
+
+void HYDROGUI_RiverBottomOp::abortOperation()
+{
+//  erasePreview();
+  HYDROGUI_Operation::abortOperation();
+}
+
+void HYDROGUI_RiverBottomOp::commitOperation()
+{
+//  erasePreview();
+  HYDROGUI_Operation::commitOperation();
+}
+
+HYDROGUI_InputPanel* HYDROGUI_RiverBottomOp::createInputPanel() const
+{
+  HYDROGUI_RiverBottomDlg* aPanel = new HYDROGUI_RiverBottomDlg( module(), getName() );
+  return aPanel;
+}
+
+bool HYDROGUI_RiverBottomOp::processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                           QStringList& theBrowseObjectsEntries )
+{
+  HYDROGUI_RiverBottomDlg* aPanel = ::qobject_cast<HYDROGUI_RiverBottomDlg*>( inputPanel() );
+  if ( !aPanel )
+    return false;
+
+  Handle(HYDROData_River) aRiver = riverObject( aPanel->getRiverName() );
+  if ( aRiver.IsNull() )
+  {
+    theErrorMsg = tr( "INCORRECT_RIVER_OBJECT" );
+    return false;
+  }
+
+  startDocOperation();
+
+//  Handle(HYDRO_RiverBottom) aBottom = createNewObject();
+//  aBottom->SetName( QString( "%1_Bottom" ).arg( aRiver->GetName() ) );
+
+//  erasePreview();
+
+//    module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), aBottom, true );
+//    theBrowseObjectsEntries.append( HYDROGUI_DataObject::dataObjectEntry( aBottom ) );
+
+//  module()->setIsToUpdate( aBottom );
+
+  theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
+
+  commitDocOperation();
+
+  return true;
+}
+/*
+Handle(HYDROData_RiverBottom) HYDROGUI_RiverBottomOp::createNewObject()
+{
+  return Handle(HYDROData_RiverBottom)::DownCast( doc()->CreateObject( KIND_RIVERBOTTOM ) );
+}
+*/
+
+Handle(HYDROData_River) HYDROGUI_RiverBottomOp::riverObject( const QString& theName ) const
+{
+    return Handle(HYDROData_River)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), theName ) );
+}
+QStringList HYDROGUI_RiverBottomOp::riverNames( bool all ) const
+{
+    QStringList aNames;
+/*
+    for ( HYDROData_Iterator it( HYDROData_Document::Document( module()->getStudyId() ), KIND_RIVER ); it.More(); it.Next() )
+    {
+        it.Current();
+        if ( !aRiver.IsNull() && ( all || !aRiver->HasBottom() )
+            aNames.append( aRiver->GetName() );
+    }
+*/
+    return aNames;
+}
diff --git a/src/HYDROGUI/HYDROGUI_RiverBottomOp.h b/src/HYDROGUI/HYDROGUI_RiverBottomOp.h
new file mode 100644 (file)
index 0000000..b99b666
--- /dev/null
@@ -0,0 +1,56 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_RiverBottomOp_H
+#define HYDROGUI_RiverBottomOp_H
+
+#include "HYDROGUI_Operation.h"
+
+#include <HYDROData_River.h>
+
+class HYDROGUI_RiverBottomOp : public HYDROGUI_Operation
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_RiverBottomOp( HYDROGUI_Module* theModule );
+  virtual ~HYDROGUI_RiverBottomOp();
+
+protected:
+  virtual void                 startOperation();
+  virtual void                 abortOperation();
+  virtual void                 commitOperation();
+
+  virtual HYDROGUI_InputPanel* createInputPanel() const;
+
+  virtual bool                 processApply( int& theUpdateFlags, QString& theErrorMsg,
+                                             QStringList& theBrowseObjectsEntries );
+
+private:
+  Handle(HYDROData_River)      riverObject( const QString& ) const;
+  QStringList                  riverNames( bool all = false ) const;
+
+protected:
+//  Handle(HYDROData_RiverBottom) createNewObject() const;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_ViewerDlg.cxx b/src/HYDROGUI/HYDROGUI_ViewerDlg.cxx
new file mode 100644 (file)
index 0000000..e2ca565
--- /dev/null
@@ -0,0 +1,160 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_ViewerDlg.h"
+
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_AISTrihedron.h"
+
+#include <CurveCreator_Widget.h>
+#include <CurveCreator_ICurve.hxx>
+#include <CurveCreator_Utils.hxx>
+
+#include <OCCViewer_ViewPort3d.h>
+#include <OCCViewer_Utilities.h>
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewFrame.h>
+#include <LightApp_Application.h>
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QMouseEvent>
+
+HYDROGUI_ViewerDlg::HYDROGUI_ViewerDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+: HYDROGUI_InputPanel( theModule, theTitle )
+{
+  QWidget* viewMain = new QWidget( mainFrame() );
+  QVBoxLayout* viewBase = new QVBoxLayout( viewMain );
+  viewBase->setMargin( 0 );
+
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  myViewManager = new OCCViewer_ViewManager( theModule->getApp()->activeStudy(), 0 );
+  OCCViewer_Viewer* aViewer = new OCCViewer_Viewer( false );
+
+  aViewer->setBackground( OCCViewer_ViewFrame::TOP_LEFT,
+                          aResMgr->backgroundValue( "OCCViewer", "xz_background", aViewer->background(OCCViewer_ViewFrame::TOP_LEFT) ) );
+  aViewer->setBackground( OCCViewer_ViewFrame::TOP_RIGHT,
+                          aResMgr->backgroundValue( "OCCViewer", "yz_background", aViewer->background(OCCViewer_ViewFrame::TOP_RIGHT) ) );
+  aViewer->setBackground( OCCViewer_ViewFrame::BOTTOM_LEFT,
+                          aResMgr->backgroundValue( "OCCViewer", "xy_background", aViewer->background(OCCViewer_ViewFrame::BOTTOM_LEFT) ) );
+  aViewer->setBackground( OCCViewer_ViewFrame::BOTTOM_RIGHT,
+                          aResMgr->backgroundValue( "OCCViewer", "background", aViewer->background(OCCViewer_ViewFrame::MAIN_VIEW) ) );
+
+  aViewer->setTrihedronSize( aResMgr->doubleValue( "3DViewer", "trihedron_size", aViewer->trihedronSize() ),
+                             aResMgr->booleanValue( "3DViewer", "relative_size", aViewer->trihedronRelative() ));
+  aViewer->setInteractionStyle( aResMgr->integerValue( "3DViewer", "navigation_mode", aViewer->interactionStyle() ) );
+  aViewer->setZoomingStyle( aResMgr->integerValue( "3DViewer", "zooming_mode", aViewer->zoomingStyle() ) );
+  aViewer->enablePreselection( aResMgr->booleanValue( "OCCViewer", "enable_preselection", aViewer->isPreselectionEnabled() ) );
+  aViewer->enableSelection( aResMgr->booleanValue( "OCCViewer", "enable_selection", aViewer->isSelectionEnabled() ) );
+
+  myViewManager->setViewModel( aViewer );// custom view model, which extends SALOME_View interface
+
+  SUIT_ViewWindow* aViewWin = myViewManager->createViewWindow();
+  aViewer->setStaticTrihedronDisplayed( false );
+  Handle(AIS_Trihedron) aTrihedron =
+      HYDROGUI_AISTrihedron::createTrihedron( aResMgr->doubleValue( "3DViewer", "trihedron_size", aViewer->trihedronSize() ) );
+  Handle(AIS_InteractiveContext) anAISContext = aViewer->getAISContext();
+  if ( !anAISContext.IsNull() )
+  {
+    anAISContext->Display( aTrihedron );
+    anAISContext->Deactivate( aTrihedron );
+  }
+
+  viewBase->addWidget( aViewWin );
+
+  // Coordinates
+  connect( myViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
+           this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
+
+  if ( aViewWin )
+  {
+    OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( aViewWin );
+    if ( aViewFrame && aViewFrame->getViewPort() )
+      aViewFrame->getViewPort()->installEventFilter( this );
+  }
+
+  myCoordLabel = new QLabel( viewMain );
+  viewBase->addWidget( myCoordLabel );
+}
+
+HYDROGUI_ViewerDlg::~HYDROGUI_ViewerDlg()
+{
+  delete myViewManager;
+}
+
+bool HYDROGUI_ViewerDlg::event( QEvent* e )
+{
+    if ( e->type() == QEvent::Polish )
+        addWidget( myCoordLabel->parentWidget(), 4 );
+
+    return HYDROGUI_InputPanel::event( e );
+}
+
+Handle(AIS_InteractiveContext) HYDROGUI_ViewerDlg::getAISContext()
+{
+  OCCViewer_Viewer* aViewer = (OCCViewer_Viewer*)myViewManager->getViewModel();
+  return aViewer ? aViewer->getAISContext() : 0;
+}
+
+OCCViewer_Viewer* HYDROGUI_ViewerDlg::viewer() const
+{
+    return ::qobject_cast<OCCViewer_Viewer*>( myViewManager->getViewModel() );
+}
+
+OCCViewer_ViewManager* HYDROGUI_ViewerDlg::viewManager() const
+{
+    return myViewManager;
+}
+
+void HYDROGUI_ViewerDlg::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
+{
+  OCCViewer_ViewWindow* anOCCViewWindow = 
+    dynamic_cast<OCCViewer_ViewWindow*>(theViewWindow);
+  if ( anOCCViewWindow && anOCCViewWindow->getViewPort() )
+  {
+    gp_Pnt aPnt = CurveCreator_Utils::ConvertClickToPoint( theEvent->x(), theEvent->y(), anOCCViewWindow->getViewPort()->getView() );
+
+    // Show the coordinates
+    QString aX = HYDROGUI_Tool::GetCoordinateString( aPnt.X(), true );
+    QString anY = HYDROGUI_Tool::GetCoordinateString( aPnt.Y(), true );
+    myCoordLabel->setText( tr("UZ_COORDINATES_INFO").arg( aX ).arg( anY ) );
+  }
+}
+
+bool HYDROGUI_ViewerDlg::eventFilter( QObject* theObj, QEvent* theEvent )
+{
+  if ( theObj->inherits( "OCCViewer_ViewPort" ) )
+  {
+    if ( theEvent->type() == QEvent::Leave )
+      myCoordLabel->clear();
+
+    return false;
+  }
+
+  return HYDROGUI_InputPanel::eventFilter( theObj, theEvent );
+}
diff --git a/src/HYDROGUI/HYDROGUI_ViewerDlg.h b/src/HYDROGUI/HYDROGUI_ViewerDlg.h
new file mode 100644 (file)
index 0000000..2b8b50b
--- /dev/null
@@ -0,0 +1,63 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// 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_VIEWERDLG_H
+#define HYDROGUI_VIEWERDLG_H
+
+#include "HYDROGUI_InputPanel.h"
+
+#include <AIS_InteractiveContext.hxx>
+
+class QLabel;
+class SUIT_ViewWindow;
+class OCCViewer_Viewer;
+class OCCViewer_ViewManager;
+
+class HYDROGUI_ViewerDlg : public HYDROGUI_InputPanel
+{
+  Q_OBJECT
+
+public:
+  HYDROGUI_ViewerDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+  virtual ~HYDROGUI_ViewerDlg();
+
+  Handle(AIS_InteractiveContext) getAISContext();
+
+  void                           deleteSelected();
+  bool                           deleteEnabled();
+
+  virtual bool                   event( QEvent* );
+
+protected:
+  OCCViewer_Viewer*              viewer() const;
+  OCCViewer_ViewManager*         viewManager() const;
+  virtual bool                   eventFilter( QObject*, QEvent* );
+
+protected slots:
+  void                           onMouseMove( SUIT_ViewWindow*, QMouseEvent* );
+
+private:
+  OCCViewer_ViewManager*         myViewManager;
+  QLabel*                        myCoordLabel;
+};
+
+#endif
index 0bcb0c31c7ce9863d799e04e5f8f171e6a71df62..9f5955f648b50209d0daec9a4cf47b98127e2a2b 100644 (file)
       <source>EDIT_SPLITTED_IMAGE_ICO</source>
       <translation>icon_edit_splitted_image.png</translation>
     </message>
-                   
+
+    <message>
+      <source>CREATE_RIVER_BOTTOM_ICO</source>
+      <translation>icon_river_bottom_image.png</translation>
+    </message>
+
   </context>
 </TS>
index e74f56c4ff009f75e20bf93e4b90ba2f60a55f1d..ea7b2ede7f03e7727dbd80926c1c8ec705da46a1 100644 (file)
@@ -1342,6 +1342,19 @@ Would you like to remove all references from the image?</translation>
       <source>STB_EDIT_LOCAL_CS</source>
       <translation>Change local CS</translation>
     </message>
+
+    <message>
+      <source>MEN_CREATE_RIVER_BOTTOM</source>
+      <translation>Find bottom</translation>
+    </message>
+    <message>
+      <source>DSK_CREATE_RIVER_BOTTOM</source>
+      <translation>Create river bottom polyline</translation>
+    </message>
+    <message>
+      <source>STB_CREATE_RIVER_BOTTOM</source>
+      <translation>Creates the river bottom polyline on selected river object</translation>
+    </message>
   </context>
   
   <context>
@@ -1483,6 +1496,14 @@ Would you like to remove all references from the image?</translation>
       <translation>Bathymetry</translation>
     </message>
   </context>
+
+  <context>
+    <name>HYDROGUI_ViewerDlg</name>
+    <message>
+      <source>UZ_COORDINATES_INFO</source>
+      <translation>U: %1, Z: %2</translation>
+    </message>
+  </context>
   
   <context>
     <name>HYDROGUI_ProfileDlg</name>
@@ -1498,10 +1519,6 @@ Would you like to remove all references from the image?</translation>
       <source>PROFILE_NAME_TLT</source>
       <translation>Name</translation>
     </message>
-    <message>
-      <source>UZ_COORDINATES_INFO</source>
-      <translation>U: %1, Z: %2</translation>
-    </message>
     <message>
       <source>U_TITLE</source>
       <translation>U</translation>
@@ -2229,4 +2246,20 @@ Polyline should consist from one not closed curve.</translation>
     </message>
   </context>
 
+  <context>
+    <name>HYDROGUI_RiverBottomDlg</name>
+    <message>
+      <source>RIVER_OBJECT</source>
+      <translation>River object</translation>
+    </message>
+  </context>
+
+  <context>
+    <name>HYDROGUI_RiverBottomOp</name>
+    <message>
+      <source>FIND_RIVER_BOTTOM</source>
+      <translation>Find river bottom</translation>
+    </message>
+  </context>
+
 </TS>