I'm putting a text graphic onto a graphic layer that shows the distance from a vehicle (Point geometry) to a waypoint (also Point geometry). The text graphic will eventually be below the the waypoint graphic, right now it sits on top of it. If the user changes the position of the waypoint, then the waypoint graphic changes its position, the distance between it and vehicle is recalculated, and the text is changed.
GraphicsLayer {
id: root
.
.
.
// -------------------------------------------------------------------------
// Waypoint distance graphic.
Graphic {
id: waypointDistanceTextGraphic
geometry: waypointCoord // Places text graphic on top of waypoint graphic - ToDo: move text graphic below waypoint graphic
symbol: TextSymbol {
id: textSymbol
text: courseTrack.geometry.geodesicLength()
textColor: "white"
}
}
.
.
.
onWaypointCoordChanged: {
// Try using the cloning technique:
var waypointDistanceTextGraphic2 = waypointDistanceTextGraphic.clone()
waypointDistanceTextGraphic2.text = heloCoord.distance(waypointCoord)
console.log("Waypoint distance: ", waypointDistanceTextGraphic2.text)
waypointDistanceTextGraphic = waypointDistanceTextGraphic2
}
}
The distance printed to the console is correct, but the text graphic remains the same (in this case the geodesic length of the course track - just trying different things here). Can the text of a text graphic be changed? If so, how?
Thanks!
-Rainer