ALKMaps.Control.SelectFeature

The SelectFeature control selects vector features from a given layer on click or hover.

Inherits from

Summary
ALKMaps.Control.SelectFeatureThe SelectFeature control selects vector features from a given layer on click or hover.
Properties
events{ALKMaps.Events} Events instance for listeners and triggering control specific events.
multipleKey{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the multiple property to true.
toggleKey{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the toggle property to true.
multiple{Boolean} Allow selection of multiple geometries.
clickout{Boolean} Unselect features when clicking outside any feature.
toggle{Boolean} Unselect a selected feature on click.
hover{Boolean} Select on mouse over and deselect on mouse out.
highlightOnly{Boolean} If true do not actually select features (that is place them in the layer’s selected features array), just highlight them.
box{Boolean} Allow feature selection by drawing a box.
onBeforeSelect{Function} Optional function to be called before a feature is selected.
onSelect{Function} Optional function to be called when a feature is selected.
onUnselect{Function} Optional function to be called when a feature is unselected.
scope{Object} The scope to use with the onBeforeSelect, onSelect, onUnselect callbacks.
geometryTypes{Array(String)} To restrict selecting to a limited set of geometry types, send a list of strings corresponding to the geometry class names.
layer{ALKMaps.Layer.Vector} The vector layer with a common renderer root for all layers this control is configured with (if an array of layers was passed to the constructor), or the vector layer the control was configured with (if a single layer was passed to the constructor).
layers{Array(ALKMaps.Layer.Vector)} The layers this control will work on, or null if the control was configured with a single layer
callbacks{Object} The functions that are sent to the handlers.feature for callback
selectStyle{Object} Hash of styles
renderIntent{String} key used to retrieve the select style from the layer’s style map.
handlers{Object} Object with references to multiple ALKMaps.Handler instances.
Constructor
ALKMaps.Control.SelectFeatureCreate a new control for selecting features.
Functions
initLayerAssign the layer property.
destroy
activateActivates the control.
deactivateDeactivates the control.
unselectAllUnselect all selected features.
clickFeatureCalled on click in a feature Only responds if this.hover is false.
multipleSelectAllow for multiple selected features based on multiple property and multipleKey event modifier.
toggleSelectEvent should toggle the selected state of a feature based on toggle property and toggleKey event modifier.
clickoutFeatureCalled on click outside a previously clicked (selected) feature.
overFeatureCalled on over a feature.
outFeatureCalled on out of a selected feature.
highlightRedraw feature with the select style.
unhighlightRedraw feature with the “default” style
selectAdd feature to the layer’s selectedFeature array, render the feature as selected, and call the onSelect function.
unselectRemove feature from the layer’s selectedFeature array, render the feature as normal, and call the onUnselect function.
selectBoxCallback from the handlers.box set up when box selection is true on.
setMapSet the map property for the control.
setLayerAttach a new layer to the control, overriding any existing layers.

Properties

events

{ALKMaps.Events} Events instance for listeners and triggering control specific events.

Register a listener for a particular event with the following syntax

control.events.register(type, obj, listener);

Supported event types (in addition to those from <ALKMaps.Control.events>)

beforefeaturehighlightedTriggered before a feature is highlighted
featurehighlightedTriggered when a feature is highlighted
featureunhighlightedTriggered when a feature is unhighlighted
boxselectionstartTriggered before box selection starts
boxselectionendTriggered after box selection ends

multipleKey

{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the multiple property to true.  Default is null.

toggleKey

{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the toggle property to true.  Default is null.

multiple

{Boolean} Allow selection of multiple geometries.  Default is false.

clickout

{Boolean} Unselect features when clicking outside any feature.  Default is true.

toggle

{Boolean} Unselect a selected feature on click.  Default is false.  Only has meaning if hover is false.

hover

{Boolean} Select on mouse over and deselect on mouse out.  If true, this ignores clicks and only listens to mouse moves.

highlightOnly

{Boolean} If true do not actually select features (that is place them in the layer’s selected features array), just highlight them.  This property has no effect if hover is false.  Defaults to false.

box

{Boolean} Allow feature selection by drawing a box.

onBeforeSelect

{Function} Optional function to be called before a feature is selected.  The function should expect to be called with a feature.

onSelect

{Function} Optional function to be called when a feature is selected.  The function should expect to be called with a feature.

onUnselect

{Function} Optional function to be called when a feature is unselected.  The function should expect to be called with a feature.

scope

{Object} The scope to use with the onBeforeSelect, onSelect, onUnselect callbacks.  If null the scope will be this control.

geometryTypes

{Array(String)} To restrict selecting to a limited set of geometry types, send a list of strings corresponding to the geometry class names.

layer

{ALKMaps.Layer.Vector} The vector layer with a common renderer root for all layers this control is configured with (if an array of layers was passed to the constructor), or the vector layer the control was configured with (if a single layer was passed to the constructor).

layers

{Array(ALKMaps.Layer.Vector)} The layers this control will work on, or null if the control was configured with a single layer

callbacks

{Object} The functions that are sent to the handlers.feature for callback

selectStyle

{Object} Hash of styles

renderIntent

{String} key used to retrieve the select style from the layer’s style map.

handlers

{Object} Object with references to multiple ALKMaps.Handler instances.

Constructor

ALKMaps.Control.SelectFeature

Create a new control for selecting features.

Parameters

layers{ALKMaps.Layer.Vector}, or an array of vector layers.  The layer(s) this control will select features from.
options{Object}

Functions

initLayer

initLayer: function(layers)

Assign the layer property.  If layers is an array, we need to use a RootContainer.

Parameters

layers{ALKMaps.Layer.Vector}, or an array of vector layers.

destroy

destroy: function()

activate

activate: function ()

Activates the control.

Returns

{Boolean} The control was effectively activated.

deactivate

deactivate: function ()

Deactivates the control.

Returns

{Boolean} The control was effectively deactivated.

unselectAll

unselectAll: function(options)

Unselect all selected features.  To unselect all except for a single feature, set the options.except property to the feature.

Parameters

options{Object} Optional configuration object.

clickFeature

clickFeature: function(feature)

Called on click in a feature Only responds if this.hover is false.

Parameters

feature{ALKMaps.Feature.Vector}

multipleSelect

multipleSelect: function()

Allow for multiple selected features based on multiple property and multipleKey event modifier.

Returns

{Boolean} Allow for multiple selected features.

toggleSelect

toggleSelect: function()

Event should toggle the selected state of a feature based on toggle property and toggleKey event modifier.

Returns

{Boolean} Toggle the selected state of a feature.

clickoutFeature

clickoutFeature: function(feature)

Called on click outside a previously clicked (selected) feature.  Only responds if this.hover is false.

Parameters

feature{<ALKMaps.Vector.Feature>}

overFeature

overFeature: function(feature)

Called on over a feature.  Only responds if this.hover is true.

Parameters

feature{ALKMaps.Feature.Vector}

outFeature

outFeature: function(feature)

Called on out of a selected feature.  Only responds if this.hover is true.

Parameters

feature{ALKMaps.Feature.Vector}

highlight

highlight: function(feature)

Redraw feature with the select style.

Parameters

feature{ALKMaps.Feature.Vector}

unhighlight

unhighlight: function(feature)

Redraw feature with the “default” style

Parameters

feature{ALKMaps.Feature.Vector}

select

select: function(feature)

Add feature to the layer’s selectedFeature array, render the feature as selected, and call the onSelect function.

Parameters

feature{ALKMaps.Feature.Vector}

unselect

unselect: function(feature)

Remove feature from the layer’s selectedFeature array, render the feature as normal, and call the onUnselect function.

Parameters

feature{ALKMaps.Feature.Vector}

selectBox

selectBox: function(position)

Callback from the handlers.box set up when box selection is true on.

Parameters

position{ALKMaps.Bounds || ALKMaps.Pixel }

setMap

setMap: function(map)

Set the map property for the control.

Parameters

map{ALKMaps.Map}

setLayer

setLayer: function(layers)

Attach a new layer to the control, overriding any existing layers.

Parameters

layersArray of {ALKMaps.Layer.Vector} or a single {ALKMaps.Layer.Vector}
{Boolean} Allow selection of multiple geometries.
{Boolean} Unselect a selected feature on click.
Instances of ALKMaps.Layer.Vector are used to render vector data from a variety of sources.
Base class to construct a higher-level handler for event sequences.
initLayer: function(layers)
Assign the layer property.
destroy: function()
activate: function ()
Activates the control.
deactivate: function ()
Deactivates the control.
unselectAll: function(options)
Unselect all selected features.
clickFeature: function(feature)
Called on click in a feature Only responds if this.hover is false.
multipleSelect: function()
Allow for multiple selected features based on multiple property and multipleKey event modifier.
{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the multiple property to true.
toggleSelect: function()
Event should toggle the selected state of a feature based on toggle property and toggleKey event modifier.
{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the toggle property to true.
clickoutFeature: function(feature)
Called on click outside a previously clicked (selected) feature.
overFeature: function(feature)
Called on over a feature.
outFeature: function(feature)
Called on out of a selected feature.
highlight: function(feature)
Redraw feature with the select style.
unhighlight: function(feature)
Redraw feature with the “default” style
select: function(feature)
Add feature to the layer’s selectedFeature array, render the feature as selected, and call the onSelect function.
unselect: function(feature)
Remove feature from the layer’s selectedFeature array, render the feature as normal, and call the onUnselect function.
selectBox: function(position)
Callback from the handlers.box set up when box selection is true on.
{Boolean} Allow feature selection by drawing a box.
setMap: function(map)
Set the map property for the control.
setLayer: function(layers)
Attach a new layer to the control, overriding any existing layers.
Controls affect the display or behavior of the map.
Vector features use the ALKMaps.Geometry classes as geometry description.
Instances of this class represent bounding boxes.
This class represents a screen coordinate, in x and y coordinates
Instances of ALKMaps.Map are interactive maps embedded in a web page.
Close