Browse Source

Don't clip aircraft images when rotated

chirpmodem-v8.1.0
Jon Beniston 3 months ago
parent
commit
a874cbbe16
  1. 77
      plugins/channelrx/demodadsb/map/map.qml
  2. 85
      plugins/channelrx/demodadsb/map/map_6.qml
  3. 83
      plugins/channelrx/demodadsb/map/map_6_strict.qml

77
plugins/channelrx/demodadsb/map/map.qml

@ -244,8 +244,8 @@ Item { @@ -244,8 +244,8 @@ Item {
}
MapQuickItem {
id: aircraft
anchorPoint.x: image.width/2
anchorPoint.y: image.height/2
anchorPoint.x: imageBounds.width/2
anchorPoint.y: imageBounds.height/2
coordinate: position
zoomLevel: aircraftZoomLevel
@ -255,41 +255,50 @@ Item { @@ -255,41 +255,50 @@ Item {
layer.enabled: smoothing
layer.smooth: smoothing
horizontalItemAlignment: Grid.AlignHCenter
Image {
id: image
rotation: heading
source: aircraftImage
visible: !lightIcons
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
if (mouse.button === Qt.LeftButton) {
highlighted = true
} else if (mouse.button === Qt.RightButton) {
contextMenu.popup()
// Sized to the rotated image's bounding box, so the smoothing layer
// doesn't clip wingtips and the bubble sits close at every heading
Item {
id: imageBounds
width: image.implicitWidth * Math.abs(Math.cos(heading * Math.PI / 180)) + image.implicitHeight * Math.abs(Math.sin(heading * Math.PI / 180))
height: image.implicitWidth * Math.abs(Math.sin(heading * Math.PI / 180)) + image.implicitHeight * Math.abs(Math.cos(heading * Math.PI / 180))
Image {
id: image
anchors.centerIn: parent
rotation: heading
source: aircraftImage
visible: !lightIcons
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
if (mouse.button === Qt.LeftButton) {
highlighted = true
} else if (mouse.button === Qt.RightButton) {
contextMenu.popup()
}
}
onDoubleClicked: {
target = true
}
}
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
}
onDoubleClicked: {
target = true
ColorOverlay {
cached: true
anchors.centerIn: parent
width: image.implicitWidth
height: image.implicitHeight
rotation: heading
source: image
color: "#c0ffffff"
visible: lightIcons
MouseArea {
anchors.fill: parent
onClicked: {
highlighted = true
}
onDoubleClicked: {
target = true
}
}
}
}

85
plugins/channelrx/demodadsb/map/map_6.qml

@ -8,8 +8,8 @@ import Qt5Compat.GraphicalEffects @@ -8,8 +8,8 @@ import Qt5Compat.GraphicalEffects
Item {
id: qmlMap
property real aircraftZoomLevel: 11
property int aircraftMinZoomLevel: 11
property int airportZoomLevel: 11
property real aircraftMinZoomLevel: 11
property real airportZoomLevel: 11
property string mapProvider: "osm"
property variant mapPtr
property string requestedMapType
@ -246,8 +246,8 @@ Item { @@ -246,8 +246,8 @@ Item {
id: aircraftComponent
MapQuickItem {
id: aircraft
anchorPoint.x: image.width/2
anchorPoint.y: image.height/2
anchorPoint.x: imageBounds.width/2
anchorPoint.y: imageBounds.height/2
coordinate: position
zoomLevel: aircraftZoomLevel
@ -257,43 +257,52 @@ Item { @@ -257,43 +257,52 @@ Item {
layer.enabled: smoothing
layer.smooth: smoothing
horizontalItemAlignment: Grid.AlignHCenter
Image {
id: image
rotation: heading
source: aircraftImage
visible: !lightIcons
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
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()
// Sized to the rotated image's bounding box, so the smoothing layer
// doesn't clip wingtips and the bubble sits close at every heading
Item {
id: imageBounds
width: image.implicitWidth * Math.abs(Math.cos(heading * Math.PI / 180)) + image.implicitHeight * Math.abs(Math.sin(heading * Math.PI / 180))
height: image.implicitWidth * Math.abs(Math.sin(heading * Math.PI / 180)) + image.implicitHeight * Math.abs(Math.cos(heading * Math.PI / 180))
Image {
id: image
anchors.centerIn: parent
rotation: heading
source: aircraftImage
visible: !lightIcons
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
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
}
}
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
}
onDoubleClicked: {
target = true
ColorOverlay {
cached: true
anchors.centerIn: parent
width: image.implicitWidth
height: image.implicitHeight
rotation: heading
source: image
color: "#c0ffffff"
visible: lightIcons
MouseArea {
anchors.fill: parent
onClicked: {
highlighted = true
}
onDoubleClicked: {
target = true
}
}
}
}

83
plugins/channelrx/demodadsb/map/map_6_strict.qml

@ -250,8 +250,8 @@ Item { @@ -250,8 +250,8 @@ Item {
}
MapQuickItem {
id: aircraft
anchorPoint.x: image.width/2
anchorPoint.y: image.height/2
anchorPoint.x: imageBounds.width/2
anchorPoint.y: imageBounds.height/2
coordinate: position
zoomLevel: aircraftZoomLevel
@ -261,44 +261,53 @@ Item { @@ -261,44 +261,53 @@ Item {
layer.enabled: smoothing
layer.smooth: smoothing
horizontalItemAlignment: Grid.AlignHCenter
Image {
id: image
rotation: heading
source: aircraftImage
visible: !lightIcons
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: (mouse) => {
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()
// Sized to the rotated image's bounding box, so the smoothing layer
// doesn't clip wingtips and the bubble sits close at every heading
Item {
id: imageBounds
width: image.implicitWidth * Math.abs(Math.cos(heading * Math.PI / 180)) + image.implicitHeight * Math.abs(Math.sin(heading * Math.PI / 180))
height: image.implicitWidth * Math.abs(Math.sin(heading * Math.PI / 180)) + image.implicitHeight * Math.abs(Math.cos(heading * Math.PI / 180))
Image {
id: image
anchors.centerIn: parent
rotation: heading
source: aircraftImage
visible: !lightIcons
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: (mouse) => {
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
}
}
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
}
onDoubleClicked: {
target = true
MultiEffect {
anchors.centerIn: parent
width: image.implicitWidth
height: image.implicitHeight
rotation: heading
source: image
brightness: 1.0
colorization: 1.0
colorizationColor: "#c0ffffff"
visible: lightIcons
MouseArea {
anchors.fill: parent
onClicked: {
highlighted = true
}
onDoubleClicked: {
target = true
}
}
}
}

Loading…
Cancel
Save