Hi,
I am tracking a path of a target and want to visualize it with a poly line in real time.
I add new points to the poly line in a background worker thread. However, the polyline is not updated on the map display as new points are added.
The code below is executed in a thread and each time the variable currentPoint is updated to a new position:
//Update history graphic
if (target.mHistoryGraphic == null) //happens only once....
{
mHistorySymbol = Symbol.Line.Solid.Red;
target.mHistoryGeometry = new Polyline();
target.mHistoryGraphic = new Graphic(target.mHistoryGeometry, mHistorySymbol, target.mLabel + "History");
target.mHistoryGraphic.Placement3D = Placement3D.AttachToSurface;
target.mHistoryGeometry.AddPoint(new Point (0,0));
target.mHistoryGeometry.AddPoint(new Point(1, 0));
target.mHistoryGeometry.AddPoint(currentPoint); //<---- I can see this part of the poly line displaying
}
else
{
target.mHistoryGeometry.AddPoint(currentPoint);//<--- points added to the poly line is not shown! How should it be done?????
}
Do I have to repopulate the polyline each time?
Thanks,
totte