]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1323 BR_1323_0
authorisn <isn@opencascade.com>
Fri, 3 Nov 2017 13:42:36 +0000 (16:42 +0300)
committerisn <isn@opencascade.com>
Fri, 3 Nov 2017 14:18:06 +0000 (17:18 +0300)
src/HYDROGUI/HYDROGUI_DataObject.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/resources/HYDROGUI_images.ts
src/HYDROGUI/resources/icon_sumb_16.png [new file with mode: 0644]
src/HYDROGUI/resources/icon_unsumb_16.png [new file with mode: 0644]

index 0153dcbd7bcbd61d7b912b9f4a8aeefca86a7139..181c591b33cd392ad0b4eee76dbd84916aadc206 100644 (file)
@@ -21,6 +21,8 @@
 #include <HYDROData_DummyObject3D.h>
 #include <HYDROData_ImmersibleZone.h>
 #include <HYDROData_Object.h>
+#include <HYDROData_ArtificialObject.h>
+#include <HYDROData_NaturalObject.h>
 
 #include <TDF_Tool.hxx>
 
@@ -33,6 +35,7 @@
 #include <SUIT_Study.h>
 
 #include <QPixmap>
+#include <QPainter>
 
 HYDROGUI_DataObject::HYDROGUI_DataObject( SUIT_DataObject* theParent, 
                                           Handle(HYDROData_Entity) theData,
@@ -143,6 +146,15 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const
   {
     QString anIcon;
     Handle(HYDROData_Entity) aDataObject = modelObject();
+    Handle(HYDROData_Object) anObject;
+    Handle(HYDROData_ArtificialObject) anAObject = Handle( HYDROData_ArtificialObject )::DownCast(aDataObject);
+    Handle(HYDROData_NaturalObject) aNObject = Handle( HYDROData_NaturalObject )::DownCast(aDataObject);
+    
+    if (!anAObject.IsNull())
+      anObject = anAObject;
+    if (!aNObject.IsNull())
+      anObject = aNObject;
+
     if( aDataObject.IsNull() )
     {
       anIcon = QObject::tr( "HYDRO_TYPE0_ICO" ); // KIND_UNKNOWN
@@ -162,15 +174,29 @@ QPixmap HYDROGUI_DataObject::icon( const int theId ) const
         if ( !aFatherObj.IsNull() )
           anObjectKind = aFatherObj->GetKind();
       }
-      else if ( anObjectKind == 5 )
+      else if ( !anObject.IsNull() )
       {
-        Handle(HYDROData_ImmersibleZone) anImmZone = Handle(HYDROData_ImmersibleZone)::DownCast( aDataObject );
-        IsUnsImmZone = !anImmZone->IsSubmersible();
+        bool IsSubm = anObject->IsSubmersible();
+        QString anIcon1 = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
+        QString anIcon2;
+        if (IsSubm) 
+          anIcon2 = QObject::tr( QString("HYDRO_SUBMERSIBLE16_ICO").toLatin1());
+        else
+          anIcon2 = QObject::tr( QString("HYDRO_UNSUBMERSIBLE16_ICO").toLatin1());
+
+        QPixmap qpm1 = aResMgr->loadPixmap( "HYDRO", anIcon1 );
+        QPixmap qpm2 = aResMgr->loadPixmap( "HYDRO", anIcon2 );
+        QPixmap qpmD(32,16);
+        qpmD.fill(QColor(0,0,0));
+        QPainter painter;
+        painter.begin(&qpmD);
+        painter.drawPixmap(0, 0, qpm1);
+        painter.drawPixmap(16, 0, qpm2);
+        painter.end();
+        return qpmD;
       }
-      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
+        anIcon = QObject::tr( QString("HYDRO_%1TYPE%2_ICO").arg( aNeedUpdate ).arg( anObjectKind ).toLatin1() );
     }
 
     return aResMgr->loadPixmap( "HYDRO", anIcon );
index 619420b3b1ce38adecaa634d0153530697827e72..ab02eb40e4a7f26a80008a0112bc17c3de7fb8dc 100644 (file)
@@ -49,6 +49,8 @@
 #include <HYDROData_Lambert93.h>
 #include <HYDROData_Polyline3D.h>
 #include <HYDROData_StricklerTable.h>
+#include <HYDROData_ArtificialObject.h>
+#include <HYDROData_NaturalObject.h>
 
 #include <HYDROData_OperationsFactory.h>
 
@@ -818,7 +820,16 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   {
     if( aSeq.Size() > 0 )
     {
-      Handle( HYDROData_Object ) anObject = Handle( HYDROData_Object )::DownCast( aSeq.First() );
+      Handle( HYDROData_Entity ) aFirstEnt = aSeq.First();
+      Handle(HYDROData_Object) anObject;
+      Handle(HYDROData_ArtificialObject) anAObject = Handle( HYDROData_ArtificialObject )::DownCast(aFirstEnt);
+      Handle(HYDROData_NaturalObject) aNObject = Handle( HYDROData_NaturalObject )::DownCast(aFirstEnt);
+
+      if (!anAObject.IsNull())
+        anObject = anAObject;
+      if (!aNObject.IsNull())
+        anObject = aNObject;
+
       if( !anObject.IsNull() )
       {
         theMenu->addSeparator();
index 547c1a914fad2f8a82faed95af72473f8492e4f8..2a817f47b0f4e0abe1ec86256f371b4a16b67937 100644 (file)
@@ -235,7 +235,7 @@ void HYDROGUI_Module::createActions()
   createAction( ProfileInterpolateId, "PROFILE_INTERPOLATE", "PROFILE_INTERPOLATE_ICO" );
 
   createAction( SubmersibleId, "SUBMERSIBLE", "SUBMERSIBLE_ICO" );
-  createAction( UnSubmersibleId, "UNSUBMERSIBLE", "UNSUBMERSIBLE_ICO" );
+  createAction( UnSubmersibleId, "UNSUBMERSIBLE", "HYDRO_UNSUBMERSIBLE16_ICO" );
   createAction( ExportToShapeFileID, "EXPORT_TO_SHAPE_FILE", "EXPORT_TO_SHAPE_FILE_ICO" );
 
   createAction( PolylineExtractionId, "POLYLINE_EXTRACTION" );
index 22f80fc6f6c47d4d33e1d1e6cf4195df7aaae73a..4a080b6003ce02410960e071a23a46ff33125202 100644 (file)
       <translation>icon_submersible.png</translation>
     </message>
     <message>
-      <source>UNSUBMERSIBLE_ICO</source>
-      <translation>icon_imm_uns_zone.png</translation>
+      <source>HYDRO_UNSUBMERSIBLE_ICO</source>
+      <translation>icon_unsubmersible.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_UNSUBMERSIBLE16_ICO</source>
+      <translation>icon_unsumb_16.png</translation>
+    </message>
+    <message>
+      <source>HYDRO_SUBMERSIBLE16_ICO</source>
+      <translation>icon_sumb_16.png</translation>
     </message>
 
 
diff --git a/src/HYDROGUI/resources/icon_sumb_16.png b/src/HYDROGUI/resources/icon_sumb_16.png
new file mode 100644 (file)
index 0000000..34a7914
Binary files /dev/null and b/src/HYDROGUI/resources/icon_sumb_16.png differ
diff --git a/src/HYDROGUI/resources/icon_unsumb_16.png b/src/HYDROGUI/resources/icon_unsumb_16.png
new file mode 100644 (file)
index 0000000..49ccbbe
Binary files /dev/null and b/src/HYDROGUI/resources/icon_unsumb_16.png differ