void HYDROGUI_ObjSelector::SetName( const QString& theName )
{
myObjName->setText( theName );
+ emit selectionChanged();
}
QString HYDROGUI_ObjSelector::GetName() const
*/
void alreadySelected( const QString& theName );
+ void selectionChanged();
+
protected:
virtual void paintEvent( QPaintEvent* );
virtual bool hitButton( const QPoint& thePnt ) const;
// Parameters
QGroupBox* aParamGroup = new QGroupBox( tr( "PARAMETERS" ) );
- myProfileLabel = new QLabel( tr( "PROFILE" ), aParamGroup );
- myProfile = new HYDROGUI_ObjSelector( theModule, KIND_PROFILE, aParamGroup );
-
myPolylineLabel = new QLabel( tr( "POLYLINE" ), aParamGroup );
myPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINEXY, aParamGroup );
+ myProfileLabel = new QLabel( tr( "PROFILE" ), aParamGroup );
+ myProfile = new HYDROGUI_ObjSelector( theModule, KIND_PROFILE, aParamGroup );
+
+ myBathLabel = new QLabel( tr( "BATH" ), aParamGroup );
+ myBath = new HYDROGUI_ObjSelector( theModule, KIND_BATHYMETRY, aParamGroup );
+
QGridLayout* aParamLayout = new QGridLayout( aParamGroup );
aParamLayout->setMargin( 5 );
aParamLayout->setSpacing( 5 );
- aParamLayout->addWidget( myProfileLabel, 0, 0 );
- aParamLayout->addWidget( myProfile, 0, 1 );
- aParamLayout->addWidget( myPolylineLabel, 1, 0 );
- aParamLayout->addWidget( myPolyline, 1, 1 );
+ aParamLayout->addWidget( myPolylineLabel, 0, 0 );
+ aParamLayout->addWidget( myPolyline, 0, 1 );
+ aParamLayout->addWidget( myProfileLabel, 1, 0 );
+ aParamLayout->addWidget( myProfile, 1, 1 );
+ aParamLayout->addWidget( myBathLabel, 2, 0 );
+ aParamLayout->addWidget( myBath, 2, 1 );
// Common
addWidget( aNameGroup );
addStretch();
setMode( myIsEdit );
+
+ connect( myProfile, SIGNAL( selectionChanged() ), this, SLOT( OnSelectionChanged() ) );
+ connect( myBath, SIGNAL( selectionChanged() ), this, SLOT( OnSelectionChanged() ) );
}
HYDROGUI_Poly3DDlg::~HYDROGUI_Poly3DDlg()
return myName->text();
}
-void HYDROGUI_Poly3DDlg::setSelectedObjects( const QString& theName1,
- const QString& theName2 )
+void HYDROGUI_Poly3DDlg::setSelectedObjects( const QString& theNamePoly,
+ const QString& theNameProfile,
+ const QString& theNameBath )
{
- myProfile->SetName( theName1 );
- myPolyline->SetName( theName2 );
+ myPolyline->SetName( theNamePoly );
+ myProfile->SetName( theNameProfile );
+ myBath->SetName( theNameBath );
}
-bool HYDROGUI_Poly3DDlg::getSelectedObjects( QString& theName1,
- QString& theName2 ) const
+bool HYDROGUI_Poly3DDlg::getSelectedObjects( QString& theNamePoly,
+ QString& theNameProfile,
+ QString& theNameBath ) const
{
- theName1 = myProfile->GetName();
- theName2 = myPolyline->GetName();
- return !theName1.isEmpty() && !theName2.isEmpty();
+ theNamePoly = myPolyline->GetName();
+ theNameProfile = myProfile->GetName();
+ theNameBath = myBath->GetName();
+ return !theNamePoly.isEmpty() && ( !theNameProfile.isEmpty() || theNameBath.isEmpty() );
}
void HYDROGUI_Poly3DDlg::setPreselectedObject( const QString& theName )
myPolyline->SetChecked( true );
myPolyline->SetName( QString() );
}
+
+void HYDROGUI_Poly3DDlg::OnSelectionChanged()
+{
+ if( sender()==myProfile && !myProfile->GetName().isEmpty() )
+ myBath->Clear();
+ if( sender()==myBath && !myBath->GetName().isEmpty() )
+ myProfile->Clear();
+}
void setResultName( const QString& theName );
QString getResultName() const;
- void setSelectedObjects( const QString& theName1,
- const QString& theName2 );
- bool getSelectedObjects( QString& theName1,
- QString& theName2 ) const;
+ void setSelectedObjects( const QString& theNamePoly,
+ const QString& theNameProfile,
+ const QString& theNameBath );
+ bool getSelectedObjects( QString& theNamePoly,
+ QString& theNameProfile,
+ QString& theNameBath ) const;
void setPreselectedObject( const QString& theName );
+protected slots:
+ void OnSelectionChanged();
+
private:
bool myIsEdit;
QLineEdit* myName;
+ QLabel* myPolylineLabel;
+ HYDROGUI_ObjSelector* myPolyline;
+
QLabel* myProfileLabel;
HYDROGUI_ObjSelector* myProfile;
- QLabel* myPolylineLabel;
- HYDROGUI_ObjSelector* myPolyline;
+ QLabel* myBathLabel;
+ HYDROGUI_ObjSelector* myBath;
};
#endif
#include <HYDROData_Polyline3D.h>
#include <HYDROData_Profile.h>
#include <HYDROData_PolylineXY.h>
+#include <HYDROData_Bathymetry.h>
#include <HYDROData_OperationsFactory.h>
}
aPanel->setResultName( aPoly3DName );
- QString aSelectedName1, aSelectedName2;
+ QString aPolyName, aProfileName, aBathName;
if( myIsEdit && !myEditedObject.IsNull() )
{
- Handle(HYDROData_Entity) anObject1 = myEditedObject->GetProfileUZ()->GetFatherObject();
- if( !anObject1.IsNull() )
- aSelectedName1 = anObject1->GetName();
- Handle(HYDROData_Entity) anObject2 = myEditedObject->GetPolylineXY();
- if( !anObject2.IsNull() )
- aSelectedName2 = anObject2->GetName();
- aPanel->setSelectedObjects( aSelectedName1, aSelectedName2 );
+ Handle(HYDROData_Entity) aProfile = myEditedObject->GetProfileUZ()->GetFatherObject();
+ if( !aProfile.IsNull() )
+ aProfileName = aProfile->GetName();
+
+ Handle(HYDROData_Entity) aPoly = myEditedObject->GetPolylineXY();
+ if( !aPoly.IsNull() )
+ aPolyName = aPoly->GetName();
+
+ //TODO: use bathymetry from data model
+
+ aPanel->setSelectedObjects( aPolyName, aProfileName, aBathName );
}
else if( !myIsEdit )
{
if( aResultName.isEmpty() )
return false;
- QString aSelectedName1, aSelectedName2;
- if( !aPanel->getSelectedObjects( aSelectedName1, aSelectedName2 ) )
+ QString aPolyName, aProfileName, aBathName;
+ if( !aPanel->getSelectedObjects( aPolyName, aProfileName, aBathName ) )
return false;
if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != aResultName ) )
}
}
- Handle(HYDROData_Entity) anObject1 =
- HYDROGUI_Tool::FindObjectByName( module(), aSelectedName1, KIND_PROFILE ) ;
- Handle(HYDROData_Entity) anObject2 =
- HYDROGUI_Tool::FindObjectByName( module(), aSelectedName2, KIND_POLYLINEXY );
- if( anObject1.IsNull() || anObject2.IsNull() )
+ Handle(HYDROData_Entity) aProfileEnt =
+ HYDROGUI_Tool::FindObjectByName( module(), aProfileName, KIND_PROFILE ) ;
+ Handle(HYDROData_Entity) aPolyEnt =
+ HYDROGUI_Tool::FindObjectByName( module(), aPolyName, KIND_POLYLINEXY );
+ Handle(HYDROData_Entity) aBathEnt =
+ HYDROGUI_Tool::FindObjectByName( module(), aBathName, KIND_BATHYMETRY );
+
+ if( aPolyEnt.IsNull() || ( aPolyEnt.IsNull() && aBathEnt.IsNull() ) )
return false;
- Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( anObject1 );
- Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( anObject2 );
+ Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( aProfileEnt );
+ Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( aBathEnt );
+ Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( aPolyEnt );
- if( aProfile.IsNull() || aPolyline.IsNull() )
+ if( aProfile.IsNull() || ( aPolyline.IsNull() && aBath.IsNull() ) )
return false;
Handle(HYDROData_ProfileUZ) aProfileUZ = aProfile->GetProfileUZ();
aResult->SetName( aResultName );
aResult->SetProfileUZ( aProfileUZ );
aResult->SetPolylineXY( aPolyline );
+ //TODO: set bathymetry
if( !myIsEdit )
{
if( !myIsEdit )
{
size_t aViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() );
- module()->setObjectVisible( aViewId, anObject1, false );
- module()->setObjectVisible( aViewId, anObject2, false );
+ module()->setObjectVisible( aViewId, aPolyline, false );
+ module()->setObjectVisible( aViewId, aProfile, false );
module()->setObjectVisible( aViewId, aResult, true );
}
<source>PROFILE</source>
<translation>Profile</translation>
</message>
+ <message>
+ <source>BATH</source>
+ <translation>Bathymetry</translation>
+ </message>
</context>
<context>