From: vsv Date: Thu, 27 Jun 2019 16:15:02 +0000 (+0300) Subject: Provide Color Scale preferences in SALOME mode X-Git-Tag: VEDF2019Lot4~103^2~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0ea850a2c65f95ae48e87e27eca5704324089ae8;p=modules%2Fshaper.git Provide Color Scale preferences in SALOME mode --- diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index 209e9542f..7fa6366d6 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -788,6 +788,41 @@ void SHAPERGUI::createPreferences() pref->addItem(tr("In 2d mode"), highlightGroup, SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-2d"); + int colorScaleGroup = pref->addItem(tr("Color scale"), viewTab); + pref->setItemProperty("columns", 4, colorScaleGroup); + int aItem = pref->addItem(tr("X position"), colorScaleGroup, + SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_x_position"); + pref->setItemProperty("min", 0, aItem); + pref->setItemProperty("max", 1, aItem); + + aItem = pref->addItem(tr("Y position"), colorScaleGroup, + SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_y_position"); + pref->setItemProperty("min", 0, aItem); + pref->setItemProperty("max", 1, aItem); + + aItem = pref->addItem(tr("Width"), colorScaleGroup, + SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_width"); + pref->setItemProperty("min", 0, aItem); + pref->setItemProperty("max", 1, aItem); + + aItem = pref->addItem(tr("Height"), colorScaleGroup, + SUIT_PreferenceMgr::Double, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_height"); + pref->setItemProperty("min", 0, aItem); + pref->setItemProperty("max", 1, aItem); + + aItem = pref->addItem(tr("Intervals number"), colorScaleGroup, + SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_nb_intervals"); + pref->setItemProperty("min", 0, aItem); + pref->setItemProperty("max", 100, aItem); + + aItem = pref->addItem(tr("Text height"), colorScaleGroup, + SUIT_PreferenceMgr::Integer, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_height"); + pref->setItemProperty("min", 0, aItem); + pref->setItemProperty("max", 100, aItem); + + aItem = pref->addItem(tr("Text color"), colorScaleGroup, + SUIT_PreferenceMgr::Color, ModuleBase_Preferences::VIEWER_SECTION, "scalar_bar_text_color"); + pref->retrieve(); } diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp index aa417a462..785c67f2a 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp @@ -561,6 +561,14 @@ void SHAPERGUI_SalomeViewer::setColorScaleTextHeigth(int theH) } } +void SHAPERGUI_SalomeViewer::setColorScaleTextColor(const QColor& theColor) +{ + if (mySelector) { + Quantity_Color aColor(theColor.redF(), theColor.greenF(), theColor.blueF(), Quantity_TOC_RGB); + mySelector->viewer()->getColorScale()->SetColor(aColor); + } +} + void SHAPERGUI_SalomeViewer::setColorScaleTitle(const QString& theText) { if (mySelector) { diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h index 2b6b88792..588eafff0 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h @@ -200,6 +200,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); diff --git a/src/SHAPERGUI/resources/LightApp.xml.in b/src/SHAPERGUI/resources/LightApp.xml.in index 9e39e529e..fb1dbafbd 100644 --- a/src/SHAPERGUI/resources/LightApp.xml.in +++ b/src/SHAPERGUI/resources/LightApp.xml.in @@ -25,6 +25,15 @@ + + + + + + + + +