From eb694b90bc3a7729d85860e037d67ce95c2d38ec Mon Sep 17 00:00:00 2001 From: strajuser Date: Fri, 7 Jul 2017 12:01:35 +0300 Subject: [PATCH] - definitions for identify features --- types/esri-leaflet/esri-leaflet-tests.ts | 30 ++++++ types/esri-leaflet/index.d.ts | 111 +++++++++++++++++++++++ 2 files changed, 141 insertions(+) diff --git a/types/esri-leaflet/esri-leaflet-tests.ts b/types/esri-leaflet/esri-leaflet-tests.ts index e6feca9aba..4c897f7540 100644 --- a/types/esri-leaflet/esri-leaflet-tests.ts +++ b/types/esri-leaflet/esri-leaflet-tests.ts @@ -431,3 +431,33 @@ query.count(function(error, count, response){ }); query.ids(function(error, ids, response){ }); query.where("zone_id='B'").bounds(function(error, latLngBounds, response){ }); + +let identifyFeaturesOptions: L.esri.IdentifyFeaturesOptions; +let identifyFeatures: L.esri.IdentifyFeatures; + +identifyFeaturesOptions = { +}; +identifyFeaturesOptions = { + url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/0', + proxy: '//localhost/proxy', + useCors: true, + timeout: 1000 +}; + +identifyFeatures = L.esri.identifyFeatures(identifyFeaturesOptions); +identifyFeatures = L.esri.identifyFeatures({}); +identifyFeatures = L.esri.identifyFeatures({ + url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/0', + proxy: '//localhost/proxy', + useCors: true, + timeout: 1000 +}); + +identifyFeatures = new L.esri.IdentifyFeatures(identifyFeaturesOptions); +identifyFeatures = new L.esri.IdentifyFeatures({}); +identifyFeatures = new L.esri.IdentifyFeatures({ + url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer/0', + proxy: '//localhost/proxy', + useCors: true, + timeout: 1000 +}); diff --git a/types/esri-leaflet/index.d.ts b/types/esri-leaflet/index.d.ts index e74511f5c7..66d8ae4d6d 100644 --- a/types/esri-leaflet/index.d.ts +++ b/types/esri-leaflet/index.d.ts @@ -972,6 +972,117 @@ declare namespace L { * @returns {Query} */ function query(options: QueryOptions): Query; + + /** + * Options for IdentifyFeatures + * + * @interface IdentifyFeaturesOptions + * @extends {ServiceOptions} + */ + interface IdentifyFeaturesOptions extends ServiceOptions { } + + /** + * L.esri.IdentifyFeatures is an abstraction for the Identify API found in Map Services. It provides a chainable API for building request parameters and executing the request. + * + * @class IdentifyFeatures + * @extends {Task} + */ + class IdentifyFeatures extends Task { + constructor(options: IdentifyFeaturesOptions | ImageService); + /** + * The map to identify features on. + * + * @param {L.Map} map + * @returns {this} + * @memberof IdentifyFeatures + */ + on(map: L.Map): this; + /** + * Identifies feautres at a given + * + * @param {LatLngExpression} latlng + * @returns {this} + * @memberof IdentifyFeatures + */ + at(latlng: LatLngExpression): this; + /** + * Add a layer definition to the query. + * + * @param {number} id + * @param {string} where + * @returns {this} + * @memberof IdentifyFeatures + */ + layerDef(id: number, where: string): this; + /** + * Identifies features within a given time range. + * + * @param {Date} from + * @param {Date} to + * @returns {this} + * @memberof IdentifyFeatures + */ + between(from: Date, to: Date): this; + /** + * By default, only the topmost feature will be identified, but it is possible to specify both an alternative strategy and array of individual layers. See the REST API documentation for more information about valid combinations. + * ex: .layers('all:0'). + * + * @param {string} layers + * @returns {this} + * @memberof IdentifyFeatures + */ + layers(layers: string): this; + /** + * Return only this many decimal points of precision in the output geometries. + * + * @param {number} precision + * @returns {this} + * @memberof IdentifyFeatures + */ + precision(precision: number): this; + /** + * Buffer the identify area by a given number of screen pixels. + * + * @param {number} precision + * @returns {this} + * @memberof IdentifyFeatures + */ + tolerance(precision: number): this; + /** + * Return geometry with results. Default is true. + * + * @param {boolean} returnGeometry + * @returns {this} + * @memberof IdentifyFeatures + */ + returnGeometry(returnGeometry: boolean): this; + /** + * Simplify the geometries of the output features for the current map view. the factor parameter controls the amount of simplification between 0 (no simplification) and 1 (the most basic shape possible). + * + * @param {L.Map} map + * @param {number} factor + * @returns {this} + * @memberof IdentifyFeatures + */ + simplify(map: L.Map, factor: number): this; + /** + * Executes the identify request with the current parameters, identified features will be passed to callback as a GeoJSON FeatureCollection. Accepts an optional function context + * + * @param {FeatureCallbackHandler} callback + * @param {*} context + * @returns {this} + * @memberof IdentifyFeatures + */ + run(callback: FeatureCallbackHandler, context: any): this; + } + + /** + * L.esri.IdentifyFeatures is an abstraction for the Identify API found in Map Services. It provides a chainable API for building request parameters and executing the request. + * + * @param {(IdentifyFeaturesOptions | ImageService)} options + * @returns {IdentifyFeatures} + */ + function identifyFeatures(options: IdentifyFeaturesOptions | ImageService): IdentifyFeatures; } }