From 44dfe2a816bcc56710381a08dfa513a237f89215 Mon Sep 17 00:00:00 2001 From: Matthias Kuehlewein Date: Thu, 13 Oct 2022 10:48:57 +0200 Subject: [PATCH] LineSymbol: Fix dashed line with mid symbols Dashed lines with mid symbols that are placed in the center of a dash are sometimes disturbed. This commit ensures that the dash is always drawn the same way, independent of whether mid symbols are present or not. Closes GH-2064 (Bezier curve around mid symbol of dashed line). --- src/core/symbols/line_symbol.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/core/symbols/line_symbol.cpp b/src/core/symbols/line_symbol.cpp index 1e50418e0..9e5a88976 100644 --- a/src/core/symbols/line_symbol.cpp +++ b/src/core/symbols/line_symbol.cpp @@ -1,6 +1,6 @@ /* * Copyright 2012, 2013 Thomas Schöps - * Copyright 2012-2020 Kai Pastor + * Copyright 2012-2020, 2024 Kai Pastor * * This file is part of OpenOrienteering. * @@ -803,23 +803,19 @@ void LineSymbol::processContinuousLine( { auto mid_position = (split.clen + effective_end_length - mid_symbols_length) / 2; auto next_split = SplitPathCoord::at(mid_position, split); - path.copy(split, next_split, processed_flags, processed_coords); - split = next_split; auto orientation = qreal(0); - bool mid_symbol_rotatable = bool(mid_symbol) && mid_symbol->isRotatable(); + const auto mid_symbol_rotatable = mid_symbol->isRotatable(); for (auto i = mid_symbols_per_spot; i > 0; --i) { if (mid_symbol_rotatable) - orientation = split.tangentVector().angle(); - mid_symbol->createRenderablesScaled(split.pos, orientation, output); + orientation = next_split.tangentVector().angle(); + mid_symbol->createRenderablesScaled(next_split.pos, orientation, output); if (i > 1) { mid_position += mid_symbol_distance_f; - next_split = SplitPathCoord::at(mid_position, split); - path.copy(split, next_split, processed_flags, processed_coords); - split = next_split; + next_split = SplitPathCoord::at(mid_position, next_split); } } } @@ -1201,7 +1197,7 @@ SplitPathCoord LineSymbol::createDashGroups( bool is_first_dash = is_first_dashgroup && dash == 1; bool is_last_dash = is_last_dashgroup && dash == dashes_in_group; - // The dash has an start if it is not the first dash in a half first group. + // The dash has a start if it is not the first dash in a half first group. bool has_start = !(is_first_dash && half_first_group); // The dash has an end if it is not the last dash in a half last group. bool has_end = !(is_last_dash && half_last_group);