geoflo.Select

This module provides the select functionality for the Geoflo application. It allows users to select features on the map by clicking on them.

Methods

static activate(options) → {boolean}

This function activates the select feature functionality by enabling drag pan, setting buttons, and setting the active button to 'select'. It also triggers a 'select.activate' event with the provided options.
Parameters:
Name Type Description
options Object The options object for activation.
Properties
Name Type Attributes Description
id string <optional>
The ID of the feature to select.
feature Object <optional>
The feature object to select.
Returns:
boolean - Returns false if already activated.

static addPopup(features)

This function creates a popup element with the specified features and adds it to the map at the click coordinates.
Parameters:
Name Type Description
features Object The features to be displayed in the popup.
Properties
Name Type Description
title string The title of the popup.
description string The description of the popup.
latitude number The latitude coordinate for the popup location.
longitude number The longitude coordinate for the popup location.

static canHandle(modeName) → {boolean}

This function determines if the given mode name is equal to the SELECT mode.
Parameters:
Name Type Description
modeName string The mode name to be checked.
Returns:
boolean - Returns true if the mode name is SELECT, false otherwise.

static deactivate() → {boolean}

This function deactivates the current feature by setting the 'activated' flag to false and triggering necessary actions.
Returns:
boolean - Returns false if the feature is not activated.

static deselectCurrentFeature()

Deselects the current feature by removing its selection.

static handleClick(event) → {boolean}

Handles the click event on the map and selects features based on the event.
Parameters:
Name Type Description
event Object The event object containing information about the click event.
Returns:
boolean - Returns false if geoflo.noSelect is true, otherwise selects features based on the event.

static handleDrag(event)

Handles the drag event triggered by a user interaction. It sets the map class to 'grabbing' to indicate dragging.
Parameters:
Name Type Description
event Event The event object representing the drag event.

static handleMove(event)

Handles the mouse move event.
Parameters:
Name Type Description
event Event The event object representing the mouse move event.

static removePopup() → {boolean}

Removes the popup element from the DOM if it exists.
Returns:
boolean - Returns true if the popup element was successfully removed, otherwise false.

static selectFeature(id) → {Array}

Selects a feature by its ID, adds it to the selected features list, and optionally adds a popup.
Parameters:
Name Type Description
id string The ID of the feature to be selected.
Returns:
Array - - An array of removed features if wantingToEdit is false, otherwise returns the removed feature.