Instances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers. Create a new image tile with the OpenLayers.Tile.Image constructor.
OpenLayers.
|
Instances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers. |
Properties | |
events | {OpenLayers.Events} An events object that handles all events on the tile. |
url | {String} The URL of the image being requested. |
maxGetUrlLength | {Number} If set, requests that would result in GET urls with more characters than the number provided will be made using form-encoded HTTP POST. |
crossOriginKeyword | The value of the crossorigin keyword to use when loading images. |
Constructor | |
OpenLayers.
|
Constructor for a new OpenLayers.Tile.Image instance. |
Functions | |
destroy | nullify references to prevent circular references and memory leaks |
setImage | Sets the image element for this tile. |
getCanvasContext | Returns a canvas context associated with the tile image (with the image drawn on it). |
Constants | |
OpenLayers.
|
{HTMLImageElement} The image for a tile. |
{OpenLayers.Events} An events object that handles all events on the tile.
tile.events.register(type, obj, listener);
beforeload | Triggered before an image is prepared for loading, when the url for the image is known already. Listeners may call setImage on the tile instance. If they do so, that image will be used and no new one will be created. |
{Number} If set, requests that would result in GET urls with more characters than the number provided will be made using form-encoded HTTP POST. It is good practice to avoid urls that are longer than 2048 characters.
Older versions of Gecko based browsers (e.g. Firefox < 3.5) and most Opera versions do not fully support this option. On all browsers, transition effects are not supported if POST requests are used.
The value of the crossorigin keyword to use when loading images. This is only relevant when using getCanvasContext for tiles from remote origins and should be set to either ‘anonymous’ or ‘use-credentials’ for servers that send Access-Control-Allow-Origin headers with their tiles.
Constructor for a new OpenLayers.Tile.Image instance.
layer | {OpenLayers.Layer} layer that the tile will go in. |
position | {OpenLayers.Pixel} |
bounds | {OpenLayers.Bounds} |
url | {String} Deprecated. Remove me in 3.0. |
size | {OpenLayers.Size} |
options | {Object} |
getCanvasContext: function()
Returns a canvas context associated with the tile image (with the image drawn on it). Returns undefined if the browser does not support canvas, if the tile has no image or if it’s currently loading.
The function returns a canvas context instance but the underlying canvas is still available in the ‘canvas’ property:
var context = tile.getCanvasContext(); if (context) { var data = context.canvas.toDataURL('image/jpeg'); }
{Boolean}
nullify references to prevent circular references and memory leaks
destroy: function()
Sets the image element for this tile.
setImage: function( img )
Returns a canvas context associated with the tile image (with the image drawn on it).
getCanvasContext: function()