mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Add tests and fix a few definitions.
This commit is contained in:
58
types/openlayers/index.d.ts
vendored
58
types/openlayers/index.d.ts
vendored
@@ -12379,7 +12379,7 @@ declare module ol {
|
||||
* @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.
|
||||
@@ -12389,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.
|
||||
@@ -12398,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.
|
||||
@@ -12433,33 +12433,33 @@ declare module ol {
|
||||
*/
|
||||
getMinResolution(): number;
|
||||
|
||||
/**
|
||||
* Get the maximum zoom level for the view.
|
||||
* @return {number} The maximum zoom level.
|
||||
* @api
|
||||
*/
|
||||
getMaxZoom(): 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;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* 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.
|
||||
@@ -12569,7 +12569,7 @@ declare module ol {
|
||||
* @observable
|
||||
* @api stable
|
||||
*/
|
||||
setResolution(resolution: number): void;
|
||||
setResolution(resolution?: number): void;
|
||||
|
||||
/**
|
||||
* Set the rotation for this view.
|
||||
@@ -12668,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