@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
43 lines (42 loc) • 2.04 kB
TypeScript
import Feature from 'ol/Feature.js';
import { GeoJSON } from 'ol/format.js';
import GirafeSingleton from '../../base/GirafeSingleton.js';
import IGirafeContext from '../context/icontext.js';
import { Extent } from 'ol/extent.js';
export declare const SEARCH_PROVIDER_DEFAULT = "default";
export declare const SEARCH_GROUP_DEFAULT = "default";
export declare const SEARCH_GROUP_RECENTER_MAP = "recenter_map";
declare abstract class AbstractSearchClient extends GirafeSingleton {
readonly type: string;
readonly providerName: string;
protected url: URL;
protected readonly resultSrid: string;
protected readonly searchTermPlaceholder = "###SEARCHTERM###";
protected readonly searchLangPlaceholder = "###SEARCHLANG###";
protected readonly geoJsonFormatter: GeoJSON<Feature<import("ol/geom.js").Geometry, {
[x: string]: any;
}>>;
protected constructor(context: IGirafeContext, type: string, name: string, url: string, resultSrid: string);
initializeSingleton(): void;
protected get mapProjection(): import("ol/proj.js").Projection;
requestSearch(term: string, abortController: AbortController): Promise<Feature[]>;
/**
* Parses the response from the server and returns an array of features.
* Features must have the following properties to be used correctly with the search component:
* - `provider`
* - `label`
* - `label_html`: optional, for styled entries in the search results list
* - `actions`: optional, a list of SearchResultsActions
*/
protected parseResponse(response: Response): Promise<Feature[]>;
/**
* Groups results by the default group, which equivalates to no grouping. Should be overridden by the client class
* to group results by a custom criteria.
*/
groupedResults(results: Feature[]): Record<string, Feature[]>;
/**
* Returns a bbox around the geometry that is 50% larger than the geometry.
*/
getZoomToBbox(feature: Feature): Extent | undefined;
}
export default AbstractSearchClient;