Using ArcGIS API for JavaScript 2.5 I am trying to draw a path on an esri map. with circles like so, but when I call Polyline.insertPoint it doesn't show the new segment:
I keep adding points as time progresses. My implementation is to have a Graphic object with a Polyline geometry and a SimpleLineSymbol. I call the Polyline's insertPoint method when I need to add a segment. The problem I'm coming across is that when I call insertPoint, the point point is added to the array, BUT doesn't color in the line. The interesting thing is that if I remove the graphic from the graphics layer and then add it back on, then the new line segment shows up. This would be sufficient, except I need to have circles drawn on top of the line, so when I remove+add the Polyline it is drawn on top of the circles.
So in my current implementation every time I add a line point, I have to:
- Call Polyline.insertPoint
- Remove then add the graphic from the graphics layer
- Remove + add all the circles on the path (because they just got hidden from the above action)
The problem with the above steps is that the line and circles flash on and off during this process which is very undesirable.
I feel like I am using the graphic objects provided by esri incorrectly because it's so hard to accomplish a seemingly easy task. Do you have any suggestions on an alternative implementation that has a good probability of not having these same graphical artifacts that I'm experiencing?