Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-573: Geographic graticles now working

Mike McGanna3a3d65702cb
diff --git a/src/js/Worldview/Map/GraticuleLayer.js b/src/js/Worldview/Map/GraticuleLayer.js
index db19fc455..0471f0d44 100644
--- a/src/js/Worldview/Map/GraticuleLayer.js
+++ b/src/js/Worldview/Map/GraticuleLayer.js
@@ -1,10 +1,10 @@
/*
* NASA Worldview
- *
+ *
* This code was originally developed at NASA/Goddard Space Flight Center for
- * the Earth Science Data and Information System (ESDIS) project.
+ * the Earth Science Data and Information System (ESDIS) project.
*
- * Copyright (C) 2013 United States Government as represented by the
+ * Copyright (C) 2013 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*/
@@ -16,15 +16,15 @@ Worldview.namespace("Map");
* Standard OpenLayers graticle control that acts like a layer.
*/
Worldview.Map.GraticuleLayer = OpenLayers.Class(OpenLayers.Layer, {
-
+
graticuleLineStyle: null,
graticuleLabelStyle: null,
graticule: null,
isControl: true,
-
+
initialize: function(name, options) {
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
-
+
this.graticuleLineStyle = new OpenLayers.Symbolizer.Line({
strokeColor: '#AAAAAA',
strokeOpacity: 0.95,
@@ -32,53 +32,56 @@ Worldview.Map.GraticuleLayer = OpenLayers.Class(OpenLayers.Layer, {
strokeLinecap: 'square',
strokeDashstyle: 'dot'
});
-
+
this.graticuleLabelStyle = new OpenLayers.Symbolizer.Text({
fontFamily: 'Gill Sans',
fontSize: '16',
fontWeight: '550',
fontColor: '#0000e1',
fontOpacity: 1.0
- });
+ });
},
-
+
/*
* Add the control when the layer is added to the map
*/
setMap: function(map) {
- OpenLayers.Layer.prototype.setMap.apply(this, arguments);
-
+ OpenLayers.Layer.prototype.setMap.apply(this, arguments);
+
this.graticule = new OpenLayers.Control.Graticule({
layerName: 'ol_graticule_control',
- numPoints: 2,
+ numPoints: 2,
labelled: true,
lineSymbolizer: this.graticuleLineStyle,
labelSymbolizer: this.graticuleLabelStyle
});
-
- map.addControl(this.graticule);
+
+ map.addControl(this.graticule);
},
-
+
/*
* Remove the contorl when the layer is removed from the map
*/
removeMap: function(map) {
- OpenLayers.Layer.prototype.removeMap.apply(this, arguments);
- map.removeControl(this.graticule);
+ OpenLayers.Layer.prototype.removeMap.apply(this, arguments);
+ map.removeControl(this.graticule);
this.graticule.destroy();
this.graticule = null;
},
-
+
setVisibility: function(value) {
+ if ( !this.granule ) {
+ return;
+ }
if ( value ) {
this.graticule.activate();
} else {
this.graticule.deactivate();
}
},
-
+
/*
* Name of this class per OpenLayers convention.
*/
- CLASS_NAME: "Worldview.Map.GraticuleLayer"
+ CLASS_NAME: "Worldview.Map.GraticuleLayer"
});