I would like to more accurately determine if a Location is in a MapShape, or whether two MapShape intersect each other.
At present, I use something like
This only uses the bounding rectangle, so if I have a MapPolygon, then I can possibly get a hit outside of the actual shape boundaries
The problem becomes more compounded when I need to look for the intersection of two shapes
One point to note is that because I only have MapPolygons ort MapPaths in my layer I can check the GeographicalBounds for the Intesection. If I have MapRectangles or MapEllipses then I do not get a hit, unless I set the MapControl.
Hope you can help
Thanks
Simon
At present, I use something like
LocationRect? selectionRect = null; foreach(MapShape shape in Items) { LocationRect shapeLocationRect = shape.GeographicalBounds; shapeLocationRect.MapControl = MapControl; if (shapeLocationRect.Contains(location)) { selectionRect = shapeLocationRect; break; } }This only uses the bounding rectangle, so if I have a MapPolygon, then I can possibly get a hit outside of the actual shape boundaries
The problem becomes more compounded when I need to look for the intersection of two shapes
foreach (var layerItem in layer.Items) { if (layerItem is MapShape) { MapShape mapShape = (MapShape)layerItem; if (selectionRect.HasValue && mapShape.GeographicalBounds.Intersect(selectionRect.Value)) { } } } One point to note is that because I only have MapPolygons ort MapPaths in my layer I can check the GeographicalBounds for the Intesection. If I have MapRectangles or MapEllipses then I do not get a hit, unless I set the MapControl.
Hope you can help
Thanks
Simon