maps.nyc.gov

Class: Draw

nyc.ol.Draw(options)

new Draw(options)

A class to provide the user with drawing tools
Parameters:
Name Type Description
options nyc.ol.Draw.Options Constructor options
Source:
Fires:

Extends

Members

(static) EventType :string

Enumeration for tracker event types
Type:
  • string
Properties:
Name Type Description
ACTIVE_CHANGED string The active changed event type
Source:

(static) Type :string

Enumeration for draw types
Type:
  • string
Properties:
Name Type Description
POINT string The point drawing type
LINE string The line drawing type
POLYGON string The polugon drawing type
CIRCLE string The circle drawing type
SQUARE string The square drawing type
BOX string The box drawing type
FREE string The freehand drawing type
GPS string The GPS capture drawing type
NONE string No drawing type
Source:

tracker :nyc.ol.Tracker

The tracker used to draw based on device geolocation
Type:
Source:

Methods

activate(type)

Activate to begin adding drawings of the specified type
Parameters:
Name Type Description
type nyc.ol.Draw.Type The drawing type to activate
Source:

active() → {boolean}

Return the active state
Source:
Returns:
The active state
Type
boolean

addFeatures(features, silent)

Set features on the drawing layer
Parameters:
Name Type Description
features Array.<nyc.ol.Feature> The features
silent boolean Do not trigger events
Source:

clear()

Remove all features from the drawing layer
Source:

deactivate(silent)

Deactivate to stop drawing
Parameters:
Name Type Description
silent boolean
Source:

getFeatures() → {Object.<string, Array.<ol.Feature>>}

Get the features that are unchanged or have been added, changed, or removed
Source:
Returns:
The features
Type
Object.<string, Array.<ol.Feature>>

off(eventName, evtHdlr, hdlrScopeopt)

Remove a previously connected event handler
Parameters:
Name Type Attributes Description
eventName string The name of the event to which the handler will be connected
evtHdlr function The event handler function
hdlrScope Object <optional>
The scope in which to invoke the event handler
Inherited From:
Source:

on(eventName, evtHdlr, hdlrScopeopt)

Connect a function to an event
Parameters:
Name Type Attributes Description
eventName string The name of the event to which the handler will be connected
evtHdlr function The event handler function
hdlrScope Object <optional>
The scope in which to invoke the event handler
Inherited From:
Source:

one(eventName, evtHdlr, hdlrScopeopt)

Connect a function to an event for a single invocation
Parameters:
Name Type Attributes Description
eventName string The name of the event to which the handler will be connected
evtHdlr function The event handler function
hdlrScope Object <optional>
The scope in which to invoke the event handler
Inherited From:
Source:

removeFeature(feature)

Remove a features from the drawing layer
Parameters:
Name Type Description
feature ol.Feature The feature to remove
Source:

setFeatures(features)

Add features to the drawing layer
Parameters:
Name Type Description
features Array.<nyc.ol.Feature> The features
Source:

setGpsAccuracyLimit(limit)

Set the accuracy limit for geolocation capture
Parameters:
Name Type Description
limit number The accuracy limit in meters
Source:

trigger(eventName, dataopt)

Trigger a named event with event data
Parameters:
Name Type Attributes Description
eventName string The name of the event to trigger
data Object <optional>
The event data
Inherited From:
Source:

Type Definitions

Options

Constructor options for nyc.ol.Draw
Type:
  • Object
Properties:
Name Type Attributes Default Description
map ol.Map The OpenLayers map with which the user will interact
source ol.source.Vector The source on which to draw
style ol.style.Style <optional>
The style to use for features added to the map
accuracyStyle ol.style.Style <optional>
The style to use for displaying geolocation accuracy values
restore boolean <optional>
true Prompt for restore
showAccuracy boolean <optional>
true Visibility of the accuracy layer
showEveryTrackPositon boolean <optional>
true Include all positons along GPS teack
Source:

Events

activechanged

The active changed event
Type:
  • ol.events.Event
Source:

nyc-lib: Class: Draw

maps.nyc.gov

Class: Draw

nyc.ol.Draw(options)

new Draw(options)

A class to provide the user with drawing tools
Parameters:
Name Type Description
options nyc.ol.Draw.Options Constructor options
Source:
Fires:

Extends

Members

(static) EventType :string

Enumeration for tracker event types
Type:
  • string
Properties:
Name Type Description
ACTIVE_CHANGED string The active changed event type
Source:

(static) Type :string

Enumeration for draw types
Type:
  • string
Properties:
Name Type Description
POINT string The point drawing type
LINE string The line drawing type
POLYGON string The polugon drawing type
CIRCLE string The circle drawing type
SQUARE string The square drawing type
BOX string The box drawing type
FREE string The freehand drawing type
GPS string The GPS capture drawing type
NONE string No drawing type
Source:

tracker :nyc.ol.Tracker

The tracker used to draw based on device geolocation
Type:
Source:

Methods

activate(type)

Activate to begin adding drawings of the specified type
Parameters:
Name Type Description
type nyc.ol.Draw.Type The drawing type to activate
Source:

active() → {boolean}

Return the active state
Source:
Returns:
The active state
Type
boolean

addFeatures(features, silent)

Set features on the drawing layer
Parameters:
Name Type Description
features Array.<nyc.ol.Feature> The features
silent boolean Do not trigger events
Source:

clear()

Remove all features from the drawing layer
Source:

deactivate(silent)

Deactivate to stop drawing
Parameters:
Name Type Description
silent boolean
Source:

getFeatures() → {Object.<string, Array.<ol.Feature>>}

Get the features that are unchanged or have been added, changed, or removed
Source:
Returns:
The features
Type
Object.<string, Array.<ol.Feature>>

off(eventName, evtHdlr, hdlrScopeopt)

Remove a previously connected event handler
Parameters:
Name Type Attributes Description
eventName string The name of the event to which the handler will be connected
evtHdlr function The event handler function
hdlrScope Object <optional>
The scope in which to invoke the event handler
Inherited From:
Source:

on(eventName, evtHdlr, hdlrScopeopt)

Connect a function to an event
Parameters:
Name Type Attributes Description
eventName string The name of the event to which the handler will be connected
evtHdlr function The event handler function
hdlrScope Object <optional>
The scope in which to invoke the event handler
Inherited From:
Source:

one(eventName, evtHdlr, hdlrScopeopt)

Connect a function to an event for a single invocation
Parameters:
Name Type Attributes Description
eventName string The name of the event to which the handler will be connected
evtHdlr function The event handler function
hdlrScope Object <optional>
The scope in which to invoke the event handler
Inherited From:
Source:

removeFeature(feature)

Remove a features from the drawing layer
Parameters:
Name Type Description
feature ol.Feature The feature to remove
Source:

setFeatures(features)

Add features to the drawing layer
Parameters:
Name Type Description
features Array.<nyc.ol.Feature> The features
Source:

setGpsAccuracyLimit(limit)

Set the accuracy limit for geolocation capture
Parameters:
Name Type Description
limit number The accuracy limit in meters
Source:

trigger(eventName, dataopt)

Trigger a named event with event data
Parameters:
Name Type Attributes Description
eventName string The name of the event to trigger
data Object <optional>
The event data
Inherited From:
Source:

Type Definitions

Options

Constructor options for nyc.ol.Draw
Type:
  • Object
Properties:
Name Type Attributes Default Description
map ol.Map The OpenLayers map with which the user will interact
source ol.source.Vector The source on which to draw
style ol.style.Style <optional>
The style to use for features added to the map
accuracyStyle ol.style.Style <optional>
The style to use for displaying geolocation accuracy values
restore boolean <optional>
true Prompt for restore
showAccuracy boolean <optional>
true Visibility of the accuracy layer
showEveryTrackPositon boolean <optional>
true Include all positons along GPS teack
Source:

Events

activechanged

The active changed event
Type:
  • ol.events.Event
Source: