|
|
|
@ -110,21 +110,21 @@ Item {
@@ -110,21 +110,21 @@ Item {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function calculateScale() { |
|
|
|
|
if(mapControl) { |
|
|
|
|
var scaleLinePixelLength = 100 |
|
|
|
|
var leftCoord = mapControl.toCoordinate(Qt.point(0, scale.y), false /* clipToViewPort */) |
|
|
|
|
var rightCoord = mapControl.toCoordinate(Qt.point(scaleLinePixelLength, scale.y), false /* clipToViewPort */) |
|
|
|
|
var scaleLineMeters = Math.round(leftCoord.distanceTo(rightCoord)) |
|
|
|
|
|
|
|
|
|
if (QGroundControl.settingsManager.unitsSettings.distanceUnits.value === UnitsSettings.DistanceUnitsFeet) { |
|
|
|
|
calculateFeetRatio(scaleLineMeters, scaleLinePixelLength) |
|
|
|
|
} else { |
|
|
|
|
calculateMetersRatio(scaleLineMeters, scaleLinePixelLength) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Connections { |
|
|
|
|
target: mapControl |
|
|
|
|
|
|
|
|
|
onWidthChanged: scaleTimer.restart() |
|
|
|
|
onHeightChanged: scaleTimer.restart() |
|
|
|
|
onZoomLevelChanged: scaleTimer.restart() |
|
|
|
@ -135,7 +135,6 @@ Item {
@@ -135,7 +135,6 @@ Item {
|
|
|
|
|
interval: 100 |
|
|
|
|
running: false |
|
|
|
|
repeat: false |
|
|
|
|
|
|
|
|
|
onTriggered: calculateScale() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -145,7 +144,7 @@ Item {
@@ -145,7 +144,7 @@ Item {
|
|
|
|
|
font.family: ScreenTools.demiboldFontFamily |
|
|
|
|
anchors.left: parent.left |
|
|
|
|
anchors.right: parent.right |
|
|
|
|
horizontalAlignment: Text.AlignRight |
|
|
|
|
horizontalAlignment:Text.AlignRight |
|
|
|
|
text: "0 m" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|