示例#1
0
        public async static Task <ImageMapType> CreateAsync(IJSRuntime jsRuntime, string baseUrlFormat, int minZoom, int maxZoom, string name, float opacity)
        {
            var    realUrl  = baseUrlFormat.Replace("{z}", "' + zoom + '").Replace("{x}", "' + coord.x + '").Replace("{y}", "' + coord.y + '");
            string initOpts = @"{
                'getTileUrl': (coord, zoom) => {
                            return '" + realUrl + @"'
                        },
                'tileSize': new google.maps.Size(256, 256),
                'maxZoom': " + maxZoom.ToString() + @",
                'minZoom': " + minZoom.ToString() + @",
                'opacity': " + opacity.ToString() + @",
                'name': '" + name + @"'
            }";

            //string initOpts = @"{
            //    'getTileUrl': (coord, zoom) => {
            //                return '" + baseUrl + @"' + zoom + '/' + coord.x + '/' + coord.y;
            //            },
            //    'tileSize': new google.maps.Size(256, 256),
            //    'maxZoom': " + maxZoom.ToString() + @",
            //    'minZoom': " + minZoom.ToString() + @",
            //    'opacity': " + opacity.ToString() + @",
            //    'name': '" + name + @"'
            //}";

            var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.ImageMapType", initOpts);

            var to = new ImageMapType(jsObjectRef)
            {
                Name = name
            };

            return(to);
        }
示例#2
0
 public async Task RemoveImageLayer(ImageMapType reference)
 {
     await _jsObjectRef.JSRuntime.MyInvokeAsync <object>("googleMapsObjectManager.removeImageLayer", this.Guid.ToString(), reference.Guid.ToString());
 }