public Order(IEnumerable <XElement> elements)
 {
     foreach (var cElement in elements)
     {
         Waypoints.Add(cElement.Value);
     }
 }
Exemple #2
0
        /// <summary>
        /// Add Destination to the route
        /// </summary>
        /// <param name="systemID">System to set destination to</param>
        /// <param name="clear">Clear all waypoints before setting?</param>
        public void AddDestination(string systemID, bool clear)
        {
            if (clear)
            {
                Waypoints.Clear();
                ActiveRoute.Clear();
            }

            Waypoints.Add(EveManager.Instance.SystemIDToName[systemID]);

            routeNeedsUpdate = true;

            string url = @"https://esi.evetech.net/v2/ui/autopilot/waypoint/?";

            var httpData = HttpUtility.ParseQueryString(string.Empty);

            httpData["add_to_beginning"]      = "false";
            httpData["clear_other_waypoints"] = clear ? "true" : "false";
            httpData["datasource"]            = "tranquility";
            httpData["destination_id"]        = systemID;
            string httpDataStr = httpData.ToString();

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url + httpDataStr);

            request.Method        = WebRequestMethods.Http.Post;
            request.Timeout       = 20000;
            request.Proxy         = null;
            request.ContentType   = "application/json";
            request.ContentLength = 0;

            request.Headers[HttpRequestHeader.Authorization] = "Bearer " + ESIAccessToken;

            request.BeginGetResponse(new AsyncCallback(AddDestinationCallback), request);
        }
Exemple #3
0
 private void Read(XmlReader reader)
 {
     Waypoints.Clear();
     while (reader.Read())
     {
         if (reader.IsStartElement())
         {
             if (reader.Name == "trkpt" || reader.Name == "rtept")
             {
                 Waypoint wp = new Waypoint();
                 wp.Read(reader);
                 Waypoints.Add(wp);
             }
             if (reader.Name == "name")
             {
                 reader.Read();
                 this.Name = reader.Value.Trim();
             }
         }
         if (reader.NodeType == XmlNodeType.EndElement && (reader.Name == "trk" || reader.Name == "rte"))
         {
             break;
         }
     }
 }
Exemple #4
0
        private static bool ParseWaypoints(NodeStruct node, FileLoader fileLoader)
        {
            byte       type;
            NodeStruct nodeWaypoint = fileLoader.GetChildNode(node, out type);

            while (nodeWaypoint != null)
            {
                if (type != (byte)OtbmNodeTypes.Waypoint)
                {
                    return(false);
                }

                MemoryStream props;
                if (!fileLoader.GetProps(nodeWaypoint, out props))
                {
                    return(false);
                }

                //(name, new Position(x, y, z)
                Waypoints.Add(props.GetString(), new Position(props.ReadUInt16(), props.ReadUInt16(), (byte)props.ReadByte()));

                nodeWaypoint = fileLoader.GetNextNode(nodeWaypoint, out type);
            }
            return(true);
        }
Exemple #5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (Core.ApplicationData.Instance.ActiveGeocache != null)
            {
                int    index = 1;
                string code  = string.Format("{0:00}{1}", index, Core.ApplicationData.Instance.ActiveGeocache.Code.Substring(2));
                while (Core.ApplicationData.Instance.ActiveGeocache.Database.WaypointCollection.GetWaypoint(code) != null)
                {
                    index++;
                    code = string.Format("{0:00}{1}", index, Core.ApplicationData.Instance.ActiveGeocache.Code.Substring(2));
                }
                Core.Data.WaypointData wpi = new Core.Data.WaypointData();
                wpi.Code         = code;
                wpi.Comment      = "";
                wpi.DataFromDate = DateTime.Now;
                wpi.Description  = "";
                wpi.GeocacheCode = Core.ApplicationData.Instance.ActiveGeocache.Code;
                wpi.ID           = code;
                wpi.Lat          = null;
                wpi.Lon          = null;
                wpi.Name         = "";
                wpi.Time         = DateTime.Now;
                wpi.Url          = "";
                wpi.UrlName      = "";
                wpi.WPType       = Core.ApplicationData.Instance.WaypointTypes[1];

                Utils.DataAccess.AddWaypoint(Core.ApplicationData.Instance.ActiveGeocache.Database, wpi);
                var wp = Core.ApplicationData.Instance.ActiveGeocache.Database.WaypointCollection.GetWaypoint(code);
                Waypoints.Add(wp);
                SelectedWaypoint = wp;
            }
        }
        public DummyClient()
        {
            CanStart = false;

            Waypoints.Add(new Waypoint(WaypointType.Waypoint, "ZeeRo", 0, 0, 0));
            Waypoints.Add(new Waypoint(WaypointType.Waypoint, "Québec", 46.8073, -71.2072, 65, null, "CY", "CYQB"));

            filteredWaypoints = new ReadOnlyObservableCollection <Waypoint>(Waypoints);

            waypointSubscription = this.WhenAnyValue(x => x.Waypoint).Subscribe(x =>
            {
                EHSI.WorkingWaypoint = Waypoint != null;
                if (EHSI.WorkingWaypoint)
                {
                    EHSI.WaypointLatitude     = x.Latitude;
                    EHSI.WaypointLongitude    = x.Longitude;
                    EHSI.WaypointMeanAltitude = x.Altitude;

                    if (x.Bearing.HasValue)
                    {
                        EHSI.Bearing = x.Bearing.Value;
                    }
                }
                else
                {
                    EHSI.Distance = 0;
                }
            });

            Waypoint = Waypoints.First();

            EHSI.PropertyChanged += EHSI_PropertyChanged;
        }
 public void AddWaypoint(Position p, bool HighRes)
 {
     Waypoints.Add(p);
     if (HighRes)
     {
         HasHighResWaypoints = true;
     }
 }
Exemple #8
0
        /// <summary>
        /// This function adds a waypoint to the system waypoint list, it is called by SystemMap.cs and connects the UI waypoint to the back end waypoints.
        /// </summary>
        /// <param name="XSystemAU">System Position X in AU</param>
        /// <param name="YSystemAU">System Position Y in AU</param>
        public void AddWaypoint(String Title, double XSystemAU, double YSystemAU, int FactionID)
        {
            Waypoint NewWP = new Waypoint(Title, this, XSystemAU, YSystemAU, FactionID);

            Waypoints.Add(NewWP);
            //logger.Info("Waypoint added.");
            //logger.Info(XSystemAU.ToString());
            //logger.Info(YSystemAU.ToString());
        }
Exemple #9
0
 private void UpdateView()
 {
     Waypoints.Clear();
     if (Core.ApplicationData.Instance.ActiveGeocache != null)
     {
         List <Core.Data.Waypoint> wpts = Utils.DataAccess.GetWaypointsFromGeocache(Core.ApplicationData.Instance.ActiveGeocache.Database, Core.ApplicationData.Instance.ActiveGeocache.Code);
         foreach (var w in wpts)
         {
             Waypoints.Add(w);
         }
     }
     IsGeocacheSelected = Core.ApplicationData.Instance.ActiveGeocache != null;
 }
 private Waypoint GetWaypointForNode(OsmNode node)
 {
     if (Waypoints.ContainsKey(node.Id))
     {
         return(Waypoints[node.Id]);
     }
     else
     {
         Waypoint nw = new Waypoint(node);
         Waypoints.Add(node.Id, nw);
         return(nw);
     }
 }
Exemple #11
0
        private void Load_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var fileName = Helper.OpenWptFile();

            if (!string.IsNullOrEmpty(fileName))
            {
                Waypoints.Clear();
                foreach (var gwp in Helper.LoadWptFile(fileName))
                {
                    Waypoints.Add(gwp);
                }
            }
        }
Exemple #12
0
        public void Read(string xml, bool stayInGMT = false)
        {
            Waypoints.Clear();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);

            XmlNodeList nameNode = doc.GetElementsByTagName("name");

            Name = nameNode.Item(0).InnerText;

            XmlNodeList parentNode = doc.GetElementsByTagName("trkpt");

            Waypoint wpt = null;
            int      x   = 1;

            foreach (XmlNode pt in parentNode)
            {
                if (stayInGMT)
                {
                    wpt = new Waypoint
                    {
                        Latitude  = double.Parse(pt.Attributes["lat"].Value),
                        Longitude = double.Parse(pt.Attributes["lon"].Value),

                        Time = (DateTime)DateTimeOffset.Parse(pt.InnerText).DateTime,
                        Name = x.ToString()
                    };
                }
                else
                {
                    wpt = new Waypoint
                    {
                        Latitude  = double.Parse(pt.Attributes["lat"].Value),
                        Longitude = double.Parse(pt.Attributes["lon"].Value),

                        //BEWARE: pt.inner text is time in GMT and when parsed
                        //it converts it to local time which could surprise you
                        Time = DateTime.Parse(pt.InnerText),
                        Name = x.ToString()
                    };
                }
                Waypoints.Add(wpt);
                x++;
            }

            var wpts = Waypoints.OrderBy(t => t.Time).ToList();

            Waypoints = wpts;
            XMLString = xml;
        }
Exemple #13
0
        private Waypoints GetWaypointsList(string fname, bool reverse)
        {
            float     len       = 0;
            Waypoints waypoints = new Waypoints(fname);
            Vector3D  v_prev    = MakeVector(dgWaypoints.Rows[0]);

            waypoints.Add(v_prev);

            for (int i = 1; i < dgWaypoints.Rows.Count - 1; i++)
            {
                Vector3D v_cur = MakeVector(dgWaypoints.Rows[i]);
                len += v_prev.GetDistanceTo(v_cur);
                waypoints.Add(v_cur);
                v_prev = v_cur;
            }

            if (reverse)
            {
                waypoints.List.Reverse();
            }

            return(waypoints);
        }
        public JourneyViewModel(Journey j)
        {
            Distance = Units.MetersToMiles(j.Distance);
            Cost     = Convert.ToDecimal(j.Cost);
            Date     = j.Date;

            Waypoints.Clear();

            foreach (var w in j.Waypoints)
            {
                Waypoints.Add(w);
            }

            var originWaypoint      = Waypoints.OrderBy(w => w.Step).First();
            var destinationWaypoint = Waypoints.OrderBy(w => w.Step).Last();

            OriginAddress = new Address
            {
                Label     = originWaypoint.Label,
                Latitude  = originWaypoint.Latitude,
                Longitude = originWaypoint.Longitude,
                PlaceId   = originWaypoint.PlaceId
            };

            DestinationAddress = new Address
            {
                Label     = destinationWaypoint.Label,
                Latitude  = destinationWaypoint.Latitude,
                Longitude = destinationWaypoint.Longitude,
                PlaceId   = destinationWaypoint.PlaceId
            };

            if (Waypoints.Count() > 2)
            {
                Gps = true;
            }
            else
            {
                Manual = true;
            }

            Invoiced   = j.Invoiced;
            Passengers = j.Passengers;
            Vehicle    = j.Vehicle;
            Company    = j.Company;
            Reason     = j.Reason;

            ShareCommand = new Command(Share);
        }
        internal void SaveWaypoints(int playerId, List <Waypoint> waypoints)
        {
            Waypoints.RemoveAll(wp => wp.OwnerPlayerId == playerId);

            foreach (var waypoint in waypoints)
            {
                Waypoints.Add(new MapWaypoint
                {
                    Id               = waypoint.entityId,
                    Name             = waypoint.name,
                    WaypointPosition = waypoint.pos,
                    OwnerPlayerId    = playerId
                });
            }
        }
        public void Save_CheckIfTheItemsArePersist_ResultTheSameTripCollection()
        {
            WaypointsRepository repository = WaypointsRepositoryFactory.Create();

            Waypoints waypoints = new Waypoints();
            waypoints.Add(CreateWaypoint());

            Task.Run(() => repository.SaveAsync(waypoints)).Wait();

            Waypoints savedWaypoints = null;
            Task.Run(() => savedWaypoints = repository.LoadAsync().Result).Wait();

            Assert.AreEqual(1, savedWaypoints.Count);
            Assert.IsNotNull(savedWaypoints[0].Position);
        }
Exemple #17
0
        /// <summary>
        /// Creates a new waypoint that serves as the handover point for an elevator.
        /// </summary>
        /// <param name="id">The ID of the waypoint.</param>
        /// <param name="tier">The position (tier).</param>
        /// <param name="x">The position (x-coordinate).</param>
        /// <param name="y">The position (y-coordinate).</param>
        /// <param name="elevator">The elevator.</param>
        /// <param name="isQueueWaypoint">Indicates whether this waypoint is also a queue waypoint.</param>
        /// <returns>The newly created waypoint.</returns>
        public Waypoint CreateWaypoint(int id, Tier tier, Elevator elevator, double x, double y, bool isQueueWaypoint)
        {
            Waypoint wp = new Waypoint(this)
            {
                ID = id, X = x, Y = y, Elevator = elevator, IsQueueWaypoint = isQueueWaypoint
            };

            tier.AddWaypoint(wp);
            Waypoints.Add(wp);
            WaypointGraph.Add(wp);
            _idToWaypoint[wp.ID] = wp;
            // Set volatile ID
            SetVolatileIDForWaypoint(wp);
            // Return
            return(wp);
        }
Exemple #18
0
        /// <summary>
        /// Add Destination to the route
        /// </summary>
        /// <param name="systemID">System to set destination to</param>
        /// <param name="clear">Clear all waypoints before setting?</param>
        public void AddDestination(long systemID, bool clear)
        {
            lock (ActiveRouteLock)
            {
                if (clear)
                {
                    Waypoints.Clear();
                    ActiveRoute.Clear();
                }
            }

            Waypoints.Add(EveManager.Instance.SystemIDToName[systemID]);

            routeNeedsUpdate    = true;
            esiRouteNeedsUpdate = true;
        }
Exemple #19
0
        /// <summary>
        /// Creates a typical waypoint.
        /// </summary>
        /// <param name="id">The ID of the waypoint.</param>
        /// <param name="tier">The position (tier).</param>
        /// <param name="x">The position (x-coordinate).</param>
        /// <param name="y">The position (y-coordinate).</param>
        /// <param name="podStorageLocation">Indicates whether the waypoint serves as a storage location.</param>
        /// <param name="isQueueWaypoint">Indicates whether the waypoint belongs to a queue.</param>
        /// <returns>The newly created waypoint.</returns>
        public Waypoint CreateWaypoint(int id, Tier tier, double x, double y, bool podStorageLocation, bool isQueueWaypoint)
        {
            Waypoint wp = new Waypoint(this)
            {
                ID = id, Tier = tier, X = x, Y = y, PodStorageLocation = podStorageLocation, IsQueueWaypoint = isQueueWaypoint
            };

            tier.AddWaypoint(wp);
            Waypoints.Add(wp);
            WaypointGraph.Add(wp);
            _idToWaypoint[wp.ID] = wp;
            // Set volatile ID
            SetVolatileIDForWaypoint(wp);
            // Return
            return(wp);
        }
Exemple #20
0
        /// <summary>
        /// Creates a new waypoint that serves as the handover point for an output station.
        /// </summary>
        /// <param name="id">The ID of the waypoint.</param>
        /// <param name="tier">The position (tier).</param>
        /// <param name="station">The station.</param>
        /// <param name="isQueueWaypoint">Indicates whether this waypoint is also a queue waypoint.</param>
        /// <returns>The newly created waypoint.</returns>
        public Waypoint CreateWaypoint(int id, Tier tier, OutputStation station, bool isQueueWaypoint)
        {
            Waypoint wp = new Waypoint(this)
            {
                ID = id, X = station.X, Y = station.Y, Radius = station.Radius, OutputStation = station, IsQueueWaypoint = isQueueWaypoint
            };

            station.Waypoint = wp;
            tier.AddWaypoint(wp);
            Waypoints.Add(wp);
            WaypointGraph.Add(wp);
            _idToWaypoint[wp.ID] = wp;
            // Set volatile ID
            SetVolatileIDForWaypoint(wp);
            // Return
            return(wp);
        }
        public void Save_CheckIfTheItemsArePersist_ResultTheSameTripCollection()
        {
            WaypointsRepository repository = WaypointsRepositoryFactory.Create();

            Waypoints waypoints = new Waypoints();

            waypoints.Add(CreateWaypoint());

            Task.Run(() => repository.SaveAsync(waypoints)).Wait();

            Waypoints savedWaypoints = null;

            Task.Run(() => savedWaypoints = repository.LoadAsync().Result).Wait();

            Assert.AreEqual(1, savedWaypoints.Count);
            Assert.IsNotNull(savedWaypoints[0].Position);
        }
Exemple #22
0
        /// <summary>
        /// Creates a new waypoint that serves as a storage location.
        /// </summary>
        /// <param name="id">The ID of the waypoint.</param>
        /// <param name="tier">The position (tier).</param>
        /// <param name="pod">The pod currently stored at it.</param>
        /// <returns>The newly created waypoint.</returns>
        public Waypoint CreateWaypoint(int id, Tier tier, Pod pod)
        {
            Waypoint wp = new Waypoint(this)
            {
                ID = id, X = pod.X, Y = pod.Y, Radius = pod.Radius, PodStorageLocation = true, Pod = pod
            };

            pod.Waypoint = wp;
            tier.AddWaypoint(wp);
            Waypoints.Add(wp);
            WaypointGraph.Add(wp);
            _idToWaypoint[wp.ID] = wp;
            // Set volatile ID
            SetVolatileIDForWaypoint(wp);
            // Return
            return(wp);
        }
Exemple #23
0
        /// <summary>
        /// Add Destination to the route
        /// </summary>
        /// <param name="systemID">System to set destination to</param>
        /// <param name="clear">Clear all waypoints before setting?</param>
        public async void AddDestination(long systemID, bool clear)
        {
            if (clear)
            {
                Waypoints.Clear();
                ActiveRoute.Clear();
            }

            Waypoints.Add(EveManager.Instance.SystemIDToName[systemID]);


            UpdateActiveRoute();


            ESI.NET.EsiClient esiClient = EveManager.Instance.ESIClient;
            esiClient.SetCharacterData(ESIAuthData);

            bool firstRoute = true;

            foreach (Navigation.RoutePoint rp in ActiveRoute)
            {
                // explicitly add interim waypoints for ansiblex gates or actual waypoints
                if (rp.GateToTake == Navigation.GateType.Ansibex || Waypoints.Contains(rp.SystemName))
                {
                    long wayPointSysID = EveManager.Instance.GetEveSystem(rp.SystemName).ID;
                    ESI.NET.EsiResponse <string> esr = await esiClient.UserInterface.Waypoint(wayPointSysID, false, firstRoute);

                    if (EVEData.ESIHelpers.ValidateESICall <string>(esr))
                    {
                        routeNeedsUpdate = true;
                    }

                    firstRoute = false;
                }
            }

/*
 *          ESI.NET.EsiResponse<string> esr = await esiClient.UserInterface.Waypoint(systemID, false, true);
 *          if(EVEData.ESIHelpers.ValidateESICall<string>(esr))
 *          {
 *              routeNeedsUpdate = true;
 *          }
 */
        }
Exemple #24
0
        public void UpdateWaypointGroup()
        {
            if (m_WaypointGroup == null || m_WaypointGroup.transform.childCount == 0)
            {
                return;
            }

            Reset();

            for (int i = 0; i < m_WaypointGroup.transform.childCount; i++)
            {
                GameObject _object = m_WaypointGroup.transform.GetChild(i).gameObject;

                if (_object)
                {
                    Waypoints.Add(new WaypointObject(_object));
                }
            }
        }
Exemple #25
0
        public void Copy(WaypointList _object)
        {
            if (_object == null)
            {
                return;
            }

            Foldout = _object.Foldout;

            Identifier = _object.Identifier;
            Order      = _object.Order;
            Ascending  = _object.Ascending;

            Waypoints.Clear();
            foreach (WaypointObject _waypoint in _object.Waypoints)
            {
                Waypoints.Add(new WaypointObject(_waypoint));
            }
        }
Exemple #26
0
        public IEnumerable <IResult> Save()
        {
            var waypoint = new Waypoint
            {
                Title       = this.Title,
                CreatedDate = DateTime.Now,
                Description = this.Description,
                Position    = new GPSPosition {
                    Latitude = this.Latitude, Longitude = this.Longitude,
                },
            };
            var waypoints = new Waypoints();

            waypoints.Add(waypoint);

            yield return(new SaveResult(waypoints));

            GoBack();
        }
        /// <summary>
        /// Adds a waypoint to the edge
        /// </summary>
        /// <param name="xWaypoint">The waypoint to add</param>
        public void AddWayPoint(XElement xWaypoint)
        {
            double x = 0;
            double y = 0;

            var attr = BpmnNM.GetAttributeValue(xWaypoint, BpmnNM.Di, BpmnDiConstants.XAttribute);

            if (attr != null)
            {
                x = double.Parse(attr, CultureInfo.InvariantCulture);
            }
            attr = BpmnNM.GetAttributeValue(xWaypoint, BpmnNM.Di, BpmnDiConstants.YAttribute);
            if (attr != null)
            {
                y = double.Parse(attr, CultureInfo.InvariantCulture);
            }

            var tuple = new PointD(x, y);

            Waypoints.Add(tuple);
        }
Exemple #28
0
        /// <summary>
        /// Gets the waypoints.
        /// </summary>
        public unsafe void GetWaypoints()
        {
            Waypoints.Clear();
            if (pathpoints() > 0)
            {
                double *xitems;
                double *zitems;
                int     itemsCount;

                using (FFXINAV.Get_WayPoints_Wrapper(out xitems, out zitems, out itemsCount))
                {
                    for (int i = 0; i < itemsCount; i++)
                    {
                        var position = new position_t {
                            X = (float)xitems[i], Z = (float)zitems[i]
                        };
                        Waypoints.Add(position);
                    }
                }
            }
        }
Exemple #29
0
        private bool ReconstructPath(Tile start, Tile[] recordedResult)
        {
            Waypoints.Clear();

            for (Tile tile = Grid.Goal; tile != null; tile = recordedResult[tile.Index])
            {
                Waypoints.Add(tile);
            }

            Waypoints.Reverse();
            Position = Waypoints[0].Position;
            Logger.Log($"Calculated path from: {start.Position.X},{start.Position.Y} -> {Waypoints.Last().Position.X},{Waypoints.Last().Position.Y}");
            if (Waypoints.Count > 0)
            {
                return(Waypoints[0] == start);
            }
            else
            {
                return(false);
            }
        }
Exemple #30
0
        public MainPageViewModel(IUiService uiService, MenuBarViewModel menuBarViewModel)
            : base(uiService)
        {
            AddLocationsPopup = menuBarViewModel;

            IsAddLocationsPopupVisible = false;
            LoadAddLocationsPopupMenuItems();

            DisplayName = "Where Am I";

            WaypointsRepository repository = WaypointsRepositoryFactory.Create();
            Waypoints           waypoints  = new Waypoints();

            waypoints.Add(CreateWaypoint());

            Waypoints savedWaypoints = null;

            Task.Run(() => savedWaypoints = repository.LoadAsync().Result).Wait();

            //TODO: Delete!!!
            if (savedWaypoints.Count == 0)
            {
                savedWaypoints.PopulateWithMockData();
                repository.SaveAsync(savedWaypoints);
            }

            WaypointList = new ObservableCollection <Waypoint>(savedWaypoints.ToArray());
            var location = GetCurrentLocation();

            if (location == null)
            {
                MessageDialog message = new MessageDialog("GPSLocationNotResolved");
                Task.Run(() => message.ShowAsync()).Wait();
            }
            else
            {
                CurrentLocationLatitude  = location.Latitude;
                CurrentLocationLongitude = location.Longitude;
            }
        }
        public MainPageViewModel(IUiService uiService, MenuBarViewModel menuBarViewModel)
            : base(uiService)
        {
            AddLocationsPopup = menuBarViewModel;

            IsAddLocationsPopupVisible = false;
            LoadAddLocationsPopupMenuItems();

            DisplayName = "Where Am I";

            WaypointsRepository repository = WaypointsRepositoryFactory.Create();
            Waypoints waypoints = new Waypoints();
            waypoints.Add(CreateWaypoint());

            Waypoints savedWaypoints = null;
            Task.Run(() => savedWaypoints = repository.LoadAsync().Result).Wait();

            //TODO: Delete!!!
            if (savedWaypoints.Count == 0)
            {
                savedWaypoints.PopulateWithMockData();
                repository.SaveAsync(savedWaypoints);
            }

            WaypointList = new ObservableCollection<Waypoint>(savedWaypoints.ToArray());
            var location = GetCurrentLocation();
            if (location == null)
            {
                MessageDialog message = new MessageDialog("GPSLocationNotResolved");
                Task.Run(() => message.ShowAsync()).Wait();
            }
            else
            {
                CurrentLocationLatitude = location.Latitude;
                CurrentLocationLongitude = location.Longitude;
            }
        }
Exemple #32
0
        /// <summary>
        /// This function adds a waypoint to the system waypoint list, it is called by SystemMap.cs and connects the UI waypoint to the back end waypoints.
        /// </summary>
        /// <param name="X">System Position X in AU</param>
        /// <param name="Y">System Position Y in AU</param>
        public void AddWaypoint(String Title, double X, double Y, int FactionID)
        {
            Waypoint NewWP = new Waypoint(Title, this, X, Y, FactionID);

            Waypoints.Add(NewWP);
        }
        public IEnumerable<IResult> Save()
        {
            var waypoint = new Waypoint
            {
                Title = this.Title,
                CreatedDate = DateTime.Now,
                Description = this.Description,
                Position = new GPSPosition { Latitude = this.Latitude, Longitude = this.Longitude, },
            };
            var waypoints = new Waypoints ();
            waypoints.Add(waypoint);

            yield return new SaveResult(waypoints);

            GoBack();
        }
Exemple #34
0
        private Waypoints GetWaypointsList(string fname, bool reverse)
        {
            float len = 0;
            Waypoints waypoints = new Waypoints(fname);
            Vector3D v_prev = MakeVector(dgWaypoints.Rows[0]);
            waypoints.Add(v_prev);

            for (int i = 1; i < dgWaypoints.Rows.Count - 1; i++)
            {
                Vector3D v_cur = MakeVector(dgWaypoints.Rows[i]);
                len += v_prev.GetDistanceTo(v_cur);
                waypoints.Add(v_cur);
                v_prev = v_cur;
            }

            if (reverse)
                waypoints.List.Reverse();

            return waypoints;
        }