Select to view content in your preferred language

GraphicsLayer.Refresh requires panning before updates are visible

818
5
10-01-2012 06:41 AM
JohanCarlsson
Regular Contributor
I've read that you should disable client caching to avoid this, but I haven't found any way of doing this when using a GraphicsLayer. My current solution is removing the graphic objects I've placed on the map, saving them in a temporary variable and then placing them on the map again. However, this causes changes made with EditGeometry to be discarded and it's too slow when handling a large amount of objects.

No changes in objects are visible unless I pan the map. Not vertices, color changes or movements on the map.

I've searched the forums for similar problems but to no avail.

Any tips to how I should do to make the layer update without having to pan the map?

Regards
Johan Carlsson
0 Kudos
5 Replies
HyrumErnstrom
Regular Contributor
How are you making the changes that aren't appearing?
0 Kudos
JohanCarlsson
Regular Contributor
I am using the EditGeometry class to edit vertices of the objects. When the user clicks an object they also have the option to change the aRGB-values of an object. When an edit of vertices is finished, I use editor.StopEdit() and when a new color is assigned I assign a new symbol to the graphics object (g.Symbol = newSymbol).

Assigning a new color:
       
    SimpleFillSymbol fillSymbol = new SimpleFillSymbol()
    {
       BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)),
       BorderThickness = 2,
       Fill = new SolidColorBrush(Color.FromArgb(argb.alpha, argb.red, argb.green, argb.blue)),
    };

     g.Symbol = fillSymbol
     graphicsLayer.Refresh();


I've got the EditGeometry feature to work now though, I had placed the StopEdit in the wrong place.
The only problem now is when assigning a color, as shown above. All other edits are now visible (moving the object on the map, editing vertices, placing new objects interactively).
0 Kudos
DominiqueBroux
Esri Frequent Contributor
do you mean that if you don't call 'graphicslayer.refresh()', your symbol change is not immediatly taken into account?
0 Kudos
JohanCarlsson
Regular Contributor
Sorry if my description is fuzzy. From the beginning I removed the object, adding the changes and then placing the modified graphics object onto the layer again. This worked fine but it seems like the servers doesn't like it so I'm trying to get refresh to work. With refresh, however, I have to pan the map to see any changes take place. I think I found my problem though, I didn't use StopEdit before doing a refresh of the layer. The object then returned to it's previous appearance and location. So it was just a fault on my side, thanks for the quick replys though.
0 Kudos
HyrumErnstrom
Regular Contributor
Are you using a Renderer on the GraphicsLayer.

You shouldn't have to call the GraphicsLayer.Refresh.
0 Kudos