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_Poly3DDlg.h"
21 #include "HYDROGUI_ObjSelector.h"
29 HYDROGUI_Poly3DDlg::HYDROGUI_Poly3DDlg( HYDROGUI_Module* theModule, const QString& theTitle )
30 : HYDROGUI_InputPanel( theModule, theTitle ),
34 QGroupBox* aNameGroup = new QGroupBox( tr( "POLYLINE_3D_NAME" ) );
36 QLabel* aNameLabel = new QLabel( tr( "NAME" ), aNameGroup );
37 myName = new QLineEdit( aNameGroup );
39 QGridLayout* aNameLayout = new QGridLayout( aNameGroup );
40 aNameLayout->setMargin( 5 );
41 aNameLayout->setSpacing( 5 );
42 aNameLayout->addWidget( aNameLabel, 0, 0 );
43 aNameLayout->addWidget( myName, 0, 1 );
46 QGroupBox* aParamGroup = new QGroupBox( tr( "PARAMETERS" ) );
48 myPolylineLabel = new QLabel( tr( "POLYLINE" ), aParamGroup );
49 myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINEXY, aParamGroup );
51 myProfileLabel = new QLabel( tr( "PROFILE" ), aParamGroup );
52 myProfile = new HYDROGUI_ObjSelector( theModule, KIND_PROFILE, aParamGroup );
54 myBathLabel = new QLabel( tr( "BATH" ), aParamGroup );
55 myBath = new HYDROGUI_ObjSelector( theModule, KIND_BATHYMETRY, aParamGroup );
57 QGridLayout* aParamLayout = new QGridLayout( aParamGroup );
58 aParamLayout->setMargin( 5 );
59 aParamLayout->setSpacing( 5 );
60 aParamLayout->addWidget( myPolylineLabel, 0, 0 );
61 aParamLayout->addWidget( myPolyline, 0, 1 );
62 aParamLayout->addWidget( myProfileLabel, 1, 0 );
63 aParamLayout->addWidget( myProfile, 1, 1 );
64 aParamLayout->addWidget( myBathLabel, 2, 0 );
65 aParamLayout->addWidget( myBath, 2, 1 );
68 addWidget( aNameGroup );
69 addWidget( aParamGroup );
74 connect( myProfile, SIGNAL( selectionChanged() ), this, SLOT( OnSelectionChanged() ) );
75 connect( myBath, SIGNAL( selectionChanged() ), this, SLOT( OnSelectionChanged() ) );
78 HYDROGUI_Poly3DDlg::~HYDROGUI_Poly3DDlg()
82 void HYDROGUI_Poly3DDlg::reset()
89 void HYDROGUI_Poly3DDlg::setMode( const bool theIsEdit )
94 void HYDROGUI_Poly3DDlg::setResultName( const QString& theName )
96 myName->setText( theName );
99 QString HYDROGUI_Poly3DDlg::getResultName() const
101 return myName->text();
104 void HYDROGUI_Poly3DDlg::setSelectedObjects( const QString& theNamePoly,
105 const QString& theNameProfile,
106 const QString& theNameBath )
108 myPolyline->SetName( theNamePoly );
109 myProfile->SetName( theNameProfile );
110 myBath->SetName( theNameBath );
113 bool HYDROGUI_Poly3DDlg::getSelectedObjects( QString& theNamePoly,
114 QString& theNameProfile,
115 QString& theNameBath ) const
117 theNamePoly = myPolyline->GetName();
118 theNameProfile = myProfile->GetName();
119 theNameBath = myBath->GetName();
120 return !theNamePoly.isEmpty() && ( !theNameProfile.isEmpty() || !theNameBath.isEmpty() );
123 void HYDROGUI_Poly3DDlg::setPreselectedObject( const QString& theName )
125 myProfile->SetName( theName );
126 myPolyline->SetChecked( true );
127 myPolyline->SetName( QString() );
130 void HYDROGUI_Poly3DDlg::OnSelectionChanged()
132 if( sender()==myProfile && !myProfile->GetName().isEmpty() )
134 if( sender()==myBath && !myBath->GetName().isEmpty() )