Salome HOME
Issue #351 constraint is not applied on preselected segments
authornds <natalia.donis@opencascade.com>
Tue, 20 Jan 2015 14:54:42 +0000 (17:54 +0300)
committernds <natalia.donis@opencascade.com>
Tue, 20 Jan 2015 14:54:42 +0000 (17:54 +0300)
The reason: lost selection of the circle center.
The decision: do not perform redisplay the AIS presentation in the AIS_InteractiveContext(displayer) if the shapes are equal. Here the GeomAPI realisation is necessary. The TopoDS_Shape realisation of the isEqual method is not enough because different TShapes instances are created and isEqual returns false.
A correction in the widget shape selector to avoid the distance presentation update by set an object(before set an attribute). In the previous version, the distance was jumped by selecting two points on lines. The reason is the distance calculation between point-object by setObject and after that point-point by setAttr

src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp
src/PartSet/PartSet_WidgetShapeSelector.cpp

index f57605c8c4fe2ee37f078ab46f0ea545f8d7d5e5..096dc4a96bc01d45798762380b297aa7325a315d 100644 (file)
@@ -7,6 +7,7 @@
 #include <GeomAlgoAPI_PointBuilder.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Shape.h>
+#include <GeomAPI_Vertex.h>
 #include <BRepBuilderAPI_MakeVertex.hxx>
 #include <BRep_Tool.hxx>
 #include <TopoDS_Vertex.hxx>
@@ -19,7 +20,7 @@ std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_PointBuilder::point(
   const gp_Pnt& aPnt = thePoint->impl<gp_Pnt>();
   BRepBuilderAPI_MakeVertex aMaker(aPnt);
   TopoDS_Vertex aVertex = aMaker.Vertex();
-  std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+  std::shared_ptr<GeomAPI_Vertex> aRes(new GeomAPI_Vertex);
   aRes->setImpl(new TopoDS_Shape(aVertex));
   return aRes;
 }
index bd9a98be5be667b2989e0bb8cb8b7df8fc45127d..c8b8112fe01861ca9a96892992587c117ffc3d8d 100644 (file)
@@ -40,11 +40,10 @@ bool PartSet_WidgetShapeSelector::storeValue() const
       if (aRefAttr) {
         TopoDS_Shape aShape = myShape->impl<TopoDS_Shape>();
         AttributePtr aPntAttr = PartSet_Tools::findAttributeBy2dPoint(mySelectedObject, aShape, mySketch);
-        if (mySelectedObject)
-          aRefAttr->setObject(mySelectedObject);
         if (aPntAttr)
           aRefAttr->setAttr(aPntAttr);
-
+        else if (mySelectedObject)
+          aRefAttr->setObject(mySelectedObject);
         updateObject(myFeature);
         return true;
       }