1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HYDROGUI_Poly3DDlg.h"
25 #include "HYDROGUI_ObjSelector.h"
33 HYDROGUI_Poly3DDlg::HYDROGUI_Poly3DDlg( HYDROGUI_Module* theModule, const QString& theTitle )
34 : HYDROGUI_InputPanel( theModule, theTitle ),
38 QGroupBox* aNameGroup = new QGroupBox( tr( "POLYLINE_3D_NAME" ) );
40 QLabel* aNameLabel = new QLabel( tr( "NAME" ), aNameGroup );
41 myName = new QLineEdit( aNameGroup );
43 QGridLayout* aNameLayout = new QGridLayout( aNameGroup );
44 aNameLayout->setMargin( 5 );
45 aNameLayout->setSpacing( 5 );
46 aNameLayout->addWidget( aNameLabel, 0, 0 );
47 aNameLayout->addWidget( myName, 0, 1 );
50 QGroupBox* aParamGroup = new QGroupBox( tr( "PARAMETERS" ) );
52 myPolylineLabel = new QLabel( tr( "POLYLINE" ), aParamGroup );
53 myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINEXY, aParamGroup );
55 myProfileLabel = new QLabel( tr( "PROFILE" ), aParamGroup );
56 myProfile = new HYDROGUI_ObjSelector( theModule, KIND_PROFILE, aParamGroup );
58 myBathLabel = new QLabel( tr( "BATH" ), aParamGroup );
59 myBath = new HYDROGUI_ObjSelector( theModule, KIND_BATHYMETRY, aParamGroup );
61 QGridLayout* aParamLayout = new QGridLayout( aParamGroup );
62 aParamLayout->setMargin( 5 );
63 aParamLayout->setSpacing( 5 );
64 aParamLayout->addWidget( myPolylineLabel, 0, 0 );
65 aParamLayout->addWidget( myPolyline, 0, 1 );
66 aParamLayout->addWidget( myProfileLabel, 1, 0 );
67 aParamLayout->addWidget( myProfile, 1, 1 );
68 aParamLayout->addWidget( myBathLabel, 2, 0 );
69 aParamLayout->addWidget( myBath, 2, 1 );
72 addWidget( aNameGroup );
73 addWidget( aParamGroup );
78 connect( myProfile, SIGNAL( selectionChanged() ), this, SLOT( OnSelectionChanged() ) );
79 connect( myBath, SIGNAL( selectionChanged() ), this, SLOT( OnSelectionChanged() ) );
82 HYDROGUI_Poly3DDlg::~HYDROGUI_Poly3DDlg()
86 void HYDROGUI_Poly3DDlg::reset()
93 void HYDROGUI_Poly3DDlg::setMode( const bool theIsEdit )
98 void HYDROGUI_Poly3DDlg::setResultName( const QString& theName )
100 myName->setText( theName );
103 QString HYDROGUI_Poly3DDlg::getResultName() const
105 return myName->text();
108 void HYDROGUI_Poly3DDlg::setSelectedObjects( const QString& theNamePoly,
109 const QString& theNameProfile,
110 const QString& theNameBath )
112 myPolyline->SetName( theNamePoly );
113 myProfile->SetName( theNameProfile );
114 myBath->SetName( theNameBath );
117 bool HYDROGUI_Poly3DDlg::getSelectedObjects( QString& theNamePoly,
118 QString& theNameProfile,
119 QString& theNameBath ) const
121 theNamePoly = myPolyline->GetName();
122 theNameProfile = myProfile->GetName();
123 theNameBath = myBath->GetName();
124 return !theNamePoly.isEmpty() && ( !theNameProfile.isEmpty() || !theNameBath.isEmpty() );
127 void HYDROGUI_Poly3DDlg::setPreselectedObject( const QString& theName )
129 myProfile->SetName( theName );
130 myPolyline->SetChecked( true );
131 myPolyline->SetName( QString() );
134 void HYDROGUI_Poly3DDlg::OnSelectionChanged()
136 if( sender()==myProfile && !myProfile->GetName().isEmpty() )
138 if( sender()==myBath && !myBath->GetName().isEmpty() )