geoview-core
    Preparing search index...

    Class AbstractGeoViewLayerAbstract

    The AbstractGeoViewLayer class is the abstraction class of all GeoView Layers classes. It registers the configuration options and defines the methods shared by all its descendant. The class constructor has three parameters: mapId, type and mapLayerConfig. Its role is to save in attributes the mapId, type and elements of the mapLayerConfig that are common to all GeoView layers. The main characteristic of a GeoView layer is the presence of an metadataAccessPath attribute whose value is passed as an attribute of the mapLayerConfig object.

    The general order of the overridable methods in the processing is:

    1. onFetchAndSetServiceMetadata
    2. onValidateListOfLayerEntryConfig
    3. onValidateLayerEntryConfig
    4. onProcessLayerMetadata
    5. onProcessOneLayerEntry
    6. onCreateGVLayer

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    hitTolerance: number = AbstractGeoViewLayer.DEFAULT_HIT_TOLERANCE

    The default hit tolerance

    listOfLayerEntryConfig: TypeLayerEntryConfig[] = []

    An array of layer settings. In the schema, this attribute is optional. However, we define it as mandatory and if the configuration does not provide a value, we use an empty array instead of an undefined attribute.

    olRootLayer?: BaseLayer

    The OpenLayer root layer representing this GeoView Layer.

    DEFAULT_HIT_TOLERANCE: number = 4

    The default hit tolerance the query should be using

    DEFAULT_WAIT_PERIOD_METADATA_WARNING: number = ...

    The default waiting time before showing a warning about the metadata taking a long time to get processed

    Methods

    • Adds a GeoViewLayerLoadedFailedError in the internal list of errors for a layer being loaded. It also sets the layer status to error.

      Parameters

      • error: Error

        The error

      • layerConfig: ConfigBaseClass | undefined

        Optional layer config

      Returns void

    • Recursively processes the list of layer entries to see if all of them are greater than or equal to the provided layer status.

      Parameters

      • layerStatus: TypeLayerStatus

        The layer status to compare with the internal value of the config.

      Returns boolean

      true when all layers are greater than or equal to the layerStatus parameter.

    • This method is used to create the layers specified in the listOfLayerEntryConfig attribute inherited from its parent. Normally, it is the second method called in the life cycle of a GeoView layer, the first one being the constructor. Its code is the same for all child classes. It must first validate that the olLayers attribute is null indicating that the method has never been called before for this layer. If this is not the case, an error message must be sent. Then, it calls the abstract method getAdditionalServiceDefinition. For example, when the child is a WFS service, this method executes the GetCapabilities request and saves the result in the metadata attribute of the class. It also process the layer's metadata for each layer in the listOfLayerEntryConfig tree in order to define the missing pieces of the layer's configuration. Layer's configuration can come from the configuration of the GeoView layer or from the information saved by the method #processListOfLayerMetadata, priority being given to the first of the two. When the GeoView layer does not have a service definition, the getAdditionalServiceDefinition method does nothing.

      Finally, the processListOfLayerEntryConfig is called to instantiate each layer identified by the listOfLayerEntryConfig attribute. This method will also register the layers to all layer sets that offer this possibility. For example, if a layer is queryable, it will subscribe to the details-panel and every time the user clicks on the map, the panel will ask the layer to return the descriptive information of all the features in a tolerance radius. This information will be used to populate the details-panel.

      Parameters

      • OptionalmapProjection: Projection

        The map projection.

      • OptionalabortSignal: AbortSignal

        Abort signal to handle cancelling of the process.

      Returns Promise<ConfigBaseClass[]>

      A promise of the config base classes created.

    • Protected

      Emits a layer-specific message event with localization support

      Parameters

      • messageKey: string

        The key used to lookup the localized message OR message

      • messageParams: string[] | undefined = []

        Array of parameters to be interpolated into the localized message

      • messageType: SnackbarType = ...

        The message type

      • Optionalnotification: boolean = false

        Whether to show this as a notification. Defaults to false

      Returns void

      this.emitMessage(
      'layers.fetchProgress',
      ['50', '100'],
      messageType: 'error',
      true
      );

      LayerMessageEvent

    • Fetches the metadata by calling onFetchServiceMetadata.

      Type Parameters

      • T

      Parameters

      • OptionalabortSignal: AbortSignal

        Abort signal to handle cancelling of the process.

      Returns Promise<T>

      Returns a Promise of a metadata

      When the metadata fetch fails or contains an error.

      When the metadata is empty (no Capabilities) (WMS/WFS layers).

    • Initializes the server date fragments order from a service date format string. If the date fragments order has not already been set, this method derives it from the provided date format using DateMgt.getDateFragmentsOrder and stores it for later use.

      Parameters

      • OptionaldateFormat: string = 'DD/MM/YYYY HH:MM:SSZ'

        The date format string provided by the service, used to determine the order of date fragments.

      Returns void

    • Must override method to read the service metadata from the metadataAccessPath.

      Type Parameters

      • T

      Parameters

      • OptionalabortSignal: AbortSignal

        Abort signal to handle cancelling of the process.

      Returns Promise<T>

      A promise resolved once the metadata has been fetched.

      When the metadata fetch fails or contains an error.

    • Must override method to process a layer entry and return a Promise of an Open Layer Base Layer object.

      Parameters

      • layerConfig: AbstractBaseLayerEntryConfig

        Information needed to create the GeoView layer.

      • OptionalmapProjection: Projection

        The map projection.

      • OptionalabortSignal: AbortSignal

        Abort signal to handle cancelling of the process.

      Returns Promise<AbstractBaseLayerEntryConfig>

      The Promise that the config metadata has been processed.

    • Overridable method to process a layer entry and return a Promise of an Open Layer Base Layer object.

      Parameters

      • layerConfig: AbstractBaseLayerEntryConfig

        Information needed to create the GeoView layer.

      Returns Promise<AbstractBaseGVLayer>

      The Open Layer Base Layer that has been created.

    • Overridable method to validate the configuration of the layer entries to ensure that each layer is correctly defined.

      Parameters

      • listOfLayerEntryConfig: ConfigBaseClass[]

        The list of layer entries configuration to validate.

      Returns void