From: isn Date: Fri, 3 Nov 2017 13:42:36 +0000 (+0300) Subject: refs #1323 X-Git-Tag: v2.1~58^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_1323_0;p=modules%2Fhydro.git refs #1323 --- diff --git a/src/HYDROGUI/HYDROGUI_DataObject.cxx b/src/HYDROGUI/HYDROGUI_DataObject.cxx index 0153dcbd..181c591b 100644 --- a/src/HYDROGUI/HYDROGUI_DataObject.cxx +++ b/src/HYDROGUI/HYDROGUI_DataObject.cxx @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include @@ -33,6 +35,7 @@ #include #include +#include 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 ); diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 619420b3..ab02eb40 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -49,6 +49,8 @@ #include #include #include +#include +#include #include @@ -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(); diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index 547c1a91..2a817f47 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -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" ); diff --git a/src/HYDROGUI/resources/HYDROGUI_images.ts b/src/HYDROGUI/resources/HYDROGUI_images.ts index 22f80fc6..4a080b60 100644 --- a/src/HYDROGUI/resources/HYDROGUI_images.ts +++ b/src/HYDROGUI/resources/HYDROGUI_images.ts @@ -47,8 +47,16 @@ icon_submersible.png - UNSUBMERSIBLE_ICO - icon_imm_uns_zone.png + HYDRO_UNSUBMERSIBLE_ICO + icon_unsubmersible.png + + + HYDRO_UNSUBMERSIBLE16_ICO + icon_unsumb_16.png + + + HYDRO_SUBMERSIBLE16_ICO + icon_sumb_16.png diff --git a/src/HYDROGUI/resources/icon_sumb_16.png b/src/HYDROGUI/resources/icon_sumb_16.png new file mode 100644 index 00000000..34a79149 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 index 00000000..49ccbbe0 Binary files /dev/null and b/src/HYDROGUI/resources/icon_unsumb_16.png differ