Loading app/src/js/AstroMap.js +22 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,19 @@ export default L.Map.AstroMap = L.Map.extend({ southPolar: new LayerCollection(this.target, "south-polar stereographic") }; if(this.layers["northPolar"].isEmpty()) { this._hasNorthPolar = false; } else { this._hasNorthPolar = true; } if(this.layers["southPolar"].isEmpty()) { this._hasSouthPolar = false; } else { this._hasSouthPolar = true; } this.defaultProj = L.extend({}, L.CRS.EPSG4326, { R: this.radii["a"] }); this.options["crs"] = this.defaultProj; Loading Loading @@ -82,5 +95,13 @@ export default L.Map.AstroMap = L.Map.extend({ this.options.crs = newCRS; this.setView(center, 1, true); this.loadLayerCollection(name); } }, hasNorthPolar: function() { return this._hasNorthPolar; }, hasSouthPolar: function() { return this._hasSouthPolar; }, }); app/src/js/LayerCollection.js +17 −9 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ export default L.LayerCollection = L.Class.extend({ this.projName = projName; this.baseLayers = {}; this.overlays = {}; this.defaultLayerIndex = 0; this.defaultLayerIndex = null; L.LayerCollection.layerControl = null; let layers = this.parseJSON(); Loading @@ -31,7 +31,7 @@ export default L.LayerCollection = L.Class.extend({ * Parses the USGS JSON, creates layer objects for a particular * target and projection, and stores them in a JS object. * @return {Object} - Dictionary containing the layer information in * the format: {base: , overlays} * the format: {base: [], overlays: []} */ parseJSON: function() { let layers = { Loading Loading @@ -128,13 +128,21 @@ export default L.LayerCollection = L.Class.extend({ L.LayerCollection.layerControl.remove(); } if(this.defaultLayerIndex != null) { let defaultLayer = Object.keys(this.baseLayers)[this.defaultLayerIndex]; this.baseLayers[defaultLayer].addTo(map); } if(!this.isEmpty()) { L.LayerCollection.layerControl = L.control.layers( this.baseLayers, this.overlays ); L.LayerCollection.layerControl.addTo(map); } }, isEmpty: function() { return (Object.entries(this.baseLayers).length == 0); } }); app/src/js/Projection.js +12 −4 Original line number Diff line number Diff line Loading @@ -18,13 +18,21 @@ export default L.Control.Projection = L.Control.extend({ let container = L.DomUtil.create("div"); this.northPolar = L.DomUtil.get("projectionNorthPole"); L.DomEvent.on(this.northPolar, "click", this.loadNorthPolar, this); if(!map.hasNorthPolar()) { this.northPolar.disabled = true; L.DomUtil.addClass(this.northPolar, "disabled"); L.DomEvent.on(this.northPolar, "click", this.loadNorthPolar, this); this.cylindrical = L.DomUtil.get("projectionCylindrical"); L.DomEvent.on(this.cylindrical, "click", this.loadCylindrical, this); } this.southPolar = L.DomUtil.get("projectionSouthPole"); L.DomEvent.on(this.southPolar, "click", this.loadSouthPolar, this); if(!map.hasSouthPolar()) { this.southPolar.disabled = true; L.DomUtil.addClass(this.southPolar, "disabled"); } this.cylindrical = L.DomUtil.get("projectionCylindrical"); L.DomEvent.on(this.cylindrical, "click", this.loadCylindrical, this); return container; }, Loading Loading
app/src/js/AstroMap.js +22 −1 Original line number Diff line number Diff line Loading @@ -44,6 +44,19 @@ export default L.Map.AstroMap = L.Map.extend({ southPolar: new LayerCollection(this.target, "south-polar stereographic") }; if(this.layers["northPolar"].isEmpty()) { this._hasNorthPolar = false; } else { this._hasNorthPolar = true; } if(this.layers["southPolar"].isEmpty()) { this._hasSouthPolar = false; } else { this._hasSouthPolar = true; } this.defaultProj = L.extend({}, L.CRS.EPSG4326, { R: this.radii["a"] }); this.options["crs"] = this.defaultProj; Loading Loading @@ -82,5 +95,13 @@ export default L.Map.AstroMap = L.Map.extend({ this.options.crs = newCRS; this.setView(center, 1, true); this.loadLayerCollection(name); } }, hasNorthPolar: function() { return this._hasNorthPolar; }, hasSouthPolar: function() { return this._hasSouthPolar; }, });
app/src/js/LayerCollection.js +17 −9 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ export default L.LayerCollection = L.Class.extend({ this.projName = projName; this.baseLayers = {}; this.overlays = {}; this.defaultLayerIndex = 0; this.defaultLayerIndex = null; L.LayerCollection.layerControl = null; let layers = this.parseJSON(); Loading @@ -31,7 +31,7 @@ export default L.LayerCollection = L.Class.extend({ * Parses the USGS JSON, creates layer objects for a particular * target and projection, and stores them in a JS object. * @return {Object} - Dictionary containing the layer information in * the format: {base: , overlays} * the format: {base: [], overlays: []} */ parseJSON: function() { let layers = { Loading Loading @@ -128,13 +128,21 @@ export default L.LayerCollection = L.Class.extend({ L.LayerCollection.layerControl.remove(); } if(this.defaultLayerIndex != null) { let defaultLayer = Object.keys(this.baseLayers)[this.defaultLayerIndex]; this.baseLayers[defaultLayer].addTo(map); } if(!this.isEmpty()) { L.LayerCollection.layerControl = L.control.layers( this.baseLayers, this.overlays ); L.LayerCollection.layerControl.addTo(map); } }, isEmpty: function() { return (Object.entries(this.baseLayers).length == 0); } });
app/src/js/Projection.js +12 −4 Original line number Diff line number Diff line Loading @@ -18,13 +18,21 @@ export default L.Control.Projection = L.Control.extend({ let container = L.DomUtil.create("div"); this.northPolar = L.DomUtil.get("projectionNorthPole"); L.DomEvent.on(this.northPolar, "click", this.loadNorthPolar, this); if(!map.hasNorthPolar()) { this.northPolar.disabled = true; L.DomUtil.addClass(this.northPolar, "disabled"); L.DomEvent.on(this.northPolar, "click", this.loadNorthPolar, this); this.cylindrical = L.DomUtil.get("projectionCylindrical"); L.DomEvent.on(this.cylindrical, "click", this.loadCylindrical, this); } this.southPolar = L.DomUtil.get("projectionSouthPole"); L.DomEvent.on(this.southPolar, "click", this.loadSouthPolar, this); if(!map.hasSouthPolar()) { this.southPolar.disabled = true; L.DomUtil.addClass(this.southPolar, "disabled"); } this.cylindrical = L.DomUtil.get("projectionCylindrical"); L.DomEvent.on(this.cylindrical, "click", this.loadCylindrical, this); return container; }, Loading