Salome HOME
Issue #2199 Import of edges participating to the result of the sketch. Set Z layer...
authornds <nds@opencascade.com>
Fri, 17 Nov 2017 08:51:55 +0000 (11:51 +0300)
committernds <nds@opencascade.com>
Fri, 17 Nov 2017 08:51:55 +0000 (11:51 +0300)
src/PartSet/PartSet_Module.cpp

index 3f3c23bd529f361936a65df367ce3d94088b8c1c..57d9fc6b7556b3eb5eacd53e29ab1f6f85d77c06 100755 (executable)
 #include <XGUI_SelectionMgr.h>
 #include <XGUI_ActionsMgr.h>
 
-#include <SketchPlugin_Feature.h>
-#include <SketchPlugin_Sketch.h>
 #include <SketchPlugin_ConstraintAngle.h>
 #include <SketchPlugin_ConstraintLength.h>
 #include <SketchPlugin_ConstraintDistance.h>
 #include <SketchPlugin_ConstraintParallel.h>
 #include <SketchPlugin_ConstraintPerpendicular.h>
 #include <SketchPlugin_ConstraintRadius.h>
+#include <SketchPlugin_Feature.h>
+#include <SketchPlugin_Projection.h>
+#include <SketchPlugin_Sketch.h>
 
 #include <SketcherPrs_SymbolPrs.h>
 #include <SketcherPrs_Coincident.h>
@@ -934,15 +935,21 @@ void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS)
 {
   Handle(AIS_InteractiveObject) anAIS = theAIS->impl<Handle(AIS_InteractiveObject)>();
   if (!anAIS.IsNull()) {
+    bool aToUseZLayer = false;
+    FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+    if (aFeature.get() && PartSet_Tools::findRefsToMeFeature(aFeature,
+                                                        SketchPlugin_Projection::ID()))
+      aToUseZLayer = true;
     Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
     Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAIS);
     if (!aDim.IsNull()) {
-      aCtx->SetZLayer(aDim, myVisualLayerId);
+      aToUseZLayer = true;
     } else {
       Handle(SketcherPrs_SymbolPrs) aCons = Handle(SketcherPrs_SymbolPrs)::DownCast(anAIS);
       if (!aCons.IsNull())
-        aCtx->SetZLayer(aCons, myVisualLayerId);
+      aToUseZLayer = true;
     }
+    aCtx->SetZLayer(anAIS, myVisualLayerId);
   }
 }