# Class: FeatureStore

## vcs.vcm.layer.FeatureStore

FeatureStore Layer

#### new vcs.vcm.layer.FeatureStore(options)

  Name | Type | Description
  --- | --- | ---
  `options` | vcs.vcm.layer.FeatureStore.Options |

### Extends

- vcs.vcm.layer.Vector

### Classes

FeatureStoreChanges

### Members

#### vcs.vcm.layer.FeatureStore.featureStoreState{string}

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `DYNAMIC` | string |
  `STATIC` | string |
  `EDITED` | string |

#### altitudeMode{string}

#### changeTracker{vcs.vcm.layer.FeatureStore.FeatureStoreChanges}

#### classificationType

#### className{string}

  class Name of the Object

#### heightAboveGround{number}

  height above ground for all point vector objects -> altitudeMode must be set to: "relativeToGround" either on the feature (precedence) or the layer

#### hiddenObjectIds{Array.<string>}

  array of object Ids which should be hidden global, if this layer is active

#### injectedFetchDynamicFeatureFunc{function} {undefined}

  a function to retrieve a single feature from the server

#### name{string}

  unique Name

#### skirt{number}

#### storeyHeight{number}

#### visibility{boolean}

#### zCoordinateEyeOffset{number}

  All point vector objects become billboards in cesium which can contain an eyeOffset see: https://cesiumjs.org/Cesium/Build/Documentation/Billboard.html?classFilter=billboard

### Methods

#### activate(active){Promise} inherited

  Activates or deactivates this layer object, i.e. changes its internal view state and updates the map by calling show

  Name | Type | Description
  --- | --- | ---
  `active` | boolean | false or true activates or deactivates this layer

  ##### Fires:

  - `LAYER_ACTIVATED` (vcs.vcm.layer.Layer) - vcs.vcm.event.EventType.LAYER_ACTIVATED is triggered when a layer is activated.
  - `LAYER_CHANGED` (vcs.vcm.layer.Layer) - vcs.vcm.event.EventType.LAYER_CHANGED is triggered when a layer is activated or deactivated.
  - `LAYER_DEACTIVATED` (vcs.vcm.layer.Layer) - vcs.vcm.event.EventType.LAYER_DEACTIVATED is triggered when a layer is deactivated.

#### addFeatures(features){Array.<string>} inherited

  add features to the vector layer and return an array with their ids. The geometry will be mutated and transformed to EPSG 3857 mercator coordinate system

  Name | Type | Description
  --- | --- | ---
  `features` | Array.<ol.Feature> |

  TODO
    - mechanism to enforce XYZ coordinate layout for internal usage

#### addGenericFeatureProperties(properties) inherited

  Set properties, which are always added to the generic object, eg. for use in balloons

  Name | Type | Description
  --- | --- | ---
  `properties` | Object |

#### clearHiddenObjects() inherited

  clears all the hidden objects

#### clearHighlighting()

  clears all highlighted objects

#### clearStyle() inherited

  Clears the style of this layer

#### dispose() inherited

  disposes of this layer, removes instances from the current maps and the framework

#### getAltitudeMode(){string} inherited

  returns the altitudeMode of the layer

  Deprecated
    - Yes

#### getClassName(){string} inherited

  returns the class name of this object.

  Deprecated
    - Yes

  ##### Returns:

  className

#### getConfigObject(){Object} inherited

#### getExclusiveGroup(){string} inherited

  returns the exclusive group of this layer

  Deprecated
    - Yes

#### getExtent(){vcs.vcm.util.Extent} inherited

  returns the Extent of this layer

  Deprecated
    - Yes

#### getFeatureById(id){ol.Feature} inherited

  returns an feature if found, otherwise null feature geometries are always in EPSG 3857 mercator coordinate system

  Name | Type | Description
  --- | --- | ---
  `id` | string | number |

#### getFeatures(){Array.<ol.Feature>} inherited

  returns an array with features Feature geometries are always in EPSG 3857 mercator coordinate system

#### getFeaturesById(ids){Array.<ol.Feature>} inherited

  returns an array with features feature geometries are always in EPSG 3857 mercator coordinate system

  Name | Type | Description
  --- | --- | ---
  `ids` | Array.<string> |

#### getHeightAboveGround(){number} inherited

  returns the height above ground

  Deprecated
    - Yes

#### getId(){string} inherited

  returns the id of this object

  Deprecated
    - Yes

#### getMaxResolution(){number} inherited

  returns the maximum resolution (exclusive) below which this layer will be visible.

  Deprecated
    - 3.5

#### getMinResolution(){number} inherited

  returns the minimum resolution (inclusive) at which this layer will be visible.

  Deprecated
    - 3.5

#### getName(){string} inherited

  returns the name of the Object, the name is either given by the config Object or a uuid is generated

  Deprecated
    - Yes

#### getProjection(){vcs.vcm.util.Projection} inherited

  returns the source Projection

  Deprecated
    - 3.5

#### getScaleByDistance(){Array.<number>} inherited

  returns the scale By Distance

  Deprecated
    - Yes

#### getSource(){ol.source.Vector} inherited

  returns the ol3 vector source

#### getStyle(){vcs.vcm.util.style.VectorStyleItem} inherited

  returns the style of the layer

  Deprecated
    - 3.5

#### getType(){number} inherited

  returns the type of this layer

  Deprecated
    - Yes

#### getVcsMeta(options){vcs.vcm.layer.VcsMeta} inherited

  Returns the layers vcsMeta object

  Name | Type | Description
  --- | --- | ---
  `options` | vcs.vcm.layer.GeoJSON.writeOptions |

#### getZCoordinateEyeOffset(){number} inherited

  returns the amount of meters the features are being pulled forward in the direction of the viewer (in 3D)

  Deprecated
    - Yes

#### getZIndex(){number} inherited

  returns the zIndex of the layer

  Deprecated
    - Yes

#### hideObjects(ids)

  hides a number of objects

  Name | Type | Description
  --- | --- | ---
  `ids` | Array.<(string|number)> | A list of Object Ids which will be hidden

#### highlight(toHighlight)

  highlights a number of building objects with the given color

  Name | Type | Description
  --- | --- | ---
  `toHighlight` | Object.<string, (vcs.vcm.util.style.VectorStyleItem|Cesium.Color|ol.style.Style)> |

#### isActive(){boolean} inherited

  checks if the layer is active

  Deprecated
    - Yes

#### isExclusive(){boolean} inherited

  returns whether this layer can only be used exclusive

  Deprecated
    - Yes

#### isIconManagerInUse(){boolean} inherited

  returns whether this layer is used by the iconmanager

  Deprecated
    - Yes

#### isInitialized(){boolean} inherited

  returns true if the layer is initialized

  Deprecated
    - Yes

#### isSupported(opt_map){boolean} inherited

  checks if the currently active map supports this layer

  Name | Type | Description
  --- | --- | ---
  `map` | vcs.vcm.maps.Map |

#### removeAllFeatures() inherited

  removes all features from the vector layer

#### removeFeaturesById(ids) inherited

  removes features from the vector layer

  Name | Type | Description
  --- | --- | ---
  `ids` | Array.<(string|number)> |

#### removeStaticFeature(featureId)

  removes a static feature from featureStore layer

  Name | Type | Description
  --- | --- | ---
  `featureId` | string |

#### setHighlightStyle(style) inherited

  sets the highlightstyle of this layer

  Name | Type | Description
  --- | --- | ---
  `style` | ol.style.Style | ol.StyleFunction | vcs.vcm.util.style.VectorStyleItem |

#### setProjection(projection) inherited

  Sets a new source Projection for the layer. All features added hereafter are assumed to be in this projection

  Name | Type | Description
  --- | --- | ---
  `projection` | vcs.vcm.util.Projection |

  Deprecated
    - 3.5

#### setStyle(style, silent)

  Sets the style based on a styleName on a layer

  Name | Type | Description
  --- | --- | ---
  `style` | string | ol.style.Style | ol.StyleFunction | vcs.vcm.util.style.StyleItem |
  `silent` | boolean |

#### showObjects(ids)

  unHides a number of objects

  Name | Type | Description
  --- | --- | ---
  `ids` | Array.<(string|number)> | A list of Object Ids which will be unHidden

#### switchStaticFeatureToDynamic(featureId){Promise.<ol.Feature>}

  switch an array of static features to dynamic features This is done by hiding the static features and adding their dynamic counterparts to the FeatureStore layer

  Name | Type | Description
  --- | --- | ---
  `featureId` | string | number | input static feature ID

#### unHighlight(toUnHighlight)

  unhighlights a number of building objects

  Name | Type | Description
  --- | --- | ---
  `toUnHighlight` | Array.<string> | Array with IDS to unhighlight

### Type Definitions

#### vcs.vcm.layer.FeatureStore.Feature{Object}

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `id` | string | the mongo id
  `properties` | Object | the properties bag
  `geometry` | Object |
  `vcsMeta` | Object | undefined |
  `state` | vcs.vcm.layer.FeatureStore.featureStoreState |
  `type` | string | the featureType

  TODO
    - write vcsMeta for features
    - set type to be one of an enum

#### vcs.vcm.layer.FeatureStore.LayerSchema{Object}

  For further details see: http://gitlab/vcsuite/virtualcityMAP/wikis/featureStore/layerSchema

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `id` | string | layer mongo id
  `type` | string |
  `featureType` | string |
  `staticRepresentation` | vcs.vcm.layer.FeatureStore.StaticRepresentation | undefined | URLs to static representations for 2D and 3D maps
  `hiddenStaticFeatureIds` | Array.<string> | an array of IDs of features to hide from the static representation
  `features` | Array.<vcs.vcm.layer.FeatureStore.Feature> | the array of features to represent dynamic features
  `vcsMeta` | vcs.vcm.layer.VcsMeta | vector style implemented by the map and base64-encoded png icons used for custom styles

  TODO
    - write type enum

#### vcs.vcm.layer.FeatureStore.Options{vcs.vcm.layer.FeatureStore.LayerSchema}

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `injectedFetchDynamicFeatureFunc` | function | undefined | injected function for fetching dynamic features from a remote FeatureStore server

#### vcs.vcm.layer.FeatureStore.StaticRepresentation{Object}

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `threeDim` | string | undefined | 3D static representation of this layer
  `twoDim` | string | undefined | 2D static representation for this layer

#### vcs.vcm.layer.FeatureStore.TrackResults{Object}

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `add` | Array.<ol.Feature> |
  `edit` | Array.<ol.Feature> |
  `remove` | Array.<ol.Feature> |

### Events

#### LAYER_ACTIVATED inherited

  vcs.vcm.event.EventType.LAYER_ACTIVATED is triggered when a layer is activated.

  ##### Type:

  - vcs.vcm.layer.Layer

#### LAYER_CHANGED inherited

  vcs.vcm.event.EventType.LAYER_CHANGED is triggered when a layer is activated or deactivated.

  ##### Type:

  - vcs.vcm.layer.Layer

#### LAYER_DEACTIVATED inherited

  vcs.vcm.event.EventType.LAYER_DEACTIVATED is triggered when a layer is deactivated.

  ##### Type:

  - vcs.vcm.layer.Layer