public void ProcessFeatures(IMap map, IEnumerable<Feature> features)
{
IOverlay airOverlay = map.GetOverlay("AAMapData.Air", true);
IOverlay groundOverlay = map.GetOverlay("AAMapData.Ground", true);
groundOverlay.IsVisible = GroundDataDisplay;
airOverlay.IsVisible = AirDataDisplay;
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 (!GroundDataDisplay)
{
if (overlay.PolygonExists(feature.Id))
continue;
}
}
else
{
if (!AirDataDisplay)
{
continue;
}
}
switch (feature.Geometry.Type)
{
case GeoJSONObjectType.Point:
break;
case GeoJSONObjectType.MultiPoint:
break;
case GeoJSONObjectType.LineString:
{
if (!overlay.LineExists(feature.Id))
{
var line = (LineString)feature.Geometry;
List<PointLatLng> coordinates = line.Coordinates.OfType<GeographicPosition>()
.Select(c => new PointLatLng(c.Latitude, c.Longitude))
.ToList();
overlay.AddLine(feature.Id, coordinates, new ColorInfo { StrokeColor = 0xFFFF0000 }, feature);
}
}
break;
case GeoJSONObjectType.MultiLineString:
break;
case GeoJSONObjectType.Polygon:
{
if (!overlay.PolygonExists(feature.Id))
{
var poly = (Polygon)feature.Geometry;
List<PointLatLng> coordinates =
poly.Coordinates[0].Coordinates.OfType<GeographicPosition>()
.Select(c => new PointLatLng(c.Latitude, c.Longitude))
.ToList();
ColorInfo colorInfo = feature.ToColorInfo();
colorInfo.StrokeColor = 0xFFFF0000;
overlay.AddPolygon(feature.Id, coordinates, colorInfo, feature);
}
}
break;
case GeoJSONObjectType.MultiPolygon:
break;
case GeoJSONObjectType.GeometryCollection:
break;
case GeoJSONObjectType.Feature:
break;
case GeoJSONObjectType.FeatureCollection:
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}