public CategoryDto Handle(GetCategoryByIdQuery query)
            {
                var category    = _categoryQueryRepository.GetById(query.Id);
                var categoryDto = MapService.Map(category);

                return(categoryDto);
            }
Example #2
0
            public List <CategoryDto> Handle(GetCategoryByPartialNameQuery query)
            {
                var categories     = _categoryQueryRepository.GetByPartialName(query.CategoryName);
                var categoriesDtos = MapService.Map(categories);

                return(categoriesDtos);
            }
        private async void OnSignup()
        {
            if (!await IsValidated())
            {
                return;
            }

            await Task.Run(async() =>
            {
                IsBusy = true;

                var result = await _restService.CreateUser(MapService.ToModel(this));

                Device.BeginInvokeOnMainThread(async() =>
                {
                    if (result.StatusCode != System.Net.HttpStatusCode.OK)
                    {
                        await DisplayAlert("Warning", "You can't create login at this time!", "OK");

                        return;
                    }
                });

                IsBusy = false;
            });


            await Navigation.PushAsync(new LoginView());
        }
Example #4
0
        public LocationPage()
        {
            InitializeComponent();
            var ms = new MapService();

            MapData = ms.SetUpMap(Location);
        }
Example #5
0
        public static void ServerStart(string str)
        {
            Console.WriteLine("Loading Data Access Objects.\n"
                              + "-------------------------------------------");

            DAOManager.Initialize(str);

            Console.WriteLine("Loading Data Files.\n"
                              + "-------------------------------------------");

            Data.Data.LoadAll();
            Data.Cache.LoadData();

            StatsService.Init();
            GeoService.Init();
            MapService.Init();
            QuestEngine.Init();
            SkillEngine.Init();
            ActionEngine.Init();
            SkillsLearnService.Init();
            AreaService.Init();
            GuildService.Init();

            InitMainLoop();
        }
Example #6
0
        private async Task <EntityDto> ToEntityDto(Guid e)
        {
            var           entity   = GrainFactory.GetGrain <IEntity>(e);
            PositionState position = await GrainFactory.Get <IPosition>(e).GetData();

            float?maxSpeed = null;
            float?hp       = null;

            if (await entity.Has <IUnit>())
            {
                var unit = GrainFactory.Get <IUnit>(e);
                hp = await unit.GetHp();

                maxSpeed = await MapService.GetEntityActualMaxSpeed(entity);
            }

            var dto = new EntityDto
            {
                Name     = await entity.GetName(),
                Pos      = position,
                Id       = e,
                Hp       = hp,
                MaxSpeed = maxSpeed
            };

            return(dto);
        }
Example #7
0
        private void AddServices(string folder)
        {
            foreach (var mapFileInfo in new DirectoryInfo((Options.ServicesPath + "/" + folder).ToPlatformPath()).GetFiles("*.mxl"))
            {
                string mapName = String.Empty;
                try
                {
                    if (TryAddService(mapFileInfo, folder) == null)
                    {
                        throw new Exception("unable to load servive: " + mapFileInfo.FullName);
                    }
                }
                catch (Exception ex)
                {
                    _logger.LogError($"Service { mapName }: loadConfig - { mapFileInfo.Name  }: { ex.Message }");
                }
            }

            #region Add Folders on same level

            foreach (var folderDirectory in new DirectoryInfo((Options.ServicesPath + "/" + folder).ToPlatformPath()).GetDirectories())
            {
                MapService folderService = new MapService(this, folderDirectory.FullName, folder, MapServiceType.Folder);
                if (MapServices.Where(s => s.Fullname == folderService.Fullname && s.Type == folderService.Type).Count() == 0)
                {
                    MapServices.Add(folderService);
                    Console.WriteLine("folder " + folderService.Name + " added");
                }
            }

            #endregion
        }
Example #8
0
    private void BuildRoad()
    {
        var cubeType = MapService.GetCubeType(LifeGoalTargetX, LifeGoalTargetZ);

        if (cubeType == CubeTypes.Grass)
        {
            if (GameService.RockCount > 0)
            {
                Progress += Time.deltaTime * ContinueRoadSpeed;
                if (Progress > Mathf.PI * 2f)
                {
                    GameService.RockCount--;
                    MapService.ConvertGrassToRoad(LifeGoalTargetX, LifeGoalTargetZ);
                }

                if (Progress >= Mathf.PI * 2f)
                {
                    Progress -= Mathf.PI * 2f;
                }
            }
            else
            {
                Progress = 0;
            }
        }
        else if (cubeType == CubeTypes.Road)
        {
            var next = RoadPath.Dequeue();
            LifeGoalTargetX = next.X;
            LifeGoalTargetZ = next.Z;
            ScheduleMovingSteps(new[] { next });
        }
    }
 private void Example()
 {
     // Get a service
     ServiceManager services = FindObjectOfType <ServiceManager>();
     MapService     map      = services.Provide <MapService>();
     // do whatever you want with map
 }
Example #10
0
        public void GetMapInfo(int id, string type)
        {
            try
            {
                var mapInfo = new MapDTO();
                var service = new MapService();
                switch (type)
                {
                case "scenic":    //类似是景区
                    mapInfo = service.GetMapInfo(id);
                    break;

                case "catering":    //类似是餐饮
                    mapInfo = service.GetShop(id);
                    break;

                case "hotel":    //类似是酒店
                    mapInfo = service.GetHotel(id);
                    break;
                }
                Context.Response.Write(AjaxResult.Success(mapInfo));
            }
            catch (JsonException jsEx)
            {
                Context.Response.Write(AjaxResult.Error(jsEx.Message, jsEx.ErrorType));
            }
            catch (Exception ex)
            {
                Context.Response.Write(AjaxResult.Error(ex.Message));
            }
        }
Example #11
0
        public static void Main()
        {
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = @"platforms\dotnet\examples\config\example-compute.xml",
                JvmOptions      = new List <string> {
                    "-Xms512m", "-Xmx1024m"
                }
            };

            using (var ignite = Ignition.Start(cfg))
            {
                Console.WriteLine(">>> Services example started.");
                Console.WriteLine();

                // Deploy a service
                var svc = new MapService <int, string>();
                Console.WriteLine(">>> Deploying service to all nodes...");
                ignite.GetServices().DeployNodeSingleton("service", svc);

                // Get a sticky service proxy so that we will always be contacting the same remote node.
                var prx = ignite.GetServices().GetServiceProxy <IMapService <int, string> >("service", true);

                for (var i = 0; i < 10; i++)
                {
                    prx.Put(i, i.ToString());
                }

                var mapSize = prx.Size;

                Console.WriteLine(">>> Map service size: " + mapSize);

                ignite.GetServices().CancelAll();
            }
        }
Example #12
0
            public List <CategoryDto> Handle(GetCategoryAllChildsQuery query)
            {
                var categories     = _categoryQueryRepository.GetAllChilds(query.Id);
                var categoriesDtos = MapService.Map(categories);

                return(categoriesDtos);
            }
Example #13
0
        public BoatServicesTest()
        {
            var testRepo   = new OffloadRepoTest();
            var mapService = new MapService();

            this._boatService = new BoatService(testRepo, mapService);
        }
Example #14
0
        /// <summary>
        /// Remove the used resource and Close the Map.
        /// </summary>
        public void CloseApp()
        {
            // Remove the used resource
            ClearData();

            if (win != null)
            {
                // Unrealize the Window object
                win.Unrealize();
                win = null;
            }

            // check the s_mapview
            if (s_mapview != null)
            {
                // Dispose the MapView
                s_mapview.Dispose();
                s_mapview = null;
            }

            // check the s_maps
            if (s_maps != null)
            {
                // Dispose the MapService
                s_maps.Dispose();
                s_maps = null;
            }

            Exit();
        }
        private void SetMapMember(MapView mv)
        {
            bool changed = false;

            if (mv != null)
            {
                //Was a layer selected?
                var layer = mv.GetSelectedLayers().FirstOrDefault();
                if (layer != null)
                {
                    CIMService = new MapMemberService(layer);
                    changed    = true;
                }
                else
                {
                    //Was a table selected?
                    var table = mv.GetSelectedStandaloneTables().FirstOrDefault();
                    if (table != null)
                    {
                        CIMService = new MapMemberService(table);
                        changed    = true;
                    }
                    else
                    {
                        //A Map must have been selected
                        CIMService = new MapService(mv.Map);
                        changed    = true;
                    }
                }
            }
            if (!changed && CIMService != null)
            {
                CIMService = null;
            }
        }
        public void TestExportMap()
        {
            var testProperties = MethodInfo.GetCurrentMethod().GetCustomAttributes <TestPropertyAttribute>().ToDictionary(k => k.Name, v => v.Value);
            var mapServiceUrl  = testProperties["mapServiceUrl"];

            var parameters = new ExportMapParameters
            {
                BoundingBox = new double[] {
                    -14011824.4072731,
                    5581676.67702371,
                    -12878110.4037477,
                    6375398.77873677
                },
                ResponseFormat = ExportMapResponseFormat.Image,
                ImageFormat    = ExportMapImageFormat.Png,
                Dpi            = 300,
                Size           = new int[] { 600, 800 },
                Transparent    = true
            };
            var mapService = new MapService {
                Uri = new Uri(mapServiceUrl)
            };
            Stream image = mapService.ExportMap(parameters);

            Assert.IsNotNull(image);

            using (FileStream fs = new FileStream("output.png", FileMode.Create))
            {
                image.CopyTo(fs);
            }
        }
Example #17
0
                    /// <summary><para>Die Methode <see cref="GetImage"/> versucht ein entsprechendes Bild im Cache
                    /// zu finden. Ist kein Bild vorhanden, gibt die Methode null zurück.</para></summary>
                    ///
                    /// <param name="item">Ein <see cref="MapService"/>-Objekt, welches ein Bild repräsentiert.</param>
                    /// <returns>Das Satellitenbild, oder null, wenn kein passendes Bild gefunden wurde.</returns>
                    public static Image GetImage(MapService item)
                    {
                        Image image = null;

                        _cache.TryGetValue(item, out image);
                        return(image);
                    }
Example #18
0
        public static void NpcDied(Npc npc)
        {
            var player = npc.Ai.GetKiller() as Player;

            if (player != null)
            {
                if (player.Party != null)
                {
                    foreach (Player member in PartyService.GetOnlineMembers(player.Party))
                    {
                        QuestEngine.OnPlayerKillNpc(member, npc);
                    }
                }
                else
                {
                    QuestEngine.OnPlayerKillNpc(player, npc);
                }

                player.Instance.OnNpcKill(player, npc);
            }

            if (npc.NpcTemplate.Size != NpcSize.Small)
            {
                npc.Ai.DealExp();
            }

            if (player != null)
            {
                MapService.CreateDrop(npc, player);
            }
        }
Example #19
0
        /// <summary>
        /// Request the user consent.
        /// 사용자 동의 메소드
        /// </summary>
        public async void RequestUserConsent()
        {
            // Create the MapService for the HERE provider
            // s_maps 초기화
            s_maps = new MapService("HERE", HERE_KEY);

            // Request the user consent
            // The user consent popup will be displayed if the value is false
            // 값이 false일 경우 사용자 동의 팝업이 표시됩니다.
            await s_maps.RequestUserConsent();

            // Check the user's choice in the user consent popup
            // 사용자 동의 팝업에서 사용자의 선택을 체크합니다.
            // 사용자가 동의 하지 않으면 s_maps를 Dispose하고 앱 종료.
            if (s_maps.UserConsented != true)
            {
                // Dispose the s_maps
                s_maps.Dispose();
                s_maps = null;

                // Close this app
                Exit();
            }
            else             // 사용자가 동의하면
            {
                // Create a base UI
                // 기본 UI 나오게
                Initialize();
            }
        }
 private void SetRow(DataRow row, JObject o, string inObjString = "")
 {
     foreach (JProperty p in o.Properties())
     {
         string columnName = $"{inObjString}{p.Name}";
         if (p.Value.Type == JTokenType.Object)
         {
             this.SetRow(row, p.Value as JObject, $"{columnName}:");
         }
         else if (p.Value.Type == JTokenType.Array)
         {
             this.SetRow(row, p.Value as JArray, $"{columnName}:");
         }
         else if (columnName.Contains("TextMapHash") || columnName.Contains("Tips"))
         {
             row[columnName] = MapService.GetMappedTextBy(p);
         }
         else if (columnName == "TalkRole:Id" || columnName == "NpcID")
         {
             row[columnName] = MapService.GetMappedNPCBy(p.Value.ToString());
         }
         else
         {
             row[columnName] = p.Value;
         }
     }
 }
 private void SetRow(DataRow row, JArray a, string parentColumnName = "")
 {
     for (int i = 0; i < a.Count; i++)
     {
         JToken t          = a[i];
         string columnName = $"{parentColumnName}{i}";
         if (t.Type == JTokenType.Object)
         {
             this.SetRow(row, t as JObject, $"{columnName}:");
         }
         else if (t.Type == JTokenType.Array)
         {
             this.SetRow(row, t as JArray, $"{columnName}:");
         }
         else if (columnName.Contains("TextMapHash") || columnName.Contains("Tips"))
         {
             row[columnName] = MapService.GetMappedTextBy((t as JValue).Value.ToString());
         }
         else if (columnName == "TalkRole:Id" || columnName == "NpcID")
         {
             row[columnName] = MapService.GetMappedNPCBy((t as JValue).Value.ToString());
         }
         else
         {
             row[columnName] = (t as JValue).Value;
         }
     }
 }
Example #22
0
        public void ServiceMustGet()
        {
            var service = new MapService(this.context);
            var result  = service.Get();

            Assert.NotNull(result);
        }
Example #23
0
        public LocationViewModel(Location location)
        {
            Location = location;
            var ms = new MapService();

            MapData = ms.SetUpMap(Location);
        }
Example #24
0
        public static void Main()
        {
            using (IIgnite ignite = Ignition.Start(Utils.GetServerNodeConfiguration()))
            {
                Console.WriteLine(">>> Services example started.");
                Console.WriteLine();

                // Deploy a service
                var svc = new MapService <int, string>();
                Console.WriteLine(">>> Deploying service to all nodes...");
                ignite.GetServices().DeployNodeSingleton(ServiceName, svc);

                // Get a sticky service proxy so that we will always be contacting the same remote node.
                var prx = ignite.GetServices().GetServiceProxy <IMapService <int, string> >(ServiceName, true);

                for (var i = 0; i < 10; i++)
                {
                    prx.Put(i, i.ToString());
                }

                var mapSize = prx.Size;

                Console.WriteLine(">>> Map service size: " + mapSize);

                ignite.GetServices().CancelAll();
            }

            Console.WriteLine();
            Console.WriteLine(">>> Example finished, press any key to exit ...");
            Console.ReadKey();
        }
 public PlayerController(PlayerService playerService, HeroService heroService, MapService mapService, PlayerTypeService playerTypeService)
 {
     this.playerService     = playerService;
     this.heroService       = heroService;
     this.mapService        = mapService;
     this.playerTypeService = playerTypeService;
 }
        public static void Main()
        {
            using (var ignite = Ignition.StartFromApplicationConfiguration())
            {
                Console.WriteLine(">>> Services example started.");
                Console.WriteLine();

                var svc = new MapService <int, string>();
                Console.WriteLine(">>> Deploying service to all nodes...");
                ignite.GetServices().DeployNodeSingleton("service", svc);

                var prx = ignite.GetServices().GetServiceProxy <IMapService <int, string> >("service", true);

                for (var i = 0; i < 10; i++)
                {
                    prx.Put(i, i.ToString());
                }

                var mapSize = prx.Size;

                Console.WriteLine(">>> Map service size: " + mapSize);

                ignite.GetServices().CancelAll();
            }

            Console.WriteLine();
            Console.WriteLine(">>> Example finished, press any key to exit ...");
            Console.ReadKey();
        }
        public MapView(RestaurantViewModel restaurant)
        {
            MapViewModel map       = MapService.getMapRestaurant(RestaurantViewModel.GetRestaurant(restaurant));
            var          requesMap = new Map(
                MapSpan.FromCenterAndRadius(
                    new Position(map.lat, map.lng), Distance.FromMiles(0.3)))
            {
                HeightRequest   = 100,
                WidthRequest    = 960,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            var stack = new StackLayout {
                Spacing = 0
            };

            requesMap.Pins.Add(new Pin
            {
                Type     = PinType.Generic,
                Position = new Position(map.lat, map.lng),
                Label    = restaurant.NameRestaurant,
                Address  = restaurant.AddressRestaurant
            });
            stack.Children.Add(requesMap);
            Content = stack;
        }
Example #28
0
        private MapService CreateMapService()
        {
            var userID  = Guid.Parse(User.Identity.GetUserId());
            var service = new MapService(userID);

            return(service);
        }
Example #29
0
                    /// <summary><para>Löscht ein Bild aus dem Cache.</para></summary>
                    ///
                    /// <param name="map">Ein <see cref="MapService"/>-Objekt, das das Bild repräsentiert.</param>
                    /// <returns>True, wenn ein Bild gelöscht wurde, sonst False.</returns>
                    public static bool Remove(MapService map)
                    {
                        CacheEqualityMode em = _equalityMode;

                        _equalityMode = CacheEqualityMode.MapService;

                        long key = -1;

                        foreach (KeyValuePair <long, MapService> keys in _lruList)
                        {
                            if (keys.Value == map)
                            {
                                key = keys.Key;
                                break;
                            }
                        }
                        if (key != -1)
                        {
                            if (_cache.ContainsKey(map) == true)
                            {
                                if (_cache.Remove(map) == true)
                                {
                                    _lruList.Remove(key);
                                }
                            }
                        }

                        _equalityMode = em;
                        return(key != -1);
                    }
        /// <summary>
        /// Request the user consent.
        /// </summary>
        public async void RequestUserConsent()
        {
            // Create the MapService for the HERE provider
            s_maps = new MapService("HERE", HERE_KEY);

            // Request the user consent
            // The user consent popup will be displayed if the value is false
            await s_maps.RequestUserConsent();

            // Check the user's choice in the user consent popup
            if (s_maps.UserConsented != true)
            {
                // Dispose the s_maps
                s_maps.Dispose();
                s_maps = null;

                // Close this app
                Exit();
            }
            else
            {
                // Create a base UI
                Initialize();
            }
        }
Example #31
0
        public static void Main()
        {
            using (var ignite = Ignition.Start(@"platforms\dotnet\examples\config\examples-config.xml"))
            {
                Console.WriteLine(">>> Services example started.");
                Console.WriteLine();

                // Deploy a service
                var svc = new MapService<int, string>();
                Console.WriteLine(">>> Deploying service to all nodes...");
                ignite.GetServices().DeployNodeSingleton("service", svc);

                // Get a sticky service proxy so that we will always be contacting the same remote node.
                var prx = ignite.GetServices().GetServiceProxy<IMapService<int, string>>("service", true);

                for (var i = 0; i < 10; i++)
                    prx.Put(i, i.ToString());

                var mapSize = prx.Size;

                Console.WriteLine(">>> Map service size: " + mapSize);

                ignite.GetServices().CancelAll();
            }

            Console.WriteLine();
            Console.WriteLine(">>> Example finished, press any key to exit ...");
            Console.ReadKey();
        }
        public void MapImages()
        {
            var service = new MapService();

            var filename = @"c:\tmp\image.jpg";
            service.GetMapImage(filename, -34.9859652, 138.7019549);

            Approvals.VerifyFile(filename);
        }
Example #33
0
        public TradeEngine(MapService mapService, string dataPath)
        {
            MapService = mapService;

            var file = new FileInfo(Path.Combine(dataPath, DataFileName));
            var converter = new XmlSerializer(typeof(TradeGoods));
            using (var stream = file.OpenRead())
                m_TradeGoods = ((TradeGoods)converter.Deserialize(stream)).TradeGood.ToImmutableList();

            m_LegalTradeGoods = m_TradeGoods.Where(g => g.Legal).ToImmutableList();
            m_CharacterBuilder = new CharacterBuilder(dataPath);
        }
Example #34
0
 /// <summary><para>Die interne Funktion berechnet den X/Y Bildpunkt auf einem Satellitenbild (Tile), 
 /// der den geographischen Koordinaten im übergebenen <see cref="GeoUtility.GeoSystem.Geographic"/>-Objekt entspricht.
 /// <para>Die Funktion ist nur für interne Berechnungen bestimmt.</para></para></summary>
 /// 
 /// <param name="tail">Ein <see cref="GeoUtility.GeoSystem.MapService.Info.MapServiceInternalMapTile"/>-Objekt.</param>
 /// <param name="size">Größe des Satellitenbildes (i.d.R. 256 Pixel)</param>
 /// <returns>Bildpunkt auf dem Satellitenbild als <see cref="GeoUtility.GeoSystem.Helper.GeoPoint"/>-Objekt, der den Koordinaten entspricht.</returns>
 internal GeoPoint WGSPixel(MapService.Info.MapServiceInternalMapTile tail, int size)
 {
     string key = tail.Key;                                  // Restkey, der nur die Pixelverschiebung im Bild enthält
     double left = 0, top = 0;
     double dsize = Convert.ToDouble(size);
     for (int i = 0; i < key.Length; i++)
     {
         double shift = dsize / (Math.Pow(2.0, i + 1));
         if ((key[i] == 's') || (key[i] == 't')) top += shift;
         if ((key[i] == 'r') || (key[i] == 's')) left += shift;
     }
     top = Math.Round(top, 0);
     left = Math.Round(left, 0);
     return new GeoPoint((int)left, (int)top);
 }
        public MapsViewModel(IApp app, MapService mapService, IMessageBoxService messageBoxService)
        {
            if (IsInDesignModeStatic) return;

            if (null == app) throw new ArgumentNullException("app", "app cannot be null");
            if (string.IsNullOrWhiteSpace(app.MapsApiKey)) throw new NullReferenceException("map api key must be provided");

            _mapService = mapService;
            _messageBoxService = messageBoxService;
            _mapService.AfterCompleted = AfterMapDataLoaded;
            _mapsApiKey = app.MapsApiKey;
            this.ZoomLevel = 17;

            QueueSafeDispatch(GetData);
        }
        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            /*
             Google Maps Clustering
            */
            var filepath = string.Concat(HttpContext.Current.Server.MapPath("~"), @"App_Data\Points.csv");
            var memcache = new MemCache();
            var pointsDatabase = new PointsDatabase(memcache, filepath);
            var mapService = new MapService(pointsDatabase, memcache);
            Map.MapService = mapService; // Simulate putting data in session, probably dont do this in production where you put data in static class

            RegisterRoutes();

            GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear(); // use JSON
        }
Example #37
0
        /// <summary><para>Die Funktion transformiert den internen generischen Schlüssel den Google Maps Schlüssel.
        /// <para>Die Funktion ist nur für interne Berechnungen bestimmt.</para></para></summary>
        /// 
        /// <param name="tile">Ein <see cref="MapService.Info.MapServiceInternalMapTile"/>-Objekt mit dem internen Schlüssel.</param>
        /// <returns>Ein <see cref="MapService.Info.MapServiceGoogleMapsTile"/>-Objekt mit den Zugriffsdaten auf das Satellitenbild.</returns>
        internal MapService.Info.MapServiceGoogleMapsTile InternalToGoogle(MapService.Info.MapServiceInternalMapTile tile)
        {
            string key = tile.Key;
            int zoom = key.Length - 1;
            int iExp = key.Length - 1;
            int x = 0; int y = 0;

            for (int i = 1; i < key.Length; i++)
            {
                iExp -= 1;
                string s = key.Substring(i, 1);
                if (s == "r") { x += (int)Math.Pow(2, iExp); };
                if (s == "t") { y += (int)Math.Pow(2, iExp); };
                if (s == "s") { x += (int)Math.Pow(2, iExp); y += (int)Math.Pow(2, iExp); };
            }

            return new MapService.Info.MapServiceGoogleMapsTile(x, y, zoom);
        
        }
Example #38
0
        /// <summary><para>Die Funktion transformiert den Google Maps Schlüssel in die intern benutzte Repräsentation.
        /// <para>Die Funktion ist nur für interne Berechnungen bestimmt.</para></para></summary>
        /// 
        /// <param name="tile">Ein <see cref="MapService.Info.MapServiceGoogleMapsTile"/>-Objekt mit den Zugriffsdaten auf das Satellitenbild.</param>
        /// <returns>Ein <see cref="MapService.Info.MapServiceInternalMapTile"/>-Objekt mit dem internen Schlüssel.</returns>
        internal MapService.Info.MapServiceInternalMapTile GoogleToInternal(MapService.Info.MapServiceGoogleMapsTile tile)
        {
            int x = tile.X;
            int y = tile.Y;
            int zoom = tile.Zoom;
            string key = "";
            int wert = 0;
            int exp = zoom;
            int[] keyArray = new int[zoom + 1];

            // 1. Buchstabe konstant
            keyArray[0] = 2;

            // Werte des Feldes iKey[]: q=0, r=1, t=2, s=3
            for (int i = 1; i < keyArray.Length; i++)           
            {
                exp -= 1;

                // Test auf Rechtswert
                wert = (x - (int)Math.Pow(2, exp));   
                if (wert >= 0) { keyArray[i] = 1; x = wert; }

                // Test auf Hochwert
                wert = (y - (int)Math.Pow(2, exp));       
                if (wert >= 0) { keyArray[i] += 2; y = wert; }
            }
            for (int i = 0; i < keyArray.Length; i++)
            {
                switch (keyArray[i])
                {
                    case 0: key += "q"; break;
                    case 1: key += "r"; break;
                    case 2: key += "t"; break;
                    case 3: key += "s"; break;
                }
            }

            return new MapService.Info.MapServiceInternalMapTile(key);
 
        }
 public TradeEngineMgt2(MapService mapService, string dataPath) : base(mapService, dataPath) { }
Example #40
0
    private MapResourceItem CreateMapResourceItem(MapService mapService)
    {
        Logger.Debug("Creating map resource item for service=" + mapService.ServiceName);
        GISResourceItemDefinition definition = new GISResourceItemDefinition();
        definition.DataSourceType = Properties.DataSourceType;
        definition.DataSourceDefinition = Properties.DataSourceDefinition;
        definition.Identity = Properties.Identity;
        definition.ResourceDefinition = "(default)@" + mapService.ServiceName;
        definition.DataSourceShared = true;

        MapResourceItem resourceItem = new MapResourceItem();
        resourceItem.Definition = definition;
        resourceItem.Name = mapService.DisplayName;
        resourceItem.DisplaySettings = new DisplaySettings();
        resourceItem.DisplaySettings.Visible = mapService.Visible;
        resourceItem.Parent = MapResourceManager;

        return resourceItem;
    }
        /// <summary><para>Die Funktion berechnet die linke untere Ecke und die Breite und Höhe des 
        /// aktuellen Satellitenbilds (Tiles) aus dem übergebenen internen Schlüssel.
        /// <para>Die Funktion ist nur für interne Berechnungen bestimmt.</para></para></summary>
        /// 
        /// <param name="tile">Ein <see cref="MapService.Info.MapServiceInternalMapTile"/>-Objekt mit dem internen generischen Schlüssel.</param>
        /// <returns>Koordinaten (linke untere Ecke), Größe und Mittelpunkt des Luftbilds.</returns>
        internal GeoRect MapDimension(MapService.Info.MapServiceInternalMapTile tile)
        {
            string key = tile.Key;
            if ((key == null) || (key.Length == 0) || (key.Substring(0, 1) != "t"))
            {
                throw new ErrorProvider.GeoException(new ErrorProvider.ErrorMessage("ERROR_MAPDIMENSION"));
            }

            double geoLaenge = -180;    // geographische Länge
            double gridLaenge = 360;    // Breite des jeweiligen Quadranten 
            double geoBreite = -1;      // geographische Breite
            double gridHoehe = 2;       // Höhe des jeweiligen Quadranten

            for (int i = 1; i < key.Length; i++)
            {
                gridLaenge /= 2;
                gridHoehe /= 2;
                string c = key.Substring(i, 1);
                switch (c)
                {
                    case "s":
                        geoLaenge += gridLaenge;
                        break;
                    case "r":
                        geoBreite += gridHoehe;
                        geoLaenge += gridLaenge;
                        break;
                    case "q":
                        geoBreite += gridHoehe;
                        break;
                    case "t":
                        break;
                    default:
                        throw new ErrorProvider.GeoException(new ErrorProvider.ErrorMessage("ERROR_MAPDIMENSION"));
                }
            }

            // Konvertierung nach Grad
            gridHoehe += geoBreite;
            gridHoehe = (2 * Math.Atan(Math.Exp(Math.PI * gridHoehe))) - (Math.PI / 2);
            gridHoehe *= (180 / Math.PI);

            geoBreite = (2 * Math.Atan(Math.Exp(Math.PI * geoBreite))) - (Math.PI / 2);
            geoBreite *= (180 / Math.PI);

            gridHoehe -= geoBreite;

            if (gridLaenge < 0)
            {
                geoLaenge = geoLaenge + gridLaenge;
                gridLaenge = -gridLaenge;
            }

            if (gridHoehe < 0)
            {
                geoBreite = geoBreite + gridHoehe;
                gridHoehe = -gridHoehe;
            }

            return new GeoRect(geoLaenge, geoBreite, gridLaenge, gridHoehe);
        }
Example #42
0
        /// <summary><para>Die Funktion konvertiert den internen generischen Schlüssel in das Virtual Earth Format. 
        /// <para>Die Funktion ist nur für interne Berechnungen bestimmt.</para></para></summary>
        /// 
        /// <param name="tile">Ein <see cref="MapService.Info.MapServiceInternalMapTile"/>-Objekt mit dem internen Schlüssel.</param>
        /// <returns>Ein <see cref="MapService.Info.MapServiceVirtualEarthMapsTile"/>-Objekt mit den Zugriffsdaten auf das Satellitenbild.</returns>
        internal MapService.Info.MapServiceVirtualEarthMapsTile InternalToVirtualEarth(MapService.Info.MapServiceInternalMapTile tile)
        {
            string key = tile.Key;
            string earth = "a";
            for (int i = 1; i < key.Length; i++)
            {
                switch (key.Substring(i, 1))
                {
                    case "q": earth += "0"; break;
                    case "r": earth += "1"; break;
                    case "t": earth += "2"; break;
                    case "s": earth += "3"; break;
                }
            }

            return new MapService.Info.MapServiceVirtualEarthMapsTile(earth);
        }
Example #43
0
 /// <summary><para>Die interne Funktion berechnet den X/Y Bildpunkt auf einem Satellitenbild (Tile), 
 /// der den geographischen Koordinaten im übergebenen <see cref="GeoUtility.GeoSystem.Geographic"/>-Objekt entspricht.
 /// <para>Die Funktion ist nur für interne Berechnungen bestimmt.</para></para></summary>
 /// 
 /// <param name="tail">Ein <see cref="GeoUtility.GeoSystem.MapService.Info.MapServiceInternalMapTile"/>-Objekt.</param>
 /// <returns>Bildpunkt auf dem Satellitenbild als <see cref="GeoUtility.GeoSystem.Helper.GeoPoint"/>-Objekt, der den Koordinaten entspricht.</returns>
 internal GeoPoint WGSPixel(MapService.Info.MapServiceInternalMapTile tail)
 {
     return WGSPixel(tail, 256);
 }
Example #44
0
        /// <summary><para>Die Funktion konvertiert das Virtual Earth Format in den internen Schlüssel.
        /// <para>Die Funktion ist nur für interne Berechnungen bestimmt.</para></para></summary>
        /// 
        /// <param name="tile">Ein <see cref="MapService.Info.MapServiceVirtualEarthMapsTile"/>-Objekt mit den Zugriffsdaten auf das Satellitenbild.</param>
        /// <returns>Ein <see cref="MapService.Info.MapServiceInternalMapTile"/>-Objekt mit dem internen Schlüssel.</returns>
        internal MapService.Info.MapServiceInternalMapTile VirtualEarthToInternal(MapService.Info.MapServiceVirtualEarthMapsTile tile)
        {
            string earth = tile.Key;
            string key = "t";                                   // 1. Buchstabe immer "t"

            for (int i = 1; i < earth.Length; i++)
            {
                switch (earth.Substring(i, 1))
                {
                    case "0": key += "q"; break;
                    case "1": key += "r"; break;
                    case "2": key += "t"; break;
                    case "3": key += "s"; break;
                }
            }

            return new MapService.Info.MapServiceInternalMapTile(key);
        }
Example #45
0
        /// <summary><para>Die Funktion konvertiert das Yahoo Maps Format in die interne Repräsentation eines Satellitenbildes. 
        /// <para>Die Funktion ist nur für interne Berechnungen bestimmt.</para></para></summary>
        /// 
        /// <param name="tile">Ein <see cref="MapService.Info.MapServiceYahooMapsTile"/>-Objekt mit den Zugriffsdaten auf das Satellitenbild.</param>
        /// <returns>Ein <see cref="MapService.Info.MapServiceInternalMapTile"/>-Objekt mit den Zugriffsdaten auf das Satellitenbild.</returns>
        internal MapService.Info.MapServiceInternalMapTile YahooToInternal(MapService.Info.MapServiceYahooMapsTile tile)
        {
            int x = tile.X;
            int y = tile.Y;
            int zoom = tile.Zoom;
            string key = "";
            int wert = 0;
            int exp = zoom - 1;
            int[] keyArray = new int[zoom];
            
            // 1. Buchstabe immer gleich
            keyArray[0] = 2;
            
            // y normalisieren nur bei Yahoo                      
            if (y < 0) { y -= 1; };
            y = (int)Math.Pow(2, (exp - 1)) + y;

            // Werte des Feldes iKey[]: q=0, r=1, t=2, s=3
            for (int i = 1; i < keyArray.Length; i++)                       
            {
                exp -= 1;

                //Test auf Rechtswert
                wert = (x - (int)Math.Pow(2, exp));               
                if (wert >= 0) { keyArray[i] = 1; x = wert; }

                //Test auf Hochwert
                wert = (y - (int)Math.Pow(2, exp));                   
                if (wert >= 0) { y = wert; } else { keyArray[i] += 2; }
            }

            // In internes Format umwandeln.
            for (int i = 0; i < keyArray.Length; i++)
            {
                switch (keyArray[i])
                {
                    case 0: key += "q"; break;
                    case 1: key += "r"; break;
                    case 2: key += "t"; break;
                    case 3: key += "s"; break;
                }
            }

            return new MapService.Info.MapServiceInternalMapTile(key);
        
        }
Example #46
0
        /// <summary><para>Die Funktion berechnet den neuen internen Schlüssel für das Satellitenbild (Tile), 
        /// welches durch die Verschiebung in die angegebene Richtung ausgewählt wird. Die Funktion wird von der 
        /// <see cref="MapService"/>-Klasse verwendet, und sollte nur über deren Methoden verwendet werden.
        /// <para>Die Funktion ist nur für interne Berechnungen bestimmt.</para></para></summary>
        /// 
        /// <param name="tile">Interne generische Repräsentation des Schlüssels.</param>
        /// <param name="dir">Richtung der Verschiebung.</param>
        /// <returns>Den internen generischen Schlüssel im <see cref="MapService.Info.MapServiceInternalMapTile"/>-Objekt.</returns>
        internal MapService.Info.MapServiceInternalMapTile MapMove(MapService.Info.MapServiceInternalMapTile tile, MapService.Info.MapDirection dir)
        {
            char[] keyArray = tile.Key.ToCharArray();
            switch (dir)
            {
                case (MapService.Info.MapDirection.North):
                    for (int i = keyArray.Length - 1; i >= 0; i--)
                    {
                        if (keyArray[i] == 's')
                        {
                            keyArray[i] = 'r';
                            break;
                        }
                        else if (keyArray[i] == 't')
                        {
                            keyArray[i] = 'q';
                            break;
                        }
                        else if (keyArray[i] == 'r')
                        {
                            keyArray[i] = 's';
                        }
                        else if (keyArray[i] == 'q')
                        {
                            keyArray[i] = 't';
                        }
                    };
                    break;
                case (MapService.Info.MapDirection.Northeast):
                    for (int i = keyArray.Length - 1; i >= 0; i--)
                    {
                        if (keyArray[i] == 't')
                        {
                            keyArray[i] = 'r';
                            break;
                        }
                        else if (keyArray[i] == 'q')
                        {
                            keyArray[i] = 's';
                        }
                        else if (keyArray[i] == 'r')
                        {
                            keyArray[i] = 't';
                        }
                        else if (keyArray[i] == 's')
                        {
                            keyArray[i] = 'q';
                        }
                    };
                    break;
                case (MapService.Info.MapDirection.East):
                    for (int i = keyArray.Length - 1; i >= 0; i--)
                    {
                        if (keyArray[i] == 'q')
                        {
                            keyArray[i] = 'r';
                            break;
                        }
                        else if (keyArray[i] == 't')
                        {
                            keyArray[i] = 's';
                            break;
                        }
                        else if (keyArray[i] == 'r')
                        {
                            keyArray[i] = 'q';
                        }
                        else if (keyArray[i] == 's')
                        {
                            keyArray[i] = 't';
                        }
                    };
                    break;
                case (MapService.Info.MapDirection.Southeast):
                    for (int i = keyArray.Length - 1; i >= 0; i--)
                    {
                        if (keyArray[i] == 'q')
                        {
                            keyArray[i] = 's';
                            break;
                        }
                        else if (keyArray[i] == 'r')
                        {
                            keyArray[i] = 't';
                        }
                        else if (keyArray[i] == 's')
                        {
                            keyArray[i] = 'q';
                        }
                        else if (keyArray[i] == 't')
                        {
                            keyArray[i] = 'r';
                        }
                    };
                    break;
                case (MapService.Info.MapDirection.South):
                    for (int i = keyArray.Length - 1; i >= 0; i--)
                    {
                        if (keyArray[i] == 'r')
                        {
                            keyArray[i] = 's';
                            break;
                        }
                        else if (keyArray[i] == 'q')
                        {
                            keyArray[i] = 't';
                            break;
                        }
                        else if (keyArray[i] == 's')
                        {
                            keyArray[i] = 'r';
                        }
                        else if (keyArray[i] == 't')
                        {
                            keyArray[i] = 'q';
                        }
                    };
                    break;
                case (MapService.Info.MapDirection.Southwest):
                    for (int i = keyArray.Length - 1; i >= 0; i--)
                    {
                        if (keyArray[i] == 'r')
                        {
                            keyArray[i] = 't';
                            break;
                        }
                        else if (keyArray[i] == 'q')
                        {
                            keyArray[i] = 's';
                        }
                        else if (keyArray[i] == 's')
                        {
                            keyArray[i] = 'q';
                        }
                        else if (keyArray[i] == 't')
                        {
                            keyArray[i] = 'r';
                        }
                    };
                    break;
                case (MapService.Info.MapDirection.West):
                    for (int i = keyArray.Length - 1; i >= 0; i--)
                    {
                        if (keyArray[i] == 'r')
                        {
                            keyArray[i] = 'q';
                            break;
                        }
                        else if (keyArray[i] == 's')
                        {
                            keyArray[i] = 't';
                            break;
                        }
                        else if (keyArray[i] == 'q')
                        {
                            keyArray[i] = 'r';
                        }
                        else if (keyArray[i] == 't')
                        {
                            keyArray[i] = 's';
                        }
                    };
                    break;
                case (MapService.Info.MapDirection.Northwest):
                    for (int i = keyArray.Length - 1; i >= 0; i--)
                    {
                        if (keyArray[i] == 's')
                        {
                            keyArray[i] = 'q';
                            break;
                        }
                        else if (keyArray[i] == 'q')
                        {
                            keyArray[i] = 's';
                        }
                        else if (keyArray[i] == 'r')
                        {
                            keyArray[i] = 't';
                        }
                        else if (keyArray[i] == 't')
                        {
                            keyArray[i] = 'r';
                        }
                    };
                    break;
            }

            StringBuilder key = new StringBuilder();
            foreach (char c in keyArray)
            {
                key.Append(c.ToString());
            }

            return new MapService.Info.MapServiceInternalMapTile(key.ToString());
        }
Example #47
0
    // Use this for initialization
    void Start()
    {
        m_enemyMgr = EnemyManager.Get();
        m_battleMgr = BattleManager.Get();
        m_handler = Service.Get<HUDService>().HUDControl;
        m_inputMgr = InputManager.Get();

        // Initialize base value of player
        m_player = new PlayerStats();
        m_player.atk = 10;
        m_player.hp = 100;
        m_player.bravebar = 0;

        m_skills = new Skill[3];
        m_skills[0].name = "Punch";
        m_skills[0].energyCost = 1;
        m_skills[0].dmg = 4.7f;
        m_skills[0].id = 1;
        m_skills[1].name = "Kick";
        m_skills[1].energyCost = 2;
        m_skills[1].dmg = 9.0f;
        m_skills[1].id = 2;
        m_skills[2].name = "Strike A Pose";
        m_skills[2].energyCost = 4;
        m_skills[2].dmg = 19.0f;
        m_skills[2].id = 3;

        //Create Skill Buttons

        m_camService = Service.Get<MapService>();
        m_camService.Init();

        if(m_handler != null)
        {
            m_handler.AddActionButton("NormalAttack", this.gameObject, m_skills[0]);
            m_handler.AddActionButton("NormalAttack", this.gameObject, m_skills[1]);
            m_handler.AddActionButton("NormalAttack", this.gameObject, m_skills[2]);

            m_handler.InitializeGauge((int)GAUGE.PLAYER, m_player.hp, m_player.hp, "Ellie");
        }

        //		l2dInterface.LoadProfile ();

        l2dInterface.GetModel ().StopBasicMotion (true);
        l2dInterface.PlayCombatIdleAnim ();

        m_soundService = Service.Get<SoundService>();
    }
Example #48
0
 /// <summary>
 /// Tests the tiles in a level of detail and writes the results to a text table file.
 /// </summary>
 /// <param name="options"></param>
 /// <param name="layerInfo"></param>
 /// <param name="lod"></param>
 private static void TestLod(Options options, MapService layerInfo, LevelOfDetail lod)
 {
     if ((!options.StartLevel.HasValue || lod.level >= options.StartLevel) && (!options.EndLevel.HasValue || lod.level <= options.EndLevel))
     {
         Debug.WriteLine("Begin testing LOD#{0}...", lod.level);
         var level = lod.level;
         var firstTile = layerInfo.GetFirstTile(level);
         var lastTile = layerInfo.GetLastTile(level);
         ParallelLoopResult plResult = Parallel.For(firstTile.Row, lastTile.Row, _parallelOptions, r => TestRow(options, layerInfo, lod, level, firstTile, lastTile, r));
         while (!plResult.IsCompleted)
         {
             // DO nothing.
         }
         Debug.WriteLine("End testing LOD#{0}...", lod.level);
     }
 }
        public void TestExportMap()
        {
            var testProperties = MethodInfo.GetCurrentMethod().GetCustomAttributes<TestPropertyAttribute>().ToDictionary(k => k.Name, v => v.Value);
            var mapServiceUrl = testProperties["mapServiceUrl"];

            var parameters = new ExportMapParameters
            {
                BoundingBox = new double[] {
                    -14011824.4072731,
                    5581676.67702371,
                    -12878110.4037477,
                    6375398.77873677
                },
                ResponseFormat = ExportMapResponseFormat.Image,
                ImageFormat = ExportMapImageFormat.Png,
                Dpi = 300,
                Size = new int[] { 600, 800 },
                Transparent = true
            };
            var mapService = new MapService { Uri = new Uri(mapServiceUrl) };
            Stream image = mapService.ExportMap(parameters);

            Assert.IsNotNull(image);

            using (FileStream fs = new FileStream("output.png", FileMode.Create))
            {
                image.CopyTo(fs);
            }
        }
Example #50
0
        private static void TestRow(Options options, MapService layerInfo, LevelOfDetail lod, int level, Tile firstTile, Tile lastTile, int row)
        {
            // Exit the method if the row is out of the range of user-specified rows.
            if (
                (options.StartLevel.HasValue && options.StartLevel == level && options.StartRow.HasValue && row < options.StartRow)
                ||
                (options.EndLevel.HasValue && options.EndLevel == level && options.EndRow.HasValue && row > options.EndRow)
                )
            {
                return;
            }
            WebRequest webRequest;
            using (var sw = new StreamWriter(Path.Combine(options.OutputDirectory, string.Format("{0:00}_{1:000000}.csv", level, row)), false, System.Text.Encoding.ASCII))
            {
                sw.WriteLine("\"LOD\",\"Row\",\"Col\",\"xmin\",\"ymin\",\"xmax\",\"ymax\",\"ContentLength\",\"Error\"");
                for (int c = firstTile.Column; c < lastTile.Column; c++)
                {
                    var tileUrl = options.Url.GetTileUrl(level, row, c);

                    webRequest = HttpWebRequest.Create(tileUrl);
                    WebResponse response = null;
                    var envelope = layerInfo.GetTileExtent(level, row, c);
                    Exception theException = null;
                    int? contentLength = default(int?);
                    try
                    {
                        webRequest.Method = "HEAD";
                        response = webRequest.GetResponse();
                        string clStr = response.Headers[HttpResponseHeader.ContentLength];
                        int tempCl;
                        if (!string.IsNullOrWhiteSpace(clStr) && int.TryParse(clStr, out tempCl))
                        {
                            contentLength = tempCl;
                        }
                    }
                    catch (Exception ex)
                    {
                        Trace.TraceWarning("An exception occured at LOD {0}, row {1}, column {2}{3}{4}", lod.level, row, c, Environment.NewLine, ex);
                        theException = ex;
                    }
                    finally
                    {
                        if (response != null)
                        {
                            response.Close();
                        }
                    }
                    if (theException != null ||
                        (options.WriteErrorsOnly.HasValue && !options.WriteErrorsOnly.Value) ||
                        (options.MinimumValidContentLength.HasValue && (!contentLength.HasValue || contentLength.Value < options.MinimumValidContentLength.Value))
                        )
                    {
                        sw.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8}",
                            level, row, c, envelope.xmin, envelope.ymin, envelope.xmax, envelope.ymax,
                            contentLength.HasValue ? contentLength.Value.ToString() : string.Empty,
                            theException != null ? string.Format("\"{0}\"", theException.Message) : string.Empty);
                        sw.Flush();
                    }
                }
            }
        }