X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_LandCoverMapDlg.cxx;h=2e11ce1e0e9cffc065389d9e2f0307340c22be09;hb=d5ba71b0ced3160edd96ba0e60a9b22edb7e9490;hp=57bcaff7f1760f529b5ee8e4ebbbdfa7ce3cef70;hpb=d4bb018666a815232d1dbd84c90dfa30b995168b;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_LandCoverMapDlg.cxx b/src/HYDROGUI/HYDROGUI_LandCoverMapDlg.cxx index 57bcaff7..2e11ce1e 100644 --- a/src/HYDROGUI/HYDROGUI_LandCoverMapDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_LandCoverMapDlg.cxx @@ -24,6 +24,14 @@ #include #include +#include + +#include +#include +#include + +#include + #include #include #include @@ -34,8 +42,8 @@ HYDROGUI_LandCoverMapDlg::HYDROGUI_LandCoverMapDlg( HYDROGUI_Module* theModule, const QString& theTitle, const int theOperationId ) : HYDROGUI_InputPanel( theModule, theTitle ), - HYDROGUI_ObjComboBoxFilter(), - myOperationId( theOperationId ) + myOperationId( theOperationId ), + myFilter( theOperationId ) { // Land Cover Map name myObjectNameGroup = new QGroupBox( tr( "LAND_COVER_MAP_NAME" ), mainFrame() ); @@ -60,7 +68,7 @@ HYDROGUI_LandCoverMapDlg::HYDROGUI_LandCoverMapDlg( HYDROGUI_Module* theModule, myPolylinesFacesLabel = new QLabel( tr( "LAND_COVER_MAP_POLYLINE_FACE" ) ); aParamLayout->addWidget( myPolylinesFacesLabel, 0, 0, 1, 1 ); aParamLayout->addWidget( myPolylinesFaces = new HYDROGUI_ObjComboBox( theModule, "", KIND_UNKNOWN, myParamGroup ), 0, 1, 1, 1 ); - myPolylinesFaces->setObjectFilter( this ); + myPolylinesFaces->setObjectFilter( &myFilter ); // Strickler type name myStricklerTypesLabel = new QLabel( tr( "LAND_COVER_MAP_STRICKLER_TYPE" ), myParamGroup ); @@ -68,15 +76,21 @@ HYDROGUI_LandCoverMapDlg::HYDROGUI_LandCoverMapDlg( HYDROGUI_Module* theModule, aParamLayout->addWidget( myStricklerTypesLabel, 1, 0, 1, 1 ); aParamLayout->addWidget( myStricklerTypes, 1, 1, 1, 1 ); + // Label indicated the number of selected land covers + QString aDefaultLabel( "0" ); + mySelectedLandCoversLabel = new QLabel( tr( "LAND_COVER_MAP_SELECTED_FACES" ) + aDefaultLabel, myParamGroup ); + mySelectedLandCoversLabel->setStyleSheet("QLabel { font: italic; color : red; }"); + // Common addWidget( myObjectNameGroup ); addWidget( myParamGroup ); + addWidget( mySelectedLandCoversLabel ); addStretch(); // Connect signals and slots connect( myObjectNameEdit, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLandCoverMapChanged() ) ); - connect( myPolylinesFaces, SIGNAL( objectSelected( const QString& ) ), this, SLOT( onPolylineFaceChanged( const QString& ) ) ); + connect( myPolylinesFaces, SIGNAL( objectSelected( const QString& ) ), this, SLOT( onPolylineFaceChanged() ) ); updateState( true ); @@ -113,6 +127,8 @@ void HYDROGUI_LandCoverMapDlg::setObjectName( const QString& theName ) myObjectNameCreate->setText( theName ); else myObjectNameEdit->setCurrentIndex( myObjectNameEdit->findText( theName ) ); + + updateState(); } QString HYDROGUI_LandCoverMapDlg::getObjectName() const @@ -147,13 +163,15 @@ QString HYDROGUI_LandCoverMapDlg::getSelectedStricklerTypeName() const return myStricklerTypes->getSelectedStricklerTypeName(); } -bool HYDROGUI_LandCoverMapDlg::isOk( const Handle(HYDROData_Entity)& theEntity ) const +void HYDROGUI_LandCoverMapDlg::updateSelectedLandCoversLabel( int theNbSelected ) { - Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast(theEntity); - Handle(HYDROData_Object) anObject2d3dPrs = Handle(HYDROData_Object)::DownCast(theEntity); - return ( !anObject2d3dPrs.IsNull() || - ( !aPolylineXY.IsNull() && ( ( myOperationId == CreateLandCoverMapId || myOperationId == AddLandCoverId ) && aPolylineXY->IsClosed() || - myOperationId == SplitLandCoverId ) ) ); + QString aLabel; + aLabel.setNum( theNbSelected ); + if ( theNbSelected == 0 ) + mySelectedLandCoversLabel->setStyleSheet("QLabel { font: italic; color : red; }"); + else + mySelectedLandCoversLabel->setStyleSheet("QLabel { font: italic; color : black; }"); + mySelectedLandCoversLabel->setText( tr( "LAND_COVER_MAP_SELECTED_FACES" ) + aLabel ); } void HYDROGUI_LandCoverMapDlg::onLandCoverMapChanged() @@ -166,10 +184,11 @@ void HYDROGUI_LandCoverMapDlg::onLandCoverMapChanged() emit landCoverMapChanged( getObjectName() ); } -void HYDROGUI_LandCoverMapDlg::onPolylineFaceChanged( const QString& ) +void HYDROGUI_LandCoverMapDlg::onPolylineFaceChanged() { updateState(); - // TODO: select chosen polyline/face in the 3D viewer, if it is not selected yet (i.e. object was chosen not in the viewer, but in combo-box) + + emit polylineFaceChanged(); } void HYDROGUI_LandCoverMapDlg::updateState( bool theInitialConfigure ) @@ -193,6 +212,11 @@ void HYDROGUI_LandCoverMapDlg::updateState( bool theInitialConfigure ) myOperationId == ChangeLandCoverTypeId ); myStricklerTypesLabel->setVisible( aShowStricklerTypesCtrls ); myStricklerTypes->setVisible( aShowStricklerTypesCtrls ); + + bool aShowSelectedLandCoversLabel = ( myOperationId == RemoveLandCoverId || + myOperationId == MergeLandCoverId || + myOperationId == ChangeLandCoverTypeId ); + mySelectedLandCoversLabel->setVisible( aShowSelectedLandCoversLabel ); } else {