Extract codegrid to seperate module, heatup the codegrid caches

This commit is contained in:
Pieter Vander Vennet 2020-10-11 18:41:45 +02:00
parent 7c52ace770
commit 4db1997ed6
3 changed files with 28 additions and 6 deletions

View file

@ -5,8 +5,9 @@ import {Layer} from "leaflet"
import {GeoOperations} from "./GeoOperations";
import {UIElement} from "../UI/UIElement";
import {LayerDefinition} from "../Customizations/LayerDefinition";
import codegrid from "codegrid-js";
import State from "../State";
import CodeGrid from "./Web/CodeGrid";
/***
* A filtered layer is a layer which offers a 'set-data' function
@ -44,8 +45,6 @@ export class FilteredLayer {
private _showOnPopup: (tags: UIEventSource<any>, feature: any) => UIElement;
private static readonly grid = codegrid.CodeGrid("./tiles/");
constructor(
layerDef: LayerDefinition,
showOnPopup: ((tags: UIEventSource<any>, feature: any) => UIElement)
@ -118,7 +117,7 @@ export class FilteredLayer {
feature.properties["_lon"] = "" + lat; // We expect a string here for lat/lon
feature.properties["_lat"] = "" + lon;
// But the codegrid SHOULD be a number!
FilteredLayer.grid.getCode(lat, lon, (error, code) => {
CodeGrid.grid.getCode(lat, lon, (error, code) => {
if (error === null) {
feature.properties["_country"] = code;
} else {