diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index ec180bf45d..486a488724 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -211,6 +211,30 @@ declare namespace olx { /** experimental Whether to wrap the world horizontally. When set to false, only one world will be rendered. When true, tiles will be requested for one world only, but they will be wrapped horizontally to render multiple worlds. The default is true. */ wrapX?: boolean; } + interface OSMOptions { + /** Attributions */ + attributions?: ol.AttributionLike; + /** Cache size. Default is 2048. */ + cacheSize?: number; + /** + * The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL + * renderer or if you want to access pixel data with the Canvas renderer. + * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. Default is anonymous. + */ + crossOrigin?: string; + /** Max zoom. Default is 19. */ + maxZoom?: number; + /** Whether the layer is opaque. Default is true. */ + opaque?: boolean; + /** Maximum allowed reprojection error (in pixels). Default is 0.5. Higher values can increase reprojection performance, but decrease precision. */ + reprojectionErrorThreshold?: number; + /** Optional function to load a tile given a URL. */ + tileLoadFunction?: ol.TileLoadFunctionType; + /** URL template. Must include {x}, {y} or {-y}, and {z} placeholders. Default is https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png. */ + url?: string; + /** Whether to wrap the world horizontally. Default is true. */ + wrapX?: boolean; + } /** * Object literal with config options for the map logo. */ @@ -791,24 +815,24 @@ declare namespace olx { */ wrapX?: boolean; } - + interface ClusterOptions extends VectorOptions{ - + /** * Minimum distance in pixels between clusters. Default is 20. */ distance?: number; - + extent?: ol.Extent; - + geometryFunction?: any; - + projection?: ol.proj.ProjectionLike; - + source: ol.source.Vector; - + } - + interface WMTSOptions { attributions?: Array; crossOrigin?: string; @@ -1127,6 +1151,8 @@ declare namespace ol { interface ImageLoadFunctionType { (image: ol.Image, url: string): void } + type AttributionLike = string | Array | ol.Attribution | Array + /** * An attribution for a layer source. */ @@ -2422,9 +2448,9 @@ declare namespace ol { * @returns Control.s */ function defaults(options?: olx.control.DefaultsOptions): ol.Collection; - + namespace ScaleLine { - + /** * Units for the scale line. Supported values are 'degrees', 'imperial', 'nautical', 'metric', 'us'. */ @@ -2433,29 +2459,29 @@ declare namespace ol { class Control extends ol.Object{ constructor(options: olx.control.ControlOptions); - + /** * Get the map associated with this control. */ getMap():ol.Map; - + /** - * Remove the control from its current map and attach it to the new map. + * Remove the control from its current map and attach it to the new map. * Subclasses may set up event handlers to get notified about changes to the map here. */ setMap(map: ol.Map):void; - + /** - * This function is used to set a target element for the control. - * It has no effect if it is called after the control has been added to the map (i.e. after setMap is called on the control). + * This function is used to set a target element for the control. + * It has no effect if it is called after the control has been added to the map (i.e. after setMap is called on the control). * If no target is set in the options passed to the control constructor and if setTarget is not called then the control is * added to the map's overlay container. */ setTarget(target: Element | string):void; - - + + } - + class Attribution extends Control { } @@ -2472,17 +2498,17 @@ declare namespace ol { } class ScaleLine extends Control { - + /** * Return the units to use in the scale line. */ getUnits(): ScaleLine.Units; - + /** * Set the units to use in the scale line. */ setUnits(units: ScaleLine.Units): void; - + } class Zoom extends Control{ @@ -4061,7 +4087,7 @@ declare namespace ol { * @argument map. */ setMap(map: ol.Map): void; - + /** * Set Z-index of the layer, which is used to order layers before rendering. The default Z-index is 0. */ @@ -4254,12 +4280,13 @@ declare namespace ol { } class OSM extends XYZ { + constructor(opt_options?: olx.OSMOptions); } class Source extends ol.Object { - + constructor(options: any); - + /** * Get the projection of the source. * @return Projection.