This is a class designed to designate a single tile, however it is explicitly designed to do relatively little. Tiles store information about themselves -- such as the URL that they are related to, and their size - but do not add themselves to the layer div automatically, for example. Create a new tile with the OpenLayers.Tile constructor, or a subclass.
| TBD 3.0 | remove reference to url in above paragraph |
| OpenLayers.Tile | This is a class designed to designate a single tile, however it is explicitly designed to do relatively little. |
| Properties | |
| events | {OpenLayers.Events} An events object that handles all events on the tile. |
| eventListeners | {Object} If set as an option at construction, the eventListeners object will be registered with OpenLayers.Events.on. |
| id | {String} null |
| layer | {<OpenLayers.Layer>} layer the tile is attached to |
| url | {String} url of the request. |
| bounds | {OpenLayers.Bounds} null |
| size | {OpenLayers.Size} null |
| position | {OpenLayers.Pixel} Top Left pixel of the tile |
| isLoading | {Boolean} Is the tile loading? |
| Functions | |
| unload | Call immediately before destroying if you are listening to tile events, so that counters are properly handled if tile is still loading at destroy-time. |
| destroy | Nullify references to prevent circular references and memory leaks. |
| draw | Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn. |
| shouldDraw | Return whether or not the tile should actually be (re-)drawn. |
| setBounds | Sets the bounds on this instance |
| moveTo | Reposition the tile. |
| clear | Clear the tile of any bounds/position-related data so that it can be reused in a new location. |
{OpenLayers.Events} An events object that handles all events on the tile.
{Object} If set as an option at construction, the eventListeners object will be registered with OpenLayers.Events.on. Object structure must be a listeners object as shown in the example for the events.on method.
This options can be set in the ``tileOptions`` option from OpenLayers.Layer.Grid. For example, to be notified of the ``loadend`` event of each tiles:
new OpenLayers.Layer.OSM('osm', 'http://tile.openstreetmap.org/${z}/${x}/${y}.png', {
tileOptions: {
eventListeners: {
'loadend': function(evt) {
// do something on loadend
}
}
}
});{OpenLayers.Bounds} null
{OpenLayers.Size} null
{OpenLayers.Pixel} Top Left pixel of the tile
draw: function()
Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn. This is an example implementation that can be overridden by subclasses. The minimum thing to do here is to call clear and return the result from shouldDraw.
{Boolean} Whether or not the tile should actually be drawn.
moveTo: function ( bounds, position, redraw )
Reposition the tile.
| bounds | {OpenLayers.Bounds} |
| position | {OpenLayers.Pixel} |
| redraw | {Boolean} Call draw method on tile after moving. Default is true |
Convenience method for registering listeners with a common scope.
on: function( object )
Call immediately before destroying if you are listening to tile events, so that counters are properly handled if tile is still loading at destroy-time.
unload: function()
Nullify references to prevent circular references and memory leaks.
destroy:function()
Clear whatever is currently in the tile, then return whether or not it should actually be re-drawn.
draw: function()
Return whether or not the tile should actually be (re-)drawn.
shouldDraw: function()
Sets the bounds on this instance
setBounds: function( bounds )
Reposition the tile.
moveTo: function ( bounds, position, redraw )
Clear the tile of any bounds/position-related data so that it can be reused in a new location.
clear: function( draw )