From fdbda06ff0fde765f97c9b5e7e9a403f6e21ac61 Mon Sep 17 00:00:00 2001 From: Chris Rowe Date: Tue, 30 Aug 2016 14:39:25 +0100 Subject: [PATCH 1/4] openlayers: Added Cluster constructor options, Layer.setZIndex function and Source constructor --- openlayers/openlayers.d.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index a70f3b115b..5c4f977f1b 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -791,6 +791,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; @@ -4008,6 +4026,11 @@ 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. + */ + setZIndex(zIndex: number): void; } } @@ -4162,6 +4185,7 @@ declare namespace ol { } class Cluster extends Vector { + constructor(options: olx.source.ClusterOptions); } class Image extends Source { @@ -4198,6 +4222,9 @@ declare namespace ol { } class Source extends ol.Object { + + constructor(options: any); + /** * Get the projection of the source. * @return Projection. From a8352c713f46ed4671036c7d74c5c3a80bd409e1 Mon Sep 17 00:00:00 2001 From: Chris Rowe Date: Tue, 30 Aug 2016 16:15:37 +0100 Subject: [PATCH 2/4] Adding correct function definition for DrawGeometryFunctionType so that it takes an array of Coordinates --- openlayers/openlayers.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 5c4f977f1b..456ef54063 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -3685,7 +3685,7 @@ declare namespace ol { } function defaults(opts: olx.interaction.DefaultsOptions): ol.Collection; - interface DrawGeometryFunctionType { (coordinates: ol.Coordinate, geom?: ol.geom.Geometry): ol.geom.Geometry; } + interface DrawGeometryFunctionType { (coordinates: ol.Coordinate[], geom?: ol.geom.Geometry): ol.geom.Geometry; } interface SelectFilterFunction { (feature: ol.Feature | ol.render.Feature, layer: ol.layer.Layer): boolean; } } From 221f10c7f7587165c71aefc141fe5aae56bd650a Mon Sep 17 00:00:00 2001 From: Chris Rowe Date: Wed, 31 Aug 2016 10:42:40 +0100 Subject: [PATCH 3/4] openlayers: ScaleLine and Control type definitions --- openlayers/openlayers.d.ts | 67 +++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 16 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 456ef54063..2468a47211 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -2422,41 +2422,76 @@ declare namespace ol { * @returns Control.s */ function defaults(options?: olx.control.DefaultsOptions): ol.Collection; - - /** - * Units for the scale line. Supported values are 'degrees', 'imperial', 'nautical', 'metric', 'us'. - */ - interface ScaleLineUnits extends String { } - - class Attribution { + + namespace ScaleLine { + + /** + * Units for the scale line. Supported values are 'degrees', 'imperial', 'nautical', 'metric', 'us'. + */ + type Units = 'degrees' | 'imperial' | 'nautical' | 'metric' | 'us'; } - class Control { + 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. + * 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). + * 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) + + + } + + class Attribution extends Control { } - class FullScreen { + class FullScreen extends Control { } - class MousePosition { + class MousePosition extends Control { } - class OverviewMap { + class OverviewMap extends Control { } - class Rotate { + class Rotate extends Control { } - class ScaleLine { + 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 { + class Zoom extends Control{ } - class ZoomSlider { + class ZoomSlider extends Control{ } - class ZoomToExtent { + class ZoomToExtent extends Control{ constructor(options?: olx.ZoomToExtentOptions); } } From 2f8791fc63ca3bf6e8a76428431ed4d298c292ec Mon Sep 17 00:00:00 2001 From: Chris Rowe Date: Wed, 31 Aug 2016 10:47:10 +0100 Subject: [PATCH 4/4] openlayers: add return type to Control.setTarget --- openlayers/openlayers.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 2468a47211..ec180bf45d 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -2451,7 +2451,7 @@ declare namespace ol { * 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) + setTarget(target: Element | string):void; }