From: nds Date: Fri, 15 Jan 2016 15:58:34 +0000 (+0300) Subject: Imrove multi-selector control to provide items multi-selection. Preferences color... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0f243a04c8b1df591df4c1197b8825db194d1fc7;p=modules%2Fshaper.git Imrove multi-selector control to provide items multi-selection. Preferences color should be applyed by the next presentations visualization. --- diff --git a/src/PartSet/PartSet_CustomPrs.cpp b/src/PartSet/PartSet_CustomPrs.cpp index a449d8da6..b466171c3 100755 --- a/src/PartSet/PartSet_CustomPrs.cpp +++ b/src/PartSet/PartSet_CustomPrs.cpp @@ -88,6 +88,11 @@ bool PartSet_CustomPrs::displayPresentation(const ModuleBase_IModule::ModuleBase Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull() && !aContext->IsDisplayed(anOperationPrs)) { if (anOperationPrs->hasShapes()) { + // set color here because it can be changed in preferences + Quantity_Color aShapeColor, aResultColor; + getAISColors(theFlag, aShapeColor, aResultColor); + anOperationPrs->setColors(aShapeColor, aResultColor); + PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); XGUI_Workshop* aWorkshop = workshop(); aWorkshop->displayer()->displayAIS(myPresentations[theFlag], false/*load object in selection*/, @@ -162,23 +167,10 @@ void PartSet_CustomPrs::initPresentation(const ModuleBase_IModule::ModuleBase_Cu Handle(PartSet_OperationPrs) anAISPrs = new PartSet_OperationPrs(myWorkshop); anOperationPrs->setImpl(new Handle(AIS_InteractiveObject)(anAISPrs)); if (theFlag == ModuleBase_IModule::CustomizeDependedAndResults) { - Quantity_Color aShapeColor = ModuleBase_Tools::color("Visualization", "operation_parameter_color", - OPERATION_PARAMETER_COLOR()); - Quantity_Color aResultColor = ModuleBase_Tools::color("Visualization", "operation_result_color", - OPERATION_RESULT_COLOR()); - anAISPrs->setColors(aShapeColor, aResultColor); - anOperationPrs->setPointMarker(5, 2.); anOperationPrs->setWidth(1); } else if (theFlag == ModuleBase_IModule::CustomizeHighlightedObjects) { - Quantity_Color aShapeColor = ModuleBase_Tools::color("Visualization", "operation_highlight_color", - OPERATION_HIGHLIGHT_COLOR()); - Quantity_Color aResultColor = ModuleBase_Tools::color("Visualization", "operation_result_color", - OPERATION_RESULT_COLOR()); - anAISPrs->setColors(aShapeColor, aResultColor); - //in this presentation we show the shapes wireframe similar to their highlight by OCCT - //so, we need to use the source AIS object width for the presentation width anAISPrs->useAISWidth(); } @@ -186,6 +178,23 @@ void PartSet_CustomPrs::initPresentation(const ModuleBase_IModule::ModuleBase_Cu myPresentations[theFlag] = anOperationPrs; } +void PartSet_CustomPrs::getAISColors(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + Quantity_Color& theShapeColor, Quantity_Color& theResultColor) +{ + if (theFlag == ModuleBase_IModule::CustomizeDependedAndResults) { + theShapeColor = ModuleBase_Tools::color("Visualization", "operation_parameter_color", + OPERATION_PARAMETER_COLOR()); + theResultColor = ModuleBase_Tools::color("Visualization", "operation_result_color", + OPERATION_RESULT_COLOR()); + } + else if (theFlag == ModuleBase_IModule::CustomizeHighlightedObjects) { + theShapeColor = ModuleBase_Tools::color("Visualization", "operation_highlight_color", + OPERATION_HIGHLIGHT_COLOR()); + theResultColor = ModuleBase_Tools::color("Visualization", "operation_result_color", + OPERATION_RESULT_COLOR()); + } +} + XGUI_Workshop* PartSet_CustomPrs::workshop() const { XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); diff --git a/src/PartSet/PartSet_CustomPrs.h b/src/PartSet/PartSet_CustomPrs.h index b235e19c0..1785818b9 100755 --- a/src/PartSet/PartSet_CustomPrs.h +++ b/src/PartSet/PartSet_CustomPrs.h @@ -103,8 +103,16 @@ private: /// Nullify the operation presentation. For example, it can be useful when the viewer/context /// is closed. If this is not performed and the presentation is assigned in another context, /// it caused erroneus case because the presentation has linkage to the previous context. + /// \param theFlag an object AIS presentation type void clearPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag); + /// Returns presentation colors according to the flag + /// \param theFlag an object AIS presentation type + /// \param theShapeColor a color for shapes + /// \param theShapeColor a color for results + void getAISColors(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + Quantity_Color& theShapeColor, Quantity_Color& theResultColor); + private: bool myIsActive; ModuleBase_IWorkshop* myWorkshop; /// current workshop