Cleaning up the docs to a marginally acceptable level.
This commit is contained in:
@@ -9,7 +9,28 @@
|
||||
|
||||
/**
|
||||
* Class: OpenLayers.Layer.UTFGrid
|
||||
* MP TODO
|
||||
* This Layer reads from UTFGrid tiled data sources.
|
||||
* Since UTFGrids are essentially JSON-based ASCII art
|
||||
* with attached attributes, they are not visibly rendered.
|
||||
* In order to use them in the map,
|
||||
* you must add a UTFGrid Control as well.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* (start code)
|
||||
* var world_utfgrid = new OpenLayers.Layer.UTFGrid(
|
||||
* 'UTFGrid Layer',
|
||||
* "http://tiles/world_utfgrid/${z}/${x}/${y}.json"
|
||||
* );
|
||||
* map.addLayer(world_utfgrid);
|
||||
*
|
||||
* var control = new OpenLayers.Control.UTFGrid({
|
||||
* 'div': 'attrsdiv',
|
||||
* 'layers': [world_utfgrid],
|
||||
* 'handlerMode': 'move'
|
||||
* })
|
||||
* (end code)
|
||||
*
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Layer.Grid>
|
||||
@@ -145,19 +166,30 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
utfgridResolution: 4,
|
||||
|
||||
/**
|
||||
* Method: getTileInfo
|
||||
* APIMethod: getTileInfo
|
||||
* Get tile information for a given location at the current map resolution.
|
||||
*
|
||||
* Parameters:
|
||||
* loc - {<OpenLayers.LonLat} A location in map coordinates.
|
||||
*
|
||||
* Returns:
|
||||
* {Object} An object with
|
||||
* MP TODO
|
||||
* "col", "row", "i", and "j" properties. The col
|
||||
* and row values are zero based tile indexes from the top left. The
|
||||
* i and j values are the number of pixels to the left and top
|
||||
* (respectively) of the given location within the target tile.
|
||||
* {Object} An object with the following properties
|
||||
*
|
||||
* globalCol: the tile's X
|
||||
*
|
||||
* globalRow: the tile's Y
|
||||
*
|
||||
* gridCol: the viewport grid X
|
||||
*
|
||||
* gridRow: the viewpoirt grid Y
|
||||
*
|
||||
* tile: the associated OpenLayers.Tile.UTFGrid object
|
||||
*
|
||||
* zoom: the tile zoom level
|
||||
*
|
||||
* i: the pixel X position relative to the current tile origin
|
||||
*
|
||||
* j: the pixel Y position relative to the current tile origin
|
||||
*/
|
||||
getTileInfo: function(loc) {
|
||||
var res = this.getServerResolution();
|
||||
@@ -170,8 +202,9 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
|
||||
// Get the current grid offset
|
||||
var gridOrigin = this.grid[0][0].bounds;
|
||||
// MP TODO rounding errors can cause intermittent problems (4.9999 should be 5)
|
||||
// flooring will cause big problems (4.999 becomes 4)... do round or toFixed later?
|
||||
// Floating point math can cause problems (4.9999 should be 5)
|
||||
// flooring will cause big problems (4.999 becomes 4)...
|
||||
// Do round or toFixed later?
|
||||
var gridColOffset =
|
||||
(gridOrigin.left - this.tileOrigin.lon) / (res * this.tileSize.w);
|
||||
var gridRowOffset =
|
||||
@@ -193,8 +226,6 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
globalRow: globalRow,
|
||||
gridCol: gridCol,
|
||||
gridRow: gridRow,
|
||||
gridColOffset: gridColOffset,
|
||||
gridRowOffset: gridRowOffset,
|
||||
tile: tile,
|
||||
zoom: zoom,
|
||||
i: Math.floor((fx - globalCol) * this.tileSize.w),
|
||||
|
||||
Reference in New Issue
Block a user