public Configuration() { background = Color.FromArgb(255, 255, 255, 255); output = "output.png"; gradient = "C:\\heatmap\\g.png"; //path to g.png decay = 0.95; projection = new MercatorProjection(); colormap = new ColorMap(image: Image.FromFile(gradient)); radius = 5; width = 5000; height = 5000; kernel = new LinearKernel(radius); load_gpx(); }
public void add_heat_to_matrix(Matrix matrix, LinearKernel kernel) { int fromX = (int)(extent.min.x - kernel.radius); int toX = (int)(extent.max.x + kernel.radius + 1); int fromY = (int)(extent.min.y - kernel.radius); int toY = (int)(extent.max.y + kernel.radius + 1); foreach (var x in Main.range(fromX, toX)) { foreach (var y in Main.range(fromY, toY)) { var coord = new Coordinate(x, y); var dist = distance(coord); double?heat = kernel.heat(dist); if (heat.HasValue && heat != 0) { matrix.add(coord, weight * heat.Value); } } } }