Angular service

service source

Description

Service for converting composition and composition data into JSON object which can be saved on server

Methods

generateThumbnail ($element, $scope)

Create thumbnail of map view and save it into selected element

Parameters

NameTypeDescription
$element $element

Selected element

$scope $scope

Angular scope from which function was called

generateUuid -> String

Generate random Uuid

Returns

TypeDescription
String

Random Uuid in string format

getCurrentBaseLayer (map) -> Object

Returns object about current selected base layer

Parameters

NameTypeDescription
map Ol.map

Selected map object

Returns

TypeDescription
Object

Returns object with current current selected base layers title as attribute

layer2json (layers, $scope) -> Array

Converts map layers into a JSON object. If $scope is defined, stores only layers checked in form Uses layer2json().

Parameters

NameTypeDescription
layers Array

Map layers that should be converted

$scope $scope

Angular scope from which function is called

Returns

TypeDescription
Array

JSON object representing the layers

layer2json (layer) -> Object

Converts map layer into a JSON object (only for ol.layer.Layer)
Layer properties covered: (CLASS_NAME), name, url, params, group, displayInLayerSwitcher, visibility, opacity attribution, transitionEffect, isBaseLayer, minResolution, maxResolution, minScale, maxScale, metadata, abstract, opacity, singleTile, removable, queryable, legend, projections, wmsMinScale, wmsMaxScale

The layer index is not covered, as we assume that it is corresponding to the layers order.

Parameters

NameTypeDescription
layer Object

Map layer that should be converted

Returns

TypeDescription
Object

JSON object representing the layer

layer2string (layer, pretty) -> String

Converts map layer from Layer object to text in JSON notation.

Syntactic sugar for layer2json() UNUSED?

Parameters

NameTypeDescription
layer Object

Layer to be converted

pretty Boolean

Whether to use pretty notation

Returns

TypeDescription
String

Text in JSON notation representing the layer

map2json (map, $scope) -> Object

Create Json object which stores information about composition, user, map state and map layers (including layer data)

Parameters

NameTypeDescription
map Ol.map

Selected map object

$scope $scope

Angular scope from which function is called

Returns

TypeDescription
Object

JSON object with all required map composition metadata

serializeFeatures (features) -> String

Convert feature array to GeoJSON string

Parameters

NameTypeDescription
features Array

Array of features

Returns

TypeDescription
String

GeoJSON string

serializeStyle (s) -> Object

Convert layer style object into JSON object, partial function of layer2style (saves Fill color, Stroke color/width, Image fill, stroke, radius, src and type)

Parameters

NameTypeDescription
s ol.style.Style

Style to convert

Returns

TypeDescription
Object

Converted JSON object for style