From 7958e02bd038a1702fb043699fced025731f5367 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 19 Jun 2012 12:43:54 +0200 Subject: [PATCH] Add map user projection getter and setter. --- src/api/map.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/api/map.js b/src/api/map.js index 72390f61b6..31ed31f877 100644 --- a/src/api/map.js +++ b/src/api/map.js @@ -4,6 +4,7 @@ goog.require('ol.Loc'); goog.require('ol.Map'); goog.require('ol.Projection'); goog.require('ol.loc'); +goog.require('ol.projection'); /** @@ -58,3 +59,27 @@ ol.Map.prototype.center = function(opt_arg) { return this.getCenter(); } }; + +/** + * @param {ol.ProjectionLike=} opt_arg + * @returns {ol.Map|ol.Loc|undefined} + */ +ol.Map.prototype.projection = function(opt_arg) { + if (arguments.length == 1 && goog.isDef(opt_arg)) { + return this.setProjection(ol.projection(opt_arg)); + } else { + return this.getProjection(); + } +}; + +/** + * @param {ol.ProjectionLike=} opt_arg + * @returns {ol.Map|ol.Loc|undefined} + */ +ol.Map.prototype.userProjection = function(opt_arg) { + if (arguments.length == 1 && goog.isDef(opt_arg)) { + return this.setUserProjection(ol.projection(opt_arg)); + } else { + return this.getUserProjection(); + } +};