summaryrefslogtreecommitdiff
path: root/tests/baseline/mapitems/data/rectangle/rectangle_grid2.qml
blob: 29f0f8a0d8d427f77c3c01ab9aba823c78657cc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// 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: "osm"
    }
    zoomLevel: 1
    copyrightsVisible: false

    Repeater {
        id: c
        property double rWidth: 70
        property double rHeight: 50
        property int count: 4
        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: 'green'
            border.width: 1
            autoFadeIn: false
            opacity: 0.3
        }
    }

    Repeater {
        id: c2
        property double rWidth: 40
        property double rHeight: 40
        property int count: 4
        model: count*count
        MapRectangle
        {
            topLeft
            {
                longitude: Math.min(180, Math.max(-180, -180+360*(index%c2.count+0.5)/(c2.count) - c2.rWidth/2))
                latitude: Math.min(90, Math.max(-90, -90+180*(Math.floor(index/c2.count)+0.5)/(c2.count) - c2.rHeight/2))
            }
            bottomRight
            {
                longitude: Math.min(180, Math.max(-180, -180+360*(index%c2.count+0.5)/(c2.count) + c2.rWidth/2))
                latitude: Math.min(90, Math.max(-90, -90+180*(Math.floor(index/c2.count)+0.5)/(c2.count) + c2.rHeight/2))
            }
            color: 'blue'
            border.width: 1
            autoFadeIn: false
            opacity: 0.3
        }
    }
}