new Measurements( [options])
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
options |
Mapspace.layer.VectorOptions |
<optional> |
Options. |
- Source:
- mapspace/layer/measurements.js
Fires:
- ol.render.event:Event
Extends
Members
-
labelsVisible :boolean
-
- Source:
- mapspace/layer/measurements.js
-
measurementUnits :ol.proj.Units
-
Units for measurements that are not coordinates.
- Source:
- mapspace/layer/measurements.js
-
projectionTransformFn :ol.TransformFunction
-
Function to transform coordinates to current workspace output projection. Only applies to measurements that are shown as coordinates (POINT measurement).
- Source:
- mapspace/layer/measurements.js
-
projectionUnits :ol.proj.Units
-
Units for the output projection. Only applies to measurements that are shown as coordinates (POINT measurement).
- Source:
- mapspace/layer/measurements.js
Methods
-
addFeatures(features, unselectable)
-
Add features to layer.
Parameters:
Name Type Argument Description features
Array.<ol.Feature> Features.
unselectable
boolean <nullable>
Optional boolean. If true features will be set as unselectable. By default is false.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
clearStyleCollectionCache()
-
Clear in the style cache any style from a Style Collection.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
confirmRemoval()
-
Returns true if the removal of features requires a confirmation through a browser confirm message. By default is true but inherited layers can override this behaviour.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
exportFeatures(options)
-
Returns a Promise that exports the exportable features of this layer to the given formats using the given filter.
Parameters:
Name Type Argument Description options
Mapspace.ExportOptions <nullable>
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns a boolean or a Blob for the resolve function or an Error for the reject function.
- Type
- Promise
-
filterEditableFeatures(features, includeRemoved)
-
Returns a new array of features filtering the ones that are editable from the passed ones.
Parameters:
Name Type Argument Description features
Array.<ol.Feature> Features.
includeRemoved
boolean <nullable>
If include features with 'blomaction' set to 'erasure'. By default is false.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- Array.<ol.Feature>
-
filterFeatures(selectedFeatures, filter)
-
Returns a Promise that filters features applying the given filter.
Parameters:
Name Type Description selectedFeatures
Array.<ol.Feature> Array of currently selected features in the layer.
filter
Mapspace.ExportFilterType The filter to apply to features.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns an array of
ol.Feature
for the resolve function and an Error for the reject function.- Type
- Promise
-
findFeaturesByFilter(filter, resolution)
-
Finds the features that comply with the given filter.
Parameters:
Name Type Argument Description filter
Mapspace.Filter The filter.
resolution
number <nullable>
An optional resolution. If set then only features that are enabled to be selected are returned (features that return true for the isFeatureActionEnabled).
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- Array.<ol.Feature>
-
findFeaturesByText(text, resolution)
-
Finds the features that has any of the words in text in any of the observable values in the feature. Values in observable properties are converted to string and compared as strings. If value is an Object or an Array, then each owned property of the object, or any item in the array, is used for search.
Parameters:
Name Type Argument Description text
string A string with words, separated by blank spaces. Words can be any text, including an alphanumeric string, a number, or true/false.
resolution
number <nullable>
An optional resolution. If set then only features that are enabled to be selected are returned (features that return true for the isFeatureActionEnabled).
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- Array.<ol.Feature>
-
finishFeatureAction(actionType, feature, featureExtra, featureObject)
-
This function can be called after executing a given action to allow this layer to perform extra settings in the layer or feature. This function do not checks if the action is enabled for the given feature. Use
isFeatureActionEnabled
previously for that.Parameters:
Name Type Argument Description actionType
Mapspace.FeatureActionType Type of action executed.
feature
ol.Feature <nullable>
An optional feature that has received the action, or null if the action affects all the layer.
featureExtra
ol.Feature <nullable>
An optional secondary feature to fullfil the action. Normally it is the original feature when the action is a reset.
featureObject
Object <nullable>
An optional object with a
data
andupdate
keys in which aMapspace.control.FeaturePanel
store extra data of a feature.- Inherited From:
- Source:
- mapspace/layer/vector.js
-
generateSelectionStyleFunction(baseStyles)
-
Creates a Function from a given
ol.style.Style
object that is suitable as aol.StyleFunction
or as aol.FeatureStyleFunction
. This Function will be used for features that are selected, and the one returned bygenerateStyleFunction
will be used for features that are not selected.If the returned function is used as
ol.FeatureStyleFunction
then thethis
keyword is expecetd to be the feature and two arguments are expected with the resolution and an optional viewType. The definition is like this:function(this:feature, number, ?Mapspace.ViewType): Array.<ol.style.Style>
If the returned function is used as
ol.StyleFunction
thenthis
keyword is expected to be null and three arguments are expected: feature, resolution, and optional viewType. The definition is like this:function((ol.Feature|ol.render.Feature), number, ?Mapspace.ViewType): Array.<ol.style.Style>
Parameters:
Name Type Description baseStyles
Array.<ol.style.Style> | ol.style.Style The styles to use as reference to generate the selection style.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- function
-
generateStyleFunction(style)
-
Creates a Function that is suitable as a
ol.StyleFunction
or as aol.FeatureStyleFunction
.If the returned function is used as
ol.FeatureStyleFunction
then thethis
keyword is expected to be the feature and two arguments are expected with the resolution and an optional viewType. The definition is like this:function(this:feature, number, ?Mapspace.ViewType): Array.<ol.style.Style>
If the returned function is used as
ol.StyleFunction
thenthis
keyword is expected to be null and three arguments are expected: feature, resolution, and optional viewType. The definition is like this:function((ol.Feature|ol.render.Feature), number, ?Mapspace.ViewType): Array.<ol.style.Style>
If an optional
ol.style.Style
is passed then this style object will be used to create the output instead of Style cache of the layer.Parameters:
Name Type Argument Description style
ol.style.Style <nullable>
An optional single style object to be used instead of the Style cache of the layer.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- function
-
getAllCount()
-
Returns a non-rejectable Promise that retrieves the number of features that are commonly reported in a
Mapspace.control.TableReport
.- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns an
Mapspace.LayerCounts
for the resolve function. This promise does not reject.- Type
- Promise
-
getAttributeAlias(attribute)
-
Returns an attribute alias for the given attribute.
Parameters:
Name Type Description attribute
string Attribute.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- string
-
getAttributes()
-
Returns a Promise that request all attribute names in the layer.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns an array of attribute names for the resolve function or and error for the reject function.
- Type
- Promise
-
getConditionListRender(filter, showLimits)
-
Returns the filter render for a a given filter or the current filter if none is provided.
Parameters:
Name Type Argument Description filter
Mapspace.Filter <nullable>
Filter.
showLimits
boolean <nullable>
If show limits in filter render or not. By default is true.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- string
-
getCustomFeatureEditor(options)
-
Returns the
Mapspace.control.FeatureEditor
that aMapspace.control.FeaturePanel
must use. This method can be overriden in derived classes.Parameters:
Name Type Description options
Mapspace.control.FeatureEditorOptions The required options.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
Returns:
-
getCustomFilterEditor(options)
-
Returns the
Mapspace.control.FilterEditor
that this layer can use to filter the requested and/or rendered features.Parameters:
Name Type Description options
Mapspace.control.FilterEditorOptions The required options.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
-
getCustomStyle()
-
Returns the custom style of the layer.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- ol.style.Style
-
getCustomStyleCollection()
-
Returns the custom style collection of the layer.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
-
getDefaultCustomStyle()
-
Returns the default custom style to use in case the layer is initialized without one in the options. It can return null. If so, the layer will not have styles and will not be visible.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- ol.style.Style
-
getDefaultStyleCollections()
-
Returns an array of
Mapspace.StyleCollection
that can be used with this layer.- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- Array.<Mapspace.StyleCollection>
-
getExpanded()
-
Returns a expanded property that is not serializable.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
getExportFilters()
-
Returns an array of
Mapspace.ExportFilterType
that this layer can use when exporting features.- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- Array.<Mapspace.ExportFilterType>
-
getExportFormats()
-
Returns an array of
Mapspace.format.ExportFormatNames
that this layer can be exported to.- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- Array.<Mapspace.format.ExportFormatNames>
-
getFeatureStyle(style, viewType, measurementType)
-
Returns a
ol.style.Style
to be used in aol.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 aol.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 Argument Description style
ol.style.Style The custom style of the feature.
viewType
Mapspace.ViewType Type of viewer.
measurementType
Mapspace.MeasurementType <nullable>
Optional type of measurement. If not provided then the generic feature style is returned. If provided returns an specific feature style to be added to generic one or to replace generic one.
- Overrides:
- Source:
- mapspace/layer/measurements.js
Returns:
- Type
- ol.style.Style
-
getFeatureStyleInCollection(feature, viewType)
-
Returns the
ol.style.Style
from the current style collection to be used in aol.Feature
. If no style collection is defined or must not be used returns null.Parameters:
Name Type Description feature
ol.Feature Feature.
viewType
Mapspace.ViewType Type of viewer that contains the feature.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- ol.style.Style
-
getFilter()
-
Returns the array of conditions in the filter of features. By default it is an empty array meaning that there is not any filter.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- Mapspace.Filter
-
getFilteredCount()
-
Returns a Promise that retrieves the number of features that this layer can have if all features in the layer are loaded taking filters into account. This method returns a Promise so server vector layers can retrieve this info for the server.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns a number or null for the resolve function or an error for the reject function.
- Type
- Promise
-
getFilteredStyleRulesCount()
-
Returns a Promise that retrieves the number of features per each style rule that this layer can have if all features in the layer are loaded taking filters into account. This method returns a Promise so server vector layers can retrieve this info for the server.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns an array of numbers for the resolve function or an error for the reject function.
- Type
- Promise
-
getFilterFunction()
-
Returns the filter function if there is a current filter.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- function | null
-
getFilterRender(filter, showLimits)
-
Returns a Promise that retrieves the filter render for a a given filter or the current filter if none is provided. Retrieves an empty string if no filter is set.
Parameters:
Name Type Argument Description filter
Mapspace.Filter <nullable>
Filter.
showLimits
boolean <nullable>
If show limits in filter render or not. By default is true.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns a string with the filter render and never rejects.
- Type
- Promise
-
getFixedAttributes(feature)
-
Returns an array of reserved attribute names that are fixed and should not be modified in any feature editor. Derived clases must return specific arrays.
Parameters:
Name Type Argument Description feature
ol.Feature <nullable>
An optional feature that will allow to determine extra attributes that should be considered fixed for it. If not provided then it is returned the default array of fixed attributes for all the features in the layer.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- Array.<string>
-
getFormattedLabel(feature, viewType)
-
Returns the formatted label for the given feature.
Parameters:
Name Type Description feature
ol.Feature The measurement feature. If the feature is not a measurement one then returns null.
viewType
Mapspace.ViewType The type of viewer for the label.
- Source:
- mapspace/layer/measurements.js
Returns:
- Type
- string
-
getIgnoreHoles(viewerType)
-
Gets the property that define if holes must be ignored when converting the geometries of this layer of 3D objects.
Parameters:
Name Type Description viewerType
Mapspace.ViewType Type of viewer for the material definition.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
getLayerCount()
-
Returns a Promise that retrieves the total number of features that this layer can have if all features in the layer are loaded without taking filters into account. This method returns a Promise so server vector layers can retrieve this info for the server.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns a number for the resolve function or an error for the reject function.
- Type
- Promise
-
getMaterialDefinition(viewerType, feature)
-
Returns the
Mapspace.MaterialDefinition
of the layer or of feature passed if one is passed. Returns null if the material definition is not in cache. Do no edit the returned object directly. Instead use thesetCustomStyle
orsetCustomStyleCollection
functions. The MaterialDefinition should always derive from the style of the layer.Parameters:
Name Type Argument Description viewerType
Mapspace.ViewType Type of viewer for the material definition.
feature
ol.Feature <nullable>
Optional feature for which obtain the material definition. It is only used when a style collection is set and in use.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
-
getMeasureStyleRulesCount()
-
Returns a Promise that retrieves the measures of the features per each style rule that this layer can have if all features in the layer are loaded taking filters into account. This method returns a Promise so server vector layers can retrieve this info for the server.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns an array of numbers for the resolve function or an error for the reject function.
- Type
- Promise
-
getOverviewSettings()
-
Returns the reference to the object that stores the overview settings. These settings are settings for showing this layer in an Overview panel, that show statistics and classification information. It is an object with two values: visible (if the layer must be visible), and group (a number or null) that groups layers. The reference can be modified
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- Object
-
getPoint3DStyle(feature)
-
Gets the property that define how point geometries will be converted to 3D objects. If POINT then the point will be converted into a square facing always the camera (billboard). If POINT2D then will be converted to a given shape restricted to the XZ plane. Finally, if POINT3D then will be converted a proper 3D object. By default is POINT. This style only applies for Street viewers for now.
Parameters:
Name Type Argument Description feature
ol.Feature <nullable>
Optional feature for which obtain the point 3D style. It is only used when a style collection is set and in use.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
-
getPointHeight()
-
Returns the option that controls how points are positioned in height when using a single custom style.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
-
getPointSize(viewerType, feature)
-
Gets the size to use for point geometries when converting them into 3D objects. When styling with a
ol.style.Style
the size of a point is given in pixels. This property sets the real world size to use instead of pixels. This value is ignored if point3DStyle is POINT. The value must be in the same units as the geometries of the layer. By default is 1.0 meters.Parameters:
Name Type Argument Description viewerType
Mapspace.ViewType Type of viewer for the material definition.
feature
ol.Feature <nullable>
Optional feature for which obtain the point size. It is only used when a style collection is set and in use.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- number
-
getRuleIndex(feature)
-
Returns the index of the style rule that matches the feature. Return -1 if there is not a custom style collection, or it is not in use, or feature matches no style rule.
Parameters:
Name Type Description feature
ol.Feature Feature.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- number
-
getRuleVisible(ruleIndex)
-
Gets the visibility of a given rule in the style collection, if one is set.
Parameters:
Name Type Description ruleIndex
number Rule index.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
If visible or not. Null if no style collection is set.
- Type
- boolean
-
getSnappingOptions()
-
Returns the snapping options for this layer or null if the layer has no one.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
-
getStatisticsGroupsForRuleStyle(rule)
-
Returns an array of
Mapspace.layer.VectorValueGroupStatistics
that matches the givenMapspace.StyleRule
or an empty array if there is no match. If layer has no custom style collection or vector statistics returns empty array.Parameters:
Name Type Description rule
Mapspace.StyleRule Style rule.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- Array.<Mapspace.layer.VectorValueGroupStatistics>
-
getStyleCacheKey(viewType, ruleIndex, geomType)
-
Get the style cache key used with given params. Keys follow this pattern:
style-rule-{0}-{1}-{2}
. For example:style-rule-1-ortho-Polygon
.Parameters:
Name Type Argument Description viewType
Mapspace.ViewType Type of viewer.
ruleIndex
number Index of the rule.
geomType
ol.geom.GeometryType <nullable>
Optional geometry type.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- string
-
getStyleCacheKeyForFeature(viewType, feature, useGeomType)
-
Gets the style cache key used for the given feature. Keys follow this pattern:
style-rule-{0}-{1}-{2}
. For example:style-rule-1-ortho-Polygon
. Returns null when passing a feature without geometry or that do not comply with any rule or comply with a non-visible rule.Parameters:
Name Type Argument Description viewType
Mapspace.ViewType Type of viewer.
feature
ol.Feature Feature.
useGeomType
boolean <nullable>
Optional. If use geometry type in the key. Default is true.
string <nullable>
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
getStyleRulesCount()
-
Returns a Promise that retrieves the number of features per each style rule that this layer can have if all features in the layer are loaded without taking filters into account. This method returns a Promise so server vector layers can retrieve this info for the server.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns an array of numbers for the resolve function or an error for the reject function.
- Type
- Promise
-
getUseStyleCollection()
-
Returns if the custom style to use is the style collection. If false then the single custom style is used. By default is false. This value is set through
setCustomStyle
andsetCustomStyleCollection
methods.- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
hasFilterStatistics()
-
Returns true if this layer provides more statistics when using a filter. Only local layers created from local data have for now this ability.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
hasVectorStatistics()
-
Returns true if the source of this layer has statistics through a service that the source can use to retrieve it. These statistics can be used to present information about the number of objects and measures, total and by class if there is a classification.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
initializeStyleCache()
-
Initializes the style cache.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
-
isActionEnabled(actionType)
-
Returns true if the layer has the given action enabled. By default is true. The result can be overriden in derived classes for extra validation.
Parameters:
Name Type Description actionType
Mapspace.FeatureActionType The action to check.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
isCustomStyleEditable()
-
Returns true if the custom style of the layer can be edited. This function can be overriden in derived classes to avoid custom styles in certain layers where only one custom style is not suitable as styling setup.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
isDefaultCustomStyle(style)
-
Returns true if given style is the current default custom style.
Parameters:
Name Type Description style
ol.style.Style - Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
isFeatureActionEnabled(actionType, feature, resolution, viewType)
-
Returns true if the given feature has the given action enabled for this layer. Do not checks that feature belongs to this layer, just check validity for the action in the feature. By default is true. The result can be overriden in derived classes for extra validation.
Parameters:
Name Type Argument Description actionType
Mapspace.FeatureActionType The action to check.
feature
ol.Feature The feature to check.
resolution
number <nullable>
An optional resolution to use in the checking.
viewType
Mapspace.ViewType <nullable>
An optional type of viewer.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
isReadOnly()
-
Returns true if the layer is read-only and cannot be edited in any way, either in geometries or attributes.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
isSavedInWorkspace()
-
Returns true if this layer can be saved in the workspace.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
Returns:
- Type
- boolean
-
notifyFeaturesChanged()
-
Sends a notification of changes in features in the source of the layer, if it is required. By default this method does nothing. Override it in derived classes to execute a notification.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
-
notifyStatus(status)
-
Notifies a change in status.
Parameters:
Name Type Description status
Mapspace.layer.VectorStatus - Inherited From:
- Source:
- mapspace/layer/vector.js
-
processFeature(action, feature)
-
Returns a Promise that processes a feature after a given action to allow this layer to perform extra settings in the layer or feature.
Parameters:
Name Type Argument Description action
Mapspace.FeatureActionType Action executed.
feature
ol.Feature <nullable>
An optional feature that has received the action, or null if the action affects all the layer.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns the feature for the resolve function or and error for the reject function.
- Type
- Promise
-
processFeatures(action, features)
-
Returns a Promise that processes some features after a given action to allow this layer to perform extra settings in the layer or features.
Parameters:
Name Type Argument Description action
Mapspace.FeatureActionType Action executed.
features
Array.<ol.Feature> <nullable>
An optional array of features that has received the action, or null if the action affects all the layer.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that never rejects and that for the resolve function returns an array of features successfully processed or errors for the features with problems.
- Type
- Promise
-
removeFeatures(features)
-
Removes several features from the layer. Returns an array with the features finally removed.
Parameters:
Name Type Description features
Array.<ol.Feature> The array of features to remove.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
The array of features finally removed.
- Type
- Array.<ol.Feature>
-
removeUnselectableFeatures()
-
Remove unselectable features from layer.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
saveFeature(feature, action, key)
-
Returns a Promise that saves a feature that has changed. The storage of the features can be in user local storage (cookies) or in a server database. That functionality is set in each layer type overriding this method.
Parameters:
Name Type Argument Description feature
ol.Feature The feature with changes.
action
Mapspace.FeatureActionType <nullable>
An optional type of action performed in the feature.
key
string <nullable>
An optional key string that identifies a local storage for saving the feature.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that returns the feature for the resolve function or and error for the reject function.
- Type
- Promise
-
saveFeatures(features, action, key)
-
Returns a Promise that saves an array of features that has changed. The storage of the features can be in user local storage (cookies) or in a server database. That functionality is set in each layer type overriding this method.
Parameters:
Name Type Argument Description features
Array.<ol.Feature> The array of features with changes.
action
Mapspace.FeatureActionType <nullable>
An optional type of action performed in the features.
key
string <nullable>
An optional key string that identifies a local storage for saving the features.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
Returns:
A Promise that never rejects and that for the resolve function returns an array of features successfully saved or errors for the features with problems.
- Type
- Promise
-
setCustomStyle(style)
-
Modifies the style of the layer using a
ol.style.Style
single objet that is used to generate a finalol.StyleFunction
to style the layer. Also updates the internal material definitions to use in Street and 3D viewers.Parameters:
Name Type Description style
ol.style.Style The style object.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
setCustomStyleCollection(styleCol)
-
Modifies the style of the layer using a
Mapspace.StyleCollection
single object that is used to generate a finalol.StyleFunction
to style the layer. Also updates the internal material definitions to use in Street and 3D viewers.Parameters:
Name Type Description styleCol
Mapspace.StyleCollection Style collection object.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
setDefaultMaterialDefinition(key)
-
Sets the material definition with its defaults values.
Parameters:
Name Type Description key
string Key. It is '_' for the material definition of the custom single style, and 'rule-{0}' for the material definitions of the custom collection style.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
setExpanded(expanded)
-
Saves an expanded property that is not serialized.
Parameters:
Name Type Description expanded
boolean If layer group is expanded or not.
- Inherited From:
- Source:
- mapspace/layer/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 calls the source to update features as needed, and will cause a refresh in any viewer containing the layer.
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/layer/vector.js
-
setIgnoreHoles(viewerType, ignore)
-
Sets the property that define if holes must be ignored when converting the geometries of this layer of 3D objects.
Parameters:
Name Type Description viewerType
Mapspace.ViewType Type of viewer for the material definition.
ignore
boolean True to ignore holes.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
setMaterialDefinitions(key, style, point3DStyle, pointHeight)
-
Sets the material definitions for the given key using the given style.
Parameters:
Name Type Argument Description key
string Key. It is '_' for the material definition of the custom single style, and 'rule-{0}' for the material definitions of the custom collection style.
style
ol.style.Style Style.
point3DStyle
Mapspace.Point3DStyle <nullable>
Optional point 3D style.
pointHeight
Mapspace.HeightReference <nullable>
Optional point height style.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
setPoint3DStyle(point3DStyle)
-
Sets the property that define how point geometries will be converted to 3D objects. If POINT then the point will be converted into a square facing always the camera (billboard). If POINT2D then will be converted to a given shape restricted to the XZ plane. Finally, if POINT3D then will be converted a proper 3D object. By default is POINT. This style only applies for Street viewers for now.
Parameters:
Name Type Description point3DStyle
Mapspace.Point3DStyle The property.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
setPointHeight(pointHeight)
-
Sets the option that controls how points are positioned in height when using a single custom style.
Parameters:
Name Type Description pointHeight
Mapspace.HeightReference The value.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
setPointSize(viewerType, pointSize, ruleIndex)
-
Sets the size to use for point geometries when converting them into 3D objects. When styling with a
ol.style.Style
the size of a point is giving in pixels. This property sets the real world size to use instead of that pixels. This value is ignored if point3DStyle is POINT. The value must be in the same units as the geometries of the layer. By default is 1.0 meters.Parameters:
Name Type Argument Description viewerType
Mapspace.ViewType Type of viewer for the material definition.
pointSize
number The property.
ruleIndex
number <nullable>
Optional index of the style rule in which apply the point size. If no rule index is passed, the value is set for the single style. If no style collection is set or is not in use then nothing is changed.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
setRuleVisible(ruleIndex, visible)
-
Sets the visibility of a given rule in the style collection, if one is set.
Parameters:
Name Type Description ruleIndex
number Rule index.
visible
boolean If visible or not.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
setSnappingOptions(options)
-
Sets the snapping options for this layer. It can be null to deactivate snapping options. This do not create any snapping interaction in the viewer. This function only stores the options to allow serialize it and be used by the pertinent
action
classes.Parameters:
Name Type Argument Description options
Mapspace.SnappingOptions <nullable>
The snapping options.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
toggleRuleVisible(ruleIndex)
-
Toggles the visibility of a given rule in the style collection, if one is set.
Parameters:
Name Type Description ruleIndex
number Rule index.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
updateFilterFunction()
-
Updates the filter function to use the current filter.
- Inherited From:
- Source:
- mapspace/layer/vector.js
-
updateStyleCache(style)
-
Updates the style cache using the given style.
Parameters:
Name Type Description style
ol.style.Style | Mapspace.StyleCollection The style object.
- Inherited From:
- Overrides:
- Source:
- mapspace/layer/vector.js
-
writeFeatures(features, format, projection)
-
Returns a serialized string of the features in the given format.
Parameters:
Name Type Argument Description features
Array.<features> The features to serialize.
format
Mapspace.ExportFormatNames The format.
projection
string <nullable>
Optional projection.
- Inherited From:
- Source:
- mapspace/layer/vector.js
Returns:
The serialized string or null if any problem happened.
- Type
- string