80 lines
1.8 KiB
JavaScript
80 lines
1.8 KiB
JavaScript
/**
|
|
* @typedef {Object.<string, L.Marker>} MarkerLookup
|
|
* A lookup table of markers keyed by 'lat lng' (no groupings)
|
|
*/
|
|
|
|
/**
|
|
* @typedef {Object.<string, L.LayerGroup>} LayerGroupLookup
|
|
* A lookup table of Leaflet layer groups by category
|
|
*/
|
|
|
|
/**
|
|
* @typedef {Object} MapState
|
|
* @property {L.Layer} baseLayer
|
|
* @property {number} zoom
|
|
* @property {L.LatLngExpression} center
|
|
* @property {number} minZoom
|
|
* @property {number} maxZoom
|
|
* A representation of the (current) Leaflet map state
|
|
*/
|
|
|
|
/**
|
|
* @typedef {Object} GisStateType
|
|
* @property {L.Map|null} map
|
|
* @property {{string: L.Layer}|null} baseLayers
|
|
* @property {?MapState} currentMapState
|
|
* @property {boolean} bViewActive
|
|
* @property {MarkerLookup} markers
|
|
* @property {LayerGroupLookup} layers
|
|
* @property {Object|null} bibliography
|
|
* @property {String|null} apiUrl
|
|
* @property {Object} cartography
|
|
*/
|
|
|
|
/** @type {GisStateType} */
|
|
export const GisState = {
|
|
map: null,
|
|
baseLayers: null,
|
|
currentMapState: null,
|
|
bViewActive: false,
|
|
markers: {
|
|
sites: {},
|
|
notConserved: {},
|
|
findings: {},
|
|
prehistoric: {},
|
|
underwater: {},
|
|
reuse: {},
|
|
buildingTechs: {},
|
|
},
|
|
layers: {
|
|
geometries: {},
|
|
/**
|
|
* @type {L.LayerGroup}
|
|
*/
|
|
walls: {},
|
|
sites: {},
|
|
notConserved: {},
|
|
findings: {},
|
|
prehistoric: {},
|
|
underwater: {},
|
|
reuse: {},
|
|
buildingTechs: {},
|
|
},
|
|
bibliography: null,
|
|
apiUrl : null,
|
|
cartography : {
|
|
historic: [],
|
|
cadastral: null,
|
|
buildings: null,
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {array} coords - ['lat', 'lng']
|
|
* @param {string} group
|
|
* @returns {L.Marker|undefined}
|
|
*/
|
|
export function getMarkerByCoords(coords, group) {
|
|
return GisState.markers[group][`${coords[0]} ${coords[1]}`];
|
|
}
|