X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConstructionPlugin%2FConstructionPlugin_Point.cpp;h=087cfd91deaf5d37e9da75790cef97f5e628747d;hb=29ae5ac5706b94b3df50136a545649be524fd2a3;hp=51432b609b7f269b390759b8a7a0f934973793b3;hpb=d4b0a5cb916f4eccf4a0bce02e43a54c7a67cb93;p=modules%2Fshaper.git diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp index 51432b609..087cfd91d 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,16 +12,16 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "ConstructionPlugin_Point.h" #include #include +#include #include #include #include @@ -38,6 +38,8 @@ #include #include +#include + //================================================================================================== ConstructionPlugin_Point::ConstructionPlugin_Point() { @@ -151,13 +153,27 @@ void ConstructionPlugin_Point::execute() //================================================================================================== bool ConstructionPlugin_Point::customisePresentation(ResultPtr theResult, - AISObjectPtr thePrs, - std::shared_ptr theDefaultPrs) + AISObjectPtr thePrs) { - bool isCustomized = theDefaultPrs.get() != NULL && - theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs); + std::vector aColor; + // get color from the attribute of the result + if (theResult.get() != NULL && + theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) { + AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID()); + if (aColorAttr.get() && aColorAttr->size()) { + aColor.push_back(aColorAttr->value(0)); + aColor.push_back(aColorAttr->value(1)); + aColor.push_back(aColorAttr->value(2)); + } + } + if (aColor.empty()) + aColor = Config_PropManager::color("Visualization", COLOR_NAME()); + + bool isCustomized = false; + if (aColor.size() == 3) + isCustomized = thePrs->setColor(aColor[0], aColor[1], aColor[2]); //thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol - return true; + return isCustomized; } //================================================================================================== @@ -305,8 +321,7 @@ std::list > } } - return GeomAlgoAPI_ShapeTools::intersect(anEdge, aFace, - aPlaneSelection->context()->groupName() == ModelAPI_ResultConstruction::group()); + return GeomAlgoAPI_ShapeTools::intersect(anEdge, aFace); } //==================================================================================================