public void WorldPosToPixelTest(int continent, int floor, int mapid, int zoom, double worldX, double worldY,
                                        double expPixelX, double expPixelY)
        {
            var mapEntry   = GwApi.GetMapFloor(continent, floor);
            var region     = mapEntry.Regions.Values.Single(r => r.Maps.Values.Count(m => m.Id == mapid) == 1);
            var map        = region.Maps.Values.Single(m => m.Id == mapid);
            var pixelPoint = GwMapsHelper.WorldPosToPixel(map, new Gw2Point {
                X = worldX, Y = worldY
            }, zoom);

            Console.WriteLine(pixelPoint);
            var expectedPoint = new Gw2Point {
                X = expPixelX, Y = expPixelY
            };

            Assert.AreEqual(expectedPoint, pixelPoint);
        }
Exemple #2
0
        public void UpdatePosition(int mapId, Gw2Point point, Player player)
        {
            Gw2Point pixel  = GwMapsHelper.WorldPosToPixel(mapId, point, (int)Zoom);
            var      latlng = MercatorProjection.Instance.FromPixelToLatLng((long)pixel.X, (long)pixel.Y, (int)Zoom);

            marker.ToolTipText =
                String.Format(
                    "Point: {0}\n" +
                    "Pixel: {1}\n" +
                    "Lat/Long: {2}\n" +
                    "Player Name: {3}\n" +
                    "Profession: {4}\n" +
                    "Team Color: {5}\n",
                    point.ToString(),
                    pixel.ToString(),
                    latlng.ToString(),
                    player.CharacterName,
                    player.Profession,
                    player.TeamColor
                    );
            Debug.WriteLine(marker.ToolTipText);
            UpdatePosition(latlng);
        }