export default FeatureHash; /** * accuracy: The encoding and decoding accuracy. Optional. Default value is 1. */ export type FeatureHashOptions = { /** * The encoding and decoding accuracy. Optional. Default value is 1. */ accuracy?: number; /** * defaultValues. */ defaultValues?: { [x: string]: (arg0: olFeature) => void; }; /** * Encode styles. Optional. */ encodeStyles?: boolean; /** * A function that returns serializable properties for a feature. Optional. By default the feature * properties (as returned by `feature.getProperties()`) are used. To be serializable the returned * properties should be numbers or strings. */ properties?: (arg0: olFeature) => { [x: string]: (string | number | undefined); }; /** * Determines whether the style defined for each feature is read and * converted into: * A) an `ol.style.Style` object set in the feature, or * B) an object with key:values that defines the style properties set in the feature and for the * `ngeo.misc.FeatureHelper` to use to style the feature with. */ setStyle?: boolean; propertiesType?: { [x: string]: string; }; }; /** * Provide an OpenLayers format for encoding and decoding features for use * in permalinks. * * The code is based on Stéphane Brunner's URLCompressed format. * * TODOs: * * - The OpenLayers-URLCompressed format has options where the user * can define attribute and style transformers. This is currently * not supported by this format. * - The OpenLayers-URLCompressed format has a "simplify" option. * This format does not have it. * - ol.style.Icon styles are not supported. * - Transformation of coordinates during encoding and decoding is * not supported. * * @see https://github.com/sbrunner/OpenLayers-URLCompressed */ declare class FeatureHash extends olFormatTextFeature { /** * @param {FeatureHashOptions} [opt_options] Options. */ constructor(opt_options?: FeatureHashOptions); /** * @type {number} * @private */ private accuracy_; /** * @type {boolean} * @private */ private encodeStyles_; /** * @type {function(olFeature):Object} * @private */ private propertiesFunction_; /** * @type {boolean} * @private */ private setStyle_; /** * @type {number} * @private */ private prevX_; /** * @type {number} * @private */ private prevY_; /** * @type {Object): void>} * @private */ private defaultValues_; /** * Read a logical sequence of characters and return (or complete then return) * an array of numbers. The coordinates are assumed to be in * two dimensions and in latitude, longitude order. * corresponding to a geometry's coordinates. * * @param {string} text Text. * @param {number[]} [opt_flatCoordinates] Flat coordinates array. * @returns {number[]} Flat coordinates. */ decodeCoordinates_(text: string, opt_flatCoordinates?: number[]): number[]; /** * Encode an array of number (corresponding to some coordinates) into a * logical sequence of characters. The coordinates are assumed to be in * two dimensions and in latitude, longitude order. * * @param {number[]} flatCoordinates Flat coordinates. * @param {number} stride Stride. * @param {number} offset Offset. * @param {number} end End. * @returns {string} String. * @hidden */ encodeCoordinates_(flatCoordinates: number[], stride: number, offset: number, end: number): string; /** * Encode a feature into a logical sequence of characters. * * @param {olFeature} feature Feature. * @param {import('ol/format/Feature').ReadOptions} [opt_options] Read options. * @returns {string} Encoded feature. * @protected * @override */ protected override writeFeatureText(feature: olFeature, opt_options?: import("ol/format/Feature").ReadOptions): string; /** * Encode an array of features into a logical sequence of characters. * * @param {olFeature[]} features Feature. * @param {import('ol/format/Feature').ReadOptions} [opt_options] Read options. * @returns {string} Encoded features. * @protected * @override */ protected override writeFeaturesText(features: olFeature[], opt_options?: import("ol/format/Feature").ReadOptions): string; /** * Encode a geometry into a logical sequence of characters. * * @param {Geometry} geometry Geometry. * @param {import('ol/format/Feature').ReadOptions} [opt_options] Read options. * @returns {string} Encoded geometry. * @protected * @override */ protected override writeGeometryText(geometry: Geometry, opt_options?: import("ol/format/Feature").ReadOptions): string; } import olFeature from 'ol/Feature'; import olFormatTextFeature from 'ol/format/TextFeature'; import Geometry from 'ol/geom/Geometry';