diff --git a/examples/mm.html b/examples/mm.html deleted file mode 100644 index 2fd524dbbe..0000000000 --- a/examples/mm.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - MultiMap - - - - - - - - - - - - - -

MultiMap Example

-
- MultiMap, basic, cleanup -
-

- An example of using the Layer.MultiMap class. -

-
-
click to add the marker to the map
-
click to remove the marker from the map
- - diff --git a/examples/multimap-mercator.html b/examples/multimap-mercator.html deleted file mode 100644 index 48b2dd9ec2..0000000000 --- a/examples/multimap-mercator.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - MultiMap SphericalMercator - - - - - - - - - - - - - -

MultiMap Mercator Example

-
- MultiMap, basic, cleanup -
-

- This sphericalMercator example using multimap demonstrates that the - multimap layer does not fully support the sphericalMercator projection at - this time. -

-
- - diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js index dfb6160dba..bec7c34b22 100644 --- a/lib/OpenLayers.js +++ b/lib/OpenLayers.js @@ -136,7 +136,6 @@ "OpenLayers/Layer/MapServer.js", "OpenLayers/Layer/KaMap.js", "OpenLayers/Layer/KaMapCache.js", - "OpenLayers/Layer/MultiMap.js", "OpenLayers/Layer/Markers.js", "OpenLayers/Layer/Text.js", "OpenLayers/Layer/WorldWind.js", diff --git a/lib/OpenLayers/Layer/MultiMap.js b/lib/OpenLayers/Layer/MultiMap.js deleted file mode 100644 index 3052b829b3..0000000000 --- a/lib/OpenLayers/Layer/MultiMap.js +++ /dev/null @@ -1,286 +0,0 @@ -/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for - * full list of contributors). Published under the Clear BSD license. - * See http://svn.openlayers.org/trunk/openlayers/license.txt for the - * full text of the license. */ - -/** - * @requires OpenLayers/Layer/EventPane.js - * @requires OpenLayers/Layer/FixedZoomLevels.js - * @requires OpenLayers/Lang.js - */ - -/** - * Class: OpenLayers.Layer.MultiMap - * Note that MultiMap does not fully support the sphericalMercator - * option. See Ticket #953 for more details. - * *Deprecated*. Use OpenLayers.Layer.Bing instead. See #3063 - * - * Inherits from: - * - - * - - */ -OpenLayers.Layer.MultiMap = OpenLayers.Class( - OpenLayers.Layer.EventPane, OpenLayers.Layer.FixedZoomLevels, { - - /** - * Constant: MIN_ZOOM_LEVEL - * {Integer} 1 - */ - MIN_ZOOM_LEVEL: 1, - - /** - * Constant: MAX_ZOOM_LEVEL - * {Integer} 17 - */ - MAX_ZOOM_LEVEL: 17, - - /** - * Constant: RESOLUTIONS - * {Array(Float)} Hardcode these resolutions so that they are more closely - * tied with the standard wms projection - */ - RESOLUTIONS: [ - 9, - 1.40625, - 0.703125, - 0.3515625, - 0.17578125, - 0.087890625, - 0.0439453125, - 0.02197265625, - 0.010986328125, - 0.0054931640625, - 0.00274658203125, - 0.001373291015625, - 0.0006866455078125, - 0.00034332275390625, - 0.000171661376953125, - 0.0000858306884765625, - 0.00004291534423828125 - ], - - /** - * APIProperty: type - * {?} - */ - type: null, - - /** - * Constructor: OpenLayers.Layer.MultiMap - * - * Parameters: - * name - {String} - * options - {Object} - */ - initialize: function(name, options) { - OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments); - OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this, - arguments); - if (this.sphericalMercator) { - OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator); - this.initMercatorParameters(); - this.RESOLUTIONS.unshift(10); - } - }, - - /** - * Method: loadMapObject - */ - loadMapObject:function() { - try { //crash proofing - this.mapObject = new MultimapViewer(this.div); - } catch (e) { } - }, - - /** - * APIMethod: getWarningHTML - * - * Returns: - * {String} String with information on why layer is broken, how to get - * it working. - */ - getWarningHTML:function() { - return OpenLayers.i18n( - "getLayerWarning", {'layerType':"MM", 'layerLib':"MultiMap"} - ); - }, - - - - /************************************ - * * - * MapObject Interface Controls * - * * - ************************************/ - - - // Get&Set Center, Zoom - - /** - * APIMethod: setMapObjectCenter - * Set the mapObject to the specified center and zoom - * - * Parameters: - * center - {Object} MapObject LonLat format - * zoom - {int} MapObject zoom format - */ - setMapObjectCenter: function(center, zoom) { - this.mapObject.goToPosition(center, zoom); - }, - - /** - * APIMethod: getMapObjectCenter - * - * Returns: - * {Object} The mapObject's current center in Map Object format - */ - getMapObjectCenter: function() { - return this.mapObject.getCurrentPosition(); - }, - - /** - * APIMethod: getMapObjectZoom - * - * Returns: - * {Integer} The mapObject's current zoom, in Map Object format - */ - getMapObjectZoom: function() { - return this.mapObject.getZoomFactor(); - }, - - - // LonLat - Pixel Translation - - /** - * APIMethod: getMapObjectLonLatFromMapObjectPixel - * - * Parameters: - * moPixel - {Object} MapObject Pixel format - * - * Returns: - * {Object} MapObject LonLat translated from MapObject Pixel - */ - getMapObjectLonLatFromMapObjectPixel: function(moPixel) { - moPixel.x = moPixel.x - (this.map.getSize().w/2); - moPixel.y = moPixel.y - (this.map.getSize().h/2); - return this.mapObject.getMapPositionAt(moPixel); - }, - - /** - * APIMethod: getMapObjectPixelFromMapObjectLonLat - * - * Parameters: - * moLonLat - {Object} MapObject LonLat format - * - * Returns: - * {Object} MapObject Pixel transtlated from MapObject LonLat - */ - getMapObjectPixelFromMapObjectLonLat: function(moLonLat) { - return this.mapObject.geoPosToContainerPixels(moLonLat); - }, - - - /************************************ - * * - * MapObject Primitives * - * * - ************************************/ - - - // LonLat - - /** - * APIMethod: getLongitudeFromMapObjectLonLat - * - * Parameters: - * moLonLat - {Object} MapObject LonLat format - * - * Returns: - * {Float} Longitude of the given MapObject LonLat - */ - getLongitudeFromMapObjectLonLat: function(moLonLat) { - return this.sphericalMercator ? - this.forwardMercator(moLonLat.lon, moLonLat.lat).lon : - moLonLat.lon; - }, - - /** - * APIMethod: getLatitudeFromMapObjectLonLat - * - * Parameters: - * moLonLat - {Object} MapObject LonLat format - * - * Returns: - * {Float} Latitude of the given MapObject LonLat - */ - getLatitudeFromMapObjectLonLat: function(moLonLat) { - return this.sphericalMercator ? - this.forwardMercator(moLonLat.lon, moLonLat.lat).lat : - moLonLat.lat; - }, - - /** - * APIMethod: getMapObjectLonLatFromLonLat - * - * Parameters: - * lon - {Float} - * lat - {Float} - * - * Returns: - * {Object} MapObject LonLat built from lon and lat params - */ - getMapObjectLonLatFromLonLat: function(lon, lat) { - var mmLatLon; - if(this.sphericalMercator) { - var lonlat = this.inverseMercator(lon, lat); - mmLatLon = new MMLatLon(lonlat.lat, lonlat.lon); - } else { - mmLatLon = new MMLatLon(lat, lon); - } - return mmLatLon; - }, - - // Pixel - - /** - * APIMethod: getXFromMapObjectPixel - * - * Parameters: - * moPixel - {Object} MapObject Pixel format - * - * Returns: - * {Integer} X value of the MapObject Pixel - */ - getXFromMapObjectPixel: function(moPixel) { - return moPixel.x; - }, - - /** - * APIMethod: getYFromMapObjectPixel - * - * Parameters: - * moPixel - {Object} MapObject Pixel format - * - * Returns: - * {Integer} Y value of the MapObject Pixel - */ - getYFromMapObjectPixel: function(moPixel) { - return moPixel.y; - }, - - /** - * APIMethod: getMapObjectPixelFromXY - * - * Parameters: - * x - {Integer} - * y - {Integer} - * - * Returns: - * {Object} MapObject Pixel from x and y parameters - */ - getMapObjectPixelFromXY: function(x, y) { - return new MMPoint(x, y); - }, - - CLASS_NAME: "OpenLayers.Layer.MultiMap" -}); diff --git a/lib/deprecated.js b/lib/deprecated.js index bc101b8b99..dbba190603 100644 --- a/lib/deprecated.js +++ b/lib/deprecated.js @@ -13,6 +13,8 @@ * @requires OpenLayers/Console.js * @requires OpenLayers/Lang.js * @requires OpenLayers/Feature.js + * @requires OpenLayers/Layer/EventPane.js + * @requires OpenLayers/Layer/FixedZoomLevels.js */ /** @@ -2898,3 +2900,279 @@ OpenLayers.Layer.WFS = OpenLayers.Class( CLASS_NAME: "OpenLayers.Layer.WFS" }); + +/** + * Class: OpenLayers.Layer.MultiMap + * Note that MultiMap does not fully support the sphericalMercator + * option. See Ticket #953 for more details. + * *Deprecated*. Use OpenLayers.Layer.Bing instead. See #3063 + * + * Inherits from: + * - + * - + */ +OpenLayers.Layer.MultiMap = OpenLayers.Class( + OpenLayers.Layer.EventPane, OpenLayers.Layer.FixedZoomLevels, { + + /** + * Constant: MIN_ZOOM_LEVEL + * {Integer} 1 + */ + MIN_ZOOM_LEVEL: 1, + + /** + * Constant: MAX_ZOOM_LEVEL + * {Integer} 17 + */ + MAX_ZOOM_LEVEL: 17, + + /** + * Constant: RESOLUTIONS + * {Array(Float)} Hardcode these resolutions so that they are more closely + * tied with the standard wms projection + */ + RESOLUTIONS: [ + 9, + 1.40625, + 0.703125, + 0.3515625, + 0.17578125, + 0.087890625, + 0.0439453125, + 0.02197265625, + 0.010986328125, + 0.0054931640625, + 0.00274658203125, + 0.001373291015625, + 0.0006866455078125, + 0.00034332275390625, + 0.000171661376953125, + 0.0000858306884765625, + 0.00004291534423828125 + ], + + /** + * APIProperty: type + * {?} + */ + type: null, + + /** + * Constructor: OpenLayers.Layer.MultiMap + * + * Parameters: + * name - {String} + * options - {Object} + */ + initialize: function(name, options) { + OpenLayers.Layer.EventPane.prototype.initialize.apply(this, arguments); + OpenLayers.Layer.FixedZoomLevels.prototype.initialize.apply(this, + arguments); + if (this.sphericalMercator) { + OpenLayers.Util.extend(this, OpenLayers.Layer.SphericalMercator); + this.initMercatorParameters(); + this.RESOLUTIONS.unshift(10); + } + }, + + /** + * Method: loadMapObject + */ + loadMapObject:function() { + try { //crash proofing + this.mapObject = new MultimapViewer(this.div); + } catch (e) { } + }, + + /** + * APIMethod: getWarningHTML + * + * Returns: + * {String} String with information on why layer is broken, how to get + * it working. + */ + getWarningHTML:function() { + return OpenLayers.i18n( + "getLayerWarning", {'layerType':"MM", 'layerLib':"MultiMap"} + ); + }, + + + + /************************************ + * * + * MapObject Interface Controls * + * * + ************************************/ + + + // Get&Set Center, Zoom + + /** + * APIMethod: setMapObjectCenter + * Set the mapObject to the specified center and zoom + * + * Parameters: + * center - {Object} MapObject LonLat format + * zoom - {int} MapObject zoom format + */ + setMapObjectCenter: function(center, zoom) { + this.mapObject.goToPosition(center, zoom); + }, + + /** + * APIMethod: getMapObjectCenter + * + * Returns: + * {Object} The mapObject's current center in Map Object format + */ + getMapObjectCenter: function() { + return this.mapObject.getCurrentPosition(); + }, + + /** + * APIMethod: getMapObjectZoom + * + * Returns: + * {Integer} The mapObject's current zoom, in Map Object format + */ + getMapObjectZoom: function() { + return this.mapObject.getZoomFactor(); + }, + + + // LonLat - Pixel Translation + + /** + * APIMethod: getMapObjectLonLatFromMapObjectPixel + * + * Parameters: + * moPixel - {Object} MapObject Pixel format + * + * Returns: + * {Object} MapObject LonLat translated from MapObject Pixel + */ + getMapObjectLonLatFromMapObjectPixel: function(moPixel) { + moPixel.x = moPixel.x - (this.map.getSize().w/2); + moPixel.y = moPixel.y - (this.map.getSize().h/2); + return this.mapObject.getMapPositionAt(moPixel); + }, + + /** + * APIMethod: getMapObjectPixelFromMapObjectLonLat + * + * Parameters: + * moLonLat - {Object} MapObject LonLat format + * + * Returns: + * {Object} MapObject Pixel transtlated from MapObject LonLat + */ + getMapObjectPixelFromMapObjectLonLat: function(moLonLat) { + return this.mapObject.geoPosToContainerPixels(moLonLat); + }, + + + /************************************ + * * + * MapObject Primitives * + * * + ************************************/ + + + // LonLat + + /** + * APIMethod: getLongitudeFromMapObjectLonLat + * + * Parameters: + * moLonLat - {Object} MapObject LonLat format + * + * Returns: + * {Float} Longitude of the given MapObject LonLat + */ + getLongitudeFromMapObjectLonLat: function(moLonLat) { + return this.sphericalMercator ? + this.forwardMercator(moLonLat.lon, moLonLat.lat).lon : + moLonLat.lon; + }, + + /** + * APIMethod: getLatitudeFromMapObjectLonLat + * + * Parameters: + * moLonLat - {Object} MapObject LonLat format + * + * Returns: + * {Float} Latitude of the given MapObject LonLat + */ + getLatitudeFromMapObjectLonLat: function(moLonLat) { + return this.sphericalMercator ? + this.forwardMercator(moLonLat.lon, moLonLat.lat).lat : + moLonLat.lat; + }, + + /** + * APIMethod: getMapObjectLonLatFromLonLat + * + * Parameters: + * lon - {Float} + * lat - {Float} + * + * Returns: + * {Object} MapObject LonLat built from lon and lat params + */ + getMapObjectLonLatFromLonLat: function(lon, lat) { + var mmLatLon; + if(this.sphericalMercator) { + var lonlat = this.inverseMercator(lon, lat); + mmLatLon = new MMLatLon(lonlat.lat, lonlat.lon); + } else { + mmLatLon = new MMLatLon(lat, lon); + } + return mmLatLon; + }, + + // Pixel + + /** + * APIMethod: getXFromMapObjectPixel + * + * Parameters: + * moPixel - {Object} MapObject Pixel format + * + * Returns: + * {Integer} X value of the MapObject Pixel + */ + getXFromMapObjectPixel: function(moPixel) { + return moPixel.x; + }, + + /** + * APIMethod: getYFromMapObjectPixel + * + * Parameters: + * moPixel - {Object} MapObject Pixel format + * + * Returns: + * {Integer} Y value of the MapObject Pixel + */ + getYFromMapObjectPixel: function(moPixel) { + return moPixel.y; + }, + + /** + * APIMethod: getMapObjectPixelFromXY + * + * Parameters: + * x - {Integer} + * y - {Integer} + * + * Returns: + * {Object} MapObject Pixel from x and y parameters + */ + getMapObjectPixelFromXY: function(x, y) { + return new MMPoint(x, y); + }, + + CLASS_NAME: "OpenLayers.Layer.MultiMap" +}); diff --git a/tests/Layer/MultiMap.html b/tests/deprecated/Layer/MultiMap.html similarity index 97% rename from tests/Layer/MultiMap.html rename to tests/deprecated/Layer/MultiMap.html index 8ae07d2adc..1ab3234565 100644 --- a/tests/Layer/MultiMap.html +++ b/tests/deprecated/Layer/MultiMap.html @@ -2,7 +2,8 @@ - + +