Select to view content in your preferred language

How to Cluster only specific graphics with Clusterer?

535
0
03-08-2013 04:18 AM
PhilipKnight1
Occasional Contributor
My situation: I have a bunch of Graphics that each have a Graphic label (uses TextSymbol as the symbol) associated with original graphics. When I do a cluster I want (problem 1) only the original Graphics to be clustered. I also want (problem 2) any singular graphics that are NOT clustered to retain their original graphic as well as their associated graphic/label.

I am clustering via a flare clusterer, fyi. I have of course overridden OnCreateGraphic, which would be a fine place to do this. In fact I can just remove the labels from the cluster to be clustered and that takes care of problem 1.

But now I need to solve problem 2: I can only return one graphic and since these labels are essentially in the same position as the original cluster I have always gotten at least 2 graphics (orignal graphic and label graphic) being passed to OnCreateGraphic as the cluster to be clustered. Since I can only pass back one graphic I have to choose which one to appear, the other one just doesnt show up. Is there a way to return more than one graphic? (unlikely?)

So, with problem 2, I tried using the actual clusterer: I have run into some issues though. Simply setting the clusterer for the Layer, seems to behind the scenes call ClusterGraphicsAsync. The only way it seems to be to turn off clustering is to set the clusterer for the Layer to null. (this is how it is done in the examples I looked at). Also, it seems to be that ass soon as I add graphics to the layer they also get clustered. passing ClusterGraphicsAsync specific graphics seems to have no effect; it always clustered every graphic in the layer.

I very much welcome any ideas on how to solve [my] problem 2.

Bonus points if you can answer any of these questions:
How do I cluster only SPECIFIC graphics on a layer?
How do I turn off clustering without setting the clusterer to null?
How do return more than one graphic or (*GASP* combine two graphics into one) from OnCreateGraphic?
0 Kudos
0 Replies