OpenLayers JavaScript Mapping Library |
OpenLayers. Renderer. ElementsThis is another virtual class in that it should never be instantiated by itself as a Renderer. It exists because there is tons of shared functionality between different vector libraries which use nodes/elements as a base for rendering vectors. The highlevel bits of code that are implemented here are the adding and removing of geometries, which is essentially the same for any element-based renderer. The details of creating each node and drawing the paths are of course different, but the machinery is the same. InheritsSummary
getNodeType
This function is in charge of asking the specific renderer which type of node to create for the given geometry. All geometries in an Elements-based renderer consist of one node and some attributes. We have the nodeFactory() function which creates a node for us, but it takes a ‘type’ as input, and that is precisely what this function tells us. Parameters
Returns{String} The corresponding node type for the specified geometry drawGeometry
Draw the geometry, creating new nodes, setting paths, setting style, setting featureId on the node. This method should only be called by the renderer itself. Parameters
drawGeometryNode
Given a node, draw a geometry on the specified layer. node and geometry are required arguments, style is optional. This method is only called by the render itself. Parameters
drawPoint
Virtual function for drawing Point Geometry. Should be implemented by subclasses. This method is only called by the renderer itself. Parameters
drawLineString
Virtual function for drawing LineString Geometry. Should be implemented by subclasses. This method is only called by the renderer itself. Parameters
drawLinearRing
Virtual function for drawing LinearRing Geometry. Should be implemented by subclasses. This method is only called by the renderer itself. Parameters
drawPolygon
Virtual function for drawing Polygon Geometry. Should be implemented by subclasses. This method is only called by the renderer itself. Parameters
drawRectangle
Virtual function for drawing Rectangle Geometry. Should be implemented by subclasses. This method is only called by the renderer itself. Parameters
drawCircle
Virtual function for drawing Circle Geometry. Should be implemented by subclasses. This method is only called by the renderer itself. Parameters
drawCurve
Virtual function for drawing Curve Geometry. Should be implemented by subclasses. This method is only called by the renderer itself. Parameters
drawSurface
Virtual function for drawing Surface Geometry. Should be implemented by subclasses. This method is only called by the renderer itself. Parameters
getFeatureIdFromEvent
Parameters
Returns{OpenLayers.Geometry} A geometry from an event that happened on a layer eraseGeometry
Erase a geometry from the renderer. In the case of a multi-geometry, we cycle through and recurse on ourselves. Otherwise, we look for a node with the geometry.id, destroy its geometry, and remove it from the DOM. Parameters
nodeFactory
Create new node of the specified type, with the (optional) specified id. If node already exists with same ID and type, we remove it and then call ourselves again to recreate it. Parameters
Returns{DOMElement} A new node of the given type and id |
destroy: function()
Remove all the elements from the root
clear: function()
This function is in charge of asking the specific renderer which type of node to create for the given geometry.
getNodeType: function( geometry )
Draw the geometry, creating new nodes, setting paths, setting style, setting featureId on the node.
drawGeometry: function( geometry, style, featureId )
Given a node, draw a geometry on the specified layer.
drawGeometryNode: function( node, geometry, style )
Virtual function for drawing Point Geometry.
drawPoint: function( node, geometry )
Virtual function for drawing LineString Geometry.
drawLineString: function( node, geometry )
Virtual function for drawing LinearRing Geometry.
drawLinearRing: function( node, geometry )
Virtual function for drawing Polygon Geometry.
drawPolygon: function( node, geometry )
Virtual function for drawing Rectangle Geometry.
drawRectangle: function( node, geometry )
Virtual function for drawing Circle Geometry.
drawCircle: function( node, geometry )
Virtual function for drawing Curve Geometry.
drawCurve: function( node, geometry )
Virtual function for drawing Surface Geometry.
drawSurface: function( node, geometry )
getFeatureIdFromEvent: function( evt )
Erase a geometry from the renderer.
eraseGeometry: function( geometry )
Create new node of the specified type, with the (optional) specified id.
nodeFactory: function( id, type, geometry )