Class: renderer

geo.svg. renderer

new geo.svg.renderer(arg){geo.svg.svgRenderer}

Create a new instance of class svgRenderer.

Name Type Description
arg object

Options for the renderer.

Name Type Default Description
layer geo.layer optional

Layer associated with the renderer.

canvas HTMLElement optional

Canvas element associated with the renderer.

widget boolean false optional

Set to true if this is a stand-alone widget. If it is not a widget, svg elements are wrapped in a parent group.

d3Parent HTMLElement optional

If specified, the parent for any rendered objects; otherwise the renderer's layer's main node is used.

Returns:
Type Description
geo.svg.svgRenderer

Extends

Members

inherited idle

Getter for the idle state. Read only.

Properties:
Name Type Description
idle boolean

true if the object is idle (onIdle would call a handler immediately).

Static Methods

staticgeo.svg.renderer.fallback(){null}

If the d3 renderer is not supported, supply the name of a renderer that should be used instead. This asks for the null renderer.

Returns:
Type Description
null null for the null renderer.

staticgeo.svg.renderer.supported(){boolean}

Report if the d3 renderer is supported. This is just a check if d3 is available.

Returns:
Type Description
boolean true if available.

Methods

inherited addPromise(promise){this}

Add a new promise object preventing idle event handlers from being called until it is resolved.

Name Type Description
promise Promise

A promise object.

Returns:
Type Description
this

api(){string}

Get API used by the renderer.

Returns:
Type Description
string 'svg'.

inherited canvas(val){HTMLElement|this}

Get/set canvas for the renderer.

Name Type Description
val HTMLElement optional

If undefined, return the current canvas element, otherwise set the canvas element and mark the renderer as modified.

Returns:
Type Description
HTMLElement | this The current canvas element or the renderer instance.

Override draw method to do nothing.

inherited geoIsOn(event, handler){boolean}

Report if an event handler is bound to this object.

Name Type Description
event string | Array.<string>

An event or list of events to check.

handler function optional

A function that might be bound. If undefined, this will report true if there is any handler for the specified event.

Returns:
Type Description
boolean true if any of the specified events are bound to the specified handler.

inherited geoOff(event, arg){this}

Remove handlers from one event or an array of events. If no event is provided all handlers will be removed.

Name Type Description
event string | Array.<string> optional

An event or a list of events from geo.event or defined by the user, or undefined to remove all events (in which case arg is ignored).

arg function | Array.<function()> optional nullable

A function or array of functions to remove from the events or a falsy value to remove all handlers from the events.

Returns:
Type Description
this

inherited geoOn(event, handler){this}

Bind an event handler to this object.

Name Type Description
event string

An event from geo.event or a user-defined value.

handler function

A function that is called when event is triggered. The function is passed a geo.event object.

Returns:
Type Description
this

inherited geoTrigger(event, args){this}

Trigger an event (or events) on this object and call all handlers.

Name Type Description
event string | Array.<string>

An event or list of events from geo.event or defined by the user.

args object optional

Additional information to add to the geo.event object passed to the handlers.

Returns:
Type Description
this

inherited height(){number}

Get the height of the renderer.

Returns:
Type Description
number The height of the renderer.

inherited initialized(val){boolean|this}

Get/set if renderer has been initialized.

Name Type Description
val boolean optional

If undefined return the initialization state, otherwise set it.

Returns:
Type Description
boolean | this The initialization state or this renderer instance.

Get layer of the renderer.

Returns:
Type Description
geo.layer

Get the map associated with the renderer's layer.

Returns:
Type Description
geo.map | null The map associated with the renderer's layer or null if there is no layer.

inherited modified(){this}

Update the timestamp to the next global timestamp value.

Returns:
Type Description
this

inherited onIdle(handler){this}

Bind a handler that will be called one time when all internal promises are resolved. If there are no outstanding promises, this is invoked synchronously.

Name Type Description
handler function

A function taking no arguments.

Returns:
Type Description
this

scaleFactor(){number}

Return the current scaling factor to build features that shouldn't change size during zooms. For example:

selection.append('circle') .attr('r', r0 / renderer.scaleFactor());

This will create a circle element with radius r0 independent of the current zoom level.

Returns:
Type Description
number The current scale factor.

select(id, parentId){d3Selector}

Returns a d3 selection for the given feature id.

Name Type Description
id string

The id of the feature to select.

parentId string optional

The parent of the feature. This is used to determine the feature's group.

Returns:
Type Description
d3Selector

inherited timestamp(){number}

Get time.

Returns:
Type Description
number The timestamp. This is 0 if the timestamp has never been modified.

inherited width(){number}

Get the width of the renderer.

Returns:
Type Description
number The width of the renderer.

innergetGroup(parentId){d3Selector}

Get the svg group element associated with this renderer instance, or of a group within the render instance.

Name Type Description
parentId string optional

Optional parent ID name.

Returns:
Type Description
d3Selector Selector with the d3 group.

innerinitCorners()

Set the initial lat-lon coordinates of the map view.

innersetAttrs(select, attrs)

Set attributes to a d3 selection.

Name Type Description
select d3Selector

The d3 selector with the elements to change.

attrs object

A map of attributes to set on the elements.

innersetStyles(select, styles)

Set styles to a d3 selection. Ignores unknown style keys.

Name Type Description
select d3Selector

The d3 selector with the elements to change.

styles object

Style object associated with a feature.