Polyline in Graphics Layer Intersect with X-Y

349
1
12-05-2010 05:55 PM
HenryKo
New Contributor III
Hi,

I have a graphics layer with polylines. How do I find the polylines in the graphics layer that intersect with an (x,y) point? I am using Flex API 1.3.

I have done something similar to the following but it does not work (all points are in projected mercator units):


public function FindIntersectingRoutes(mapPoint: Geometry): Array
{
    var result: Array = new Array();

    var allRoutes: Array = (myGraphicsLayer.graphicProvider as ArrayCollection).toArray();

    for each (var g: Graphic in allRoutes)
    {
        var pt: MapPoint = (mapPoint as MapPoint);

        var l: Polyline = g.geometry as Polyline;

        if (l.extent.intersects(pt))
            result.push(g);
    }

    return result;
}

Thanks.
Tags (2)
0 Kudos
1 Reply
HenryKo
New Contributor III
Hi, anyone can help with this? Thanks. 🙂
0 Kudos