diff --git a/python/plugins/processing/tests/testdata/expected/transect_fixed_single_both_swapped.gml b/python/plugins/processing/tests/testdata/expected/transect_fixed_single_both_swapped.gml new file mode 100644 index 000000000000..7e73e26d1468 --- /dev/null +++ b/python/plugins/processing/tests/testdata/expected/transect_fixed_single_both_swapped.gml @@ -0,0 +1,790 @@ + + + -1007699.67743807 1334639.79376903-1007695.38013693 1334643.87803237 + + + + -1007699.39626005 1334640.42219045-1007698.51286553 1334640.89082049 + -1007698.51286553 1334640.42219045 -1007699.39626005 1334640.89082049 + 1 + 0 + 0 + 1 + 90.00 + 1.000000 + 2 + + + + + -1007699.48998606 1334640.24551155-1007698.60659153 1334640.71414158 + -1007698.60659153 1334640.24551155 -1007699.48998606 1334640.71414158 + 1 + 0 + 1 + 2 + 90.00 + 1.000000 + 2 + + + + + -1007699.58371207 1334640.06883264-1007698.70031754 1334640.53746267 + -1007698.70031754 1334640.06883264 -1007699.58371207 1334640.53746267 + 1 + 0 + 2 + 3 + 90.00 + 1.000000 + 2 + + + + + -1007699.67743807 1334639.89215374-1007698.79404354 1334640.36078377 + -1007698.79404354 1334639.89215374 -1007699.67743807 1334640.36078377 + 1 + 0 + 3 + 4 + 90.00 + 1.000000 + 2 + + + + + -1007698.87625616 1334641.0871433-1007697.8764214 1334641.10532212 + -1007697.8764214 1334641.0871433 -1007698.87625616 1334641.10532212 + 2 + 1 + 4 + 1 + 90.00 + 1.000000 + 2 + + + + + -1007698.87989192 1334640.88717635-1007697.88005717 1334640.90535517 + -1007697.88005717 1334640.88717635 -1007698.87989192 1334640.90535517 + 2 + 1 + 5 + 2 + 90.00 + 1.000000 + 2 + + + + + -1007698.88352768 1334640.6872094-1007697.88369293 1334640.70538822 + -1007697.88369293 1334640.6872094 -1007698.88352768 1334640.70538822 + 2 + 1 + 6 + 3 + 90.00 + 1.000000 + 2 + + + + + -1007698.57444492 1334640.06062766-1007698.14727692 1334640.96479993 + -1007698.14727692 1334640.96479993 -1007698.57444492 1334640.06062766 + 2 + 1 + 7 + 4 + 90.00 + 1.000000 + 2 + + + + + -1007698.39361047 1334639.97519406-1007697.96644246 1334640.87936633 + -1007697.96644246 1334640.87936633 -1007698.39361047 1334639.97519406 + 2 + 1 + 8 + 5 + 90.00 + 1.000000 + 2 + + + + + -1007698.21277601 1334639.88976046-1007697.78560801 1334640.79393273 + -1007697.78560801 1334640.79393273 -1007698.21277601 1334639.88976046 + 2 + 1 + 9 + 6 + 90.00 + 1.000000 + 2 + + + + + -1007697.43018498 1334641.18324138-1007696.5063014 1334641.56591506 + -1007696.5063014 1334641.18324138 -1007697.43018498 1334641.56591506 + 3 + 2 + 10 + 1 + 90.00 + 1.000000 + 2 + + + + + -1007697.50671971 1334640.99846467-1007696.58283614 1334641.38113835 + -1007696.58283614 1334640.99846467 -1007697.50671971 1334641.38113835 + 3 + 2 + 11 + 2 + 90.00 + 1.000000 + 2 + + + + + -1007697.58325445 1334640.81368795-1007696.65937088 1334641.19636163 + -1007696.65937088 1334640.81368795 -1007697.58325445 1334641.19636163 + 3 + 2 + 12 + 3 + 90.00 + 1.000000 + 2 + + + + + -1007697.65978918 1334640.62891124-1007696.73590561 1334641.01158492 + -1007696.73590561 1334640.62891124 -1007697.65978918 1334641.01158492 + 3 + 2 + 13 + 4 + 90.00 + 1.000000 + 2 + + + + + -1007697.73672317 1334640.44900368-1007696.80824647 1334640.82039432 + -1007696.80824647 1334640.44900368 -1007697.73672317 1334640.82039432 + 3 + 2 + 14 + 5 + 90.00 + 1.000000 + 2 + + + + + -1007697.81121219 1334640.26596432-1007696.88031755 1334640.63125212 + -1007696.88031755 1334640.26596432 -1007697.81121219 1334640.63125212 + 3 + 2 + 15 + 6 + 90.00 + 1.000000 + 2 + + + + + -1007697.88853468 1334640.09745328-1007696.94386101 1334640.42546496 + -1007696.94386101 1334640.09745328 -1007697.88853468 1334640.42546496 + 3 + 2 + 16 + 7 + 90.00 + 1.000000 + 2 + + + + + -1007697.97399382 1334639.99112039-1007696.987237 1334640.15332697 + -1007696.987237 1334639.99112039 -1007697.97399382 1334640.15332697 + 3 + 2 + 17 + 8 + 90.00 + 1.000000 + 2 + + + + + -1007698.00643513 1334639.79376903-1007697.01967831 1334639.9559756 + -1007697.01967831 1334639.79376903 -1007698.00643513 1334639.9559756 + 3 + 2 + 18 + 9 + 90.00 + 1.000000 + 2 + + + + + -1007698.38013693 1334641.37803237-1007697.38013693 1334641.37803237 + -1007698.38013693 1334641.37803237 -1007697.38013693 1334641.37803237 + 4 + 3 + 19 + 1 + 90.00 + 1.000000 + 2 + + + + + -1007698.38013693 1334641.57803237-1007697.38013693 1334641.57803237 + -1007698.38013693 1334641.57803237 -1007697.38013693 1334641.57803237 + 4 + 3 + 20 + 2 + 90.00 + 1.000000 + 2 + + + + + -1007698.38013693 1334641.77803237-1007697.38013693 1334641.77803237 + -1007698.38013693 1334641.77803237 -1007697.38013693 1334641.77803237 + 4 + 3 + 21 + 3 + 90.00 + 1.000000 + 2 + + + + + -1007698.38013693 1334641.97803237-1007697.38013693 1334641.97803237 + -1007698.38013693 1334641.97803237 -1007697.38013693 1334641.97803237 + 4 + 3 + 22 + 4 + 90.00 + 1.000000 + 2 + + + + + -1007698.38013693 1334642.17803237-1007697.38013693 1334642.17803237 + -1007698.38013693 1334642.17803237 -1007697.38013693 1334642.17803237 + 4 + 3 + 23 + 5 + 90.00 + 1.000000 + 2 + + + + + -1007698.38013693 1334642.37803237-1007697.38013693 1334642.37803237 + -1007698.38013693 1334642.37803237 -1007697.38013693 1334642.37803237 + 4 + 3 + 24 + 6 + 90.00 + 1.000000 + 2 + + + + + -1007698.38013693 1334642.57803237-1007697.38013693 1334642.57803237 + -1007698.38013693 1334642.57803237 -1007697.38013693 1334642.57803237 + 4 + 3 + 25 + 7 + 90.00 + 1.000000 + 2 + + + + + -1007698.38013693 1334642.77803237-1007697.38013693 1334642.77803237 + -1007698.38013693 1334642.77803237 -1007697.38013693 1334642.77803237 + 4 + 3 + 26 + 8 + 90.00 + 1.000000 + 2 + + + + + -1007698.38013693 1334642.97803237-1007697.38013693 1334642.97803237 + -1007698.38013693 1334642.97803237 -1007697.38013693 1334642.97803237 + 4 + 3 + 27 + 9 + 90.00 + 1.000000 + 2 + + + + + -1007698.38013693 1334643.17803237-1007697.38013693 1334643.17803237 + -1007698.38013693 1334643.17803237 -1007697.38013693 1334643.17803237 + 4 + 3 + 28 + 10 + 90.00 + 1.000000 + 2 + + + + + -1007698.38013693 1334643.37803237-1007697.38013693 1334643.37803237 + -1007698.38013693 1334643.37803237 -1007697.38013693 1334643.37803237 + 4 + 3 + 29 + 11 + 90.00 + 1.000000 + 2 + + + + + -1007697.68013693 1334642.87803237-1007697.68013693 1334643.87803237 + -1007697.68013693 1334643.87803237 -1007697.68013693 1334642.87803237 + 4 + 3 + 30 + 12 + 90.00 + 1.000000 + 2 + + + + + -1007697.48013693 1334642.87803237-1007697.48013693 1334643.87803237 + -1007697.48013693 1334643.87803237 -1007697.48013693 1334642.87803237 + 4 + 3 + 31 + 13 + 90.00 + 1.000000 + 2 + + + + + -1007697.28013693 1334642.87803237-1007697.28013693 1334643.87803237 + -1007697.28013693 1334643.87803237 -1007697.28013693 1334642.87803237 + 4 + 3 + 32 + 14 + 90.00 + 1.000000 + 2 + + + + + -1007697.08013693 1334642.87803237-1007697.08013693 1334643.87803237 + -1007697.08013693 1334643.87803237 -1007697.08013693 1334642.87803237 + 4 + 3 + 33 + 15 + 90.00 + 1.000000 + 2 + + + + + -1007696.88013693 1334642.87803237-1007696.88013693 1334643.87803237 + -1007696.88013693 1334643.87803237 -1007696.88013693 1334642.87803237 + 4 + 3 + 34 + 16 + 90.00 + 1.000000 + 2 + + + + + -1007696.68013693 1334642.87803237-1007696.68013693 1334643.87803237 + -1007696.68013693 1334643.87803237 -1007696.68013693 1334642.87803237 + 4 + 3 + 35 + 17 + 90.00 + 1.000000 + 2 + + + + + -1007696.48013693 1334642.87803237-1007696.48013693 1334643.87803237 + -1007696.48013693 1334643.87803237 -1007696.48013693 1334642.87803237 + 4 + 3 + 36 + 18 + 90.00 + 1.000000 + 2 + + + + + -1007696.28013693 1334642.87803237-1007696.28013693 1334643.87803237 + -1007696.28013693 1334643.87803237 -1007696.28013693 1334642.87803237 + 4 + 3 + 37 + 19 + 90.00 + 1.000000 + 2 + + + + + -1007696.08013693 1334642.87803237-1007696.08013693 1334643.87803237 + -1007696.08013693 1334643.87803237 -1007696.08013693 1334642.87803237 + 4 + 3 + 38 + 20 + 90.00 + 1.000000 + 2 + + + + + -1007695.88013693 1334642.87803237-1007695.88013693 1334643.87803237 + -1007695.88013693 1334643.87803237 -1007695.88013693 1334642.87803237 + 4 + 3 + 39 + 21 + 90.00 + 1.000000 + 2 + + + + + -1007696.38013693 1334643.17803237-1007695.38013693 1334643.17803237 + -1007695.38013693 1334643.17803237 -1007696.38013693 1334643.17803237 + 4 + 3 + 40 + 22 + 90.00 + 1.000000 + 2 + + + + + -1007696.38013693 1334642.97803237-1007695.38013693 1334642.97803237 + -1007695.38013693 1334642.97803237 -1007696.38013693 1334642.97803237 + 4 + 3 + 41 + 23 + 90.00 + 1.000000 + 2 + + + + + -1007696.38013693 1334642.77803237-1007695.38013693 1334642.77803237 + -1007695.38013693 1334642.77803237 -1007696.38013693 1334642.77803237 + 4 + 3 + 42 + 24 + 90.00 + 1.000000 + 2 + + + + + -1007696.38013693 1334642.57803237-1007695.38013693 1334642.57803237 + -1007695.38013693 1334642.57803237 -1007696.38013693 1334642.57803237 + 4 + 3 + 43 + 25 + 90.00 + 1.000000 + 2 + + + + + -1007696.38013693 1334642.37803237-1007695.38013693 1334642.37803237 + -1007695.38013693 1334642.37803237 -1007696.38013693 1334642.37803237 + 4 + 3 + 44 + 26 + 90.00 + 1.000000 + 2 + + + + + -1007696.38013693 1334642.17803237-1007695.38013693 1334642.17803237 + -1007695.38013693 1334642.17803237 -1007696.38013693 1334642.17803237 + 4 + 3 + 45 + 27 + 90.00 + 1.000000 + 2 + + + + + -1007696.38013693 1334641.97803237-1007695.38013693 1334641.97803237 + -1007695.38013693 1334641.97803237 -1007696.38013693 1334641.97803237 + 4 + 3 + 46 + 28 + 90.00 + 1.000000 + 2 + + + + + -1007696.38013693 1334641.77803237-1007695.38013693 1334641.77803237 + -1007695.38013693 1334641.77803237 -1007696.38013693 1334641.77803237 + 4 + 3 + 47 + 29 + 90.00 + 1.000000 + 2 + + + + + -1007696.38013693 1334641.57803237-1007695.38013693 1334641.57803237 + -1007695.38013693 1334641.57803237 -1007696.38013693 1334641.57803237 + 4 + 3 + 48 + 30 + 90.00 + 1.000000 + 2 + + + + + -1007696.38013693 1334641.37803237-1007695.38013693 1334641.37803237 + -1007695.38013693 1334641.37803237 -1007696.38013693 1334641.37803237 + 4 + 3 + 49 + 31 + 90.00 + 1.000000 + 2 + + + + + -1007696.08172314 1334640.8774-1007696.0785487 1334641.87739496 + -1007696.0785487 1334640.8774 -1007696.08172314 1334641.87739496 + 4 + 3 + 50 + 32 + 90.00 + 1.000000 + 2 + + + + + -1007696.28172214 1334640.87676511-1007696.27854769 1334641.87676007 + -1007696.27854769 1334640.87676511 -1007696.28172214 1334641.87676007 + 4 + 3 + 51 + 33 + 90.00 + 1.000000 + 2 + + + + + -1007696.48172113 1334640.87613022-1007696.47854668 1334641.87612518 + -1007696.47854668 1334640.87613022 -1007696.48172113 1334641.87612518 + 4 + 3 + 52 + 34 + 90.00 + 1.000000 + 2 + + + + + -1007696.68172012 1334640.87549533-1007696.67854568 1334641.8754903 + -1007696.67854568 1334640.87549533 -1007696.68172012 1334641.8754903 + 4 + 3 + 53 + 35 + 90.00 + 1.000000 + 2 + + + + + -1007696.88171911 1334640.87486045-1007696.87854467 1334641.87485541 + -1007696.87854467 1334640.87486045 -1007696.88171911 1334641.87485541 + 4 + 3 + 54 + 36 + 90.00 + 1.000000 + 2 + + + + + -1007697.08202457 1334640.87500562-1007697.07823672 1334641.87499845 + -1007697.08202457 1334640.87500562 -1007697.07823672 1334641.87499845 + 4 + 3 + 55 + 37 + 90.00 + 1.000000 + 2 + + + + + -1007697.28202314 1334640.8757632-1007697.27823528 1334641.87575602 + -1007697.28202314 1334640.8757632 -1007697.27823528 1334641.87575602 + 4 + 3 + 56 + 38 + 90.00 + 1.000000 + 2 + + + + + -1007697.4820217 1334640.87652077-1007697.47823385 1334641.87651359 + -1007697.4820217 1334640.87652077 -1007697.47823385 1334641.87651359 + 4 + 3 + 57 + 39 + 90.00 + 1.000000 + 2 + + + + + -1007697.68202027 1334640.87727834-1007697.67823241 1334641.87727117 + -1007697.68202027 1334640.87727834 -1007697.67823241 1334641.87727117 + 4 + 3 + 58 + 40 + 90.00 + 1.000000 + 2 + + + + + -1007698.38012491 1334641.37803232-1007697.38012491 1334641.37803232 + -1007698.38012491 1334641.37803232 -1007697.38012491 1334641.37803232 + 4 + 3 + 59 + 41 + 90.00 + 1.000000 + 2 + + + diff --git a/python/plugins/processing/tests/testdata/expected/transect_fixed_single_both_swapped.xsd b/python/plugins/processing/tests/testdata/expected/transect_fixed_single_both_swapped.xsd new file mode 100644 index 000000000000..83712dae17ec --- /dev/null +++ b/python/plugins/processing/tests/testdata/expected/transect_fixed_single_both_swapped.xsd @@ -0,0 +1,97 @@ + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/python/plugins/processing/tests/testdata/expected/transect_multi_left_05_swapped.gml b/python/plugins/processing/tests/testdata/expected/transect_multi_left_05_swapped.gml new file mode 100644 index 000000000000..40a54a75859e --- /dev/null +++ b/python/plugins/processing/tests/testdata/expected/transect_multi_left_05_swapped.gml @@ -0,0 +1,248 @@ + + + -1007699.25579326 1334639.74601889-1007695.52602282 1334643.73158576 + + + + -1007698.95456279 1334640.42219045-1007698.51286553 1334640.65650547 + -1007698.51286553 1334640.42219045 -1007698.95456279 1334640.65650547 + transect_multi.0 + 1 + 0 + 0 + 1 + 90.00 + 0.500000 + 0 + + + + + -1007699.25579326 1334639.85435371-1007698.814096 1334640.08866873 + -1007698.814096 1334639.85435371 -1007699.25579326 1334640.08866873 + transect_multi.0 + 1 + 0 + 1 + 2 + 90.00 + 0.500000 + 0 + + + + + -1007698.23435929 1334641.02514922-1007697.88013693 1334641.37803237 + -1007698.23435929 1334641.02514922 -1007697.88013693 1334641.37803237 + transect_multi.1 + 2 + 1 + 2 + 1 + 90.00 + 0.500000 + 0 + + + + + -1007698.23369032 1334643.37803237-1007697.88013693 1334643.73158576 + -1007698.23369032 1334643.73158576 -1007697.88013693 1334643.37803237 + transect_multi.1 + 2 + 1 + 3 + 2 + 90.00 + 0.500000 + 0 + + + + + -1007695.88013693 1334643.37803237-1007695.52658354 1334643.73158576 + -1007695.52658354 1334643.73158576 -1007695.88013693 1334643.37803237 + transect_multi.1 + 2 + 1 + 4 + 3 + 90.00 + 0.500000 + 0 + + + + + -1007695.88013693 1334641.02504059-1007695.52602282 1334641.37803237 + -1007695.52602282 1334641.02504059 -1007695.88013693 1334641.37803237 + transect_multi.1 + 2 + 1 + 5 + 4 + 90.00 + 0.500000 + 0 + + + + + -1007696.96839654 1334640.87457824-1007696.96824319 1334641.37457822 + -1007696.96839654 1334640.87457824 -1007696.96824319 1334641.37457822 + transect_multi.1 + 2 + 1 + 6 + 5 + 90.00 + 0.500000 + 0 + + + + + -1007698.23435929 1334641.02514922-1007697.88013693 1334641.37803237 + -1007698.23435929 1334641.02514922 -1007697.88013693 1334641.37803237 + transect_multi.1 + 2 + 1 + 7 + 6 + 90.00 + 0.500000 + 0 + + + + + -1007698.37633878 1334641.0871433-1007697.8764214 1334641.09623271 + -1007697.8764214 1334641.0871433 -1007698.37633878 1334641.09623271 + transect_multi.2 + 3 + 2 + 8 + 1 + 90.00 + 0.500000 + 0 + + + + + -1007698.38672604 1334640.52493354-1007697.96194165 1334640.78867247 + -1007697.96194165 1334640.78867247 -1007698.38672604 1334640.52493354 + transect_multi.2 + 3 + 2 + 9 + 2 + 90.00 + 0.500000 + 0 + + + + + -1007697.94699881 1334640.31718839-1007697.73341481 1334640.76927453 + -1007697.73341481 1334640.76927453 -1007697.94699881 1334640.31718839 + transect_multi.2 + 3 + 2 + 10 + 3 + 90.00 + 0.500000 + 0 + + + + + -1007696.96824319 1334641.18324138-1007696.5063014 1334641.37457822 + -1007696.5063014 1334641.18324138 -1007696.96824319 1334641.37457822 + transect_multi.2 + 3 + 2 + 11 + 1 + 90.00 + 0.500000 + 0 + + + + + -1007697.2100332 1334640.60230849-1007696.74693454 1334640.79082807 + -1007696.74693454 1334640.60230849 -1007697.2100332 1334640.79082807 + transect_multi.2 + 3 + 2 + 12 + 2 + 90.00 + 0.500000 + 0 + + + + + -1007697.28602434 1334640.4166796-1007696.821179 1334640.6008502 + -1007696.821179 1334640.4166796 -1007697.28602434 1334640.6008502 + transect_multi.2 + 3 + 2 + 13 + 3 + 90.00 + 0.500000 + 0 + + + + + -1007697.39310278 1334640.15461381-1007696.92411811 1334640.32797291 + -1007696.92411811 1334640.15461381 -1007697.39310278 1334640.32797291 + transect_multi.2 + 3 + 2 + 14 + 4 + 90.00 + 0.500000 + 0 + + + + + -1007697.47945635 1334639.9562693-1007696.99482279 1334640.07927462 + -1007696.99482279 1334639.9562693 -1007697.47945635 1334640.07927462 + transect_multi.2 + 3 + 2 + 15 + 5 + 90.00 + 0.500000 + 0 + + + + + -1007697.52090606 1334639.74601889-1007697.02752765 1334639.82712218 + -1007697.02752765 1334639.74601889 -1007697.52090606 1334639.82712218 + transect_multi.2 + 3 + 2 + 16 + 6 + 90.00 + 0.500000 + 0 + + + diff --git a/python/plugins/processing/tests/testdata/expected/transect_multi_left_05_swapped.xsd b/python/plugins/processing/tests/testdata/expected/transect_multi_left_05_swapped.xsd new file mode 100644 index 000000000000..a2b4a69c40ce --- /dev/null +++ b/python/plugins/processing/tests/testdata/expected/transect_multi_left_05_swapped.xsd @@ -0,0 +1,104 @@ + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/python/plugins/processing/tests/testdata/expected/transect_multi_right_1_swapped.gml b/python/plugins/processing/tests/testdata/expected/transect_multi_right_1_swapped.gml new file mode 100644 index 000000000000..7fede101ae18 --- /dev/null +++ b/python/plugins/processing/tests/testdata/expected/transect_multi_right_1_swapped.gml @@ -0,0 +1,248 @@ + + + -1007700.13918779 1334639.41301612-1007695.88013693 1334643.37803237 + + + + -1007699.83795732 1334640.65650547-1007698.95456279 1334641.1251355 + -1007698.95456279 1334640.65650547 -1007699.83795732 1334641.1251355 + transect_multi.0 + 1 + 0 + 0 + 1 + 90.00 + 1.000000 + 1 + + + + + -1007700.13918779 1334640.08866873-1007699.25579326 1334640.55729876 + -1007699.25579326 1334640.08866873 -1007700.13918779 1334640.55729876 + transect_multi.0 + 1 + 0 + 1 + 2 + 90.00 + 1.000000 + 1 + + + + + -1007697.88013693 1334641.37803237-1007697.1716922 1334642.08379867 + -1007697.88013693 1334641.37803237 -1007697.1716922 1334642.08379867 + transect_multi.1 + 2 + 1 + 2 + 1 + 90.00 + 1.000000 + 1 + + + + + -1007697.88013693 1334642.67092559-1007697.17303015 1334643.37803237 + -1007697.88013693 1334643.37803237 -1007697.17303015 1334642.67092559 + transect_multi.1 + 2 + 1 + 3 + 2 + 90.00 + 1.000000 + 1 + + + + + -1007696.58724371 1334642.67092559-1007695.88013693 1334643.37803237 + -1007695.88013693 1334643.37803237 -1007696.58724371 1334642.67092559 + transect_multi.1 + 2 + 1 + 4 + 3 + 90.00 + 1.000000 + 1 + + + + + -1007696.58836516 1334641.37803237-1007695.88013693 1334642.08401592 + -1007695.88013693 1334641.37803237 -1007696.58836516 1334642.08401592 + transect_multi.1 + 2 + 1 + 5 + 4 + 90.00 + 1.000000 + 1 + + + + + -1007696.96824319 1334641.37457822-1007696.96793648 1334642.37457817 + -1007696.96824319 1334641.37457822 -1007696.96793648 1334642.37457817 + transect_multi.1 + 2 + 1 + 6 + 5 + 90.00 + 1.000000 + 1 + + + + + -1007697.88013693 1334641.37803237-1007697.1716922 1334642.08379867 + -1007697.88013693 1334641.37803237 -1007697.1716922 1334642.08379867 + transect_multi.1 + 2 + 1 + 7 + 6 + 90.00 + 1.000000 + 1 + + + + + -1007699.37617353 1334641.09623271-1007698.37633878 1334641.11441153 + -1007698.37633878 1334641.09623271 -1007699.37617353 1334641.11441153 + transect_multi.2 + 3 + 2 + 8 + 1 + 90.00 + 1.000000 + 1 + + + + + -1007699.23629481 1334639.99745567-1007698.38672604 1334640.52493354 + -1007698.38672604 1334640.52493354 -1007699.23629481 1334639.99745567 + transect_multi.2 + 3 + 2 + 9 + 2 + 90.00 + 1.000000 + 1 + + + + + -1007698.37416682 1334639.41301612-1007697.94699881 1334640.31718839 + -1007697.94699881 1334640.31718839 -1007698.37416682 1334639.41301612 + transect_multi.2 + 3 + 2 + 10 + 3 + 90.00 + 1.000000 + 1 + + + + + -1007697.89212676 1334641.37457822-1007696.96824319 1334641.7572519 + -1007696.96824319 1334641.37457822 -1007697.89212676 1334641.7572519 + transect_multi.2 + 3 + 2 + 11 + 1 + 90.00 + 1.000000 + 1 + + + + + -1007698.13623052 1334640.79082807-1007697.2100332 1334641.16786723 + -1007697.2100332 1334640.79082807 -1007698.13623052 1334641.16786723 + transect_multi.2 + 3 + 2 + 12 + 2 + 90.00 + 1.000000 + 1 + + + + + -1007698.21571502 1334640.6008502-1007697.28602434 1334640.96919141 + -1007697.28602434 1334640.6008502 -1007698.21571502 1334640.96919141 + transect_multi.2 + 3 + 2 + 13 + 3 + 90.00 + 1.000000 + 1 + + + + + -1007698.33107213 1334640.32797291-1007697.39310278 1334640.67469111 + -1007697.39310278 1334640.32797291 -1007698.33107213 1334640.67469111 + transect_multi.2 + 3 + 2 + 14 + 4 + 90.00 + 1.000000 + 1 + + + + + -1007698.44872348 1334640.07927462-1007697.47945635 1334640.32528526 + -1007697.47945635 1334640.07927462 -1007698.44872348 1334640.32528526 + transect_multi.2 + 3 + 2 + 15 + 5 + 90.00 + 1.000000 + 1 + + + + + -1007698.50766288 1334639.82712218-1007697.52090606 1334639.98932876 + -1007697.52090606 1334639.82712218 -1007698.50766288 1334639.98932876 + transect_multi.2 + 3 + 2 + 16 + 6 + 90.00 + 1.000000 + 1 + + + diff --git a/python/plugins/processing/tests/testdata/expected/transect_multi_right_1_swapped.xsd b/python/plugins/processing/tests/testdata/expected/transect_multi_right_1_swapped.xsd new file mode 100644 index 000000000000..dc8206034874 --- /dev/null +++ b/python/plugins/processing/tests/testdata/expected/transect_multi_right_1_swapped.xsd @@ -0,0 +1,104 @@ + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/python/plugins/processing/tests/testdata/expected/transect_single_left_05_swapped.gml b/python/plugins/processing/tests/testdata/expected/transect_single_left_05_swapped.gml new file mode 100644 index 000000000000..f46ce0128b5a --- /dev/null +++ b/python/plugins/processing/tests/testdata/expected/transect_single_left_05_swapped.gml @@ -0,0 +1,231 @@ + + + -1007699.25579326 1334639.74601889-1007695.52602282 1334643.73158576 + + + + -1007698.95456279 1334640.42219045-1007698.51286553 1334640.65650547 + -1007698.51286553 1334640.42219045 -1007698.95456279 1334640.65650547 + 1 + 0 + 0 + 1 + 90.00 + 0.500000 + 0 + + + + + -1007699.25579326 1334639.85435371-1007698.814096 1334640.08866873 + -1007698.814096 1334639.85435371 -1007699.25579326 1334640.08866873 + 1 + 0 + 1 + 2 + 90.00 + 0.500000 + 0 + + + + + -1007698.37633878 1334641.0871433-1007697.8764214 1334641.09623271 + -1007697.8764214 1334641.0871433 -1007698.37633878 1334641.09623271 + 2 + 1 + 2 + 1 + 90.00 + 0.500000 + 0 + + + + + -1007698.38672604 1334640.52493354-1007697.96194165 1334640.78867247 + -1007697.96194165 1334640.78867247 -1007698.38672604 1334640.52493354 + 2 + 1 + 3 + 2 + 90.00 + 0.500000 + 0 + + + + + -1007697.94699881 1334640.31718839-1007697.73341481 1334640.76927453 + -1007697.73341481 1334640.76927453 -1007697.94699881 1334640.31718839 + 2 + 1 + 4 + 3 + 90.00 + 0.500000 + 0 + + + + + -1007696.96824319 1334641.18324138-1007696.5063014 1334641.37457822 + -1007696.5063014 1334641.18324138 -1007696.96824319 1334641.37457822 + 3 + 2 + 5 + 1 + 90.00 + 0.500000 + 0 + + + + + -1007697.2100332 1334640.60230849-1007696.74693454 1334640.79082807 + -1007696.74693454 1334640.60230849 -1007697.2100332 1334640.79082807 + 3 + 2 + 6 + 2 + 90.00 + 0.500000 + 0 + + + + + -1007697.28602434 1334640.4166796-1007696.821179 1334640.6008502 + -1007696.821179 1334640.4166796 -1007697.28602434 1334640.6008502 + 3 + 2 + 7 + 3 + 90.00 + 0.500000 + 0 + + + + + -1007697.39310278 1334640.15461381-1007696.92411811 1334640.32797291 + -1007696.92411811 1334640.15461381 -1007697.39310278 1334640.32797291 + 3 + 2 + 8 + 4 + 90.00 + 0.500000 + 0 + + + + + -1007697.47945635 1334639.9562693-1007696.99482279 1334640.07927462 + -1007696.99482279 1334639.9562693 -1007697.47945635 1334640.07927462 + 3 + 2 + 9 + 5 + 90.00 + 0.500000 + 0 + + + + + -1007697.52090606 1334639.74601889-1007697.02752765 1334639.82712218 + -1007697.02752765 1334639.74601889 -1007697.52090606 1334639.82712218 + 3 + 2 + 10 + 6 + 90.00 + 0.500000 + 0 + + + + + -1007698.23435929 1334641.02514922-1007697.88013693 1334641.37803237 + -1007698.23435929 1334641.02514922 -1007697.88013693 1334641.37803237 + 4 + 3 + 11 + 1 + 90.00 + 0.500000 + 0 + + + + + -1007698.23369032 1334643.37803237-1007697.88013693 1334643.73158576 + -1007698.23369032 1334643.73158576 -1007697.88013693 1334643.37803237 + 4 + 3 + 12 + 2 + 90.00 + 0.500000 + 0 + + + + + -1007695.88013693 1334643.37803237-1007695.52658354 1334643.73158576 + -1007695.52658354 1334643.73158576 -1007695.88013693 1334643.37803237 + 4 + 3 + 13 + 3 + 90.00 + 0.500000 + 0 + + + + + -1007695.88013693 1334641.02504059-1007695.52602282 1334641.37803237 + -1007695.52602282 1334641.02504059 -1007695.88013693 1334641.37803237 + 4 + 3 + 14 + 4 + 90.00 + 0.500000 + 0 + + + + + -1007696.96839654 1334640.87457824-1007696.96824319 1334641.37457822 + -1007696.96839654 1334640.87457824 -1007696.96824319 1334641.37457822 + 4 + 3 + 15 + 5 + 90.00 + 0.500000 + 0 + + + + + -1007698.23435929 1334641.02514922-1007697.88013693 1334641.37803237 + -1007698.23435929 1334641.02514922 -1007697.88013693 1334641.37803237 + 4 + 3 + 16 + 6 + 90.00 + 0.500000 + 0 + + + diff --git a/python/plugins/processing/tests/testdata/expected/transect_single_left_05_swapped.xsd b/python/plugins/processing/tests/testdata/expected/transect_single_left_05_swapped.xsd new file mode 100644 index 000000000000..3c03c0a953c7 --- /dev/null +++ b/python/plugins/processing/tests/testdata/expected/transect_single_left_05_swapped.xsd @@ -0,0 +1,97 @@ + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/python/plugins/processing/tests/testdata/expected/transect_single_right_1_swapped.gml b/python/plugins/processing/tests/testdata/expected/transect_single_right_1_swapped.gml new file mode 100644 index 000000000000..494da3308a5d --- /dev/null +++ b/python/plugins/processing/tests/testdata/expected/transect_single_right_1_swapped.gml @@ -0,0 +1,231 @@ + + + -1007700.13918779 1334639.41301612-1007695.88013693 1334643.37803237 + + + + -1007699.83795732 1334640.65650547-1007698.95456279 1334641.1251355 + -1007698.95456279 1334640.65650547 -1007699.83795732 1334641.1251355 + 1 + 0 + 0 + 1 + 90.00 + 1.000000 + 1 + + + + + -1007700.13918779 1334640.08866873-1007699.25579326 1334640.55729876 + -1007699.25579326 1334640.08866873 -1007700.13918779 1334640.55729876 + 1 + 0 + 1 + 2 + 90.00 + 1.000000 + 1 + + + + + -1007699.37617353 1334641.09623271-1007698.37633878 1334641.11441153 + -1007698.37633878 1334641.09623271 -1007699.37617353 1334641.11441153 + 2 + 1 + 2 + 1 + 90.00 + 1.000000 + 1 + + + + + -1007699.23629481 1334639.99745567-1007698.38672604 1334640.52493354 + -1007698.38672604 1334640.52493354 -1007699.23629481 1334639.99745567 + 2 + 1 + 3 + 2 + 90.00 + 1.000000 + 1 + + + + + -1007698.37416682 1334639.41301612-1007697.94699881 1334640.31718839 + -1007697.94699881 1334640.31718839 -1007698.37416682 1334639.41301612 + 2 + 1 + 4 + 3 + 90.00 + 1.000000 + 1 + + + + + -1007697.89212676 1334641.37457822-1007696.96824319 1334641.7572519 + -1007696.96824319 1334641.37457822 -1007697.89212676 1334641.7572519 + 3 + 2 + 5 + 1 + 90.00 + 1.000000 + 1 + + + + + -1007698.13623052 1334640.79082807-1007697.2100332 1334641.16786723 + -1007697.2100332 1334640.79082807 -1007698.13623052 1334641.16786723 + 3 + 2 + 6 + 2 + 90.00 + 1.000000 + 1 + + + + + -1007698.21571502 1334640.6008502-1007697.28602434 1334640.96919141 + -1007697.28602434 1334640.6008502 -1007698.21571502 1334640.96919141 + 3 + 2 + 7 + 3 + 90.00 + 1.000000 + 1 + + + + + -1007698.33107213 1334640.32797291-1007697.39310278 1334640.67469111 + -1007697.39310278 1334640.32797291 -1007698.33107213 1334640.67469111 + 3 + 2 + 8 + 4 + 90.00 + 1.000000 + 1 + + + + + -1007698.44872348 1334640.07927462-1007697.47945635 1334640.32528526 + -1007697.47945635 1334640.07927462 -1007698.44872348 1334640.32528526 + 3 + 2 + 9 + 5 + 90.00 + 1.000000 + 1 + + + + + -1007698.50766288 1334639.82712218-1007697.52090606 1334639.98932876 + -1007697.52090606 1334639.82712218 -1007698.50766288 1334639.98932876 + 3 + 2 + 10 + 6 + 90.00 + 1.000000 + 1 + + + + + -1007697.88013693 1334641.37803237-1007697.1716922 1334642.08379867 + -1007697.88013693 1334641.37803237 -1007697.1716922 1334642.08379867 + 4 + 3 + 11 + 1 + 90.00 + 1.000000 + 1 + + + + + -1007697.88013693 1334642.67092559-1007697.17303015 1334643.37803237 + -1007697.88013693 1334643.37803237 -1007697.17303015 1334642.67092559 + 4 + 3 + 12 + 2 + 90.00 + 1.000000 + 1 + + + + + -1007696.58724371 1334642.67092559-1007695.88013693 1334643.37803237 + -1007695.88013693 1334643.37803237 -1007696.58724371 1334642.67092559 + 4 + 3 + 13 + 3 + 90.00 + 1.000000 + 1 + + + + + -1007696.58836516 1334641.37803237-1007695.88013693 1334642.08401592 + -1007695.88013693 1334641.37803237 -1007696.58836516 1334642.08401592 + 4 + 3 + 14 + 4 + 90.00 + 1.000000 + 1 + + + + + -1007696.96824319 1334641.37457822-1007696.96793648 1334642.37457817 + -1007696.96824319 1334641.37457822 -1007696.96793648 1334642.37457817 + 4 + 3 + 15 + 5 + 90.00 + 1.000000 + 1 + + + + + -1007697.88013693 1334641.37803237-1007697.1716922 1334642.08379867 + -1007697.88013693 1334641.37803237 -1007697.1716922 1334642.08379867 + 4 + 3 + 16 + 6 + 90.00 + 1.000000 + 1 + + + diff --git a/python/plugins/processing/tests/testdata/expected/transect_single_right_1_swapped.xsd b/python/plugins/processing/tests/testdata/expected/transect_single_right_1_swapped.xsd new file mode 100644 index 000000000000..f81d7d8a955b --- /dev/null +++ b/python/plugins/processing/tests/testdata/expected/transect_single_right_1_swapped.xsd @@ -0,0 +1,97 @@ + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/python/plugins/processing/tests/testdata/qgis_algorithm_tests3.yaml b/python/plugins/processing/tests/testdata/qgis_algorithm_tests3.yaml index 26fe780b740c..7601c666e8dd 100644 --- a/python/plugins/processing/tests/testdata/qgis_algorithm_tests3.yaml +++ b/python/plugins/processing/tests/testdata/qgis_algorithm_tests3.yaml @@ -2481,6 +2481,84 @@ tests: name: expected/transect_fixed_single_both.gml type: vector + # Tests for DIRECTION parameter + # DIRECTION: 0 = Left to Right (default), 1 = Right to Left (hydraulic convention) + - algorithm: native:transect + name: Transect single left 90.0 0.5m right to left direction + params: + ANGLE: 90.0 + LENGTH: 0.5 + INPUT: + name: custom/transect_single.gml + type: vector + SIDE: 0 + DIRECTION: 1 + results: + OUTPUT: + name: expected/transect_single_left_05_swapped.gml + type: vector + + - algorithm: native:transect + name: Transect single right 90.0 1m right to left direction + params: + ANGLE: 90.0 + LENGTH: 1.0 + INPUT: + name: custom/transect_single.gml + type: vector + SIDE: 1 + DIRECTION: 1 + results: + OUTPUT: + name: expected/transect_single_right_1_swapped.gml + type: vector + + - algorithm: native:transect + name: Transect multi left 90.0 0.5m right to left direction + params: + ANGLE: 90.0 + LENGTH: 0.5 + INPUT: + name: custom/transect_multi.gml + type: vector + SIDE: 0 + DIRECTION: 1 + results: + OUTPUT: + name: expected/transect_multi_left_05_swapped.gml + type: vector + + - algorithm: native:transect + name: Transect multi right 90.0 1m right to left direction + params: + ANGLE: 90.0 + LENGTH: 1.0 + INPUT: + name: custom/transect_multi.gml + type: vector + SIDE: 1 + DIRECTION: 1 + results: + OUTPUT: + name: expected/transect_multi_right_1_swapped.gml + type: vector + + - algorithm: native:transectfixeddistance + name: Test (native:transectfixeddistance) right to left direction + params: + ANGLE: 90.0 + INPUT: + name: custom/transect_single.gml + type: vector + INTERVAL: 0.20 + LENGTH: 1.0 + SIDE: 2 + DIRECTION: 1 + results: + OUTPUT: + name: expected/transect_fixed_single_both_swapped.gml + type: vector + - algorithm: qgis:distancematrix name: Linear (N*k x 3) distance matrix params: diff --git a/src/analysis/processing/qgsalgorithmtransectbase.cpp b/src/analysis/processing/qgsalgorithmtransectbase.cpp index eee6f4df2180..a49803409645 100644 --- a/src/analysis/processing/qgsalgorithmtransectbase.cpp +++ b/src/analysis/processing/qgsalgorithmtransectbase.cpp @@ -67,6 +67,10 @@ void QgsTransectAlgorithmBase::initAlgorithm( const QVariantMap & ) addParameter( new QgsProcessingParameterEnum( QStringLiteral( "SIDE" ), QObject::tr( "Side to create the transects" ), QStringList() << QObject::tr( "Left" ) << QObject::tr( "Right" ) << QObject::tr( "Both" ), false, 2 ) ); + auto direction = std::make_unique( QStringLiteral( "DIRECTION" ), QObject::tr( "Direction" ), QStringList() << QObject::tr( "Left to Right" ) << QObject::tr( "Right to Left" ), false, 0, true ); + direction->setGuiDefaultValueOverride( 1 ); + addParameter( direction.release() ); + addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Transect" ), Qgis::ProcessingSourceType::VectorLine ) ); } @@ -86,6 +90,8 @@ QVariantMap QgsTransectAlgorithmBase::processAlgorithm( const QVariantMap ¶m if ( mOrientation == QgsTransectAlgorithmBase::Both ) mLength /= 2.0; + mDirection = static_cast( parameterAsInt( parameters, QStringLiteral( "DIRECTION" ), context ) ); + // Let subclass prepare their specific parameters if ( !prepareAlgorithmTransectParameters( parameters, context, feedback ) ) return QVariantMap(); @@ -180,7 +186,7 @@ QVariantMap QgsTransectAlgorithmBase::processAlgorithm( const QVariantMap ¶m << ( ( mOrientation == QgsTransectAlgorithmBase::Both ) ? evaluatedLength * 2 : evaluatedLength ) << static_cast( mOrientation ); outFeat.setAttributes( attrs ); - outFeat.setGeometry( calcTransect( pt, azimuth, evaluatedLength, mOrientation, evaluatedAngle ) ); + outFeat.setGeometry( calcTransect( pt, azimuth, evaluatedLength, mOrientation, evaluatedAngle, mDirection ) ); if ( !sink->addFeature( outFeat, QgsFeatureSink::FastInsert ) ) throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) ); number++; @@ -195,7 +201,7 @@ QVariantMap QgsTransectAlgorithmBase::processAlgorithm( const QVariantMap ¶m return outputs; } -QgsGeometry QgsTransectAlgorithmBase::calcTransect( const QgsPoint &point, const double angleAtVertex, const double length, const QgsTransectAlgorithmBase::Side orientation, const double angle ) +QgsGeometry QgsTransectAlgorithmBase::calcTransect( const QgsPoint &point, const double angleAtVertex, const double length, const QgsTransectAlgorithmBase::Side orientation, const double angle, const QgsTransectAlgorithmBase::Direction direction ) { QgsPoint pLeft; // left point of the line QgsPoint pRight; // right point of the line @@ -220,8 +226,19 @@ QgsGeometry QgsTransectAlgorithmBase::calcTransect( const QgsPoint &point, const break; } - line.append( pLeft ); - line.append( pRight ); + // Direction determines the line orientation: + // - LeftToRight: line goes from pLeft to pRight (default) + // - RightToLeft: line goes from pRight to pLeft (hydraulic convention - perpendicular from stream bank looking downstream) + if ( direction == QgsTransectAlgorithmBase::RightToLeft ) + { + line.append( pRight ); + line.append( pLeft ); + } + else + { + line.append( pLeft ); + line.append( pRight ); + } return QgsGeometry::fromPolyline( line ); } diff --git a/src/analysis/processing/qgsalgorithmtransectbase.h b/src/analysis/processing/qgsalgorithmtransectbase.h index a6cd58765906..8e2e4ee021fb 100644 --- a/src/analysis/processing/qgsalgorithmtransectbase.h +++ b/src/analysis/processing/qgsalgorithmtransectbase.h @@ -41,6 +41,15 @@ class QgsTransectAlgorithmBase : public QgsProcessingAlgorithm Both }; + /** + * Direction of the transect line + */ + enum Direction + { + LeftToRight, + RightToLeft + }; + QString group() const final; QString groupId() const final; QStringList tags() const override; @@ -84,7 +93,7 @@ class QgsTransectAlgorithmBase : public QgsProcessingAlgorithm /** * Returns the transect geometry at the specified point. */ - static QgsGeometry calcTransect( const QgsPoint &point, double angleAtVertex, double length, Side orientation, double angle ); + static QgsGeometry calcTransect( const QgsPoint &point, double angleAtVertex, double length, Side orientation, double angle, Direction direction ); // Shared member variables accessible to subclasses Side mOrientation = Both; @@ -92,6 +101,7 @@ class QgsTransectAlgorithmBase : public QgsProcessingAlgorithm double mLength = 5.0; bool mDynamicAngle = false; bool mDynamicLength = false; + Direction mDirection = LeftToRight; QgsProperty mAngleProperty; QgsProperty mLengthProperty; };