]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1323, icons of imm. zones (only) are changing while switching between sumb...
authorisn <isn@opencascade.com>
Wed, 25 Oct 2017 16:31:01 +0000 (19:31 +0300)
committerisn <isn@opencascade.com>
Mon, 30 Oct 2017 18:49:38 +0000 (21:49 +0300)
12 files changed:
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_DataObject.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/HYDROGUI_SubmersibleOp.cxx
src/HYDROGUI/HYDROGUI_UnSubmersibleOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_UnSubmersibleOp.h [new file with mode: 0644]
src/HYDROGUI/resources/HYDROGUI_images.ts
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDROGUI/resources/icon_imm_uns_zone.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_mimm_uns_zone.png [new file with mode: 0644]

index 0454e19f469287bb53029d6daa9c295f829be938..130135bdbbc2280a83d6226843681c1e33d5358c 100644 (file)
@@ -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
index 890e29a9b62441aaf0e15f14a286ab519bf246d5..0153dcbd7bcbd61d7b912b9f4a8aeefca86a7139 100644 (file)
@@ -19,6 +19,7 @@
 #include "HYDROGUI_DataObject.h"
 
 #include <HYDROData_DummyObject3D.h>
+#include <HYDROData_ImmersibleZone.h>
 #include <HYDROData_Object.h>
 
 #include <TDF_Tool.hxx>
@@ -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 );
index cf0954d922a3c8d89b324d02abfd19f5dfbe864c..619420b3b1ce38adecaa634d0153530697827e72 100644 (file)
@@ -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);
+        }
       }
     }
   }
index 14c473fe55a283bb18f1123b534287ee281b510c..547c1a914fad2f8a82faed95af72473f8492e4f8 100644 (file)
@@ -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;
index e56315e8483b4e126d9ea1309978f621a1f148bf..50ec909ea09929c373de6089019be3bdfe2d180e 100644 (file)
@@ -110,6 +110,7 @@ enum OperationId
 
   RecognizeContoursId,
   SubmersibleId,
+  UnSubmersibleId,
   ImportPolylineId,
   ImportSinusXId,
   ExportSinusXId,
index 47ca42f6ed19ad8bcdff834034678f1a178d254d..af10438a09c6870961c39140ce80b2f179937b29 100644 (file)
@@ -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 (file)
index 0000000..5fb28bf
--- /dev/null
@@ -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 <HYDROGUI_UnSubmersibleOp.h>
+#include <HYDROGUI_Tool2.h>
+#include <HYDROGUI_Module.h>
+
+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 (file)
index 0000000..6d0ffb9
--- /dev/null
@@ -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 <HYDROGUI_Operation.h>
+#include <HYDROData_Object.h>
+
+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
index df3ecb21aa9edc7a2408149e296f0ca5469c06aa..22f80fc6f6c47d4d33e1d1e6cf4195df7aaae73a 100644 (file)
       <source>SUBMERSIBLE_ICO</source>
       <translation>icon_submersible.png</translation>
     </message>
+    <message>
+      <source>UNSUBMERSIBLE_ICO</source>
+      <translation>icon_imm_uns_zone.png</translation>
+    </message>
 
 
     <!-- Icons for objects -->
       <source>HYDRO_TYPE5_ICO</source>
       <translation>icon_imm_zone.png</translation>
     </message>
+    <message>
+      <source>HYDRO_TYPE5U_ICO</source>
+      <translation>icon_imm_uns_zone.png</translation>
+    </message>
     <message>
       <source>HYDRO_TYPE6_ICO</source>
       <translation>icon_river.png</translation>
       <source>HYDRO_M_TYPE5_ICO</source>
       <translation>icon_mimm_zone.png</translation>
     </message>
+    <message>
+      <source>HYDRO_M_TYPE5U_ICO</source>
+      <translation>icon_mimm_uns_zone.png</translation>
+    </message>
     <message>
       <source>HYDRO_M_TYPE6_ICO</source>
       <translation>icon_mriver.png</translation>
index 4c07b121e78209e781a852da143d6a9bbd164f72..95df64460cea956c35789919dc66524952960b98 100644 (file)
@@ -1119,6 +1119,10 @@ Would you like to remove all references from the image?</translation>
       <source>DSK_SUBMERSIBLE</source>
       <translation>Submersible</translation>
     </message>
+    <message>
+      <source>DSK_UNSUBMERSIBLE</source>
+      <translation>Unsubmersible</translation>
+    </message>
     <message>
       <source>DSK_EXPORT_TO_SHAPE_FILE</source>
       <translation>Export</translation>
@@ -1492,6 +1496,10 @@ Would you like to remove all references from the image?</translation>
       <source>MEN_SUBMERSIBLE</source>
       <translation>Submersible</translation>
     </message>
+    <message>
+      <source>MEN_UNSUBMERSIBLE</source>
+      <translation>Unsubmersible</translation>
+    </message>
     <message>
       <source>MEN_EXPORT_TO_SHAPE_FILE</source>
       <translation>Export</translation>
@@ -1846,6 +1854,10 @@ Would you like to remove all references from the image?</translation>
       <source>STB_SUBMERSIBLE</source>
       <translation>If the object is submersible</translation>
     </message>
+    <message>
+      <source>STB_UNSUBMERSIBLE</source>
+      <translation>If the object is non submersible</translation>
+    </message>
     <message>
       <source>STB_EXPORT_TO_SHAPE_FILE</source>
       <translation>Export</translation>
diff --git a/src/HYDROGUI/resources/icon_imm_uns_zone.png b/src/HYDROGUI/resources/icon_imm_uns_zone.png
new file mode 100644 (file)
index 0000000..49ccbbe
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 (file)
index 0000000..6067093
Binary files /dev/null and b/src/HYDROGUI/resources/icon_mimm_uns_zone.png differ