ol-ishare/logger

Creates a map based on a profile and enables reporting on features or locations based on one or more layers in the profile.

import { LoggerMap } from 'ol-ishare/logger'

Classes

Selection
Report
LoggerMap
ReportsManager

Members

(static) actions

Properties:
Name Type Description
select module:ol-ishare/logger~selectAction

Action to perform when multiple selections have been made and have not been resolved automatically

autoSelect module:ol-ishare/logger~autoSelect

Action to use initially when the map has been told to attempt a selection

abandonSelect module:ol-ishare/logger~abandonSelectAction

Action to perform when selection process should be ended without generating a report

Methods

(inner) selectAction(location, targetLayerDetails, contextLayerDetails, selected, abandon)

Should present the user with all current selections, the user must then either select one, or abandon the process.

Parameters:
Name Type Description
location module:ol-ishare/logger.Location

The location selected on the map

targetLayerDetails Array.<module:ol-ishare/logger.targetLayerDetail>

Details for all target layers, plus selections from map query

contextLayerDetails module:ol-ishare/logger.contextLayerDetails

All context layer details, plus results of queries per target layer selection

selected module:ol-ishare/logger~selected

Function to call to move to the next stage in generating a report

abandon module:ol-ishare/logger~abandonSelectAction

Function to call when the selection process should be abandoned

(inner) automaticSelectAction(location, targetLayerDetails, contextLayerDetails) → {Array.<module:ol-ishare/logger~Selection>}

Checks and/or filters selections made by the user

If one selection is returned then module:ol-ishare/logger~selected is called If more than one selection is returned, module:ol-ishare/logger~selectAction will be called for further steps in the selection process If no results are returned then module:ol-ishare/logger~abandonSelectAction will be called If a custom reason for abandoning the selection is needed (e.g. the chosen feature doesn't meet some criteria) then throw an {module:ol-ishare/logger~AbandonedSelection} object with the appropriate error message

By default this will only check that at least one selection has been made.

Parameters:
Name Type Description
location module:ol-ishare/logger.Location

The location selected on the map

targetLayerDetails Array.<module:ol-ishare/logger.targetLayerDetail>

Details for all target layers, plus selections from map query

contextLayerDetails module:ol-ishare/logger.contextLayerDetails

All context layer details, plus results of queries per target layer selection

Returns:

Results of attempt to perform automatic selection

Type
Array.<module:ol-ishare/logger~Selection>

Type Definitions

Location

Properties:
Name Type Description
x Number

Horizontal co-ordinate value

y Number

Vertical co-ordinate value

proj String

Projection of {x} and {y}

Type:

Context

Properties:
Name Type Description
string Array.<FeatureCollection>

One GeoJSON FeatureCollections per context layer

Type:

CompletedSelection

Properties:
Name Type Attributes Description
selection module:ol-ishare/logger~Selection

Selection made from target layer

description String <optional>

Additional text for the report, e.g. free-text user description of a fault

context module:ol-ishare/logger~Context <optional>

Context object for report, will be added automatically if not specified. Use only if doing something non-standard with context layers.

Type:

AbandonedSelection

Properties:
Name Type Attributes Description
message String <optional>

Reason for ending selection process

isError Boolean <optional>

Whether the selection has been abandoned because of an error - message should have more details

Type:

selected(completedSelection)

Signature for the internal function called when a selection has been made

Parameters:
Name Type Description
completedSelection module:ol-ishare/logger~CompletedSelection

All information about the successful selection

abandonSelectAction(abandonedSelectionopt)

Called when attempts to make a selection fail or are deliberately abandoned

Parameters:
Name Type Attributes Description
abandonedSelection module:ol-ishare/logger~AbandonedSelection <optional>

Reason for ending selection process

layerField

Properties:
Name Type Attributes Description
name String

Name of field

displayName String

User-friendly name for field

link String <optional>

Format of link to external resource for field values

Type:

layerDetail

Properties:
Name Type Attributes Description
layer String

Name of target layer

displayName String

User-friendly name for target layer

fields Array.<module:ol-ishare/logger.layerField>

Field configuration for target layer

metadata Object <optional>

Metadata for layer, if any

Layer information

Type:

selectionContexts

Properties:
Name Type Description
contexts Object.<string, module:ol-ishare/logger.Context>

Contexts found for each result in target layer, keyed by target layer idField value

Results from context layers for a given target layer

Type:

contextLayerDetails

Properties:
Name Type Description
layers Array.<module:ol-ishare/logger.layerDetail>

Information about all context layers

selectionContexts Object.<string, module:ol-ishare/logger.selectionContexts>

Results for context layers, keyed by target layer name

Contains context layer definitions and optionally results found when querying target layer(s)

Type:

targetLayerDetail

Properties:
Name Type Attributes Description
layer String

Name of target layer

displayName String

User-friendly name for target layer

idField String

Name of field containing uniquely identifying value for records in target layer data

fields Array.<module:ol-ishare/logger.layerField>

Field configuration for target layer

metadata Object <optional>

Metadata for layer, if any

selections Array.<module:ol-ishare/logger~Selection> <optional>

Results of querying the target layer, if any

olFeatures Array.<ol/Feature~Feature> <optional>

One OpenLayers Feature for each record found when querying the target layer

errors String <optional>

Errors found when querying a layer

Describes a target layer and optionally contains results from querying the layer

Type:

TargetLayerOption

Properties:
Name Type Description
layer String

Name of layer - Layer.layerName

idField String

Name of field containing unique identifier to use for selection(s) in a report

Type:

LoggerMapOptions

Properties:
Name Type Attributes Description
reportOn module:ol-ishare/logger.TargetLayerOption | Array.<module:ol-ishare/logger.TargetLayerOption> <optional>

Details of layer(s) that will be used to log reports against, if required. If valid layers are configured that are not in mapOptions.layers then they will be added to the map.

contextLayers Array.<String> <optional>

Names of layers from which to include details in a Report. If no context layers are set, then there will be no context layer data. If valid layers are set that are not set in mapOptions, then they will be added to the map.

selectAction module:ol-ishare/logger~selectAction <optional>

Function to allow user to select from all results from a target layer

abandonSelectAction module:ol-ishare/logger~abandonSelectAction <optional>

Called when one of the other select actions stops the selection process without making a report

overLayer ol/layer/Vector <optional>

Predefined layer to use for displaying highlighted selections.

Type:

Events

report

Properties:
Name Type Description
type string

'report'

report module:ol-ishare/logger~Report

Report object

Map clicked, target layer feature selected

Type:

nothingSelected

Properties:
Name Type Description
type string

'nothingSelected'

Map clicked, target layer feature not selected

Type: