I'm adding a line graphic to a graphic layer and then later trying to change its vertices. I'm using the MutliPoint's setPoint() to change the vertices, but after doing so, the line graphic disappears. Below is simplified code of what I'm trying to do. On creation, the line graphic shows. I then call upon sendWaypointClicked() to update the line graphic's vertices (to hard-coded values in this example). The debugging console.log() statements are putting out the correct coordinates, but the line disappears after calling setPoint() on the line graphic's polyline. Any help is appreciated in getting the line to appear with updated vertices.
Thanks!
import ArcGIS.Runtime 10.25
GraphicsLayer { id: root
renderingMode: Enums.RenderingModeDynamic
function sendWaypointClicked()
{ console.log("Point count: ", polyline.pointCount); console.log("Old heloCoord - x:", polyline.point(0).x, ", y:", polyline.point(0).y); console.log("Old waypointCoord - x:", polyline.point(1).x, ", y:", polyline.point(1).y); console.log("New heloCoord - x:", heloCoord.x, ", y:", heloCoord.y); console.log("New waypointCoord - x:", waypointCoord.x, ", y:", waypointCoord.y); polyline.setPoint(0, heloCoord)
polyline.setPoint(1, waypointCoord)
console.log("Latest heloCoord - x:", polyline.point(0).x, ", y:", polyline.point(0).y); console.log("Latest waypointCoord - x:", polyline.point(1).x, ", y:", polyline.point(1).y); }
property Point waypointCoord:
Point { x: 13357521
y: 1571120
spatialReference: SpatialReference {wkid: 102100} }
property Point heloCoord:
Point { x: 13387521
y: 1571120
spatialReference: SpatialReference {wkid: 102100} }
Graphic { id: courseTrack
geometry: Polyline { id: polyline
json: { "spatialReference":{"latestWkid": 3857, "wkid": 102100}, "paths": [[ [13367521, 1571120], [13397521, 1571120] ]]
}
}
symbol: SimpleLineSymbol { color: "red"
width: 4
}
}
}