Interface ResourceAdapter<M, L, O, F>

Adapter for vector data display control.

interface ResourceAdapter<M, L, O, F> {
    baselayer?: boolean;
    id?: string;
    item?: CompositeRead;
    layer?: L;
    map?: M;
    name?: string;
    options: O;
    order?: number;
    resourceId: number;
    selected?: boolean;
    source?: unknown;
    addData?(geojson: GeoJsonObject): void | Promise<void>;
    addLayer(options: O): undefined | L | Promise<L>;
    beforeRemove?(): void;
    clearLayer?(cb?: ((feature: F) => boolean)): void | Promise<void>;
    closePopup?(findFeatureCb?: DataLayerFilter<F, L>): void;
    filter?(cb: DataLayerFilter<F, L>): LayerDefinition<Feature<Geometry, GeoJsonProperties>, L>[];
    getBounds?(): undefined | LngLatBoundsArray | Promise<(LngLatBoundsArray | undefined)>;
    getDependLayers?(): L[];
    getExtent?(): undefined | LngLatBoundsArray | Promise<(LngLatBoundsArray | undefined)>;
    getFiltered?(): LayerDefinition<Feature<Geometry, GeoJsonProperties>, L>[];
    getIdentificationIds(): Promise<undefined | number[]>;
    getLayers?(): LayerDefinition<F, L>[];
    getLegend?(options?: GetLegendOptions): Promise<LayerLegend[]>;
    getSelected?(): LayerDefinition<Feature<Geometry, GeoJsonProperties>, L>[];
    hideLabel?(): void;
    hideLayer?(layer?: L): void;
    isLabelVisible?(): boolean;
    onLayerClick?(event: OnLayerMouseOptions<Feature<Geometry, GeoJsonProperties>, LayerAdapter<any, any, AdapterOptions<Record<string, any>, Record<string, any>>>>): Promise<any>;
    openPopup?(findFeatureCb?: DataLayerFilter<F, L>, options?: PopupOptions<Feature<Geometry, GeoJsonProperties>, any>): void;
    propertiesFilter?(filters: PropertiesFilter<(F extends Feature<Geometry, GeoJsonProperties>
            ? F<F>["properties"]
            : Record<string, string>) extends null
        ? Record<string, any>
        : F extends Feature<Geometry, GeoJsonProperties>
            ? F<F>["properties"]
            : Record<string, string>>, options?: FilterOptions<(F extends Feature<Geometry, GeoJsonProperties>
            ? F<F>["properties"]
            : Record<string, string>) extends null
        ? Record<string, any>
        : F extends Feature<Geometry, GeoJsonProperties>
            ? F<F>["properties"]
            : Record<string, string>>): Promise<void>;
    removeFilter?(): void;
    removeLayer?(): void;
    select?(findFeatureCb?: PropertiesFilter | DataLayerFilter<F, L>): void;
    setData?(geojson: GeoJsonObject): void | Promise<void>;
    setOpacity?(val: number): void;
    setPaint?(paint: Paint): void;
    setSelectedPaint?(paint: Paint): void;
    showLabel?(): void;
    showLayer?(layer?: L): void;
    unselect?(findFeatureCb?: PropertiesFilter | DataLayerFilter<F, L>): void;
    updateLayer?(options?: UpdateLayerAdapterOptions): void;
    updatePaint?(paint: Partial<Paint>): void;
    updateSelectedPaint?(paint: Partial<Paint>): void;
    updateTooltip?(layerDef?: LayerDefinition<F, L>): void;
}

Type Parameters

Hierarchy (view full)

Implemented by

Properties

baselayer?: boolean
id?: string
item?: CompositeRead
layer?: L
map?: M
name?: string
options: O
order?: number
resourceId: number
selected?: boolean

True if there are selected features in the layer

source?: unknown

Experimental option, only for MVT. Points to a data source instead of loading data into a layer.

Methods

  • The way to filter layer objects through serializable expressions. To clear the filter, pass null or undefined as the second parameter.

    Parameters

    • filters: PropertiesFilter<(F extends Feature<Geometry, GeoJsonProperties>
              ? F<F>["properties"]
              : Record<string, string>) extends null
          ? Record<string, any>
          : F extends Feature<Geometry, GeoJsonProperties>
              ? F<F>["properties"]
              : Record<string, string>>

      Filter, conforming to the PropertiesFilter expression specification's.

    • Optionaloptions: FilterOptions<(F extends Feature<Geometry, GeoJsonProperties>
              ? F<F>["properties"]
              : Record<string, string>) extends null
          ? Record<string, any>
          : F extends Feature<Geometry, GeoJsonProperties>
              ? F<F>["properties"]
              : Record<string, string>>

      Options object.

    Returns Promise<void>

    layer.propertiesFilter(['all', ['color', 'eq', 'green'], ['year', 'gt', 2011]]);
    layer.propertiesFilter([[
    'any',
    ['color', 'eq', 'green'],
    ['color', 'eq', 'red']
    ],
    ['year', 'gt', 2011]
    ]);