Class: RoadObjects

RoadObjects

Layer for road objects from norweigan NVDB service. This layer inherits from Mapspace.layer.Vector adding the default configuration needed.


new RoadObjects(options)

Parameters:
Name Type Argument Description
options Mapspace.nvdb.layer.RoadObjectsOptions <nullable>

Constructor options.

Source:
mapspace-nvdb/layer/roadobjects.js

Extends

Methods


addLocalFeature(feature)

Adds a feature as a local feature, and will be stored in local storage.

Parameters:
Name Type Description
feature ol.Feature

The feature.

Inherited From:
Source:
mapspace/source/vector.js

addZValues(z)

Adds Z values to geometries, converting them to 3D. If any Z value is present in any geometry it is overwritten.

Parameters:
Name Type Description
z number

Z value.

Inherited From:
Source:
mapspace/source/vector.js

clearLocalFeatures()

Clears the list of local features that will be stored in local storage.

Inherited From:
Source:
mapspace/source/vector.js

convertRuleToFilter(index)

Converts a style rule existing in current style collection into a Mapspace.Filter.

Parameters:
Name Type Description
index number

Rule index.

Source:
mapspace-nvdb/layer/roadobjects.js
Returns:
Type
Mapspace.Filter

createReprojected(projection)

Returns a Promise that creates a new Mapspace.source.Vector but with the features reprojected to a new projection.

Parameters:
Name Type Description
projection string | Mapspace.ProjectionInfo

Projection for the resulting features.

Inherited From:
Source:
mapspace/source/vector.js
Returns:

A Promise that returns a Mapspace.source.Vector for the resolve function and an Error for the reject function.

Type
Promise

getAllowedGeometryTypes()

Returns an array of ol.geom.GeometryType with the types of geometries that can be stored in this layer, depending on the type of NVDB object selected for the layer.

Source:
mapspace-nvdb/layer/roadobjects.js
Returns:
Type
Array.<ol.geom.GeometryType>

getFeatureStyle(style, viewType, isPoint)

Returns a ol.style.Style to be used in a ol.Feature for a given custom style.

Features save custom styles in a customStyle property that is serialized with workspace for certain layers. This custom style is a ol.style.Style but is not suitable for be used as style for the feature. This function returns the correct Style to be used for the feature.

Parameters:
Name Type Description
style ol.style.Style

The custom style of the feature.

viewType Mapspace.ViewType

Type of viewer.

isPoint boolean

If style is for points.

Source:
mapspace-nvdb/layer/roadobjects.js
Returns:
Type
ol.style.Style

getLocalFeatures()

Returns the features that are stored in local storage.

Inherited From:
Source:
mapspace/source/vector.js
Returns:
Type
Array.<ol.Feature>

hasAllZValuesZero()

Checks if this source contains Z values with all values equal to zero. This function requires to be called when hasNoZValues is true.

Inherited From:
Source:
mapspace/source/vector.js
Returns:
Type
boolean

hasNoDegreesCoordinates()

Checks if all coordinates in the geometries of this source are suitable as degrees in EPSG:4326 WGS84 projection that any source has by default. A coordinate is a degree if X is inside the [-360,360] range and if Y is inside the [-90,90] range. The Z value is ignored in the checking. If any coordinate of any geometry inside a feature do not fit inside the ranges, then false is returned.

Inherited From:
Source:
mapspace/source/vector.js
Returns:
Type
boolean

hasNoZValues()

Checks if this source contains Z values. If no Z values exist returns true.

Inherited From:
Source:
mapspace/source/vector.js
Returns:
Type
boolean

isLocalFeature()

Returns true if the given feature is a local feature, stored in local storage.

Inherited From:
Source:
mapspace/source/vector.js
Returns:
Type
boolean

loadFeaturesInLocalStorage(key)

Loads to the source any features in the local storage using the given key.

Parameters:
Name Type Description
key string

Key for the value to store.

Inherited From:
Source:
mapspace/source/vector.js

notifyFeaturesChanged()

Triggers a FEATURESCHANGED event.

Inherited From:
Overrides:
Source:
mapspace/source/vector.js

removeFeaturesInLocalStorage(key)

Removes the local features in the source from the local storage using the given key.

Parameters:
Name Type Description
key string

Key for the value to store.

Inherited From:
Source:
mapspace/source/vector.js

removeLocalFeature(feature)

Removes a feature as a local feature, and won't be stored in local storage.

Parameters:
Name Type Description
feature ol.Feature

The feature.

Inherited From:
Source:
mapspace/source/vector.js

removeZValues()

Removes Z values from geometries, converting them to 2D. This is here because the current lib for reading shapefiles, shp.js, has an issue reading polygons with holes that truncates Z values making them unusable. This method updates geometries so use it beafore making any reference to the geometry objects.

Inherited From:
Source:
mapspace/source/vector.js

saveFeature(features, action)

Returns a Promise that saves a feature that has changed.

Parameters:
Name Type Argument Description
features ol.Feature

The feature with changes.

action Mapspace.FeatureActionType <nullable>

An optional type of action performed in the features.

Source:
mapspace-nvdb/layer/roadobjects.js
Returns:

A Promise that returns the feature for the resolve function or Error for the reject function.

Type
Promise

saveFeaturesInLocalStorage(key)

Saves the local features in the source to a local storage using the given key. Be aware that a typical feature stringyfied in JSON notation can take 1KB and that there are limitations in web browsers to local storage as explained in https://en.wikipedia.org/wiki/Web_storage.

Parameters:
Name Type Description
key string

Key for the value to store.

Inherited From:
Source:
mapspace/source/vector.js

setFilter(filter, callback)

Sets the array of conditions for filtering features. As this is a time consuming operation, new filter should be compared with current to call only when the filter has changed. This function should not be called, and call Mapspace.layer.Vector#setFilter instead, that calls this function and also stores the filter.

Parameters:
Name Type Argument Description
filter Mapspace.Filter

The array of conditions that features must follow to be downloaded (if source is a Mapspace.layer.ServerVector) and/or rendered.

callback function <nullable>

An optional function to be called when the apply of the filter has finished.

Inherited From:
Source:
mapspace/source/vector.js