]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Change color for construction/body/group.
authornds <natalia.donis@opencascade.com>
Wed, 11 Mar 2015 15:36:52 +0000 (18:36 +0300)
committernds <natalia.donis@opencascade.com>
Wed, 11 Mar 2015 15:36:52 +0000 (18:36 +0300)
The custom presentation using to change the arc's AIS preview object.

src/SketchPlugin/SketchPlugin_SketchEntity.h
src/XGUI/XGUI_Displayer.cpp

index 11bc85e620fe2ddf2bdbc75f48720f82e8599829..b1b74b519c9d9824dcc1b37009784a17070139a2 100644 (file)
@@ -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<int> aColor;
     std::shared_ptr<ModelAPI_AttributeBoolean> 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;
index 1acdc22eafcc5a97440dfde8ae33ba561e3e7e73..7d4ae0012ba5db8b645726cedd4d3cc806ac92e1 100644 (file)
@@ -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<GeomAPI_IPresentable>(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<ModelAPI_Result>(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<GeomAPI_ICustomPrs>(aFeature);
     if (aCustPrs.get() != NULL)
       aCustomPrs = aCustPrs;
   }
+  if (aCustomPrs.get() == NULL) {
+    // we ignore presentable not customized objects
+    GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
+    if (aPrs.get() != NULL)
+      return false;
+    aCustomPrs = myCustomPrs;
+  }
   return aCustomPrs->customisePresentation(aResult, anAISObj, myCustomPrs);
 }