diff options
author | Matthias Rauter <matthias.rauter@qt.io> | 2023-02-22 18:23:44 +0100 |
---|---|---|
committer | Matthias Rauter <matthias.rauter@qt.io> | 2023-04-11 07:59:01 +0100 |
commit | bd3ca9bd2158c2271cc76173fd747679d7fbd76c (patch) | |
tree | 9fee399b8d4d8ff084fc5e42d86086741b1087eb /tests | |
parent | fbe6f3f4b9456467baa772c6efe40b80aefd1414 (diff) | |
download | qtlocation-bd3ca9bd2158c2271cc76173fd747679d7fbd76c.tar.gz |
Polygons/lines can now be rendered following the shortest path on the globe
This is enabled by interpolating the lines of polygons and paths.
The interpolating is done following the greater circle navigation and the
connection between corners of the polygon appear curved on the projected map.
This behavior can be turned on by setting a new property, called
referenceSurface. It can be set to ReferenceSurface.Map, drawing paths as lines on
the map or to ReferenceSurface.Globe, drawing path on the globe leading to
curves on the map. It is set to ReferenceSurface.Map on default, reproducing
the old implementation for polygons, polylines and rectangles.
The circle item was already using the great circle path before this
change. Its standard implementation was changed to draw a circle in map
coordinates with approximated radius. This should be sufficient for many
cases. To get the old implementation, referenceSurface has to be set to
ReferenceSurface.Map.
Fixes: QTBUG-94785
Change-Id: Ifdd1597a7116c3d220462f063656b04becb6422f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests')
32 files changed, 506 insertions, 33 deletions
diff --git a/tests/baseline/mapitems/data/circle/circle_concentric1.qml b/tests/baseline/mapitems/data/circle/circle_concentric1.qml index a4be266d..dc8bc6eb 100644 --- a/tests/baseline/mapitems/data/circle/circle_concentric1.qml +++ b/tests/baseline/mapitems/data/circle/circle_concentric1.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/circle/circle_grid1.qml b/tests/baseline/mapitems/data/circle/circle_grid1.qml index 53ce8eb7..59fe47ac 100644 --- a/tests/baseline/mapitems/data/circle/circle_grid1.qml +++ b/tests/baseline/mapitems/data/circle/circle_grid1.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/circle_greatCircle/circle_comparison.qml b/tests/baseline/mapitems/data/circle_greatCircle/circle_comparison.qml new file mode 100644 index 00000000..5294d3d7 --- /dev/null +++ b/tests/baseline/mapitems/data/circle_greatCircle/circle_comparison.qml @@ -0,0 +1,42 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick +import QtLocation +import QtPositioning + +Map { + width: 512 + height: 512 + + center: QtPositioning.coordinate(80, -140) + + id: map + plugin: Plugin { + name: "osm" + } + zoomLevel: 2 + copyrightsVisible: false + + MapCircle + { + center: map.center + radius: 3000000 + color: "red" + border.width: 1 + autoFadeIn: false + opacity: 0.5 + referenceSurface: QtLocation.ReferenceSurface.Map + } + + MapCircle + { + center: map.center + radius: 3000000 + color: "blue" + border.width: 1 + autoFadeIn: false + opacity: 0.5 + referenceSurface: QtLocation.ReferenceSurface.Globe + } +} diff --git a/tests/baseline/mapitems/data/circle_greatCircle/circle_concentric1.qml b/tests/baseline/mapitems/data/circle_greatCircle/circle_concentric1.qml new file mode 100644 index 00000000..96606a6a --- /dev/null +++ b/tests/baseline/mapitems/data/circle_greatCircle/circle_concentric1.qml @@ -0,0 +1,48 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick +import QtLocation +import QtPositioning + +Map { + width: 512 + height: 512 + + center: QtPositioning.coordinate(0, 20) + + id: map + plugin: Plugin { + name: "itemsoverlay" + } + zoomLevel: 1 + copyrightsVisible: false + + Repeater { + id: c + property var colors: [ + "#30ff0000", + "#30ffa500", + "#30ffff00", + "#3000ff00", + "#300000ff", + "#30ee82ee" + ] + property int count: 20 + model: count + MapCircle + { + center + { + longitude: 20 + latitude: 0 + } + radius: ((c.count-index-1)/(c.count-1)*(6371-1000)+500)*Math.PI*1000 + color: c.colors[Math.floor(index%c.colors.length)] + border.width: 1 + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + opacity: 1 + } + } +} diff --git a/tests/baseline/mapitems/data/circle/circle_concentric2.qml b/tests/baseline/mapitems/data/circle_greatCircle/circle_concentric2.qml index 45184c09..35272df4 100644 --- a/tests/baseline/mapitems/data/circle/circle_concentric2.qml +++ b/tests/baseline/mapitems/data/circle_greatCircle/circle_concentric2.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false @@ -41,6 +41,7 @@ Map { color: c.colors[Math.floor(index%c.colors.length)] border.width: 1 autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe opacity: 1 } } diff --git a/tests/baseline/mapitems/data/circle/circle_concentric3.qml b/tests/baseline/mapitems/data/circle_greatCircle/circle_concentric3.qml index 55918fc9..677aeebe 100644 --- a/tests/baseline/mapitems/data/circle/circle_concentric3.qml +++ b/tests/baseline/mapitems/data/circle_greatCircle/circle_concentric3.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false @@ -41,6 +41,7 @@ Map { color: c.colors[Math.floor(index%c.colors.length)] border.width: 1 autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe opacity: 1 } } diff --git a/tests/baseline/mapitems/data/circle/circle_concentric4.qml b/tests/baseline/mapitems/data/circle_greatCircle/circle_concentric4.qml index 2232b88f..d856414e 100644 --- a/tests/baseline/mapitems/data/circle/circle_concentric4.qml +++ b/tests/baseline/mapitems/data/circle_greatCircle/circle_concentric4.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false @@ -41,6 +41,7 @@ Map { color: c.colors[Math.floor(index%c.colors.length)] border.width: 1 autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe opacity: 1 } } diff --git a/tests/baseline/mapitems/data/circle_greatCircle/circle_grid1.qml b/tests/baseline/mapitems/data/circle_greatCircle/circle_grid1.qml new file mode 100644 index 00000000..be44f08d --- /dev/null +++ b/tests/baseline/mapitems/data/circle_greatCircle/circle_grid1.qml @@ -0,0 +1,48 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick +import QtLocation +import QtPositioning + +Map { + width: 512 + height: 512 + + center: QtPositioning.coordinate(0, 20) + + id: map + plugin: Plugin { + name: "itemsoverlay" + } + zoomLevel: 1 + copyrightsVisible: false + + Repeater { + id: c + property var colors: [ + "red", + "orange", + "yellow", + "green", + "blue", + "violet" + ] + property int count: c.colors.length + model: count*count + MapCircle + { + center + { + longitude: -180+360*(index%c.count+0.5)/(c.count) + latitude: -90+180*(Math.floor(index/c.count)+0.5)/(c.count) + } + radius: 2000*1000 + color: c.colors[Math.floor(index%c.colors.length)] + border.width: 1 + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + opacity: 0.3 + } + } +} diff --git a/tests/baseline/mapitems/data/circle/circle_grid2.qml b/tests/baseline/mapitems/data/circle_greatCircle/circle_grid2.qml index 14ab12ba..c00dd3a9 100644 --- a/tests/baseline/mapitems/data/circle/circle_grid2.qml +++ b/tests/baseline/mapitems/data/circle_greatCircle/circle_grid2.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false @@ -33,6 +33,7 @@ Map { color: 'green' border.width: 1 autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe opacity: 0.3 } } diff --git a/tests/baseline/mapitems/data/circle/circle_grid3.qml b/tests/baseline/mapitems/data/circle_greatCircle/circle_grid3.qml index fa36657e..b0dec740 100644 --- a/tests/baseline/mapitems/data/circle/circle_grid3.qml +++ b/tests/baseline/mapitems/data/circle_greatCircle/circle_grid3.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false @@ -33,6 +33,7 @@ Map { color: 'green' border.width: 1 autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe opacity: 0.3 } } diff --git a/tests/baseline/mapitems/data/circle/circle_poles.qml b/tests/baseline/mapitems/data/circle_greatCircle/circle_poles.qml index 0aece161..47d11b44 100644 --- a/tests/baseline/mapitems/data/circle/circle_poles.qml +++ b/tests/baseline/mapitems/data/circle_greatCircle/circle_poles.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false @@ -29,6 +29,7 @@ Map { smooth: true border.width: 1 autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe opacity: 0.5 } MapCircle @@ -43,6 +44,7 @@ Map { smooth: true border.width: 1 autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe opacity: 0.5 } } diff --git a/tests/baseline/mapitems/data/polygon/polygon_africa1_tilt.qml b/tests/baseline/mapitems/data/polygon/polygon_africa1_tilt.qml index 5bddfd36..454bb62e 100644 --- a/tests/baseline/mapitems/data/polygon/polygon_africa1_tilt.qml +++ b/tests/baseline/mapitems/data/polygon/polygon_africa1_tilt.qml @@ -12,7 +12,7 @@ Map { height: 512 center: QtPositioning.coordinate(20, 30) - tilt: 30 + tilt: 30 plugin: Plugin { diff --git a/tests/baseline/mapitems/data/polygon/polygon_africa1_tilt_bear.qml b/tests/baseline/mapitems/data/polygon/polygon_africa1_tilt_bear.qml index e8d035bd..84d73778 100644 --- a/tests/baseline/mapitems/data/polygon/polygon_africa1_tilt_bear.qml +++ b/tests/baseline/mapitems/data/polygon/polygon_africa1_tilt_bear.qml @@ -12,8 +12,8 @@ Map { height: 512 center: QtPositioning.coordinate(20, 30) - tilt: 30 - bearing: 34 + tilt: 30 + bearing: 34 plugin: Plugin { diff --git a/tests/baseline/mapitems/data/polygon/polygon_hole.qml b/tests/baseline/mapitems/data/polygon/polygon_hole.qml index 0dfee0eb..8fde4edc 100644 --- a/tests/baseline/mapitems/data/polygon/polygon_hole.qml +++ b/tests/baseline/mapitems/data/polygon/polygon_hole.qml @@ -12,7 +12,7 @@ Map { center: QtPositioning.coordinate(52, 22) plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 4 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/polygon/polygon_hole_bear.qml b/tests/baseline/mapitems/data/polygon/polygon_hole_bear.qml index 7053f065..b3811034 100644 --- a/tests/baseline/mapitems/data/polygon/polygon_hole_bear.qml +++ b/tests/baseline/mapitems/data/polygon/polygon_hole_bear.qml @@ -10,10 +10,10 @@ Map { height: 512 center: QtPositioning.coordinate(52, 22) - bearing: 54 - + bearing: 54 + plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 4 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/polygon/polygon_hole_tilt.qml b/tests/baseline/mapitems/data/polygon/polygon_hole_tilt.qml index dfcc7433..ec3a64ed 100644 --- a/tests/baseline/mapitems/data/polygon/polygon_hole_tilt.qml +++ b/tests/baseline/mapitems/data/polygon/polygon_hole_tilt.qml @@ -10,10 +10,10 @@ Map { height: 512 center: QtPositioning.coordinate(52, 22) - tilt: 60 - + tilt: 60 + plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 4 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/polygon_greatCircle/polygon_hole.qml b/tests/baseline/mapitems/data/polygon_greatCircle/polygon_hole.qml new file mode 100644 index 00000000..d06fa4b7 --- /dev/null +++ b/tests/baseline/mapitems/data/polygon_greatCircle/polygon_hole.qml @@ -0,0 +1,54 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick +import QtLocation +import QtPositioning + +Map { + width: 512 + height: 512 + + center: QtPositioning.coordinate(52, 22) + + plugin: Plugin { + name: "itemsoverlay" + } + zoomLevel: 4 + copyrightsVisible: false + + MapPolygon { + color: "green" + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + geoShape: QtPositioning.polygon( + [ + QtPositioning.coordinate(51.11, 17.13), + QtPositioning.coordinate(50.42, 30.54), + QtPositioning.coordinate(58.36, 26.70) + ], + [ + [ + QtPositioning.coordinate(54.36, 23.46), + QtPositioning.coordinate(51.91, 20.52), + QtPositioning.coordinate(51.50, 28.25), + QtPositioning.coordinate(54.36, 26.80) + ] + ] + ) + } + + MapPolygon { + color: "blue" + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + geoShape: QtPositioning.polygon( + [ + QtPositioning.coordinate(54.36, 33.46), + QtPositioning.coordinate(51.91, 30.52), + QtPositioning.coordinate(51.50, 38.25), + QtPositioning.coordinate(54.36, 36.80) + ] + ) + } +} diff --git a/tests/baseline/mapitems/data/polygon_greatCircle/polygon_poles.qml b/tests/baseline/mapitems/data/polygon_greatCircle/polygon_poles.qml new file mode 100644 index 00000000..901ffd7a --- /dev/null +++ b/tests/baseline/mapitems/data/polygon_greatCircle/polygon_poles.qml @@ -0,0 +1,79 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick +import QtLocation +import QtPositioning + +Map { + width: 512 + height: 512 + + center: QtPositioning.coordinate(0, 20) + + id: map + plugin: Plugin { + name: "itemsoverlay" + } + zoomLevel: 1 + copyrightsVisible: false + + MapCircle + { + center + { + longitude: 0 + latitude: -90 + } + radius: 0.25*Math.PI*6371*1000 + color: 'red' + smooth: true + border.width: 1 + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + opacity: 0.3 + } + MapCircle + { + center + { + longitude: 0 + latitude: 90 + } + radius: 0.25*Math.PI*6371*1000 + color: 'green' + smooth: true + border.width: 1 + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + opacity: 0.3 + } + + MapPolygon { + color: 'red' + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + geoShape: QtPositioning.polygon( + [ + QtPositioning.coordinate(-30, 61), + QtPositioning.coordinate(-30, -179), + QtPositioning.coordinate(-30, -59) + ] + ) + opacity: 0.5 + } + + MapPolygon { + color: 'green' + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + geoShape: QtPositioning.polygon( + [ + QtPositioning.coordinate(30, 1), + QtPositioning.coordinate(30, 121), + QtPositioning.coordinate(30, -119) + ] + ) + opacity: 0.5 + } +} diff --git a/tests/baseline/mapitems/data/polygon_greatCircle/polygon_poles2.qml b/tests/baseline/mapitems/data/polygon_greatCircle/polygon_poles2.qml new file mode 100644 index 00000000..02075fb2 --- /dev/null +++ b/tests/baseline/mapitems/data/polygon_greatCircle/polygon_poles2.qml @@ -0,0 +1,48 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick +import QtLocation +import QtPositioning + +Map { + width: 512 + height: 512 + + center: QtPositioning.coordinate(0, 20) + + id: map + plugin: Plugin { + name: "itemsoverlay" + } + zoomLevel: 1 + copyrightsVisible: false + + MapPolygon { + color: 'red' + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + geoShape: QtPositioning.polygon( + [ + QtPositioning.coordinate(-30, 61), + QtPositioning.coordinate(0, -179), + QtPositioning.coordinate(30, -59) + ] + ) + opacity: 0.5 + } + + MapPolygon { + color: 'green' + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + geoShape: QtPositioning.polygon( + [ + QtPositioning.coordinate(30, 61), + QtPositioning.coordinate(0, -179), + QtPositioning.coordinate(-30, -59) + ] + ) + opacity: 0.5 + } +} diff --git a/tests/baseline/mapitems/data/polyline/polyline_dateborder.qml b/tests/baseline/mapitems/data/polyline/polyline_dateborder.qml index cf74ba9c..ff351b17 100644 --- a/tests/baseline/mapitems/data/polyline/polyline_dateborder.qml +++ b/tests/baseline/mapitems/data/polyline/polyline_dateborder.qml @@ -12,7 +12,7 @@ Map { center: QtPositioning.coordinate(0, 0) plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/polyline/polyline_dateborder2.qml b/tests/baseline/mapitems/data/polyline/polyline_dateborder2.qml index 203281af..52041a03 100644 --- a/tests/baseline/mapitems/data/polyline/polyline_dateborder2.qml +++ b/tests/baseline/mapitems/data/polyline/polyline_dateborder2.qml @@ -12,7 +12,7 @@ Map { center: QtPositioning.coordinate(0, 0) plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/polyline/polyline_local.qml b/tests/baseline/mapitems/data/polyline/polyline_local.qml index cfd0f959..54e5c9fb 100644 --- a/tests/baseline/mapitems/data/polyline/polyline_local.qml +++ b/tests/baseline/mapitems/data/polyline/polyline_local.qml @@ -12,7 +12,7 @@ Map { center: QtPositioning.coordinate(52, 22) plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 4 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/polyline/polyline_poles.qml b/tests/baseline/mapitems/data/polyline/polyline_poles.qml index 7abd7060..7b99757c 100644 --- a/tests/baseline/mapitems/data/polyline/polyline_poles.qml +++ b/tests/baseline/mapitems/data/polyline/polyline_poles.qml @@ -12,7 +12,7 @@ Map { center: QtPositioning.coordinate(0, 0) plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/polyline_greatCircle/polyline_dateborder.qml b/tests/baseline/mapitems/data/polyline_greatCircle/polyline_dateborder.qml new file mode 100644 index 00000000..dfaf4d12 --- /dev/null +++ b/tests/baseline/mapitems/data/polyline_greatCircle/polyline_dateborder.qml @@ -0,0 +1,54 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick +import QtLocation +import QtPositioning + +Map { + width: 512 + height: 512 + + center: QtPositioning.coordinate(0, 0) + + plugin: Plugin { + name: "itemsoverlay" + } + zoomLevel: 1 + copyrightsVisible: false + + MapPolyline { + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + line.color: "green" + line.width: 5 + path: [ + QtPositioning.coordinate(30, 1), + QtPositioning.coordinate(30, 121), + QtPositioning.coordinate(30, -119), + ] + } + + MapPolyline { + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + line.color: "green" + line.width: 5 + path: [ + QtPositioning.coordinate(-30, 1), + QtPositioning.coordinate(-30, 121), + QtPositioning.coordinate(-30, -119), + ] + } + + MapPolyline { + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + line.color: "green" + line.width: 5 + path: [ + QtPositioning.coordinate(-30, 60), + QtPositioning.coordinate(-30, -120), + ] + } +} diff --git a/tests/baseline/mapitems/data/polyline_greatCircle/polyline_dateborder2.qml b/tests/baseline/mapitems/data/polyline_greatCircle/polyline_dateborder2.qml new file mode 100644 index 00000000..a87fe283 --- /dev/null +++ b/tests/baseline/mapitems/data/polyline_greatCircle/polyline_dateborder2.qml @@ -0,0 +1,41 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick +import QtLocation +import QtPositioning + +Map { + width: 512 + height: 512 + + center: QtPositioning.coordinate(0, 0) + + plugin: Plugin { + name: "itemsoverlay" + } + zoomLevel: 1 + copyrightsVisible: false + + MapPolyline { + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + line.color: "blue" + line.width: 2 + path: [ + QtPositioning.coordinate(60, 100), + QtPositioning.coordinate(55, -100), + QtPositioning.coordinate(50, 0), + QtPositioning.coordinate(45, 100), + QtPositioning.coordinate(40, 0), + QtPositioning.coordinate(35, -100), + QtPositioning.coordinate(30, 100), + QtPositioning.coordinate(25, -100), + QtPositioning.coordinate(20, 0), + QtPositioning.coordinate(15, 100), + QtPositioning.coordinate(10, 0), + QtPositioning.coordinate( 5, -100) + ] + } + +} diff --git a/tests/baseline/mapitems/data/rectangle/rectangle_concentric1.qml b/tests/baseline/mapitems/data/rectangle/rectangle_concentric1.qml index 375337e1..9141f256 100644 --- a/tests/baseline/mapitems/data/rectangle/rectangle_concentric1.qml +++ b/tests/baseline/mapitems/data/rectangle/rectangle_concentric1.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/rectangle/rectangle_concentric2.qml b/tests/baseline/mapitems/data/rectangle/rectangle_concentric2.qml index 7e1b5b37..9c1905aa 100644 --- a/tests/baseline/mapitems/data/rectangle/rectangle_concentric2.qml +++ b/tests/baseline/mapitems/data/rectangle/rectangle_concentric2.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/rectangle/rectangle_concentric3.qml b/tests/baseline/mapitems/data/rectangle/rectangle_concentric3.qml index 39582127..42bb0e1b 100644 --- a/tests/baseline/mapitems/data/rectangle/rectangle_concentric3.qml +++ b/tests/baseline/mapitems/data/rectangle/rectangle_concentric3.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/rectangle/rectangle_grid1.qml b/tests/baseline/mapitems/data/rectangle/rectangle_grid1.qml index 1a74c003..49a9004a 100644 --- a/tests/baseline/mapitems/data/rectangle/rectangle_grid1.qml +++ b/tests/baseline/mapitems/data/rectangle/rectangle_grid1.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/rectangle/rectangle_grid2.qml b/tests/baseline/mapitems/data/rectangle/rectangle_grid2.qml index 29f0f8a0..0fdc66fe 100644 --- a/tests/baseline/mapitems/data/rectangle/rectangle_grid2.qml +++ b/tests/baseline/mapitems/data/rectangle/rectangle_grid2.qml @@ -13,7 +13,7 @@ Map { id: map plugin: Plugin { - name: "osm" + name: "itemsoverlay" } zoomLevel: 1 copyrightsVisible: false diff --git a/tests/baseline/mapitems/data/rectangle_greatCircle/rectangle_grid1.qml b/tests/baseline/mapitems/data/rectangle_greatCircle/rectangle_grid1.qml new file mode 100644 index 00000000..7053234d --- /dev/null +++ b/tests/baseline/mapitems/data/rectangle_greatCircle/rectangle_grid1.qml @@ -0,0 +1,54 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick +import QtLocation +import QtPositioning + +Map { + width: 512 + height: 512 + + center: QtPositioning.coordinate(0, 30) + + id: map + plugin: Plugin { + name: "itemsoverlay" + } + zoomLevel: 1 + copyrightsVisible: false + + Repeater { + id: c + property var colors: [ + "red", + "orange", + "yellow", + "green", + "blue", + "violet" + ] + property double rWidth: 55 + property double rHeight: 55 + property int count: c.colors.length + model: count*count + MapRectangle + { + topLeft + { + longitude: Math.min(180, Math.max(-180, -180+360*(index%c.count+0.5)/(c.count) - c.rWidth/2)) + latitude: Math.min(90, Math.max(-90, -90+180*(Math.floor(index/c.count)+0.5)/(c.count) - c.rHeight/2)) + } + bottomRight + { + longitude: Math.min(180, Math.max(-180, -180+360*(index%c.count+0.5)/(c.count) + c.rWidth/2)) + latitude: Math.min(90, Math.max(-90, -90+180*(Math.floor(index/c.count)+0.5)/(c.count) + c.rHeight/2)) + } + color: c.colors[Math.floor(index%c.colors.length)] + border.width: 1 + autoFadeIn: false + referenceSurface: QtLocation.ReferenceSurface.Globe + opacity: 0.3 + } + } +} diff --git a/tests/baseline/mapitems/tst_baseline_mapitems.cpp b/tests/baseline/mapitems/tst_baseline_mapitems.cpp index 3ee8f90d..63ba30ba 100644 --- a/tests/baseline/mapitems/tst_baseline_mapitems.cpp +++ b/tests/baseline/mapitems/tst_baseline_mapitems.cpp @@ -35,14 +35,14 @@ private Q_SLOTS: void init(); void cleanup(); - void circle_data() { setupTestSuite(); } - void circle() { runTest(); } + void mapItems_data() { setupTestSuite(); } + void mapItems() { runTest(); } private: void test(); void setupTestSuite(); - void runTest(const QString& style = QString()); + void runTest(); bool renderAndGrab(const QString& qmlFile, const QStringList& extraArgs, QImage *screenshot, QString *errMsg); QString testSuitePath; @@ -171,7 +171,7 @@ void tst_Baseline_MapItems::setupTestSuite() } -void tst_Baseline_MapItems::runTest(const QString& style) +void tst_Baseline_MapItems::runTest() { if (aborted) QSKIP("System too unstable."); @@ -181,8 +181,6 @@ void tst_Baseline_MapItems::runTest(const QString& style) QImage screenShot; QString errorMessage; QStringList args; - if (!style.isEmpty()) - args.append({"-style", style}); if (renderAndGrab(qmlFile, args, &screenShot, &errorMessage)) { consecutiveErrors = 0; } else { |