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<PartSet_Module*>(myWorkshop->module());
XGUI_Workshop* aWorkshop = workshop();
aWorkshop->displayer()->displayAIS(myPresentations[theFlag], false/*load object in selection*/,
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();
}
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<XGUI_ModuleConnector*>(myWorkshop);
/// 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