The SelectFeature control selects vector features from a given layer on click or hover.
ALKMaps. | The 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. | Create a new control for selecting features. |
Functions | |
initLayer | Assign the layer property. |
destroy | |
activate | Activates the control. |
deactivate | Deactivates the control. |
unselectAll | Unselect all selected features. |
clickFeature | Called on click in a feature Only responds if this.hover is false. |
multipleSelect | Allow for multiple selected features based on multiple property and multipleKey event modifier. |
toggleSelect | Event should toggle the selected state of a feature based on toggle property and toggleKey event modifier. |
clickoutFeature | Called on click outside a previously clicked (selected) feature. |
overFeature | Called on over a feature. |
outFeature | Called on out of a selected feature. |
highlight | Redraw feature with the select style. |
unhighlight | Redraw feature with the “default” style |
select | Add feature to the layer’s selectedFeature array, render the feature as selected, and call the onSelect function. |
unselect | Remove feature from the layer’s selectedFeature array, render the feature as normal, and call the onUnselect function. |
selectBox | Callback from the handlers.box set up when box selection is true on. |
setMap | Set the map property for the control. |
setLayer | Attach a new layer to the control, overriding any existing layers. |
{ALKMaps.Events} Events instance for listeners and triggering control specific events.
control.events.register(type, obj, listener);
beforefeaturehighlighted | Triggered before a feature is highlighted |
featurehighlighted | Triggered when a feature is highlighted |
featureunhighlighted | Triggered when a feature is unhighlighted |
boxselectionstart | Triggered before box selection starts |
boxselectionend | Triggered after box selection ends |
{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the multiple property to true. Default is null.
{String} An event modifier (‘altKey’ or ‘shiftKey’) that temporarily sets the toggle property to true. Default is null.
{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).
{Array(ALKMaps.Layer.Vector)} The layers this control will work on, or null if the control was configured with a single layer
{Object} Object with references to multiple ALKMaps.Handler instances.
Create a new control for selecting features.
layers | {ALKMaps.Layer.Vector}, or an array of vector layers. The layer(s) this control will select features from. |
options | {Object} |
initLayer: function( layers )
Assign the layer property. If layers is an array, we need to use a RootContainer.
layers | {ALKMaps.Layer.Vector}, or an array of vector layers. |
clickFeature: function( feature )
Called on click in a feature Only responds if this.hover is false.
feature | {ALKMaps.Feature.Vector} |
multipleSelect: function()
Allow for multiple selected features based on multiple property and multipleKey event modifier.
{Boolean} Allow for multiple selected features.
overFeature: function( feature )
Called on over a feature. Only responds if this.hover is true.
feature | {ALKMaps.Feature.Vector} |
outFeature: function( feature )
Called on out of a selected feature. Only responds if this.hover is true.
feature | {ALKMaps.Feature.Vector} |
highlight: function( feature )
Redraw feature with the select style.
feature | {ALKMaps.Feature.Vector} |
unhighlight: function( feature )
Redraw feature with the “default” style
feature | {ALKMaps.Feature.Vector} |
select: function( feature )
Add feature to the layer’s selectedFeature array, render the feature as selected, and call the onSelect function.
feature | {ALKMaps.Feature.Vector} |
unselect: function( feature )
Remove feature from the layer’s selectedFeature array, render the feature as normal, and call the onUnselect function.
feature | {ALKMaps.Feature.Vector} |
selectBox: function( position )
Callback from the handlers.box set up when box selection is true on.
position | {ALKMaps.Bounds || ALKMaps.Pixel } |
setLayer: function( layers )
Attach a new layer to the control, overriding any existing layers.
layers | Array of {ALKMaps.Layer.Vector} or a single {ALKMaps.Layer.Vector} |
Assign the layer property.
initLayer: function( layers )
destroy: function()
Activates the control.
activate: function ()
Deactivates the control.
deactivate: function ()
Unselect all selected features.
unselectAll: function( options )
Called on click in a feature Only responds if this.hover is false.
clickFeature: function( feature )
Allow for multiple selected features based on multiple property and multipleKey event modifier.
multipleSelect: function()
Event should toggle the selected state of a feature based on toggle property and toggleKey event modifier.
toggleSelect: function()
Called on click outside a previously clicked (selected) feature.
clickoutFeature: function( feature )
Called on over a feature.
overFeature: function( feature )
Called on out of a selected feature.
outFeature: function( feature )
Redraw feature with the select style.
highlight: function( feature )
Redraw feature with the “default” style
unhighlight: function( feature )
Add feature to the layer’s selectedFeature array, render the feature as selected, and call the onSelect function.
select: function( feature )
Remove feature from the layer’s selectedFeature array, render the feature as normal, and call the onUnselect function.
unselect: function( feature )
Callback from the handlers.box set up when box selection is true on.
selectBox: function( position )
Set the map property for the control.
setMap: function( map )
Attach a new layer to the control, overriding any existing layers.
setLayer: function( layers )