From: vsv Date: Thu, 27 Jun 2019 15:19:31 +0000 (+0300) Subject: Manage colors of ColorScale presentation X-Git-Tag: VEDF2019Lot4~103^2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=605aa7248932dd2a0c68e74cac76dffb5a12c27d;p=modules%2Fshaper.git Manage colors of ColorScale presentation --- diff --git a/src/ModuleBase/ModuleBase_IViewer.h b/src/ModuleBase/ModuleBase_IViewer.h index e264f5cb4..77c10a45c 100644 --- a/src/ModuleBase/ModuleBase_IViewer.h +++ b/src/ModuleBase/ModuleBase_IViewer.h @@ -173,6 +173,10 @@ Q_OBJECT // \param theH is number of intervals virtual void setColorScaleTextHeigth(int theH) = 0; + //! Set color of text of color scale + // \param theH is number of intervals + virtual void setColorScaleTextColor(const QColor& theColor) = 0; + //! Set title of color scale // \param theText is a title virtual void setColorScaleTitle(const QString& theText) = 0; diff --git a/src/PartSet/PartSet_FieldStepPrs.cpp b/src/PartSet/PartSet_FieldStepPrs.cpp index f99c796e2..2c0981dbc 100644 --- a/src/PartSet/PartSet_FieldStepPrs.cpp +++ b/src/PartSet/PartSet_FieldStepPrs.cpp @@ -19,12 +19,16 @@ #include "PartSet_FieldStepPrs.h" +#include + #include #include #include #include +#include + #include #include #include @@ -68,7 +72,13 @@ PartSet_FieldStepPrs::PartSet_FieldStepPrs(FieldStepPtr theStep) aDrawer->SetPointAspect( new Prs3d_PointAspect(Aspect_TOM_POINT, Quantity_NOC_YELLOW, POINT_SIZE)); - myLabelColor = Quantity_Color(1, 1, 1, Quantity_TOC_RGB); + SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); + QColor aQColor = aResMgr->colorValue("Viewer", "scalar_bar_text_color", Qt::black); + + myLabelColor = Quantity_Color(aQColor.redF(), aQColor.greenF(), aQColor.blueF(), + Quantity_TOC_RGB); + + SetMaterial(Graphic3d_NOM_PLASTIC); } @@ -144,7 +154,8 @@ void PartSet_FieldStepPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t { double aMin, aMax; QList aShapeData = range(aMin, aMax); - int aNbIntertvals = 20; + SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); + int aNbIntertvals = aResMgr->integerValue("Viewer", "scalar_bar_nb_intervals", 20); AttributeSelectionListPtr aSelList = aData->selectionList(CollectionPlugin_Field::SELECTED_ID()); for (int i = 0; i < aSelList->size(); i++) { diff --git a/src/XGUI/SHAPER.xml b/src/XGUI/SHAPER.xml index e580f31a1..879498824 100644 --- a/src/XGUI/SHAPER.xml +++ b/src/XGUI/SHAPER.xml @@ -20,6 +20,7 @@ +
diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index 367b8ad86..7d86a013f 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -620,6 +620,18 @@ void XGUI_ViewerProxy::setColorScaleIntervals(int theNb) #endif } +void XGUI_ViewerProxy::setColorScaleTextColor(const QColor& theColor) +{ +#ifdef HAVE_SALOME + myWorkshop->salomeConnector()->viewer()->setColorScaleTextColor(theColor); +#else + Handle(AIS_ColorScale) aColorScale = myWorkshop->mainWindow()->viewer()->colorScale(); + Quantity_Color aColor(theColor.redF(), theColor.greenF(), theColor.blueF(), Quantity_TOC_RGB); + aColorScale->SetColor(aColor); +#endif +} + + void XGUI_ViewerProxy::setColorScaleTextHeigth(int theH) { #ifdef HAVE_SALOME @@ -653,6 +665,9 @@ void XGUI_ViewerProxy::setupColorScale() double aH = aResMgr->doubleValue("Viewer", "scalar_bar_height", 0.5); setColorScaleSize(aW, aH); + QColor aColor = aResMgr->integerValue("Viewer", "scalar_bar_text_color", Qt::black); + setColorScaleTextColor(aColor); + int aT = aResMgr->integerValue("Viewer", "scalar_bar_text_height", 14); setColorScaleTextHeigth(aT); diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index 384372390..3f8688960 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -150,6 +150,10 @@ Q_OBJECT // \param theH is number of intervals virtual void setColorScaleTextHeigth(int theH); + //! Set color of text of color scale + // \param theH is number of intervals + virtual void setColorScaleTextColor(const QColor& theColor); + //! Set title of color scale // \param theText is a title virtual void setColorScaleTitle(const QString& theText);