Example #1
0
        public void Display(bool factoryReset = false)
        {
            Application.Current.Dispatcher.BeginInvoke(new ThreadStart(() =>
            {
                if (factoryReset)
                {
                    MapViewer.Clear();
                }
                else
                {
                    MapViewer.ClearOverlays();
                }

                foreach (var obj in Heap.Values)
                {
                    obj.Display();
                }

                if (Report != null)
                {
                    var path = new Track(VisibleTrack).ToWindowsPointArray();
                    MapViewer.AddOverlay(new TrackOverlay(path, 2)
                    {
                        Layer = (uint)OverlayLayers.Track
                    });

                    var position = path[0][0];
                    if (TrackPointer != null)
                    {
                        position = TrackPointer.Position;
                    }
                    TrackPointer = new CrosshairsOverlay(position)
                    {
                        Layer = (uint)OverlayLayers.Pointer
                    };
                    MapViewer.AddOverlay(TrackPointer);

                    MapViewer.AddOverlay(new WaypointOverlay(Report.TakeOffPoint.ToWindowsPoint(), "Take off")
                    {
                        Layer = (uint)OverlayLayers.TakeOff_And_Landing
                    });
                    MapViewer.AddOverlay(new WaypointOverlay(Report.LandingPoint.ToWindowsPoint(), "Landing")
                    {
                        Layer = (uint)OverlayLayers.TakeOff_And_Landing
                    });

                    foreach (var m in Report.Markers)
                    {
                        MapViewer.AddOverlay(new MarkerOverlay(m.ToWindowsPoint(), "Marker " + m.Name)
                        {
                            Layer = (uint)OverlayLayers.Markers
                        });
                    }
                }
                if (KeepPointerCentered)
                {
                    MapViewer.PanTo(TrackPointer.Position);
                }
            }));
        }
Example #2
0
        public override void Display()
        {
            MapOverlay overlay = null;

            if (Point != null)
            {
                uint layer;

                if (isStatic)
                {
                    layer = (uint)OverlayLayers.Static_Points;
                }
                //else if (ObjectType == "MVMD" || ObjectType == "MPDGD" || ObjectType == "MPDGF")
                //    layer = (uint)OverlayLayers.Markers;
                else
                {
                    layer = (uint)OverlayLayers.Pilot_Points;
                }
                //else
                //    layer = (uint)OverlayLayers.Reference_Points;

                switch (Definition.DisplayMode)
                {
                case "NONE":
                    break;

                case "":
                case "WAYPOINT":
                {
                    overlay = new WaypointOverlay(Point.ToWindowsPoint(), Definition.ObjectName)
                    {
                        Layer = layer, Color = this.Color
                    };
                }
                break;

                case "TARGET":
                {
                    overlay = new TargetOverlay(Point.ToWindowsPoint(), radius, Definition.ObjectName)
                    {
                        Layer = layer, Color = this.Color
                    };
                }
                break;

                case "MARKER":
                {
                    overlay = new MarkerOverlay(Point.ToWindowsPoint(), Definition.ObjectName)
                    {
                        Layer = layer, Color = this.Color
                    };
                } break;

                case "CROSSHAIRS":
                {
                    overlay = new CrosshairsOverlay(Point.ToWindowsPoint())
                    {
                        Layer = layer, Color = this.Color
                    };
                }
                break;
                }
            }

            if (overlay != null)
            {
                Engine.MapViewer.AddOverlay(overlay);
            }
        }
Example #3
0
        private void InitMap()
        {
            //add a map grid
            map.AddOverlay(new CoordinateGridOverlay(1000));

            // add a random track
            var rnd      = new Random();
            var position = new Point(302263, 4609451);
            var trackLog = new Point[6000];
            var utm      = new Point(position.X, position.Y);

            trackLog[0] = position;

            double amplitude = Math.PI / 10, stroke = 10;
            double ang = 0, dist;

            for (var i = 1; i < trackLog.Length; i++)
            {
                ang        += amplitude * (rnd.NextDouble() - 0.5);
                dist        = stroke * (1 + rnd.NextDouble()) / 2;
                utm.X      += dist * Math.Cos(ang);
                utm.Y      += dist * Math.Sin(ang);
                trackLog[i] = new Point(utm.X, utm.Y);
            }
            var track = new TrackOverlay(trackLog, 2);

            track.Color = Colors.Blue;
            map.AddOverlay(track);

            //add crosshairs
            position = trackLog[rnd.Next(trackLog.Length)];
            var crosshairs = new CrosshairsOverlay(position);

            crosshairs.Color = Colors.Red;
            map.AddOverlay(crosshairs);

            //add a marker
            position = trackLog[rnd.Next(trackLog.Length)];
            var marker = new MarkerOverlay(position, "Marker 1");

            marker.Color = Colors.Green;
            map.AddOverlay(marker);

            //add a target
            position = new Point(306000, 4609000);
            var target = new TargetOverlay(position, 100, "Target 1");

            target.Color = Colors.Yellow;
            map.AddOverlay(target);

            //add a waypoint
            position = new Point(305500, 4608500);
            var waypoint = new WaypointOverlay(position, "Waypoint 1");

            waypoint.Color = Colors.Orange;
            map.AddOverlay(waypoint);

            //add a poligonal area
            var polygon = new Point[] {
                new Point(303000, 4610000),
                new Point(305000, 4610000),
                new Point(305000, 4612000),
                new Point(303000, 4612000)
            };
            var area = new PolygonalAreaOverlay(polygon, "AREA 1");

            area.Color = Colors.Orange;
            map.AddOverlay(area);

            //add a PZ
            position = new Point(308000, 4608000);
            var pz = new CircularAreaOverlay(position, 500, "BPZ1");

            pz.Color = Colors.Blue;
            map.AddOverlay(pz);

            {
                //add a distance
                var d        = Math.Sqrt(Math.Pow(marker.Position.X - target.Position.X, 2) + Math.Pow(marker.Position.Y - target.Position.Y, 2));
                var distance = new DistanceOverlay(target.Position, marker.Position, "Distance D" + Environment.NewLine + d.ToString("0m"));
                map.AddOverlay(distance);
            }

            {
                //add an angle
                var a     = Angle(track.Position, crosshairs.Position, trackLog[trackLog.Length - 1]);
                var angle = new AngleOverlay(track.Position, crosshairs.Position, trackLog[trackLog.Length - 1], "Angle alpha" + Environment.NewLine + a.ToString("0.00°"));
                map.AddOverlay(angle);
            }
        }