From 8a8b46f0ce5179a42a05f5d1720bdb8a4e9a45bb Mon Sep 17 00:00:00 2001 From: beginor Date: Fri, 6 Jan 2017 19:20:31 -0600 Subject: [PATCH] [openlayers] ol.format.ogc.filter > ol.format.filter, view.animate(), and ol.Map#forEachFeatureAtPixel ol.Map#hasFeatureAtPixel (#13588) * update openlayers: - move `ol.format.ogc.filter` to `ol.format.filter`; - add `view.animate()` method; - change `ol.Map#forEachFeatureAtPixel` and `ol.Map#hasFeatureAtPixel` parameters; * Merge remote-tracking branch 'upstream/master' --- openlayers/index.d.ts | 74 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 11 deletions(-) diff --git a/openlayers/index.d.ts b/openlayers/index.d.ts index 5f30540d5a..f81e964b4d 100644 --- a/openlayers/index.d.ts +++ b/openlayers/index.d.ts @@ -2764,10 +2764,8 @@ declare module ol { } - module ogc { - module filter { - interface Filter { } - } + module filter { + interface Filter { } } /** @@ -6669,13 +6667,22 @@ declare module ol { * the {@link ol.layer.Layer layer} of the feature and will be null for * unmanaged layers. To stop detection, callback functions can return a * truthy value. - * @param {olx.AtPixelOptions=} opt_options Optional options. + * @param {(function(this: U, ol.layer.Layer): boolean)=} opt_layerFilter Layer + * filter function. The filter function will receive one argument, the + * {@link ol.layer.Layer layer-candidate} and it should return a boolean + * value. Only layers which are visible and for which this function returns + * `true` will be tested for features. By default, all visible layers will + * be tested. * @return {T|undefined} Callback result, i.e. the return value of last * callback execution, or the first truthy callback return value. - * @template S,T + * @template T * @api stable */ - forEachFeatureAtPixel(pixel: ol.Pixel, callback: ((feature: (ol.Feature | ol.render.Feature), layer: ol.layer.Layer) => T), opt_options?: olx.AtPixelOptions): (T); + forEachFeatureAtPixel( + pixel: ol.Pixel, + callback: ((feature: (ol.Feature | ol.render.Feature), layer: ol.layer.Layer) => T), + opt_layerFilter?: ((layer: ol.layer.Layer) => boolean) + ): (T); /** * Detect layers that have a color value at a pixel on the viewport, and @@ -6712,12 +6719,13 @@ declare module ol { * value. Only layers which are visible and for which this function returns * `true` will be tested for features. By default, all visible layers will * be tested. - * @param {U=} opt_this Value to use as `this` when executing `layerFilter`. * @return {boolean} Is there a feature at the given pixel? - * @template U * @api */ - hasFeatureAtPixel(pixel: ol.Pixel, opt_layerFilter?: ((layer: ol.layer.Layer) => boolean), opt_this?: U): boolean; + hasFeatureAtPixel( + pixel: ol.Pixel, + opt_layerFilter?: ((layer: ol.layer.Layer) => boolean) + ): boolean; /** * Returns the geographical coordinate for a browser event. @@ -7902,6 +7910,23 @@ declare module ol { */ function transformExtent(extent: ol.Extent, source: ol.ProjectionLike, destination: ol.ProjectionLike): ol.Extent; + /** + * Get the resolution of the point in degrees or distance units. For + * projections with degrees as the unit this will simply return the + * provided resolution. For other projections the point resolution is + * estimated by transforming the 'point' pixel to EPSG:4326, measuring + * its width and height on the normal sphere, and taking the average of + * the width and height. + * @param {ol.proj.Projection} projection The projection. + * @param {number} resolution Nominal resolution in projection units. + * @param {ol.Coordinate} point Point to find adjusted resolution at. + * @return {number} Point to find adjusted resolution at. + */ + function getPointResolution( + projection: ol.proj.Projection, + resolution: number, + point: ol.Coordinate + ): number; } /** @@ -11701,6 +11726,15 @@ declare module ol { */ setZoom(zoom: number): void; + /** + * Animate the view. The view's center, zoom (or resolution), and + * rotation can be animated for smooth transitions between view states. + * @param {olx.AnimateOptions} var_args Animation options. + * @param {olx.AnimateOptions | (completed: boolean) => void } restArgs + * @api experimental + */ + animate(...var_args: Array): void; + } } @@ -11771,6 +11805,24 @@ declare module olx { easing?: ((t: number) => number); } + /** + * Animation options. Multiple animations can be run in series by passing + * multiple options objects. To run multiple animations in parallel, call + * the method multiple times. An optional callback can be provided as a + * final argument. The callback will be called with a boolean indicating + * whether the animation completed without being cancelled. + */ + interface AnimateOptions { + center?: ol.Coordinate | undefined; + zoom?: number | undefined; + resolution?: number | undefined; + rotation?: number | undefined; + anchor?: number | undefined; + duration?: number | undefined; + easing?: ((t: number) => number) | undefined; + } + + type AnimateCallback = (completed: boolean) => void; } /** @@ -12162,7 +12214,7 @@ declare module olx { startIndex?: number; count?: number; bbox?: ol.Extent; - filter?: ol.format.ogc.filter.Filter; + filter?: ol.format.filter.Filter; resultType?: string; }