[OpenLayers-Commits] r7344 - in sandbox/topp/geoext: build examples lib/OpenLayers lib/OpenLayers/Control lib/OpenLayers/Feature lib/OpenLayers/Format lib/OpenLayers/Format/SLD lib/OpenLayers/Lang lib/OpenLayers/Layer lib/OpenLayers/Renderer lib/OpenLayers/Tile tests tests/Feature tests/Format/SLD tests/Layer tests/Renderer tests/Request tests/Tile tests/manual
commits at openlayers.org
commits at openlayers.org
Tue Jun 10 17:48:51 EDT 2008
Author: tschaub
Date: 2008-06-10 17:48:50 -0400 (Tue, 10 Jun 2008)
New Revision: 7344
Added:
sandbox/topp/geoext/examples/styles-rotation.html
sandbox/topp/geoext/lib/OpenLayers/Lang/it.js
sandbox/topp/geoext/lib/OpenLayers/Lang/pt-BR.js
sandbox/topp/geoext/lib/OpenLayers/Lang/sv-SE.js
sandbox/topp/geoext/tests/Request.html
sandbox/topp/geoext/tests/Request/
sandbox/topp/geoext/tests/Request/XMLHttpRequest.html
Removed:
sandbox/topp/geoext/tests/Request/XMLHttpRequest.html
Modified:
sandbox/topp/geoext/build/full.cfg
sandbox/topp/geoext/build/library.cfg
sandbox/topp/geoext/build/license.txt
sandbox/topp/geoext/build/lite.cfg
sandbox/topp/geoext/examples/spherical-mercator.html
sandbox/topp/geoext/lib/OpenLayers/Ajax.js
sandbox/topp/geoext/lib/OpenLayers/Control/PanZoomBar.js
sandbox/topp/geoext/lib/OpenLayers/Control/Permalink.js
sandbox/topp/geoext/lib/OpenLayers/Feature/Vector.js
sandbox/topp/geoext/lib/OpenLayers/Format/KML.js
sandbox/topp/geoext/lib/OpenLayers/Format/SLD/v1.js
sandbox/topp/geoext/lib/OpenLayers/Layer/GML.js
sandbox/topp/geoext/lib/OpenLayers/Layer/GeoRSS.js
sandbox/topp/geoext/lib/OpenLayers/Layer/Google.js
sandbox/topp/geoext/lib/OpenLayers/Layer/Grid.js
sandbox/topp/geoext/lib/OpenLayers/Layer/KaMap.js
sandbox/topp/geoext/lib/OpenLayers/Layer/MapGuide.js
sandbox/topp/geoext/lib/OpenLayers/Layer/MapServer.js
sandbox/topp/geoext/lib/OpenLayers/Layer/Text.js
sandbox/topp/geoext/lib/OpenLayers/Layer/Vector.js
sandbox/topp/geoext/lib/OpenLayers/Layer/VirtualEarth.js
sandbox/topp/geoext/lib/OpenLayers/Layer/WFS.js
sandbox/topp/geoext/lib/OpenLayers/Layer/WorldWind.js
sandbox/topp/geoext/lib/OpenLayers/Map.js
sandbox/topp/geoext/lib/OpenLayers/Renderer/SVG.js
sandbox/topp/geoext/lib/OpenLayers/Renderer/VML.js
sandbox/topp/geoext/lib/OpenLayers/Request.js
sandbox/topp/geoext/lib/OpenLayers/Style.js
sandbox/topp/geoext/lib/OpenLayers/Tile/WFS.js
sandbox/topp/geoext/lib/OpenLayers/Util.js
sandbox/topp/geoext/tests/Ajax.html
sandbox/topp/geoext/tests/Feature/Vector.html
sandbox/topp/geoext/tests/Format/SLD/v1_0_0.html
sandbox/topp/geoext/tests/Layer/Vector.html
sandbox/topp/geoext/tests/Renderer/VML.html
sandbox/topp/geoext/tests/Tile/WFS.html
sandbox/topp/geoext/tests/Util.html
sandbox/topp/geoext/tests/list-tests.html
sandbox/topp/geoext/tests/manual/ajax.html
sandbox/topp/geoext/tests/xml_eq.js
Log:
merge r7251:HEAD from trunk
Modified: sandbox/topp/geoext/build/full.cfg
===================================================================
--- sandbox/topp/geoext/build/full.cfg 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/build/full.cfg 2008-06-10 21:48:50 UTC (rev 7344)
@@ -13,7 +13,10 @@
[exclude]
Firebug/firebug.js
Firebug/firebugx.js
+OpenLayers/Lang/cs-CZ.js
OpenLayers/Lang/de.js
OpenLayers/Lang/en-CA.js
OpenLayers/Lang/fr.js
-OpenLayers/Lang/cs-CZ.js
+OpenLayers/Lang/it.js
+OpenLayers/Lang/pt-BR.js
+OpenLayers/Lang/sv-SE.js
\ No newline at end of file
Modified: sandbox/topp/geoext/build/library.cfg
===================================================================
--- sandbox/topp/geoext/build/library.cfg 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/build/library.cfg 2008-06-10 21:48:50 UTC (rev 7344)
@@ -46,9 +46,11 @@
OpenLayers/Renderer/SVG.js
OpenLayers/Renderer/VML.js
OpenLayers/Renderer.js
+OpenLayers/Lang/cs-CZ.js
OpenLayers/Lang/de.js
OpenLayers/Lang/en-CA.js
OpenLayers/Lang/fr.js
-OpenLayers/Lang/cs-CZ.js
+OpenLayers/Lang/it.js
+OpenLayers/Lang/pt-BR.js
+OpenLayers/Lang/sv-SE.js
-
Modified: sandbox/topp/geoext/build/license.txt
===================================================================
--- sandbox/topp/geoext/build/license.txt 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/build/license.txt 2008-06-10 21:48:50 UTC (rev 7344)
@@ -43,3 +43,12 @@
*
**/
+/**
+ * Contains XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/>
+ * Copyright 2007 Sergey Ilinsky (http://www.ilinsky.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ */
Modified: sandbox/topp/geoext/build/lite.cfg
===================================================================
--- sandbox/topp/geoext/build/lite.cfg 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/build/lite.cfg 2008-06-10 21:48:50 UTC (rev 7344)
@@ -21,8 +21,11 @@
[exclude]
Firebug/firebug.js
Firebug/firebugx.js
+OpenLayers/Lang/cs-CZ.js
OpenLayers/Lang/de.js
OpenLayers/Lang/en-CA.js
OpenLayers/Lang/fr.js
-OpenLayers/Lang/cs-CZ.js
+OpenLayers/Lang/it.js
+OpenLayers/Lang/pt-BR.js
+OpenLayers/Lang/sv-SE.js
Modified: sandbox/topp/geoext/examples/spherical-mercator.html
===================================================================
--- sandbox/topp/geoext/examples/spherical-mercator.html 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/examples/spherical-mercator.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -4,6 +4,9 @@
<link rel="stylesheet" href="style.css" type="text/css" />
<style type="text/css">
.olControlAttribution { bottom: 0px!important }
+ #map {
+ height: 512px;
+ }
</style>
<script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script>
Copied: sandbox/topp/geoext/examples/styles-rotation.html (from rev 7342, trunk/openlayers/examples/styles-rotation.html)
===================================================================
--- sandbox/topp/geoext/examples/styles-rotation.html (rev 0)
+++ sandbox/topp/geoext/examples/styles-rotation.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -0,0 +1,83 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>OpenLayers Styles Rotation Example</title>
+ <style type="text/css">
+ #map {
+ width: 800px;
+ height: 475px;
+ border: 1px solid black;
+ }
+ </style>
+ <script src="../lib/OpenLayers.js" type="text/javascript"></script>
+ <script type="text/javascript">
+
+ var map;
+ var vectors;
+
+ function init(){
+ map = new OpenLayers.Map('map');
+ var wms = new OpenLayers.Layer.WMS(
+ "OpenLayers WMS",
+ "http://labs.metacarta.com/wms/vmap0",
+ {layers: 'basic'}
+ );
+
+ vectors = new OpenLayers.Layer.Vector(
+ "Simple Geometry",
+ {
+ styleMap: new OpenLayers.StyleMap({
+ "default": {
+ externalGraphic: "../img/marker-gold.png",
+ //graphicWidth: 17,
+ graphicHeight: 20,
+ graphicYOffset: -19,
+ rotation: "${angle}",
+ fillOpacity: "${opacity}"
+ },
+ "select": {
+ cursor: "crosshair",
+ externalGraphic: "../img/marker.png"
+ }
+ })
+ }
+ );
+
+ map.addLayers([wms, vectors]);
+
+ var features = [];
+ var x = -111.04;
+ var y = 45.68;
+ for(var i = 0; i < 10; i++){
+ x += i * .5;
+ y += i * .1;
+ features.push(
+ new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Point(x, y), {angle: (i*36)%360-180, opacity:i/10+.1}
+ )
+ );
+ features.push(
+ new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Point(x, y), {angle: (i*36)%360, opacity:i/10+.1}
+ )
+ );
+ }
+
+ map.setCenter(new OpenLayers.LonLat(x-10, y), 5);
+ vectors.addFeatures(features);
+
+ var selectControl = new OpenLayers.Control.SelectFeature(
+ vectors, {hover: true});
+ map.addControl(selectControl);
+ selectControl.activate();
+
+ };
+
+ </script>
+ </head>
+ <body onload="init()">
+ <h1 id="title">Rotation Styles Example</h1>
+ <p id="shortdesc">Vector point feature symbolizers can have a <tt>rotation</tt> property. The center of the rotation is the point of the image specified by <tt>graphicXOffset</tt> and <tt>graphicYOffset</tt>.</p>
+ <div id="map"></div>
+ <div id="docs"/>
+ </body>
+</html>
Modified: sandbox/topp/geoext/lib/OpenLayers/Ajax.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Ajax.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Ajax.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -30,16 +30,18 @@
*/
-/**
-* @param {} request
-*/
+/**
+ * Function: OpenLayers.nullHandler
+ * @param {} request
+ */
OpenLayers.nullHandler = function(request) {
alert(OpenLayers.i18n("unhandledRequest", {'statusText':request.statusText}));
};
/**
* Function: loadURL
- * Background load a document.
+ * Background load a document. For more flexibility in using XMLHttpRequest,
+ * see the <OpenLayers.Request> methods.
*
* Parameters:
* uri - {String} URI of source doc
@@ -49,35 +51,32 @@
* caller - {Object} object which gets callbacks
* onComplete - {Function} Optional callback for success. The callback
* will be called with this set to caller and will receive the request
- * object as an argument.
+ * object as an argument. Note that if you do not specify an onComplete
+ * function, <OpenLayers.nullHandler> will be called (which pops up an
+ * alert dialog).
* onFailure - {Function} Optional callback for failure. In the event of
* a failure, the callback will be called with this set to caller and will
- * receive the request object as an argument.
+ * receive the request object as an argument. Note that if you do not
+ * specify an onComplete function, <OpenLayers.nullHandler> will be called
+ * (which pops up an alert dialog).
*
* Returns:
- * {XMLHttpRequest} The request object. To abort loading, call
- * request.abort().
+ * {<OpenLayers.Request.XMLHttpRequest>} The request object. To abort loading,
+ * call request.abort().
*/
OpenLayers.loadURL = function(uri, params, caller,
onComplete, onFailure) {
-
- var success = (onComplete) ? OpenLayers.Function.bind(onComplete, caller)
- : OpenLayers.nullHandler;
-
- var failure = (onFailure) ? OpenLayers.Function.bind(onFailure, caller)
- : OpenLayers.nullHandler;
-
- // from prototype.js
- var request = new OpenLayers.Ajax.Request(
- uri,
- {
- method: 'get',
- parameters: params,
- onComplete: success,
- onFailure: failure
- }
- );
- return request.transport;
+
+ if(typeof params == 'string') {
+ params = OpenLayers.Util.getParameters(params);
+ }
+ var success = (onComplete) ? onComplete : OpenLayers.nullHandler;
+ var failure = (onFailure) ? onFailure : OpenLayers.nullHandler;
+
+ return OpenLayers.Request.GET({
+ url: uri, params: params,
+ success: success, failure: failure, scope: caller
+ });
};
/**
@@ -263,6 +262,7 @@
/**
* Class: OpenLayers.Ajax.Request
+ * *Deprecated*. Use <OpenLayers.Request> method instead.
*
* Inherit:
* - <OpenLayers.Ajax.Base>
Modified: sandbox/topp/geoext/lib/OpenLayers/Control/PanZoomBar.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Control/PanZoomBar.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Control/PanZoomBar.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -186,7 +186,7 @@
this.zoomStopHeight),
imgLocation + "zoombar.png",
"absolute", null, "crop");
- div.style.height = sz.h;
+ div.style.height = sz.h + "px";
} else {
div = OpenLayers.Util.createDiv(
'OpenLayers_Control_PanZoomBar_Zoombar' + this.map.id,
Modified: sandbox/topp/geoext/lib/OpenLayers/Control/Permalink.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Control/Permalink.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Control/Permalink.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -5,6 +5,7 @@
/**
* @requires OpenLayers/Control.js
+ * @requires OpenLayers/Control/ArgParser.js
*/
/**
Modified: sandbox/topp/geoext/lib/OpenLayers/Feature/Vector.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Feature/Vector.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Feature/Vector.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -80,7 +80,7 @@
OpenLayers.Feature.prototype.initialize.apply(this,
[null, null, attributes]);
this.lonlat = null;
- this.geometry = geometry;
+ this.geometry = geometry ? geometry : null;
this.state = null;
this.attributes = {};
if (attributes) {
@@ -113,9 +113,10 @@
* {<OpenLayers.Feature.Vector>} An exact clone of this vector feature.
*/
clone: function () {
- return new OpenLayers.Feature.Vector(this.geometry.clone(),
- this.attributes,
- this.style);
+ return new OpenLayers.Feature.Vector(
+ this.geometry ? this.geometry.clone() : null,
+ this.attributes,
+ this.style);
},
/**
Modified: sandbox/topp/geoext/lib/OpenLayers/Format/KML.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Format/KML.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Format/KML.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -9,6 +9,7 @@
* @requires OpenLayers/Geometry/LineString.js
* @requires OpenLayers/Geometry/Polygon.js
* @requires OpenLayers/Geometry/Collection.js
+ * @requires OpenLayers/Request/XMLHttpRequest.js
*/
/**
@@ -249,11 +250,9 @@
*
*/
fetchLink: function(href) {
- var request = new OpenLayers.Ajax.Request(href,
- {method: 'get', asynchronous: false });
-
- if (request && request.transport) {
- return request.transport.responseText;
+ var request = OpenLayers.Request.GET({url: href, async: false});
+ if (request) {
+ return request.responseText;
}
},
@@ -550,9 +549,9 @@
if (inlineStyleNode) {
var inlineStyle= this.parseStyle(inlineStyleNode);
if (inlineStyle) {
- feature.style = OpenLayers.Util.extend({},
- feature.style);
- OpenLayers.Util.extend(feature.style, inlineStyle);
+ feature.style = OpenLayers.Util.extend(
+ feature.style, inlineStyle
+ );
}
}
Modified: sandbox/topp/geoext/lib/OpenLayers/Format/SLD/v1.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Format/SLD/v1.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Format/SLD/v1.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -227,6 +227,9 @@
if(graphic.href != undefined) {
symbolizer.externalGraphic = graphic.href;
}
+ if(graphic.rotation != undefined) {
+ symbolizer.rotation = graphic.rotation;
+ }
},
"ExternalGraphic": function(node, graphic) {
this.readChildNodes(node, graphic);
@@ -422,7 +425,9 @@
"stroke-width": "strokeWidth",
"stroke-linecap": "strokeLinecap",
"fill": "fillColor",
- "fill-opacity": "fillOpacity"
+ "fill-opacity": "fillOpacity",
+ "font-family": "fontFamily",
+ "font-size": "fontSize"
},
/**
@@ -729,6 +734,68 @@
value: obj.symbolizer[obj.key]
});
},
+ "TextSymbolizer": function(symbolizer) {
+ var node = this.createElementNSPlus("TextSymbolizer");
+ // add in optional Label
+ if(symbolizer.label != null) {
+ this.writeNode(node, "Label", symbolizer.label);
+ }
+ // add in optional Font
+ if(symbolizer.fontFamily != null ||
+ symbolizer.fontSize != null) {
+ this.writeNode(node, "Font", symbolizer);
+ }
+ // add in optional Fill
+ if(symbolizer.fillColor != null ||
+ symbolizer.fillOpacity != null) {
+ this.writeNode(node, "Fill", symbolizer);
+ }
+ return node;
+ },
+ "Font": function(symbolizer) {
+ var node = this.createElementNSPlus("Font");
+ // add in CssParameters
+ if(symbolizer.fontFamily) {
+ this.writeNode(
+ node, "CssParameter",
+ {symbolizer: symbolizer, key: "fontFamily"}
+ );
+ }
+ if(symbolizer.fontSize) {
+ this.writeNode(
+ node, "CssParameter",
+ {symbolizer: symbolizer, key: "fontSize"}
+ );
+ }
+ return node;
+ },
+ "Label": function(label) {
+ // only the simplest of ogc:expression handled
+ // {label: "some text and a ${propertyName}"}
+ var node = this.createElementNSPlus("Label");
+ var tokens = label.split("${");
+ node.appendChild(this.createTextNode(tokens[0]));
+ var item, last;
+ for(var i=1; i<tokens.length; i++) {
+ item = tokens[i];
+ last = item.indexOf("}");
+ if(last > 0) {
+ this.writeNode(
+ node, "ogc:PropertyName",
+ {property: item.substring(0, last)}
+ );
+ node.appendChild(
+ this.createTextNode(item.substring(++last))
+ );
+ } else {
+ // no ending }, so this is a literal ${
+ node.appendChild(
+ this.createTextNode("${" + item)
+ );
+ }
+ }
+ return node;
+ },
"PolygonSymbolizer": function(symbolizer) {
var node = this.createElementNSPlus("PolygonSymbolizer");
this.writeNode(node, "Fill", symbolizer);
Copied: sandbox/topp/geoext/lib/OpenLayers/Lang/it.js (from rev 7342, trunk/openlayers/lib/OpenLayers/Lang/it.js)
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Lang/it.js (rev 0)
+++ sandbox/topp/geoext/lib/OpenLayers/Lang/it.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -0,0 +1,120 @@
+/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
+ * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Lang.js
+ */
+
+/**
+ * Namespace: OpenLayers.Lang["it"]
+ * Dictionary for Italian. Keys for entries are used in calls to
+ * <OpenLayers.Lang.translate>. Entry bodies are normal strings or
+ * strings formatted for use with <OpenLayers.String.format> calls.
+ */
+OpenLayers.Lang.it = {
+
+ 'unhandledRequest': "Codice di ritorno della richiesta ${statusText}",
+
+ 'permalink': "Permalink",
+
+ 'overlays': "Overlays",
+
+ 'baseLayer': "Livello base",
+
+ 'sameProjection':
+ "La mini mappa funziona solamente se ha la stessa proiezione della mappa principale",
+
+ 'readNotImplemented': "Lettura non implementata.",
+
+ 'writeNotImplemented': "Scrittura non implementata.",
+
+ 'noFID': "Impossibile aggiornare un elemento grafico che non abbia il FID.",
+
+ 'errorLoadingGML': "Errore nel caricamento del file GML ${url}",
+
+ 'browserNotSupported':
+ "Il tuo browser non supporta il rendering vettoriale. I renderizzatore attualemnte supportati sono:\n${renderers}",
+
+ 'componentShouldBe': "addFeatures : il componente dovrebbe essere di tipo ${geomType}",
+
+ // console message
+ 'getFeatureError':
+ "getFeatureFromEvent chiamata su di un livello senza renderizzatore. Ciò significa che " +
+ "il livello è stato cancellato, ma non i gestori associati ad esso.",
+
+ // console message
+ 'minZoomLevelError':
+ "La proprietà minZoomLevel è da utilizzare solamente " +
+ "con livelli che abbiano FixedZoomLevels. Il fatto che " +
+ "questo livello wfs controlli la proprietà minZoomLevel è " +
+ "un retaggio del passato. Non possiamo comunque rimuoverla " +
+ "senza rompere le vecchie applicazioni che dipendono su di essa." +
+ "Quindi siamo costretti a deprecarla -- minZoomLevel " +
+ "e sarà rimossa dalla vesione 3.0. Si prega di utilizzare i " +
+ "settaggi di risoluzione min/max come descritto qui: " +
+ "http://trac.openlayers.org/wiki/SettingZoomLevels",
+
+ 'commitSuccess': "Transazione WFS: SUCCESS ${response}",
+
+ 'commitFailed': "Transazione WFS: FAILED ${response}",
+
+ 'googleWarning':
+ "Il livello Google non è riuscito a caricare correttamente.<br><br>" +
+ "Per evitare questo messaggio, seleziona un nuovo BaseLayer " +
+ "nel selettore di livelli nell'angolo in alto a destra.<br><br>" +
+ "Più precisamente, ciò accade perchè la libreria Google Maps " +
+ "non è stata inclusa nella pagina, oppure non contiene la " +
+ "corretta API key per il tuo sito.<br><br>" +
+ "Sviluppatori: Per aiuto su come farlo funzionare correttamente, " +
+ "<a href='http://trac.openlayers.org/wiki/Google' " +
+ "target='_blank'>clicca qui</a>",
+
+ 'getLayerWarning':
+ "Il livello ${layerType} non è riuscito a caricare correttamente.<br><br>" +
+ "Per evitare questo messaggio, seleziona un nuovo BaseLayer " +
+ "nel selettore di livelli nell'angolo in alto a destra.<br><br>" +
+ "Più precisamente, ciò accade perchè la libreria ${layerLib} " +
+ "non è stata inclusa nella pagina.<br><br>" +
+ "Sviluppatori: Per aiuto su come farlo funzionare correttamente, " +
+ "<a href='http://trac.openlayers.org/wiki/${layerLib}' " +
+ "target='_blank'>clicca qui</a>",
+
+ 'scale': "Scala = 1 : ${scaleDenom}",
+
+ // console message
+ 'layerAlreadyAdded':
+ "Stai cercando di aggiungere il livello: ${layerName} alla mappa, ma tale livello è già stato aggiunto.",
+
+ // console message
+ 'reprojectDeprecated':
+ "Stai utilizzando l'opzione 'reproject' sul livello ${layerName}. " +
+ "Questa opzione è deprecata: il suo utilizzo è stato introdotto per" +
+ "supportare il disegno dei dati sopra mappe commerciali, ma tale " +
+ "funzionalità dovrebbe essere ottenuta tramite l'utilizzo della proiezione " +
+ "Spherical Mercator. Per maggiori informazioni consultare qui " +
+ "http://trac.openlayers.org/wiki/SphericalMercator.",
+
+ // console message
+ 'methodDeprecated':
+ "Questo metodo è stato deprecato e sarà rimosso dalla versione 3.0. " +
+ "Si prega di utilizzare il metodo ${newMethod} in alternativa.",
+
+ // console message
+ 'boundsAddError': "Devi specificare i valori di x e y alla funzione add.",
+
+ // console message
+ 'lonlatAddError': "Devi specificare i valori di lon e lat alla funzione add.",
+
+ // console message
+ 'pixelAddError': "Devi specificare i valori di x e y alla funzione add.",
+
+ // console message
+ 'unsupportedGeometryType': "Tipo di geometria non supportata: ${geomType}",
+
+ // console message
+ 'pagePositionFailed':
+ "OpenLayers.Util.pagePosition fallita: l'elemento con id ${elemId} è posizionato in modo errato.",
+
+ 'end': ''
+};
Copied: sandbox/topp/geoext/lib/OpenLayers/Lang/pt-BR.js (from rev 7342, trunk/openlayers/lib/OpenLayers/Lang/pt-BR.js)
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Lang/pt-BR.js (rev 0)
+++ sandbox/topp/geoext/lib/OpenLayers/Lang/pt-BR.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -0,0 +1,122 @@
+/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
+ * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Lang.js
+ */
+
+/**
+ * Namespace: OpenLayers.Lang["pt-BR"]
+ * Dictionary for Brazilian Portuguese. Keys for entries are used in calls to
+ * <OpenLayers.Lang.translate>. Entry bodies are normal strings or
+ * strings formatted for use with <OpenLayers.String.format> calls.
+ */
+OpenLayers.Lang["pt-BR"] = {
+
+ 'unhandledRequest': "A requisição retornou um erro não tratado: ${statusText}",
+
+ 'permalink': "Link para essa página",
+
+ 'overlays': "Camadas de Sobreposição",
+
+ 'baseLayer': "Camada Base",
+
+ 'sameProjection':
+ "O mapa de referência só funciona quando ele está na mesma projeção do mapa principal",
+
+ 'readNotImplemented': "Leitura não implementada.",
+
+ 'writeNotImplemented': "Escrita não implementada.",
+
+ 'noFID': "Não é possÃvel atualizar uma feição que não tenha um FID.",
+
+ 'errorLoadingGML': "Erro ao carregar o arquivo GML ${url}",
+
+ 'browserNotSupported':
+ "Seu navegador não suporta renderização de vetores. Os renderizadores suportados atualmente são:\n${renderers}",
+
+ 'componentShouldBe': "addFeatures: o componente deve ser do tipo ${geomType}",
+
+ // console message
+ 'getFeatureError':
+ "getFeatureFromEvent foi executado mas nenhum renderizador foi encontrado. " +
+ "Isso pode indicar que você destruiu uma camana, mas não o handler associado a ela.",
+
+ // console message
+ 'minZoomLevelError':
+ "A propriedade minZoomLevel é de uso restrito das camadas "+
+ "descendentes de FixedZoomLevels. A verificação dessa propriedade " +
+ "pelas camadas wfs é um resÃduo do passado. Não podemos, entretanto " +
+ "não é possÃvel removê-la sem possÃvelmente quebrar o funcionamento " +
+ "de aplicações OL que possuem depência com ela. Portanto estamos " +
+ "tornando seu uso obsoleto -- a verificação desse atributo será " +
+ "removida na versão 3.0. Ao invés, use as opções de resolução " +
+ "min/max como descrito em: " +
+ "http://trac.openlayers.org/wiki/SettingZoomLevels",
+
+ 'commitSuccess': "Transação WFS : SUCESSO ${response}",
+
+ 'commitFailed': "Transação WFS : ERRO ${response}",
+
+ 'googleWarning':
+ "Não foi possÃvel carregar a camada Google corretamente.<br><br>" +
+ "Para se livrar dessa mensagem, selecione uma nova Camada Base, " +
+ "na ferramenta de alternação de camadas localização do canto " +
+ "superior direito.<br><br>" +
+ "Muito provavelmente, isso foi causado porque o script da " +
+ "biblioteca do Google Maps não foi incluÃdo, ou porque ele não " +
+ "contém a chave correta da API para o seu site.<br><br>" +
+ "Desenvolvedores: Para obter ajuda em solucionar esse problema " +
+ "<a href='http://trac.openlayers.org/wiki/Google' " +
+ "target='_blank'>cliquem aqui</a>",
+
+ 'getLayerWarning':
+ "Não foi possÃvel carregar a camada ${layerType} corretamente.<br><br>" +
+ "Para se livrar dessa mensagem, selecione uma nova Camada Base, " +
+ "na ferramenta de alternação de camadas localização do canto " +
+ "superior direito.<br><br>" +
+ "Muito provavelmente, isso foi causado porque o script da " +
+ "biblioteca ${layerLib} não foi incluÃdo corretamente.<br><br>" +
+ "Desenvolvedores: Para obter ajuda em solucionar esse problema " +
+ "<a href='http://trac.openlayers.org/wiki/${layerLib}' " +
+ "target='_blank'>cliquem aqui</a>",
+
+ 'scale': "Escala = 1 : ${scaleDenom}",
+
+ // console message
+ 'layerAlreadyAdded':
+ "Você tentou adicionar a camada: ${layerName} ao mapa, mas ela já foi adicionada",
+
+ // console message
+ 'reprojectDeprecated':
+ "Você está usando a opção 'reproject' na camada ${layerName}. " +
+ "Essa opção está obsoleta: seu uso foi projetado para suportar " +
+ "a visualização de dados sobre bases de mapas comerciais, " +
+ "entretanto essa funcionalidade deve agora ser alcançada usando " +
+ "o suporte à projeção Mercator. Mais informação está disponÃvel em: " +
+ "http://trac.openlayers.org/wiki/SphericalMercator.",
+
+ // console message
+ 'methodDeprecated':
+ "Esse método está obsoleto e será removido na versão 3.0. " +
+ "Ao invés, por favor use ${newMethod}.",
+
+ // console message
+ 'boundsAddError': "Você deve informar ambos os valores x e y para a função add.",
+
+ // console message
+ 'lonlatAddError': "Você deve informar ambos os valores lon e lat para a função add.",
+
+ // console message
+ 'pixelAddError': "Você deve informar ambos os valores x e y para a função add.",
+
+ // console message
+ 'unsupportedGeometryType': "Tipo geométrico não suportado: ${geomType}.",
+
+ // console message
+ 'pagePositionFailed':
+ "OpenLayers.Util.pagePosition falhou: o elemento de id ${elemId} deve estar fora do lugar.",
+
+ 'end': ''
+};
Copied: sandbox/topp/geoext/lib/OpenLayers/Lang/sv-SE.js (from rev 7342, trunk/openlayers/lib/OpenLayers/Lang/sv-SE.js)
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Lang/sv-SE.js (rev 0)
+++ sandbox/topp/geoext/lib/OpenLayers/Lang/sv-SE.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -0,0 +1,121 @@
+/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
+ * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Lang.js
+ */
+
+/**
+ * Namespace: OpenLayers.Lang["sv-SE"]
+ * Dictionary for swedish (Sweden). Keys for entries are used in calls to
+ * <OpenLayers.Lang.translate>. Entry bodies are normal strings or
+ * strings formatted for use with <OpenLayers.String.format> calls.
+ */
+OpenLayers.Lang["sv-SE"] = {
+
+ 'unhandledRequest': "Ej hanterad fråga retur ${statusText}",
+
+ 'permalink': "Permalänk",
+
+ 'overlays': "Kartlager",
+
+ 'baseLayer': "Bakgrundskarta",
+
+ 'sameProjection':
+ "Översiktskartan fungerar endast när den har samma projektion som huvudkartan",
+
+ 'readNotImplemented': "Läsning ej implementerad.",
+
+ 'writeNotImplemented': "Skrivning ej implementerad.",
+
+ 'noFID': "Kan ej uppdatera feature (objekt) för vilket FID saknas.",
+
+ 'errorLoadingGML': "Fel i laddning av GML-fil ${url}",
+
+ 'browserNotSupported':
+ "Din webbläsare stöder inte vektorvisning. För närvarande stöds följande visning:\n${renderers}",
+
+ 'componentShouldBe': "addFeatures : komponenten skall vara en ${geomType}",
+
+ // console message
+ 'getFeatureError':
+ "getFeatureFromEvent anropad för lager utan utritning. Detta betyder oftast att man " +
+ "raderat ett lager, men inte en hanterare som är knuten till lagret.",
+
+ // console message
+ 'minZoomLevelError':
+ "Egenskapen minZoomLevel är endast avsedd att användas " +
+ "med lager med FixedZoomLevels. Att detta WFS-lager " +
+ "kontrollerar minZoomLevel är en relik från äldre versioner. " +
+ "Vi kan dock inte ta bort det utan att riskera att " +
+ "OL-baserade tillämpningar som använder detta slutar " +
+ "fungera. Därför är det satt som deprecated, minZoomLevel " +
+ "kommer att tas bort i version 3.0. Använd i stället " +
+ "inställning av min/max resolution som beskrivs här: " +
+ "http://trac.openlayers.org/wiki/SettingZoomLevels",
+
+ 'commitSuccess': "WFS-transaktion: LYCKADES ${response}",
+
+ 'commitFailed': "WFS-transaktion: MISSLYCKADES ${response}",
+
+ 'googleWarning':
+ "Google-lagret kunde inte laddas korrekt.<br><br>" +
+ "För att slippa detta meddelande, välj en annan bakgrundskarta " +
+ "i lagerväljaren i övre högra hörnet.<br><br>" +
+ "Sannolikt beror felet på att Google Maps-biblioteket " +
+ "inte är inkluderat på webbsidan eller på att sidan " +
+ "inte anger korrekt API-nyckel för webbplatsen.<br><br>" +
+ "Utvecklare: hjälp för att åtgärda detta, " +
+ "<a href='http://trac.openlayers.org/wiki/Google' " +
+ "target='_blank'>klicka här</a>.",
+
+ 'getLayerWarning':
+ "${layerType}-lagret kunde inte laddas korrekt.<br><br>" +
+ "För att slippa detta meddelande, välj en annan bakgrundskarta " +
+ "i lagerväljaren i övre högra hörnet.<br><br>" +
+ "Sannolikt beror felet på att ${layerLib}-biblioteket " +
+ "inte är inkluderat på webbsidan.<br><br>" +
+ "Utvecklare: hjälp för att åtgärda detta, " +
+ "<a href='http://trac.openlayers.org/wiki/${layerLib}' " +
+ "target='_blank'>klicka här</a>.",
+
+ 'scale': "<strong>Skala</strong> 1 : ${scaleDenom}",
+
+ // console message
+ 'layerAlreadyAdded':
+ "Du försökte lägga till lagret: ${layerName} på kartan, men det har lagts till tidigare",
+
+ // console message
+ 'reprojectDeprecated':
+ "Du använder inställningen 'reproject' på lagret ${layerName}. " +
+ "Denna inställning markerad som deprecated: den var avsedd " +
+ "att användas för att stödja visning av kartdata på kommersiella " +
+ "bakgrundskartor, men nu bör man i stället " +
+ "använda Spherical Mercator-stöd för den funktionaliteten. " +
+ "Mer information finns " +
+ "på http://trac.openlayers.org/wiki/SphericalMercator.",
+
+ // console message
+ 'methodDeprecated':
+ "Denna metod är markerad som deprecated och kommer att tas bort i 3.0. " +
+ "Använd ${newMethod} i stället.",
+
+ // console message
+ 'boundsAddError': "Du måste skicka både x- och y-värde till funktionen add.",
+
+ // console message
+ 'lonlatAddError': "Du måste skicka både lon- och lat-värde till funktionen add.",
+
+ // console message
+ 'pixelAddError': "Du måste skicka både x- och y-värde till funktionen add.",
+
+ // console message
+ 'unsupportedGeometryType': "Stöd saknas för geometritypen: ${geomType}",
+
+ // console message
+ 'pagePositionFailed':
+ "OpenLayers.Util.pagePosition misslyckades: elementet med id ${elemId} kan placeras fel.",
+
+ 'end': ''
+};
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/GML.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/GML.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/GML.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -4,7 +4,7 @@
/**
* @requires OpenLayers/Layer/Vector.js
- * @requires OpenLayers/Ajax.js
+ * @requires OpenLayers/Request/XMLHttpRequest.js
*/
/**
@@ -100,7 +100,12 @@
*/
loadGML: function() {
if (!this.loaded) {
- var results = OpenLayers.loadURL(this.url, null, this, this.requestSuccess, this.requestFailure);
+ OpenLayers.Request.GET({
+ url: this.url,
+ success: this.requestSuccess,
+ failure: this.requestFailure,
+ scope: this
+ });
this.loaded = true;
}
},
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/GeoRSS.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/GeoRSS.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/GeoRSS.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -5,7 +5,7 @@
/**
* @requires OpenLayers/Layer/Markers.js
- * @requires OpenLayers/Ajax.js
+ * @requires OpenLayers/Request/XMLHttpRequest.js
*/
/**
@@ -100,7 +100,11 @@
loadRSS: function() {
if (!this.loaded) {
this.events.triggerEvent("loadstart");
- OpenLayers.loadURL(this.location, null, this, this.parseData);
+ OpenLayers.Request.GET({
+ url: this.location,
+ success: this.parseData,
+ scope: this
+ });
this.loaded = true;
}
},
@@ -127,7 +131,7 @@
* Parse the data returned from the Events call.
*
* Parameters:
- * ajaxRequest - {XMLHttpRequest}
+ * ajaxRequest - {<OpenLayers.Request.XMLHttpRequest>}
*/
parseData: function(ajaxRequest) {
var doc = ajaxRequest.responseXML;
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/Google.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/Google.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/Google.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -189,8 +189,27 @@
* evt - {Event}
*/
onMapResize: function() {
- this.mapObject.checkResize();
+ if(this.visibility) {
+ this.mapObject.checkResize();
+ } else {
+ this.windowResized = true;
+ }
},
+
+ /**
+ * Method: display
+ * Hide or show the layer
+ *
+ * Parameters:
+ * display - {Boolean}
+ */
+ display: function(display) {
+ OpenLayers.Layer.EventPane.prototype.display.apply(this, arguments);
+ if(this.div.style.display == "block" && this.windowResized) {
+ this.mapObject.checkResize();
+ this.windowResized = false;
+ }
+ },
/**
* APIMethod: getZoomForExtent
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/Grid.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/Grid.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -353,7 +353,7 @@
var minCols = Math.ceil(viewSize.w/this.tileSize.w) +
Math.max(1, 2 * this.buffer);
- var extent = this.map.getMaxExtent();
+ var extent = this.maxExtent;
var resolution = this.map.getResolution();
var tileLayout = this.calculateGridLayout(bounds, extent, resolution);
@@ -719,7 +719,7 @@
* {<OpenLayers.Bounds>} Bounds of the tile at the given pixel location.
*/
getTileBounds: function(viewPortPx) {
- var maxExtent = this.map.getMaxExtent();
+ var maxExtent = this.maxExtent;
var resolution = this.getResolution();
var tileMapWidth = resolution * this.tileSize.w;
var tileMapHeight = resolution * this.tileSize.h;
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/KaMap.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/KaMap.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/KaMap.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -64,13 +64,9 @@
var newArguments = [];
newArguments.push(name, url, params, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
- this.params = (params ? params : {});
- if (params) {
- OpenLayers.Util.applyDefaults(
- this.params,
- this.DEFAULT_PARAMS
- );
- }
+ this.params = OpenLayers.Util.applyDefaults(
+ this.params, this.DEFAULT_PARAMS
+ );
},
/**
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/MapGuide.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/MapGuide.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/MapGuide.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -3,7 +3,7 @@
* full text of the license. */
/**
- * @requires OpenLayers/Ajax.js
+ * @requires OpenLayers/Request/XMLHttpRequest.js
* @requires OpenLayers/Layer/Grid.js
*/
@@ -202,12 +202,10 @@
getVisParams.mapName = this.params.mapName;
getVisParams.format = 'text/xml';
getVisParams = OpenLayers.Util.extend(getVisParams, params);
-
- new OpenLayers.Ajax.Request(this.url,
- { parameters: getVisParams,
- method: 'get',
- asynchronous: false //must be synchronous call to return control here
- });
+
+ OpenLayers.Request.GET({
+ url: this.url, params: getVisParams, async: false
+ });
}
//construct the full URL
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/MapServer.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/MapServer.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/MapServer.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -42,12 +42,9 @@
newArguments.push(name, url, params, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
- if (arguments.length > 0) {
- OpenLayers.Util.applyDefaults(
- this.params,
- this.DEFAULT_PARAMS
- );
- }
+ this.params = OpenLayers.Util.applyDefaults(
+ this.params, this.DEFAULT_PARAMS
+ );
// unless explicitly set in options, if the layer is transparent,
// it will be an overlay
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/Text.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/Text.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/Text.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -5,7 +5,7 @@
/**
* @requires OpenLayers/Layer/Markers.js
- * @requires OpenLayers/Ajax.js
+ * @requires OpenLayers/Request/XMLHttpRequest.js
*/
/**
@@ -109,8 +109,12 @@
};
this.events.triggerEvent("loadstart");
- OpenLayers.loadURL(this.location, null,
- this, this.parseData, onFail);
+ OpenLayers.Request.GET({
+ url: this.location,
+ success: this.parseData,
+ failure: onFail,
+ scope: this
+ });
this.loaded = true;
}
}
@@ -137,7 +141,7 @@
* Method: parseData
*
* Parameters:
- * ajaxRequest - {XMLHttpRequest}
+ * ajaxRequest - {<OpenLayers.Request.XMLHttpRequest>}
*/
parseData: function(ajaxRequest) {
var text = ajaxRequest.responseText;
@@ -170,9 +174,19 @@
}
// FIXME: At the moment, we only use this if we have an
- // externalGraphic, because icon has no setOffset API Method.
- if (feature.style.graphicXOffset !== null
- && feature.style.graphicYOffset !== null) {
+ // externalGraphic, because icon has no setOffset API Method.
+ /**
+ * FIXME FIRST!!
+ * The Text format does all sorts of parseFloating
+ * The result of a parseFloat for a bogus string is NaN. That
+ * means the three possible values here are undefined, NaN, or a
+ * number. The previous check was an identity check for null. This
+ * means it was failing for all undefined or NaN. A slightly better
+ * check is for undefined. An even better check is to see if the
+ * value is a number (see #1441).
+ */
+ if (feature.style.graphicXOffset !== undefined
+ && feature.style.graphicYOffset !== undefined) {
iconOffset = new OpenLayers.Pixel(
feature.style.graphicXOffset,
feature.style.graphicYOffset);
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/Vector.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/Vector.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/Vector.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -45,6 +45,15 @@
* - *featuresadded* Triggered after features are added. The event
* object passed to listeners will have a *features* property with a
* reference to an array of added features.
+ * - *beforefeatureremoved* Triggered before a feature is removed. Listeners
+ * will receive an object with a *feature* property referencing the
+ * feature to be removed.
+ * - *featureremoved* Triggerd after a feature is removed. The event
+ * object passed to listeners will have a *feature* property with a
+ * reference to the removed feature.
+ * - *featuresremoved* Triggered after features are removed. The event
+ * object passed to listeners will have a *features* property with a
+ * reference to an array of removed features.
* - *featureselected* Triggered after a feature is selected. Listeners
* will receive an object with a *feature* property referencing the
* selected feature.
@@ -61,8 +70,9 @@
* Listeners will receive an object with a *feature* property referencing
* the modified feature.
*/
- EVENT_TYPES: ["beforefeatureadded", "featureadded",
- "featuresadded", "featureselected", "featureunselected",
+ EVENT_TYPES: ["beforefeatureadded", "featureadded", "featuresadded",
+ "beforefeatureremoved", "featureremoved", "featuresremoved",
+ "featureselected", "featureunselected",
"beforefeaturemodified", "featuremodified", "afterfeaturemodified"],
/**
@@ -191,8 +201,6 @@
* Destroy this layer
*/
destroy: function() {
- OpenLayers.Layer.prototype.destroy.apply(this, arguments);
-
this.destroyFeatures();
this.features = null;
this.selectedFeatures = null;
@@ -202,6 +210,7 @@
this.renderer = null;
this.geometryType = null;
this.drawn = null;
+ OpenLayers.Layer.prototype.destroy.apply(this, arguments);
},
/**
@@ -367,14 +376,27 @@
*
* Parameters:
* features - {Array(<OpenLayers.Feature.Vector>)}
+ * options - {Object}
*/
- removeFeatures: function(features) {
+ removeFeatures: function(features, options) {
if (!(features instanceof Array)) {
features = [features];
}
+ if (features.length <= 0) {
+ return;
+ }
+ var notify = !options || !options.silent;
+
for (var i = features.length - 1; i >= 0; i--) {
var feature = features[i];
+
+ if (notify) {
+ this.events.triggerEvent("beforefeatureremoved", {
+ feature: feature
+ });
+ }
+
this.features = OpenLayers.Util.removeItem(this.features, feature);
if (feature.geometry) {
@@ -386,7 +408,17 @@
if (OpenLayers.Util.indexOf(this.selectedFeatures, feature) != -1){
OpenLayers.Util.removeItem(this.selectedFeatures, feature);
}
+
+ if (notify) {
+ this.events.triggerEvent("featureremoved", {
+ feature: feature
+ });
+ }
}
+
+ if (notify) {
+ this.events.triggerEvent("featuresremoved", {features: features});
+ }
},
/**
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/VirtualEarth.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/VirtualEarth.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/VirtualEarth.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -95,8 +95,8 @@
// create div and set to same size as map
var veDiv = OpenLayers.Util.createDiv(this.name);
var sz = this.map.getSize();
- veDiv.style.width = sz.w;
- veDiv.style.height = sz.h;
+ veDiv.style.width = sz.w + "px";
+ veDiv.style.height = sz.h + "px";
this.div.appendChild(veDiv);
try { // crash prevention
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/WFS.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/WFS.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/WFS.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -138,11 +138,10 @@
this.options.geometry_column = "the_geom";
}
- this.params = params;
- OpenLayers.Util.applyDefaults(
- this.params,
- OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
- );
+ this.params = OpenLayers.Util.applyDefaults(
+ params,
+ OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
+ );
this.url = url;
},
@@ -456,21 +455,14 @@
}
var data = this.writer.write(this.features);
-
- var url = this.url;
- var success = OpenLayers.Function.bind(this.commitSuccess, this);
-
- var failure = OpenLayers.Function.bind(this.commitFailure, this);
-
- // from prototype.js
- new OpenLayers.Ajax.Request(url,
- { method: 'post',
- postBody: data,
- onComplete: success,
- onFailure: failure
- }
- );
+ OpenLayers.Request.POST({
+ url: this.url,
+ data: data,
+ success: this.commitSuccess,
+ failure: this.commitFailure,
+ scope: this
+ });
},
/**
Modified: sandbox/topp/geoext/lib/OpenLayers/Layer/WorldWind.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Layer/WorldWind.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Layer/WorldWind.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -54,13 +54,9 @@
var newArguments = [];
newArguments.push(name, url, params, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
- this.params = (params ? params : {});
- if (params) {
- OpenLayers.Util.applyDefaults(
- this.params,
- this.DEFAULT_PARAMS
- );
- }
+ this.params = OpenLayers.Util.applyDefaults(
+ this.params, this.DEFAULT_PARAMS
+ );
},
/**
* Method: addTile
Modified: sandbox/topp/geoext/lib/OpenLayers/Map.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Map.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Map.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -1340,11 +1340,7 @@
* false.
*/
pan: function(dx, dy, options) {
- // this should be pushed to applyDefaults and extend
- if (!options) {
- options = {};
- }
- OpenLayers.Util.applyDefaults(options, {
+ options = OpenLayers.Util.applyDefaults(options, {
animate: true,
dragging: false
});
Modified: sandbox/topp/geoext/lib/OpenLayers/Renderer/SVG.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Renderer/SVG.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Renderer/SVG.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -222,6 +222,12 @@
} else {
node.setAttributeNS(null, "r", style.pointRadius);
}
+
+ if (style.rotation) {
+ var rotation = OpenLayers.String.format(
+ "rotate(${0} ${1} ${2})", [style.rotation, x, y]);
+ node.setAttributeNS(null, "transform", rotation);
+ }
}
if (options.isFilled) {
Modified: sandbox/topp/geoext/lib/OpenLayers/Renderer/VML.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Renderer/VML.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Renderer/VML.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -98,11 +98,11 @@
setSize: function(size) {
OpenLayers.Renderer.prototype.setSize.apply(this, arguments);
- this.rendererRoot.style.width = this.size.w;
- this.rendererRoot.style.height = this.size.h;
+ this.rendererRoot.style.width = this.size.w + "px";
+ this.rendererRoot.style.height = this.size.h + "px";
- this.root.style.width = this.size.w;
- this.root.style.height = this.size.h;
+ this.root.style.width = this.size.w + "px";
+ this.root.style.height = this.size.h + "px";
},
/**
@@ -169,8 +169,9 @@
node.style.left = ((geometry.x/resolution)+xOffset).toFixed();
node.style.top = ((geometry.y/resolution)-(yOffset+height)).toFixed();
- node.style.width = width;
- node.style.height = height;
+ node.style.width = width + "px";
+ node.style.height = height + "px";
+ node.style.flip = "y";
// modify style/options for fill and stroke styling below
style.fillColor = "none";
@@ -209,11 +210,20 @@
fill.setAttribute("src", style.externalGraphic);
fill.setAttribute("type", "frame");
- node.style.flip = "y";
if (!(style.graphicWidth && style.graphicHeight)) {
fill.aspect = "atmost";
}
+
+ // additional rendering for rotated graphics
+ if (style.rotation) {
+ this.graphicRotate(node, xOffset, yOffset);
+ // make the fill fully transparent, because we now have
+ // the graphic as imagedata element. We cannot just remove
+ // the fill, because this is part of the hack described
+ // in graphicRotate
+ fill.setAttribute("opacity", 0);
+ }
}
if (fill.parentNode != node) {
node.appendChild(fill);
@@ -250,6 +260,112 @@
},
/**
+ * Method: graphicRotate
+ * If a point is to be styled with externalGraphic and rotation, VML fills
+ * cannot be used to display the graphic, because rotation of graphic
+ * fills is not supported by the VML implementation of Internet Explorer.
+ * This method creates a olv:imagedata element inside the VML node,
+ * DXImageTransform.Matrix and BasicImage filters for rotation and
+ * opacity, and a 3-step hack to remove rendering artefacts from the
+ * graphic and preserve the ability of graphics to trigger events.
+ * Finally, OpenLayers methods are used to determine the correct
+ * insertion point of the rotated image, because DXImageTransform.Matrix
+ * does the rotation without the ability to specify a rotation center
+ * point.
+ *
+ * Parameters:
+ * node - {DOMElement}
+ * xOffset - {Number} rotation center relative to image, x coordinate
+ * yOffset - {Number} rotation center relative to image, y coordinate
+ */
+ graphicRotate: function(node, xOffset, yOffset) {
+ var style = style || node._style;
+ var options = node._options;
+
+ var aspectRatio, size;
+ if (!(style.graphicWidth && style.graphicHeight)) {
+ // load the image to determine its size
+ var img = new Image();
+ img.onreadystatechange = OpenLayers.Function.bind(function() {
+ if(img.readyState == "complete" ||
+ img.readyState == "interactive") {
+ aspectRatio = img.width / img.height;
+ size = Math.max(style.pointRadius * 2,
+ style.graphicWidth || 0,
+ style.graphicHeight || 0);
+ xOffset = xOffset * aspectRatio;
+ style.graphicWidth = size * aspectRatio;
+ style.graphicHeight = size;
+ this.graphicRotate(node, xOffset, yOffset)
+ }
+ }, this);
+ img.src = style.externalGraphic;
+
+ // will be called again by the onreadystate handler
+ return;
+ } else {
+ size = Math.max(style.graphicWidth, style.graphicHeight);
+ aspectRatio = style.graphicWidth / style.graphicHeight;
+ }
+
+ var width = Math.round(style.graphicWidth || size * aspectRatio);
+ var height = Math.round(style.graphicHeight || size);
+ node.style.width = width + "px";
+ node.style.height = height + "px";
+
+ // Three steps are required to remove artefacts for images with
+ // transparent backgrounds (resulting from using DXImageTransform
+ // filters on svg objects), while preserving awareness for browser
+ // events on images:
+ // - Use the fill as usual (like for unrotated images) to handle
+ // events
+ // - specify an imagedata element with the same src as the fill
+ // - style the imagedata element with an AlphaImageLoader filter
+ // with empty src
+ var image = document.getElementById(node.id + "_image");
+ if (!image) {
+ image = this.createNode("olv:imagedata", node.id + "_image");
+ node.appendChild(image);
+ }
+ image.style.width = width + "px";
+ image.style.height = height + "px";
+ image.src = style.externalGraphic;
+ image.style.filter =
+ "progid:DXImageTransform.Microsoft.AlphaImageLoader(" +
+ "src='', sizingMethod='scale')";
+
+ var rotation = style.rotation * Math.PI / 180;
+ var sintheta = Math.sin(rotation);
+ var costheta = Math.cos(rotation);
+
+ // do the rotation on the image
+ var filter =
+ "progid:DXImageTransform.Microsoft.Matrix(M11=" + costheta +
+ ",M12=" + (-sintheta) + ",M21=" + sintheta + ",M22=" + costheta +
+ ",SizingMethod='auto expand')\n"
+
+ // set the opacity (needed for the imagedata)
+ var opacity = style.graphicOpacity || style.fillOpacity;
+ if (opacity && opacity != 1) {
+ filter +=
+ "progid:DXImageTransform.Microsoft.BasicImage(opacity=" +
+ opacity+")\n";
+ }
+ node.style.filter = filter;
+
+ // do the rotation again on a box, so we know the insertion point
+ var centerPoint = new OpenLayers.Geometry.Point(-xOffset, -yOffset);
+ var imgBox = new OpenLayers.Bounds(0, 0, width, height).toGeometry();
+ imgBox.rotate(style.rotation, centerPoint);
+ var imgBounds = imgBox.getBounds();
+
+ node.style.left = Math.round(
+ parseInt(node.style.left) + imgBounds.left) + "px";
+ node.style.top = Math.round(
+ parseInt(node.style.top) - imgBounds.bottom) + "px";
+ },
+
+ /**
* Method: postDraw
* Some versions of Internet Explorer seem to be unable to set fillcolor
* and strokecolor to "none" correctly before the fill node is appended to
@@ -295,10 +411,10 @@
(bbox.top/resolution).toFixed());
// Set the internal coordinate system to draw the path
- node.style.left = scaledBox.left;
- node.style.top = scaledBox.top;
- node.style.width = scaledBox.getWidth();
- node.style.height = scaledBox.getHeight();
+ node.style.left = scaledBox.left + "px";
+ node.style.top = scaledBox.top + "px";
+ node.style.width = scaledBox.getWidth() + "px";
+ node.style.height = scaledBox.getHeight() + "px";
node.coordorigin = scaledBox.left + " " + scaledBox.top;
node.coordsize = scaledBox.getWidth()+ " " + scaledBox.getHeight();
@@ -414,13 +530,13 @@
if(!isNaN(geometry.x)&& !isNaN(geometry.y)) {
var resolution = this.getResolution();
- node.style.left = (geometry.x /resolution).toFixed() - radius;
- node.style.top = (geometry.y /resolution).toFixed() - radius;
+ node.style.left = ((geometry.x /resolution).toFixed() - radius) + "px";
+ node.style.top = ((geometry.y /resolution).toFixed() - radius) + "px";
var diameter = radius * 2;
- node.style.width = diameter;
- node.style.height = diameter;
+ node.style.width = diameter + "px";
+ node.style.height = diameter + "px";
}
},
@@ -522,10 +638,10 @@
drawRectangle: function(node, geometry) {
var resolution = this.getResolution();
- node.style.left = geometry.x/resolution;
- node.style.top = geometry.y/resolution;
- node.style.width = geometry.width/resolution;
- node.style.height = geometry.height/resolution;
+ node.style.left = geometry.x/resolution + "px";
+ node.style.top = geometry.y/resolution + "px";
+ node.style.width = geometry.width/resolution + "px";
+ node.style.height = geometry.height/resolution + "px";
},
/**
Modified: sandbox/topp/geoext/lib/OpenLayers/Request.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Request.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Request.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -1,228 +1,266 @@
-/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
- * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
- * full text of the license. */
-
-/**
- * Namespace: OpenLayers.Request
- * The OpenLayers.Request namespace contains convenience methods for working
- * with XMLHttpRequests. These methods work with a cross-browser
- * W3C compliant <OpenLayers.Request.XMLHttpRequest> class.
- */
-OpenLayers.Request = {
-
- /**
- * Constant: DEFAULT_CONFIG
- * {Object} Default configuration for all requests.
- */
- DEFAULT_CONFIG: {
- method: "GET",
- url: window.location.href,
- async: true,
- user: undefined,
- password: undefined,
- params: null,
- proxy: OpenLayers.ProxyHost,
- headers: {},
- data: null,
- callback: function() {},
- scope: null
- },
-
- /**
- * APIMethod: issue
- * Create a new XMLHttpRequest object, open it, set any headers, bind
- * a callback to done state, and send any data.
- *
- * Parameters:
- * config - {Object} Object containing properties for configuring the
- * request. Allowed configuration properties are described below.
- * config.method - {String} One of GET, POST, PUT, DELETE, HEAD, or
- * OPTIONS. Default is GET.
- * config.url - {String} URL for the request.
- * config.async - {Boolean} Open an asynchronous request. Default is true.
- * config.user - {String} User for relevant authentication scheme. Set
- * to null to clear current user.
- * config.password - {String} Password for relevant authentication scheme.
- * Set to null to clear current password.
- * config.proxy - {String} Optional proxy. Defaults to
- * <OpenLayers.ProxyHost>.
- * config.params - {Object} Any key:value pairs to be appended to the
- * url as a query string. Assumes url doesn't already include a query
- * string or hash. Parameter values that are arrays will be
- * concatenated with a comma (note that this goes against form-encoding)
- * as is done with <OpenLayers.Util.getParameterString>.
- * config.headers - {Object} Object with header:value pairs to be set on
- * the request.
- * config.data - {Object} Any data to send with the request.
- * config.callback - {Function} Function to call when request is done.
- * To determine if the request failed, check request.status (200
- * indicates success).
- * config.scope - {Object} If callback is a public method on some object,
- * set the scope to that object.
- *
- * Returns:
- * {XMLHttpRequest} Request object. To abort the request before a response
- * is received, call abort() on the request object.
- */
- issue: function(config) {
- // apply default config - proxy host may have changed
- var defaultConfig = OpenLayers.Util.extend(
- this.DEFAULT_CONFIG,
- {proxy: OpenLayers.ProxyHost}
- );
- config = OpenLayers.Util.applyDefaults(config, defaultConfig);
-
- // create request, open, and set headers
- var request = new OpenLayers.Request.XMLHttpRequest();
- var url = config.url;
- if(config.params) {
- url += "?" + OpenLayers.Util.getParameterString(config.params);
- }
- if(config.proxy && (url.indexOf("http") == 0)) {
- url = config.proxy + encodeURIComponent(url);
- }
- request.open(
- config.method, url, config.async, config.user, config.password
- );
- for(var header in config.headers) {
- request.setRequestHeader(header, config.headers[header]);
- }
-
- // bind callback to readyState 4 (done)
- var complete = (config.scope) ?
- OpenLayers.Function.bind(config.callback, config.scope) :
- config.callback;
- request.onreadystatechange = function() {
- if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {
- complete(request);
- }
- }
-
- // send request (optionally with data) and return
- request.send(config.data);
- return request;
- },
-
- /**
- * APIMethod: GET
- * Send an HTTP GET request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to GET.
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties.
- *
- * Returns:
- * {XMLHttpRequest} Request object.
- */
- GET: function(config) {
- config = OpenLayers.Util.extend(config, {method: "GET"});
- return OpenLayers.Request.issue(config);
- },
-
- /**
- * APIMethod: POST
- * Send a POST request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to POST and "Content-Type" header set to "application/xml".
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties. The
- * default "Content-Type" header will be set to "application-xml" if
- * none is provided.
- *
- * Returns:
- * {XMLHttpRequest} Request object.
- */
- POST: function(config) {
- config = OpenLayers.Util.extend(config, {method: "POST"});
- // set content type to application/xml if it isn't already set
- config.headers = config.headers ? config.headers : {};
- if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
- config.headers["Content-Type"] = "application/xml";
- }
- return OpenLayers.Request.issue(config);
- },
-
- /**
- * APIMethod: PUT
- * Send an HTTP PUT request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to PUT and "Content-Type" header set to "application/xml".
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties. The
- * default "Content-Type" header will be set to "application-xml" if
- * none is provided.
- *
- * Returns:
- * {XMLHttpRequest} Request object.
- */
- PUT: function(config) {
- config = OpenLayers.Util.extend(config, {method: "PUT"});
- // set content type to application/xml if it isn't already set
- config.headers = config.headers ? config.headers : {};
- if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
- config.headers["Content-Type"] = "application/xml";
- }
- return OpenLayers.Request.issue(config);
- },
-
- /**
- * APIMethod: DELETE
- * Send an HTTP DELETE request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to DELETE.
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties.
- *
- * Returns:
- * {XMLHttpRequest} Request object.
- */
- DELETE: function(config) {
- config = OpenLayers.Util.extend(config, {method: "DELETE"});
- return OpenLayers.Request.issue(config);
- },
-
- /**
- * APIMethod: HEAD
- * Send an HTTP HEAD request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to HEAD.
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties.
- *
- * Returns:
- * {XMLHttpRequest} Request object.
- */
- HEAD: function(config) {
- config = OpenLayers.Util.extend(config, {method: "HEAD"});
- return OpenLayers.Request.issue(config);
- },
-
- /**
- * APIMethod: OPTIONS
- * Send an HTTP OPTIONS request. Additional configuration properties are
- * documented in the <issue> method, with the method property set
- * to OPTIONS.
- *
- * Parameters:
- * config - {Object} Object with properties for configuring the request.
- * See the <issue> method for documentation of allowed properties.
- *
- * Returns:
- * {XMLHttpRequest} Request object.
- */
- OPTIONS: function(config) {
- config = OpenLayers.Util.extend(config, {method: "OPTIONS"});
- return OpenLayers.Request.issue(config);
- }
-
-};
\ No newline at end of file
+/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
+ * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * Namespace: OpenLayers.Request
+ * The OpenLayers.Request namespace contains convenience methods for working
+ * with XMLHttpRequests. These methods work with a cross-browser
+ * W3C compliant <OpenLayers.Request.XMLHttpRequest> class.
+ */
+OpenLayers.Request = {
+
+ /**
+ * Constant: DEFAULT_CONFIG
+ * {Object} Default configuration for all requests.
+ */
+ DEFAULT_CONFIG: {
+ method: "GET",
+ url: window.location.href,
+ async: true,
+ user: undefined,
+ password: undefined,
+ params: null,
+ proxy: OpenLayers.ProxyHost,
+ headers: {},
+ data: null,
+ callback: function() {},
+ success: null,
+ failure: null,
+ scope: null
+ },
+
+ /**
+ * APIMethod: issue
+ * Create a new XMLHttpRequest object, open it, set any headers, bind
+ * a callback to done state, and send any data.
+ *
+ * Parameters:
+ * config - {Object} Object containing properties for configuring the
+ * request. Allowed configuration properties are described below.
+ * This object is modified and should not be reused.
+ *
+ * Allowed config properties:
+ * method - {String} One of GET, POST, PUT, DELETE, HEAD, or
+ * OPTIONS. Default is GET.
+ * url - {String} URL for the request.
+ * async - {Boolean} Open an asynchronous request. Default is true.
+ * user - {String} User for relevant authentication scheme. Set
+ * to null to clear current user.
+ * password - {String} Password for relevant authentication scheme.
+ * Set to null to clear current password.
+ * proxy - {String} Optional proxy. Defaults to
+ * <OpenLayers.ProxyHost>.
+ * params - {Object} Any key:value pairs to be appended to the
+ * url as a query string. Assumes url doesn't already include a query
+ * string or hash. Parameter values that are arrays will be
+ * concatenated with a comma (note that this goes against form-encoding)
+ * as is done with <OpenLayers.Util.getParameterString>.
+ * headers - {Object} Object with header:value pairs to be set on
+ * the request.
+ * data - {Object} Any data to send with the request.
+ * callback - {Function} Function to call when request is done.
+ * To determine if the request failed, check request.status (200
+ * indicates success).
+ * success - {Function} Optional function to call if request status is in
+ * the 200s. This will be called in addition to callback above and
+ * would typically only be used as an alternative.
+ * failure - {Function} Optional function to call if request status is not
+ * in the 200s. This will be called in addition to callback above and
+ * would typically only be used as an alternative.
+ * scope - {Object} If callback is a public method on some object,
+ * set the scope to that object.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object. To abort the request before a response
+ * is received, call abort() on the request object.
+ */
+ issue: function(config) {
+ // apply default config - proxy host may have changed
+ var defaultConfig = OpenLayers.Util.extend(
+ this.DEFAULT_CONFIG,
+ {proxy: OpenLayers.ProxyHost}
+ );
+ config = OpenLayers.Util.applyDefaults(config, defaultConfig);
+
+ // create request, open, and set headers
+ var request = new OpenLayers.Request.XMLHttpRequest();
+ var url = config.url;
+ if(config.params) {
+ url += "?" + OpenLayers.Util.getParameterString(config.params);
+ }
+ if(config.proxy && (url.indexOf("http") == 0)) {
+ url = config.proxy + encodeURIComponent(url);
+ }
+ request.open(
+ config.method, url, config.async, config.user, config.password
+ );
+ for(var header in config.headers) {
+ request.setRequestHeader(header, config.headers[header]);
+ }
+
+ // bind callbacks to readyState 4 (done)
+ var complete = (config.scope) ?
+ OpenLayers.Function.bind(config.callback, config.scope) :
+ config.callback;
+
+ // optional success callback
+ var success;
+ if(config.success) {
+ success = (config.scope) ?
+ OpenLayers.Function.bind(config.success, config.scope) :
+ config.success;
+ }
+
+ // optional failure callback
+ var failure;
+ if(config.failure) {
+ failure = (config.scope) ?
+ OpenLayers.Function.bind(config.failure, config.scope) :
+ config.failure;
+ }
+
+ request.onreadystatechange = function() {
+ if(request.readyState == OpenLayers.Request.XMLHttpRequest.DONE) {
+ complete(request);
+ if(success && request.status >= 200 && request.status < 300) {
+ success(request);
+ }
+ if(failure && (request.status < 200 || request.status >= 300)) {
+ failure(request);
+ }
+ }
+ }
+
+ // send request (optionally with data) and return
+ request.send(config.data);
+ return request;
+ },
+
+ /**
+ * APIMethod: GET
+ * Send an HTTP GET request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to GET.
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties.
+ * This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ GET: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "GET"});
+ return OpenLayers.Request.issue(config);
+ },
+
+ /**
+ * APIMethod: POST
+ * Send a POST request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to POST and "Content-Type" header set to "application/xml".
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties. The
+ * default "Content-Type" header will be set to "application-xml" if
+ * none is provided. This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ POST: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "POST"});
+ // set content type to application/xml if it isn't already set
+ config.headers = config.headers ? config.headers : {};
+ if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
+ config.headers["Content-Type"] = "application/xml";
+ }
+ return OpenLayers.Request.issue(config);
+ },
+
+ /**
+ * APIMethod: PUT
+ * Send an HTTP PUT request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to PUT and "Content-Type" header set to "application/xml".
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties. The
+ * default "Content-Type" header will be set to "application-xml" if
+ * none is provided. This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ PUT: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "PUT"});
+ // set content type to application/xml if it isn't already set
+ config.headers = config.headers ? config.headers : {};
+ if(!("CONTENT-TYPE" in OpenLayers.Util.upperCaseObject(config.headers))) {
+ config.headers["Content-Type"] = "application/xml";
+ }
+ return OpenLayers.Request.issue(config);
+ },
+
+ /**
+ * APIMethod: DELETE
+ * Send an HTTP DELETE request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to DELETE.
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties.
+ * This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ DELETE: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "DELETE"});
+ return OpenLayers.Request.issue(config);
+ },
+
+ /**
+ * APIMethod: HEAD
+ * Send an HTTP HEAD request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to HEAD.
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties.
+ * This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ HEAD: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "HEAD"});
+ return OpenLayers.Request.issue(config);
+ },
+
+ /**
+ * APIMethod: OPTIONS
+ * Send an HTTP OPTIONS request. Additional configuration properties are
+ * documented in the <issue> method, with the method property set
+ * to OPTIONS.
+ *
+ * Parameters:
+ * config - {Object} Object with properties for configuring the request.
+ * See the <issue> method for documentation of allowed properties.
+ * This object is modified and should not be reused.
+ *
+ * Returns:
+ * {XMLHttpRequest} Request object.
+ */
+ OPTIONS: function(config) {
+ config = OpenLayers.Util.extend(config, {method: "OPTIONS"});
+ return OpenLayers.Request.issue(config);
+ }
+
+};
Modified: sandbox/topp/geoext/lib/OpenLayers/Style.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Style.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Style.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -353,4 +353,4 @@
* {Array} prefixes of the sld symbolizers. These are the
* same as the main geometry types
*/
-OpenLayers.Style.SYMBOLIZER_PREFIXES = ['Point', 'Line', 'Polygon'];
+OpenLayers.Style.SYMBOLIZER_PREFIXES = ['Point', 'Line', 'Polygon', 'Text'];
Modified: sandbox/topp/geoext/lib/OpenLayers/Tile/WFS.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Tile/WFS.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Tile/WFS.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -5,6 +5,7 @@
/**
* @requires OpenLayers/Tile.js
+ * @requires OpenLayers/Request/XMLHttpRequest.js
*/
/**
@@ -32,7 +33,7 @@
/**
* Property: request
- * {OpenLayers.Ajax.Request}
+ * {<OpenLayers.Request.XMLHttpRequest>}
*/
request: null,
@@ -100,8 +101,7 @@
/**
* Method: loadFeaturesForRegion
- * get the full request string from the ds and the tile params
- * and call the AJAX loadURL().
+ * Abort any pending requests and issue another request for data.
*
* Input are function pointers for what to do on success and failure.
*
@@ -113,7 +113,12 @@
if(this.request) {
this.request.abort();
}
- this.request = OpenLayers.loadURL(this.url, null, this, success);
+ this.request = OpenLayers.Request.GET({
+ url: this.url,
+ success: success,
+ failure: failure,
+ scope: this
+ });
},
/**
@@ -122,7 +127,7 @@
* layer.addFeatures in vector mode, addResults otherwise.
*
* Parameters:
- * request - {XMLHttpRequest}
+ * request - {<OpenLayers.Request.XMLHttpRequest>}
*/
requestSuccess:function(request) {
if (this.features) {
Modified: sandbox/topp/geoext/lib/OpenLayers/Util.js
===================================================================
--- sandbox/topp/geoext/lib/OpenLayers/Util.js 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/lib/OpenLayers/Util.js 2008-06-10 21:48:50 UTC (rev 7344)
@@ -49,7 +49,8 @@
* {Object} The destination object.
*/
OpenLayers.Util.extend = function(destination, source) {
- if(destination && source) {
+ destination = destination || {};
+ if(source) {
for(var property in source) {
var value = source[property];
if(value !== undefined) {
@@ -427,8 +428,9 @@
"relative", border);
if (OpenLayers.Util.alphaHack()) {
-
- div.style.display = "inline-block";
+ if(div.style.display != "none") {
+ div.style.display = "inline-block";
+ }
if (sizing == null) {
sizing = "scale";
}
@@ -521,7 +523,7 @@
* in place and returned by this function.
*/
OpenLayers.Util.applyDefaults = function (to, from) {
-
+ to = to || {};
/*
* FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
* prototype object" when calling hawOwnProperty if the source object is an
@@ -1363,7 +1365,7 @@
*/
OpenLayers.Util.getRenderedDimensions = function(contentHTML, size) {
- var w = h = null;
+ var w, h;
// create temp container div with restricted size
var container = document.createElement("div");
@@ -1374,9 +1376,11 @@
//fix a dimension, if specified.
if (size) {
if (size.w) {
- w = container.style.width = size.w;
+ w = size.w;
+ container.style.width = w + "px";
} else if (size.h) {
- h = container.style.height = size.h;
+ h = size.h
+ container.style.height = h + "px";
}
}
Modified: sandbox/topp/geoext/tests/Ajax.html
===================================================================
--- sandbox/topp/geoext/tests/Ajax.html 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/tests/Ajax.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -4,13 +4,21 @@
<script type="text/javascript">
function test_Ajax_loadUrl(t) {
- t.plan(1);
- var req = OpenLayers.Ajax.Request;
- OpenLayers.ProxyHost = "/?url=";
- OpenLayers.Ajax.Request.prototype.request = function(uri) {
- t.eq(uri, "/?url=http%3A%2F%2Fexample.com%2F%3Fformat%3Dimage%2Bkml", "URI matches what we expect from loadurl");
- }
- OpenLayers.loadURL("http://example.com/?format=image+kml");
+ t.plan(5);
+ var _get = OpenLayers.Request.GET;
+ var caller = {};
+ var onComplete = function() {};
+ var onFailure = function() {};
+ var params = {};
+ OpenLayers.Request.GET = function(config) {
+ t.eq(config.url, "http://example.com/?format=image+kml", "correct url")
+ t.eq(config.params, params, "correct params");
+ t.eq(config.scope, caller, "correct scope");
+ t.ok(config.success === onComplete, "correct success callback");
+ t.ok(config.failure === onFailure, "correct failure callback");
+ };
+ OpenLayers.loadURL("http://example.com/?format=image+kml", params, caller, onComplete, onFailure);
+ OpenLayers.Request.GET = _get;
}
</script>
</head>
Modified: sandbox/topp/geoext/tests/Feature/Vector.html
===================================================================
--- sandbox/topp/geoext/tests/Feature/Vector.html 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/tests/Feature/Vector.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -59,7 +59,7 @@
}
function test_Feature_Vector_clone(t) {
- t.plan(5);
+ t.plan(6);
var geometry = new OpenLayers.Geometry.Point(Math.random(),
Math.random());
@@ -79,6 +79,11 @@
"geometry.x property set properly");
t.eq(clone.geometry.y, geometry.y,
"geometry.y property set properly");
+
+ feature = new OpenLayers.Feature.Vector();
+ clone = feature.clone();
+ t.ok(clone instanceof OpenLayers.Feature.Vector,
+ "clone can clone geometry-less features");
}
Modified: sandbox/topp/geoext/tests/Format/SLD/v1_0_0.html
===================================================================
--- sandbox/topp/geoext/tests/Format/SLD/v1_0_0.html 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/tests/Format/SLD/v1_0_0.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -150,6 +150,42 @@
}
+ function test_writeTextSymbolizer(t) {
+ t.plan(1);
+ var parser = new OpenLayers.Format.SLD.v1_0_0();
+ var symbolizer = {
+ "Text": {
+ "label": "This is the ${city} in ${state}.",
+ "fontFamily": "Arial",
+ "fontSize": 10,
+ "fillColor": "blue"
+ }
+ };
+ var node = parser.writers["sld"]["TextSymbolizer"].apply(
+ parser, [symbolizer["Text"]]
+ );
+
+ var expected =
+ '<TextSymbolizer xmlns="http://www.opengis.net/sld">' +
+ '<Label>' +
+ 'This is the ' +
+ '<ogc:PropertyName xmlns:ogc="http://www.opengis.net/ogc">city</ogc:PropertyName>' +
+ ' in ' +
+ '<ogc:PropertyName xmlns:ogc="http://www.opengis.net/ogc">state</ogc:PropertyName>' +
+ '.' +
+ '</Label>' +
+ '<Font>' +
+ '<CssParameter name="font-family">Arial</CssParameter>' +
+ '<CssParameter name="font-size">10</CssParameter>' +
+ '</Font>' +
+ '<Fill>' +
+ '<CssParameter name="fill">blue</CssParameter>' +
+ '</Fill>' +
+ '</TextSymbolizer>';
+
+ t.xml_eq(node, expected, "TextSymbolizer correctly written");
+
+ }
</script>
</head>
Modified: sandbox/topp/geoext/tests/Layer/Vector.html
===================================================================
--- sandbox/topp/geoext/tests/Layer/Vector.html 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/tests/Layer/Vector.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -67,7 +67,7 @@
}
function test_Layer_Vector_removeFeatures(t) {
- t.plan(3);
+ t.plan(6);
var layer = new OpenLayers.Layer.Vector(name);
@@ -75,7 +75,7 @@
var pointFeature1 = new OpenLayers.Feature.Vector(layer, point1);
var point2 = new OpenLayers.Geometry.Point(-111.14, 45.78);
var pointFeature2 = new OpenLayers.Feature.Vector(layer, point2);
-
+
layer.addFeatures([pointFeature1, pointFeature2]);
var features = layer.removeFeatures([pointFeature1]);
@@ -88,7 +88,36 @@
t.ok(layer.features.length == 0,
"OpenLayers.Layer.Vector.removeFeatures(layer.features) removes all feature from the features array");
- }
+
+ // 3 tests
+ layer.events.register('beforefeatureremoved', null, function(obj) {
+ t.ok(pointFeature1 == obj.feature,
+ "OpenLayers.Layer.Vector.removeFeatures triggers beforefeatureremoved with correct feature passed to callback");
+ });
+ layer.events.register('featureremoved', null, function(obj) {
+ t.ok(pointFeature1 == obj.feature,
+ "OpenLayers.Layer.Vector.removeFeatures triggers featureremoved with correct feature passed to callback");
+ });
+ layer.events.register('featuresremoved', null, function(obj) {
+ t.ok(pointFeature1 == obj.features[0],
+ "OpenLayers.Layer.Vector.removeFeatures triggers featuresremoved with correct features passed to callback");
+ });
+ layer.addFeatures([pointFeature1]);
+ layer.removeFeatures([pointFeature1]);
+
+ // 0 test
+ layer.events.register('beforefeatureremoved', null, function(obj) {
+ t.fail("OpenLayers.Layer.Vector.removeFeatures triggers beforefeatureremoved while it must not");
+ });
+ layer.events.register('featureremoved', null, function(obj) {
+ t.fail("OpenLayers.Layer.Vector.removeFeatures triggers featureremoved while it must not");
+ });
+ layer.events.register('featuresremoved', null, function(obj) {
+ t.fail("OpenLayers.Layer.Vector.removeFeatures triggers featuresremoved while it must not");
+ });
+ layer.addFeatures([pointFeature1]);
+ layer.removeFeatures([pointFeature1], {silent: true});
+ }
function test_Layer_Vector_drawFeature(t) {
t.plan(4);
Modified: sandbox/topp/geoext/tests/Renderer/VML.html
===================================================================
--- sandbox/topp/geoext/tests/Renderer/VML.html 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/tests/Renderer/VML.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -143,7 +143,48 @@
t.eq(node.style.width, (2 * radius) + "px", "width is correct");
t.eq(node.style.height, (2 * radius) + "px", "height is correct");
}
+
+ function test_VML_drawGraphic(t) {
+ if (!OpenLayers.Renderer.VML.prototype.supported()) {
+ t.plan(0);
+ return;
+ }
+
+ t.plan(6);
+
+ var r = new OpenLayers.Renderer.VML(document.body);
+ r.resolution = 1;
+
+ var node = document.createElement('div');
+ node.id = "test"
+ node._geometryClass = "OpenLayers.Geometry.Point";
+
+ var geometry = {
+ x: 1,
+ y: 2
+ }
+
+ var style = {
+ externalGraphic: "foo.png",
+ graphicWidth: 7,
+ graphicHeight: 10
+ }
+
+ r.drawGeometryNode(node, geometry, style);
+ t.eq(node.childNodes[0].id, "test_fill", "fill child node correctly created");
+ t.eq(node.style.left, "-3px", "x of insertion point with calculated xOffset correct");
+ t.eq(node.style.top, "-3px", "y of insertion point with calculated yOffset correct");
+
+ style.rotation = 90;
+
+ r.drawGeometryNode(node, geometry, style);
+
+ t.eq(node.childNodes[1].id, "test_image", "image child node correctly created");
+ t.eq(node.style.left, "-4px", "x of insertion point of rotated image correct");
+ t.eq(node.style.top, "-4px", "y of insertion point of rotated image correct");
+ }
+
function test_VML_drawlinestring(t) {
if (!OpenLayers.Renderer.VML.prototype.supported()) {
t.plan(0);
Copied: sandbox/topp/geoext/tests/Request (from rev 7342, trunk/openlayers/tests/Request)
Deleted: sandbox/topp/geoext/tests/Request/XMLHttpRequest.html
===================================================================
--- trunk/openlayers/tests/Request/XMLHttpRequest.html 2008-06-10 21:36:17 UTC (rev 7342)
+++ sandbox/topp/geoext/tests/Request/XMLHttpRequest.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -1,14 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript">
- function test_constructor(t) {
- t.plan(1);
- t.ok(new OpenLayers.Request.XMLHttpRequest(),
- "constructor didn't fail and we trust the code is well tested in OpenLayers.Request methods");
- }
- </script>
-</head>
-<body>
-</body>
-</html>
Copied: sandbox/topp/geoext/tests/Request/XMLHttpRequest.html (from rev 7342, trunk/openlayers/tests/Request/XMLHttpRequest.html)
===================================================================
--- sandbox/topp/geoext/tests/Request/XMLHttpRequest.html (rev 0)
+++ sandbox/topp/geoext/tests/Request/XMLHttpRequest.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -0,0 +1,14 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ function test_constructor(t) {
+ t.plan(1);
+ t.ok(new OpenLayers.Request.XMLHttpRequest(),
+ "constructor didn't fail and we trust the code is well tested in OpenLayers.Request methods");
+ }
+ </script>
+</head>
+<body>
+</body>
+</html>
Copied: sandbox/topp/geoext/tests/Request.html (from rev 7342, trunk/openlayers/tests/Request.html)
===================================================================
--- sandbox/topp/geoext/tests/Request.html (rev 0)
+++ sandbox/topp/geoext/tests/Request.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -0,0 +1,204 @@
+<html>
+<head>
+ <script src="../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ function setup() {
+ window._xhr = OpenLayers.Request.XMLHttpRequest;
+ var anon = new Function();
+ OpenLayers.Request.XMLHttpRequest = function() {};
+ OpenLayers.Request.XMLHttpRequest.prototype = {
+ open: anon,
+ setRequestHeader: anon,
+ send: anon
+ };
+ OpenLayers.Request.XMLHttpRequest.DONE = 4;
+ }
+ function teardown() {
+ OpenLayers.Request.XMLHttpRequest = window._xhr;
+ }
+
+ function test_issue(t) {
+ setup();
+
+ t.plan(18);
+ var request, config;
+ var proto = OpenLayers.Request.XMLHttpRequest.prototype;
+ var issue = OpenLayers.Function.bind(OpenLayers.Request.issue,
+ OpenLayers.Request);
+
+ // test that issue returns a new XMLHttpRequest - 1 test
+ request = issue();
+ t.ok(request instanceof OpenLayers.Request.XMLHttpRequest,
+ "returns an XMLHttpRequest instance");
+
+ // test that issue calls xhr.open with correct args from config - 5 tests
+ var _open = proto.open;
+ config = {
+ method: "foo",
+ url: "http://nowhere",
+ async: "bar",
+ user: "uncle",
+ password: "sam"
+ };
+ proto.open = function(method, url, async, user, password) {
+ t.eq(method, config.method, "open called with correct method");
+ t.eq(url, config.url, "open called with correct url");
+ t.eq(async, config.async, "open called with correct async");
+ t.eq(user, config.user, "open called with correct user");
+ t.eq(password, config.password, "open called with correct password");
+ }
+ request = issue(config);
+ proto.open = _open;
+
+ // test that headers are correctly set - 4 tests
+ var _setRequestHeader = proto.setRequestHeader;
+ config = {
+ headers: {
+ foo: "bar",
+ chicken: "soup"
+ }
+ };
+ proto.setRequestHeader = function(key, value) {
+ t.ok(key in config.headers, "setRequestHeader called with key: " + key);
+ t.eq(value, config.headers[key], "setRequestHeader called with correct value: " + value);
+ }
+ request = issue(config);
+ proto.setRequestHeader = _setRequestHeader;
+
+ // test that callback is called (no scope) - 1 test
+ var unbound = function(request) {
+ t.ok(request instanceof OpenLayers.Request.XMLHttpRequest,
+ "unbound callback called with xhr instance");
+ }
+ config = {
+ callback: unbound
+ };
+ request = issue(config);
+ request.readyState = OpenLayers.Request.XMLHttpRequest.DONE;
+ request.onreadystatechange();
+
+ // test that callback is called (with scope) - 2 tests
+ var obj = {};
+ var bound = function(request) {
+ t.ok(this === obj, "bound callback has correct scope");
+ t.ok(request instanceof OpenLayers.Request.XMLHttpRequest,
+ "bound callback called with xhr instance");
+ }
+ config = {
+ callback: bound,
+ scope: obj
+ };
+ request = issue(config);
+ request.readyState = 4;
+ request.onreadystatechange();
+
+ // test that send is called with data - 1 test
+ var _send = proto.send;
+ config = {
+ method: "PUT",
+ data: "bling"
+ };
+ proto.send = function(data) {
+ t.eq(data, config.data, "send called with correct data");
+ }
+ request = issue(config);
+ proto.send = _send;
+
+ // test that optional success callback is only called with 200s and
+ // failure is only called with non-200s
+ var _send = proto.send;
+ proto.send = function() {};
+
+ config = {
+ success: function(req) {
+ t.ok(req.status >= 200 && req.status < 300,
+ "success callback called with " + req.status + " status");
+ },
+ failure: function(req) {
+ t.ok(req.status < 200 || req.status >= 300,
+ "failure callback called with " + req.status + " status");
+ }
+ };
+ request = issue(config);
+ request.readyState = 4;
+
+ // mock up status 200 (1 test)
+ request.status = 200;
+ request.onreadystatechange();
+
+ // mock up status 299 (1 test)
+ request.status = 299;
+ request.onreadystatechange();
+
+ // mock up status 100 (1 test)
+ request.status = 100;
+ request.onreadystatechange();
+
+ // mock up status 300 (1 test)
+ request.status = 300;
+ request.onreadystatechange();
+
+ proto.send = _send;
+
+ teardown();
+ }
+
+ function test_GET(t) {
+ t.plan(1);
+ var _issue = OpenLayers.Request.issue;
+ OpenLayers.Request.issue = function(config) {
+ t.eq(config.method, "GET", "calls issue with correct method");
+ }
+ OpenLayers.Request.GET();
+ OpenLayers.Request.issue = _issue;
+ }
+ function test_POST(t) {
+ t.plan(1);
+ var _issue = OpenLayers.Request.issue;
+ OpenLayers.Request.issue = function(config) {
+ t.eq(config.method, "POST", "calls issue with correct method");
+ }
+ OpenLayers.Request.POST();
+ OpenLayers.Request.issue = _issue;
+ }
+ function test_PUT(t) {
+ t.plan(1);
+ var _issue = OpenLayers.Request.issue;
+ OpenLayers.Request.issue = function(config) {
+ t.eq(config.method, "PUT", "calls issue with correct method");
+ }
+ OpenLayers.Request.PUT();
+ OpenLayers.Request.issue = _issue;
+ }
+ function test_DELETE(t) {
+ t.plan(1);
+ var _issue = OpenLayers.Request.issue;
+ OpenLayers.Request.issue = function(config) {
+ t.eq(config.method, "DELETE", "calls issue with correct method");
+ }
+ OpenLayers.Request.DELETE();
+ OpenLayers.Request.issue = _issue;
+ }
+ function test_HEAD(t) {
+ t.plan(1);
+ var _issue = OpenLayers.Request.issue;
+ OpenLayers.Request.issue = function(config) {
+ t.eq(config.method, "HEAD", "calls issue with correct method");
+ }
+ OpenLayers.Request.HEAD();
+ OpenLayers.Request.issue = _issue;
+ }
+ function test_OPTIONS(t) {
+ t.plan(1);
+ var _issue = OpenLayers.Request.issue;
+ OpenLayers.Request.issue = function(config) {
+ t.eq(config.method, "OPTIONS", "calls issue with correct method");
+ }
+ OpenLayers.Request.OPTIONS();
+ OpenLayers.Request.issue = _issue;
+ }
+ </script>
+</head>
+<body>
+</body>
+</html>
Modified: sandbox/topp/geoext/tests/Tile/WFS.html
===================================================================
--- sandbox/topp/geoext/tests/Tile/WFS.html 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/tests/Tile/WFS.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -64,12 +64,12 @@
var g_Success = {};
- var tLoadURL = OpenLayers.loadURL;
- OpenLayers.loadURL = function(url, params, caller, onComplete) {
- t.ok(url == tile.url, "tile's url correctly passed as 1st param to loadURL");
- t.ok(params == null, "null passed as 2nd param to loadURL");
- t.ok(caller == tile, "tile passed as 3rd param to loadURL");
- t.ok(onComplete == g_Success, "success param from loadFeaturesForRegion() passed as 4th param to loadURL");
+ var _get = OpenLayers.Request.GET;
+ OpenLayers.Request.GET = function(config) {
+ t.ok(config.url == tile.url, "tile's url correctly passed");
+ t.ok(config.params == null, "null params");
+ t.ok(config.scope == tile, "tile passed as scope");
+ t.ok(config.success == g_Success, "success passed");
};
//no running request -- 4 tests
@@ -82,8 +82,8 @@
}
};
OpenLayers.Tile.WFS.prototype.loadFeaturesForRegion.apply(tile, [g_Success]);
-
- OpenLayers.loadURL = tLoadURL;
+
+ OpenLayers.Request.GET = _get;
}
function test_Tile_WFS_destroy(t) {
Modified: sandbox/topp/geoext/tests/Util.html
===================================================================
--- sandbox/topp/geoext/tests/Util.html 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/tests/Util.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -169,7 +169,7 @@
function test_Util_applyDefaults(t) {
- t.plan(10);
+ t.plan(11);
var to = {
'a': "abra",
@@ -198,6 +198,12 @@
t.eq( ret["c"], "press", "key present in from and not ret successfully copied to ret");
t.eq(to.toString(), "works", "correctly applies custom toString");
t.eq(to.n, null, "correctly preserves null");
+
+ var to;
+ var from = {rand: Math.random()};
+
+ var ret = OpenLayers.Util.applyDefaults(to, from);
+ t.eq(ret.rand, from.rand, "works with undefined to");
}
function test_Util_getParameterString(t) {
@@ -400,7 +406,7 @@
}
function test_Util_modifyAlphaImageDiv(t) {
- t.plan( 19 );
+ t.plan( 21 );
var imageDiv = OpenLayers.Util.createAlphaImageDiv();
@@ -460,8 +466,6 @@
if (OpenLayers.Util.alphaHack()) {
- t.eq(imageDiv.style.display, "inline-block", "imageDiv.style.display set correctly");
-
var filter = "progid:DXImageTransform.Microsoft" +
".AlphaImageLoader(src='" + img + "', " +
"sizingMethod='" + sizing + "') alpha(opacity=" + opacity *100 + ")";
@@ -476,6 +480,24 @@
t.ok(true, "image filter value not set (not in IE)");
}
+ var imageDiv = OpenLayers.Util.createAlphaImageDiv();
+ var display = "none";
+ imageDiv.style.display = display;
+ OpenLayers.Util.modifyAlphaImageDiv(imageDiv, id, xy, sz, img, position, border, sizing, opacity);
+ t.eq(imageDiv.style.display, display, "imageDiv.style.display set correctly, if 'none'");
+
+ var imageDiv = OpenLayers.Util.createAlphaImageDiv();
+ var display = "block";
+ imageDiv.style.display = display;
+ OpenLayers.Util.modifyAlphaImageDiv(imageDiv, id, xy, sz, img, position, border, sizing, opacity);
+ if(OpenLayers.Util.alphaHack()) {
+ t.eq(imageDiv.style.display, "inline-block", "imageDiv.style.display set correctly, if not 'none'");
+ } else {
+ t.ok(true, "inline-block is not part of CSS2 and is not supported by Firefox 2");
+ }
+
+
+
var imageDiv = OpenLayers.Util.createAlphaImageDiv(id, xy, sz, img, position, border, "scale", opacity);
if (OpenLayers.Util.alphaHack()) {
var filter = "progid:DXImageTransform.Microsoft" +
@@ -693,7 +715,7 @@
}
function tests_Util_extend(t) {
- t.plan(6);
+ t.plan(7);
var source = {
num: Math.random(),
@@ -720,6 +742,12 @@
t.eq(destination.nada, "untouched",
"undefined source properties don't clobber existing properties");
t.eq(window.property, undefined, "Property variable not clobbered.");
+
+ var destination;
+ var source = {rand: Math.random()};
+ var ret = OpenLayers.Util.extend(destination, source);
+ t.eq(destination.rand, source.rand, "works with undefined destination");
+
}
function test_XX_Util_Try(t) {
@@ -754,6 +782,20 @@
t.ok(ret == g_TestVal3, "try returns first sucessfully executed function's return");
}
+
+ function test_getRenderedDimensions(t) {
+ t.plan(2);
+ var content = (new Array(100)).join("foo ");
+
+ // test with fixed width
+ var fw = OpenLayers.Util.getRenderedDimensions(content, {w: 20});
+ t.eq(fw.w, 20, "got the fixed width");
+
+ // test with fixed height
+ var fh = OpenLayers.Util.getRenderedDimensions(content, {h: 15});
+ t.eq(fh.h, 15, "got the fixed height");
+
+ }
</script>
</head>
Modified: sandbox/topp/geoext/tests/list-tests.html
===================================================================
--- sandbox/topp/geoext/tests/list-tests.html 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/tests/list-tests.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -57,6 +57,8 @@
<li>Lang.html</li>
<li>Layer.html</li>
<li>Renderer.html</li>
+ <li>Request.html</li>
+ <li>Request/XMLHttpRequest.html</li>
<li>Layer/EventPane.html</li>
<li>Layer/FixedZoomLevels.html</li>
<li>Layer/GeoRSS.html</li>
Modified: sandbox/topp/geoext/tests/manual/ajax.html
===================================================================
--- sandbox/topp/geoext/tests/manual/ajax.html 2008-06-10 21:48:50 UTC (rev 7343)
+++ sandbox/topp/geoext/tests/manual/ajax.html 2008-06-10 21:48:50 UTC (rev 7344)
@@ -1,70 +1,49 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>Ajax Acceptance Test</title>
- <style type="text/css">
-
- body {
- font-size: 0.8em;
- }
- p {
- padding-top: 1em;
- }
-
- .buttons {
- margin: 1em;
- float: left;
- }
-
- </style>
-
+ <title>XHR Acceptance Test</title>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript">
var url = "ajax.txt";
function sendSynchronous(){
- var request = new OpenLayers.Ajax.Request(url, {
- 'asynchronous': false,
- onComplete: function() {
+ var request = OpenLayers.Request.GET({
+ url: url,
+ async: false,
+ callback: function() {
document.getElementById('send_sync').value += 'request completed\n';
}
});
document.getElementById('send_sync').value += 'other processing\n';
}
function sendAsynchronous(){
- var request = new OpenLayers.Ajax.Request(url, {
- onComplete: function() {
+ var request = OpenLayers.Request.GET({
+ url: url,
+ callback: function() {
document.getElementById('send_sync').value += 'request completed\n';
}
});
document.getElementById('send_sync').value += 'other processing\n';
}
function sendAndAbort(){
- var request = new OpenLayers.Ajax.Request(url, {
- onComplete: function(request) {
- if (request.responseText == '') {
- document.getElementById('send_sync').value += 'request aborted\n';
- }
+ var request = OpenLayers.Request.GET({
+ url: url,
+ callback: function() {
+ document.getElementById('send_sync').value += 'never called\n';
}
});
- request.transport.abort();
+ request.abort();
document.getElementById('send_sync').value += 'other processing\n';
}
- </script>
- </head>
- <body >
- <div class="buttons">
- <button onclick="sendSynchronous()">Send an synchronous Ajax request</button><br />
- <button onclick="sendAsynchronous()">Send an asynchronous Ajax request</button><br />
- <button onclick="sendAndAbort()">Send a request and abort it</button><br />
+ </script>
+ </head>
+ <body >
+ <button onclick="sendSynchronous()">synchronous</button>
+ expected output: "request completed" then "other processing"<br />
+ <button onclick="sendAsynchronous()">asynchronous</button>
+ expected output: "other processing" then "request completed"<br />
+ <button onclick="sendAndAbort()">send and abort</button>
+ expected output: "other processing" (and not "never called")<br />
<textarea id="send_sync" rows="6"></textarea><br />
<button onclick="document.getElementById('send_sync').value = ''">Clear</button>
- </div>
- <p><b></b></p>
- <p>Clicking on the different buttons should give the following results in the textarea below :</p>
- <ul>
- <li>synchronous: "request completed" then "other processing"</li>
- <li>asynchronous: "other processing" then "request completed"</li>
- <li>abort: "request aborted" then "other processing" (note that real XHR behavior would not call onComplete with abort - meaning "request aborted" would not be displayed here)</li>
- </ul>
<