I have a Map like so:
Map {
id: basemap
focus: true
positionDisplay {
showPosition: true
positionSource: PositionSource {
id: positionSrc
name: "MyPlugin"
updateInterval: 500 //ms
onPositionChanged: { console.log("current pos:", position.coordinate.latitude, position.coordinate.longitude); }
}
ArcGISLocalTiledLayer {
path: "./Topographic.tpk"
}
}
I created a PositionSource plugin and it updates fine, printing the new position at every 500ms. However the positionDisplay does not update its mapPoint and does not AutoPan
I have even modified the 'mode' property to every possible value:
AutoPanModeOff
What is missing? I expected it to zoom in to my location and follow it as latitude and longitude updates inside positionSrc
P.S.: If I print basemap.positionDisplay.mapPoint the result is 'null'
Did you develop your own custom position plugin? Or are you just using the out of the box plugin? Just curious because of the "MyPlugin" name specified. Otherwise, seems like it should work. Does the Position display sample in the QML sample app work for you? What platform are you on?
Yes, it is the plugin that I developed on my own. It works, because it prints a new position every 500ms.
I am on Windows 7, Qt 5.6.0 32bit
I have tested the sample app provided with the installation of the SDK.
The live example fails to get my current position using the default plugin (even though I have it set up on my windows control panel).
But the simulated example that uses nmeasource works.
I just copied this code from the sample into mine:
Text {
text: locationPoint.isEmpty || !locationPoint.valid
? "Invalid Coordinates"
: locationPoint.toDegreesMinutesSeconds(2) +
(positionSource.position.horizontalAccuracyValid
? " ± " + Math.round(positionSource.position.horizontalAccuracy.toString()) + "m"
: "")
color: locationPoint.valid ? "white": "red"
font {
bold: true
pointSize: 16
}
}
And it prints my coordinates correctly
Are you setting the mode to Enums.AutoPanModeNavigation, or just the "AutoPanModeNavigation" string?