示例#1
0
        public Guid GenerateHeatMapOverlayToken(HeatPoint[] heatPoints, HeatmapSettings settings)
        {
            //until javascript sets the intensity on each point, it comes through as 0, which renders transparent
            //this sets the intensity to the default intensity so the heat points render with color
            foreach (HeatPoint h in heatPoints) h.Intensity = HeatmapSettings.DEFAULT_INTENSITY;

            // for now, force each of the tile images to have a border with the Border = true setting
            if (null == settings) settings = new HeatmapSettings() {Border = true};

            var cacheObject = new HeatmapSettingsCache.SettingsCacheObject(settings, new HeatPointList(heatPoints));

            return HeatmapSettingsCache.Instance.Store(cacheObject);
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HeatmapSettings settings;
            try
            {
                if (!string.IsNullOrEmpty(Request.QueryString["token"]))
                {
                    Guid token = new Guid(Request.QueryString["token"]);
                    settings = HeatmapSettingsCache.Instance.Retrieve(token).Settings;
                }
                else
                {
                    double smallestX = 0, smallestY = 0, largestX = 0, largestY = 0;
                    int largestRange = 0;
                    int multiplier = 10;

                    var HeatPoints = new HeatPointList();
                    string[] dataPoints = Request.QueryString["data"].Split(new char[] { ',' });

                    // create the heatpoints from
                    for (int i = 0; i < dataPoints.Length; i++)
                    {
                        double lat = double.Parse(dataPoints[i]);
                        double lon = double.Parse(dataPoints[++i]);

                        HeatPoints.Add(new HeatPoint(lat, lon, HeatmapSettings.DEFAULT_INTENSITY));
                    }
                    settings = new HeatmapSettings();
                    settings.Size = MapQueryStringValueToHeatMapPropertyValue("size", settings.Size);
                    settings.Sensitivity = MapQueryStringValueToHeatMapPropertyValue("sensitivity", settings.Sensitivity);
                    settings.Transparency = MapQueryStringValueToHeatMapPropertyValue("transparency", settings.Transparency);
                    settings.Zoom = MapQueryStringValueToHeatMapPropertyValue("zoom", settings.Zoom);

                }
                //var hm = new HeatMap(settings);
                throw new NotImplementedException("not implemented");
                //Respond(hm.GenerateMap());

            }
            catch (Exception ex)
            {
                Bitmap b = new Bitmap(100, 100);
                Graphics Surface = Graphics.FromImage(b);
                Surface.Clear(Color.Black);
                Surface.DrawImage(b, 100, 100);
                Respond(b);
            }
        }
示例#3
0
文件: Tile.cs 项目: aroder/heatmap
        public Tile(HeatPointList heatPoints, HeatmapSettings settings, Bounds bounds)
        {
            Bounds = bounds;

            Bounds heatMapBounds = new Bounds(bounds);
            heatMapBounds.TopLeftLat += settings.Size / 2 * this.DegreesPerPixelLat;
            heatMapBounds.TopLeftLng -= settings.Size / 2 * this.DegreesPerPixelLng;
            heatMapBounds.BottomRightLat -= settings.Size / 2 * this.DegreesPerPixelLat;
            heatMapBounds.BottomRightLng += settings.Size / 2 * this.DegreesPerPixelLng;

            HeatPointList pointsWithinBounds = new HeatPointList();
            foreach (HeatPoint hp in heatPoints)
            {
                if (heatMapBounds.Contains(hp)) pointsWithinBounds.Add(hp);
            }

            HeatMap = new HeatMap(pointsWithinBounds, settings, heatMapBounds);
        }
示例#4
0
文件: Heatmap.cs 项目: aroder/heatmap
 public HeatMap(HeatPointList heatPoints, HeatmapSettings settings, Bounds bounds)
 {
     Settings = settings;
     HeatPoints = heatPoints;
     Bounds = bounds;
 }
示例#5
0
文件: Heatmap.cs 项目: aroder/heatmap
 public HeatMap(HeatPointList heatPoints, HeatmapSettings settings)
 {
     Settings = settings;
     HeatPoints = heatPoints;
 }
示例#6
0
 public SettingsCacheObject(HeatmapSettings settings, HeatPointList heatPoints)
 {
     Settings = settings;
     HeatPoints = heatPoints;
 }
示例#7
0
 public Guid UpdateHeatmapOverlaySettings(Guid token, HeatmapSettings settings)
 {
     var cacheObject = HeatmapSettingsCache.Instance.Retrieve(token);
     cacheObject.Settings = settings;
     return HeatmapSettingsCache.Instance.Store(token, cacheObject);
 }