From: nds Date: Wed, 11 Mar 2015 15:36:52 +0000 (+0300) Subject: Change color for construction/body/group. X-Git-Tag: V_1.1.0~143^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=761a8a239096a9b803d2143e814a57fbff081b94;p=modules%2Fshaper.git Change color for construction/body/group. The custom presentation using to change the arc's AIS preview object. --- 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); }