From: nds Date: Tue, 30 Dec 2014 11:34:30 +0000 (+0300) Subject: Issue #351 - constraint is not applied on preselected segments X-Git-Tag: V_0.7.0_rc1~6^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d072a47c905f8d4a96704ed67cad5dd334d6117c;p=modules%2Fshaper.git Issue #351 - constraint is not applied on preselected segments --- diff --git a/src/GeomAPI/GeomAPI_Edge.cpp b/src/GeomAPI/GeomAPI_Edge.cpp index 06c733f3b..759b0b323 100644 --- a/src/GeomAPI/GeomAPI_Edge.cpp +++ b/src/GeomAPI/GeomAPI_Edge.cpp @@ -100,7 +100,7 @@ std::shared_ptr GeomAPI_Edge::circle() } -bool GeomAPI_Edge::isEqual(std::shared_ptr theEdge) +bool GeomAPI_Edge::isEqual(const std::shared_ptr theEdge) const { const TopoDS_Shape& aMyShape = const_cast(this)->impl(); const TopoDS_Shape& aInShape = theEdge->impl(); diff --git a/src/GeomAPI/GeomAPI_Edge.h b/src/GeomAPI/GeomAPI_Edge.h index 535522629..1c4802ecc 100644 --- a/src/GeomAPI/GeomAPI_Edge.h +++ b/src/GeomAPI/GeomAPI_Edge.h @@ -45,7 +45,7 @@ public: std::shared_ptr circle(); /// Returns true if the current edge is geometrically equal to the given edge - bool isEqual(std::shared_ptr theEdge); + bool isEqual(const std::shared_ptr theEdge) const; }; #endif diff --git a/src/GeomAPI/GeomAPI_Vertex.cpp b/src/GeomAPI/GeomAPI_Vertex.cpp index 3c9e0a0b2..d881d79b5 100644 --- a/src/GeomAPI/GeomAPI_Vertex.cpp +++ b/src/GeomAPI/GeomAPI_Vertex.cpp @@ -35,7 +35,7 @@ std::shared_ptr GeomAPI_Vertex::point() return std::shared_ptr(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); } -bool GeomAPI_Vertex::isEqual(std::shared_ptr theVert) +bool GeomAPI_Vertex::isEqual(const std::shared_ptr theVert) const { const TopoDS_Shape& aMyShape = const_cast(this)->impl(); const TopoDS_Shape& aInShape = theVert->impl(); diff --git a/src/GeomAPI/GeomAPI_Vertex.h b/src/GeomAPI/GeomAPI_Vertex.h index fab2840b4..3b517a863 100644 --- a/src/GeomAPI/GeomAPI_Vertex.h +++ b/src/GeomAPI/GeomAPI_Vertex.h @@ -29,7 +29,7 @@ public: std::shared_ptr point(); /// Returns true if the current edge is geometrically equal to the given edge - bool isEqual(std::shared_ptr theVert); + bool isEqual(const std::shared_ptr theVert) const; }; #endif diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 22b76ad2e..45980ee62 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -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(theObject); + if (aResult.get() != NULL) { + Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aAISIO); + if (!aShapePrs.IsNull()) { + std::shared_ptr aShapePtr = ModelAPI_Tools::shape(aResult); + const TopoDS_Shape& aShape = aShapePrs->Shape(); + std::shared_ptr anAISShapePtr(new GeomAPI_Shape()); + anAISShapePtr->setImpl(new TopoDS_Shape(aShape)); + + if (aShapePtr->isEqual(anAISShapePtr)) + return; + } + } aContext->Redisplay(aAISIO, false); if (isUpdateViewer) updateViewer();