mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-29 09:55:50 +08:00
135
types/openlayers/index.d.ts
vendored
135
types/openlayers/index.d.ts
vendored
@@ -12344,13 +12344,42 @@ declare module ol {
|
||||
*/
|
||||
constructor(opt_options?: olx.ViewOptions);
|
||||
|
||||
/**
|
||||
* 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<olx.animation.AnimateOptions | olx.animation.AnimateCallback>): void;
|
||||
|
||||
/**
|
||||
* Determine if the view is being animated.
|
||||
* @return {boolean} The view is being animated.
|
||||
* @api
|
||||
*/
|
||||
getAnimating(): boolean;
|
||||
|
||||
/**
|
||||
* Determine if the user is interacting with the view, such as panning or zooming.
|
||||
* @return {boolean} The view is being interacted with.
|
||||
* @api
|
||||
*/
|
||||
getInteracting(): boolean;
|
||||
|
||||
/**
|
||||
* Cancel any ongoing animations.
|
||||
* @api
|
||||
*/
|
||||
cancelAnimations(): void;
|
||||
|
||||
/**
|
||||
* Get the constrained center of this view.
|
||||
* @param {ol.Coordinate|undefined} center Center.
|
||||
* @return {ol.Coordinate|undefined} Constrained center.
|
||||
* @api
|
||||
*/
|
||||
constrainCenter(center: (ol.Coordinate)): (ol.Coordinate);
|
||||
constrainCenter(center?: ol.Coordinate): ol.Coordinate;
|
||||
|
||||
/**
|
||||
* Get the constrained resolution of this view.
|
||||
@@ -12360,7 +12389,7 @@ declare module ol {
|
||||
* @return {number|undefined} Constrained resolution.
|
||||
* @api
|
||||
*/
|
||||
constrainResolution(resolution: (number), opt_delta?: number, opt_direction?: number): (number);
|
||||
constrainResolution(resolution?: number, opt_delta?: number, opt_direction?: number): number;
|
||||
|
||||
/**
|
||||
* Get the constrained rotation of this view.
|
||||
@@ -12369,7 +12398,7 @@ declare module ol {
|
||||
* @return {number|undefined} Constrained rotation.
|
||||
* @api
|
||||
*/
|
||||
constrainRotation(rotation: (number), opt_delta?: number): (number);
|
||||
constrainRotation(rotation?: number, opt_delta?: number): number;
|
||||
|
||||
/**
|
||||
* Get the view center.
|
||||
@@ -12377,7 +12406,7 @@ declare module ol {
|
||||
* @observable
|
||||
* @api stable
|
||||
*/
|
||||
getCenter(): (ol.Coordinate);
|
||||
getCenter(): ol.Coordinate;
|
||||
|
||||
/**
|
||||
* Calculate the extent for the current view state and the passed size.
|
||||
@@ -12404,6 +12433,34 @@ declare module ol {
|
||||
*/
|
||||
getMinResolution(): number;
|
||||
|
||||
/**
|
||||
* Get the maximum zoom level for the view.
|
||||
* @return {number} The maximum zoom level.
|
||||
* @api
|
||||
*/
|
||||
getMaxZoom(): number;
|
||||
|
||||
/**
|
||||
* Set a new maximum zoom level for the view.
|
||||
* @param {number} zoom The maximum zoom level.
|
||||
* @api stable
|
||||
*/
|
||||
setMaxZoom(zoom: number): void;
|
||||
|
||||
/**
|
||||
* Get the minimum zoom level for the view.
|
||||
* @return {number} The minimum zoom level.
|
||||
* @api
|
||||
*/
|
||||
getMinZoom(): number;
|
||||
|
||||
/**
|
||||
* Set a new minimum zoom level for the view.
|
||||
* @param {number} zoom The minimum zoom level.
|
||||
* @api stable
|
||||
*/
|
||||
setMinZoom(zoom: number): void;
|
||||
|
||||
/**
|
||||
* Get the view projection.
|
||||
* @return {ol.proj.Projection} The projection of the view.
|
||||
@@ -12417,7 +12474,7 @@ declare module ol {
|
||||
* @observable
|
||||
* @api stable
|
||||
*/
|
||||
getResolution(): (number);
|
||||
getResolution(): number;
|
||||
|
||||
/**
|
||||
* Get the resolutions for the view. This returns the array of resolutions
|
||||
@@ -12425,7 +12482,17 @@ declare module ol {
|
||||
* @return {Array.<number>|undefined} The resolutions of the view.
|
||||
* @api stable
|
||||
*/
|
||||
getResolutions(): (number[]);
|
||||
getResolutions(): number[];
|
||||
|
||||
/**
|
||||
* Get the resolution for a provided extent (in map units) and size (in pixels).
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {ol.Size=} opt_size Box pixel size.
|
||||
* @return {number} The resolution at which the provided extent will render at
|
||||
* the given size.
|
||||
* @api
|
||||
*/
|
||||
getResolutionForExtent(extent: ol.Extent, opt_size?: ol.Size): number;
|
||||
|
||||
/**
|
||||
* Get the view rotation.
|
||||
@@ -12436,12 +12503,29 @@ declare module ol {
|
||||
getRotation(): number;
|
||||
|
||||
/**
|
||||
* Get the current zoom level. Return undefined if the current
|
||||
* resolution is undefined or not within the "resolution constraints".
|
||||
* Get the current zoom level. If you configured your view with a resolutions
|
||||
* array (this is rare), this method may return non-integer zoom levels (so
|
||||
* the zoom level is not safe to use as an index into a resolutions array).
|
||||
* @return {number|undefined} Zoom.
|
||||
* @api stable
|
||||
* @api
|
||||
*/
|
||||
getZoom(): (number);
|
||||
getZoom(): number;
|
||||
|
||||
/**
|
||||
* Get the zoom level for a resolution.
|
||||
* @param {number} resolution The resolution.
|
||||
* @return {number|undefined} The zoom level for the provided resolution.
|
||||
* @api
|
||||
*/
|
||||
getZoomForResolution(resolution: number): number;
|
||||
|
||||
/**
|
||||
* Get the resolution for a zoom level.
|
||||
* @param {number} zoom Zoom level.
|
||||
* @return {number} The view resolution for the provided zoom level.
|
||||
* @api
|
||||
*/
|
||||
getResolutionForZoom(zoom: number): number;
|
||||
|
||||
/**
|
||||
* Fit the given geometry or extent based on the given map size and border.
|
||||
@@ -12452,7 +12536,7 @@ declare module ol {
|
||||
* @param {olx.view.FitOptions=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
fit(geometry: (ol.geom.SimpleGeometry | ol.Extent), opt_options?: olx.view.FitOptions): void;
|
||||
fit(geometryOrExtent: (ol.geom.SimpleGeometry | ol.Extent), opt_options?: olx.view.FitOptions): void;
|
||||
|
||||
/**
|
||||
* Center on coordinate and view position.
|
||||
@@ -12477,7 +12561,7 @@ declare module ol {
|
||||
* @observable
|
||||
* @api stable
|
||||
*/
|
||||
setCenter(center: (ol.Coordinate)): void;
|
||||
setCenter(center: ol.Coordinate): void;
|
||||
|
||||
/**
|
||||
* Set the resolution for this view.
|
||||
@@ -12485,7 +12569,7 @@ declare module ol {
|
||||
* @observable
|
||||
* @api stable
|
||||
*/
|
||||
setResolution(resolution: (number)): void;
|
||||
setResolution(resolution?: number): void;
|
||||
|
||||
/**
|
||||
* Set the rotation for this view.
|
||||
@@ -12495,20 +12579,6 @@ declare module ol {
|
||||
*/
|
||||
setRotation(rotation: number): void;
|
||||
|
||||
/**
|
||||
* Set a new maximum zoom level for the view.
|
||||
* @param {number} zoom The maximum zoom level.
|
||||
* @api stable
|
||||
*/
|
||||
setMaxZoom(zoom: number): void;
|
||||
|
||||
/**
|
||||
* Set a new minimum zoom level for the view.
|
||||
* @param {number} zoom The minimum zoom level.
|
||||
* @api stable
|
||||
*/
|
||||
setMinZoom(zoom: number): void;
|
||||
|
||||
/**
|
||||
* Zoom to a specific zoom level.
|
||||
* @param {number} zoom Zoom level.
|
||||
@@ -12516,15 +12586,6 @@ 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<olx.animation.AnimateOptions | olx.animation.AnimateCallback>): void;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12607,7 +12668,7 @@ declare module olx {
|
||||
zoom?: number | undefined;
|
||||
resolution?: number | undefined;
|
||||
rotation?: number | undefined;
|
||||
anchor?: number | undefined;
|
||||
anchor?: ol.Coordinate | undefined;
|
||||
duration?: number | undefined;
|
||||
easing?: ((t: number) => number) | undefined;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ let mapBrowserEvent: ol.MapBrowserEvent;
|
||||
let multiLineString: ol.geom.MultiLineString;
|
||||
let multiPoint: ol.geom.MultiPoint;
|
||||
let multiPolygon: ol.geom.MultiPolygon;
|
||||
let pixel: ol.Pixel;
|
||||
let point: ol.geom.Point;
|
||||
let polygon: ol.geom.Polygon;
|
||||
let projection: ol.proj.Projection;
|
||||
@@ -392,17 +393,97 @@ voidValue = feature.setProperties(object);
|
||||
// ol.View
|
||||
//
|
||||
|
||||
let view: ol.View = new ol.View({
|
||||
center: [0, 0],
|
||||
let view: ol.View;
|
||||
view = new ol.View();
|
||||
view = new ol.View({});
|
||||
view = new ol.View({
|
||||
center: coordinate,
|
||||
constrainRotation: numberValue,
|
||||
enableRotation: booleanValue,
|
||||
extent: extent,
|
||||
maxResolution: numberValue,
|
||||
minResolution: numberValue,
|
||||
maxZoom: numberValue,
|
||||
minZoom: numberValue,
|
||||
projection: projectionLike,
|
||||
resolution: numberValue,
|
||||
resolutions: [numberValue, numberValue, numberValue, numberValue, numberValue],
|
||||
rotation: numberValue,
|
||||
zoom: numberValue,
|
||||
zoomFactor: numberValue,
|
||||
});
|
||||
view = new ol.View({
|
||||
constrainRotation: booleanValue,
|
||||
});
|
||||
|
||||
voidValue = view.setMaxZoom(numberValue);
|
||||
voidValue = view.setMinZoom(numberValue);
|
||||
voidValue = view.animate();
|
||||
voidValue = view.animate({});
|
||||
voidValue = view.animate({zoom: view.getZoom() + 1});
|
||||
voidValue = view.animate({zoom: 10}, {center: [0, 0]});
|
||||
voidValue = view.animate({
|
||||
center: coordinate,
|
||||
zoom: numberValue,
|
||||
resolution: numberValue,
|
||||
rotation: numberValue,
|
||||
anchor: coordinate,
|
||||
duration: numberValue,
|
||||
easing: easingFunction,
|
||||
});
|
||||
extent = view.calculateExtent();
|
||||
extent = view.calculateExtent(size);
|
||||
voidValue = view.cancelAnimations();
|
||||
voidValue = view.centerOn(coordinate, size, pixel);
|
||||
coordinate = view.constrainCenter();
|
||||
coordinate = view.constrainCenter(coordinate);
|
||||
numberValue = view.constrainResolution();
|
||||
numberValue = view.constrainResolution(numberValue);
|
||||
numberValue = view.constrainResolution(numberValue, numberValue);
|
||||
numberValue = view.constrainResolution(numberValue, numberValue, numberValue);
|
||||
numberValue = view.constrainRotation();
|
||||
numberValue = view.constrainRotation(numberValue);
|
||||
numberValue = view.constrainRotation(numberValue, numberValue);
|
||||
voidValue = view.fit(simpleGeometry);
|
||||
voidValue = view.fit(simpleGeometry, {});
|
||||
voidValue = view.fit(extent);
|
||||
voidValue = view.fit(extent, {});
|
||||
voidValue = view.fit(extent, {callback: () => {}});
|
||||
voidValue = view.fit(extent, {callback: (animationCompleted: boolean) => {}});
|
||||
voidValue = view.fit(extent, {
|
||||
size: size,
|
||||
padding: [numberValue, numberValue, numberValue, numberValue],
|
||||
constrainResolution: booleanValue,
|
||||
nearest: booleanValue,
|
||||
minResolution: numberValue,
|
||||
maxZoom: numberValue,
|
||||
duration: numberValue,
|
||||
easing: easingFunction,
|
||||
callback: (animationCompleted: boolean) => {}
|
||||
});
|
||||
booleanValue = view.getAnimating();
|
||||
coordinate = view.getCenter();
|
||||
booleanValue = view.getInteracting();
|
||||
numberValue = view.getMaxResolution();
|
||||
numberValue = view.getMaxZoom();
|
||||
numberValue = view.getMinResolution();
|
||||
numberValue = view.getMinZoom();
|
||||
projection = view.getProjection();
|
||||
numberValue = view.getResolution();
|
||||
numberValue = view.getResolutionForExtent(extent);
|
||||
numberValue = view.getResolutionForExtent(extent, size);
|
||||
numberValue = view.getResolutionForZoom(numberValue);
|
||||
[numberValue, numberValue, numberValue, numberValue, numberValue] = view.getResolutions();
|
||||
numberValue = view.getRotation();
|
||||
numberValue = view.getZoom();
|
||||
numberValue = view.getZoomForResolution(numberValue);
|
||||
voidValue = view.rotate(numberValue);
|
||||
voidValue = view.rotate(numberValue, coordinate);
|
||||
voidValue = view.setCenter(coordinate);
|
||||
voidValue = view.setMaxZoom(numberValue);
|
||||
voidValue = view.setMinZoom(numberValue);
|
||||
voidValue = view.setResolution();
|
||||
voidValue = view.setResolution(numberValue);
|
||||
voidValue = view.setRotation(numberValue);
|
||||
voidValue = view.setZoom(numberValue);
|
||||
|
||||
//
|
||||
// ol.layer.Base
|
||||
@@ -468,6 +549,7 @@ let vectorTileLayer: ol.layer.VectorTile = new ol.layer.VectorTile({
|
||||
zIndex: 2
|
||||
});
|
||||
|
||||
|
||||
//
|
||||
// ol.Object
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user