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
| import QtQuick 2.0
import QtQuick.Window 2.0
import QtLocation 5.6
import QtPositioning 5.6
Window {
width: 512
height: 512
visible: true
Plugin {
id: mapPlugin
name: "osm" // "mapboxgl", "esri", ...
// specify plugin parameters if necessary
// PluginParameter {
// name:
// value:
// }
}
ListModel {
id: locationModel
ListElement {lat: 43.100000; lon: 5.100000; color: "orange"; radius:600; text:"A"}
ListElement {lat: 43.200000; lon: 5.200000; color: "green"; radius:400; text:"B"}
ListElement {lat: 43.300000; lon: 5.300000; color: "orange"; radius:500; text:"C"}
ListElement {lat: 43.400000; lon: 5.400000; color: "red"; radius:300; text:"D"}
ListElement {lat: 43.500000; lon: 5.500000; color: "green"; radius:200; text:"E"}
ListElement {lat: 43.600000; lon: 5.600000; color: "orange"; radius:450; text:"F"}
ListElement {lat: 43.700000; lon: 5.700000; color: "red"; radius:200; text:"G"}
}
Map {
anchors.fill: parent
plugin: mapPlugin
center: QtPositioning.coordinate(43.30000, 5.35000)
zoomLevel: 9
MapItemView {
model: locationModel
delegate: MapCircle {
center: QtPositioning.coordinate(lat, lon) // lat et lon depuis le modele
radius: model.radius
opacity: 0.35
color: model.color
border.color: model.color
}
}
MapItemView {
model: locationModel
delegate: MapQuickItem {
coordinate: QtPositioning.coordinate(lat, lon)
anchorPoint.x: image.width * 0.5
anchorPoint.y: image.height
sourceItem: Column {
Image {
id: image
source: "marker.png"
}
Text {
text: model.text
font.bold: true
}
}
}
}
}
} |
Partager