From cf059e978ed6b66b32625ae9068dc55587119199 Mon Sep 17 00:00:00 2001 From: Christian Beilschmidt Date: Fri, 6 May 2016 10:34:08 +0200 Subject: [PATCH] add `setExtent` to ol.proj.Projection and make transform `ol.geom.Point` accept `ol.proj.Projection` (#9076) * make transform `ol.geom.Point` accept `ol.proj.Projection` * transform is described here: http://openlayers.org/en/v3.0.0/apidoc/ol.geom.Point.html#transform ** "Can be a string identifier or a ol.proj.Projection object." * add `setExtent` to ol.proj.Projection * setExtent is described here: http://openlayers.org/en/v3.0.0/apidoc/ol.proj.Projection.html#setExtent ** "Type `ol.Extent`" --- openlayers/openlayers-tests.ts | 2 ++ openlayers/openlayers.d.ts | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/openlayers/openlayers-tests.ts b/openlayers/openlayers-tests.ts index 3858720e23..a2152b11ad 100644 --- a/openlayers/openlayers-tests.ts +++ b/openlayers/openlayers-tests.ts @@ -136,6 +136,7 @@ coordinate = geometryResult.getClosestPoint(coordinate); geometryResult.getClosestPoint(coordinate, coordinate); extent = geometryResult.getExtent(); geometryResult.getExtent(extent); +geometryResult.transform(projection, projection); // // @@ -337,6 +338,7 @@ var tileLayer: ol.layer.Tile = new ol.layer.Tile({ projection = new ol.proj.Projection({ code:stringValue, }); +projection.setExtent(projection.getExtent()); // // ol.Map diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 244a8f83c9..d1ec613314 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -2936,7 +2936,7 @@ declare namespace ol { * @param destination The desired projection. Can be a string identifier or a ol.proj.Projection object. * @return This geometry. Note that original geometry is modified in place. */ - transform(source: ol.proj.ProjectionLike, destination: ol.proj.ProjectionLike): ol.geom.Geometry; + transform(source: ol.proj.ProjectionLike | ol.proj.Projection, destination: ol.proj.ProjectionLike | ol.proj.Projection): ol.geom.Geometry; } /** @@ -4054,6 +4054,12 @@ declare namespace ol { constructor(options: olx.Projection); getExtent(): Extent; + + /** + * Set the validity extent for this projection. + * @param extent The new extent of the projection. + */ + setExtent(extent: Extent): void; } }