Cleaning up the docs to a marginally acceptable level.

This commit is contained in:
Matthew Perry
2012-02-08 11:16:50 -08:00
parent 0cf589b337
commit b01026bd80
3 changed files with 263 additions and 124 deletions

View File

@@ -61,55 +61,57 @@ Group: OpenLayers {
File: Size (no auto-title, OpenLayers/BaseTypes/Size.js)
} # Group: BaseTypes
File: Console (no auto-title, OpenLayers/Console.js)
Group: Control {
File: Control (no auto-title, OpenLayers/Control.js)
File: ArgParser (no auto-title, OpenLayers/Control/ArgParser.js)
File: Attribution (no auto-title, OpenLayers/Control/Attribution.js)
File: Button (no auto-title, OpenLayers/Control/Button.js)
File: DragFeature (no auto-title, OpenLayers/Control/DragFeature.js)
File: DragPan (no auto-title, OpenLayers/Control/DragPan.js)
File: DrawFeature (no auto-title, OpenLayers/Control/DrawFeature.js)
File: EditingToolbar (no auto-title, OpenLayers/Control/EditingToolbar.js)
File: Geolocate (no auto-title, OpenLayers/Control/Geolocate.js)
File: GetFeature (no auto-title, OpenLayers/Control/GetFeature.js)
File: Graticule (no auto-title, OpenLayers/Control/Graticule.js)
File: KeyboardDefaults (no auto-title, OpenLayers/Control/KeyboardDefaults.js)
File: LayerSwitcher (no auto-title, OpenLayers/Control/LayerSwitcher.js)
File: Measure (no auto-title, OpenLayers/Control/Measure.js)
File: ModifyFeature (no auto-title, OpenLayers/Control/ModifyFeature.js)
File: MousePosition (no auto-title, OpenLayers/Control/MousePosition.js)
File: Navigation (no auto-title, OpenLayers/Control/Navigation.js)
File: NavigationHistory (no auto-title, OpenLayers/Control/NavigationHistory.js)
File: NavToolbar (no auto-title, OpenLayers/Control/NavToolbar.js)
File: OverviewMap (no auto-title, OpenLayers/Control/OverviewMap.js)
File: Pan (no auto-title, OpenLayers/Control/Pan.js)
File: Panel (no auto-title, OpenLayers/Control/Panel.js)
File: PanPanel (no auto-title, OpenLayers/Control/PanPanel.js)
File: PanZoom (no auto-title, OpenLayers/Control/PanZoom.js)
File: PanZoomBar (no auto-title, OpenLayers/Control/PanZoomBar.js)
File: Permalink (no auto-title, OpenLayers/Control/Permalink.js)
File: PinchZoom (no auto-title, OpenLayers/Control/PinchZoom.js)
File: Scale (no auto-title, OpenLayers/Control/Scale.js)
File: ScaleLine (no auto-title, OpenLayers/Control/ScaleLine.js)
File: SelectFeature (no auto-title, OpenLayers/Control/SelectFeature.js)
File: SLDSelect (no auto-title, OpenLayers/Control/SLDSelect.js)
File: Snapping (no auto-title, OpenLayers/Control/Snapping.js)
File: Split (no auto-title, OpenLayers/Control/Split.js)
File: TouchNavigation (no auto-title, OpenLayers/Control/TouchNavigation.js)
File: TransformFeature (no auto-title, OpenLayers/Control/TransformFeature.js)
File: WMSGetFeatureInfo (no auto-title, OpenLayers/Control/WMSGetFeatureInfo.js)
File: WMTSGetFeatureInfo (no auto-title, OpenLayers/Control/WMTSGetFeatureInfo.js)
File: ZoomBox (no auto-title, OpenLayers/Control/ZoomBox.js)
File: ZoomIn (no auto-title, OpenLayers/Control/ZoomIn.js)
File: ZoomOut (no auto-title, OpenLayers/Control/ZoomOut.js)
File: ZoomPanel (no auto-title, OpenLayers/Control/ZoomPanel.js)
File: ZoomToMaxExtent (no auto-title, OpenLayers/Control/ZoomToMaxExtent.js)
} # Group: Control
File: Events (no auto-title, OpenLayers/Events.js)
Group: Control {
File: ArgParser (no auto-title, OpenLayers/Control/ArgParser.js)
File: Attribution (no auto-title, OpenLayers/Control/Attribution.js)
File: Button (no auto-title, OpenLayers/Control/Button.js)
File: DragFeature (no auto-title, OpenLayers/Control/DragFeature.js)
File: DragPan (no auto-title, OpenLayers/Control/DragPan.js)
File: DrawFeature (no auto-title, OpenLayers/Control/DrawFeature.js)
File: EditingToolbar (no auto-title, OpenLayers/Control/EditingToolbar.js)
File: Geolocate (no auto-title, OpenLayers/Control/Geolocate.js)
File: GetFeature (no auto-title, OpenLayers/Control/GetFeature.js)
File: Graticule (no auto-title, OpenLayers/Control/Graticule.js)
File: KeyboardDefaults (no auto-title, OpenLayers/Control/KeyboardDefaults.js)
File: LayerSwitcher (no auto-title, OpenLayers/Control/LayerSwitcher.js)
File: Measure (no auto-title, OpenLayers/Control/Measure.js)
File: ModifyFeature (no auto-title, OpenLayers/Control/ModifyFeature.js)
File: MousePosition (no auto-title, OpenLayers/Control/MousePosition.js)
File: Navigation (no auto-title, OpenLayers/Control/Navigation.js)
File: NavigationHistory (no auto-title, OpenLayers/Control/NavigationHistory.js)
File: NavToolbar (no auto-title, OpenLayers/Control/NavToolbar.js)
File: OverviewMap (no auto-title, OpenLayers/Control/OverviewMap.js)
File: Pan (no auto-title, OpenLayers/Control/Pan.js)
File: Panel (no auto-title, OpenLayers/Control/Panel.js)
File: PanPanel (no auto-title, OpenLayers/Control/PanPanel.js)
File: PanZoom (no auto-title, OpenLayers/Control/PanZoom.js)
File: PanZoomBar (no auto-title, OpenLayers/Control/PanZoomBar.js)
File: Permalink (no auto-title, OpenLayers/Control/Permalink.js)
File: PinchZoom (no auto-title, OpenLayers/Control/PinchZoom.js)
File: Scale (no auto-title, OpenLayers/Control/Scale.js)
File: ScaleLine (no auto-title, OpenLayers/Control/ScaleLine.js)
File: SelectFeature (no auto-title, OpenLayers/Control/SelectFeature.js)
File: SLDSelect (no auto-title, OpenLayers/Control/SLDSelect.js)
File: Snapping (no auto-title, OpenLayers/Control/Snapping.js)
File: Split (no auto-title, OpenLayers/Control/Split.js)
File: TouchNavigation (no auto-title, OpenLayers/Control/TouchNavigation.js)
File: TransformFeature (no auto-title, OpenLayers/Control/TransformFeature.js)
File: UTFGrid (OpenLayers/Control/UTFGrid.js)
File: WMSGetFeatureInfo (no auto-title, OpenLayers/Control/WMSGetFeatureInfo.js)
File: WMTSGetFeatureInfo (no auto-title, OpenLayers/Control/WMTSGetFeatureInfo.js)
File: ZoomBox (no auto-title, OpenLayers/Control/ZoomBox.js)
File: ZoomIn (no auto-title, OpenLayers/Control/ZoomIn.js)
File: ZoomOut (no auto-title, OpenLayers/Control/ZoomOut.js)
File: ZoomPanel (no auto-title, OpenLayers/Control/ZoomPanel.js)
File: ZoomToMaxExtent (no auto-title, OpenLayers/Control/ZoomToMaxExtent.js)
} # Group: Control
} # Group: Control
Group: Feature {
@@ -279,8 +281,6 @@ Group: OpenLayers {
File: RegularPolygon (no auto-title, OpenLayers/Handler/RegularPolygon.js)
} # Group: Handler
File: Icon (no auto-title, OpenLayers/Icon.js)
Group: Lang {
File: Lang (no auto-title, OpenLayers/Lang.js)
@@ -332,41 +332,45 @@ Group: OpenLayers {
Group: Layer {
File: Layer (no auto-title, OpenLayers/Layer.js)
File: ArcGISCache.js (no auto-title, OpenLayers/Layer/ArcGISCache.js)
File: ArcGIS93Rest (no auto-title, OpenLayers/Layer/ArcGIS93Rest.js)
File: ArcIMS (no auto-title, OpenLayers/Layer/ArcIMS.js)
File: Bing (no auto-title, OpenLayers/Layer/Bing.js)
File: Boxes (no auto-title, OpenLayers/Layer/Boxes.js)
File: EventPane (no auto-title, OpenLayers/Layer/EventPane.js)
File: FixedZoomLevels (no auto-title, OpenLayers/Layer/FixedZoomLevels.js)
File: GeoRSS (no auto-title, OpenLayers/Layer/GeoRSS.js)
File: Google (no auto-title, OpenLayers/Layer/Google.js)
File: Google.v3 (no auto-title, OpenLayers/Layer/Google/v3.js)
File: Grid (no auto-title, OpenLayers/Layer/Grid.js)
File: HTTPRequest (no auto-title, OpenLayers/Layer/HTTPRequest.js)
File: Image (no auto-title, OpenLayers/Layer/Image.js)
File: KaMap (no auto-title, OpenLayers/Layer/KaMap.js)
File: KaMapCache (no auto-title, OpenLayers/Layer/KaMapCache.js)
File: MapGuide (no auto-title, OpenLayers/Layer/MapGuide.js)
File: MapServer (no auto-title, OpenLayers/Layer/MapServer.js)
File: Markers (no auto-title, OpenLayers/Layer/Markers.js)
File: OSM (no auto-title, OpenLayers/Layer/OSM.js)
File: PointGrid (no auto-title, OpenLayers/Layer/PointGrid.js)
File: PointTrack (no auto-title, OpenLayers/Layer/PointTrack.js)
File: SphericalMercator (no auto-title, OpenLayers/Layer/SphericalMercator.js)
File: Text (no auto-title, OpenLayers/Layer/Text.js)
File: TileCache (no auto-title, OpenLayers/Layer/TileCache.js)
File: TMS (no auto-title, OpenLayers/Layer/TMS.js)
File: Vector (no auto-title, OpenLayers/Layer/Vector.js)
File: Vector.RootContainer (no auto-title, OpenLayers/Layer/Vector/RootContainer.js)
File: WMS (no auto-title, OpenLayers/Layer/WMS.js)
File: WMTS (no auto-title, OpenLayers/Layer/WMTS.js)
File: WorldWind (no auto-title, OpenLayers/Layer/WorldWind.js)
File: XYZ (no auto-title, OpenLayers/Layer/XYZ.js)
File: Zoomify (no auto-title, OpenLayers/Layer/Zoomify.js)
} # Group: Layer
File: Map (no auto-title, OpenLayers/Map.js)
Group: Layer {
File: ArcGISCache.js (no auto-title, OpenLayers/Layer/ArcGISCache.js)
File: ArcGIS93Rest (no auto-title, OpenLayers/Layer/ArcGIS93Rest.js)
File: ArcIMS (no auto-title, OpenLayers/Layer/ArcIMS.js)
File: Bing (no auto-title, OpenLayers/Layer/Bing.js)
File: Boxes (no auto-title, OpenLayers/Layer/Boxes.js)
File: EventPane (no auto-title, OpenLayers/Layer/EventPane.js)
File: FixedZoomLevels (no auto-title, OpenLayers/Layer/FixedZoomLevels.js)
File: GeoRSS (no auto-title, OpenLayers/Layer/GeoRSS.js)
File: Google (no auto-title, OpenLayers/Layer/Google.js)
File: Google.v3 (no auto-title, OpenLayers/Layer/Google/v3.js)
File: Grid (no auto-title, OpenLayers/Layer/Grid.js)
File: HTTPRequest (no auto-title, OpenLayers/Layer/HTTPRequest.js)
File: Image (no auto-title, OpenLayers/Layer/Image.js)
File: KaMap (no auto-title, OpenLayers/Layer/KaMap.js)
File: KaMapCache (no auto-title, OpenLayers/Layer/KaMapCache.js)
File: MapGuide (no auto-title, OpenLayers/Layer/MapGuide.js)
File: MapServer (no auto-title, OpenLayers/Layer/MapServer.js)
File: Markers (no auto-title, OpenLayers/Layer/Markers.js)
File: OSM (no auto-title, OpenLayers/Layer/OSM.js)
File: PointGrid (no auto-title, OpenLayers/Layer/PointGrid.js)
File: PointTrack (no auto-title, OpenLayers/Layer/PointTrack.js)
File: SphericalMercator (no auto-title, OpenLayers/Layer/SphericalMercator.js)
File: Text (no auto-title, OpenLayers/Layer/Text.js)
File: TileCache (no auto-title, OpenLayers/Layer/TileCache.js)
File: TMS (no auto-title, OpenLayers/Layer/TMS.js)
File: Vector (no auto-title, OpenLayers/Layer/Vector.js)
File: Vector.RootContainer (no auto-title, OpenLayers/Layer/Vector/RootContainer.js)
File: WMS (no auto-title, OpenLayers/Layer/WMS.js)
File: WMTS (no auto-title, OpenLayers/Layer/WMTS.js)
File: WorldWind (no auto-title, OpenLayers/Layer/WorldWind.js)
File: XYZ (no auto-title, OpenLayers/Layer/XYZ.js)
File: Zoomify (no auto-title, OpenLayers/Layer/Zoomify.js)
File: UTFGrid (OpenLayers/Layer/UTFGrid.js)
} # Group: Layer
} # Group: Layer
Group: Marker {
@@ -383,12 +387,19 @@ Group: OpenLayers {
File: FramedCloud (no auto-title, OpenLayers/Popup/FramedCloud.js)
} # Group: Popup
File: Projection (no auto-title, OpenLayers/Projection.js)
Group: Protocol {
File: Protocol (no auto-title, OpenLayers/Protocol.js)
File: HTTP (no auto-title, OpenLayers/Protocol/HTTP.js)
Group: Protocol {
File: CSW (OpenLayers/Protocol/CSW.js)
File: CSW.v2_0_2 (OpenLayers/Protocol/CSW/v2_0_2.js)
File: HTTP (no auto-title, OpenLayers/Protocol/HTTP.js)
File: Script (no auto-title, OpenLayers/Protocol/Script.js)
File: SOS.DEFAULTS (no auto-title, OpenLayers/Protocol/SOS.js)
File: SOS.v1_0_0 (no auto-title, OpenLayers/Protocol/SOS/v1_0_0.js)
} # Group: Protocol
Group: WFS {
@@ -398,9 +409,6 @@ Group: OpenLayers {
File: v1_1_0 (no auto-title, OpenLayers/Protocol/WFS/v1_1_0.js)
} # Group: WFS
File: Script (no auto-title, OpenLayers/Protocol/Script.js)
File: SOS.DEFAULTS (no auto-title, OpenLayers/Protocol/SOS.js)
File: SOS.v1_0_0 (no auto-title, OpenLayers/Protocol/SOS/v1_0_0.js)
} # Group: Protocol
Group: Renderer {
@@ -420,9 +428,6 @@ Group: OpenLayers {
File: XMLHttpRequest (no auto-title, OpenLayers/Request/XMLHttpRequest.js)
} # Group: Request
File: Rule (no auto-title, OpenLayers/Rule.js)
File: SingleFile.js (no auto-title, OpenLayers/SingleFile.js)
Group: Strategy {
File: Strategy (no auto-title, OpenLayers/Strategy.js)
@@ -435,10 +440,6 @@ Group: OpenLayers {
File: Save (no auto-title, OpenLayers/Strategy/Save.js)
} # Group: Strategy
File: Style (no auto-title, OpenLayers/Style.js)
File: Style2 (no auto-title, OpenLayers/Style2.js)
File: StyleMap (no auto-title, OpenLayers/StyleMap.js)
Group: Symbolizer {
File: Symbolizer (no auto-title, OpenLayers/Symbolizer.js)
@@ -454,11 +455,30 @@ Group: OpenLayers {
File: Tile (no auto-title, OpenLayers/Tile.js)
File: Image (no auto-title, OpenLayers/Tile/Image.js)
File: Image.IFrame (no auto-title, OpenLayers/Tile/Image/IFrame.js)
File: UTFGrid (OpenLayers/Tile/UTFGrid.js)
} # Group: Tile
File: Tween (no auto-title, OpenLayers/Tween.js)
File: Util (no auto-title, OpenLayers/Util.js)
File: Deprecated (no auto-title, deprecated.js)
Group: OpenLayers {
File: Animation (OpenLayers/Animation.js)
File: Console (no auto-title, OpenLayers/Console.js)
File: Events (no auto-title, OpenLayers/Events.js)
File: Events.buttonclick (OpenLayers/Events/buttonclick.js)
File: Icon (no auto-title, OpenLayers/Icon.js)
File: Kinetic (OpenLayers/Kinetic.js)
File: Map (no auto-title, OpenLayers/Map.js)
File: Projection (no auto-title, OpenLayers/Projection.js)
File: Rule (no auto-title, OpenLayers/Rule.js)
File: SingleFile.js (no auto-title, OpenLayers/SingleFile.js)
File: Style (no auto-title, OpenLayers/Style.js)
File: Style2 (no auto-title, OpenLayers/Style2.js)
File: StyleMap (no auto-title, OpenLayers/StyleMap.js)
File: Tween (no auto-title, OpenLayers/Tween.js)
File: Util (no auto-title, OpenLayers/Util.js)
} # Group: OpenLayers
} # Group: OpenLayers
Group: Index {

View File

@@ -11,8 +11,32 @@
/**
* Class: OpenLayers.Control.UTFGrid
* The UTFGrid control displays ....
* pointer, as it is moved about the map.
*
* This Control provides behavior associated with UTFGrid Layers.
* These 'hit grids' provide underlying feature attributes without
* calling the server (again). This control allows Mousemove, Hovering
* and Click events to trigger callbacks that use the attributes in
* whatever way you need.
*
* The most common example may be a UTFGrid layer containing feature
* attributes that are displayed in a div as you mouseover.
*
* Example Code:
*
* (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.Control>
@@ -26,17 +50,28 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
*/
autoActivate: true,
/**
* APIProperty: Layers
* List of layers to consider. Must be Layer.UTFGrids
* `null` is the default indicating all UTFGrid Layers are queried.
* {Array} <OpenLayers.Layer.UTFGrid>
*/
layers: null,
/**
* Property: element
* {DOMElement}
*/
element: null,
/**
* Property: debugElement
* {DOMElement}
*/
debugElement: null,
/**
* Constructor: OpenLayers.Control.UTFGrid
* Parameters:
* options - {Object} Options for control.
/* Property: defaultHandlerOptions
* The default opts passed to the handler constructors
*/
defaultHandlerOptions: {
'delay': 300,
@@ -48,16 +83,30 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
'stopDouble': false
},
/* Property: handlerMode
/* APIProperty: handlerMode
* Defaults to 'click'. Can be 'hover' or 'move'.
*/
handlerMode: 'hover',
/**
* APIMethod: setHandler
* sets this.handlerMode and calls resetHandler()
*
* Parameters:
* hm - {String} Handler Mode string; 'click', 'hover' or 'move'.
*/
setHandler: function(hm) {
this.handlerMode = hm;
this.resetHandler();
},
/**
* Method: resetHandler
* Deactivates the old hanlder and creates a new
* <OpenLayers.Handler> based on the mode specified in
* this.handlerMode
*
*/
resetHandler: function() {
if (this.handler) {
this.handler.deactivate();
@@ -112,6 +161,18 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: handleEvent
* Internal method called when specified event is triggered.
*
* This method does several things:
*
* Gets the lonLat of the event.
*
* Loops through the appropriate hit grid layers and gathers the attributes.
*
* Passes the attributes to the callback
*
* Parameters:
* evt - {<OpenLayers.Event>}
*/
handleEvent: function(evt) {
if (evt == null) {
@@ -125,6 +186,7 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
}
var layers = this.findLayers();
var globalAttrs = {};
if (layers.length > 0) {
var layer;
for (var i=0, len=layers.length; i<len; i++) {
@@ -132,7 +194,7 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
var info = layer.getTileInfo( lonLat );
this.writeDebugInfo(info);
var tile = info.tile;
var attrs = null;
var localAttrs = null;
var resolution = layer.utfgridResolution || 4;
if (tile !== null && typeof(tile) !== 'undefined') {
var data = tile.json
@@ -142,15 +204,21 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
].charCodeAt(
Math.floor((info.i) / resolution)
));
attrs = data.data[data.keys[code]];
this.callback(attrs);
localAttrs = data.data[data.keys[code]];
for (var property in localAttrs) {
// If attribute names collide, last one takes it
globalAttrs[property] = localAttrs[property];
}
}
}
}
this.callback(globalAttrs); // perhaps pass tile, lonLat?
}
},
/** Method:
/** Method: writeDebugInfo
* Writes out debug info on event
* Only fired off if this.debugElement is set
*
*/
writeDebugInfo: function(info) {
@@ -161,8 +229,6 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
debug += "<li>globalcol :" + info.globalCol + "</li>";
debug += "<li>gridrow :" + info.gridRow + "</li>";
debug += "<li>gridcol :" + info.gridCol + "</li>";
debug += "<li>gridrow offset :" + info.gridRowOffset + "</li>";
debug += "<li>gridcol offset :" + info.gridColOffset + "</li>";
debug += "</ul>";
if (this.debugElement) {
this.debugElement.innerHTML = debug;
@@ -170,9 +236,16 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
},
/**
* Method: callback
* APIMethod: callback
* Takes the attrs and does somethings with them
* this is a default (intended to be overridden)
* The default behavior is to make a simple table
* and write to a div (defined by this.element)
*
* Parameters:
* attrs - {Object}
*
* Returns:
* {Boolean} - was the element updated?
*/
callback: function(attrs) {
if (attrs !== null && typeof(attrs) !== 'undefined') {
@@ -195,6 +268,12 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
* number values.
* See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
* for details.
*
* Parameters:
* key - {Integer}
*
* Returns:
* {Integer} Adjusted key for non-escaped chars
*/
resolveCode: function(key) {
if (key >= 93) key--;
@@ -205,6 +284,7 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
/**
* Method: reset
* Resets the element
*/
reset: function(evt) {
this.callback(null);
@@ -216,7 +296,15 @@ OpenLayers.Control.UTFGrid = OpenLayers.Class(OpenLayers.Control, {
* Method: findLayers
* Internal method to get the layers, independent of whether we are
* inspecting the map or using a client-provided array
* MP TODO respect list of user-supplied candidates
*
* The default value of this.layers is null; this causes the
* findLayers method to return ALL UTFGrid layers encountered.
*
* Parameters:
* None
*
* Returns:
* {Array} Layers to handle on each event
*/
findLayers: function() {
var candidates = this.layers || this.map.layers;

View File

@@ -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),