コード例 #1
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);
        }
コード例 #2
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;
         }
     }
 }
コード例 #3
0
        public void Load()
        {
            Observable.Start(() =>
            {
                try
                {
                    Status = "Loading";

                    IEnumerable <Waypoint> fixes = null;
                    IEnumerable <Waypoint> navs  = null;

                    Task <IEnumerable <Waypoint> > fixresult = Task.Run(() => fixes = LoadFixes());
                    Task <IEnumerable <Waypoint> > navresult = Task.Run(() => navs = LoadNavs());

                    Task.WaitAll(fixresult, navresult);

                    Observable.Start(() =>
                    {
                        Waypoints.Clear();
                        Waypoints.AddRange(navs);
                        Waypoints.AddRange(fixes);
                    }, RxApp.MainThreadScheduler);

                    Status = "Loaded";
                }
                catch (Exception ex)
                {
                    Status = ex.Message;
                }
            }, RxApp.TaskpoolScheduler);
        }
コード例 #4
0
ファイル: ViewerForm.cs プロジェクト: planee/WaypointCreator
        private void ViewerForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                foreach (var minimap in _minimapCache.Where(x => x.Texture != null))
                {
                    minimap.Texture.Dispose();
                    minimap.Texture = null;
                }

                ViewerSpectator = null;
                Waypoints.Clear();
                Spawnpoints.Clear();

                VbSpectator.Created -= OnCreateVbSpectator;
                VbSpectator.Dispose();
                VbSpectator         = null;
                VbWaypoint.Created -= OnCreateVbWaypoint;
                VbWaypoint.Dispose();
                VbWaypoint            = null;
                VbSpawnpoint.Created -= OnCreateVbSpawnpoint;
                VbSpawnpoint.Dispose();
                VbSpawnpoint          = null;
                VbMapTexture.Created -= OnCreateVbMapTexture;
                VbMapTexture.Dispose();
                VbMapTexture = null;

                _device.Dispose();
            }
            catch
            {
            }
        }
コード例 #5
0
ファイル: ObjAIBase.cs プロジェクト: agentran/GameServer
 public void DashToTarget(ITarget t, float dashSpeed, float followTargetMaxDistance, float backDistance, float travelTime)
 {
     // TODO: Take into account the rest of the arguments
     IsDashing = true;
     Target    = t;
     Waypoints.Clear();
 }
コード例 #6
0
ファイル: BMSClient.cs プロジェクト: BeePerNet/UMFDExtractor
        void Load(FlightData data)
        {
            loaded = true;
            //Load waypoints

            List <Waypoint> waypoints = new List <Waypoint>();

            foreach (var val in data.StringData.data.Where(x => x.strId == 0x21))
            {
                //NP:1,WP,7.7571525E5,1.307072E6,-1E1,-1E1;
                string[] values = val.value.Split(',');
                if (values.Length > 3)
                {
                    waypoints.Add(new Waypoint(WaypointType.Waypoint, values[0].Substring(3),
                                               double.Parse(values[2], CultureInfo.InvariantCulture),
                                               double.Parse(values[3], CultureInfo.InvariantCulture),
                                               double.Parse(values[4], CultureInfo.InvariantCulture)
                                               ));
                }
            }

            Observable.Start(() =>
            {
                Waypoints.Clear();
                if (waypoints.Count > 0)
                {
                    Waypoints.AddRange(waypoints);
                }
            }, RxApp.MainThreadScheduler);
        }
コード例 #7
0
 public void DashToTarget(ITarget t, float dashSpeed, float followTargetMaxDistance, float backDistance, float travelTime)
 {
     // TODO: Take into account the rest of the arguments
     IsDashing        = true;
     Target           = t;
     _dashTime        = this.GetDistanceTo(t) / (dashSpeed * 0.001f);
     _dashElapsedTime = 0;
     DashSpeed        = dashSpeed;
     Waypoints.Clear();
 }
コード例 #8
0
 public void ClearAllWaypoints()
 {
     lock (ActiveRouteLock)
     {
         ActiveRoute.Clear();
         Waypoints.Clear();
     }
     routeNeedsUpdate  = true;
     esiSendRouteClear = true;
 }
コード例 #9
0
 /// <summary>
 /// This function removes a waypoint from the system waypoint list, it is called in SystemMap.cs and connects the UI to the backend.
 /// </summary>
 /// <param name="Remove"></param>
 public void RemoveWaypoint(Waypoint Remove)
 {
     if (Waypoints.Count == 1)
     {
         Waypoints.Clear();
     }
     else
     {
         Waypoints.Remove(Remove);
     }
 }
コード例 #10
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);
                }
            }
        }
コード例 #11
0
ファイル: Control.xaml.cs プロジェクト: pheijmans-zz/GAPP
 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;
 }
コード例 #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;
        }
コード例 #13
0
 /// <summary>
 /// This function removes a waypoint from the system waypoint list, it is called in SystemMap.cs and connects the UI to the backend.
 /// </summary>
 /// <param name="Remove"></param>
 public void RemoveWaypoint(Waypoint Remove)
 {
     //logger.Info("Waypoint Removed.");
     //logger.Info(Remove.XSystem.ToString());
     //logger.Info(Remove.YSystem.ToString());
     if (Waypoints.Count == 1)
     {
         Waypoints.Clear();
     }
     else
     {
         Waypoints.Remove(Remove);
     }
 }
コード例 #14
0
        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);
        }
コード例 #15
0
ファイル: LocalCharacter.cs プロジェクト: luccion/SMT
        /// <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;
        }
コード例 #16
0
ファイル: LocalCharacter.cs プロジェクト: afarazit/SMT
        /// <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;
 *          }
 */
        }
コード例 #17
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));
            }
        }
コード例 #18
0
ファイル: Unit.cs プロジェクト: Teafuu/CrestfallenTLWBackend
        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);
            }
        }
コード例 #19
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);
                    }
                }
            }
        }
コード例 #20
0
        public void SetDestination(Vector2Int destinationCell)
        {
            var map = Entity ? Entity.Map ? Entity.Map : Locator.City ? Locator.City.Map : null : null;

            if (!map)
            {
                this.Log($"Pathfinding can not find path without being registered in a map.", LogType.Warning);
                return;
            }

            Waypoints.Clear();
            DestinationChanged?.Invoke(this, new CellEventArgs(destinationCell));

            this.Log($"Pathfinding sending entity from {Entity.CellPosition} to {destinationCell}");

            if (CellPosition == destinationCell)
            {
                this.Log($"Pathfinding entity was already at {destinationCell}");

                DestinationReached?.Invoke(this, new CellEventArgs(destinationCell));
                return;
            }

            var newWaypoints = Path.FindPath(CellPosition, destinationCell, map);

            Waypoints = newWaypoints ?? new Queue <Vector2Int>();

            if (Waypoints.Count == 0)
            {
                this.Log($"Pathfinding couldn't find a path!", LogType.Warning);

                DestinationReached?.Invoke(this, new CellEventArgs(destinationCell));
            }
            else
            {
                TotalWaypoints = Waypoints.Count;
            }
        }
コード例 #21
0
ファイル: Servo.cs プロジェクト: Beskamir/iServo
 public void ReturnHome()
 {
     Waypoints.Clear();
     Waypoints.Enqueue(HomeVector2);
     TempWaypoints.Clear();
 }
コード例 #22
0
 internal void Restart(DataWaypoint newOrigin)
 {
     Waypoints.Clear();
     Waypoints.AddLast(newOrigin);
 }
コード例 #23
0
ファイル: Navigation.cs プロジェクト: raboley/XPathfinder
 /// <summary>
 /// Clears the waypoints and grid.
 /// </summary>
 public void ClearWaypointsAndGrid()
 {
     Waypoints.Clear();
 }