]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #351 - constraint is not applied on preselected segments
authornds <natalia.donis@opencascade.com>
Tue, 30 Dec 2014 11:34:30 +0000 (14:34 +0300)
committernds <natalia.donis@opencascade.com>
Tue, 30 Dec 2014 11:34:30 +0000 (14:34 +0300)
src/GeomAPI/GeomAPI_Edge.cpp
src/GeomAPI/GeomAPI_Edge.h
src/GeomAPI/GeomAPI_Vertex.cpp
src/GeomAPI/GeomAPI_Vertex.h
src/XGUI/XGUI_Displayer.cpp

index 06c733f3baa888eb9662eedf0fc27baa2cc549be..759b0b323cb2c90205d2fef862abfe9c3fbc9c97 100644 (file)
@@ -100,7 +100,7 @@ std::shared_ptr<GeomAPI_Circ> GeomAPI_Edge::circle()
 }
 
 
-bool GeomAPI_Edge::isEqual(std::shared_ptr<GeomAPI_Shape> theEdge)
+bool GeomAPI_Edge::isEqual(const std::shared_ptr<GeomAPI_Shape> theEdge) const
 {
   const TopoDS_Shape& aMyShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
   const TopoDS_Shape& aInShape = theEdge->impl<TopoDS_Shape>();
index 53552262983695efa0144176558bc02e86ceb647..1c4802ecc687b10585a3ea5c8c761bec5c0b3057 100644 (file)
@@ -45,7 +45,7 @@ public:
   std::shared_ptr<GeomAPI_Circ> circle();
 
   /// Returns true if the current edge is geometrically equal to the given edge
-  bool isEqual(std::shared_ptr<GeomAPI_Shape> theEdge);
+  bool isEqual(const std::shared_ptr<GeomAPI_Shape> theEdge) const;
 };
 
 #endif
index 3c9e0a0b23a48f1090be2bed1d1036009e121821..d881d79b5bf0ea0cbbb7106bc0d3507f9aa05384 100644 (file)
@@ -35,7 +35,7 @@ std::shared_ptr<GeomAPI_Pnt> GeomAPI_Vertex::point()
   return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z()));
 }
 
-bool GeomAPI_Vertex::isEqual(std::shared_ptr<GeomAPI_Shape> theVert)
+bool GeomAPI_Vertex::isEqual(const std::shared_ptr<GeomAPI_Shape> theVert) const
 {
   const TopoDS_Shape& aMyShape = const_cast<GeomAPI_Vertex*>(this)->impl<TopoDS_Shape>();
   const TopoDS_Shape& aInShape = theVert->impl<TopoDS_Shape>();
index fab2840b4cb99ff9e91b01d1f899795e84c5f319..3b517a8632a0e61b4a894093058d6eadcfe247c7 100644 (file)
@@ -29,7 +29,7 @@ public:
   std::shared_ptr<GeomAPI_Pnt> point();
 
   /// Returns true if the current edge is geometrically equal to the given edge
-  bool isEqual(std::shared_ptr<GeomAPI_Shape> theVert);
+  bool isEqual(const std::shared_ptr<GeomAPI_Shape> theVert) const;
 };
 
 #endif
index 22b76ad2eafae3bb03d009aaf614b84982cedaba..45980ee6270402dec376e5fe227ce6858cb46017 100644 (file)
@@ -208,6 +208,23 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
     Handle(AIS_InteractiveContext) aContext = AISContext();
     if (aContext.IsNull())
       return;
+    // Check that the visualized shape is the same and the redisplay is not necessary
+    // Redisplay of AIS object leads to this object selection compute and the selection 
+    // in the browser is lost
+    // become
+    ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+    if (aResult.get() != NULL) {
+      Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aAISIO);
+      if (!aShapePrs.IsNull()) {
+        std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
+        const TopoDS_Shape& aShape = aShapePrs->Shape();
+        std::shared_ptr<GeomAPI_Shape> anAISShapePtr(new GeomAPI_Shape());
+        anAISShapePtr->setImpl(new TopoDS_Shape(aShape));
+
+        if (aShapePtr->isEqual(anAISShapePtr))
+          return;
+      }
+    }
     aContext->Redisplay(aAISIO, false);
     if (isUpdateViewer)
       updateViewer();