[OpenLayers-Commits] r12360 - in sandbox/camptocamp/clientzoom: .
apidoc_config doc_config examples lib lib/OpenLayers/Control
lib/OpenLayers/Handler lib/OpenLayers/Layer
lib/OpenLayers/Layer/Google lib/OpenLayers/Tile tests
tests/Control tests/Format/WMSCapabilities tests/Handler
tests/Layer tests/Tile tests/manual
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Tue Sep 13 08:08:41 EDT 2011
Author: erilem
Date: 2011-09-13 05:08:41 -0700 (Tue, 13 Sep 2011)
New Revision: 12360
Added:
sandbox/camptocamp/clientzoom/tests/manual/dateline-sketch.html
Removed:
sandbox/camptocamp/clientzoom/examples/google-ng.html
sandbox/camptocamp/clientzoom/examples/google-ng.js
sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/GoogleNG.js
sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/Google.js
sandbox/camptocamp/clientzoom/tests/Layer/GoogleNG.html
sandbox/camptocamp/clientzoom/tests/Tile/Google.html
Modified:
sandbox/camptocamp/clientzoom/
sandbox/camptocamp/clientzoom/apidoc_config/Menu.txt
sandbox/camptocamp/clientzoom/doc_config/Menu.txt
sandbox/camptocamp/clientzoom/examples/buffer.html
sandbox/camptocamp/clientzoom/examples/measure.html
sandbox/camptocamp/clientzoom/lib/OpenLayers.js
sandbox/camptocamp/clientzoom/lib/OpenLayers/Control/EditingToolbar.js
sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Path.js
sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Point.js
sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Polygon.js
sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/RegularPolygon.js
sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Google/v3.js
sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js
sandbox/camptocamp/clientzoom/tests/Control/EditingToolbar.html
sandbox/camptocamp/clientzoom/tests/Format/WMSCapabilities/v1_1_1.html
sandbox/camptocamp/clientzoom/tests/Handler/Path.html
sandbox/camptocamp/clientzoom/tests/Handler/Polygon.html
sandbox/camptocamp/clientzoom/tests/Handler/RegularPolygon.html
sandbox/camptocamp/clientzoom/tests/list-tests.html
Log:
svn merge -r12300:HEAD http://svn.openlayers.org/trunk/openlayers
Property changes on: sandbox/camptocamp/clientzoom
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/roberthl/openlayers:9745-9748
+ /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:12301-12359
Modified: sandbox/camptocamp/clientzoom/apidoc_config/Menu.txt
===================================================================
--- sandbox/camptocamp/clientzoom/apidoc_config/Menu.txt 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/apidoc_config/Menu.txt 2011-09-13 12:08:41 UTC (rev 12360)
@@ -352,7 +352,6 @@
File: GML (no auto-title, OpenLayers/Layer/GML.js)
File: Google (no auto-title, OpenLayers/Layer/Google.js)
File: Google.v3 (no auto-title, OpenLayers/Layer/Google/v3.js)
- File: GoogleNG (no auto-title, OpenLayers/Layer/GoogleNG.js)
File: Grid (no auto-title, OpenLayers/Layer/Grid.js)
File: HTTPRequest (no auto-title, OpenLayers/Layer/HTTPRequest.js)
File: Image (no auto-title, OpenLayers/Layer/Image.js)
@@ -475,7 +474,6 @@
Group: Tile {
File: Tile (no auto-title, OpenLayers/Tile.js)
- File: Google (no auto-title, OpenLayers/Tile/Google.js)
File: Image (no auto-title, OpenLayers/Tile/Image.js)
File: Image.IFrame (no auto-title, OpenLayers/Tile/Image/IFrame.js)
File: WFS (no auto-title, OpenLayers/Tile/WFS.js)
Modified: sandbox/camptocamp/clientzoom/doc_config/Menu.txt
===================================================================
--- sandbox/camptocamp/clientzoom/doc_config/Menu.txt 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/doc_config/Menu.txt 2011-09-13 12:08:41 UTC (rev 12360)
@@ -352,7 +352,6 @@
File: GML (no auto-title, OpenLayers/Layer/GML.js)
File: Google (no auto-title, OpenLayers/Layer/Google.js)
File: Google.v3 (no auto-title, OpenLayers/Layer/Google/v3.js)
- File: GoogleNG (no auto-title, OpenLayers/Layer/GoogleNG.js)
File: Grid (no auto-title, OpenLayers/Layer/Grid.js)
File: HTTPRequest (no auto-title, OpenLayers/Layer/HTTPRequest.js)
File: Image (no auto-title, OpenLayers/Layer/Image.js)
@@ -475,7 +474,6 @@
Group: Tile {
File: Tile (no auto-title, OpenLayers/Tile.js)
- File: Google (no auto-title, OpenLayers/Tile/Google.js)
File: Image (no auto-title, OpenLayers/Tile/Image.js)
File: Image.IFrame (no auto-title, OpenLayers/Tile/Image/IFrame.js)
File: WFS (no auto-title, OpenLayers/Tile/WFS.js)
Modified: sandbox/camptocamp/clientzoom/examples/buffer.html
===================================================================
--- sandbox/camptocamp/clientzoom/examples/buffer.html 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/examples/buffer.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -48,7 +48,7 @@
<div id="docs">
Use the buffer property to control how many tiles are included
- outside the visible map area. Default is 2.
+ outside the visible map area. Default is 0.
</div>
</body>
</html>
Deleted: sandbox/camptocamp/clientzoom/examples/google-ng.html
===================================================================
--- sandbox/camptocamp/clientzoom/examples/google-ng.html 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/examples/google-ng.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <title>OpenLayers Google NG Layer Example</title>
- <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
- <link rel="stylesheet" href="../theme/default/google.css" type="text/css">
- <link rel="stylesheet" href="style.css" type="text/css">
- <style type="text/css">
- .olControlAttribution {
- left: 2px;
- right: inherit;
- bottom: 3px;
- line-height: 11px;
- font-family: Arial, sans-serif;
- }
- </style>
- <script src="http://maps.google.com/maps/api/js?v=3.5&sensor=false"></script>
- <script src="../lib/OpenLayers.js"></script>
- <script src="google-ng.js"></script>
- </head>
- <body onload="init()">
- <h1 id="title">Google NG Layer Example</h1>
- <div id="tags">
- Google, api key, apikey
- </div>
- <p id="shortdesc">
- Demonstrate use of tiles from the Google Maps v3 API.
- </p>
- <div id="map" class="smallmap"></div>
- <div id="docs">
- <p>
- If you use OpenLayers.Layer.GoogleNG, the getTile method of the
- GMaps v3 API's MapType is used to load tiles. This allows for
- better integration than interacting with a whole map generated
- by a google.maps.Map instance, as done with
- OpenLayers.Layer.Google. See the
- <a href="google-ng.js" target="_blank">google-ng.js source</a>
- to see how this is done.
- </p>
- </div>
- </body>
-</html>
Deleted: sandbox/camptocamp/clientzoom/examples/google-ng.js
===================================================================
--- sandbox/camptocamp/clientzoom/examples/google-ng.js 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/examples/google-ng.js 2011-09-13 12:08:41 UTC (rev 12360)
@@ -1,28 +0,0 @@
-var map;
-
-function init() {
- map = new OpenLayers.Map('map');
- map.addControl(new OpenLayers.Control.LayerSwitcher());
-
- var gphy = new OpenLayers.Layer.GoogleNG(
- {type: google.maps.MapTypeId.TERRAIN}
- );
- var gmap = new OpenLayers.Layer.GoogleNG(
- // ROADMAP, the default
- );
- var ghyb = new OpenLayers.Layer.GoogleNG(
- {type: google.maps.MapTypeId.HYBRID}
- );
- var gsat = new OpenLayers.Layer.GoogleNG(
- {type: google.maps.MapTypeId.SATELLITE}
- );
-
- map.addLayers([gphy, gmap, ghyb, gsat]);
-
- // GoogleNG uses EPSG:900913 as projection, so we have to
- // transform our coordinates
- map.setCenter(new OpenLayers.LonLat(10.2, 48.9).transform(
- new OpenLayers.Projection("EPSG:4326"),
- map.getProjectionObject()
- ), 5);
-}
Modified: sandbox/camptocamp/clientzoom/examples/measure.html
===================================================================
--- sandbox/camptocamp/clientzoom/examples/measure.html 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/examples/measure.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -70,12 +70,19 @@
]);
var styleMap = new OpenLayers.StyleMap({"default": style});
+ // allow testing of specific renderers via "?renderer=Canvas", etc
+ var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
+ renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
+
measureControls = {
line: new OpenLayers.Control.Measure(
OpenLayers.Handler.Path, {
persist: true,
handlerOptions: {
- layerOptions: {styleMap: styleMap}
+ layerOptions: {
+ renderers: renderer,
+ styleMap: styleMap
+ }
}
}
),
@@ -83,7 +90,10 @@
OpenLayers.Handler.Polygon, {
persist: true,
handlerOptions: {
- layerOptions: {styleMap: styleMap}
+ layerOptions: {
+ renderers: renderer,
+ styleMap: styleMap
+ }
}
}
)
Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Control/EditingToolbar.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Control/EditingToolbar.js 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Control/EditingToolbar.js 2011-09-13 12:08:41 UTC (rev 12360)
@@ -25,6 +25,13 @@
OpenLayers.Control.Panel, {
/**
+ * APIProperty: citeCompliant
+ * {Boolean} If set to true, coordinates of features drawn in a map extent
+ * crossing the date line won't exceed the world bounds. Default is false.
+ */
+ citeCompliant: false,
+
+ /**
* Constructor: OpenLayers.Control.EditingToolbar
* Create an editing toolbar for a given layer.
*
@@ -39,9 +46,18 @@
[ new OpenLayers.Control.Navigation() ]
);
var controls = [
- new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'}),
- new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Path, {'displayClass': 'olControlDrawFeaturePath'}),
- new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Polygon, {'displayClass': 'olControlDrawFeaturePolygon'})
+ new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Point, {
+ displayClass: 'olControlDrawFeaturePoint',
+ handlerOptions: {citeCompliant: this.citeCompliant}
+ }),
+ new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Path, {
+ displayClass: 'olControlDrawFeaturePath',
+ handlerOptions: {citeCompliant: this.citeCompliant}
+ }),
+ new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Polygon, {
+ displayClass: 'olControlDrawFeaturePolygon',
+ handlerOptions: {citeCompliant: this.citeCompliant}
+ })
];
this.addControls(controls);
},
Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Path.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Path.js 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Path.js 2011-09-13 12:08:41 UTC (rev 12360)
@@ -108,7 +108,7 @@
* feature.
*/
createFeature: function(pixel) {
- var lonlat = this.map.getLonLatFromPixel(pixel);
+ var lonlat = this.layer.getLonLatFromViewPortPx(pixel);
var geometry = new OpenLayers.Geometry.Point(
lonlat.lon, lonlat.lat
);
@@ -165,7 +165,7 @@
*/
addPoint: function(pixel) {
this.layer.removeFeatures([this.point]);
- var lonlat = this.control.map.getLonLatFromPixel(pixel);
+ var lonlat = this.layer.getLonLatFromViewPortPx(pixel);
this.point = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat)
);
@@ -326,7 +326,7 @@
if(!this.line) {
this.createFeature(pixel);
}
- var lonlat = this.control.map.getLonLatFromPixel(pixel);
+ var lonlat = this.layer.getLonLatFromViewPortPx(pixel);
this.point.geometry.x = lonlat.lon;
this.point.geometry.y = lonlat.lat;
this.callback("modify", [this.point.geometry, this.getSketch(), drawing]);
Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Point.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Point.js 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Point.js 2011-09-13 12:08:41 UTC (rev 12360)
@@ -43,6 +43,13 @@
multi: false,
/**
+ * APIProperty: citeCompliant
+ * {Boolean} If set to true, coordinates of features drawn in a map extent
+ * crossing the date line won't exceed the world bounds. Default is false.
+ */
+ citeCompliant: false,
+
+ /**
* Property: mouseDown
* {Boolean} The mouse is down
*/
@@ -164,7 +171,8 @@
// without this, resolution properties must be specified at the
// map-level for this temporary layer to init its resolutions
// correctly
- calculateInRange: OpenLayers.Function.True
+ calculateInRange: OpenLayers.Function.True,
+ wrapDateLine: this.citeCompliant
}, this.layerOptions);
this.layer = new OpenLayers.Layer.Vector(this.CLASS_NAME, options);
this.map.addLayer(this.layer);
@@ -179,7 +187,7 @@
* pixel - {<OpenLayers.Pixel>} A pixel location on the map.
*/
createFeature: function(pixel) {
- var lonlat = this.map.getLonLatFromPixel(pixel);
+ var lonlat = this.layer.getLonLatFromViewPortPx(pixel);
var geometry = new OpenLayers.Geometry.Point(
lonlat.lon, lonlat.lat
);
@@ -306,7 +314,7 @@
if(!this.point) {
this.createFeature(pixel);
}
- var lonlat = this.map.getLonLatFromPixel(pixel);
+ var lonlat = this.layer.getLonLatFromViewPortPx(pixel);
this.point.geometry.x = lonlat.lon;
this.point.geometry.y = lonlat.lat;
this.callback("modify", [this.point.geometry, this.point, false]);
Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Polygon.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Polygon.js 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/Polygon.js 2011-09-13 12:08:41 UTC (rev 12360)
@@ -75,7 +75,7 @@
* feature.
*/
createFeature: function(pixel) {
- var lonlat = this.map.getLonLatFromPixel(pixel);
+ var lonlat = this.layer.getLonLatFromViewPortPx(pixel);
var geometry = new OpenLayers.Geometry.Point(
lonlat.lon, lonlat.lat
);
Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/RegularPolygon.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/RegularPolygon.js 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Handler/RegularPolygon.js 2011-09-13 12:08:41 UTC (rev 12360)
@@ -84,6 +84,13 @@
irregular: false,
/**
+ * APIProperty: citeCompliant
+ * {Boolean} If set to true, coordinates of features drawn in a map extent
+ * crossing the date line won't exceed the world bounds. Default is false.
+ */
+ citeCompliant: false,
+
+ /**
* Property: angle
* {Float} The angle from the origin (mouse down) to the current mouse
* position, in radians. This is measured counterclockwise from the
@@ -174,7 +181,8 @@
// without this, resolution properties must be specified at the
// map-level for this temporary layer to init its resolutions
// correctly
- calculateInRange: OpenLayers.Function.True
+ calculateInRange: OpenLayers.Function.True,
+ wrapDateLine: this.citeCompliant
}, this.layerOptions);
this.layer = new OpenLayers.Layer.Vector(this.CLASS_NAME, options);
this.map.addLayer(this.layer);
@@ -224,7 +232,7 @@
*/
down: function(evt) {
this.fixedRadius = !!(this.radius);
- var maploc = this.map.getLonLatFromPixel(evt.xy);
+ var maploc = this.layer.getLonLatFromViewPortPx(evt.xy);
this.origin = new OpenLayers.Geometry.Point(maploc.lon, maploc.lat);
// create the new polygon
if(!this.fixedRadius || this.irregular) {
@@ -250,7 +258,7 @@
* evt - {Evt} The move event
*/
move: function(evt) {
- var maploc = this.map.getLonLatFromPixel(evt.xy);
+ var maploc = this.layer.getLonLatFromViewPortPx(evt.xy);
var point = new OpenLayers.Geometry.Point(maploc.lon, maploc.lat);
if(this.irregular) {
var ry = Math.sqrt(2) * Math.abs(point.y - this.origin.y) / 2;
Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Google/v3.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Google/v3.js 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/Google/v3.js 2011-09-13 12:08:41 UTC (rev 12360)
@@ -203,7 +203,7 @@
*/
setGMapVisibility: function(visible) {
var cache = OpenLayers.Layer.Google.cache[this.map.id];
- if (cache && !cache.resized) {
+ if (cache) {
var type = this.type;
var layers = this.map.layers;
var layer;
Deleted: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/GoogleNG.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/GoogleNG.js 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/GoogleNG.js 2011-09-13 12:08:41 UTC (rev 12360)
@@ -1,336 +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/XYZ.js
- * @requires OpenLayers/Tile/Google.js
- * @requires OpenLayers/Layer/SphericalMercator.js
- */
-
-/**
- * Class: OpenLayers.Layer.GoogleNG
- * Google layer using <OpenLayers.Tile.Google> tiles.
- *
- * Inherits from:
- * - <OpenLayers.Layer.XYZ>
- */
-OpenLayers.Layer.GoogleNG = OpenLayers.Class(OpenLayers.Layer.XYZ, {
-
- /**
- * Property: SUPPORTED_TRANSITIONS
- * {Array} An immutable (that means don't change it!) list of supported
- * transitionEffect values. This layer type supports none.
- */
- SUPPORTED_TRANSITIONS: [],
-
- /**
- * Property: serverResolutions
- * {Array} the resolutions provided by the Google API.
- */
- serverResolutions: [
- 156543.03390625, 78271.516953125, 39135.7584765625,
- 19567.87923828125, 9783.939619140625, 4891.9698095703125,
- 2445.9849047851562, 1222.9924523925781, 611.4962261962891,
- 305.74811309814453, 152.87405654907226, 76.43702827453613,
- 38.218514137268066, 19.109257068634033, 9.554628534317017,
- 4.777314267158508, 2.388657133579254, 1.194328566789627,
- 0.5971642833948135, 0.29858214169740677, 0.14929107084870338,
- 0.07464553542435169, 0.037322767712175846
- ],
-
- /**
- * Property: attributionTemplate
- * {String}
- */
- attributionTemplate: '<span class="olGoogleAttribution ${mapType}">' +
- '<div><a title="Click to see this area on Google Maps" ' +
- 'target="_blank" href="http://maps.google.com/maps?' +
- 'll=${center}&z=${zoom}&t=${t}"><img width="62" height="24" ' +
- 'src="http://maps.gstatic.com/mapfiles/google_white.png"/></a>' +
- '</div>${mapData}<a style="white-space: nowrap" target="_blank" ' +
- 'href="http://www.google.com/help/terms_maps.html">' +
- 'Terms of Use</a></span>',
-
- /**
- * Property: mapTypes
- * {Object} mapping of {google.maps.MapTypeId} to the t param of
- * http://maps.google.com/maps? permalinks
- */
- mapTypes: {
- "roadmap": "m",
- "satellite": "k",
- "hybrid": "h",
- "terrain": "p"
- },
-
- /**
- * APIProperty: type
- * {google.maps.MapTypeId} See
- * http://code.google.com/apis/maps/documentation/javascript/reference.html#MapTypeId
- */
- type: null,
-
- /**
- * Constructor: OpenLayers.Layer.GoogleNG
- * Create a new GoogleNG layer. Requires the GMaps v3 JavaScript API script
- * (http://maps.google.com/maps/api/js?v=3.5&sensor=false) loaded in
- * the html document. Note: Terms of Service compliant use requires the map
- * to be configured with an <OpenLayers.Control.Attribution> control and
- * the attribution placed on the map.
- *
- * Example:
- * (code)
- * var terrain = new OpenLayers.Layer.GoogleNG({
- * name: "Google Terrain",
- * type: google.maps.MapTypeId.TERRAIN
- * });
- * (end)
- *
- * Parameters:
- * options - {Object} Configuration properties for the layer.
- *
- * Required configuration properties:
- * type - {google.maps.MapTypeId} The layer identifier. See
- * http://code.google.com/apis/maps/documentation/javascript/reference.html#MapTypeId
- * for valid types.
- *
- * Any other documented layer properties can be provided in the config object.
- */
- initialize: function(options) {
- options = OpenLayers.Util.applyDefaults({
- sphericalMercator: true
- }, options);
-
- if (!options.type) {
- options.type = google.maps.MapTypeId.ROADMAP;
- }
- var newArgs = [options.name, null, options];
- OpenLayers.Layer.XYZ.prototype.initialize.apply(this, newArgs);
-
- if (!OpenLayers.Layer.GoogleNG.mapObject) {
- OpenLayers.Layer.GoogleNG.mapObject =
- new google.maps.Map(document.createElement("div"));
- }
- if (OpenLayers.Layer.GoogleNG.mapObject.mapTypes[this.type]) {
- this.initLayer();
- } else {
- google.maps.event.addListenerOnce(
- OpenLayers.Layer.GoogleNG.mapObject,
- "idle",
- OpenLayers.Function.bind(this.initLayer, this)
- );
- }
- },
-
- /**
- * Method: initLayer
- *
- * Sets layer properties according to the metadata provided by the API
- */
- initLayer: function() {
- var mapType = OpenLayers.Layer.GoogleNG.mapObject.mapTypes[this.type];
- if (!this.name) {
- this.setName("Google " + mapType.name);
- }
-
- var minZoom = mapType.minZoom || 0;
- this.addOptions({
- maxResolution: Math.min(
- this.serverResolutions[minZoom], this.maxResolution
- ),
- zoomOffset: minZoom,
- numZoomLevels: Math.min(
- mapType.maxZoom + 1 - minZoom, this.numZoomLevels
- )
- }, true);
- },
-
- /**
- * Method: addTile
- * Create a tile, initialize it, and add it to the layer div.
- *
- * Parameters
- * bounds - {<OpenLayers.Bounds>}
- * position - {<OpenLayers.Pixel>}
- *
- * Returns:
- * {<OpenLayers.Tile.Google>} The added OpenLayers.Tile.Google
- */
- addTile:function(bounds, position) {
- return new OpenLayers.Tile.Google(
- this, position, bounds, this.tileOptions
- );
- },
-
- /**
- * Method: updateAttribution
- * Updates the attribution using the <attributionTemplate>
- *
- * Parameters:
- * copyrights - {Object} Object with "m", "k", "h" and "p" properties (see
- * <mapTypes>), each holding an array of copyrights.
- */
- updateAttribution: function(copyrights) {
- var myCopyrights;
- if (this.type == google.maps.MapTypeId.HYBRID) {
- // the Copyright Service returns "k" and "m" copyrights for the
- // HYBRID layer type.
- var candidates = [].concat(
- copyrights["h"], copyrights["k"], copyrights["m"]
- );
- myCopyrights = [];
- for (var i=candidates.length-1; i>=0; --i) {
- if (OpenLayers.Util.indexOf(candidates, myCopyrights) == -1) {
- myCopyrights.push(candidates[i]);
- }
- }
- } else {
- myCopyrights = copyrights[this.mapTypes[this.type]];
- }
- var mapData = myCopyrights.length == 0 ? "" :
- "Map Data ©" + new Date().getFullYear() + " " +
- myCopyrights.join(", ") + " - ";
- var center = this.map.getCenter();
- center && center.transform(
- this.map.getProjectionObject(),
- new OpenLayers.Projection("EPSG:4326")
- );
- var size = this.map.getSize();
- this.attribution = OpenLayers.String.format(this.attributionTemplate, {
- t: this.mapTypes[this.type],
- zoom: this.map.getZoom(),
- center: center.lat + "," + center.lon,
- mapType: this.type,
- mapData: mapData
- });
- this.map && this.map.events.triggerEvent("changelayer", {
- layer: this,
- property: "attribution"
- });
- },
-
- /**
- * Method: setMap
- */
- setMap: function() {
- OpenLayers.Layer.XYZ.prototype.setMap.apply(this, arguments);
- this.events.register("moveend", this,
- OpenLayers.Layer.GoogleNG.loadCopyrights
- );
- },
-
- /**
- * Method: removeMap
- */
- removeMap: function() {
- OpenLayers.Layer.XYZ.prototype.removeMap.apply(this, arguments);
- this.events.unregister("moveend", this,
- OpenLayers.Layer.GoogleNG.loadCopyrights
- );
- },
-
- /**
- * APIMethod: clone
- *
- * Parameters:
- * obj - {Object}
- *
- * Returns:
- * {<OpenLayers.Layer.GoogleNG>} An exact clone of this
- * <OpenLayers.Layer.GoogleNG>
- */
- clone: function(obj) {
- if (obj == null) {
- obj = new OpenLayers.Layer.GoogleNG(this.options);
- }
- //get all additions from superclasses
- obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
- // copy/set any non-init, non-simple values here
- return obj;
- },
-
- CLASS_NAME: "OpenLayers.Layer.GoogleNG"
-});
-
-/**
- * Property: mapObject
- * {google.maps.Map} Shared GMaps instance - will be set upon instantiation of
- * the 1st GoogleNG layer
- */
-OpenLayers.Layer.GoogleNG.mapObject = null;
-
-/**
- * Function: loadCopyrights
- * Using the Google Maps Copyright Service mode (see
- * http://mapki.com/wiki/Google_Map_Parameters#Misc) to get the attribution for
- * the current map extent. Will be called by each GoogleNG layer instance on
- * moveend.
- */
-OpenLayers.Layer.GoogleNG.loadCopyrights = function() {
- var me = OpenLayers.Layer.GoogleNG.loadCopyrights;
- if (me.numLoadingScripts == undefined) {
- me.loadingScripts = [];
- me.numLoadingScripts = 0;
- me.copyrights = {"m": [], "k": [], "h": [], "p": []};
-
- // store window scope functions before overwriting them
- me.origGAddCopyright = window.GAddCopyright;
- me.origGVerify = window.GVerify;
- me.origGAppFeatures = window.GAppFeatures;
-
- // defining window scope functions called by the script that the
- // Copyright Service returns
- window.GAddCopyright = function() {
- var copyright = arguments[7];
- var category = me.copyrights[arguments[0]];
- if (OpenLayers.Util.indexOf(category, copyright) == -1) {
- copyright && category.push(copyright);
- }
- };
- window.GVerify = OpenLayers.Function.True;
- window.GAppFeatures = OpenLayers.Function.bind(function() {
- me.numLoadingScripts--;
- if (me.numLoadingScripts == 0) {
- var script;
- for (var i=me.loadingScripts.length-1; i>=0; --i) {
- script = me.loadingScripts[i][0];
- me.loadingScripts[i][1].updateAttribution(me.copyrights);
- script.parentNode.removeChild(script);
- }
-
- // restore original functions
- window.GAddCopyright = me.origGAddCopyright;
- delete me.origGAddCopyright;
- window.GVerify = me.origGVerify;
- delete me.origGVerify;
- window.GAppFeatures = me.origGAppFeatures;
- delete me.origGAppFeatures;
-
- delete me.loadingScripts;
- delete me.numLoadingScripts;
- delete me.copyrights;
- }
- }, this);
- }
- var mapProj = this.map.getProjectionObject();
- var llProj = new OpenLayers.Projection("EPSG:4326");
- var center = this.map.getCenter().transform(mapProj, llProj);
- var extent = this.map.getExtent().transform(mapProj, llProj);
- var params = {
- spn: extent.getHeight() + "," + extent.getWidth(),
- z: this.map.getZoom(),
- t: this.mapTypes[this.type],
- vp: center.lat + "," + center.lon
- };
- var url = "http://maps.google.com/maps?" +
- OpenLayers.Util.getParameterString(params);
- var script = document.createElement("script");
- script.type = "text/javascript";
- script.src = url;
- me.numLoadingScripts++;
- me.loadingScripts.push([script, this]);
- document.getElementsByTagName("head")[0].appendChild(script);
-};
-
Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Layer/XYZ.js 2011-09-13 12:08:41 UTC (rev 12360)
@@ -153,8 +153,9 @@
(res * this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top) /
(res * this.tileSize.h));
- var z = this.serverResolutions != null ?
- OpenLayers.Util.indexOf(this.serverResolutions, res) :
+ var resolutions = this.serverResolutions || this.resolutions;
+ var z = this.zoomOffset == 0 ?
+ OpenLayers.Util.indexOf(resolutions, res) :
this.getServerSupportedZoom() + this.zoomOffset;
var limit = Math.pow(2, z);
Deleted: sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/Google.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/Google.js 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers/Tile/Google.js 2011-09-13 12:08:41 UTC (rev 12360)
@@ -1,154 +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/BaseTypes/Class.js
- * @requires OpenLayers/Util.js
- * @requires OpenLayers/Tile.js
- */
-
-/*
- * Class: OpenLayers.Tile.Google
- * Instances of OpenLayers.Tile.Google are used to manage the tiles created
- * by google.maps.MapType (see
- * http://code.google.com/apis/maps/documentation/javascript/reference.html#MapType).
- *
- * Inherits from:
- * - <OpenLayers.Tile>
- */
-OpenLayers.Tile.Google = OpenLayers.Class(OpenLayers.Tile, {
-
- /**
- * Property: node
- * {DOMElement} The tile node from the MapType's getTile method
- */
- node: null,
-
- /**
- * Constructor: OpenLayers.Tile.Google
- * Constructor for a new <OpenLayers.Tile.Google> instance.
- *
- * Parameters:
- * layer - {<OpenLayers.Layer>} layer that the tile will go in.
- * position - {<OpenLayers.Pixel>}
- * bounds - {<OpenLayers.Bounds>}
- * options - {Object}
- */
- initialize: function(layer, position, bounds, options) {
- OpenLayers.Tile.prototype.initialize.apply(this, [
- layer, position, bounds, null, null, options
- ]);
- },
-
- /**
- * APIMethod: destroy
- * Nullify references to prevent circular references and memory leaks.
- */
- destroy:function() {
- this.node && this.clear();
- this.node = null;
- OpenLayers.Tile.prototype.destroy.apply(this, arguments);
- },
-
- /**
- * Method: clone
- *
- * Parameters:
- * obj - {<OpenLayers.Tile>} The tile to be cloned
- *
- * Returns:
- * {<OpenLayers.Tile>} An exact clone of this <OpenLayers.Tile.Google>
- */
- clone: function (obj) {
- if (obj == null) {
- obj = new OpenLayers.Tile.Google(this.layer,
- this.position,
- this.bounds);
- }
-
- // catch any randomly tagged-on properties
- OpenLayers.Util.applyDefaults(obj, this);
-
- obj.node = null;
-
- return obj;
- },
-
- /**
- * Method: draw
- * Check that a tile should be drawn, and draw it.
- *
- * Returns:
- * {Boolean} Always returns true.
- */
- draw: function() {
- var layerType = OpenLayers.Layer.GoogleNG.mapObject.mapTypes[
- this.layer.type
- ];
- if (layerType && OpenLayers.Tile.prototype.draw.apply(this, arguments)) {
- var xyz = this.layer.getXYZ(this.bounds);
- var point = new google.maps.Point(xyz.x, xyz.y);
-
- // The hybrid tile consists of two images. For some reason, we have
- // to make sure that the satellite image loads first, otherwise we
- // occasionally get blank tiles for one of the two images. This is
- // done by requesting the tile for just the satellite mapType
- // first, before requesting the hybrid one.
- //TODO revisit this - it may be a temporary issue with GMaps
- var tempTile;
- if (this.layer.type === google.maps.MapTypeId.HYBRID) {
- tempTile = layerType.getTile(point, xyz.z, document);
- }
-
- this.node = layerType.getTile(point, xyz.z, document);
-
- this.isLoading = true;
- this.events.triggerEvent("loadstart");
-
- this.layer.div.appendChild(this.node);
-
- // We only modify what we need to - we expect the size to be set
- // by getTile, and we have a test that will fail if this changes.
- OpenLayers.Util.modifyDOMElement(
- this.node, null, this.position, null, "absolute"
- );
-
- // The images inside the node returned from getTile seem to be
- // preloaded already, so registering onload events on these images
- // won't work. Instead, we trigger the loadend event immediately
- // in the next cycle.
- window.setTimeout(OpenLayers.Function.bind(function() {
- this.isLoading = false;
- // check for this.events - we may be destroyed already
- this.events && this.events.triggerEvent("loadend");
-
- // see hybrid tile issue above
- //TODO revisit this - it may be a temporary issue with GMaps
- if (tempTile) {
- layerType.releaseTile(tempTile);
- }
- }, this), 0);
- }
- return true;
- },
-
- /**
- * Method: clear
- * Clear the tile of any bounds/position-related data so that it can
- * be reused in a new location. To be implemented by subclasses.
- */
- clear: function() {
- if (this.node) {
- this.node.parentNode &&
- this.node.parentNode.removeChild(this.node);
- OpenLayers.Layer.GoogleNG.mapObject.mapTypes[
- this.layer.type
- ].releaseTile(this.node);
- }
- },
-
- CLASS_NAME: "OpenLayers.Tile.Google"
-});
Modified: sandbox/camptocamp/clientzoom/lib/OpenLayers.js
===================================================================
--- sandbox/camptocamp/clientzoom/lib/OpenLayers.js 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/lib/OpenLayers.js 2011-09-13 12:08:41 UTC (rev 12360)
@@ -122,7 +122,6 @@
"OpenLayers/Popup.js",
"OpenLayers/Tile.js",
"OpenLayers/Tile/BackBufferable.js",
- "OpenLayers/Tile/Google.js",
"OpenLayers/Tile/Image.js",
"OpenLayers/Tile/Image/IFrame.js",
"OpenLayers/Tile/WFS.js",
@@ -155,7 +154,6 @@
"OpenLayers/Layer/Boxes.js",
"OpenLayers/Layer/XYZ.js",
"OpenLayers/Layer/Bing.js",
- "OpenLayers/Layer/GoogleNG.js",
"OpenLayers/Layer/TMS.js",
"OpenLayers/Layer/TileCache.js",
"OpenLayers/Layer/Zoomify.js",
Modified: sandbox/camptocamp/clientzoom/tests/Control/EditingToolbar.html
===================================================================
--- sandbox/camptocamp/clientzoom/tests/Control/EditingToolbar.html 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/tests/Control/EditingToolbar.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -3,12 +3,14 @@
<script src="../OLLoader.js"></script>
<script type="text/javascript">
function test_ctor_draw(t) {
- t.plan(4);
+ t.plan(5);
var map = new OpenLayers.Map('map');
var vLayer = new OpenLayers.Layer.Vector();
map.addLayer(vLayer);
- var editingToolbar = new OpenLayers.Control.EditingToolbar(vLayer);
+ var editingToolbar = new OpenLayers.Control.EditingToolbar(vLayer, {
+ citeCompliant: "foo"
+ });
map.addControl(editingToolbar);
t.ok(editingToolbar instanceof OpenLayers.Control.EditingToolbar,
@@ -19,6 +21,7 @@
"First control is active" );
t.eq(editingToolbar.controls.length, 4,
"EditingToolbar contains 4 Controls" );
+ t.eq(editingToolbar.controls[1].handler.citeCompliant, "foo", "citeCompliant option passed to handler correctly")
map.destroy();
}
Modified: sandbox/camptocamp/clientzoom/tests/Format/WMSCapabilities/v1_1_1.html
===================================================================
--- sandbox/camptocamp/clientzoom/tests/Format/WMSCapabilities/v1_1_1.html 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/tests/Format/WMSCapabilities/v1_1_1.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -535,13 +535,12 @@
<Layer>
<Title>Acme Corp. Map Server</Title>
<SRS>EPSG:4326</SRS>
+ <BoundingBox SRS="EPSG:4326"
+ minx="-1" miny="-1" maxx="1" maxy="1" resx="0.0" resy="0.0"/>
<AuthorityURL name="DIF_ID">
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple"
xlink:href="http://gcmd.gsfc.nasa.gov/difguide/whatisadif.html" />
</AuthorityURL>
- <BoundingBox SRS="EPSG:4326"
- minx="-1" miny="-1" maxx="1" maxy="1" resx="0.0" resy="0.0"/>
-
<Layer>
<Name>ROADS_RIVERS</Name>
<Title>Roads and Rivers</Title>
Modified: sandbox/camptocamp/clientzoom/tests/Handler/Path.html
===================================================================
--- sandbox/camptocamp/clientzoom/tests/Handler/Path.html 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/tests/Handler/Path.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -1376,6 +1376,32 @@
map.destroy();
}
+ function test_citeComplaint(t) {
+ t.plan(2);
+ var map = new OpenLayers.Map('map');
+ map.addLayer(new OpenLayers.Layer.OSM());
+ var layer = new OpenLayers.Layer.Vector();
+ map.addLayer(layer);
+ var control = new OpenLayers.Control({});
+ var handler = new OpenLayers.Handler.Path(control, {});
+ control.handler = handler;
+ map.addControl(control);
+ map.zoomToExtent(new OpenLayers.Bounds(-24225034.496992, -11368938.517442, -14206280.326992, -1350184.3474418));
+ handler.activate();
+ handler.createFeature(new OpenLayers.Pixel(100, 50));
+ t.ok(handler.point.geometry.x < 0, "Geometry started correctly when wrapping the dateline using citeCompliant false");
+ control.deactivate();
+
+ handler = new OpenLayers.Handler.Path(control, {}, {citeCompliant: true});
+ control.handler = handler;
+ control.activate();
+ handler.createFeature(new OpenLayers.Pixel(100, 50));
+ t.ok(handler.point.geometry.x > 0, "Geometry started correctly when wrapping the dateline using citeCompliant true");
+
+ map.destroy();
+ }
+
+
</script>
</head>
<body>
Modified: sandbox/camptocamp/clientzoom/tests/Handler/Polygon.html
===================================================================
--- sandbox/camptocamp/clientzoom/tests/Handler/Polygon.html 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/tests/Handler/Polygon.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -1128,6 +1128,31 @@
map.destroy();
}
+ function test_citeComplaint(t) {
+ t.plan(2);
+ var map = new OpenLayers.Map('map');
+ map.addLayer(new OpenLayers.Layer.OSM());
+ var layer = new OpenLayers.Layer.Vector();
+ map.addLayer(layer);
+ var control = new OpenLayers.Control({});
+ var handler = new OpenLayers.Handler.Polygon(control, {});
+ control.handler = handler;
+ map.addControl(control);
+ map.zoomToExtent(new OpenLayers.Bounds(-24225034.496992, -11368938.517442, -14206280.326992, -1350184.3474418));
+ control.activate();
+ handler.createFeature(new OpenLayers.Pixel(100, 50));
+ t.ok(handler.point.geometry.x < 0, "Geometry started correctly when wrapping the dateline using citeCompliant false");
+ control.deactivate();
+
+ var handler = new OpenLayers.Handler.Polygon(control, {}, {citeCompliant: true});
+ control.handler = handler;
+ control.activate();
+ handler.createFeature(new OpenLayers.Pixel(100, 50));
+ t.ok(handler.point.geometry.x > 0, "Geometry started correctly when wrapping the dateline using citeCompliant true");
+
+ map.destroy();
+ }
+
</script>
</head>
<body>
Modified: sandbox/camptocamp/clientzoom/tests/Handler/RegularPolygon.html
===================================================================
--- sandbox/camptocamp/clientzoom/tests/Handler/RegularPolygon.html 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/tests/Handler/RegularPolygon.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -149,9 +149,6 @@
function test_Handler_RegularPolygon_irregular(t) {
t.plan(4);
var map = {
- getLonLatFromPixel: function(px) {
- return {lon: px.x, lat: px.y};
- },
getResolution: function() {
return 1;
}
@@ -164,6 +161,9 @@
t.eq(ring.components[0].y, 10, "correct bottom");
t.eq(ring.components[2].x, 10, "correct left");
t.eq(ring.components[2].y, 15, "correct top");
+ },
+ getLonLatFromViewPortPx: function(px) {
+ return {lon: px.x, lat: px.y};
}
};
var control = {};
@@ -190,11 +190,7 @@
t.plan(1);
// setup
- var map = new OpenLayers.Map("map", {
- getLonLatFromPixel: function(px) {
- return {lon: px.x, lat: px.y};
- }
- });
+ var map = new OpenLayers.Map("map");
var control = {"map": map};
@@ -211,6 +207,17 @@
var isLeftClick = OpenLayers.Event.isLeftClick;
OpenLayers.Event.isLeftClick = function() { return true; };
+ handler.layer = {
+ renderer: {
+ clear: OpenLayers.Function.Void
+ },
+ addFeatures: OpenLayers.Function.Void,
+ drawFeature: OpenLayers.Function.Void,
+ destroyFeatures: OpenLayers.Function.Void,
+ getLonLatFromViewPortPx: function() {
+ return xy;
+ }
+ };
// test
map.events.triggerEvent("mousedown", {"xy": xy});
Deleted: sandbox/camptocamp/clientzoom/tests/Layer/GoogleNG.html
===================================================================
--- sandbox/camptocamp/clientzoom/tests/Layer/GoogleNG.html 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/tests/Layer/GoogleNG.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -1,104 +0,0 @@
-<html>
-<head>
- <script src="http://maps.google.com/maps/api/js?sensor=false&v=3.5"></script>
- <script src="../OLLoader.js"></script>
- <script type="text/javascript">
- var map, layer;
-
- function test_constructor(t) {
- t.plan(2);
-
- layer = new OpenLayers.Layer.GoogleNG({type: google.maps.MapTypeId.HYBRID});
- t.ok(layer instanceof OpenLayers.Layer.GoogleNG, "returns OpenLayers.Layer.GoogleNG object" );
- t.eq(layer.type, google.maps.MapTypeId.HYBRID, "Layer type set");
- }
-
- function test_initLayer(t) {
- t.plan(6);
-
- map = new OpenLayers.Map("map");
- var log = {};
- layer = new OpenLayers.Layer.GoogleNG({
- numZoomLevels: 10,
- maxResolution: 39135.7584765625,
- initLayer: function() {
- log[layer.id] = true;
- OpenLayers.Layer.GoogleNG.prototype.initLayer.apply(this, arguments);
- }
- });
- map.addLayer(layer);
- map.zoomToMaxExtent();
-
- var map2 = new OpenLayers.Map("map2");
- var minZoom = 1;
- var layer2 = new OpenLayers.Layer.GoogleNG({
- numZoomLevels: 24,
- initLayer: function() {
- log[layer2.id] = true;
- var origMinZoom = OpenLayers.Layer.GoogleNG.mapObject.mapTypes[layer2.type].minZoom;
- // pretend the API reports a different minZoom
- OpenLayers.Layer.GoogleNG.mapObject.mapTypes[layer2.type].minZoom = minZoom;
- OpenLayers.Layer.GoogleNG.prototype.initLayer.apply(this, arguments);
- OpenLayers.Layer.GoogleNG.mapObject.mapTypes[layer2.type].minZoom = origMinZoom;
- }
- });
- map2.addLayer(layer2);
- map2.zoomToMaxExtent();
-
- t.delay_call(1, function() {
- t.eq(log[layer.id], true, "initLayer called for 1st layer");
- t.eq(log[layer2.id], true, "initLayer called for 2nd layer");
-
- t.eq(layer.numZoomLevels, 10, "numZoomLevels from configuration takes precedence if lower");
- t.eq(layer2.numZoomLevels, OpenLayers.Layer.GoogleNG.mapObject.mapTypes[layer2.type].maxZoom + 1 - minZoom, "numZoomLevels from API takes precedence if lower");
-
- t.eq(layer.maxResolution, 39135.7584765625, "maxResolution from configuration takes precedence if higher");
- t.eq(layer2.maxResolution, 78271.516953125, "maxResolution from API takes precedence if higher");
-
- map.destroy();
- map2.destroy();
- });
- }
-
- function test_attribution(t) {
- t.plan(4);
-
- var log = [];
- map = new OpenLayers.Map("map");
- layer = new OpenLayers.Layer.GoogleNG({
- type: google.maps.MapTypeId.HYBRID,
- updateAttribution: function(copyrights) {
- log.push(copyrights);
- OpenLayers.Layer.GoogleNG.prototype.updateAttribution.apply(this, arguments);
- }
- });
- map.addLayer(layer);
- map.setCenter(new OpenLayers.LonLat(16, 48).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), 5);
-
- t.delay_call(3, function() {
- t.eq(log.length, 1, "updateAttribution was called once");
- t.ok(log[0]["m"].length && log[0]["k"].length, "'m' and 'k' copyrights populated for hybrid layer");
- t.ok(layer.attribution.indexOf('olGoogleAttribution hybrid') != -1, "Attribution has the correct css class");
- t.ok(layer.attribution.indexOf('?ll=48,16&z=5&t=h"') != -1, "maps.google.com link has correct parameters");
- map.destroy();
- });
- }
-
- function test_clone(t) {
- t.plan(2);
-
- var clone;
-
- layer = new OpenLayers.Layer.GoogleNG({type: google.maps.MapTypeId.HYBRID});
- clone = layer.clone();
- t.ok(clone instanceof OpenLayers.Layer.GoogleNG, "clone is a Layer.GoogleNG instance");
- t.eq(clone.type, google.maps.MapTypeId.HYBRID, "with the correct map type");
- }
-
- </script>
-</head>
-<body>
-<div id="map" style="width:500px;height:550px"></div>
-<div id="map2" style="width:500px;height:550px"></div>
-</body>
-</html>
Deleted: sandbox/camptocamp/clientzoom/tests/Tile/Google.html
===================================================================
--- sandbox/camptocamp/clientzoom/tests/Tile/Google.html 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/tests/Tile/Google.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -1,74 +0,0 @@
-<html>
-<head>
- <script src="http://maps.google.com/maps/api/js?sensor=false&v=3.5"></script>
- <script src="../OLLoader.js"></script>
- <script type="text/javascript">
- var tile;
- var layer = new OpenLayers.Layer.GoogleNG();
- var position = new OpenLayers.Pixel(20,30);
- var bounds = new OpenLayers.Bounds(1,2,3,4);
-
-
- function test_constructor (t) {
- t.plan( 4 );
-
- tile = new OpenLayers.Tile.Google(layer, position, bounds);
-
- t.ok( tile instanceof OpenLayers.Tile.Google, "new OpenLayers.Tile.Google returns Tile object" );
- t.ok( tile.layer == layer, "tile.layer is set correctly");
- t.ok( tile.position.equals(position), "tile.position is set correctly");
- t.ok( tile.bounds.equals(bounds), "tile.bounds is set correctly");
- }
-
- function test_clone (t) {
- t.plan( 5 );
-
- tile = new OpenLayers.Tile.Google(layer, position, bounds);
- tile.node = document.createElement("div");
- var clone = tile.clone();
-
- t.ok( clone instanceof OpenLayers.Tile.Google, "OpenLayers.Tile.Google.clone returns Tile.Google object" );
- t.ok( clone.layer == layer, "clone.layer is set correctly");
- t.ok( clone.position.equals(position), "clone.position is set correctly");
- t.ok( clone.bounds.equals(bounds), "clone.bounds is set correctly");
- t.ok( !clone.node, "node not cloned");
- }
-
- function test_draw (t) {
- t.plan( 5 );
-
- var map = new OpenLayers.Map('map');
- map.addLayer(layer);
-
- tile = new OpenLayers.Tile.Google(layer, position, bounds);
-
- tile.events.register("loadstart", this, function() {
- t.ok(true, "loadstart triggered");
- });
- tile.events.register("loadend", this, function() {
- t.ok(true, "loadend triggered");
- });
-
- t.delay_call(1, function() {
- //this should trigger a "loadstart" event
- tile.draw();
-
- t.ok( tile.node, "tile.draw creates a node");
- // The two tests below will fail when getTile doesn't set the tile size
- t.eq( tile.node.style.width, layer.tileSize.w+"px", "Image width is correct" );
- t.eq( tile.node.style.height, layer.tileSize.h+"px", "Image height is correct" );
- });
- t.delay_call(2, function() {
- map.removeLayer(layer);
- map.destroy();
- /* wait until "loadend" fires */
- });
-
- }
-
- </script>
-</head>
-<body>
-<div id="map" style="height:550px;width:500px"></div>
-</body>
-</html>
\ No newline at end of file
Modified: sandbox/camptocamp/clientzoom/tests/list-tests.html
===================================================================
--- sandbox/camptocamp/clientzoom/tests/list-tests.html 2011-09-12 11:43:22 UTC (rev 12359)
+++ sandbox/camptocamp/clientzoom/tests/list-tests.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -153,7 +153,6 @@
<li>Layer/GML.html</li>
<li>Layer/Google.html</li>
<li>Layer/Google/v3.html</li>
- <li>Layer/GoogleNG.html</li>
<li>Layer/Grid.html</li>
<li>Layer/HTTPRequest.html</li>
<li>Layer/Image.html</li>
@@ -224,7 +223,6 @@
<li>Symbolizer/Raster.html</li>
<li>Symbolizer/Text.html</li>
<li>Tile.html</li>
- <li>Tile/Google.html</li>
<li>Tile/Image.html</li>
<li>Tile/BackBufferable.html</li>
<li>Tile/Image/IFrame.html</li>
Copied: sandbox/camptocamp/clientzoom/tests/manual/dateline-sketch.html (from rev 12359, trunk/openlayers/tests/manual/dateline-sketch.html)
===================================================================
--- sandbox/camptocamp/clientzoom/tests/manual/dateline-sketch.html (rev 0)
+++ sandbox/camptocamp/clientzoom/tests/manual/dateline-sketch.html 2011-09-13 12:08:41 UTC (rev 12360)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <title>OpenLayers: Sketch handlers crossing the dateline</title>
+ <link rel="stylesheet" href="../../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="../../examples/style.css" type="text/css">
+ <style type="text/css">
+ #map {
+ height: 512px;
+ }
+ </style>
+
+ <script src="http://maps.google.com/maps/api/js?v=3.5&sensor=false"></script>
+
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+
+// make map available for easy debugging
+var map;
+
+function init(){
+ map = new OpenLayers.Map('map');
+
+ var gmap = new OpenLayers.Layer.Google(
+ "Google Streets",
+ {sphericalMercator: true}
+ );
+ var vector = new OpenLayers.Layer.Vector("Editable Vectors");
+
+ map.addLayers([gmap, vector]);
+ map.addControl(new OpenLayers.Control.EditingToolbar(vector));
+
+ var extent = new OpenLayers.Bounds(-24225034.496992, -11368938.517442, -14206280.326992, -1350184.3474418);
+ map.zoomToExtent(extent);
+}
+
+ </script>
+ </head>
+ <body onload="init()">
+ <h1 id="title">OpenLayers sketch handlers crossing the dateline example</h1>
+
+ <div id="tags">
+ international date line, dateline, sketch
+ </div>
+ <p id="shortdesc">
+ Start digitizing a polygon or line
+ on one side of the international dateline, and then cross the dateline
+ whilst digitizing. The feature should behave like digitizing on any
+ other location.
+ </p>
+ <div id="map" class="smallmap"></div>
+
+ <div id="docs">
+ </div>
+ </body>
+</html>
More information about the Commits
mailing list