ALKMaps.Renderer.SVG2

Inherits from

Summary
ALKMaps.Renderer.SVG2
Properties
xmlns{String}
xlinkns{String}
symbolMetrics{Object} Cache for symbol metrics according to their svg coordinate space.
Constants
labelNodeType{String} The node type for text label containers.
Constructor
ALKMaps.Renderer.SVG2
Functions
supported{Boolean} Whether or not the browser supports the SVG renderer
updateDimensions
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.
drawTextFunction for drawing text labels.
getComponentString
getShortString
importSymboladd a new symbol definition from the rendererer’s symbol hash
getFeatureIdFromEvent
Constants
ALKMaps.Renderer.SVG2.LABEL_ALIGN{Object}
ALKMaps.Renderer.SVG2.LABEL_VSHIFT{Object}
ALKMaps.Renderer.SVG2.LABEL_VFACTOR{Object}
Functions
ALKMaps.Renderer.SVG2.preventDefaultUsed to prevent default events (especially opening images in a new tab on ctrl-click) from being executed for externalGraphic and graphicName symbols

Properties

xmlns

{String}

xlinkns

{String}

symbolMetrics

{Object} Cache for symbol metrics according to their svg coordinate space.  This is an object keyed by the symbol’s id, and values are an object with size, x and y properties.

Constants

labelNodeType

{String} The node type for text label containers.

Constructor

ALKMaps.Renderer.SVG2

Parameters

containerID{String}

Functions

supported

supported: function()

Returns

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

updateDimensions

updateDimensions: function(zoomChanged)

Parameters

zoomChanged{Boolean}

getNodeType

getNodeType: function(geometry,
style)

Parameters

geometry{ALKMaps.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{ALKMaps.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{ALKMaps.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{ALKMaps.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{ALKMaps.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{ALKMaps.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{ALKMaps.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{ALKMaps.Geometry}

Returns

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

drawText

drawText: function(featureId,
style,
location)

Function for drawing text labels.  This method is only called by the renderer itself.

Parameters

featureId{String|DOMElement}
style{Object}
location{ALKMaps.Geometry.Point}, will be modified inline

Returns

{DOMElement} container holding the text label

getComponentString

Parameters

components{Array(ALKMaps.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)

getShortString

getShortString: function(point)

Parameters

point{ALKMaps.Geometry.Point}

Returns

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

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

{DOMElement}the imported symbol

getFeatureIdFromEvent

getFeatureIdFromEvent: function(evt)

Parameters

evt{Object} An ALKMaps.Event object

Returns

{ALKMaps.Geometry} A geometry from an event that happened on a layer.

Constants

ALKMaps.Renderer.SVG2.LABEL_ALIGN

{Object}

ALKMaps.Renderer.SVG2.LABEL_VSHIFT

{Object}

ALKMaps.Renderer.SVG2.LABEL_VFACTOR

{Object}

Functions

ALKMaps.Renderer.SVG2.preventDefault

ALKMaps.Renderer.SVG2.preventDefault = function(e)

Used to prevent default events (especially opening images in a new tab on ctrl-click) from being executed for externalGraphic and graphicName symbols

supported: function()
{Boolean} Whether or not the browser supports the SVG renderer
updateDimensions: function(zoomChanged)
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)
Function for drawing text labels.
getShortString: function(point)
importSymbol: function (graphicName)
add a new symbol definition from the rendererer’s symbol hash
getFeatureIdFromEvent: function(evt)
ALKMaps.Renderer.SVG2.preventDefault = function(e)
Used to prevent default events (especially opening images in a new tab on ctrl-click) from being executed for externalGraphic and graphicName symbols
A Geometry is a description of a geographic object.
Point geometry class.
Utility functions for event handling.
Close