Skip to content

Commit

Permalink
Minor bug fix for multipolygons (ArduPilot#3252)
Browse files Browse the repository at this point in the history
Co-authored-by: rupertbenbrook <rupert@altitudeangel.com>
  • Loading branch information
rupertbenbrook and rupertbenbrook-aa authored Dec 7, 2023
1 parent 5a6d4f9 commit 743e88f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ExtLibs/AltitudeAngelWings/Service/AltitudeAngelService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,17 @@ private void ProcessFeatures(IMap map)

case GeoJSONObjectType.MultiPolygon:
// TODO: This does not work for polygons with holes and just does the outer polygon
foreach (var poly in ((MultiPolygon)feature.Geometry).Coordinates)
for (var index = 0; index < ((MultiPolygon)feature.Geometry).Coordinates.Count; index++)
{
var poly = ((MultiPolygon)feature.Geometry).Coordinates[index];
var coordinates =
poly.Coordinates[0].Coordinates.OfType<Position>()
.Select(c => new LatLong(c.Latitude, c.Longitude))
.ToList();

var colorInfo = properties.ToColorInfo(_settings.MapOpacityAdjust);
overlayFeatures.Add(new OverlayFeature(feature.Id, OverlayFeatureType.Line, coordinates, colorInfo, feature));
overlayFeatures.Add(new OverlayFeature($"{feature.Id}-{index}", OverlayFeatureType.Line,
coordinates, colorInfo, feature));
}

break;
Expand Down

0 comments on commit 743e88f

Please sign in to comment.