Get all graphics under a rectangle

216
0
11-22-2022 06:09 AM
ofirrosner
New Contributor III

Hi,
my goal is to get all graphics(in all visible layers) under a certain rectangle, which is drawn on the screen.

to do this, i wat thinking about 2 ways(in pseudo-code)
First - one is by using GeometryEngine.Intersection(Geometry, Geometry)
for-each visible layer that i have
for-each graphic in that layer
do  GeometryEngine.Intersection(rectangle, graphic.geometry)
if true add it my collection

Second- use GeoView.IdentifyGraphicsOverlayAsync(GraphicsOverlay, Point, Double, Boolean)
because for some reason the tolerance maximum value is 100
divide(somehow) my rectangle to 100 by 100 parts (or 50 by 50, and take the middle point on the rectangle)
for-each visible layer that i have
and for each part call IdentifyGraphicsOverlayAsync or the corresponding layer
add the results to my collection

my question is, if i have 10k+(maybe even 100k+) visible object on my screen in many different layers
which way is more efficient(or maybe there's even a better way).
and is there a possibility to run those function on different(non-ui) thread


0 Kudos
0 Replies