Salome HOME
Issue #2024: Redesign of circle and arc of circle
authordbv <dbv@opencascade.com>
Tue, 28 Mar 2017 08:16:51 +0000 (11:16 +0300)
committerdbv <dbv@opencascade.com>
Tue, 28 Mar 2017 08:17:05 +0000 (11:17 +0300)
Removed redundant method.

src/GeomAPI/GeomAPI_Shape.cpp
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h
src/SketchPlugin/SketchPlugin_Validators.cpp
src/SketchPlugin/plugin-Sketch.xml

index b8c32ec2867a16c9b1e28ef83be64607b363c12c..c811116dff5529eb7b96243b3eecbd07d05bdf2d 100644 (file)
@@ -444,8 +444,11 @@ GeomShapePtr GeomAPI_Shape::intersect(const GeomShapePtr theShape) const
   if (aResult.ShapeType() == TopAbs_COMPOUND) {
     NCollection_List<TopoDS_Shape> aSubs;
     addSimpleToList(aResult, aSubs);
-    if (aSubs.Size() == 1)
+    if(aSubs.Size() == 1) {
       aResult = aSubs.First();
+    } else if(aSubs.Size() == 0) {
+      return GeomShapePtr();
+    }
   }
 
   GeomShapePtr aResShape(new GeomAPI_Shape);
index cf3ab9623ab8d0a94497b6c1c3cd7b9f963551b2..1df2c7f8745f37b64881a809f7885f922452a77e 100644 (file)
@@ -648,27 +648,6 @@ bool GeomAlgoAPI_ShapeTools::isSubShapeInsideShape(
   return true;
 }
 
-//==================================================================================================
-bool GeomAlgoAPI_ShapeTools::isShapesIntersects(
-  const std::shared_ptr<GeomAPI_Shape> theShape1,
-  const std::shared_ptr<GeomAPI_Shape> theShape2)
-{
-  if(!theShape1.get() || !theShape2.get()) {
-    return false;
-  }
-
-  const TopoDS_Shape& aShape1 = theShape1->impl<TopoDS_Shape>();
-  const TopoDS_Shape& aShape2 = theShape2->impl<TopoDS_Shape>();
-
-  BRepExtrema_DistShapeShape aDist(aShape1, aShape2);
-  aDist.Perform();
-  if(aDist.IsDone() && aDist.Value() < Precision::Confusion()) {
-    return true;
-  }
-
-  return false;
-}
-
 //==================================================================================================
 bool GeomAlgoAPI_ShapeTools::isShapeValid(const std::shared_ptr<GeomAPI_Shape> theShape)
 {
index e6df0520b50345f4cf85c1137641a4ec966f9044..d3b712585176a24a8e7316e42611d48153ebf8ba 100644 (file)
@@ -108,14 +108,6 @@ public:
     const std::shared_ptr<GeomAPI_Shape> theSubShape,
     const std::shared_ptr<GeomAPI_Shape> theBaseShape);
 
-  /// \brief Checks that shapes intersects.
-  /// \param[in] theShape1 first shape.
-  /// \param[in] theShape2 second shape.
-  /// \return true if shapes intersects.
-  GEOMALGOAPI_EXPORT static bool GeomAlgoAPI_ShapeTools::isShapesIntersects(
-    const std::shared_ptr<GeomAPI_Shape> theShape1,
-    const std::shared_ptr<GeomAPI_Shape> theShape2);
-
   /// \return true if theShape is valid.
   GEOMALGOAPI_EXPORT static bool isShapeValid(const std::shared_ptr<GeomAPI_Shape> theShape);
 
index 6683c906f8606418ddedbcba9616a6075f1741f6..7dadf303c8c9c48b07a3cc52dd48b09cfa7ae326 100755 (executable)
@@ -1350,7 +1350,10 @@ bool SketchPlugin_ArcEndPointIntersectionValidator::isValid(
   if(aResult.get()) {
     GeomShapePtr aShape = aResult->shape();
     if(aShape.get() && !aShape->isNull()) {
-      return GeomAlgoAPI_ShapeTools::isShapesIntersects(anArcShape, aShape);
+      GeomShapePtr anIntersection = anArcShape->intersect(aShape);
+      if(anIntersection.get() && !anIntersection->isNull()) {
+        return true;
+      }
     }
   }
 
@@ -1363,7 +1366,8 @@ bool SketchPlugin_ArcEndPointIntersectionValidator::isValid(
     {
       GeomShapePtr aShape = (*anIt)->shape();
       if(aShape.get() && !aShape->isNull()) {
-        if(GeomAlgoAPI_ShapeTools::isShapesIntersects(anArcShape, aShape)) {
+        GeomShapePtr anIntersection = anArcShape->intersect(aShape);
+        if(anIntersection.get() && !anIntersection->isNull()) {
           return true;
         }
       }
index ec0ed952117a6fc6e7a84d7651b2e42acb5042a7..46bc7cc98ec7cd421a7fda28348c2c7e8947e068 100644 (file)
         title="Arc"
         tooltip="Create arc"
         icon="icons/Sketch/arc.png">
-        <toolbox id="arc_type">
+        <toolbox id="arc_type" modified_in_edit="false">
           <box id="by_center_and_points"
                icon="icons/Sketch/arc_base_32x32.png"
                title="Center and two points">