diff --git a/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp b/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp index ea179d8be..828760935 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherValidation.cpp @@ -36,9 +36,16 @@ # include #endif +#include +#include #include #include +#include +#include #include +#include +#include +#include #include #include "ui_TaskSketcherValidation.h" @@ -318,6 +325,28 @@ void SketcherValidation::on_fixButton_clicked() doc->recompute(); } +void SketcherValidation::on_highlightButton_clicked() +{ + std::vector points; + TopoDS_Shape shape = sketch->Shape.getValue(); + + // build up map vertex->edge + TopTools_IndexedDataMapOfShapeListOfShape vertex2Edge; + TopExp::MapShapesAndAncestors(shape, TopAbs_VERTEX, TopAbs_EDGE, vertex2Edge); + for (int i=1; i<= vertex2Edge.Extent(); ++i) { + const TopTools_ListOfShape& los = vertex2Edge.FindFromIndex(i); + if (los.Extent() != 2) { + const TopoDS_Vertex& vertex = TopoDS::Vertex(vertex2Edge.FindKey(i)); + gp_Pnt pnt = BRep_Tool::Pnt(vertex); + points.push_back(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z())); + } + } + + hidePoints(); + if (!points.empty()) + showPoints(points); +} + void SketcherValidation::on_findConstraint_clicked() { if (sketch->evaluateConstraints()) { diff --git a/src/Mod/Sketcher/Gui/TaskSketcherValidation.h b/src/Mod/Sketcher/Gui/TaskSketcherValidation.h index aad1f06a1..887e7b39e 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherValidation.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherValidation.h @@ -49,6 +49,7 @@ protected: private Q_SLOTS: void on_findButton_clicked(); void on_fixButton_clicked(); + void on_highlightButton_clicked(); void on_findConstraint_clicked(); void on_fixConstraint_clicked(); void on_findReversed_clicked(); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherValidation.ui b/src/Mod/Sketcher/Gui/TaskSketcherValidation.ui index a303939b1..3a4f01be8 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherValidation.ui +++ b/src/Mod/Sketcher/Gui/TaskSketcherValidation.ui @@ -57,6 +57,13 @@ + + + + Fix + + + @@ -67,10 +74,10 @@ - - + + - Fix + Highlight open vertexes