|
1 | 1 | /* |
2 | 2 | * Copyright 2012, 2013 Thomas Schöps |
3 | | - * Copyright 2012-2020 Kai Pastor |
| 3 | + * Copyright 2012-2020, 2024, 2025 Kai Pastor |
4 | 4 | * |
5 | 5 | * This file is part of OpenOrienteering. |
6 | 6 | * |
@@ -792,42 +792,35 @@ void LineSymbol::processContinuousLine( |
792 | 792 | MapCoordVectorF& processed_coords, |
793 | 793 | ObjectRenderables& output ) const |
794 | 794 | { |
795 | | - auto mid_symbol_distance_f = length_type(0.001) * mid_symbol_distance; |
796 | | - auto mid_symbols_length = (qMax(1, mid_symbols_per_spot) - 1) * mid_symbol_distance_f; |
797 | | - auto effective_end_length = end.clen; |
798 | | - |
799 | | - auto split = start; |
| 795 | + path.copy(start, end, processed_flags, processed_coords); |
| 796 | + processed_flags.back().setGapPoint(true); |
| 797 | + Q_ASSERT(!processed_flags[processed_flags.size()-2].isCurveStart()); |
800 | 798 |
|
801 | 799 | set_mid_symbols = set_mid_symbols && mid_symbol && !mid_symbol->isEmpty() && mid_symbols_per_spot; |
802 | | - if (set_mid_symbols && mid_symbols_length <= effective_end_length - split.clen) |
| 800 | + if (!set_mid_symbols) |
| 801 | + return; |
| 802 | + |
| 803 | + const auto mid_symbol_distance_f = length_type(0.001) * mid_symbol_distance; |
| 804 | + const auto mid_symbols_length = (qMax(1, mid_symbols_per_spot) - 1) * mid_symbol_distance_f; |
| 805 | + if (mid_symbols_length <= end.clen - start.clen) |
803 | 806 | { |
804 | | - auto mid_position = (split.clen + effective_end_length - mid_symbols_length) / 2; |
805 | | - auto next_split = SplitPathCoord::at(mid_position, split); |
806 | | - path.copy(split, next_split, processed_flags, processed_coords); |
807 | | - split = next_split; |
| 807 | + const auto mid_symbol_rotatable = mid_symbol->isRotatable(); |
808 | 808 |
|
| 809 | + auto mid_position = (start.clen + end.clen - mid_symbols_length) / 2; |
| 810 | + auto next_split = SplitPathCoord::at(mid_position, start); |
809 | 811 | auto orientation = qreal(0); |
810 | | - bool mid_symbol_rotatable = bool(mid_symbol) && mid_symbol->isRotatable(); |
811 | | - for (auto i = mid_symbols_per_spot; i > 0; --i) |
| 812 | + if (mid_symbol_rotatable) |
| 813 | + orientation = next_split.tangentVector().angle(); |
| 814 | + mid_symbol->createRenderablesScaled(next_split.pos, orientation, output); |
| 815 | + for (auto i = 2; i <= mid_symbols_per_spot; ++i) |
812 | 816 | { |
| 817 | + mid_position += mid_symbol_distance_f; |
| 818 | + next_split = SplitPathCoord::at(mid_position, next_split); |
813 | 819 | if (mid_symbol_rotatable) |
814 | | - orientation = split.tangentVector().angle(); |
815 | | - mid_symbol->createRenderablesScaled(split.pos, orientation, output); |
816 | | - |
817 | | - if (i > 1) |
818 | | - { |
819 | | - mid_position += mid_symbol_distance_f; |
820 | | - next_split = SplitPathCoord::at(mid_position, split); |
821 | | - path.copy(split, next_split, processed_flags, processed_coords); |
822 | | - split = next_split; |
823 | | - } |
| 820 | + orientation = next_split.tangentVector().angle(); |
| 821 | + mid_symbol->createRenderablesScaled(next_split.pos, orientation, output); |
824 | 822 | } |
825 | 823 | } |
826 | | - |
827 | | - path.copy(split, end, processed_flags, processed_coords); |
828 | | - |
829 | | - processed_flags.back().setGapPoint(true); |
830 | | - Q_ASSERT(!processed_flags[processed_flags.size()-2].isCurveStart()); |
831 | 824 | } |
832 | 825 |
|
833 | 826 | void LineSymbol::createPointedLineCap( |
@@ -1201,7 +1194,7 @@ SplitPathCoord LineSymbol::createDashGroups( |
1201 | 1194 | bool is_first_dash = is_first_dashgroup && dash == 1; |
1202 | 1195 | bool is_last_dash = is_last_dashgroup && dash == dashes_in_group; |
1203 | 1196 |
|
1204 | | - // The dash has an start if it is not the first dash in a half first group. |
| 1197 | + // The dash has a start if it is not the first dash in a half first group. |
1205 | 1198 | bool has_start = !(is_first_dash && half_first_group); |
1206 | 1199 | // The dash has an end if it is not the last dash in a half last group. |
1207 | 1200 | bool has_end = !(is_last_dash && half_last_group); |
|
0 commit comments