1
/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
2
* full list of contributors). Published under the Clear BSD license.
3
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
4
* full text of the license. */
7
* @requires OpenLayers/Layer/EventPane.js
8
* @requires OpenLayers/Layer/FixedZoomLevels.js
9
* @requires OpenLayers/Lang.js
13
* Class: OpenLayers.Layer.MultiMap
14
* Note that MultiMap does not fully support the sphericalMercator
15
* option. See Ticket #953 for more details.
16
* *Deprecated*. Use OpenLayers.Layer.Bing instead. See #3063
19
* - <OpenLayers.Layer.EventPane>
20
* - <OpenLayers.Layer.FixedZoomLevels>
22
OpenLayers.Layer.MultiMap = OpenLayers.Class(
23
OpenLayers.Layer.EventPane, OpenLayers.Layer.FixedZoomLevels, {
26
* Constant: MIN_ZOOM_LEVEL
32
* Constant: MAX_ZOOM_LEVEL
38
* Constant: RESOLUTIONS
39
* {Array(Float)} Hardcode these resolutions so that they are more closely
40
* tied with the standard wms projection
58
0.0000858306884765625,
59
0.00004291534423828125
69
* Constructor: OpenLayers.Layer.MultiMap
75
initialize: function(name, options) {
76
OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments);
77
OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this,
79
if (this.sphericalMercator) {
80
OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator);
81
this.initMercatorParameters();
82
this.RESOLUTIONS.unshift(10);
87
* Method: loadMapObject
89
loadMapObject:function() {
90
try { //crash proofing
91
this.mapObject = new MultimapViewer(this.div);
96
* APIMethod: getWarningHTML
99
* {String} String with information on why layer is broken, how to get
102
getWarningHTML:function() {
103
return OpenLayers.i18n(
104
"getLayerWarning", {'layerType':"MM", 'layerLib':"MultiMap"}
110
/************************************
112
* MapObject Interface Controls *
114
************************************/
117
// Get&Set Center, Zoom
120
* APIMethod: setMapObjectCenter
121
* Set the mapObject to the specified center and zoom
124
* center - {Object} MapObject LonLat format
125
* zoom - {int} MapObject zoom format
127
setMapObjectCenter: function(center, zoom) {
128
this.mapObject.goToPosition(center, zoom);
132
* APIMethod: getMapObjectCenter
135
* {Object} The mapObject's current center in Map Object format
137
getMapObjectCenter: function() {
138
return this.mapObject.getCurrentPosition();
142
* APIMethod: getMapObjectZoom
145
* {Integer} The mapObject's current zoom, in Map Object format
147
getMapObjectZoom: function() {
148
return this.mapObject.getZoomFactor();
152
// LonLat - Pixel Translation
155
* APIMethod: getMapObjectLonLatFromMapObjectPixel
158
* moPixel - {Object} MapObject Pixel format
161
* {Object} MapObject LonLat translated from MapObject Pixel
163
getMapObjectLonLatFromMapObjectPixel: function(moPixel) {
164
moPixel.x = moPixel.x - (this.map.getSize().w/2);
165
moPixel.y = moPixel.y - (this.map.getSize().h/2);
166
return this.mapObject.getMapPositionAt(moPixel);
170
* APIMethod: getMapObjectPixelFromMapObjectLonLat
173
* moLonLat - {Object} MapObject LonLat format
176
* {Object} MapObject Pixel transtlated from MapObject LonLat
178
getMapObjectPixelFromMapObjectLonLat: function(moLonLat) {
179
return this.mapObject.geoPosToContainerPixels(moLonLat);
183
/************************************
185
* MapObject Primitives *
187
************************************/
193
* APIMethod: getLongitudeFromMapObjectLonLat
196
* moLonLat - {Object} MapObject LonLat format
199
* {Float} Longitude of the given MapObject LonLat
201
getLongitudeFromMapObjectLonLat: function(moLonLat) {
202
return this.sphericalMercator ?
203
this.forwardMercator(moLonLat.lon, moLonLat.lat).lon :
208
* APIMethod: getLatitudeFromMapObjectLonLat
211
* moLonLat - {Object} MapObject LonLat format
214
* {Float} Latitude of the given MapObject LonLat
216
getLatitudeFromMapObjectLonLat: function(moLonLat) {
217
return this.sphericalMercator ?
218
this.forwardMercator(moLonLat.lon, moLonLat.lat).lat :
223
* APIMethod: getMapObjectLonLatFromLonLat
230
* {Object} MapObject LonLat built from lon and lat params
232
getMapObjectLonLatFromLonLat: function(lon, lat) {
234
if(this.sphericalMercator) {
235
var lonlat = this.inverseMercator(lon, lat);
236
mmLatLon = new MMLatLon(lonlat.lat, lonlat.lon);
238
mmLatLon = new MMLatLon(lat, lon);
246
* APIMethod: getXFromMapObjectPixel
249
* moPixel - {Object} MapObject Pixel format
252
* {Integer} X value of the MapObject Pixel
254
getXFromMapObjectPixel: function(moPixel) {
259
* APIMethod: getYFromMapObjectPixel
262
* moPixel - {Object} MapObject Pixel format
265
* {Integer} Y value of the MapObject Pixel
267
getYFromMapObjectPixel: function(moPixel) {
272
* APIMethod: getMapObjectPixelFromXY
279
* {Object} MapObject Pixel from x and y parameters
281
getMapObjectPixelFromXY: function(x, y) {
282
return new MMPoint(x, y);
285
CLASS_NAME: "OpenLayers.Layer.MultiMap"