1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include "HYDROGUI_RiverBottomDlg.h"
21 #include "HYDROGUI_Tool.h"
22 #include "HYDROGUI_ObjComboBox.h"
24 #include <HYDROData_Stream.h>
25 #include <HYDROData_Polyline3D.h>
32 HYDROGUI_RiverBottomDlg::HYDROGUI_RiverBottomDlg( HYDROGUI_Module* theModule, const QString& theTitle )
33 : HYDROGUI_InputPanel( theModule, theTitle ),
34 HYDROGUI_ObjComboBoxFilter()
37 QGroupBox* group = new QGroupBox( mainFrame() );
38 QBoxLayout* base = new QVBoxLayout( group );
40 base->addWidget( myRivers = new HYDROGUI_ObjComboBox( theModule, tr( "STREAM_OBJECT" ), KIND_STREAM, group ) );
41 myRivers->setObjectFilter( this );
47 connect( myRivers, SIGNAL( objectSelected( const QString& ) ), this, SLOT( onRiverChanged( const QString& ) ) );
52 HYDROGUI_RiverBottomDlg::~HYDROGUI_RiverBottomDlg()
56 void HYDROGUI_RiverBottomDlg::reset()
58 bool isBlocked = blockSignals( true );
62 blockSignals( isBlocked );
67 QString HYDROGUI_RiverBottomDlg::getRiverName() const
69 return myRivers->selectedObject();
72 void HYDROGUI_RiverBottomDlg::setRiverName( const QString& theName )
74 myRivers->setSelectedObject( theName );
77 bool HYDROGUI_RiverBottomDlg::isOk( const Handle(HYDROData_Entity)& theEntity ) const
79 Handle(HYDROData_Stream) aStream = Handle(HYDROData_Stream)::DownCast(theEntity);
80 return !aStream.IsNull() && aStream->GetBottomPolyline().IsNull();
83 void HYDROGUI_RiverBottomDlg::onRiverChanged( const QString& )
88 void HYDROGUI_RiverBottomDlg::updateState()
90 setApplyEnabled( !getRiverName().isEmpty() );