From 761a8a239096a9b803d2143e814a57fbff081b94 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 11 Mar 2015 18:36:52 +0300 Subject: [PATCH] Change color for construction/body/group. The custom presentation using to change the arc's AIS preview object. --- src/SketchPlugin/SketchPlugin_SketchEntity.h | 5 +++-- src/XGUI/XGUI_Displayer.cpp | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_SketchEntity.h b/src/SketchPlugin/SketchPlugin_SketchEntity.h index 11bc85e62..b1b74b519 100644 --- a/src/SketchPlugin/SketchPlugin_SketchEntity.h +++ b/src/SketchPlugin/SketchPlugin_SketchEntity.h @@ -65,14 +65,15 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature, public GeomAPI_IC { bool isCustomized = false; int aShapeType = thePrs->getShapeType(); - if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/) + // a compound is processed like the edge because the arc feature uses the compound for presentable AIS + if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/ && aShapeType != 0/*compound*/) return false; std::vector aColor; std::shared_ptr aConstructionAttr = data()->boolean(SketchPlugin_SketchEntity::CONSTRUCTION_ID()); bool isConstruction = aConstructionAttr.get() != NULL && aConstructionAttr->value(); - if (aShapeType == 6) { // if this is an edge + if (aShapeType == 6 || aShapeType == 0) { // if this is an edge or a compound if (isConstruction) { isCustomized = thePrs->setWidth(1) || isCustomized; isCustomized = thePrs->setLineStyle(3) || isCustomized; diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 1acdc22ea..7d4ae0012 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -766,22 +766,24 @@ void XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO, bool XGUI_Displayer::customizeObject(ObjectPtr theObject) { - // we need not customize presentable objects - GeomPresentablePtr aPrs = std::dynamic_pointer_cast(theObject); - if (aPrs.get() != NULL) - return false; - AISObjectPtr anAISObj = getAISObject(theObject); // correct the result's color it it has the attribute ResultPtr aResult = std::dynamic_pointer_cast(theObject); // Customization of presentation - GeomCustomPrsPtr aCustomPrs = myCustomPrs; + GeomCustomPrsPtr aCustomPrs; FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature.get() != NULL) { GeomCustomPrsPtr aCustPrs = std::dynamic_pointer_cast(aFeature); if (aCustPrs.get() != NULL) aCustomPrs = aCustPrs; } + if (aCustomPrs.get() == NULL) { + // we ignore presentable not customized objects + GeomPresentablePtr aPrs = std::dynamic_pointer_cast(theObject); + if (aPrs.get() != NULL) + return false; + aCustomPrs = myCustomPrs; + } return aCustomPrs->customisePresentation(aResult, anAISObj, myCustomPrs); } -- 2.39.2