return myModule;
}
+bool HYDROGUI_InputPanel::isApplyEnabled() const
+{
+ return myApply->isEnabled();
+}
+
+void HYDROGUI_InputPanel::setApplyEnabled( bool on )
+{
+ myApply->setEnabled( on );
+}
+
void HYDROGUI_InputPanel::onApply()
{
emit panelApply();
HYDROGUI_Module* module() const;
+ bool isApplyEnabled() const;
+ void setApplyEnabled( bool );
+
signals:
void panelApply();
void panelCancel();
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include <QTimer>
#include <QLabel>
#include <QLayout>
#include <QComboBox>
QBoxLayout* base = new QHBoxLayout( this );
base->setMargin( 0 );
- base->addWidget( new QLabel( theTitle, this ) );
+ if ( !theTitle.isEmpty() )
+ base->addWidget( new QLabel( theTitle, this ) );
base->addWidget( myObject = new QComboBox( this ) );
myObject->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) );
void HYDROGUI_ObjComboBox::reset()
{
+ bool block = myObject->signalsBlocked();
+ myObject->blockSignals( true );
+
myObject->clear();
myObject->addItems( objectNames() );
- onSelectionChanged();
+ myObject->setCurrentIndex( -1 );
+
+ myObject->blockSignals( block );
+
+ onIndexChanged( myObject->currentIndex() );
+ updateSelection();
}
void HYDROGUI_ObjComboBox::setSectedObject( const QString& theName )
}
void HYDROGUI_ObjComboBox::onSelectionChanged()
+{
+ if ( !objectFilter() || objectFilter()->isActive( this ) )
+ QTimer::singleShot( 0, this, SLOT( updateSelection() ) );
+}
+
+void HYDROGUI_ObjComboBox::updateSelection()
{
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 )
+ if ( idx >= 0 && myObject->currentIndex() != idx )
+ {
+ myObject->setCurrentIndex( idx );
emit objectSelected( myObject->itemText( idx ) );
+ }
}
void onSelectionChanged();
void onIndexChanged( int );
+ void updateSelection();
+
protected:
QStringList objectNames() const;
SUIT_SelectionMgr* selectionMgr() const;
HYDROGUI_ObjComboBoxFilter() {};
virtual ~HYDROGUI_ObjComboBoxFilter() {};
+ virtual bool isActive( HYDROGUI_ObjComboBox* ) const { return true; };
virtual bool isOk( const Handle(HYDROData_Entity)& ) const = 0;
};
#include "HYDROGUI_ZLevelsOp.h"
#include "HYDROGUI_LocalCSOp.h"
#include "HYDROGUI_RiverBottomOp.h"
+#include "HYDROGUI_ProfileInterpolateOp.h"
#include <HYDROData_Document.h>
#include <HYDROData_Obstacle.h>
createAction( HideAllId, "HIDE_ALL" );
createAction( RiverBottom, "CREATE_RIVER_BOTTOM", "CREATE_RIVER_BOTTOM_ICO" );
+ createAction( ProfileInterpolate, "PROFILE_INTERPOLATE", "PROFILE_INTERPOLATE_ICO" );
}
void HYDROGUI_Module::createMenus()
createMenu( CreateProfileId, aNewProfileId, -1, -1 );
createMenu( ImportProfilesId, aNewProfileId, -1, -1 );
createMenu( AllGeoreferencementId, aNewProfileId, -1, -1 );
+ createMenu( ProfileInterpolate, aNewProfileId, -1, -1 );
int anArtificialMenuId = createMenu( tr( "MEN_DESK_ARTIFICIAL" ), aHydroId, -1 );
createMenu( CreateChannelId, anArtificialMenuId, -1, -1 );
case EditProfileId:
anOp = new HYDROGUI_ProfileOp( aModule, theId == EditProfileId );
break;
+ case ProfileInterpolate:
+ anOp = new HYDROGUI_ProfileInterpolateOp( aModule );
+ break;
case ImportProfilesId:
anOp = new HYDROGUI_ImportProfilesOp( aModule ) ;
break;
SetZLevelId,
EditLocalCSId,
- RiverBottom
+ RiverBottom,
+ ProfileInterpolate
};
#endif
theWidget->hide();
myAddElementBox->hide();
}
+
+Handle(AIS_Trihedron) HYDROGUI_ProfileDlg::trihedron()
+{
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ Handle(AIS_Trihedron) aTrihedron =
+ HYDROGUI_AISTrihedron::createTrihedron( aResMgr->doubleValue( "3DViewer", "trihedron_size", viewer()->trihedronSize() ) );
+ return aTrihedron;
+}
void subOperationStarted(QWidget*);
void subOperationFinished(QWidget*);
+protected:
+ virtual Handle(AIS_Trihedron) trihedron();
+
private:
QLineEdit* myName;
CurveCreator_Widget* myEditorWidget;
#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 "HYDROGUI_Module.h"
+#include "HYDROGUI_ObjComboBox.h"
+#include "HYDROGUI_OCCSelector.h"
#include <OCCViewer_ViewPort3d.h>
#include <OCCViewer_Utilities.h>
#include <OCCViewer_ViewFrame.h>
#include <LightApp_Application.h>
+#include <SUIT_Tools.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
-#include <QGroupBox>
-#include <QHBoxLayout>
#include <QLabel>
+#include <QSpinBox>
#include <QLineEdit>
-#include <QMouseEvent>
+#include <QTextEdit>
+#include <QGroupBox>
+#include <QComboBox>
+#include <QGridLayout>
+
+#include <HYDROData_Stream.h>
+#include <HYDROData_Profile.h>
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 );
- }
- }
+ : HYDROGUI_ViewerDlg( theModule, theTitle )
+{
+ QWidget* main = new QGroupBox( mainFrame() );
+ QGridLayout* base = new QGridLayout( main );
+
+ addWidget( main );
+
+ base->addWidget( new QLabel( tr( "RIVER_OBJECT" ), main ), 0, 0, 1, 1 );
+ base->addWidget( myRiver = new HYDROGUI_ObjComboBox( theModule, QString::null, KIND_STREAM, main ), 0, 1, 1, 1 );
+
+ base->addWidget( new QLabel( tr( "INTERPOLATOR" ), main ), 1, 0, 1, 1 );
+ base->addWidget( myIntrp = new QComboBox( main ), 1, 1, 1, 1 );
+
+ base->addWidget( new QLabel( tr( "DESCRIPTION" ), main ), 2, 0, 1, 1 );
+ base->addWidget( myDescr = new QTextEdit( main ), 2, 1, 1, 1 );
+ myDescr->setReadOnly( true );
+
+ base->addWidget( new QLabel( tr( "PROFILE_1" ), main ), 3, 0, 1, 1 );
+ base->addWidget( myProfileStart = new HYDROGUI_ObjComboBox( theModule, QString::null, KIND_PROFILE, main ), 3, 1, 1, 1 );
+ myProfileStart->setObjectFilter( this );
+
+ base->addWidget( new QLabel( tr( "PROFILE_2" ), main ), 4, 0, 1, 1 );
+ base->addWidget( myProfileFinish = new HYDROGUI_ObjComboBox( theModule, QString::null, KIND_PROFILE, main ), 4, 1, 1, 1 );
+ myProfileFinish->setObjectFilter( this );
- myCoordLabel = new QLabel( this );
- QHBoxLayout* aCoordLayout = new QHBoxLayout();
- aCoordLayout->addWidget( myCoordLabel );
- aCoordLayout->addStretch();
+ base->addWidget( new QLabel( tr( "NUMBER_OF_PROFILES" ), main ), 5, 0, 1, 1 );
+ base->addWidget( myProfileNumber = new QSpinBox( main ), 5, 1, 1, 1 );
+ myProfileNumber->setRange( 1, 1000 );
- addLayout( aCoordLayout );
+ base->addWidget( new QLabel( tr( "PARAMETERS" ), main ), 6, 0, 1, 1 );
+ base->addWidget( myParams = new QLineEdit( main ), 6, 1, 1, 1 );
+
+ connect( myRiver, SIGNAL( objectSelected( const QString& ) ), this, SLOT( onRiverChanged( const QString& ) ) );
+ connect( myIntrp, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onInterpolatorIndexChanged( int ) ) );
+
+ connect( myProfileStart, SIGNAL( objectSelected( const QString& ) ), this, SLOT( onProfileChanged( const QString& ) ) );
+ connect( myProfileFinish, SIGNAL( objectSelected( const QString& ) ), this, SLOT( onProfileChanged( const QString& ) ) );
+
+ connect( myProfileStart, SIGNAL( objectSelected( const QString& ) ), this, SIGNAL( profileStartChanged( const QString& ) ) );
+ connect( myProfileFinish, SIGNAL( objectSelected( const QString& ) ), this, SIGNAL( profileFinishChanged( const QString& ) ) );
+
+ connect( myProfileNumber, SIGNAL( valueChanged( int ) ), this, SIGNAL( profileNumberChanged( int ) ) );
+ connect( myParams, SIGNAL( myParams->textChanged( const QString& ) ), this, SIGNAL( interpolatorParametersChanged( const QString& ) ) );
+
+ new HYDROGUI_OCCSelector( module(), viewer(), selectionMgr() );
+
+ updateState();
}
HYDROGUI_ProfileInterpolateDlg::~HYDROGUI_ProfileInterpolateDlg()
{
- delete myViewManager;
}
-void HYDROGUI_ProfileInterpolateDlg::reset()
+QString HYDROGUI_ProfileInterpolateDlg::interpolator() const
{
- myEditorWidget->reset();
- myEditorWidget->setActionMode( CurveCreator_Widget::AdditionMode );
+ return myIntrp->currentText();
}
-Handle(AIS_InteractiveContext) HYDROGUI_ProfileInterpolateDlg::getAISContext()
+void HYDROGUI_ProfileInterpolateDlg::setInterpolator( const QString& theInterp )
{
- OCCViewer_Viewer* aViewer = (OCCViewer_Viewer*)myViewManager->getViewModel();
- return aViewer ? aViewer->getAISContext() : 0;
+ int idx = myIntrp->findText( theInterp );
+ if ( idx >= 0 )
+ myIntrp->setCurrentIndex( idx );
}
-void HYDROGUI_ProfileInterpolateDlg::setProfileName( const QString& theName )
+void HYDROGUI_ProfileInterpolateDlg::setInterpolators( const QStringList& theList )
{
- myName->setText(theName);
+ myIntrp->clear();
+ myIntrp->addItems( theList );
}
-QString HYDROGUI_ProfileInterpolateDlg::getProfileName() const
+QString HYDROGUI_ProfileInterpolateDlg::interpolatorDescription() const
{
- return myName->text();
+ return myDescr->toPlainText();
}
-void HYDROGUI_ProfileInterpolateDlg::setProfile( CurveCreator_ICurve* theProfile )
+void HYDROGUI_ProfileInterpolateDlg::setInterpolatorDescription( const QString& theText )
{
- myEditorWidget->setCurve( theProfile );
+ myDescr->setText( theText );
+}
- // select the single section by default
- QList<int> aSections;
- aSections << 0;
- myEditorWidget->setSelectedSections( aSections );
+QString HYDROGUI_ProfileInterpolateDlg::interpolatorParameters() const
+{
+ return myParams->text();
}
-QList<int> HYDROGUI_ProfileInterpolateDlg::getSelectedSections()
+void HYDROGUI_ProfileInterpolateDlg::setInterpolatorParameters( const QString& theLine )
{
- return myEditorWidget->getSelectedSections();
+ myParams->setText( theLine );
}
-/**
- * Redirect the delete action to editor widget
- */
-void HYDROGUI_ProfileInterpolateDlg::deleteSelected()
+QString HYDROGUI_ProfileInterpolateDlg::river() const
{
- myEditorWidget->removeSelected();
+ return myRiver->selectedObject();
}
-/**
- * Checks whether there are some to delete
- */
-bool HYDROGUI_ProfileInterpolateDlg::deleteEnabled()
+void HYDROGUI_ProfileInterpolateDlg::setRiver( const QString& theName )
{
- return myEditorWidget->removeEnabled();
+ myRiver->setSectedObject( theName );
}
-void HYDROGUI_ProfileInterpolateDlg::processStartedSubOperation( QWidget* theWidget, bool theIsEdit )
+QString HYDROGUI_ProfileInterpolateDlg::profileStart() const
{
- myEditorWidget->setEnabled( false );
+ return myProfileStart->selectedObject();
+}
- myAddElementBox->setTitle( theIsEdit ? tr( "EDIT_ELEMENT" ) : tr( "ADD_ELEMENT" ) );
- QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( myAddElementBox->layout() );
- anAddElementLayout->addWidget( theWidget );
+void HYDROGUI_ProfileInterpolateDlg::setProfileStart( const QString& theName )
+{
+ myProfileStart->setSectedObject( theName );
+}
- theWidget->show();
- myAddElementBox->show();
+QString HYDROGUI_ProfileInterpolateDlg::profileFinish() const
+{
+ return myProfileFinish->selectedObject();
}
-void HYDROGUI_ProfileInterpolateDlg::processFinishedSubOperation( QWidget* theWidget )
+void HYDROGUI_ProfileInterpolateDlg::setProfileFinish( const QString& theName )
{
- myEditorWidget->setEnabled( true );
+ myProfileFinish->setSectedObject( theName );
+}
+
+int HYDROGUI_ProfileInterpolateDlg::profileNumber() const
+{
+ return myProfileNumber->value();
+}
+
+void HYDROGUI_ProfileInterpolateDlg::setProfileNumber( int theNum )
+{
+ myProfileNumber->setValue( theNum );
+}
+
+bool HYDROGUI_ProfileInterpolateDlg::isActive( HYDROGUI_ObjComboBox* selector ) const
+{
+ return selector == activeProfile();
+}
+
+bool HYDROGUI_ProfileInterpolateDlg::isOk( const Handle(HYDROData_Entity)& theEntity ) const
+{
+ if ( theEntity.IsNull() )
+ return false;
+
+ bool res = true;
+ if ( theEntity->GetKind() == KIND_PROFILE )
+ {
+ if ( myRiverProfiles.isEmpty() )
+ {
+ Handle(HYDROData_Stream) aStream = Handle(HYDROData_Stream)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), river(), KIND_STREAM ) );
+ if ( !aStream.IsNull() )
+ {
+ HYDROData_SequenceOfObjects aProfiles = aStream->GetProfiles();
+ HYDROGUI_ProfileInterpolateDlg* that = (HYDROGUI_ProfileInterpolateDlg*)this;
+ for ( int i = aProfiles.Lower(); i <= aProfiles.Upper(); i++ )
+ that->myRiverProfiles.insert( aProfiles.Value( i )->GetName() );
+ }
+ }
+ res = myRiverProfiles.contains( theEntity->GetName() );
+ }
+ return res;
+}
+
+void HYDROGUI_ProfileInterpolateDlg::reset()
+{
+ myRiverProfiles.clear();
- QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( myAddElementBox->layout() );
- anAddElementLayout->removeWidget( theWidget );
+ myRiver->reset();
+ myProfileStart->reset();
+ myProfileFinish->reset();
- theWidget->hide();
- myAddElementBox->hide();
+ myDescr->setText( QString::null );
}
-void HYDROGUI_ProfileInterpolateDlg::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
+void HYDROGUI_ProfileInterpolateDlg::onRiverChanged( const QString& theName )
{
- 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() );
+ myRiverProfiles.clear();
- // 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 ) );
- }
+ myProfileStart->reset();
+ myProfileFinish->reset();
+
+ updateState();
+
+ emit riverChanged( theName );
}
-bool HYDROGUI_ProfileInterpolateDlg::eventFilter( QObject* theObj, QEvent* theEvent )
+void HYDROGUI_ProfileInterpolateDlg::onInterpolatorIndexChanged( int theIdx )
{
- if ( theObj->inherits( "OCCViewer_ViewPort" ) )
- {
- if ( theEvent->type() == QEvent::Leave )
- myCoordLabel->clear();
+ emit interpolatorChanged( myIntrp->itemText( theIdx ) );
+}
- return false;
- }
+void HYDROGUI_ProfileInterpolateDlg::onProfileChanged( const QString& )
+{
+ updateState();
+}
+
+void HYDROGUI_ProfileInterpolateDlg::updateState()
+{
+ setApplyEnabled( !river().isEmpty() && !profileStart().isEmpty() && !profileFinish().isEmpty() );
+}
- return HYDROGUI_InputPanel::eventFilter( theObj, theEvent );
+HYDROGUI_ObjComboBox* HYDROGUI_ProfileInterpolateDlg::activeProfile() const
+{
+ HYDROGUI_ObjComboBox* profile = myProfileFinish;
+ if ( myProfileStart->selectedObject().isEmpty() )
+ profile = myProfileStart;
+ else if ( myProfileFinish->selectedObject().isEmpty() )
+ profile = myProfileFinish;
+ else if ( SUIT_Tools::isParent( myProfileStart->parentWidget()->focusWidget(), myProfileStart ) )
+ profile = myProfileStart;
+ else if ( SUIT_Tools::isParent( myProfileFinish->parentWidget()->focusWidget(), myProfileFinish ) )
+ profile = myProfileFinish;
+ return profile;
}
#ifndef HYDROGUI_PROFILEINTERPOLATEDLG_H
#define HYDROGUI_PROFILEINTERPOLATEDLG_H
-#include "HYDROGUI_InputPanel.h"
+#include "HYDROGUI_ViewerDlg.h"
+
+#include "HYDROGUI_ObjComboBox.h"
#include <AIS_InteractiveContext.hxx>
-class CurveCreator_Widget;
-class CurveCreator_ICurve;
-class OCCViewer_ViewManager;
-class SUIT_ViewWindow;
-class QGroupBox;
+#include <QSet>
+
+class QSpinBox;
class QLineEdit;
-class QLabel;
+class QComboBox;
+class QTextEdit;
-class HYDROGUI_ProfileInterpolateDlg : public HYDROGUI_InputPanel
+class HYDROGUI_ProfileInterpolateDlg : public HYDROGUI_ViewerDlg, public HYDROGUI_ObjComboBoxFilter
{
Q_OBJECT
HYDROGUI_ProfileInterpolateDlg( HYDROGUI_Module* theModule, const QString& theTitle );
virtual ~HYDROGUI_ProfileInterpolateDlg();
- Handle(AIS_InteractiveContext) getAISContext();
+ QString interpolator() const;
+ void setInterpolator( const QString& );
+ void setInterpolators( const QStringList& );
+
+ QString interpolatorDescription() const;
+ void setInterpolatorDescription( const QString& );
- void setProfileName( const QString& theName );
- QString getProfileName() const;
-
- void setProfile( CurveCreator_ICurve* theProfile );
+ QString interpolatorParameters() const;
+ void setInterpolatorParameters( const QString& );
- void reset();
+ QString river() const;
+ void setRiver( const QString& );
- QList<int> getSelectedSections();
+ QString profileStart() const;
+ void setProfileStart( const QString& );
- void deleteSelected();
- bool deleteEnabled();
+ QString profileFinish() const;
+ void setProfileFinish( const QString& );
-protected:
- virtual bool eventFilter( QObject*, QEvent* );
+ int profileNumber() const;
+ void setProfileNumber( int );
-protected slots:
- void processStartedSubOperation( QWidget*, bool );
- void processFinishedSubOperation( QWidget* );
+ void reset();
- void onMouseMove( SUIT_ViewWindow*, QMouseEvent* );
+ virtual bool isActive( HYDROGUI_ObjComboBox* ) const;
+ virtual bool isOk( const Handle(HYDROData_Entity)& ) const;
signals:
- void createPreview( QString );
- void selectionChanged();
- void widgetCreated(QWidget*);
- void subOperationStarted(QWidget*);
- void subOperationFinished(QWidget*);
+ void riverChanged( const QString& );
+ void interpolatorChanged( const QString& );
+ void interpolatorParametersChanged( const QString& );
+
+ void profileNumberChanged( int );
+ void profileStartChanged( const QString& );
+ void profileFinishChanged( const QString& );
+
+private slots:
+ void onRiverChanged( const QString& );
+ void onInterpolatorIndexChanged( int );
+ void onProfileChanged( const QString& );
+
private:
- QLineEdit* myName;
- CurveCreator_Widget* myEditorWidget;
- QGroupBox* myAddElementBox;
- OCCViewer_ViewManager* myViewManager;
- QLabel* myCoordLabel;
+ void updateState();
+ HYDROGUI_ObjComboBox* activeProfile() const;
+
+private:
+ typedef QSet<QString> RiverProfiles;
+
+private:
+ HYDROGUI_ObjComboBox* myRiver;
+ QComboBox* myIntrp;
+ QTextEdit* myDescr;
+ QLineEdit* myParams;
+
+ HYDROGUI_ObjComboBox* myProfileStart;
+ HYDROGUI_ObjComboBox* myProfileFinish;
+ QSpinBox* myProfileNumber;
+
+ RiverProfiles myRiverProfiles;
};
#endif
// 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 "HYDROGUI_Tool.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_DataObject.h"
+#include "HYDROGUI_UpdateFlags.h"
+#include "HYDROGUI_ProfileInterpolateDlg.h"
+
+#include <HYDROData_Stream.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_ViewManager.h>
#include <OCCViewer_ViewWindow.h>
-
#include <OCCViewer_AISSelector.h>
-#include <Precision.hxx>
-
-//static int ZValueIncrement = 0;
+#include <AIS_ListOfInteractive.hxx>
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
-HYDROGUI_ProfileInterpolateOp::HYDROGUI_ProfileInterpolateOp( HYDROGUI_Module* theModule, bool theIsEdit )
-: HYDROGUI_Operation( theModule ), myIsEdit(theIsEdit), myProfile(NULL)
+HYDROGUI_ProfileInterpolateOp::HYDROGUI_ProfileInterpolateOp( HYDROGUI_Module* theModule )
+ : HYDROGUI_Operation( theModule )
{
- setName( theIsEdit ? tr( "EDIT_PROFILE" ) : tr( "CREATE_PROFILE" ) );
+ setName( tr( "PROFILE_INTERPOLATION" ) );
}
HYDROGUI_ProfileInterpolateOp::~HYDROGUI_ProfileInterpolateOp()
{
- erasePreview();
}
-/**
- * Redirect the delete action to input panel
- */
-void HYDROGUI_ProfileInterpolateOp::deleteSelected()
+void HYDROGUI_ProfileInterpolateOp::startOperation()
{
- HYDROGUI_ProfileDlg* aPanel = (HYDROGUI_ProfileDlg*)inputPanel();
- aPanel->deleteSelected();
+ HYDROGUI_Operation::startOperation();
+
+ HYDROGUI_ProfileInterpolateDlg* aPanel = ::qobject_cast<HYDROGUI_ProfileInterpolateDlg*>( inputPanel() );
+ if ( aPanel )
+ {
+ aPanel->reset();
+ aPanel->setInterpolators( interpolators() );
+ }
+
+/*
+ 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();
}
-/**
- * Checks whether there are some to delete
- */
-bool HYDROGUI_ProfileInterpolateOp::deleteEnabled()
+void HYDROGUI_ProfileInterpolateOp::abortOperation()
{
- HYDROGUI_ProfileDlg* aPanel = (HYDROGUI_ProfileDlg*)inputPanel();
- return aPanel->deleteEnabled();
+ HYDROGUI_Operation::abortOperation();
}
-void HYDROGUI_ProfileInterpolateOp::startOperation()
+void HYDROGUI_ProfileInterpolateOp::commitOperation()
{
- if( myProfile )
- delete myProfile;
+ HYDROGUI_Operation::commitOperation();
+}
- myProfile = new HYDROGUI_CurveCreatorProfile();
+HYDROGUI_InputPanel* HYDROGUI_ProfileInterpolateOp::createInputPanel() const
+{
+ HYDROGUI_ProfileInterpolateDlg* aDlg = new HYDROGUI_ProfileInterpolateDlg( module(), getName() );
- HYDROGUI_Operation::startOperation();
+ connect( aDlg, SIGNAL( riverChanged( const QString& ) ), this, SLOT( onRiverChanged( const QString& ) ) );
+ connect( aDlg, SIGNAL( interpolatorChanged( const QString& ) ), this, SLOT( onInterpolatorChanged( const QString& ) ) );
+ connect( aDlg, SIGNAL( interpolatorParametersChanged( const QString& ) ), this, SLOT( updatePreview() ) );
+ connect( aDlg, SIGNAL( profileNumberChanged( int ) ), this, SLOT( updatePreview() ) );
+ connect( aDlg, SIGNAL( profileStartChanged( const QString& ) ), this, SLOT( updatePreview() ) );
+ connect( aDlg, SIGNAL( profileFinishChanged( const QString& ) ), this, SLOT( updatePreview() ) );
- HYDROGUI_ProfileDlg* aPanel = (HYDROGUI_ProfileDlg*)inputPanel();
- aPanel->reset();
+ return aDlg;
+}
- if( myIsEdit )
- myEditedObject = Handle(HYDROData_Profile)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+bool HYDROGUI_ProfileInterpolateOp::processApply( int& theUpdateFlags, QString& theErrorMsg,
+ QStringList& theBrowseObjectsEntries )
+{
+ HYDROGUI_ProfileInterpolateDlg* aPanel = ::qobject_cast<HYDROGUI_ProfileInterpolateDlg*>( inputPanel() );
+ if ( !aPanel )
+ return false;
+/*
+ QString aProfileName = aPanel->getProfileName().simplified();
+ if ( aProfileName.isEmpty() )
+ {
+ theErrorMsg = tr( "INCORRECT_OBJECT_NAME" );
+ return false;
+ }
- QString aProfileName;
- if( !myEditedObject.IsNull() )
- {
- Handle(HYDROData_ProfileUZ) aProfileUZ = myEditedObject->GetProfileUZ( false );
- if ( !aProfileUZ.IsNull() )
+ if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != aProfileName ) )
{
- CurveCreator::Coordinates aCurveCoords;
- CurveCreator::SectionsMap aSectionsMap;
+ // 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;
+ }
+ }
- 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() );
+ Handle(HYDROData_Profile) aProfileObj;
+ if( myIsEdit ){
+ aProfileObj = myEditedObject;
+ }
+ else{
+ aProfileObj = Handle(HYDROData_Profile)::DownCast( doc()->CreateObject( KIND_PROFILE ) );
+ }
- CurveCreator_PosPoint* aPosPoint = new CurveCreator_PosPoint( k, aCurveCoords );
- aPoints.push_back( aPosPoint );
- }
+ if( aProfileObj.IsNull() )
+ return false;
- aSectionsMap[0] = aPoints;
- myProfile->addPointsInternal( aSectionsMap );
+ Handle(HYDROData_ProfileUZ) aProfileUZ = aProfileObj->GetProfileUZ();
+ if ( aProfileUZ.IsNull() )
+ return false;
- HYDROData_ProfileUZ::SectionType aSectType = aProfileUZ->GetSectionType( 0 );
+ aProfileObj->SetName(aProfileName);
- CurveCreator::SectionType aCurveType = CurveCreator::Polyline;
- if( aSectType == HYDROData_ProfileUZ::SECTION_SPLINE )
- aCurveType = CurveCreator::Spline;
+ HYDROData_ProfileUZ::PointsList aProfileParamPoints;
- myProfile->setSectionType( 0, aCurveType );
+ CurveCreator::Coordinates aCurveCoords = myProfile->getPoints( 0 );
+ if ( aCurveCoords.size() <= 2 )
+ {
+ theErrorMsg = tr( "NUMBER_OF_PROFILE_POINTS_INCORRECT" );
+ return false;
}
- aProfileName = myEditedObject->GetName();
- }
- else
- {
- aProfileName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_PROFILE_NAME" ) );
- }
+ for ( int k = 0 ; k + 1 < aCurveCoords.size() ; k++ )
+ {
+ HYDROData_ProfileUZ::Point aProfileParamPoint;
- aPanel->setProfileName( aProfileName );
- aPanel->setProfile( myProfile );
- displayPreview();
-}
+ aProfileParamPoint.SetX( aCurveCoords.at( k ) );
+ k++;
+ aProfileParamPoint.SetY( aCurveCoords.at( k ) );
-void HYDROGUI_ProfileInterpolateOp::abortOperation()
-{
- erasePreview();
+ aProfileParamPoints.Append( aProfileParamPoint );
+ }
+ aProfileObj->SetParametricPoints( aProfileParamPoints );
- HYDROGUI_Operation::abortOperation();
-}
+ HYDROData_ProfileUZ::SectionType aSectType = HYDROData_ProfileUZ::SECTION_POLYLINE;
+ if ( myProfile->getSectionType( 0 ) == CurveCreator::Spline )
+ aSectType = HYDROData_ProfileUZ::SECTION_SPLINE;
-void HYDROGUI_ProfileInterpolateOp::commitOperation()
-{
- erasePreview();
+ 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();
- HYDROGUI_Operation::commitOperation();
+ // 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;
}
-HYDROGUI_InputPanel* HYDROGUI_ProfileInterpolateOp::createInputPanel() const
+void HYDROGUI_ProfileInterpolateOp::updatePreview()
{
- HYDROGUI_ProfileDlg* aDlg = new HYDROGUI_ProfileDlg( module(), getName() );
- return aDlg;
+ HYDROGUI_ProfileInterpolateDlg* aDlg = ::qobject_cast<HYDROGUI_ProfileInterpolateDlg*>( inputPanel() );
+ if ( !aDlg )
+ return;
+
+ Handle(AIS_InteractiveContext) aCtx = aDlg->getAISContext();
+ if ( aCtx.IsNull() )
+ return;
+
+ aCtx->UpdateCurrentViewer();
}
-bool HYDROGUI_ProfileInterpolateOp::processApply( int& theUpdateFlags,
- QString& theErrorMsg,
- QStringList& theBrowseObjectsEntries )
+QStringList HYDROGUI_ProfileInterpolateOp::interpolators() const
{
- 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;
+ return QStringList() << "Linear interpolator" << "Spline interpolator";
}
-void HYDROGUI_ProfileInterpolateOp::displayPreview()
+void HYDROGUI_ProfileInterpolateOp::onInterpolatorChanged( const QString& theInterpName )
{
- 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 );
- }
- }
+ HYDROGUI_ProfileInterpolateDlg* aPanel = dynamic_cast<HYDROGUI_ProfileInterpolateDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ aPanel->setInterpolatorDescription( QString( "Profile will be calculated used %1" ).arg( theInterpName ) );
+
+ updatePreview();
}
-void HYDROGUI_ProfileInterpolateOp::erasePreview()
+void HYDROGUI_ProfileInterpolateOp::onRiverChanged( const QString& theRiver )
{
- 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() )
+ HYDROGUI_ProfileInterpolateDlg* aDlg = ::qobject_cast<HYDROGUI_ProfileInterpolateDlg*>( inputPanel() );
+ if ( !aDlg )
+ return;
+
+ Handle(AIS_InteractiveContext) aCtx = aDlg->getAISContext();
+ if ( !aCtx.IsNull() )
{
- aDisplayer->eraseAll( true );
+ AIS_ListOfInteractive aList;
+ aCtx->DisplayedObjects( aList );
+ for ( AIS_ListIteratorOfListOfInteractive it( aList ); it.More(); it.Next() )
+ {
+ Handle(AIS_Shape) anObj = Handle(AIS_Shape)::DownCast( it.Value() );
+ if ( !anObj.IsNull() )
+ aCtx->Remove( anObj, false );
+ }
+
+ Handle(HYDROData_Stream) aStream = Handle(HYDROData_Stream)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), theRiver, KIND_STREAM ) );
+ if ( !aStream.IsNull() )
+ {
+ HYDROData_SequenceOfObjects aSeq = aStream->GetProfiles();
+ for ( int i = aSeq.Lower(); i <= aSeq.Upper(); i++ )
+ {
+ Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( aSeq.Value( i ) );
+ if ( !aProfile.IsNull() )
+ {
+ Handle(AIS_Shape) aPrs = new AIS_Shape( aProfile->GetShape3D() );
+ aPrs->SetOwner( aProfile );
+ aPrs->SetColor( Quantity_NOC_BLACK );
+ aCtx->Display( aPrs, 0, 0, false );
+ }
+ }
+ }
}
- }
+ updatePreview();
}
#include <HYDROData_Profile.h>
-class HYDROGUI_CurveCreatorProfile;
+#include <AIS_Shape.hxx>
class HYDROGUI_ProfileInterpolateOp : public HYDROGUI_Operation
{
Q_OBJECT
public:
- HYDROGUI_ProfileInterpolateOp( HYDROGUI_Module* theModule, bool isEdit );
+ HYDROGUI_ProfileInterpolateOp( HYDROGUI_Module* theModule );
virtual ~HYDROGUI_ProfileInterpolateOp();
- void deleteSelected();
- bool deleteEnabled();
-
protected:
virtual void startOperation();
virtual void abortOperation();
virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
QStringList& theBrowseObjectsEntries );
-private:
- void displayPreview();
- void erasePreview();
+ QStringList interpolators() const;
+
+private slots:
+ void updatePreview();
+ void onRiverChanged( const QString& );
+ void onInterpolatorChanged( const QString& );
private:
- bool myIsEdit;
- Handle(HYDROData_Profile) myEditedObject;
- HYDROGUI_CurveCreatorProfile* myProfile;
+ Handle(AIS_Shape) myPreview;
};
#endif
addWidget( group );
addStretch();
+
+ connect( myRivers, SIGNAL( objectSelected( const QString& ) ), this, SLOT( onRiverChanged( const QString& ) ) );
+
+ updateState();
}
HYDROGUI_RiverBottomDlg::~HYDROGUI_RiverBottomDlg()
myRivers->reset();
blockSignals( isBlocked );
+
+ updateState();
}
QString HYDROGUI_RiverBottomDlg::getRiverName() const
{
myRivers->setSectedObject( theName );
}
+
+void HYDROGUI_RiverBottomDlg::onRiverChanged( const QString& )
+{
+ updateState();
+}
+
+void HYDROGUI_RiverBottomDlg::updateState()
+{
+ setApplyEnabled( !getRiverName().isEmpty() );
+}
QString getRiverName() const;
void setRiverName( const QString& );
-protected:
+private slots:
+ void onRiverChanged( const QString& );
+
+private:
+ void updateState();
+
+private:
HYDROGUI_ObjComboBox* myRivers;
};
#include <OCCViewer_Utilities.h>
#include <OCCViewer_ViewManager.h>
#include <OCCViewer_ViewFrame.h>
+
#include <LightApp_Application.h>
+#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
myViewManager = new OCCViewer_ViewManager( theModule->getApp()->activeStudy(), 0 );
- OCCViewer_Viewer* aViewer = new OCCViewer_Viewer( false );
+ OCCViewer_Viewer* aViewer = new OCCViewer_Viewer( true );
aViewer->setBackground( OCCViewer_ViewFrame::TOP_LEFT,
aResMgr->backgroundValue( "OCCViewer", "xz_background", aViewer->background(OCCViewer_ViewFrame::TOP_LEFT) ) );
myViewManager->setViewModel( aViewer );// custom view model, which extends SALOME_View interface
+ aViewer->enableMultiselection( false );
+
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();
anAISContext->Display( aTrihedron );
anAISContext->Deactivate( aTrihedron );
}
-
+ */
viewBase->addWidget( aViewWin );
// Coordinates
HYDROGUI_ViewerDlg::~HYDROGUI_ViewerDlg()
{
+ myViewManager->closeAllViews();
delete myViewManager;
}
bool HYDROGUI_ViewerDlg::event( QEvent* e )
{
if ( e->type() == QEvent::Polish )
+ {
addWidget( myCoordLabel->parentWidget(), 4 );
+ Handle(AIS_Trihedron) aTrihedron = trihedron();
+ Handle(AIS_InteractiveContext) anAISContext = getAISContext();
+ if ( !anAISContext.IsNull() && !aTrihedron.IsNull() )
+ {
+ viewer()->setTrihedronShown( false );
+ anAISContext->Display( aTrihedron );
+ anAISContext->Deactivate( aTrihedron );
+ }
+ }
+
return HYDROGUI_InputPanel::event( e );
}
return myViewManager;
}
+SUIT_SelectionMgr* HYDROGUI_ViewerDlg::selectionMgr() const
+{
+ SUIT_SelectionMgr* aSelMgr = 0;
+ if ( module() )
+ {
+ LightApp_Application* app = module()->getApp();
+ if ( app )
+ aSelMgr = app->selectionMgr();
+ }
+ return aSelMgr;
+}
+
void HYDROGUI_ViewerDlg::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
{
OCCViewer_ViewWindow* anOCCViewWindow =
return HYDROGUI_InputPanel::eventFilter( theObj, theEvent );
}
+
+Handle(AIS_Trihedron) HYDROGUI_ViewerDlg::trihedron()
+{
+ return Handle(AIS_Trihedron)();
+}
#include "HYDROGUI_InputPanel.h"
+#include <AIS_Trihedron.hxx>
#include <AIS_InteractiveContext.hxx>
class QLabel;
+
class SUIT_ViewWindow;
+class SUIT_SelectionMgr;
+
class OCCViewer_Viewer;
class OCCViewer_ViewManager;
Handle(AIS_InteractiveContext) getAISContext();
- void deleteSelected();
- bool deleteEnabled();
-
virtual bool event( QEvent* );
+ virtual bool eventFilter( QObject*, QEvent* );
protected:
OCCViewer_Viewer* viewer() const;
OCCViewer_ViewManager* viewManager() const;
- virtual bool eventFilter( QObject*, QEvent* );
+ SUIT_SelectionMgr* selectionMgr() const;
+
+ virtual Handle(AIS_Trihedron) trihedron();
protected slots:
void onMouseMove( SUIT_ViewWindow*, QMouseEvent* );
<translation>icon_river_bottom_image.png</translation>
</message>
+ <message>
+ <source>PROFILE_INTERPOLATE_ICO</source>
+ <translation>icon_profile_interpolate_image.png</translation>
+ </message>
+
</context>
</TS>
<source>STB_CREATE_RIVER_BOTTOM</source>
<translation>Creates the river bottom polyline on selected river object</translation>
</message>
+
+ <message>
+ <source>MEN_PROFILE_INTERPOLATE</source>
+ <translation>River profiles interpolation</translation>
+ </message>
+ <message>
+ <source>DSK_PROFILE_INTERPOLATE</source>
+ <translation>Interpolate the river profiles</translation>
+ </message>
+ <message>
+ <source>STB_PROFILE_INTERPOLATE</source>
+ <translation>Creates the new river profiles using interpolation of selected ones</translation>
+ </message>
+
</context>
<context>
</message>
</context>
+ <context>
+ <name>HYDROGUI_ProfileInterpolateDlg</name>
+ <message>
+ <source>RIVER_OBJECT</source>
+ <translation>River object</translation>
+ </message>
+ <message>
+ <source>INTERPOLATOR</source>
+ <translation>Interpolator</translation>
+ </message>
+ <message>
+ <source>DESCRIPTION</source>
+ <translation>Description</translation>
+ </message>
+ <message>
+ <source>PROFILE_1</source>
+ <translation>Profile 1</translation>
+ </message>
+ <message>
+ <source>PROFILE_2</source>
+ <translation>Profile 2</translation>
+ </message>
+ <message>
+ <source>NUMBER_OF_PROFILES</source>
+ <translation>Number of profiles</translation>
+ </message>
+ <message>
+ <source>PARAMETERS</source>
+ <translation>Parameters</translation>
+ </message>
+ </context>
+
+ <context>
+ <name>HYDROGUI_ProfileInterpolateOp</name>
+ <message>
+ <source>PROFILE_INTERPOLATION</source>
+ <translation>Profile interpolation</translation>
+ </message>
+ </context>
+
</TS>