dpaw-brocket-urstate
Version:
Primal State
71 lines (56 loc) • 1.2 kB
JavaScript
/**
* @fileOverview
* @name urmap.js
* @author Gavin Coombes
* @license BSD-3-Clause
*/
;
var utility = require('dpaw-brocket-utility');
var u = utility;
var log = utility.log;
// UrMap.set(urmap, ['map', 'base', 'bounds'], value)
let UrMapObject = {
init(opts){
let self = this;
self.$name = opts.name;
self.$root = defaultStructure;
},
get(path) {
let self = this;
return u.get(self.root, path);
},
set(path, value) {
let self = this;
u.set(self.root, path, value);
// log('UrMapObject.set: After ', u.get(self, path, value));
}
};
var defaultStructure = {
base: {
projection: 'EPSG:4326',
bounds: {minLat: 0, minLon: 0, maxLat: 1, maxLon: 1}
},
tileLayers: {
ade: {id: 'ade', source: ''}
/* raster layer description */
},
featureLayers: {
gex: {id: 'gex', source: '', data: ''}
/* geojson layers descriptions */
},
layout: {
container: {
width: 600,
height: 400,
orientation: 'landscape'
},
layers: [],
widgets: []
},
data: {},
// Legends, compass rose, scale bars
widgets: {
xyz: {id: 'xyz'}
}
};
module.exports = UrMapObject;