renderer

geo.svg. renderer

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

Description:
  • Create a new instance of class svgRenderer.

Source:
Parameters:
Name Type Description
arg object

Options for the renderer.

Properties
Name Type Attributes Default Description
layer geo.layer <optional>

Layer associated with the renderer.

canvas HTMLElement <optional>

Canvas element associated with the renderer.

widget boolean <optional>
false

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
geo.svg.svgRenderer

Extends

Members

idle

Description:
  • Getter for the idle state. Read only.

Source:
Inherited From:
Properties:
Name Type Description
idle boolean

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

Getter for the idle state. Read only.

Methods

addPromise(promise) → {this}

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

Source:
Inherited From:
Parameters:
Name Type Description
promise Promise

A promise object.

Returns:
Type
this

api() → {string}

Description:
  • Get API used by the renderer.

Source:
Overrides:
Returns:

'svg'.

Type
string

canvas(valopt) → {HTMLElement|this}

Description:
  • Get/set canvas for the renderer.

Source:
Inherited From:
Parameters:
Name Type Attributes Description
val HTMLElement <optional>

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

Returns:

The current canvas element or the renderer instance.

Type
HTMLElement | this

draw()

Description:
  • Override draw method to do nothing.

Source:

geoIsOn(event, handleropt) → {boolean}

Description:
  • Report if an event handler is bound to this object.

Source:
Inherited From:
Parameters:
Name Type Attributes 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:

true if any of the specified events are bound to the specified handler.

Type
boolean

geoOff(eventopt, argopt, nullable) → {this}

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

Source:
Inherited From:
Parameters:
Name Type Attributes 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
this

geoOn(event, handler) → {this}

Description:
  • Bind an event handler to this object.

Source:
Inherited From:
Parameters:
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
this

geoOnce(event, handler) → {function}

Description:
  • Bind an event handler to this object that will fire once and then deregister itself.

Source:
Inherited From:
Parameters:
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:

The actual bound handler. This is a wrapper around the handler that was passed to the function.

Type
function

geoTrigger(event, argsopt) → {this}

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

Source:
Inherited From:
Parameters:
Name Type Attributes 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
this

height() → {number}

Description:
  • Get the height of the renderer.

Source:
Inherited From:
Returns:

The height of the renderer.

Type
number

initialized(valopt) → {boolean|this}

Description:
  • Get/set if renderer has been initialized.

Source:
Inherited From:
Parameters:
Name Type Attributes Description
val boolean <optional>

If undefined return the initialization state, otherwise set it.

Returns:

The initialization state or this renderer instance.

Type
boolean | this

layer() → {geo.layer}

Description:
  • Get layer of the renderer.

Source:
Inherited From:
Returns:
Type
geo.layer

map() → {geo.map|null}

Description:
  • Get the map associated with the renderer's layer.

Source:
Inherited From:
Returns:

The map associated with the renderer's layer or null if there is no layer.

Type
geo.map | null

modified() → {this}

Description:
  • Update the timestamp to the next global timestamp value.

Source:
Inherited From:
Returns:
Type
this

onIdle(handler) → {this}

Description:
  • 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.

Source:
Inherited From:
Parameters:
Name Type Description
handler function

A function taking no arguments.

Returns:
Type
this

removePromise(promise) → {this}

Description:
  • Mark a promise as no longer required to resolve before the idle state is reached.

Source:
Inherited From:
Parameters:
Name Type Description
promise Promise

A promise object.

Returns:
Type
this

scaleFactor() → {number}

Description:
  • 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.

Source:
Returns:

The current scale factor.

Type
number

select(id, parentIdopt) → {d3Selector}

Description:
  • Returns a d3 selection for the given feature id.

Source:
Parameters:
Name Type Attributes 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
d3Selector

timestamp() → {number}

Description:
  • Get time.

Source:
Inherited From:
Returns:

The timestamp. This is 0 if the timestamp has never been modified.

Type
number

width() → {number}

Description:
  • Get the width of the renderer.

Source:
Inherited From:
Returns:

The width of the renderer.

Type
number

(static) fallback() → {null}

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

Source:
Returns:

null for the null renderer.

Type
null

(static) supported() → {boolean}

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

Source:
Returns:

true if available.

Type
boolean

(inner) getGroup(parentIdopt) → {d3Selector}

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

Source:
Parameters:
Name Type Attributes Description
parentId string <optional>

Optional parent ID name.

Returns:

Selector with the d3 group.

Type
d3Selector

(inner) initCorners()

Description:
  • Set the initial lat-lon coordinates of the map view.

Source:

(inner) setAttrs(select, attrs)

Description:
  • Set attributes to a d3 selection.

Source:
Parameters:
Name Type Description
select d3Selector

The d3 selector with the elements to change.

attrs object

A map of attributes to set on the elements.

(inner) setStyles(select, styles)

Description:
  • Set styles to a d3 selection. Ignores unknown style keys.

Source:
Parameters:
Name Type Description
select d3Selector

The d3 selector with the elements to change.

styles object

Style object associated with a feature.