OpenLayers.Renderer.SVG

Inherits

Summary
OpenLayers.Renderer.SVG
Properties
xmlns{String}
xlinkns{String}
Constants
MAX_PIXEL{Integer} Firefox has a limitation where values larger or smaller than about 15000 in an SVG document lock the browser up.
Properties
translationParameters{Object} Hash with “x” and “y” properties
symbolSize{Object} Cache for symbol sizes according to their svg coordinate space
isGecko{Boolean}
Constructor
OpenLayers.Renderer.SVG
Functions
destroy
supported{Boolean} Whether or not the browser supports the SVG renderer
inValidRangeSee #669 for more information
setExtent
translateTransforms the SVG coordinate system
setSizeSets the size of the drawing surface.
getNodeType
setStyleUse to set all the style attributes to a SVG node.
dashStyle
createNode
nodeTypeCompare
createRenderRoot{DOMElement} The specific render engine’s root element
createRoot
createDefs{DOMElement} The element to which we’ll add the symbol definitions
drawPointThis method is only called by the renderer itself.
drawCircleThis method is only called by the renderer itself.
drawLineStringThis method is only called by the renderer itself.
drawLinearRingThis method is only called by the renderer itself.
drawPolygonThis method is only called by the renderer itself.
drawRectangleThis method is only called by the renderer itself.
drawSurfaceThis method is only called by the renderer itself.
drawTextThis method is only called by the renderer itself.
getComponentString
clipLineGiven two points (one inside the valid range, and one outside), clips the line betweeen the two points so that the new points are both inside the valid range.
getShortString
getPositionFinds the position of an svg node.
importSymboladd a new symbol definition from the rendererer’s symbol hash
Constants
OpenLayers.Renderer.SVG.LABEL_ALIGN{Object}
OpenLayers.Renderer.SVG.LABEL_VSHIFT{Object}

Properties

xmlns

{String}

xlinkns

{String}

Constants

MAX_PIXEL

{Integer} Firefox has a limitation where values larger or smaller than about 15000 in an SVG document lock the browser up.  This works around it.

Properties

translationParameters

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

symbolSize

{Object} Cache for symbol sizes according to their svg coordinate space

isGecko

{Boolean}

Constructor

OpenLayers.Renderer.SVG

Parameters

containerID{String}

Functions

destroy

destroy: function()

supported

supported: function()

Returns

{Boolean} Whether or not the browser supports the SVG renderer

inValidRange

inValidRange: function(x,
y,
xyOnly)

See #669 for more information

Parameters

x{Integer}
y{Integer}
xyOnly{Boolean} whether or not to just check for x and y, which means to not take the current translation parameters into account if true.

Returns

{Boolean} Whether or not the ‘x’ and ‘y’ coordinates are in the valid range.

setExtent

setExtent: function(extent,
resolutionChanged)

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.  False otherwise.

translate

translate: function(x,
y)

Transforms the SVG coordinate system

Parameters

x{Float}
y{Float}

Returns

{Boolean} true if the translation parameters are in the valid coordinates range, false otherwise.

setSize

setSize: function(size)

Sets the size of the drawing surface.

Parameters

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

getNodeType

getNodeType: function(geometry,
style)

Parameters

geometry{OpenLayers.Geometry}
style{Object}

Returns

{String} The corresponding node type for the specified geometry

setStyle

setStyle: function(node,
style,
options)

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

Takes care to adjust stroke width and point radius to be resolution-relative

Parameters

node{SVGDomElement} An SVG element to decorate
style{Object}
options{Object} Currently supported options include ‘isFilled’ {Boolean} and ‘isStroked’ {Boolean}

dashStyle

dashStyle: function(style,
widthFactor)

Parameters

style{Object}
widthFactor{Number}

Returns

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

createNode

createNode: function(type,
id)

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)

Parameters

node{SVGDomElement} An SVG element
type{String} Kind of node

Returns

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

createRenderRoot

createRenderRoot: function()

Returns

{DOMElement} The specific render engine’s root element

createRoot

createRoot: function(suffix)

Parameter

suffix{String} suffix to append to the id

Returns

{DOMElement}

createDefs

createDefs: function()

Returns

{DOMElement} The element to which we’ll add the symbol definitions

drawPoint

drawPoint: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the renderer could not draw the point

drawCircle

drawCircle: function(node,
geometry,
radius)

This method is only called by the renderer itself.

Parameters

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

Returns

{DOMElement} or false if the renderer could not draw the circle

drawLineString

drawLineString: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or null if the renderer could not draw all components of the linestring, or false if nothing could be drawn

drawLinearRing

drawLinearRing: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or null if the renderer could not draw all components of the linear ring, or false if nothing could be drawn

drawPolygon

drawPolygon: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or null if the renderer could not draw all components of the polygon, or false if nothing could be drawn

drawRectangle

drawRectangle: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the renderer could not draw the rectangle

drawSurface

drawSurface: function(node,
geometry)

This method is only called by the renderer itself.

Parameters

node{DOMElement}
geometry{OpenLayers.Geometry}

Returns

{DOMElement} or false if the renderer could not draw the surface

drawText

drawText: function(featureId,
style,
location)

This method is only called by the renderer itself.

Parameters

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

getComponentString

Parameters

components{Array(OpenLayers.Geometry.Point)} Array of points
separator{String} character between coordinate pairs.  Defaults to “,”

Returns

{Object} hash with properties “path” (the string created from the components and “complete” (false if the renderer was unable to draw all components)

clipLine

clipLine: function(badComponent,
goodComponent)

Given two points (one inside the valid range, and one outside), clips the line betweeen the two points so that the new points are both inside the valid range.

Parameters

badComponent{OpenLayers.Geometry.Point)} original geometry of the invalid point
goodComponent{OpenLayers.Geometry.Point)} original geometry of the valid point Returns {String} the SVG coordinate pair of the clipped point (like getShortString), or an empty string if both passed componets are at the same point.

getShortString

getShortString: function(point)

Parameters

point{OpenLayers.Geometry.Point}

Returns

{String} or false if point is outside the valid range

getPosition

getPosition: function(node)

Finds the position of an svg node.

Parameters

node{DOMElement}

Returns

{Object} hash with x and y properties, representing the coordinates within the svg coordinate system

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

{String}id of the imported symbol

Constants

OpenLayers.Renderer.SVG.LABEL_ALIGN

{Object}

OpenLayers.Renderer.SVG.LABEL_VSHIFT

{Object}

destroy: function()
supported: function()
{Boolean} Whether or not the browser supports the SVG renderer
inValidRange: function(x,
y,
xyOnly)
See #669 for more information
setExtent: function(extent,
resolutionChanged)
translate: function(x,
y)
Transforms the SVG coordinate system
setSize: function(size)
Sets the size of the drawing surface.
getNodeType: function(geometry,
style)
setStyle: function(node,
style,
options)
Use to set all the style attributes to a SVG node.
dashStyle: function(style,
widthFactor)
createNode: function(type,
id)
nodeTypeCompare: function(node,
type)
createRenderRoot: function()
{DOMElement} The specific render engine’s root element
createRoot: function(suffix)
createDefs: function()
{DOMElement} The element to which we’ll add the symbol definitions
drawPoint: function(node,
geometry)
This method is only called by the renderer itself.
drawCircle: function(node,
geometry,
radius)
This method is only called by the renderer itself.
drawLineString: function(node,
geometry)
This method is only called by the renderer itself.
drawLinearRing: function(node,
geometry)
This method is only called by the renderer itself.
drawPolygon: function(node,
geometry)
This method is only called by the renderer itself.
drawRectangle: function(node,
geometry)
This method is only called by the renderer itself.
drawSurface: function(node,
geometry)
This method is only called by the renderer itself.
drawText: function(featureId,
style,
location)
This method is only called by the renderer itself.
clipLine: function(badComponent,
goodComponent)
Given two points (one inside the valid range, and one outside), clips the line betweeen the two points so that the new points are both inside the valid range.
getShortString: function(point)
getPosition: function(node)
Finds the position of an svg node.
importSymbol: function (graphicName)
add a new symbol definition from the rendererer’s symbol hash
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.
Close