diff --git a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h index 4c445d3c4f..bff79da439 100644 --- a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h +++ b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h @@ -76,9 +76,10 @@ struct DrawingParameters const float zConstr = 0.009f; // Height for rendering constraints const float zRootPoint = 0.010f; // Height used for rendering the root point const float zLowPoints = 0.011f; // Height used for bottom rendered points - const float zHighPoints = 0.012f; // Height used for in-the-middle rendered points - const float zHighlight = 0.013f; // Height for highlighted points (selected/preselected) - const float zText = 0.013f; // Height for rendered text + const float zMidPoints = 0.012f; // Height used for mid rendered points + const float zHighPoints = 0.013f; // Height used for top rendered points + const float zHighlight = 0.014f; // Height for highlighted points (selected/preselected) + const float zText = 0.014f; // Height for rendered text //@} /// Different categories of geometries that can be selected by the user to be rendered on top, diff --git a/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp b/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp index afcf6f5100..982600b8c3 100644 --- a/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp +++ b/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp @@ -134,6 +134,21 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade& geoli return false; }; + auto isCoincident = [&](int GeoId, Sketcher::PointPos PosId) { + const std::vector& constraints = + ViewProviderSketchCoinAttorney::getConstraints(viewProvider); + for (auto& constr : constraints) { + if (constr->Type == Coincident + || (constr->Type == Tangent && constr->FirstPos != Sketcher::PointPos::none)) { + if ((constr->First == GeoId && constr->FirstPos == PosId) + || (constr->Second == GeoId && constr->SecondPos == PosId)) { + return true; + } + } + } + return false; + }; + auto isInternalAlignedGeom = [&geolistfacade](int GeoId) { auto geom = geolistfacade.getGeometryFacadeFromGeoId(GeoId); if (geom) { @@ -174,44 +189,63 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade& geoli SbVec3f* pverts = editModeScenegraphNodes.PointsCoordinate[l]->point.startEditing(); // colors of the point set - if (issketchinvalid) { - for (int i = 0; i < PtNum; i++) { - pcolor[i] = drawingParameters.InvalidSketchColor; - } - } - else { + for (int i = 0; i < PtNum; i++) { + int GeoId = coinMapping.getPointGeoId(i, l); + Sketcher::PointPos PosId = coinMapping.getPointPosId(i, l); + bool isExternal = GeoId < -1; - for (int i = 0; i < PtNum; i++) { - if (!(i == 0 && l == 0) && sketchFullyConstrained) { // root point is not coloured - pcolor[i] = drawingParameters.FullyConstrainedColor; + if (isExternal) { + if (isCoincident(GeoId, PosId) && !issketchinvalid) { + pcolor[i] = drawingParameters.ConstrIcoColor; } else { - int GeoId = coinMapping.getPointGeoId(i, l); - Sketcher::PointPos PosId = coinMapping.getPointPosId(i, l); + pcolor[i] = drawingParameters.CurveExternalColor; + } + } + else if (issketchinvalid) { + pcolor[i] = drawingParameters.InvalidSketchColor; + } + else if (!(i == 0 && l == 0) && sketchFullyConstrained) { + // root point is not coloured nor external + pcolor[i] = drawingParameters.FullyConstrainedColor; + } + else { + bool constrainedElement = isFullyConstraintElement(GeoId); - bool constrainedElement = isFullyConstraintElement(GeoId); - - if (isInternalAlignedGeom(GeoId)) { - if (constrainedElement) { - pcolor[i] = drawingParameters.FullyConstraintInternalAlignmentColor; + if (isInternalAlignedGeom(GeoId)) { + if (constrainedElement) { + pcolor[i] = drawingParameters.FullyConstraintInternalAlignmentColor; + } + else { + if (isCoincident(GeoId, PosId)) { + pcolor[i] = drawingParameters.ConstrIcoColor; } else { pcolor[i] = drawingParameters.InternalAlignedGeoColor; } } - else { - if (!isDefinedGeomPoint(GeoId, PosId)) { - if (constrainedElement) { - pcolor[i] = - drawingParameters.FullyConstraintConstructionElementColor; + } + else { + if (!isDefinedGeomPoint(GeoId, PosId)) { + if (constrainedElement) { + pcolor[i] = drawingParameters.FullyConstraintConstructionElementColor; + } + else { + if (isCoincident(GeoId, PosId)) { + pcolor[i] = drawingParameters.ConstrIcoColor; } else { pcolor[i] = drawingParameters.CurveDraftColor; } } - else { // this is a defined GeomPoint - if (constrainedElement) { - pcolor[i] = drawingParameters.FullyConstraintElementColor; + } + else { // this is a defined GeomPoint + if (constrainedElement) { + pcolor[i] = drawingParameters.FullyConstraintElementColor; + } + else { + if (isCoincident(GeoId, PosId)) { + pcolor[i] = drawingParameters.ConstrIcoColor; } else { pcolor[i] = drawingParameters.CurveColor; @@ -241,30 +275,40 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade& geoli float zNormPoint = getRenderHeight(DrawingParameters::GeometryRendering::NormalGeometry, drawingParameters.zHighPoints, - drawingParameters.zLowPoints, - drawingParameters.zLowPoints); + drawingParameters.zMidPoints, + drawingParameters.zMidPoints); float zConstrPoint = getRenderHeight(DrawingParameters::GeometryRendering::Construction, drawingParameters.zHighPoints, - drawingParameters.zLowPoints, - drawingParameters.zLowPoints); + drawingParameters.zMidPoints, + drawingParameters.zMidPoints); for (int i = 0; i < PtNum; i++) { // 0 is the origin if (i == 0 && l == 0) { // reset root point to lowest pverts[i].setValue(0, 0, viewOrientationFactor * drawingParameters.zRootPoint); } else { + int GeoId = coinMapping.getPointGeoId(i, l); + Sketcher::PointPos PosId = coinMapping.getPointPosId(i, l); pverts[i].getValue(x, y, z); - auto geom = - geolistfacade.getGeometryFacadeFromGeoId(coinMapping.getPointGeoId(i, l)); + auto geom = geolistfacade.getGeometryFacadeFromGeoId(GeoId); + bool isExternal = GeoId < -1; if (geom) { - if (geom->getConstruction()) { - pverts[i].setValue(x, y, viewOrientationFactor * zConstrPoint); + z = viewOrientationFactor * zNormPoint; + + if (isCoincident(GeoId, PosId)) { + z = viewOrientationFactor * drawingParameters.zLowPoints; } else { - pverts[i].setValue(x, y, viewOrientationFactor * zNormPoint); + if (isExternal) { + z = viewOrientationFactor * drawingParameters.zRootPoint; + } + else if (geom->getConstruction()) { + z = viewOrientationFactor * zConstrPoint; + } } + pverts[i].setValue(x, y, z); } } }