Ejemplo n.º 1
0
 private void SaveMissionCommandExecute()
 {
     MissionSource.SaveMission();
 }
Ejemplo n.º 2
0
        private void MapMouseLeftButtonDownAction(MapMouseLeftButtonDownMessenger obj)
        {
            int DistanceDefault = 50;

            if (VehicleSelected == null)
            {
                return;
            }

            if (InsertHoverPoint)
            {
                //Target
                //var a = Utils.Utils.DegreeBearing(VehicleSelected.Latitude, VehicleSelected.Longitude, obj.Latitude,obj.Longitude);

                var convertPoint = new ObservableCollection <Waypoint>();

                var x = VehicleSelected.Latitude;
                var y = VehicleSelected.Longitude;
                //Utils.Utils.ConvertMercatorToGeo(ref y, ref x);

                /*var bearing = Utils.Utils.DegreeBearing(VehicleSelected.Latitude, VehicleSelected.Longitude, obj.Latitude,obj.Longitude);
                 * var distance = Utils.Utils.CalculateDistance(VehicleSelected.Latitude, VehicleSelected.Longitude,
                 *                                           obj.Latitude, obj.Longitude, "K") *1000;
                 * if (distance > DistanceDefault)
                 * {
                 *  Utils.Utils.PointRadialDistance(ref x, ref y, bearing, DistanceDefault);
                 * }*/
                convertPoint.Add(new MavlinkWaypoint
                {
                    Latitude  = x,
                    Longitude = y,
                    Altitude  = DefaultAltitude,
                    Id        = 1,
                    Param4    = (float)VehicleSelected.Heading,
                    Command   = (ushort)MissionMavCmd.WAYPOINT,
                });

                convertPoint.Add(new MavlinkWaypoint
                {
                    Latitude  = obj.Latitude,
                    Longitude = obj.Longitude,
                    Altitude  = DefaultAltitude,
                    Id        = 2,
                    Command   = (ushort)MissionMavCmd.WAYPOINT,
                });


                var task = new MavlinkTaskNav("HoverTask", TaskID)
                {
                    NavPath  = convertPoint,
                    TaskType = TaskTypeEnum.Hoverrer
                };

                MissionSource.AddTask(task);
                VehicleSelected.Tasks.Clear();
                VehicleSelected.Tasks.Add(task);
                var newShape = new Shape(TaskID, convertPoint)
                {
                    Symbol = (LineSymbol)Application.Current.FindResource("LineSymbol")
                };

                ServiceLocator.Current.GetInstance <IMap>().AddShape(newShape);

                //MissionComponent.UploadTask(VehicleSelected.ID,
                //                            VehicleSelected.HomePosition,
                //                            new MavlinkWaypoint
                //                                {
                //                                    Latitude = VehicleSelected.Latitude,
                //                                    Longitude = VehicleSelected.Longitude,
                //                                    Altitude = DefaultAltitude,
                //                                    Param4 = (float) VehicleSelected.Heading
                //                                },
                //                            VehicleSelected.Tasks[0]);
                VehicleSelected.IsActivateMission = false;
                MissionComponent.UploadTask(VehicleSelected.ID, VehicleSelected.HomePosition, null, VehicleSelected.Tasks[0]);

                VehicleSelected.MissionID = VehicleSelected.Tasks[0].TaskID;
            }
        }
Ejemplo n.º 3
0
 private void OpenMissionCommandExecute()
 {
     MissionSource.LoadMission();
 }