X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_CustomPrs.cpp;h=10125e574301d1c8d8cb228a97bb071bd20721f2;hb=13d3f0d8b46a06931cbe8620b8563049eff4a9f6;hp=c074a841e4ab3af76f0b33dee705234510d38f74;hpb=fb0152c9215e449f46ee788c06e2902b4b77eefa;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_CustomPrs.cpp b/src/XGUI/XGUI_CustomPrs.cpp index c074a841e..10125e574 100644 --- a/src/XGUI/XGUI_CustomPrs.cpp +++ b/src/XGUI/XGUI_CustomPrs.cpp @@ -7,11 +7,13 @@ #include #include +#include #include #include #include +#include void getColor(ResultPtr theResult, std::vector& theColor) @@ -28,7 +30,7 @@ void getColor(ResultPtr theResult, std::vector& theColor) } } -void getDefaultColor(ResultPtr theResult, AISObjectPtr thePrs, std::vector& theColor) +void getDefaultColor(ResultPtr theResult, std::vector& theColor) { theColor.clear(); // get default color from the preferences manager for the given result @@ -47,14 +49,27 @@ void getDefaultColor(ResultPtr theResult, AISObjectPtr thePrs, std::vector& } } +void XGUI_CustomPrs::getResultColor(ResultPtr theResult, std::vector& theColor) +{ + getColor(theResult, theColor); + if (theColor.empty()) + getDefaultColor(theResult, theColor); +} + bool XGUI_CustomPrs::customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, std::shared_ptr theCustomPrs) { std::vector aColor; - getColor(theResult, aColor); - if (aColor.empty()) - getDefaultColor(theResult, thePrs, aColor); + getResultColor(theResult, aColor); + SessionPtr aMgr = ModelAPI_Session::get(); + if (aMgr->activeDocument() != theResult->document()) { + QColor aQColor(aColor[0], aColor[1], aColor[2]); + QColor aNewColor = QColor::fromHsvF(aQColor.hueF(), aQColor.saturationF()/3., aQColor.valueF()); + aColor[0] = aNewColor.red(); + aColor[1] = aNewColor.green(); + aColor[2] = aNewColor.blue(); + } return !aColor.empty() && thePrs->setColor(aColor[0], aColor[1], aColor[2]); }