static void UpdateFootprintMapLayer(Mode mode, PlatformState state, OverlayShapeMapLayer mapLayer) { mapLayer.Clear(); var initialGeo = state.PlatformLocation.Location; var footprintArcStartBearing = state.PlatformLocation.Course + mode.RelativeBeamAngle - (Math.Abs(mode.HorizontalBeamWidth / 2)); var footprintArcEndBearing = state.PlatformLocation.Course + mode.RelativeBeamAngle + (Math.Abs(mode.HorizontalBeamWidth / 2)); var geos = new List<Geo>(); if (mode.HorizontalBeamWidth < 360) geos.Add(initialGeo); for (var arcPointBearing = footprintArcStartBearing; arcPointBearing < footprintArcEndBearing; arcPointBearing++) geos.Add(initialGeo.Offset(Geo.MetersToRadians(mode.MaxPropagationRadius), Geo.DegreesToRadians(arcPointBearing))); geos.Add(initialGeo.Offset(Geo.MetersToRadians(mode.MaxPropagationRadius), Geo.DegreesToRadians(footprintArcEndBearing))); geos.Add(mode.HorizontalBeamWidth < 360 ? initialGeo : initialGeo.Offset(Geo.MetersToRadians(mode.MaxPropagationRadius), Geo.DegreesToRadians(footprintArcStartBearing))); mapLayer.AddPolygon(geos); mapLayer.Done(); }
static List<OverlayShapeMapLayer> CreateFootprintMapLayers(Platform platform, PlatformState state) { var result = new List<OverlayShapeMapLayer>(); foreach (var mode in from source in platform.Sources from mode in source.Modes orderby mode.ModeID select mode) { var mapLayer = new OverlayShapeMapLayer { Name = string.Format("{0}-footprint", mode.Guid), LineColor = Colors.Red, AreaColor = Color.FromArgb(64, 255, 0, 0), LineWidth = 2f, }; UpdateFootprintMapLayer(mode, state, mapLayer); result.Add(mapLayer); } return result; }