Select to view content in your preferred language

Any way to suspend GraphicLayer automatic refresh on updateGraphic(...) ?

1378
5
05-15-2013 02:22 AM
JeremieJoalland1
Deactivated User
I currently have lots of graphics displayed in a GraphicLayer and frequent updates on their location.
So let say I need to refresh thousands of polyline graphics on my GraphicLayer, using the updateGraphic(int id, Geometry geometry) method : it takes some time to perform the updateGraphic for each graphic, so I can see on the map the graphics blinked at different times....

What I would like to do, is to suspend the automatic refresh of the GraphicLayer, update my graphics in a loop for() {}, then refresh the GraphicLayer in one instruction like .resfresh(). Is this possible with ArcGIS Runtime 10.1.1 ?

I need something like .setSuspendUpdate(true) for GraphicTracker in ArcGIS Engine...
0 Kudos
5 Replies
CarlosColón-Maldonado
Occasional Contributor III
This may a long shot, but you could try overriding the paintComponent of the map for controlling when refreshing occurs. graphic Layers are mere containers of Graphic objects that get drawn by the map (or at least are my assumptions based on what I've observed of the API, anyways).

Good luck!
0 Kudos
JeremieJoalland1
Deactivated User
Thanks for your answer.
However, I was looking for a faster solution, as I don't have time to spend on a "not sure" long shot solution...

Maybe this behavior will be implemented in a future release...
0 Kudos
MarkBaird
Esri Regular Contributor
What kind of geometries are you working with and having slow updates on?

Updating and moving items in a graphics layer is something I've done quite a bit of testing on and geneally I've found it quite responsive for large number of graphics without any nasty results.

Points geneally move around quite well, but very complex lines or polygons with 1000s of verticies can be more challenging.

The key to any code like this is trying not to repeatedly create new classes.  Remember of you have a loop which contains "new" in the code this is likely to be an expensive and slow operation.

We have a sample application we wrote for the UC a couple of years ago which shows taxis moving around New York.  It might help if you took a look at the code.  The sample can be found in Mapping -> Graphics Layers -> Move Graphics.

If you are still having problems get back to me with some more details and perhaps some code.

Mark
0 Kudos
JeremieJoalland1
Deactivated User
In my case, I'm working on a generic internal API where design pattern is maybe not optimal for ArcGIS Runtime, as this API can work with different technologies. So we definitly do a lot more than just update graphics when we move 2000 polylines per second (for exemple), and we do have some "new" or other consuming instructions during this process...

That's why I wanted to know if there were a way to have the same capapbilities than ArcGIS Engine to suspend the automatic refresh of graphics layer (tracker).... because in my case, I will not be able to change the way our internal API has been developped.

My performances issues are from stress test with thousand of graphics, but I don't know the exact operational use of the API at this time... so maybe I'll come back on this issue in few month 🙂
0 Kudos
MarkBaird
Esri Regular Contributor
Okay , let us know how you get on.

When you say you are wanting to move 2000 graphics around, this doesn't alarm me.  I think with some code refactoring you should be okay.  If you can get away from creating new instances of a class in a loop then you will see a big improvement.  "New" is an expensive operation...

Good luck

Mark
0 Kudos