A renderer based on the 2D ‘canvas’ drawing element.element
| OpenLayers. Renderer. Canvas | A renderer based on the 2D ‘canvas’ drawing element.element |
| Properties | |
| root | {DOMElement} root element of canvas. |
| canvas | {Canvas} The canvas context object. |
| features | {Object} Internal object of feature/style pairs for use in redrawing the layer. |
| geometryMap | {Object} Geometry -> Feature lookup table. |
| Constructor | |
| OpenLayers. Renderer. Canvas | |
| Functions | |
| eraseGeometry | Erase a geometry from the renderer. |
| supported | {Boolean} Whether or not the browser supports the renderer class |
| setExtent | Set the visible part of the layer. |
| setSize | Sets the size of the drawing surface. |
| drawFeature | Draw the feature. |
| drawGeometry | Used when looping (in redraw) over the features; draws the canvas. |
| drawExternalGraphic | Called to draw External graphics. |
| setCanvasStyle | Prepare the canvas for drawing by setting various global settings. |
| drawPoint | This method is only called by the renderer itself. |
| drawLineString | This method is only called by the renderer itself. |
| drawLinearRing | This method is only called by the renderer itself. |
| drawPolygon | This method is only called by the renderer itself. |
| getLocalXY | transform geographic xy into pixel xy |
| clear | Clear all vectors from the renderer. |
| getFeatureIdFromEvent | Returns a feature id from an event on the renderer. |
| eraseFeatures | This is called by the layer to erase features; removes the feature from the list, then redraws the layer. |
| redraw | The real ‘meat’ of the function: any time things have changed, redraw() can be called to loop over all the data and (you guessed it) redraw it. |
| containerID | {String} |
eraseGeometry: function( geometry )
Erase a geometry from the renderer. Because the Canvas renderer has ‘memory’ of the features that it has drawn, we have to remove the feature so it doesn’t redraw.
| geometry | {OpenLayers.Geometry} |
setExtent: function( extent )
Set the visible part of the layer.
Resolution has probably changed, so we nullify the resolution cache (this.resolution), then redraw.
| extent | {OpenLayers.Bounds} |
setSize: function( size )
Sets the size of the drawing surface.
Once the size is updated, redraw the canvas.
| size | {OpenLayers.Size} |
drawFeature: function( feature, style )
Draw the feature. Stores the feature in the features list, then redraws the layer.
| feature | {OpenLayers.Feature.Vector} |
| style | {<Object>} |
drawGeometry: function( geometry, style )
Used when looping (in redraw) over the features; draws the canvas.
| geometry | {OpenLayers.Geometry} |
| style | {Object} |
| featureId | {String} |
drawExternalGraphic: function( pt, style )
Called to draw External graphics.
| geometry | {OpenLayers.Geometry} |
| style | {Object} |
drawPoint: function( geometry, style )
This method is only called by the renderer itself.
| geometry | {OpenLayers.Geometry} |
| style | {Object} |
drawLineString: function( geometry, style )
This method is only called by the renderer itself.
| geometry | {OpenLayers.Geometry} |
| style | {Object} |
drawLinearRing: function( geometry, style )
This method is only called by the renderer itself.
| geometry | {OpenLayers.Geometry} |
| style | {Object} |
drawPolygon: function( geometry, style )
This method is only called by the renderer itself.
| geometry | {OpenLayers.Geometry} |
| style | {Object} |
getLocalXY: function( point )
transform geographic xy into pixel xy
| point | {OpenLayers.Geometry.Point} |
getFeatureIdFromEvent: function( evt )
Returns a feature id from an event on the renderer.
| evt | {OpenLayers.Event} |
{String} A feature id or null.
eraseFeatures: function( features )
This is called by the layer to erase features; removes the feature from the list, then redraws the layer.
| features | {Array(OpenLayers.Feature.Vector)} |
redraw: function()
The real ‘meat’ of the function: any time things have changed, redraw() can be called to loop over all the data and (you guessed it) redraw it. Unlike Elements-based Renderers, we can’t interact with things once they’re drawn, to remove them, for example, so instead we have to just clear everything and draw from scratch.
Erase a geometry from the renderer.
eraseGeometry: function( geometry )
{Boolean} Whether or not the browser supports the renderer class
supported: function()
Set the visible part of the layer.
setExtent: function( extent )
Sets the size of the drawing surface.
setSize: function( size )
Draw the feature.
drawFeature: function( feature, style )
Used when looping (in redraw) over the features; draws the canvas.
drawGeometry: function( geometry, style )
Called to draw External graphics.
drawExternalGraphic: function( pt, style )
Prepare the canvas for drawing by setting various global settings.
setCanvasStyle: function( type, style )
This method is only called by the renderer itself.
drawPoint: function( geometry, style )
This method is only called by the renderer itself.
drawLineString: function( geometry, style )
This method is only called by the renderer itself.
drawLinearRing: function( geometry, style )
This method is only called by the renderer itself.
drawPolygon: function( geometry, style )
transform geographic xy into pixel xy
getLocalXY: function( point )
Clear all vectors from the renderer.
clear: function()
Returns a feature id from an event on the renderer.
getFeatureIdFromEvent: function( evt )
This is called by the layer to erase features; removes the feature from the list, then redraws the layer.
eraseFeatures: function( features )
The real ‘meat’ of the function: any time things have changed, redraw() can be called to loop over all the data and (you guessed it) redraw it.
redraw: function()