From f080eec7cf3aa0b4f2ecafea69accb0933843ade Mon Sep 17 00:00:00 2001 From: isn Date: Wed, 25 Oct 2017 19:31:01 +0300 Subject: [PATCH] refs #1323, icons of imm. zones (only) are changing while switching between sumb/non-submers --- src/HYDROGUI/CMakeLists.txt | 2 + src/HYDROGUI/HYDROGUI_DataObject.cxx | 13 ++++- src/HYDROGUI/HYDROGUI_Module.cxx | 16 +++++- src/HYDROGUI/HYDROGUI_Operations.cxx | 5 ++ src/HYDROGUI/HYDROGUI_Operations.h | 1 + src/HYDROGUI/HYDROGUI_SubmersibleOp.cxx | 4 +- src/HYDROGUI/HYDROGUI_UnSubmersibleOp.cxx | 54 ++++++++++++++++++ src/HYDROGUI/HYDROGUI_UnSubmersibleOp.h | 42 ++++++++++++++ src/HYDROGUI/resources/HYDROGUI_images.ts | 12 ++++ src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 12 ++++ src/HYDROGUI/resources/icon_imm_uns_zone.png | Bin 0 -> 809 bytes src/HYDROGUI/resources/icon_mimm_uns_zone.png | Bin 0 -> 837 bytes 12 files changed, 155 insertions(+), 6 deletions(-) create mode 100644 src/HYDROGUI/HYDROGUI_UnSubmersibleOp.cxx create mode 100644 src/HYDROGUI/HYDROGUI_UnSubmersibleOp.h create mode 100644 src/HYDROGUI/resources/icon_imm_uns_zone.png create mode 100644 src/HYDROGUI/resources/icon_mimm_uns_zone.png 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 0000000000000000000000000000000000000000..49ccbbe0b943504009c1e06adcb3fe07884b818d GIT binary patch literal 809 zcmV+^1J?YBP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E-^MlX|MGF00NmwL_t(IPkmEeNRv?*{$^n5MWeznyb5hz zv~IEsld@^*MTA6>5<#hfKM-g_V!sek%_)6znkjV=kTW$LDM^eA_BV+mr_qkyg0erzg)Q%qYqATGxt%A#Wm4MEIE35QX=EFR1o@EBj;Hyh zBIsG>apX7I1#!X`z<|?_i{*D#6V#W?7}imb&g^GO&hulr$qp&t8wG`6eS#j zsc)Ku2Y!Yb`iu`(6Zo#1gu@>Qi7y%&R>%|H#fUAs2B+rn#ytnLv_uk+5W%^9S**6( ziKFHb_|Me|$IOXR)O1aXliLQq;N7PMJb3FBWf(}C4?FipMU>@EA_Vv|#?*doC`R@z z+lrWZgd_3@O74w{J#Q$A3#+pEv&4eIE!3Vp)M29k)v79hFe&rG0?hgt`F;00000NkvXXu0mjfpu1<6 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..60670936cac07ea62e296306095c4f779c930954 GIT binary patch literal 837 zcmV-L1G@Z)P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E-^MlX|MGF00Om1L_t(IPjypSNR&|&{>Q-5hlUEn@F}$M zq3I=i2&pJddoeLZ&2YgbTVUG2p-reKZJ3(H1w#ZYjTU;bh8{EsgmQE$bM~ z^;Xt$x*G+?aRFy%5u9B|7eeb(!8WRc%MIC}0cCs(!F;=vq?4l}_L z_aEiefvJ)pCvO1LWPhb6H%qWu+vy^I6FYObUg$9Ie=6X%=|nQcVJNo@`sPk(J;Y!1uwF3Hj6V5+$YGLP&9IP0O zfXyZlF_{tEyPuIZOUu*)r?ZT5Qbcm%SzYIW|E%+GTIY*&?PT6i!~?2-t@o1qL`n^n P00000NkvXXu0mjfHp+F( literal 0 HcmV?d00001 -- 2.39.2