1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-08-31 20:27:52 -04:00

Add colour tracks to map.

This commit is contained in:
srcejon 2025-06-04 18:11:52 +01:00
parent 2aa2ad27da
commit 1304926162
2 changed files with 187 additions and 170 deletions

View File

@ -16,6 +16,7 @@ Item {
property bool lightIcons property bool lightIcons
property variant guiPtr property variant guiPtr
property bool smoothing property bool smoothing
property bool showContainmentRadius
function createMap(pluginParameters, requestedMap, gui) { function createMap(pluginParameters, requestedMap, gui) {
requestedMapType = requestedMap requestedMapType = requestedMap
@ -93,12 +94,6 @@ Item {
delegate: airportComponent delegate: airportComponent
} }
// This needs to be before aircraftComponent MapItemView, so it's drawn underneath
MapItemView {
model: aircraftModel
delegate: aircraftPathComponent
}
MapItemView { MapItemView {
model: aircraftModel model: aircraftModel
delegate: aircraftComponent delegate: aircraftComponent
@ -234,89 +229,103 @@ Item {
Component { Component {
id: aircraftComponent id: aircraftComponent
MapQuickItem { MapItemGroup {
id: aircraft MapItemView {
anchorPoint.x: image.width/2 model: aircraftPathModel
anchorPoint.y: image.height/2 delegate: aircraftPathComponent
coordinate: position }
zoomLevel: aircraftZoomLevel MapCircle {
id: containmentRadiusCircle
border.width: 1
border.color: "red"
radius: containmentRadius
center: position
visible: showContainmentRadius && (containmentRadius > 0)
}
MapQuickItem {
id: aircraft
anchorPoint.x: image.width/2
anchorPoint.y: image.height/2
coordinate: position
zoomLevel: aircraftZoomLevel
sourceItem: Grid { sourceItem: Grid {
columns: 1 columns: 1
Grid { Grid {
layer.enabled: smoothing layer.enabled: smoothing
layer.smooth: smoothing layer.smooth: smoothing
horizontalItemAlignment: Grid.AlignHCenter horizontalItemAlignment: Grid.AlignHCenter
Image { Image {
id: image id: image
rotation: heading rotation: heading
source: aircraftImage source: aircraftImage
visible: !lightIcons visible: !lightIcons
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: { onClicked: {
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
highlighted = true
} else if (mouse.button === Qt.RightButton) {
contextMenu.popup()
}
}
onDoubleClicked: {
target = true
}
}
}
ColorOverlay {
cached: true
width: image.width
height: image.height
rotation: heading
source: image
color: "#c0ffffff"
visible: lightIcons
MouseArea {
anchors.fill: parent
onClicked: {
highlighted = true highlighted = true
} else if (mouse.button === Qt.RightButton) { }
contextMenu.popup() onDoubleClicked: {
target = true
} }
} }
onDoubleClicked: {
target = true
}
} }
} Rectangle {
ColorOverlay { id: bubble
cached: true color: bubbleColour
width: image.width border.width: 1
height: image.height width: text.width * 1.1
rotation: heading height: text.height * 1.1
source: image radius: 5
color: "#c0ffffff" Text {
visible: lightIcons id: text
MouseArea { anchors.centerIn: parent
anchors.fill: parent text: adsbData
onClicked: { textFormat: TextEdit.RichText
highlighted = true
} }
onDoubleClicked: { MouseArea {
target = true anchors.fill: parent
} acceptedButtons: Qt.LeftButton | Qt.RightButton
} onClicked: {
} if (mouse.button === Qt.LeftButton) {
Rectangle { showAll = !showAll
id: bubble } else if (mouse.button === Qt.RightButton) {
color: bubbleColour contextMenu.popup()
border.width: 1 }
width: text.width * 1.1
height: text.height * 1.1
radius: 5
Text {
id: text
anchors.centerIn: parent
text: adsbData
textFormat: TextEdit.RichText
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
if (mouse.button === Qt.LeftButton) {
showAll = !showAll
} else if (mouse.button === Qt.RightButton) {
contextMenu.popup()
} }
} Menu {
Menu { id: contextMenu
id: contextMenu MenuItem {
MenuItem { text: "Set as target"
text: "Set as target" onTriggered: target = true
onTriggered: target = true }
} MenuItem {
MenuItem { text: "Find on feature map"
text: "Find on feature map" onTriggered: aircraftModel.findOnMap(index)
onTriggered: aircraftModel.findOnMap(index) }
} }
} }
} }

View File

@ -16,6 +16,7 @@ Item {
property bool lightIcons property bool lightIcons
property variant guiPtr property variant guiPtr
property bool smoothing property bool smoothing
property bool showContainmentRadius
function createMap(pluginParameters, requestedMap, gui) { function createMap(pluginParameters, requestedMap, gui) {
requestedMapType = requestedMap requestedMapType = requestedMap
@ -101,13 +102,6 @@ Item {
parent: mapView.map parent: mapView.map
} }
// This needs to be before aircraftComponent MapItemView, so it's drawn underneath
MapItemView {
model: aircraftModel
delegate: aircraftPathComponent
parent: mapView.map
}
MapItemView { MapItemView {
model: aircraftModel model: aircraftModel
delegate: aircraftComponent delegate: aircraftComponent
@ -238,99 +232,113 @@ Item {
id: aircraftPathComponent id: aircraftPathComponent
MapPolyline { MapPolyline {
line.width: 2 line.width: 2
line.color: 'gray' line.color: color
path: aircraftPath path: coordinates
} }
} }
Component { Component {
id: aircraftComponent id: aircraftComponent
MapQuickItem { MapItemGroup {
id: aircraft MapItemView {
anchorPoint.x: image.width/2 model: aircraftPathModel
anchorPoint.y: image.height/2 delegate: aircraftPathComponent
coordinate: position }
zoomLevel: aircraftZoomLevel MapCircle {
id: containmentRadiusCircle
border.width: 1
border.color: "red"
radius: containmentRadius
center: position
visible: showContainmentRadius && (containmentRadius > 0)
}
MapQuickItem {
id: aircraft
anchorPoint.x: image.width/2
anchorPoint.y: image.height/2
coordinate: position
zoomLevel: aircraftZoomLevel
sourceItem: Grid { sourceItem: Grid {
columns: 1 columns: 1
Grid { Grid {
layer.enabled: smoothing layer.enabled: smoothing
layer.smooth: smoothing layer.smooth: smoothing
horizontalItemAlignment: Grid.AlignHCenter horizontalItemAlignment: Grid.AlignHCenter
Image { Image {
id: image id: image
rotation: heading rotation: heading
source: aircraftImage source: aircraftImage
visible: !lightIcons visible: !lightIcons
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: { onClicked: {
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
highlighted = true
console.log("z=" + aircraft.sourceItem.z)
aircraft.sourceItem.z = aircraft.sourceItem.z + 1
} else if (mouse.button === Qt.RightButton) {
contextMenu.popup()
}
}
onDoubleClicked: {
target = true
}
}
}
MultiEffect {
width: image.width
height: image.height
rotation: heading
source: image
brightness: 1.0
colorization: 1.0
colorizationColor: "#c0ffffff"
visible: lightIcons
MouseArea {
anchors.fill: parent
onClicked: {
highlighted = true highlighted = true
console.log("z=" + aircraft.sourceItem.z) }
aircraft.sourceItem.z = aircraft.sourceItem.z + 1 onDoubleClicked: {
} else if (mouse.button === Qt.RightButton) { target = true
contextMenu.popup()
} }
} }
onDoubleClicked: {
target = true
}
} }
} Rectangle {
MultiEffect { id: bubble
width: image.width color: bubbleColour
height: image.height border.width: 1
rotation: heading width: text.width * 1.1
source: image height: text.height * 1.1
brightness: 1.0 radius: 5
colorization: 1.0 Text {
colorizationColor: "#c0ffffff" id: text
visible: lightIcons anchors.centerIn: parent
MouseArea { text: adsbData
anchors.fill: parent textFormat: TextEdit.RichText
onClicked: {
highlighted = true
} }
onDoubleClicked: { MouseArea {
target = true anchors.fill: parent
} acceptedButtons: Qt.LeftButton | Qt.RightButton
} onClicked: {
} if (mouse.button === Qt.LeftButton) {
Rectangle { showAll = !showAll
id: bubble } else if (mouse.button === Qt.RightButton) {
color: bubbleColour contextMenu.popup()
border.width: 1 }
width: text.width * 1.1
height: text.height * 1.1
radius: 5
Text {
id: text
anchors.centerIn: parent
text: adsbData
textFormat: TextEdit.RichText
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
if (mouse.button === Qt.LeftButton) {
showAll = !showAll
} else if (mouse.button === Qt.RightButton) {
contextMenu.popup()
} }
} Menu {
Menu { id: contextMenu
id: contextMenu MenuItem {
MenuItem { text: "Set as target"
text: "Set as target" onTriggered: target = true
onTriggered: target = true }
} MenuItem {
MenuItem { text: "Find on feature map"
text: "Find on feature map" onTriggered: aircraftModel.findOnMap(index)
onTriggered: aircraftModel.findOnMap(index) }
} }
} }
} }