geopf-extensions-openlayers
    Preparing search index...

    Class Catalog

    Hierarchy (View Summary)

    Index
    • Parameters

      Returns Catalog

      catalog:loaded

      catalog:layer:add

      var widget = new ol.control.Catalog({
      collapsed : true,
      draggable : false,
      titlePrimary : "",
      titleSecondary : "Gérer vos couches de données",
      layerLabel : "title",
      layerThumbnail : true,
      search : {
      display : true,
      label : "Rechercher une donnée",
      criteria : [
      "name",
      "title",
      "description"
      ]
      },
      addToMap : true,
      categories : [
      {
      title : "Données",
      id : "data",
      default : true,
      search : false,
      filter : null
      // sous categories
      // items : [
      // {
      // title : "",
      // default : true,
      // section : true, // avec section (ex. regroupement par themes)
      // icon : true, // icone pour les sections (svg ou lien http ou dsfr classe)
      // filter : {
      // field : "",
      // value : ""
      // }
      // }
      // ]
      }
      ],
      configuration : {
      type : "json",
      urls : [ // data:{}
      "https://raw.githubusercontent.com/IGNF/cartes.gouv.fr-entree-carto/main/public/data/layers.json",
      "https://raw.githubusercontent.com/IGNF/cartes.gouv.fr-entree-carto/main/public/data/edito.json"
      ]
      }
      });
      widget.on("catalog:loaded", (e) => { console.log(e.data); });
      widget.on("catalog:layer:add", (e) => { console.log(e); });
      widget.on("catalog:layer:remove", (e) => { console.log(e); });
      map.addControl(widget);

      validation du schema

    auto: boolean | undefined

    specify if control add some stuff auto

    categories: Categories[] | undefined

    specify all categories

    [
    {
    title : "Données", // title of the category
    id : "data", // id of the category
    default : true, // if true, this category is selected by default
    order : false, // if true, the items are ordered alphabetically
    featured : false, // if true, featured items are displayed first
    search : false, // if true, a search bar is displayed for this category
    cluster : false, // if true, clustering is activated for this category
    filter : null, // filter to apply on the category
    items : [ // list of subcategories
    {
    title : "Toutes les données", // title of the subcategory
    id : "all", // id of the subcategory
    default : true, // if true, this subcategory is selected by default
    order : false, // if true, the items are ordered alphabetically
    featured : false, // if true, featured items are displayed first
    icon : true, // icon for the subcategory (svg or http link or dsfr class)
    iconJson : [], // list of icons (json) for the sections
    cluster : false, // if true, clustering is activated for this subcategory
    section : false, // if true, this subcategory has a section
    sections : [], // list of sections (filled later)
    filter : null, // filter to apply on the subcategory
    }
    ]
    }
    ]
    categoryId: string | undefined

    specify the current category selected

    clusterizeRef: any

    specify clusterize instances for each category/subcategory/section

    {
    * "data" : Clusterize, // category id + instance
    * "454587412" : Clusterize, // subcategory id + instance
    * "457121205" : Clusterize, // subcategory id + instance
    * }
    clusterizeSections: any

    specify clusterize sections for each category/subcategory

    {
    * 548487533 : { // subcategory id
    * "section-accordion-548487533-72432" : [rows], // section id + rows
    * "section-accordion-548487533-78155" : [rows] // section id + rows
    * }
    * }
    clusterOptions: { blocks_in_cluster: number; rows_in_block: number } | undefined
    collapsed: boolean | undefined

    specify if control is collapsed (true) or not (false)

    configData: any

    specify configuration data (configuration service)

    container: HTMLElement
    dataOnDemand: any

    specify data on demand instances for each category/subcategory/section

    {
    * base : fragmentDocument, // category id + fragmentDocument
    * 457121205 : fragmentDocument, // subcategory id + fragmentDocument
    * 548487533 : {
    * "section-accordion-548487533-72432" : fragmentDocument, // section id + fragmentDocument
    * "section-accordion-548487533-78155" : fragmentDocument // section id + fragmentDocument
    * }
    description: any
    disposed: boolean

    The object has already been disposed.

    draggable: boolean | undefined

    specify if control is draggable (true) or not (false)

    element: HTMLElement
    eventsListeners: any[] | undefined

    specify some events listeners

    featuredLayersList: any[] | undefined

    specify all featured layers id

    layersList: any[] | undefined

    specify all list of layers (configuration service)

    layersListOnMap: any

    list of layers added on map by key pair : name/service

    {
    * "GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2:WMTS" : ol/layer/Tile,
    * "PLAN.IGN$GEOPORTAIL:TMS" : ol/layer/VectorTile
    * }
    listable: boolean
    listenerKeys: EventsKey[]
    on: ObjectOnSignature<EventsKey>
    once: ObjectOnSignature<EventsKey>
    options:
        | {
            addToMap: boolean;
            auto: boolean;
            categories: {
                cluster: boolean;
                clusterOptions: { blocks_in_cluster: number; rows_in_block: number };
                default: boolean;
                featured: boolean;
                filter: null;
                id: string;
                order: boolean;
                title: string;
            }[];
            collapsed: boolean;
            configuration: { type: string; urls: string[] };
            draggable: boolean;
            layerLabel: string;
            layerThumbnail: boolean;
            optimisation: string;
            search: { criteria: string[]; display: boolean; label: string };
            size: string;
            tabHeightAuto: boolean;
            titlePrimary: string;
            titleSecondary: string;
        }
        | undefined
    un: ObjectOnSignature<void>
    • Activate a layer This method activates a layer by its name and service. It checks if the layer exists in the layersList and if it does, it adds the layer to the map if addToMap is true. It then dispatches an event indicating that the layer has been added to the catalog.

      Parameters

      • name: string

        Layer name.

      • service: string

        Layer service.

      Returns void

      activeLayer("GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2", "WMTS");
      activeLayer("PLAN.IGN", "GEOPORTAIL:TMS");
    • Activate a layer by its ID This method activates a layer based on its ID, which is expected to be in the format "name$service". It splits the ID to extract the layer name and service, then calls the activeLayer method.

      Parameters

      • id: any

        Layer ID in the format "name$service".

      Returns void

      activeLayerByID("GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2$WMTS");
      activeLayerByID("PLAN.IGN$GEOPORTAIL:TMS");
    • Parameters

      • key: string

        Key name.

      • listener: Listener

        Listener.

      Returns void

    • Parameters

      • type: string

        Type.

      • listener: Listener

        Listener.

      Returns void

    • Add a layer config This method processes a configuration object containing layer definitions.

      Parameters

      • conf: any

        conf

      Returns void

    • Protected

      Apply any properties from another object without triggering events.

      Parameters

      • source: BaseObject

        The source object.

      Returns void

    • Increases the revision counter and dispatches a 'change' event.

      Returns void

    • Disable a layer This method disables a layer by its name and service. It checks if the layer exists in the layersList and if it does, it removes the layer from the map if addToMap is true. It then dispatches an event indicating that the layer has been removed from the catalog.

      Parameters

      • name: string

        Layer name.

      • service: string

        Layer service.

      Returns void

      disableLayer("GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2", "WMTS");
      disableLayer("PLAN.IGN", "GEOPORTAIL:TMS");
    • Disable a layer by its ID This method disables a layer based on its ID, which is expected to be in the format "name$service". It splits the ID to extract the layer name and service, then calls the disableLayer method.

      Parameters

      • id: any

        Layer ID in the format "name$service".

      Returns void

      disableLayerByID("GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2$WMTS");
      disableLayerByID("PLAN.IGN$GEOPORTAIL:TMS");
      • ajouter un test pour vérifier si l'ID est valide
      • ajouter un test pour vérifier si la couche est déjà active
      • ajouter un test pour vérifier si la couche est déjà désactivée
    • Dispatches an event and calls all listeners listening for events of this type. The event parameter can either be a string or an Object with a type property.

      Parameters

      • event: string | BaseEvent

        Event object.

      Returns boolean | undefined

      false if anyone called preventDefault on the event object or if any of the listeners returned false.

    • Clean up.

      Returns void

    • Protected

      Extension point for disposable objects.

      Returns void

    • Gets a value.

      Parameters

      • key: string

        Key name.

      Returns any

      Value.

    • Get a list of object property names.

      Returns string[]

      List of property names.

    • Get long layer ID

      Parameters

      • name: any

        nom de la couche

      • service: any

        service de la couche

      Returns string | null

      • long layer ID or null if not found

      This method retrieves the long layer ID based on the provided name and service. It searches through the layersList object for a key that matches the pattern of "name.*service". If a match is found, it returns the key; otherwise, it returns null.

      getLayerId("GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2", "WMTS");
      getLayerId("PLAN.IGN", "GEOPORTAIL:TMS");
    • Get layers by category This method filters the layers based on the provided category and sort order if specified. It checks if the category has a filter defined and applies it to the layers. If the filter matches, the layer is added to the layersCategorised array. It also updates the categories property of each layer to include the category ID.

      Parameters

      • category: any

        Category object containing the filter.

      • layers: any

        Object containing all layers.

      Returns any[]

      • Filtered layers categorized by the provided category.
    • Get the listeners for a specified event type. Listeners are returned in the order that they will be called in.

      Parameters

      • type: string

        Type.

      Returns Listener[] | undefined

      Listeners.

    • Get the map associated with this control.

      Returns Map | null

      Map.

    • Get an object of all property names and values.

      Returns NoInfer<{ [x: string]: any }>

      Object.

    • Get an object of all property names and values.

      Returns Partial<NoInfer<{ [x: string]: any }>> | null

      Object.

    • Get the version number for this object. Each time the object is modified, its version number will be incremented.

      Returns number

      Revision.

    • Parameters

      • Optionaltype: string

        Type. If not provided, true will be returned if this event target has any listeners.

      Returns boolean

      Has listeners.

    • Returns boolean

      The object has properties.

    • Parameters

      • key: string

        Key name.

      • oldValue: any

        Old value.

      Returns void

    • Protected

      Parameters

      • type: string | string[]

        Type.

      • listener: (arg0: Event | BaseEvent) => unknown

        Listener.

      Returns EventsKey | EventsKey[]

      Event key.

    • Protected

      Parameters

      • type: string | string[]

        Type.

      • listener: (arg0: Event | BaseEvent) => unknown

        Listener.

      Returns EventsKey | EventsKey[]

      Event key.

    • Parameters

      • key: string

        Key name.

      • listener: Listener

        Listener.

      Returns void

    • Parameters

      • type: string

        Type.

      • listener: Listener

        Listener.

      Returns void

    • Renders the control.

      Parameters

      • mapEvent: MapEvent

        Map event.

      Returns void

    • Sets a value.

      Parameters

      • key: string

        Key name.

      • value: any

        Value.

      • Optionalsilent: boolean

        Update without triggering an event.

      Returns void

    • Collapse or display widget main container

      Parameters

      • collapsed: boolean

        True to collapse widget, False to display it

      Returns void

    • Overwrite OpenLayers setMap method This method sets the map for the Catalog control. It initializes event listeners for the map and sets up the control's draggable and collapsed states. It also checks for existing layers on the map and updates the control accordingly.

      Parameters

      • map: Map

        Map instance to set for the control.

      Returns void

    • Sets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any existing properties).

      Parameters

      • values: Partial<NoInfer<Properties>>

        Values.

      • Optionalsilent: boolean

        Update without triggering an event.

      Returns void

    • This function is used to set a target element for the control. It has no effect if it is called after the control has been added to the map (i.e. after setMap is called on the control). If no target is set in the options passed to the control constructor and if setTarget is not called then the control is added to the map's overlay container.

      Parameters

      • target: string | HTMLElement

        Target.

      Returns void

    • Protected

      Unlisten for a certain type of event.

      Parameters

      • type: string | string[]

        Type.

      • listener: (arg0: Event | BaseEvent) => unknown

        Listener.

      Returns void

    • Unsets a property.

      Parameters

      • key: string

        Key name.

      • Optionalsilent: boolean

        Unset without triggering an event.

      Returns void

    ADD_CATALOG_LAYER_EVENT: string | undefined

    event triggered when layer is added

    catalog:layer:add

    "catalog:layer:add"
    
    Catalog.on("catalog:layer:add", function (e) {
    console.log(e.layer);
    })
    LOADED_CATALOG_EVENT: string | undefined

    event triggered when data is loaded

    catalog:loaded

    "catalog:loaded"
    
    Catalog.on("catalog:loaded", function (e) {
    console.log(e.data);
    })
    REMOVE_CATALOG_LAYER_EVENT: string | undefined

    event triggered when layer is removed

    catalog:layer:remove

    "catalog:layer:remove"
    
    Catalog.on("catalog:layer:remove", function (e) {
    console.log(e.layer);
    })