private void ProcessFeatures(IMap map, IEnumerable <Feature> features) { IOverlay airOverlay = map.GetOverlay("AAMapData.Air", true); IOverlay groundOverlay = map.GetOverlay("AAMapData.Ground", true); groundOverlay.IsVisible = _settings.GroundDataDisplay; airOverlay.IsVisible = _settings.AirDataDisplay; var polygons = new List <string>(); var lines = new List <string>(); foreach (Feature feature in features) { IOverlay overlay = string.Equals((string)feature.Properties.Get("category"), "airspace") ? airOverlay : groundOverlay; var altitude = ((JObject)feature.Properties.Get("altitudeFloor"))?.ToObject <Altitude>(); if (altitude == null || altitude.Meters <= 152) { if (!_settings.GroundDataDisplay) { if (overlay.PolygonExists(feature.Id)) { continue; } } } else { if (!_settings.AirDataDisplay) { continue; } } switch (feature.Geometry.Type) { case GeoJSONObjectType.Point: { var pnt = (Point)feature.Geometry; List <PointLatLng> coordinates = new List <PointLatLng>(); if (feature.Properties.ContainsKey("radius")) { var rad = double.Parse(feature.Properties["radius"].ToString()); for (int i = 0; i <= 360; i += 10) { coordinates.Add( newpos(new PointLatLng(((Position)pnt.Coordinates).Latitude, ((Position)pnt.Coordinates).Longitude), i, rad)); } } ColorInfo colorInfo = feature.ToColorInfo(); colorInfo.StrokeColor = 0xFFFF0000; overlay.AddOrUpdatePolygon(feature.Id, coordinates, colorInfo, feature); polygons.Add(feature.Id); } break; case GeoJSONObjectType.MultiPoint: break; case GeoJSONObjectType.LineString: { var line = (LineString)feature.Geometry; List <PointLatLng> coordinates = line.Coordinates.OfType <Position>() .Select(c => new PointLatLng(c.Latitude, c.Longitude)) .ToList(); overlay.AddOrUpdateLine(feature.Id, coordinates, new ColorInfo { StrokeColor = 0xFFFF0000 }, feature); lines.Add(feature.Id); } break; case GeoJSONObjectType.MultiLineString: break; case GeoJSONObjectType.Polygon: { var poly = (Polygon)feature.Geometry; List <PointLatLng> coordinates = poly.Coordinates[0].Coordinates.OfType <Position>() .Select(c => new PointLatLng(c.Latitude, c.Longitude)) .ToList(); ColorInfo colorInfo = feature.ToColorInfo(); colorInfo.StrokeColor = 0xFFFF0000; overlay.AddOrUpdatePolygon(feature.Id, coordinates, colorInfo, feature); polygons.Add(feature.Id); } break; case GeoJSONObjectType.MultiPolygon: foreach (var poly in ((MultiPolygon)feature.Geometry).Coordinates) { List <PointLatLng> coordinates = poly.Coordinates[0].Coordinates.OfType <Position>() .Select(c => new PointLatLng(c.Latitude, c.Longitude)) .ToList(); ColorInfo colorInfo = feature.ToColorInfo(); colorInfo.StrokeColor = 0xFFFF0000; overlay.AddOrUpdatePolygon(feature.Id, coordinates, colorInfo, feature); polygons.Add(feature.Id); } break; case GeoJSONObjectType.GeometryCollection: break; case GeoJSONObjectType.Feature: break; case GeoJSONObjectType.FeatureCollection: break; default: throw new ArgumentOutOfRangeException(); } } airOverlay.RemovePolygonsExcept(polygons); groundOverlay.RemovePolygonsExcept(polygons); airOverlay.RemoveLinesExcept(lines); groundOverlay.RemoveLinesExcept(lines); }