OpenLayers.Renderer.VML

Render vector features in browsers with VML capability.  Construct a new VML renderer with the OpenLayers.Renderer.VML constructor.

Note that for all calculations in this class, we use toFixed() to round a float value to an integer.  This is done because it seems that VML doesn’t support float values.

Inherits from

Summary
OpenLayers.Renderer.VMLRender vector features in browsers with VML capability.
Properties
xmlns{String} XML Namespace URN
symbolCache{DOMElement} node holding symbols.
offset{Object} Hash with “x” and “y” properties
Constructor
OpenLayers.Renderer.VMLCreate a new VML renderer.
Functions
destroyDeconstruct the renderer.
supportedDetermine whether a browser supports this renderer.
setExtentSet the renderer’s extent
setSizeSet the size of the drawing surface
getNodeTypeGet the node type for a geometry and style
setStyleUse to set all the style attributes to a VML node.
graphicRotateIf a point is to be styled with externalGraphic and rotation, VML fills cannot be used to display the graphic, because rotation of graphic fills is not supported by the VML implementation of Internet Explorer.
postDrawSome versions of Internet Explorer seem to be unable to set fillcolor and strokecolor to “none” correctly before the fill node is appended to a visible vml node.
setNodeDimensionGet the geometry’s bounds, convert it to our vml coordinate system, then set the node’s position, size, and local coordinate system.
dashStyle
createNodeCreate a new node
nodeTypeCompareDetermine whether a node is of a given type
createRenderRootCreate the renderer root
createRootCreate the main root element
drawPointRender a point
drawCircleRender a circle.
drawLineStringRender a linestring.
drawLinearRingRender a linearring
DrawLineRender a line.
drawPolygonRender a polygon
drawRectangleRender a rectangle
drawTextThis method is only called by the renderer itself.
drawSurface
moveRootmoves this renderer’s root to a different renderer.
importSymboladd a new symbol definition from the rendererer’s symbol hash
Constants
OpenLayers.Renderer.VML.LABEL_SHIFT{Object}

Properties

xmlns

{String} XML Namespace URN

symbolCache

{DOMElement} node holding symbols.  This hash is keyed by symbol name, and each value is a hash with a “path” and an “extent” property.

offset

{Object} Hash with “x” and “y” properties

Constructor

OpenLayers.Renderer.VML

Create a new VML renderer.

Parameters

containerID{String} The id for the element that contains the renderer

Functions

destroy

destroy: function()

Deconstruct the renderer.

supported

supported: function()

Determine whether a browser supports this renderer.

Returns

{Boolean} The browser supports the VML renderer

setExtent

setExtent: function(extent,
resolutionChanged)

Set the renderer’s extent

Parameters

extent{OpenLayers.Bounds}
resolutionChanged{Boolean}

Returns

{Boolean} true to notify the layer that the new extent does not exceed the coordinate range, and the features will not need to be redrawn.

setSize

setSize: function(size)

Set the size of the drawing surface

Parameters

size{OpenLayers.Size} the size of the drawing surface

getNodeType

getNodeType: function(geometry,
style)

Get the node type for a geometry and style

Parameters

geometry{OpenLayers.Geometry}
style{Object}

Returns

{String} The corresponding node type for the specified geometry

setStyle

setStyle: function(node,
style,
options,
geometry)

Use to set all the style attributes to a VML node.

Parameters

node{DOMElement} An VML element to decorate
style{Object}
options{Object} Currently supported options include ‘isFilled’ {Boolean} and ‘isStroked’ {Boolean}
geometry{OpenLayers.Geometry}

graphicRotate

graphicRotate: function(node,
xOffset,
yOffset)

If a point is to be styled with externalGraphic and rotation, VML fills cannot be used to display the graphic, because rotation of graphic fills is not supported by the VML implementation of Internet Explorer.  This method creates a olv:imagedata element inside the VML node, DXImageTransform.Matrix and BasicImage filters for rotation and opacity, and a 3-step hack to remove rendering artefacts from the graphic and preserve the ability of graphics to trigger events.  Finally, OpenLayers methods are used to determine the correct insertion point of the rotated image, because DXImageTransform.Matrix does the rotation without the ability to specify a rotation center point.

Parameters

node{DOMElement}
xOffset{Number} rotation center relative to image, x coordinate
yOffset{Number} rotation center relative to image, y coordinate

postDraw

postDraw: function(node)

Some versions of Internet Explorer seem to be unable to set fillcolor and strokecolor to “none” correctly before the fill node is appended to a visible vml node.  This method takes care of that and sets fillcolor and strokecolor again if needed.

Parameters

node{DOMElement}

setNodeDimension

setNodeDimension: function(node,
geometry)

Get the geometry’s bounds, convert it to our vml coordinate system, then set the node’s position, size, and local coordinate system.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

dashStyle

dashStyle: function(style)

Parameters

style{Object}

Returns

{String} A VML compliant ‘stroke-dasharray’ value

createNode

createNode: function(type,
id)

Create a new node

Parameters

type{String} Kind of node to draw
id{String} Id for node

Returns

{DOMElement} A new node of the given type and id

nodeTypeCompare

nodeTypeCompare: function(node,
type)

Determine whether a node is of a given type

Parameters

node{DOMElement} An VML element
type{String} Kind of node

Returns

{Boolean} Whether or not the specified node is of the specified type

createRenderRoot

createRenderRoot: function()

Create the renderer root

Returns

{DOMElement} The specific render engine’s root element

createRoot

createRoot: function(suffix)

Create the main root element

Parameters

suffix{String} suffix to append to the id

Returns

{DOMElement}

drawPoint

drawPoint: function(node,
geometry)

Render a point

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the point could not be drawn

drawCircle

drawCircle: function(node,
geometry,
radius)

Render a circle.  Size and Center a circle given geometry (x,y center) and radius

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}
radius{float}

Returns

{DOMElement} or false if the circle could not ne drawn

drawLineString

drawLineString: function(node,
geometry)

Render a linestring.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement}

drawLinearRing

drawLinearRing: function(node,
geometry)

Render a linearring

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement}

DrawLine

Render a line.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}
closeLine{Boolean} Close the line?  (make it a ring?)

Returns

{DOMElement}

drawPolygon

drawPolygon: function(node,
geometry)

Render a polygon

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement}

drawRectangle

drawRectangle: function(node,
geometry)

Render a rectangle

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement}

drawText

drawText: function(featureId,
style,
location)

This method is only called by the renderer itself.

Parameters

featureId{String} style -
location{OpenLayers.Geometry.Point}

drawSurface

drawSurface: function(node,
geometry)

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement}

moveRoot

moveRoot: function(renderer)

moves this renderer’s root to a different renderer.

Parameters

renderer{OpenLayers.Renderer} target renderer for the moved root
root{DOMElement} optional root node.  To be used when this renderer holds roots from multiple layers to tell this method which one to detach

Returns

{Boolean} true if successful, false otherwise

importSymbol

importSymbol: function (graphicName)

add a new symbol definition from the rendererer’s symbol hash

Parameters

graphicName{String} name of the symbol to import

Returns

{Object}hash of {DOMElement} “symbol” and {Number} “size”

Constants

OpenLayers.Renderer.VML.LABEL_SHIFT

{Object}

destroy: function()
Deconstruct the renderer.
supported: function()
Determine whether a browser supports this renderer.
setExtent: function(extent,
resolutionChanged)
Set the renderer’s extent
setSize: function(size)
Set the size of the drawing surface
getNodeType: function(geometry,
style)
Get the node type for a geometry and style
setStyle: function(node,
style,
options,
geometry)
Use to set all the style attributes to a VML node.
graphicRotate: function(node,
xOffset,
yOffset)
If a point is to be styled with externalGraphic and rotation, VML fills cannot be used to display the graphic, because rotation of graphic fills is not supported by the VML implementation of Internet Explorer.
postDraw: function(node)
Some versions of Internet Explorer seem to be unable to set fillcolor and strokecolor to “none” correctly before the fill node is appended to a visible vml node.
setNodeDimension: function(node,
geometry)
Get the geometry’s bounds, convert it to our vml coordinate system, then set the node’s position, size, and local coordinate system.
dashStyle: function(style)
createNode: function(type,
id)
Create a new node
nodeTypeCompare: function(node,
type)
Determine whether a node is of a given type
createRenderRoot: function()
Create the renderer root
createRoot: function(suffix)
Create the main root element
drawPoint: function(node,
geometry)
Render a point
drawCircle: function(node,
geometry,
radius)
Render a circle.
drawLineString: function(node,
geometry)
Render a linestring.
drawLinearRing: function(node,
geometry)
Render a linearring
drawPolygon: function(node,
geometry)
Render a polygon
drawRectangle: function(node,
geometry)
Render a rectangle
drawText: function(featureId,
style,
location)
This method is only called by the renderer itself.
drawSurface: function(node,
geometry)
moveRoot: function(renderer)
moves this renderer’s root to a different renderer.
importSymbol: function (graphicName)
add a new symbol definition from the rendererer’s symbol hash
Create a new VML renderer.
This is another virtual class in that it should never be instantiated by itself as a Renderer.
Instances of this class represent bounding boxes.
Instances of this class represent a width/height pair
A Geometry is a description of a geographic object.
Point geometry class.
This is the base class for all renderers.
Close