From: dbv Date: Tue, 28 Mar 2017 08:16:51 +0000 (+0300) Subject: Issue #2024: Redesign of circle and arc of circle X-Git-Tag: V_2.7.0~168 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3fec0e5ea40ca705c686197789a815d4a3364b20;p=modules%2Fshaper.git Issue #2024: Redesign of circle and arc of circle Removed redundant method. --- diff --git a/src/GeomAPI/GeomAPI_Shape.cpp b/src/GeomAPI/GeomAPI_Shape.cpp index b8c32ec28..c811116df 100644 --- a/src/GeomAPI/GeomAPI_Shape.cpp +++ b/src/GeomAPI/GeomAPI_Shape.cpp @@ -444,8 +444,11 @@ GeomShapePtr GeomAPI_Shape::intersect(const GeomShapePtr theShape) const if (aResult.ShapeType() == TopAbs_COMPOUND) { NCollection_List 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); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index cf3ab9623..1df2c7f87 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -648,27 +648,6 @@ bool GeomAlgoAPI_ShapeTools::isSubShapeInsideShape( return true; } -//================================================================================================== -bool GeomAlgoAPI_ShapeTools::isShapesIntersects( - const std::shared_ptr theShape1, - const std::shared_ptr theShape2) -{ - if(!theShape1.get() || !theShape2.get()) { - return false; - } - - const TopoDS_Shape& aShape1 = theShape1->impl(); - const TopoDS_Shape& aShape2 = theShape2->impl(); - - 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 theShape) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h index e6df0520b..d3b712585 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h @@ -108,14 +108,6 @@ public: const std::shared_ptr theSubShape, const std::shared_ptr 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 theShape1, - const std::shared_ptr theShape2); - /// \return true if theShape is valid. GEOMALGOAPI_EXPORT static bool isShapeValid(const std::shared_ptr theShape); diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index 6683c906f..7dadf303c 100755 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -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; } } diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index ec0ed9521..46bc7cc98 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -195,7 +195,7 @@ title="Arc" tooltip="Create arc" icon="icons/Sketch/arc.png"> - +