X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_CustomPrs.cpp;h=1780f0d44f6299d88775afb1130ad0c0aea10cf0;hb=490a2d118559ea9dfbb22eedb8075038743eb8ea;hp=8c268fd1d2754375195ff041dc945ec1ea0031c9;hpb=b58a01d9feef4187f2be788f17b1ef60a91be6b8;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_CustomPrs.cpp b/src/PartSet/PartSet_CustomPrs.cpp index 8c268fd1d..1780f0d44 100755 --- a/src/PartSet/PartSet_CustomPrs.cpp +++ b/src/PartSet/PartSet_CustomPrs.cpp @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: PartSet_CustomPrs.cpp -// Created: 30 Jun 2015 -// Author: Natalia ERMOLAEVA +// Copyright (C) 2014-2017 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// 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 +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #include #include @@ -60,9 +74,7 @@ bool PartSet_CustomPrs::activate(const FeaturePtr& theFeature, bool isModified = false; if (theFeature.get()) { - displayPresentation(ModuleBase_IModule::CustomizeArguments, theUpdateViewer); - displayPresentation(ModuleBase_IModule::CustomizeResults, theUpdateViewer); - displayPresentation(ModuleBase_IModule::CustomizeHighlightedObjects, theUpdateViewer); + displayPresentation(theFlag, theUpdateViewer); isModified = true; } return isModified; @@ -72,14 +84,8 @@ bool PartSet_CustomPrs::deactivate(const ModuleBase_IModule::ModuleBase_Customiz const bool theUpdateViewer) { myIsActive[theFlag] = false; - bool isModified = false; - - erasePresentation(ModuleBase_IModule::CustomizeArguments, theUpdateViewer); - erasePresentation(ModuleBase_IModule::CustomizeResults, theUpdateViewer); - erasePresentation(ModuleBase_IModule::CustomizeHighlightedObjects, theUpdateViewer); - isModified = true; - - return isModified; + erasePresentation(theFlag, theUpdateViewer); + return true; } bool PartSet_CustomPrs::displayPresentation( @@ -104,6 +110,7 @@ bool PartSet_CustomPrs::displayPresentation( break; case ModuleBase_IModule::CustomizeResults: PartSet_OperationPrs::getResultShapes(myFeature, myWorkshop, aFeatureShapes); + PartSet_OperationPrs::getPresentationShapes(myFeature, myWorkshop, aFeatureShapes, false); break; case ModuleBase_IModule::CustomizeHighlightedObjects: PartSet_OperationPrs::getHighlightedShapes(myWorkshop, aFeatureShapes); @@ -111,7 +118,7 @@ bool PartSet_CustomPrs::displayPresentation( default: return isModified; } - NCollection_DataMap& aShapeMap = + NCollection_DataMap& aShapeMap = anOperationPrs->shapesMap(); PartSet_OperationPrs::fillShapeList(aFeatureShapes, myWorkshop, aShapeMap); @@ -157,8 +164,9 @@ bool PartSet_CustomPrs::displayPresentation( return isModified; } -bool PartSet_CustomPrs::erasePresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer) +bool PartSet_CustomPrs::erasePresentation( + const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + const bool theUpdateViewer) { bool isErased = false; XGUI_Workshop* aWorkshop = workshop(); @@ -167,7 +175,8 @@ bool PartSet_CustomPrs::erasePresentation(const ModuleBase_IModule::ModuleBase_C return isErased; } -void PartSet_CustomPrs::clearPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) +void PartSet_CustomPrs::clearPresentation( + const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) { AISObjectPtr aPresentation = getPresentation(theFlag, false); if (aPresentation.get()) { @@ -190,7 +199,7 @@ AISObjectPtr PartSet_CustomPrs::getPresentation( AISObjectPtr anOperationPrs; if (myPresentations.contains(theFlag)) anOperationPrs = myPresentations[theFlag]; - + if (!anOperationPrs.get() && theToCreate) { initPresentation(theFlag); anOperationPrs = myPresentations[theFlag]; @@ -209,7 +218,7 @@ bool PartSet_CustomPrs::redisplay(const ObjectPtr& theObject, bool aRedisplayed = false; if (myIsActive[theFlag]) aRedisplayed = displayPresentation(theFlag, theUpdateViewer); - + return aRedisplayed; } @@ -226,7 +235,8 @@ void PartSet_CustomPrs::processEvent(const std::shared_ptr& theM myPresentationIsEmpty = true; /// store state to analize it after display/erase is finished } -void PartSet_CustomPrs::initPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) +void PartSet_CustomPrs::initPresentation( + const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) { AISObjectPtr anOperationPrs = AISObjectPtr(new GeomAPI_AISObject()); Handle(PartSet_OperationPrs) anAISPrs = new PartSet_OperationPrs(myWorkshop); @@ -249,16 +259,13 @@ Quantity_Color PartSet_CustomPrs::getShapeColor( Quantity_Color aColor; switch(theFlag) { case ModuleBase_IModule::CustomizeArguments: - aColor = ModuleBase_Tools::color("Visualization", "operation_parameter_color", - OPERATION_PARAMETER_COLOR()); + aColor = ModuleBase_Tools::color("Visualization", "operation_parameter_color"); break; case ModuleBase_IModule::CustomizeResults: - aColor = ModuleBase_Tools::color("Visualization", "operation_result_color", - OPERATION_RESULT_COLOR()); + aColor = ModuleBase_Tools::color("Visualization", "operation_result_color"); break; case ModuleBase_IModule::CustomizeHighlightedObjects: - aColor = ModuleBase_Tools::color("Visualization", "operation_highlight_color", - OPERATION_HIGHLIGHT_COLOR()); + aColor = ModuleBase_Tools::color("Visualization", "operation_highlight_color"); break; default: break;