From: vsv Date: Fri, 26 Jul 2019 10:08:24 +0000 (+0300) Subject: Issue #2964: Coloring of a step field on a part X-Git-Tag: VEDF2019Lot4~87 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ab5d666a987372fad8eca4351fb4720e163db76a;p=modules%2Fshaper.git Issue #2964: Coloring of a step field on a part --- diff --git a/src/PartSet/PartSet_FieldStepPrs.cpp b/src/PartSet/PartSet_FieldStepPrs.cpp index 04c38b959..20dd7ca98 100644 --- a/src/PartSet/PartSet_FieldStepPrs.cpp +++ b/src/PartSet/PartSet_FieldStepPrs.cpp @@ -123,7 +123,7 @@ QList PartSet_FieldStepPrs::range(double& theMin, double& theMax) const } QList aShapeData; double aRangeMin = aFieldStepData.first(), aRangeMax = aFieldStepData.last(); - for (int aRow = 0; aRow < aRows - 1; aRow++) { + for (int aRow = 0; aRow < aRows - aStart; aRow++) { double aNorm = 0; int aBaseIndex = aRow * aCols; for (int aCol = 0; aCol < aCols; aCol++) { @@ -158,18 +158,27 @@ void PartSet_FieldStepPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t { double aMin, aMax; QList aShapeData = range(aMin, aMax); - 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++) { - AttributeSelectionPtr aSelection = aSelList->value(i); - GeomShapePtr aShapePtr = aSelection->value(); - TopoDS_Shape aShape = aShapePtr->impl(); - double aValue = aShapeData.at(i); + std::string aTypeStr = aSelList->selectionType(); + if (aTypeStr == "part") { Quantity_Color aColor; - if (AIS_ColorScale::FindColor(aValue, aMin, aMax, aNbIntertvals, aColor)) - SetCustomColor(aShape, aColor); + if (AIS_ColorScale::FindColor(aMin, aMin, aMax, 1, aColor)) { + SetColor(aColor); + } + } + else { + int aNbIntertvals = aResMgr->integerValue("Viewer", "scalar_bar_nb_intervals", 20); + for (int i = 0; i < aSelList->size(); i++) { + AttributeSelectionPtr aSelection = aSelList->value(i); + GeomShapePtr aShapePtr = aSelection->value(); + TopoDS_Shape aShape = aShapePtr->impl(); + double aValue = aShapeData.at(i); + Quantity_Color aColor; + if (AIS_ColorScale::FindColor(aValue, aMin, aMax, aNbIntertvals, aColor)) + SetCustomColor(aShape, aColor); + } } } break;