Beispiel #1
0
        private void AddHeatmapLayer()
        {
            HeatmapLayer layer = new HeatmapLayer(HEATMAP_LAYER_ID, EARTHQUAKE_SOURCE_ID)
            {
                MaxZoom     = 9,
                SourceLayer = HEATMAP_LAYER_SOURCE,

                // Color ramp for heatmap.  Domain is 0 (low) to 1 (high).
                // Begin color ramp at 0-stop with a 0-transparency color
                // to create a blur-like effect.
                HeatmapColor = Expression.Interpolate(
                    Expression.Linear(), Expression.HeatmapDensity(),
                    Expression.Literal(0), Expression.Rgba(33, 102, 172, 0),
                    Expression.Literal(0.2), Expression.Rgb(103, 169, 207),
                    Expression.Literal(0.4), Expression.Rgb(209, 229, 240),
                    Expression.Literal(0.6), Expression.Rgb(253, 219, 199),
                    Expression.Literal(0.8), Expression.Rgb(239, 138, 98),
                    Expression.Literal(1), Expression.Rgb(178, 24, 43)
                    ),

                // Increase the heatmap weight based on frequency and property magnitude
                HeatmapWeight = (
                    Expression.Interpolate(
                        Expression.Linear(), Expression.Get("mag"),
                        Expression.CreateStop(0, 0),
                        Expression.CreateStop(6, 1)
                        )
                    ),

                // Increase the heatmap color weight weight by zoom level
                // heatmap-intensity is a multiplier on top of heatmap-weight
                HeatmapIntensity = (
                    Expression.Interpolate(
                        Expression.Linear(), Expression.Zoom(),
                        Expression.CreateStop(0, 1),
                        Expression.CreateStop(9, 3)
                        )
                    ),

                // Adjust the heatmap radius by zoom level
                HeatmapRadius = (
                    Expression.Interpolate(
                        Expression.Linear(), Expression.Zoom(),
                        Expression.CreateStop(0, 2),
                        Expression.CreateStop(9, 20)
                        )
                    ),

                // Transition from heatmap to circle layer by zoom level
                HeatmapOpacity = (
                    Expression.Interpolate(
                        Expression.Linear(), Expression.Zoom(),
                        Expression.CreateStop(7, 1),
                        Expression.CreateStop(9, 0)
                        )
                    )
            };

            map.Functions.AddLayerAbove(layer, "waterway-label");
        }
Beispiel #2
0
        private void AddHeatmapLayer()
        {
            // Create the heatmap layer
            var layer = new HeatmapLayer(HEATMAP_LAYER_ID, HEATMAP_SOURCE_ID)
            {
                // Heatmap layer disappears at whatever zoom level is set as the maximum
                MaxZoom = 18,

                // Color ramp for heatmap.  Domain is 0 (low) to 1 (high).
                // Begin color ramp at 0-stop with a 0-transparency color to create a blur-like effect.
                HeatmapColor = listOfHeatmapColors[index],

                // Increase the heatmap color weight weight by zoom level
                // heatmap-intensity is a multiplier on top of heatmap-weight
                HeatmapIntensity = listOfHeatmapIntensityStops[index],

                // Adjust the heatmap radius by zoom level
                HeatmapRadius = listOfHeatmapRadiusStops[index],

                HeatmapOpacity = 1f
            };

            // Add the heatmap layer to the map and above the "water-label" layer
            map.Functions.AddLayerAbove(layer, "waterway-label");
        }
Beispiel #3
0
        private void HandleTap(object sender, EventArgs eventArgs)
        {
            index++;

            if (index == listOfHeatmapColors.Length)
            {
                index = 0;
            }

            var layer = new HeatmapLayer(HEATMAP_LAYER_ID, HEATMAP_SOURCE_ID)
            {
                // Color ramp for heatmap.  Domain is 0 (low) to 1 (high).
                // Begin color ramp at 0-stop with a 0-transparency color to create a blur-like effect.
                HeatmapColor = listOfHeatmapColors[index],

                // Increase the heatmap color weight weight by zoom level
                // heatmap-intensity is a multiplier on top of heatmap-weight
                HeatmapIntensity = listOfHeatmapIntensityStops[index],

                // Adjust the heatmap radius by zoom level
                HeatmapRadius = listOfHeatmapRadiusStops[index]
            };

            map.Functions.UpdateLayer(layer);
        }
        public void Should_HaveDefaultId()
        {
            var layer = new HeatmapLayer();

            Assert.NotEmpty(layer.Id);
            Assert.Equal(LayerType.HeatmapLayer, layer.Type);
            Assert.Empty(layer.EventActivationFlags.EnabledEvents);
        }
Beispiel #5
0
        public HeatLayerBuilder AddHeatmapLayer()
        {
            var heatLayer = new HeatmapLayer(this.Map);

            this.Map.Layers.Add(heatLayer);

            return new HeatLayerBuilder(heatLayer);
        }
        public void Should_HaveGivenId()
        {
            const string id    = "id";
            var          layer = new HeatmapLayer(id);

            Assert.Equal(id, layer.Id);
            Assert.Equal(LayerType.HeatmapLayer, layer.Type);
            Assert.Empty(layer.EventActivationFlags.EnabledEvents);
        }
        internal HeatmapGradientFactory(HeatmapLayer heatmapLayer)
        {
            if (heatmapLayer == null)
            {
                throw new ArgumentNullException(nameof(heatmapLayer));
            }

            this.heatmapLayer = heatmapLayer;
        }
        public void Should_TriggerLayerAdded()
        {
            var layer     = new HeatmapLayer();
            var triggered = false;
            var map       = new Map("id");
            var eventArgs = new MapJsEventArgs {
                Type = "layeradded"
            };

            layer.OnLayerAdded += args => triggered = args.Map == map && args.Type == eventArgs.Type;
            layer.DispatchEvent(map, eventArgs);
            Assert.True(triggered);
        }
        public void Should_TriggerDblClick()
        {
            var layer     = new HeatmapLayer();
            var triggered = false;
            var map       = new Map("id");
            var eventArgs = CreateEventArgsForMouseEvent("dblclick");

            layer.OnDblClick += args => {
                triggered = args.Map == map &&
                            args.LayerId == eventArgs.LayerId &&
                            args.Pixel == eventArgs.Pixel &&
                            args.Position == eventArgs.Position &&
                            args.Type == eventArgs.Type;
            };
            layer.DispatchEvent(map, eventArgs);
            Assert.True(triggered);
        }
        public void Should_TriggerTouchStart()
        {
            var layer     = new HeatmapLayer();
            var triggered = false;
            var map       = new Map("id");
            var eventArgs = CreateEventArgsForTouchEvent("touchstart");

            layer.OnTouchStart += args => {
                triggered = args.Map == map &&
                            args.LayerId == eventArgs.LayerId &&
                            args.Pixel == eventArgs.Pixel &&
                            args.Position == eventArgs.Position &&
                            args.Pixels == eventArgs.Pixels &&
                            args.Positions == eventArgs.Positions &&
                            args.Type == eventArgs.Type;
            };
            layer.DispatchEvent(map, eventArgs);
            Assert.True(triggered);
        }
        private async Task AddHeatMap()
        {
            var heatMap = await HeatmapLayer.CreateAsync(map1.JsRuntime, new HeatmapLayerOptions
            {
                Map         = map1.InteropObject,
                Dissipating = true,
                Radius      = 10,
            });

            var heatPoints = new[] {
                new LatLngLiteral {
                    Lat = 13.505892,
                    Lng = 100.8162,
                },
                new LatLngLiteral {
                    Lat = 13.506892,
                    Lng = 100.8162,
                },
            };

            await heatMap.SetData(heatPoints);
        }
Beispiel #12
0
        private async Task AddHeatMap()
        {
            var heatMap = await HeatmapLayer.CreateAsync(map1.JsRuntime, new HeatmapLayerOptions
            {
                Map         = map1.InteropObject,
                Dissipating = true,
                Radius      = 10,
            });

            var heatPoints = new[] {
                new LatLngLiteral {
                    Lat = 13.505892,
                    Lng = 100.8162,
                },
                new LatLngLiteral {
                    Lat = 13.506892,
                    Lng = 100.8162,
                },
            };

            var hwp = new List <WeightedLocation>();

            hwp.Add(new WeightedLocation {
                Location = new LatLngLiteral {
                    Lat = 13.505892, Lng = 100.8142
                }, Weight = 3
            });
            hwp.Add(new WeightedLocation {
                Location = new LatLngLiteral {
                    Lat = 13.506892, Lng = 100.8132
                }, Weight = 5
            });

            await heatMap.SetData(hwp);

            //await heatMap.SetData(heatPoints);
        }