run fromdos on ol/Map.js

This commit is contained in:
Éric Lemoine
2012-06-20 11:10:18 +02:00
parent 487e61884e
commit 27305925ff
+231 -232
View File
@@ -1,232 +1,231 @@
goog.provide('ol.Map'); goog.provide('ol.Map');
goog.require('ol.Loc'); goog.require('ol.Loc');
goog.require('ol.Projection'); goog.require('ol.Projection');
/** /**
* @constructor * @constructor
*/ */
ol.Map = function() { ol.Map = function() {
/** /**
* @private * @private
* @type {ol.Projection} * @type {ol.Projection}
*/ */
this.projection_ = null; this.projection_ = null;
/** /**
* @private * @private
* @type {ol.Projection} * @type {ol.Projection}
*/ */
this.userProjection_ = null; this.userProjection_ = null;
/** /**
* @private * @private
* @type {ol.Loc} * @type {ol.Loc}
*/ */
this.center_ = null; this.center_ = null;
/** /**
* @private * @private
* @type {number} * @type {number}
*/ */
this.zoom_ = undefined; this.zoom_ = undefined;
/** /**
* @private * @private
* @type {number} * @type {number}
*/ */
this.numZoomLevels_ = 22; this.numZoomLevels_ = 22;
/** /**
* @private * @private
* @type {Array|undefined} * @type {Array|undefined}
*/ */
this.resolutions_ = null; this.resolutions_ = null;
/** /**
* @private * @private
* @type {Array|undefined} * @type {Array|undefined}
*/ */
this.layers_ = null; this.layers_ = null;
}; };
/** /**
@const @const
@type {string} @type {string}
*/ */
ol.Map.prototype.DEFAULT_PROJECTION = "EPSG:3857"; ol.Map.prototype.DEFAULT_PROJECTION = "EPSG:3857";
/** /**
@const @const
@type {string} @type {string}
*/ */
ol.Map.prototype.DEFAULT_USER_PROJECTION = "EPSG:4326"; ol.Map.prototype.DEFAULT_USER_PROJECTION = "EPSG:4326";
/** /**
* @return {ol.Loc} Location. * @return {ol.Loc} Location.
*/ */
ol.Map.prototype.getCenter = function() { ol.Map.prototype.getCenter = function() {
return this.center_; return this.center_;
}; };
/** /**
* @return {!ol.Projection} Projection. * @return {!ol.Projection} Projection.
*/ */
ol.Map.prototype.getProjection = function() { ol.Map.prototype.getProjection = function() {
if (goog.isNull(this.projection_)) { if (goog.isNull(this.projection_)) {
this.projection_ = new ol.Projection(this.DEFAULT_PROJECTION); this.projection_ = new ol.Projection(this.DEFAULT_PROJECTION);
} }
return this.projection_; return this.projection_;
}; };
/** /**
* @return {!ol.Projection} User projection. * @return {!ol.Projection} User projection.
*/ */
ol.Map.prototype.getUserProjection = function() { ol.Map.prototype.getUserProjection = function() {
if (goog.isNull(this.userProjection_)) { if (goog.isNull(this.userProjection_)) {
this.userProjection_ = new ol.Projection(this.DEFAULT_USER_PROJECTION); this.userProjection_ = new ol.Projection(this.DEFAULT_USER_PROJECTION);
} }
return this.userProjection_; return this.userProjection_;
}; };
/** /**
* @return {number} Zoom. * @return {number} Zoom.
*/ */
ol.Map.prototype.getZoom = function() { ol.Map.prototype.getZoom = function() {
return this.zoom_; return this.zoom_;
}; };
/** /**
* @return {number} number of zoom levels. * @return {number} number of zoom levels.
*/ */
ol.Map.prototype.getNumZoomLevels = function() { ol.Map.prototype.getNumZoomLevels = function() {
return this.numZoomLevels_; return this.numZoomLevels_;
}; };
/** /**
* @return {Array|undefined} array of resolutions available for this map * @return {Array|undefined} array of resolutions available for this map
*/ */
ol.Map.prototype.getResolutions = function() { ol.Map.prototype.getResolutions = function() {
return this.resolutions_; return this.resolutions_;
}; };
/** /**
* @return {Array|undefined} array of layers available for this map * @return {Array|undefined} array of layers available for this map
*/ */
ol.Map.prototype.getLayers = function() { ol.Map.prototype.getLayers = function() {
return this.layers_; return this.layers_;
}; };
/** /**
* @return {ol.Bounds} the maxExtent for the map * @return {ol.Bounds} the maxExtent for the map
*/ */
ol.Map.prototype.getMaxExtent = function() { ol.Map.prototype.getMaxExtent = function() {
if (goog.isDefAndNotNull(this.maxExtent_)) { if (goog.isDefAndNotNull(this.maxExtent_)) {
return this.maxExtent_; return this.maxExtent_;
} else { } else {
var extent = this.getProjection().getExtent(); var extent = this.getProjection().getExtent();
if (goog.isDefAndNotNull(extent)) { if (goog.isDefAndNotNull(extent)) {
return extent; return extent;
} else { } else {
throw('maxExtent must be defined either in the map or the projection'); throw('maxExtent must be defined either in the map or the projection');
} }
} }
};
};
/**
/** * @param {ol.Loc} center Center.
* @param {ol.Loc} center Center. * @return {ol.Map} This.
* @return {ol.Map} This. */
*/ ol.Map.prototype.setCenter = function(center) {
ol.Map.prototype.setCenter = function(center) { this.center_ = center;
this.center_ = center; return this;
return this; };
};
/**
/** * @param {ol.Projection} projection Projection.
* @param {ol.Projection} projection Projection. * @return {ol.Map} This.
* @return {ol.Map} This. */
*/ ol.Map.prototype.setProjection = function(projection) {
ol.Map.prototype.setProjection = function(projection) { this.projection_ = projection;
this.projection_ = projection; return this;
return this; };
};
/**
/** * @param {ol.Projection} userProjection set the user projection.
* @param {ol.Projection} userProjection set the user projection. * @return {ol.Map} This.
* @return {ol.Map} This. */
*/ ol.Map.prototype.setUserProjection = function(userProjection) {
ol.Map.prototype.setUserProjection = function(userProjection) { this.userProjection_ = userProjection;
this.userProjection_ = userProjection; return this;
return this; };
};
/**
/** * @param {number} zoom Zoom.
* @param {number} zoom Zoom. * @return {ol.Map} This.
* @return {ol.Map} This. */
*/ ol.Map.prototype.setZoom = function(zoom) {
ol.Map.prototype.setZoom = function(zoom) { this.zoom_ = zoom;
this.zoom_ = zoom; return this;
return this; };
};
/**
/** * @param {number} nZoom Zoom.
* @param {number} nZoom Zoom. * @return {ol.Map} This.
* @return {ol.Map} This. */
*/ ol.Map.prototype.setNumZoomLevels = function(nZoom) {
ol.Map.prototype.setNumZoomLevels = function(nZoom) { this.numZoomLevels_ = nZoom;
this.numZoomLevels_ = nZoom; return this;
return this; };
};
/**
/** * @param {Array} resolutions the map resolutions if set on the map
* @param {Array} resolutions the map resolutions if set on the map * @return {ol.Map} This.
* @return {ol.Map} This. */
*/ ol.Map.prototype.setResolutions = function(resolutions) {
ol.Map.prototype.setResolutions = function(resolutions) { this.resolutions_ = resolutions;
this.resolutions_ = resolutions; return this;
return this; };
};
/**
/** * @param {Array} layers the layers set on the map
* @param {Array} layers the layers set on the map * @return {ol.Map} This.
* @return {ol.Map} This. */
*/ ol.Map.prototype.setLayers = function(layers) {
ol.Map.prototype.setLayers = function(layers) { this.layers_ = layers;
this.layers_ = layers; return this;
return this; };
};
/**
/** * @param {ol.Bounds} extent the maxExtent for the map
* @param {ol.Bounds} extent the maxExtent for the map * @return {ol.Map} This.
* @return {ol.Map} This. */
*/ ol.Map.prototype.setMaxExtent = function(extent) {
ol.Map.prototype.setMaxExtent = function(extent) { this.maxExtent_ = extent;
this.maxExtent_ = extent; return this;
return this; };
};
/**
/** */
*/ ol.Map.prototype.destroy = function() {
ol.Map.prototype.destroy = function() { //remove layers, etc.
//remove layers, etc. for (var key in this) {
for (var key in this) { delete this[key];
delete this[key]; }
} };
};