From: isn Date: Wed, 25 Oct 2017 16:31:01 +0000 (+0300) Subject: refs #1323, icons of imm. zones (only) are changing while switching between sumb... X-Git-Tag: v2.1~58^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f080eec7cf3aa0b4f2ecafea69accb0933843ade;p=modules%2Fhydro.git refs #1323, icons of imm. zones (only) are changing while switching between sumb/non-submers --- diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index 0454e19f..130135bd 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -96,6 +96,7 @@ set(PROJECT_HEADERS HYDROGUI_StricklerTableOp.h HYDROGUI_StricklerTypeComboBox.h HYDROGUI_SubmersibleOp.h + HYDROGUI_UnSubmersibleOp.h HYDROGUI_Tool.h HYDROGUI_Tool2.h HYDROGUI_TwoImagesDlg.h @@ -246,6 +247,7 @@ set(PROJECT_SOURCES HYDROGUI_SplitPolylinesDlg.cxx HYDROGUI_SplitPolylinesOp.cxx HYDROGUI_SubmersibleOp.cxx + HYDROGUI_UnSubmersibleOp.cxx HYDROGUI_Tool.cxx HYDROGUI_Tool2.cxx HYDROGUI_TwoImagesDlg.cxx diff --git a/src/HYDROGUI/HYDROGUI_DataObject.cxx b/src/HYDROGUI/HYDROGUI_DataObject.cxx index 890e29a9..0153dcbd 100644 --- a/src/HYDROGUI/HYDROGUI_DataObject.cxx +++ b/src/HYDROGUI/HYDROGUI_DataObject.cxx @@ -19,6 +19,7 @@ #include "HYDROGUI_DataObject.h" #include +#include #include #include @@ -151,6 +152,7 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const QString aNeedUpdate( aDataObject->IsMustBeUpdated( HYDROData_Entity::Geom_All ) ? "M_" : "" ); int anObjectKind = (int)aDataObject->GetKind(); + bool IsUnsImmZone = false; if ( anObjectKind == KIND_DUMMY_3D ) { Handle(HYDROData_DummyObject3D) anObject3D = @@ -160,8 +162,15 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const if ( !aFatherObj.IsNull() ) anObjectKind = aFatherObj->GetKind(); } - - anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() ); + else if ( anObjectKind == 5 ) + { + Handle(HYDROData_ImmersibleZone) anImmZone = Handle(HYDROData_ImmersibleZone)::DownCast( aDataObject ); + IsUnsImmZone = !anImmZone->IsSubmersible(); + } + if (!IsUnsImmZone) + anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() ); + else + anIcon = QObject::tr( QString("HYDRO_%1TYPE5U_ICO").arg( aNeedUpdate ).toLatin1() ); //icon fot unsumb imm zone } return aResMgr->loadPixmap( "HYDRO", anIcon ); diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index cf0954d9..619420b3 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -822,9 +822,19 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, if( !anObject.IsNull() ) { theMenu->addSeparator(); - theMenu->addAction( action( SubmersibleId ) ); - action( SubmersibleId )->setCheckable( true ); - action( SubmersibleId )->setChecked( anObject->IsSubmersible() ); + bool IsSubmersible = anObject->IsSubmersible(); + if (!IsSubmersible) + { + theMenu->addAction( action( SubmersibleId ) ); + action( SubmersibleId )->setCheckable(true); + action( SubmersibleId )->setChecked(true); + } + else + { + theMenu->addAction( action( UnSubmersibleId ) ); + action( UnSubmersibleId )->setCheckable(true); + action( UnSubmersibleId )->setChecked(true); + } } } } diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index 14c473fe..547c1a91 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -60,6 +60,7 @@ #include "HYDROGUI_ProfileInterpolateOp.h" #include "HYDROGUI_RecognizeContoursOp.h" #include "HYDROGUI_SubmersibleOp.h" +#include "HYDROGUI_UnSubmersibleOp.h" #include "HYDROGUI_StricklerTableOp.h" #include "HYDROGUI_DuplicateOp.h" #include "HYDROGUI_LandCoverMapOp.h" @@ -234,6 +235,7 @@ void HYDROGUI_Module::createActions() createAction( ProfileInterpolateId, "PROFILE_INTERPOLATE", "PROFILE_INTERPOLATE_ICO" ); createAction( SubmersibleId, "SUBMERSIBLE", "SUBMERSIBLE_ICO" ); + createAction( UnSubmersibleId, "UNSUBMERSIBLE", "UNSUBMERSIBLE_ICO" ); createAction( ExportToShapeFileID, "EXPORT_TO_SHAPE_FILE", "EXPORT_TO_SHAPE_FILE_ICO" ); createAction( PolylineExtractionId, "POLYLINE_EXTRACTION" ); @@ -705,6 +707,9 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const case SubmersibleId: anOp = new HYDROGUI_SubmersibleOp( aModule ); break; + case UnSubmersibleId: + anOp = new HYDROGUI_UnSubmersibleOp( aModule ); + break; case PolylineExtractionId: anOp = new HYDROGUI_PolylineExtractionOp( aModule ); break; diff --git a/src/HYDROGUI/HYDROGUI_Operations.h b/src/HYDROGUI/HYDROGUI_Operations.h index e56315e8..50ec909e 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.h +++ b/src/HYDROGUI/HYDROGUI_Operations.h @@ -110,6 +110,7 @@ enum OperationId RecognizeContoursId, SubmersibleId, + UnSubmersibleId, ImportPolylineId, ImportSinusXId, ExportSinusXId, diff --git a/src/HYDROGUI/HYDROGUI_SubmersibleOp.cxx b/src/HYDROGUI/HYDROGUI_SubmersibleOp.cxx index 47ca42f6..af10438a 100644 --- a/src/HYDROGUI/HYDROGUI_SubmersibleOp.cxx +++ b/src/HYDROGUI/HYDROGUI_SubmersibleOp.cxx @@ -46,7 +46,9 @@ bool HYDROGUI_SubmersibleOp::processApply( int& theUpdateFlags, QString& theErro theUpdateFlags = 0; if( isOK ) { - myObject->SetIsSubmersible( !myObject->IsSubmersible() ); + bool IsSubmersible = myObject->IsSubmersible(); + if (!IsSubmersible) + myObject->SetIsSubmersible( true ); theUpdateFlags = 0; } return isOK; diff --git a/src/HYDROGUI/HYDROGUI_UnSubmersibleOp.cxx b/src/HYDROGUI/HYDROGUI_UnSubmersibleOp.cxx new file mode 100644 index 00000000..5fb28bfd --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_UnSubmersibleOp.cxx @@ -0,0 +1,54 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include +#include +#include + +HYDROGUI_UnSubmersibleOp::HYDROGUI_UnSubmersibleOp( HYDROGUI_Module* theModule ) + : HYDROGUI_Operation( theModule ) +{ +} + +HYDROGUI_UnSubmersibleOp::~HYDROGUI_UnSubmersibleOp() +{ +} + +void HYDROGUI_UnSubmersibleOp::startOperation() +{ + HYDROGUI_Operation::startOperation(); + myObject = Handle(HYDROData_Object)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) ); + if( myObject.IsNull() ) + onCancel(); + else + onApply(); +} + +bool HYDROGUI_UnSubmersibleOp::processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries ) +{ + theUpdateFlags = 0; + if( !myObject.IsNull() ) + { + bool IsSubmersible = myObject->IsSubmersible(); + if (IsSubmersible) + myObject->SetIsSubmersible( false ); + return true; + } + return false; +} + diff --git a/src/HYDROGUI/HYDROGUI_UnSubmersibleOp.h b/src/HYDROGUI/HYDROGUI_UnSubmersibleOp.h new file mode 100644 index 00000000..6d0ffb94 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_UnSubmersibleOp.h @@ -0,0 +1,42 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef HYDROGUI_UNSubmersibleOP_H +#define HYDROGUI_UNSubmersibleOP_H + +#include +#include + +class HYDROGUI_UnSubmersibleOp : public HYDROGUI_Operation +{ + Q_OBJECT + +public: + HYDROGUI_UnSubmersibleOp( HYDROGUI_Module* theModule ); + virtual ~HYDROGUI_UnSubmersibleOp(); + +protected: + virtual void startOperation(); + virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ); + +private: + Handle(HYDROData_Object) myObject; +}; + +#endif diff --git a/src/HYDROGUI/resources/HYDROGUI_images.ts b/src/HYDROGUI/resources/HYDROGUI_images.ts index df3ecb21..22f80fc6 100644 --- a/src/HYDROGUI/resources/HYDROGUI_images.ts +++ b/src/HYDROGUI/resources/HYDROGUI_images.ts @@ -46,6 +46,10 @@ SUBMERSIBLE_ICO icon_submersible.png + + UNSUBMERSIBLE_ICO + icon_imm_uns_zone.png + @@ -77,6 +81,10 @@ HYDRO_TYPE5_ICO icon_imm_zone.png + + HYDRO_TYPE5U_ICO + icon_imm_uns_zone.png + HYDRO_TYPE6_ICO icon_river.png @@ -175,6 +183,10 @@ HYDRO_M_TYPE5_ICO icon_mimm_zone.png + + HYDRO_M_TYPE5U_ICO + icon_mimm_uns_zone.png + HYDRO_M_TYPE6_ICO icon_mriver.png diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 4c07b121..95df6446 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -1119,6 +1119,10 @@ Would you like to remove all references from the image? DSK_SUBMERSIBLE Submersible + + DSK_UNSUBMERSIBLE + Unsubmersible + DSK_EXPORT_TO_SHAPE_FILE Export @@ -1492,6 +1496,10 @@ Would you like to remove all references from the image? MEN_SUBMERSIBLE Submersible + + MEN_UNSUBMERSIBLE + Unsubmersible + MEN_EXPORT_TO_SHAPE_FILE Export @@ -1846,6 +1854,10 @@ Would you like to remove all references from the image? STB_SUBMERSIBLE If the object is submersible + + STB_UNSUBMERSIBLE + If the object is non submersible + STB_EXPORT_TO_SHAPE_FILE Export diff --git a/src/HYDROGUI/resources/icon_imm_uns_zone.png b/src/HYDROGUI/resources/icon_imm_uns_zone.png new file mode 100644 index 00000000..49ccbbe0 Binary files /dev/null and b/src/HYDROGUI/resources/icon_imm_uns_zone.png differ diff --git a/src/HYDROGUI/resources/icon_mimm_uns_zone.png b/src/HYDROGUI/resources/icon_mimm_uns_zone.png new file mode 100644 index 00000000..60670936 Binary files /dev/null and b/src/HYDROGUI/resources/icon_mimm_uns_zone.png differ