Single argument constructor for UTFGrid layer.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
var osm = new OpenLayers.Layer.OSM();
|
||||
|
||||
var utfgrid = new OpenLayers.Layer.UTFGrid(
|
||||
"Invisible UTFGrid Layer",
|
||||
"./utfgrid/world_utfgrid/${z}/${x}/${y}.json",
|
||||
{utfgridResolution: 4} // default is 2
|
||||
);
|
||||
var utfgrid = new OpenLayers.Layer.UTFGrid({
|
||||
url: "utfgrid/world_utfgrid/${z}/${x}/${y}.json",
|
||||
utfgridResolution: 4, // default is 2
|
||||
displayInLayerSwitcher: false
|
||||
});
|
||||
|
||||
var map = new OpenLayers.Map({
|
||||
div: "map",
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
var osm = new OpenLayers.Layer.OSM();
|
||||
|
||||
var population = new OpenLayers.Layer.UTFGrid(
|
||||
"World Population",
|
||||
"./utfgrid/world_utfgrid/${z}/${x}/${y}.json",
|
||||
{utfgridResolution: 4} // default is 2
|
||||
);
|
||||
var bioregions = new OpenLayers.Layer.UTFGrid(
|
||||
"World Bioregions",
|
||||
"./utfgrid/bio_utfgrid/${z}/${x}/${y}.json",
|
||||
{utfgridResolution: 4} // default is 2
|
||||
);
|
||||
var population = new OpenLayers.Layer.UTFGrid({
|
||||
name: "World Population",
|
||||
url: "utfgrid/world_utfgrid/${z}/${x}/${y}.json",
|
||||
utfgridResolution: 4 // default is 2
|
||||
});
|
||||
var bioregions = new OpenLayers.Layer.UTFGrid({
|
||||
name: "World Bioregions",
|
||||
url: "utfgrid/bio_utfgrid/${z}/${x}/${y}.json",
|
||||
utfgridResolution: 4 // default is 2
|
||||
});
|
||||
|
||||
var map = new OpenLayers.Map({
|
||||
div: "map",
|
||||
|
||||
@@ -19,9 +19,10 @@
|
||||
* Example:
|
||||
*
|
||||
* (start code)
|
||||
* var world_utfgrid = new OpenLayers.Layer.UTFGrid(
|
||||
* 'UTFGrid Layer',
|
||||
* "http://tiles/world_utfgrid/${z}/${x}/${y}.json"
|
||||
* var world_utfgrid = new OpenLayers.Layer.UTFGrid({
|
||||
* url: "/tiles/world_utfgrid/${z}/${x}/${y}.json",
|
||||
* utfgridResolution: 4,
|
||||
* displayInLayerSwitcher: false
|
||||
* );
|
||||
* map.addLayer(world_utfgrid);
|
||||
*
|
||||
@@ -99,14 +100,18 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Layer.UTFGrid
|
||||
* Create a new UTFGrid layer.
|
||||
*
|
||||
* Parameters:
|
||||
* name - {String}
|
||||
* url - {String}
|
||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||
* config - {Object} Configuration properties for the layer.
|
||||
*
|
||||
* Required configuration properties:
|
||||
* url - {String} The url template for UTFGrid tiles. See the <url> property.
|
||||
*/
|
||||
initialize: function(name, url, options) {
|
||||
OpenLayers.Layer.Grid.prototype.initialize.apply(this, [name, url, {}, options]);
|
||||
initialize: function(options) {
|
||||
OpenLayers.Layer.Grid.prototype.initialize.apply(
|
||||
this, [options.name, options.url, {}, options]
|
||||
);
|
||||
this.tileOptions = OpenLayers.Util.extend({
|
||||
utfgridResolution: this.utfgridResolution
|
||||
}, this.tileOptions);
|
||||
@@ -117,17 +122,14 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
* Create a clone of this layer
|
||||
*
|
||||
* Parameters:
|
||||
* obj - {Object} Is this ever used?
|
||||
* obj - {Object} Only used by a subclass of this layer.
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Layer.UTFGrid>} An exact clone of this OpenLayers.Layer.UTFGrid
|
||||
*/
|
||||
clone: function (obj) {
|
||||
|
||||
if (obj == null) {
|
||||
obj = new OpenLayers.Layer.UTFGrid(this.name,
|
||||
this.url,
|
||||
this.getOptions());
|
||||
obj = new OpenLayers.Layer.UTFGrid(this.getOptions());
|
||||
}
|
||||
|
||||
// get all additions from superclasses
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
var map, layer;
|
||||
function setUp() {
|
||||
layer = new OpenLayers.Layer.UTFGrid(
|
||||
null,
|
||||
"../data/utfgrid/world_utfgrid/${z}/${x}/${y}.json",
|
||||
{isBaseLayer: true, utfgridResolution: 4}
|
||||
);
|
||||
layer = new OpenLayers.Layer.UTFGrid({
|
||||
url: "../data/utfgrid/world_utfgrid/${z}/${x}/${y}.json",
|
||||
isBaseLayer: true,
|
||||
utfgridResolution: 4
|
||||
});
|
||||
map = new OpenLayers.Map({
|
||||
div: "map",
|
||||
projection: "EPSG:900913",
|
||||
|
||||
Reference in New Issue
Block a user