[OpenLayers-Commits] r11803 - in sandbox/tschaub/canvas: . build
examples lib lib/OpenLayers lib/OpenLayers/Format
lib/OpenLayers/Format/WFST lib/OpenLayers/Format/XLS
lib/OpenLayers/Handler lib/OpenLayers/Protocol/WFS tests
tests/Format tests/Format/WFST tests/Format/XLS tests/Handler
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed Mar 30 15:39:00 EDT 2011
Author: tschaub
Date: 2011-03-30 12:38:59 -0700 (Wed, 30 Mar 2011)
New Revision: 11803
Added:
sandbox/tschaub/canvas/examples/openls.html
sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS.js
sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/
sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1.js
sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1_1_0.js
sandbox/tschaub/canvas/tests/Format/XLS/
sandbox/tschaub/canvas/tests/Format/XLS/v1_1_0.html
Removed:
sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1.js
sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1_1_0.js
sandbox/tschaub/canvas/tests/Format/XLS/v1_1_0.html
Modified:
sandbox/tschaub/canvas/
sandbox/tschaub/canvas/build/mobile.cfg
sandbox/tschaub/canvas/examples/drag-feature.html
sandbox/tschaub/canvas/examples/mobile-drawing.html
sandbox/tschaub/canvas/examples/mobile-navigation.html
sandbox/tschaub/canvas/examples/mobile.html
sandbox/tschaub/canvas/examples/modify-feature.html
sandbox/tschaub/canvas/examples/proxy.cgi
sandbox/tschaub/canvas/examples/select-feature.html
sandbox/tschaub/canvas/lib/OpenLayers.js
sandbox/tschaub/canvas/lib/OpenLayers/Feature.js
sandbox/tschaub/canvas/lib/OpenLayers/Format/WFST/v1_1_0.js
sandbox/tschaub/canvas/lib/OpenLayers/Handler/Click.js
sandbox/tschaub/canvas/lib/OpenLayers/Handler/Drag.js
sandbox/tschaub/canvas/lib/OpenLayers/Handler/Feature.js
sandbox/tschaub/canvas/lib/OpenLayers/Handler/Path.js
sandbox/tschaub/canvas/lib/OpenLayers/Handler/Polygon.js
sandbox/tschaub/canvas/lib/OpenLayers/Handler/RegularPolygon.js
sandbox/tschaub/canvas/lib/OpenLayers/Protocol/WFS/v1.js
sandbox/tschaub/canvas/tests/Feature.html
sandbox/tschaub/canvas/tests/Format/WFST/v1_1_0.html
sandbox/tschaub/canvas/tests/Handler/Path.html
sandbox/tschaub/canvas/tests/list-tests.html
Log:
Merge r11774:11802 from trunk.
Property changes on: sandbox/tschaub/canvas
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:10737-11416,11422-11762,11766-11773
+ /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:10737-11416,11422-11762,11766-11802
Modified: sandbox/tschaub/canvas/build/mobile.cfg
===================================================================
--- sandbox/tschaub/canvas/build/mobile.cfg 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/build/mobile.cfg 2011-03-30 19:38:59 UTC (rev 11803)
@@ -14,6 +14,11 @@
OpenLayers/Control/ZoomPanel.js
OpenLayers/Control/Attribution.js
OpenLayers/Control/SelectFeature.js
+OpenLayers/Control/DrawFeature.js
+OpenLayers/Control/Panel.js
+OpenLayers/Handler/Point.js
+OpenLayers/Handler/Path.js
+OpenLayers/Handler/Polygon.js
OpenLayers/Layer/Vector.js
OpenLayers/Renderer/SVG.js
OpenLayers/Renderer/Canvas.js
Modified: sandbox/tschaub/canvas/examples/drag-feature.html
===================================================================
--- sandbox/tschaub/canvas/examples/drag-feature.html 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/examples/drag-feature.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -25,8 +25,14 @@
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'});
- vectors = new OpenLayers.Layer.Vector("Vector Layer");
+ // allow testing of specific renderers via "?renderer=Canvas", etc
+ var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
+ renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
+ vectors = new OpenLayers.Layer.Vector("Vector Layer", {
+ renderers: renderer
+ });
+
map.addLayers([wms, vectors]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MousePosition());
Modified: sandbox/tschaub/canvas/examples/mobile-drawing.html
===================================================================
--- sandbox/tschaub/canvas/examples/mobile-drawing.html 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/examples/mobile-drawing.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -2,11 +2,12 @@
<html>
<head>
<title>OpenLayers Mobile Drawing</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0;">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="style.mobile.css" type="text/css">
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
- <script src="../lib/OpenLayers.js"></script>
+ <script src="../lib/OpenLayers.js?mobile"></script>
<script src="mobile-drawing.js"></script>
<style>
html, body {
@@ -24,6 +25,36 @@
bottom: 5px;
right: 5px;
}
+ div.olControlZoomPanel .olControlZoomInItemInactive,
+ div.olControlZoomPanel .olControlZoomOutItemInactive {
+ background: rgba(0,0,0,0.2);
+ position: absolute;
+ }
+ div.olControlZoomPanel .olControlZoomInItemInactive {
+ border-radius: 5px 5px 0 0;
+ }
+ div.olControlZoomPanel .olControlZoomOutItemInactive {
+ border-radius: 0 0 5px 5px ;
+ top: 37px;
+ }
+ div.olControlZoomPanel .olControlZoomOutItemInactive:after,
+ div.olControlZoomPanel .olControlZoomInItemInactive:after {
+ font-weight: bold;
+ content: '+';
+ font-size: 36px;
+ padding: 7px;
+ z-index: 2000;
+ color: #fff;
+ line-height: 1em;
+ }
+ div.olControlZoomPanel .olControlZoomOutItemInactive:after {
+ content: '–';
+ line-height: 0.9em;
+ padding: 0 8px;
+ }
+ div.olControlZoomPanel .olControlZoomToMaxExtentItemInactive {
+ display: none;
+ }
#title, #tags, #shortdesc {
display: none;
}
Modified: sandbox/tschaub/canvas/examples/mobile-navigation.html
===================================================================
--- sandbox/tschaub/canvas/examples/mobile-navigation.html 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/examples/mobile-navigation.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -7,7 +7,7 @@
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="style.mobile.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
- <script type="text/javascript" src="../lib/OpenLayers.js"></script>
+ <script type="text/javascript" src="../lib/OpenLayers.js?mobile"></script>
<script type="text/javascript" src="mobile-navigation.js"></script>
</head>
<body onload="init()">
Modified: sandbox/tschaub/canvas/examples/mobile.html
===================================================================
--- sandbox/tschaub/canvas/examples/mobile.html 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/examples/mobile.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0;">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="style.mobile.css" type="text/css">
- <script src="../lib/OpenLayers.js"></script>
+ <script src="../lib/OpenLayers.js?mobile"></script>
<script src="mobile.js"></script>
<style>
html, body {
Modified: sandbox/tschaub/canvas/examples/modify-feature.html
===================================================================
--- sandbox/tschaub/canvas/examples/modify-feature.html 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/examples/modify-feature.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -25,8 +25,15 @@
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'});
OpenLayers.Feature.Vector.style['default']['strokeWidth'] = '2';
- vectors = new OpenLayers.Layer.Vector("Vector Layer");
+ // allow testing of specific renderers via "?renderer=Canvas", etc
+ var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
+ renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
+
+ vectors = new OpenLayers.Layer.Vector("Vector Layer", {
+ renderers: renderer
+ });
+
map.addLayers([wms, vectors]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MousePosition());
Copied: sandbox/tschaub/canvas/examples/openls.html (from rev 11802, trunk/openlayers/examples/openls.html)
===================================================================
--- sandbox/tschaub/canvas/examples/openls.html (rev 0)
+++ sandbox/tschaub/canvas/examples/openls.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -0,0 +1,86 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
+ <meta name="apple-mobile-web-app-capable" content="yes"/>
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css"/>
+ <link rel="stylesheet" href="style.css" type="text/css"/>
+ <title>OpenLS: Geocoding Example</title>
+ <script type="text/javascript" src="../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ var map, layer;
+
+ function init() {
+ OpenLayers.ProxyHost = "proxy.cgi?url=";
+ map = new OpenLayers.Map('map', {
+ controls: [
+ new OpenLayers.Control.PanZoom(),
+ new OpenLayers.Control.Permalink(),
+ new OpenLayers.Control.Navigation()
+ ]
+ });
+ layer = new OpenLayers.Layer.OSM("OpenStreetMap", null, {
+ transitionEffect: 'resize'
+ });
+ map.addLayers([layer]);
+ map.zoomToMaxExtent();
+ }
+ function submitform() {
+ var queryString = document.forms[0].query.value;
+ OpenLayers.Request.POST({
+ url: "http://www.openrouteservice.org/php/OpenLSLUS_Geocode.php",
+ scope: this,
+ failure: this.requestFailure,
+ success: this.requestSuccess,
+ headers: {"Content-Type": "application/x-www-form-urlencoded"},
+ data: "FreeFormAdress=" + encodeURIComponent(queryString) + "&MaxResponse=1"
+ });
+ }
+ function requestSuccess(response) {
+ var format = new OpenLayers.Format.XLS();
+ var output = format.read(response.responseXML);
+ if (output.responseLists[0]) {
+ var geometry = output.responseLists[0].features[0].geometry;
+ var foundPosition = new OpenLayers.LonLat(geometry.x, geometry.y).transform(
+ new OpenLayers.Projection("EPSG:4326"),
+ map.getProjectionObject()
+ );
+ map.setCenter(foundPosition, 16);
+ } else {
+ alert("Sorry, no address found");
+ }
+ }
+ function requestFailure(response) {
+ alert("An error occurred while communicating with the OpenLS service. Please try again.");
+ }
+
+ </script>
+</head>
+<body onload="init()">
+<h1 id="title">OpenLS Geocoding Example</h1>
+
+<div id="tags">
+ OpenLS, XLS, Geocoding
+</div>
+
+<p id="shortdesc">
+ Show how to use an OpenLS service.
+</p>
+
+<form name="input" action="javascript: submitform();" method="post">
+ <label for="query">Search for address:</label> <input type="text" id="query" size=50 name="query"
+ value="Rue des Berges 37 Payerne"/>
+ <input type="submit" value="Submit"/>
+</form>
+
+<br>
+
+<div id="map" class="smallmap"></div>
+
+
+<div id="docs">
+ <p>
+ Geocoding example using the http://www.openrouteservice.org/ OpenLS service. Recenter to the first item of the results.
+ </p>
+</div>
+</body>
+</html>
Modified: sandbox/tschaub/canvas/examples/proxy.cgi
===================================================================
--- sandbox/tschaub/canvas/examples/proxy.cgi 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/examples/proxy.cgi 2011-03-30 19:38:59 UTC (rev 11803)
@@ -21,7 +21,7 @@
'sigma.openplans.org', 'demo.opengeo.org',
'www.openstreetmap.org', 'sample.azavea.com',
'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080',
- 'vmap0.tiles.osgeo.org']
+ 'vmap0.tiles.osgeo.org', 'www.openrouteservice.org']
method = os.environ["REQUEST_METHOD"]
Modified: sandbox/tschaub/canvas/examples/select-feature.html
===================================================================
--- sandbox/tschaub/canvas/examples/select-feature.html 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/examples/select-feature.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -22,7 +22,13 @@
{layers: 'basic'}
);
- var vectors = new OpenLayers.Layer.Vector("Vector Layer");
+ // allow testing of specific renderers via "?renderer=Canvas", etc
+ var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
+ renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
+
+ var vectors = new OpenLayers.Layer.Vector("Vector Layer", {
+ renderers: renderer
+ });
vectors.events.on({
'featureselected': function(feature) {
$('counter').innerHTML = this.selectedFeatures.length;
Modified: sandbox/tschaub/canvas/lib/OpenLayers/Feature.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Feature.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Feature.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -7,8 +7,6 @@
/**
* @requires OpenLayers/BaseTypes/Class.js
* @requires OpenLayers/Util.js
- * @requires OpenLayers/Marker.js
- * @requires OpenLayers/Popup/AnchoredBubble.js
*/
/**
@@ -53,7 +51,7 @@
* {<OpenLayers.Class>} The class which will be used to instantiate
* a new Popup. Default is <OpenLayers.Popup.AnchoredBubble>.
*/
- popupClass: OpenLayers.Popup.AnchoredBubble,
+ popupClass: null,
/**
* Property: popup
@@ -187,17 +185,16 @@
createPopup: function(closeBox) {
if (this.lonlat != null) {
-
- var id = this.id + "_popup";
- var anchor = (this.marker) ? this.marker.icon : null;
-
if (!this.popup) {
- this.popup = new this.popupClass(id,
- this.lonlat,
- this.data.popupSize,
- this.data.popupContentHTML,
- anchor,
- closeBox);
+ var anchor = (this.marker) ? this.marker.icon : null;
+ var popupClass = this.popupClass ?
+ this.popupClass : OpenLayers.Popup.AnchoredBubble;
+ this.popup = new popupClass(this.id + "_popup",
+ this.lonlat,
+ this.data.popupSize,
+ this.data.popupContentHTML,
+ anchor,
+ closeBox);
}
if (this.data.overflow != null) {
this.popup.contentDiv.style.overflow = this.data.overflow;
Modified: sandbox/tschaub/canvas/lib/OpenLayers/Format/WFST/v1_1_0.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Format/WFST/v1_1_0.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Format/WFST/v1_1_0.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -109,8 +109,10 @@
"wfs": OpenLayers.Util.applyDefaults({
"GetFeature": function(options) {
var node = OpenLayers.Format.WFST.v1.prototype.writers["wfs"]["GetFeature"].apply(this, arguments);
- options && options.resultType && this.setAttributes(node, {
- resultType: options.resultType
+ options && this.setAttributes(node, {
+ resultType: options.resultType,
+ startIndex: options.startIndex,
+ count: options.count
});
return node;
},
Deleted: sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Format/XLS/v1.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -1,307 +0,0 @@
-/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the Clear BSD license.
- * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Format/XLS.js
- * @requires OpenLayers/Format/GML/v3.js
- */
-
-/**
- * Class: OpenLayers.Format.XLS.v1
- * Superclass for XLS version 1 parsers. Only supports GeocodeRequest for now.
- *
- * Inherits from:
- * - <OpenLayers.Format.XML>
- */
-OpenLayers.Format.XLS.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
-
- /**
- * Property: namespaces
- * {Object} Mapping of namespace aliases to namespace URIs.
- */
- namespaces: {
- xls: "http://www.opengis.net/xls",
- gml: "http://www.opengis.net/gml",
- xsi: "http://www.w3.org/2001/XMLSchema-instance"
- },
-
- /**
- * Property: regExes
- * Compiled regular expressions for manipulating strings.
- */
- regExes: {
- trimSpace: (/^\s*|\s*$/g),
- removeSpace: (/\s*/g),
- splitSpace: (/\s+/),
- trimComma: (/\s*,\s*/g)
- },
-
- /**
- * APIProperty: xy
- * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)
- * Changing is not recommended, a new Format should be instantiated.
- */
- xy: true,
-
- /**
- * Property: defaultPrefix
- */
- defaultPrefix: "xls",
-
- /**
- * Property: schemaLocation
- * {String} Schema location for a particular minor version.
- */
- schemaLocation: null,
-
- /**
- * Constructor: OpenLayers.Format.XLS.v1
- * Instances of this class are not created directly. Use the
- * <OpenLayers.Format.XLS> constructor instead.
- *
- * Parameters:
- * options - {Object} An optional object whose properties will be set on
- * this instance.
- */
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- },
-
- /**
- * Method: read
- *
- * Parameters:
- * data - {DOMElement} An XLS document element.
- * options - {Object} Options for the reader.
- *
- * Returns:
- * {Object} An object representing the XLSResponse.
- */
- read: function(data, options) {
- options = OpenLayers.Util.applyDefaults(options, this.options);
- var xls = {};
- this.readChildNodes(data, xls);
- return xls;
- },
-
- /**
- * Property: readers
- * Contains public functions, grouped by namespace prefix, that will
- * be applied when a namespaced node is found matching the function
- * name. The function will be applied in the scope of this parser
- * with two arguments: the node being read and a context object passed
- * from the parent.
- */
- readers: {
- "xls": {
- "XLS": function(node, xls) {
- xls.version = node.getAttribute("version");
- this.readChildNodes(node, xls);
- },
- "Response": function(node, xls) {
- this.readChildNodes(node, xls);
- },
- "GeocodeResponse": function(node, xls) {
- xls.responseLists = [];
- this.readChildNodes(node, xls);
- },
- "GeocodeResponseList": function(node, xls) {
- var responseList = {
- features: [],
- numberOfGeocodedAddresses:
- parseInt(node.getAttribute("numberOfGeocodedAddresses"))
- };
- xls.responseLists.push(responseList);
- this.readChildNodes(node, responseList);
- },
- "GeocodedAddress": function(node, responseList) {
- var feature = new OpenLayers.Feature.Vector();
- responseList.features.push(feature);
- this.readChildNodes(node, feature);
- // post-process geometry
- feature.geometry = feature.components[0];
- },
- "GeocodeMatchCode": function(node, feature) {
- feature.attributes.matchCode = {
- accuracy: parseFloat(node.getAttribute("accuracy")),
- matchType: node.getAttribute("matchType")
- };
- },
- "Address": function(node, feature) {
- var address = {
- countryCode: node.getAttribute("countryCode"),
- addressee: node.getAttribute("addressee"),
- street: [],
- place: []
- };
- feature.attributes.address = address;
- this.readChildNodes(node, address);
- },
- "freeFormAddress": function(node, address) {
- address.freeFormAddress = this.getChildValue(node);
- },
- "StreetAddress": function(node, address) {
- this.readChildNodes(node, address);
- },
- "Building": function(node, address) {
- address.building = {
- 'number': node.getAttribute("number"),
- subdivision: node.getAttribute("subdivision"),
- buildingName: node.getAttribute("buildingName")
- };
- },
- "Street": function(node, address) {
- // only support the built-in primitive type for now
- address.street.push(this.getChildValue(node));
- },
- "Place": function(node, address) {
- // type is one of CountrySubdivision,
- // CountrySecondarySubdivision, Municipality or
- // MunicipalitySubdivision
- address.place[node.getAttribute("type")] =
- this.getChildValue(node);
- },
- "PostalCode": function(node, address) {
- address.postalCode = this.getChildValue(node);
- }
- },
- "gml": OpenLayers.Format.GML.v3.prototype.readers.gml
- },
-
- /**
- * Method: write
- *
- * Parameters:
- * request - {Object} An object representing the geocode request.
- *
- * Returns:
- * {DOMElement} The root of an XLS document.
- */
- write: function(request) {
- return this.writers.xls.XLS.apply(this, [request]);
- },
-
- /**
- * Property: writers
- * As a compliment to the readers property, this structure contains public
- * writing functions grouped by namespace alias and named like the
- * node names they produce.
- */
- writers: {
- "xls": {
- "XLS": function(request) {
- var root = this.createElementNSPlus(
- "xls:XLS",
- {attributes: {
- "version": this.VERSION,
- "xsi:schemaLocation": this.schemaLocation
- }}
- );
- this.writeNode("RequestHeader", request.header, root);
- this.writeNode("Request", request, root);
- return root;
- },
- "RequestHeader": function(header) {
- return this.createElementNSPlus("xls:RequestHeader");
- },
- "Request": function(request) {
- var node = this.createElementNSPlus("xls:Request", {
- attributes: {
- methodName: "GeocodeRequest",
- requestID: request.requestID || "",
- version: this.VERSION
- }
- });
- this.writeNode("GeocodeRequest", request.addresses, node);
- return node;
- },
- "GeocodeRequest": function(addresses) {
- var node = this.createElementNSPlus("xls:GeocodeRequest");
- for (var i=0, len=addresses.length; i<len; i++) {
- this.writeNode("Address", addresses[i], node);
- }
- return node;
- },
- "Address": function(address) {
- var node = this.createElementNSPlus("xls:Address", {
- attributes: {
- countryCode: address.countryCode
- }
- });
- if (address.freeFormAddress) {
- this.writeNode("freeFormAddess", address.freeFormAddress, node);
- } else {
- if (address.street) {
- this.writeNode("StreetAddress", address, node);
- }
- if (address.municipality) {
- this.writeNode("Municipality", address.municipality, node);
- }
- if (address.countrySubdivision) {
- this.writeNode("CountrySubdivision", address.countrySubdivision, node);
- }
- if (address.postalCode) {
- this.writeNode("PostalCode", address.postalCode, node);
- }
- }
- return node;
- },
- "freeFormAddress": function(freeFormAddress) {
- return this.createElementNSPlus("freeFormAddress",
- {value: freeFormAddress});
- },
- "StreetAddress": function(address) {
- var node = this.createElementNSPlus("xls:StreetAddress");
- if (address.building) {
- this.writeNode(node, "Building", address.building);
- }
- var street = address.street;
- if (!(street instanceof Array)) {
- street = [street];
- }
- for (var i=0, len=street.length; i < len; i++) {
- this.writeNode("Street", street[i], node);
- }
- return node;
- },
- "Building": function(building) {
- return this.createElementNSPlus("xls:Building", {
- attributes: {
- "number": building["number"],
- "subdivision": building.subdivision,
- "buildingName": building.buildingName
- }
- });
- },
- "Street": function(street) {
- return this.createElementNSPlus("xls:Street", {value: street});
- },
- "Municipality": function(municipality) {
- return this.createElementNSPlus("xls:Place", {
- attributes: {
- type: "Municipality"
- },
- value: municipality
- });
- },
- "CountrySubdivision": function(countrySubdivision) {
- return this.createElementNSPlus("xls:Place", {
- attributes: {
- type: "CountrySubdivision"
- },
- value: countrySubdivision
- });
- },
- "PostalCode": function(postalCode) {
- return this.createElementNSPlus("xls:PostalCode", {
- value: postalCode
- });
- }
- }
- },
-
- CLASS_NAME: "OpenLayers.Format.XLS.v1"
-
-});
Copied: sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1.js (from rev 11802, trunk/openlayers/lib/OpenLayers/Format/XLS/v1.js)
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1.js (rev 0)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -0,0 +1,307 @@
+/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XLS.js
+ * @requires OpenLayers/Format/GML/v3.js
+ */
+
+/**
+ * Class: OpenLayers.Format.XLS.v1
+ * Superclass for XLS version 1 parsers. Only supports GeocodeRequest for now.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.XLS.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
+
+ /**
+ * Property: namespaces
+ * {Object} Mapping of namespace aliases to namespace URIs.
+ */
+ namespaces: {
+ xls: "http://www.opengis.net/xls",
+ gml: "http://www.opengis.net/gml",
+ xsi: "http://www.w3.org/2001/XMLSchema-instance"
+ },
+
+ /**
+ * Property: regExes
+ * Compiled regular expressions for manipulating strings.
+ */
+ regExes: {
+ trimSpace: (/^\s*|\s*$/g),
+ removeSpace: (/\s*/g),
+ splitSpace: (/\s+/),
+ trimComma: (/\s*,\s*/g)
+ },
+
+ /**
+ * APIProperty: xy
+ * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)
+ * Changing is not recommended, a new Format should be instantiated.
+ */
+ xy: true,
+
+ /**
+ * Property: defaultPrefix
+ */
+ defaultPrefix: "xls",
+
+ /**
+ * Property: schemaLocation
+ * {String} Schema location for a particular minor version.
+ */
+ schemaLocation: null,
+
+ /**
+ * Constructor: OpenLayers.Format.XLS.v1
+ * Instances of this class are not created directly. Use the
+ * <OpenLayers.Format.XLS> constructor instead.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
+ initialize: function(options) {
+ OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
+ },
+
+ /**
+ * Method: read
+ *
+ * Parameters:
+ * data - {DOMElement} An XLS document element.
+ * options - {Object} Options for the reader.
+ *
+ * Returns:
+ * {Object} An object representing the XLSResponse.
+ */
+ read: function(data, options) {
+ options = OpenLayers.Util.applyDefaults(options, this.options);
+ var xls = {};
+ this.readChildNodes(data, xls);
+ return xls;
+ },
+
+ /**
+ * Property: readers
+ * Contains public functions, grouped by namespace prefix, that will
+ * be applied when a namespaced node is found matching the function
+ * name. The function will be applied in the scope of this parser
+ * with two arguments: the node being read and a context object passed
+ * from the parent.
+ */
+ readers: {
+ "xls": {
+ "XLS": function(node, xls) {
+ xls.version = node.getAttribute("version");
+ this.readChildNodes(node, xls);
+ },
+ "Response": function(node, xls) {
+ this.readChildNodes(node, xls);
+ },
+ "GeocodeResponse": function(node, xls) {
+ xls.responseLists = [];
+ this.readChildNodes(node, xls);
+ },
+ "GeocodeResponseList": function(node, xls) {
+ var responseList = {
+ features: [],
+ numberOfGeocodedAddresses:
+ parseInt(node.getAttribute("numberOfGeocodedAddresses"))
+ };
+ xls.responseLists.push(responseList);
+ this.readChildNodes(node, responseList);
+ },
+ "GeocodedAddress": function(node, responseList) {
+ var feature = new OpenLayers.Feature.Vector();
+ responseList.features.push(feature);
+ this.readChildNodes(node, feature);
+ // post-process geometry
+ feature.geometry = feature.components[0];
+ },
+ "GeocodeMatchCode": function(node, feature) {
+ feature.attributes.matchCode = {
+ accuracy: parseFloat(node.getAttribute("accuracy")),
+ matchType: node.getAttribute("matchType")
+ };
+ },
+ "Address": function(node, feature) {
+ var address = {
+ countryCode: node.getAttribute("countryCode"),
+ addressee: node.getAttribute("addressee"),
+ street: [],
+ place: []
+ };
+ feature.attributes.address = address;
+ this.readChildNodes(node, address);
+ },
+ "freeFormAddress": function(node, address) {
+ address.freeFormAddress = this.getChildValue(node);
+ },
+ "StreetAddress": function(node, address) {
+ this.readChildNodes(node, address);
+ },
+ "Building": function(node, address) {
+ address.building = {
+ 'number': node.getAttribute("number"),
+ subdivision: node.getAttribute("subdivision"),
+ buildingName: node.getAttribute("buildingName")
+ };
+ },
+ "Street": function(node, address) {
+ // only support the built-in primitive type for now
+ address.street.push(this.getChildValue(node));
+ },
+ "Place": function(node, address) {
+ // type is one of CountrySubdivision,
+ // CountrySecondarySubdivision, Municipality or
+ // MunicipalitySubdivision
+ address.place[node.getAttribute("type")] =
+ this.getChildValue(node);
+ },
+ "PostalCode": function(node, address) {
+ address.postalCode = this.getChildValue(node);
+ }
+ },
+ "gml": OpenLayers.Format.GML.v3.prototype.readers.gml
+ },
+
+ /**
+ * Method: write
+ *
+ * Parameters:
+ * request - {Object} An object representing the geocode request.
+ *
+ * Returns:
+ * {DOMElement} The root of an XLS document.
+ */
+ write: function(request) {
+ return this.writers.xls.XLS.apply(this, [request]);
+ },
+
+ /**
+ * Property: writers
+ * As a compliment to the readers property, this structure contains public
+ * writing functions grouped by namespace alias and named like the
+ * node names they produce.
+ */
+ writers: {
+ "xls": {
+ "XLS": function(request) {
+ var root = this.createElementNSPlus(
+ "xls:XLS",
+ {attributes: {
+ "version": this.VERSION,
+ "xsi:schemaLocation": this.schemaLocation
+ }}
+ );
+ this.writeNode("RequestHeader", request.header, root);
+ this.writeNode("Request", request, root);
+ return root;
+ },
+ "RequestHeader": function(header) {
+ return this.createElementNSPlus("xls:RequestHeader");
+ },
+ "Request": function(request) {
+ var node = this.createElementNSPlus("xls:Request", {
+ attributes: {
+ methodName: "GeocodeRequest",
+ requestID: request.requestID || "",
+ version: this.VERSION
+ }
+ });
+ this.writeNode("GeocodeRequest", request.addresses, node);
+ return node;
+ },
+ "GeocodeRequest": function(addresses) {
+ var node = this.createElementNSPlus("xls:GeocodeRequest");
+ for (var i=0, len=addresses.length; i<len; i++) {
+ this.writeNode("Address", addresses[i], node);
+ }
+ return node;
+ },
+ "Address": function(address) {
+ var node = this.createElementNSPlus("xls:Address", {
+ attributes: {
+ countryCode: address.countryCode
+ }
+ });
+ if (address.freeFormAddress) {
+ this.writeNode("freeFormAddess", address.freeFormAddress, node);
+ } else {
+ if (address.street) {
+ this.writeNode("StreetAddress", address, node);
+ }
+ if (address.municipality) {
+ this.writeNode("Municipality", address.municipality, node);
+ }
+ if (address.countrySubdivision) {
+ this.writeNode("CountrySubdivision", address.countrySubdivision, node);
+ }
+ if (address.postalCode) {
+ this.writeNode("PostalCode", address.postalCode, node);
+ }
+ }
+ return node;
+ },
+ "freeFormAddress": function(freeFormAddress) {
+ return this.createElementNSPlus("freeFormAddress",
+ {value: freeFormAddress});
+ },
+ "StreetAddress": function(address) {
+ var node = this.createElementNSPlus("xls:StreetAddress");
+ if (address.building) {
+ this.writeNode(node, "Building", address.building);
+ }
+ var street = address.street;
+ if (!(street instanceof Array)) {
+ street = [street];
+ }
+ for (var i=0, len=street.length; i < len; i++) {
+ this.writeNode("Street", street[i], node);
+ }
+ return node;
+ },
+ "Building": function(building) {
+ return this.createElementNSPlus("xls:Building", {
+ attributes: {
+ "number": building["number"],
+ "subdivision": building.subdivision,
+ "buildingName": building.buildingName
+ }
+ });
+ },
+ "Street": function(street) {
+ return this.createElementNSPlus("xls:Street", {value: street});
+ },
+ "Municipality": function(municipality) {
+ return this.createElementNSPlus("xls:Place", {
+ attributes: {
+ type: "Municipality"
+ },
+ value: municipality
+ });
+ },
+ "CountrySubdivision": function(countrySubdivision) {
+ return this.createElementNSPlus("xls:Place", {
+ attributes: {
+ type: "CountrySubdivision"
+ },
+ value: countrySubdivision
+ });
+ },
+ "PostalCode": function(postalCode) {
+ return this.createElementNSPlus("xls:PostalCode", {
+ value: postalCode
+ });
+ }
+ }
+ },
+
+ CLASS_NAME: "OpenLayers.Format.XLS.v1"
+
+});
Deleted: sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1_1_0.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1_1_0.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -1,53 +0,0 @@
-/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the Clear BSD license.
- * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Format/XLS/v1.js
- */
-
-/**
- * Class: OpenLayers.Format.XLS.v1_1_0
- * Read / write XLS version 1.1.0.
- *
- * Inherits from:
- * - <OpenLayers.Format.XLS.v1>
- */
-OpenLayers.Format.XLS.v1_1_0 = OpenLayers.Class(
- OpenLayers.Format.XLS.v1, {
-
- /**
- * Constant: VERSION
- * {String} 1.1
- */
- VERSION: "1.1",
-
- /**
- * Property: schemaLocation
- * {String} http://www.opengis.net/xls
- * http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd
- */
- schemaLocation: "http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd",
-
- /**
- * Constructor: OpenLayers.Format.XLS.v1_1_0
- * Instances of this class are not created directly. Use the
- * <OpenLayers.Format.XLS> constructor instead.
- *
- * Parameters:
- * options - {Object} An optional object whose properties will be set on
- * this instance.
- */
- initialize: function(options) {
- OpenLayers.Format.XLS.v1.prototype.initialize.apply(
- this, [options]
- );
- },
-
- CLASS_NAME: "OpenLayers.Format.XLS.v1_1_0"
-
-});
-
-// Support non standard implementation
-OpenLayers.Format.XLS.v1_1 = OpenLayers.Format.XLS.v1_1_0;
Copied: sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1_1_0.js (from rev 11802, trunk/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js)
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1_1_0.js (rev 0)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS/v1_1_0.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -0,0 +1,53 @@
+/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XLS/v1.js
+ */
+
+/**
+ * Class: OpenLayers.Format.XLS.v1_1_0
+ * Read / write XLS version 1.1.0.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.XLS.v1>
+ */
+OpenLayers.Format.XLS.v1_1_0 = OpenLayers.Class(
+ OpenLayers.Format.XLS.v1, {
+
+ /**
+ * Constant: VERSION
+ * {String} 1.1
+ */
+ VERSION: "1.1",
+
+ /**
+ * Property: schemaLocation
+ * {String} http://www.opengis.net/xls
+ * http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd
+ */
+ schemaLocation: "http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd",
+
+ /**
+ * Constructor: OpenLayers.Format.XLS.v1_1_0
+ * Instances of this class are not created directly. Use the
+ * <OpenLayers.Format.XLS> constructor instead.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
+ initialize: function(options) {
+ OpenLayers.Format.XLS.v1.prototype.initialize.apply(
+ this, [options]
+ );
+ },
+
+ CLASS_NAME: "OpenLayers.Format.XLS.v1_1_0"
+
+});
+
+// Support non standard implementation
+OpenLayers.Format.XLS.v1_1 = OpenLayers.Format.XLS.v1_1_0;
Copied: sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS.js (from rev 11802, trunk/openlayers/lib/OpenLayers/Format/XLS.js)
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS.js (rev 0)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Format/XLS.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -0,0 +1,118 @@
+/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XML.js
+ */
+
+/**
+ * Class: OpenLayers.Format.XLS
+ * Read/Wite XLS (OpenLS). Create a new instance with the <OpenLayers.Format.XLS>
+ * constructor. Currently only implemented for Location Utility Services, more
+ * specifically only for Geocoding. No support for Reverse Geocoding as yet.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.XLS = OpenLayers.Class(OpenLayers.Format.XML, {
+
+ /**
+ * APIProperty: defaultVersion
+ * {String} Version number to assume if none found. Default is "1.1.0".
+ */
+ defaultVersion: "1.1.0",
+
+ /**
+ * APIProperty: version
+ * {String} Specify a version string if one is known.
+ */
+ version: null,
+
+ /**
+ * Property: parser
+ * {Object} Instance of the versioned parser. Cached for multiple read and
+ * write calls of the same version.
+ */
+ parser: null,
+
+ /**
+ * Constructor: OpenLayers.Format.XLS
+ * Create a new parser for XLS.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
+ initialize: function(options) {
+ OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
+ },
+
+ /**
+ * APIMethod: write
+ * Write out an XLS request.
+ *
+ * Parameters:
+ * request - {Object} An object representing the LUS request.
+ * options - {Object} Optional configuration object.
+ *
+ * Returns:
+ * {String} An XLS document string.
+ */
+ write: function(request, options) {
+ var version = (options && options.version) ||
+ this.version || this.defaultVersion;
+ if(!this.parser || this.parser.VERSION != version) {
+ var format = OpenLayers.Format.XLS[
+ "v" + version.replace(/\./g, "_")
+ ];
+ if(!format) {
+ throw "Can't find an XLS parser for version " +
+ version;
+ }
+ this.parser = new format(this.options);
+ }
+ var root = this.parser.write(request);
+ return OpenLayers.Format.XML.prototype.write.apply(this, [root]);
+ },
+
+ /**
+ * APIMethod: read
+ * Read an XLS doc and return an object representing the result.
+ *
+ * Parameters:
+ * data - {String | DOMElement} Data to read.
+ * options - {Object} Options for the reader.
+ *
+ * Returns:
+ * {Object} An object representing the GeocodeResponse.
+ */
+ read: function(data, options) {
+ if(typeof data == "string") {
+ data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
+ }
+ var root = data.documentElement;
+ var version = this.version;
+ if(!version) {
+ version = root.getAttribute("version");
+ if(!version) {
+ version = this.defaultVersion;
+ }
+ }
+ if(!this.parser || this.parser.VERSION != version) {
+ var format = OpenLayers.Format.XLS[
+ "v" + version.replace(/\./g, "_")
+ ];
+ if(!format) {
+ throw "Can't find an XLS parser for version " +
+ version;
+ }
+ this.parser = new format(this.options);
+ }
+ var xls = this.parser.read(data, options);
+ return xls;
+ },
+
+ CLASS_NAME: "OpenLayers.Format.XLS"
+});
Modified: sandbox/tschaub/canvas/lib/OpenLayers/Handler/Click.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Handler/Click.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Handler/Click.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -346,6 +346,10 @@
// already received a click
if (this.last.touches && this.last.touches.length === 1) {
// touch device, no dblclick event - this may be a double
+ if (this["double"]) {
+ // on Android don't let the browser zoom on the page
+ OpenLayers.Event.stop(evt);
+ }
this.handleDouble(evt);
}
// if we're not in a touch environment we clear the click timer
Modified: sandbox/tschaub/canvas/lib/OpenLayers/Handler/Drag.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Handler/Drag.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Handler/Drag.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -50,6 +50,13 @@
*/
dragging: false,
+ /**
+ * Property: touch
+ * {Boolean} When a touchstart event is fired, touch will be true and all
+ * mouse related listeners will do nothing.
+ */
+ touch: false,
+
/**
* Property: last
* {<OpenLayers.Pixel>} The last pixel location of the drag.
@@ -336,6 +343,17 @@
* {Boolean} Let the event propagate.
*/
touchstart: function(evt) {
+ if (!this.touch) {
+ this.touch = true;
+ // unregister mouse listeners
+ this.map.events.un({
+ mousedown: this.mousedown,
+ mouseup: this.mouseup,
+ mousemove: this.mousemove,
+ click: this.click,
+ scope: this
+ });
+ }
return this.dragstart(evt);
},
Modified: sandbox/tschaub/canvas/lib/OpenLayers/Handler/Feature.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Handler/Feature.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Handler/Feature.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -120,7 +120,7 @@
/**
* Method: touchstart
- * Handle touchmove events
+ * Handle touchstart events
*
* Parameters:
* evt - {Event}
Modified: sandbox/tschaub/canvas/lib/OpenLayers/Handler/Path.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Handler/Path.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Handler/Path.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -25,8 +25,17 @@
* {<OpenLayers.Feature.Vector>}
*/
line: null,
-
+
/**
+ * APIProperty: maxVertices
+ * {Number} The maximum number of vertices which can be drawn by this
+ * handler. When the number of vertices reaches maxVertices, the
+ * geometry is automatically finalized. This property doesn't
+ * apply if freehand is set. Default is null.
+ */
+ maxVertices: null,
+
+ /**
* Property: freehand
* {Boolean} In freehand mode, the handler starts the path on mouse down,
* adds a point for every mouse move, and finishes the path on mouse up.
@@ -234,7 +243,7 @@
this.passesTolerance(this.lastTouchPx, evt.xy, this.dblclickTolerance)) {
// double-tap, finalize the geometry
this.lastTouchPx = evt.xy; // for up() to detect dblclick and do nothing
- this.finishTouchGeometry();
+ this.finishGeometry();
window.clearTimeout(this.timerId);
this.timerId = null;
return false;
@@ -328,6 +337,9 @@
}
this.addPoint(evt.xy);
this.lastUp = evt.xy;
+ if(this.line.geometry.components.length === this.maxVertices + 1) {
+ this.finishGeometry();
+ }
}
}
}
@@ -337,14 +349,6 @@
},
/**
- * Method: finishTouchGeometry
- * Finish the geometry and send it back to the control.
- */
- finishTouchGeometry: function() {
- this.finishGeometry();
- },
-
- /**
* APIMethod: finishGeometry
* Finish the geometry and send it back to the control.
*/
Modified: sandbox/tschaub/canvas/lib/OpenLayers/Handler/Polygon.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Handler/Polygon.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Handler/Polygon.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -151,10 +151,10 @@
},
/**
- * Method: finishTouchGeometry
+ * Method: finishGeometry
* Finish the geometry and send it back to the control.
*/
- finishTouchGeometry: function() {
+ finishGeometry: function() {
var index = this.line.geometry.components.length - 2;
this.line.geometry.removeComponent(this.line.geometry.components[index]);
this.removePoint();
@@ -293,24 +293,5 @@
return geometry;
},
- /**
- * Method: dblclick
- * Handle double-clicks. Finish the geometry and send it back
- * to the control.
- *
- * Parameters:
- * evt - {Event}
- */
- dblclick: function(evt) {
- if(!this.freehandMode(evt)) {
- // remove the penultimate point
- var index = this.line.geometry.components.length - 2;
- this.line.geometry.removeComponent(this.line.geometry.components[index]);
- this.removePoint();
- this.finalize();
- }
- return false;
- },
-
CLASS_NAME: "OpenLayers.Handler.Polygon"
});
Modified: sandbox/tschaub/canvas/lib/OpenLayers/Handler/RegularPolygon.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Handler/RegularPolygon.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Handler/RegularPolygon.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -303,7 +303,7 @@
* evt - {Event} The mouse out event
*/
out: function(evt) {
- this.cancel();
+ this.finalize();
},
/**
Modified: sandbox/tschaub/canvas/lib/OpenLayers/Protocol/WFS/v1.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers/Protocol/WFS/v1.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers/Protocol/WFS/v1.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -167,6 +167,16 @@
* });
* (end)
*
+ * To use a configured protocol to use WFS paging (if supported by the
+ * server), applications could do the following:
+ *
+ * (code)
+ * protocol.read({
+ * startIndex: 0,
+ * count: 50
+ * });
+ * (end)
+ *
* To limit the attributes returned by the GetFeature request, applications
* can use the propertyNames option to specify the properties to include in
* the response:
Modified: sandbox/tschaub/canvas/lib/OpenLayers.js
===================================================================
--- sandbox/tschaub/canvas/lib/OpenLayers.js 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/lib/OpenLayers.js 2011-03-30 19:38:59 UTC (rev 11803)
@@ -329,6 +329,9 @@
"OpenLayers/Format/OWSContext/v0_3_1.js",
"OpenLayers/Format/WMTSCapabilities.js",
"OpenLayers/Format/WMTSCapabilities/v1_0_0.js",
+ "OpenLayers/Format/XLS.js",
+ "OpenLayers/Format/XLS/v1.js",
+ "OpenLayers/Format/XLS/v1_1_0.js",
"OpenLayers/Layer/WFS.js",
"OpenLayers/Control/GetFeature.js",
"OpenLayers/Control/MouseToolbar.js",
Modified: sandbox/tschaub/canvas/tests/Feature.html
===================================================================
--- sandbox/tschaub/canvas/tests/Feature.html 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/tests/Feature.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -7,7 +7,7 @@
var feature, layer;
function test_Feature_constructor (t) {
- t.plan( 7 );
+ t.plan( 6 );
var layer = {};
var lonlat = new OpenLayers.LonLat(2,1);
@@ -26,11 +26,10 @@
t.ok( feature.lonlat.equals(lonlat), "feature.lonlat set correctly" );
t.eq( feature.data.iconURL, iconURL, "feature.data.iconURL set correctly" );
t.ok( feature.data.iconSize.equals(iconSize), "feature.data.iconSize set correctly" );
- t.ok( feature.popupClass == OpenLayers.Popup.AnchoredBubble, "default popupClass is AnchoredBubble");
}
function test_Feature_createPopup (t) {
- t.plan(1);
+ t.plan(3);
var layer = {};
var lonlat = new OpenLayers.LonLat(2,1);
var iconURL = 'http://boston.openguides.org/features/ORANGE.png';
@@ -45,6 +44,12 @@
//Safari 3 separates style overflow into overflow-x and overflow-y
var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
t.eq(popup.contentDiv.style[prop], "auto", 'overflow on popup is correct');
+ t.ok( popup instanceof OpenLayers.Popup.AnchoredBubble, "popup is an AnchoredBubble by defaults");
+ feature.destroyPopup();
+
+ feature.popupClass = OpenLayers.Popup.FramedCloud;
+ popup = feature.createPopup();
+ t.ok( popup instanceof OpenLayers.Popup.FramedCloud, "setting feature.popupClass works");
}
function test_Feature_createMarker (t) {
t.plan(1);
Modified: sandbox/tschaub/canvas/tests/Format/WFST/v1_1_0.html
===================================================================
--- sandbox/tschaub/canvas/tests/Format/WFST/v1_1_0.html 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/tests/Format/WFST/v1_1_0.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -75,6 +75,13 @@
resultType: "hits",
propertyNames: ["STATE_NAME", "STATE_FIPS", "STATE_ABBR"]
}
+ }, {
+ id: "getfeature1",
+ writer: "wfs:GetFeature",
+ arg: {
+ count: 10,
+ startIndex: 20
+ }
}];
t.plan(cases.length);
@@ -150,6 +157,16 @@
</wfs:Query>
</wfs:GetFeature>
--></div>
+<div id="getfeature1"><!--
+<wfs:GetFeature service="WFS" version="1.1.0" startIndex="20" count="10" xmlns:topp="http://www.openplans.org/topp"
+ xmlns:wfs="http://www.opengis.net/wfs"
+ xmlns:ogc="http://www.opengis.net/ogc"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
+ <wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" xmlns:topp="http://www.openplans.org/topp">
+ </wfs:Query>
+</wfs:GetFeature>
+--></div>
<div id="boundedBy"><!--
<?xml version='1.0' encoding="ISO-8859-1" ?>
<wfs:FeatureCollection
Deleted: sandbox/tschaub/canvas/tests/Format/XLS/v1_1_0.html
===================================================================
--- trunk/openlayers/tests/Format/XLS/v1_1_0.html 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/tests/Format/XLS/v1_1_0.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -1,98 +0,0 @@
-<html>
-<head>
- <script src="../../../lib/OpenLayers.js"></script>
- <script type="text/javascript">
- function test_read(t) {
- t.plan(16);
- var response = '<xls:GeocodeResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd" xmlns:xls="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml"><xls:GeocodeResponseList numberOfGeocodedAddresses="1"><xls:GeocodedAddress><gml:Point srsName="EPSG:28992"><gml:pos dimension="2">122650 483904</gml:pos></gml:Point><xls:Address countryCode="NL"><xls:StreetAddress><xls:Building number="1"/><xls:Street>president kennedylaan</xls:Street></xls:StreetAddress><xls:Place type="MunicipalitySubdivision">amsterdam</xls:Place><xls:Place type="Municipality">amsterdam</xls:Place><xls:Place type="CountrySubdivision">noord holland</xls:Place><xls:PostalCode>1079MB</xls:PostalCode></xls:Address></xls:GeocodedAddress></xls:GeocodeResponseList></xls:GeocodeResponse>';
- var format = new OpenLayers.Format.XLS();
- var output = format.read(response);
- t.eq(output.responseLists.length, 1, "Output contains 1 responseList");
- var responseList = output.responseLists[0];
- t.eq(responseList.numberOfGeocodedAddresses, 1, "Responselist contains 1 geocoded address");
- t.eq(responseList.features.length, 1, "1 feature parsed");
- var feature = responseList.features[0];
- var address = feature.attributes.address;
- t.eq(address.building["number"], "1", "Building number correctly parsed");
- t.eq(address.countryCode, "NL", "Country code correctly parsed");
- t.eq(address.place.CountrySubdivision, "noord holland", "CountrySubDivision correctly parsed");
- t.eq(address.place.Municipality, "amsterdam", "Municipality correctly parsed");
- t.eq(address.place.MunicipalitySubdivision, "amsterdam", "MunicipalitySubdivision correctly parsed");
- t.eq(address.postalCode, "1079MB", "Postalcode correctly parsed");
- t.eq(address.street[0], "president kennedylaan", "Street correctly parsed");
- t.eq(feature.geometry.x, 122650, "Geometry [x] correctly parsed");
- t.eq(feature.geometry.y, 483904, "Geometry [y] correctly parsed");
-
- var responseList = [];
- responseList.push('<?xml version="1.0" encoding="UTF-8" ?>',
-'<XLS xmlns="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/xls LocationUtilityService.xsd" version="1.1">',
-' <ResponseHeader/>',
-' <Response version="1.1" requestID="">',
-' <GeocodeResponse>',
-' <GeocodeResponseList numberOfGeocodedAddresses="2">',
-' <GeocodedAddress>',
-' <gml:Point>',
-' <gml:pos>-71.4589837781615 41.8317239069808</gml:pos>',
-' </gml:Point>',
-' <Address countryCode="">',
-' <StreetAddress>',
-' <Street></Street>',
-' <Street/>',
-' </StreetAddress>',
-' <Place type="Municipality"></Place>',
-' <Place type="CountrySubdivision"></Place>',
-' <PostalCode></PostalCode>',
-' </Address>',
-' <GeocodeMatchCode accuracy="100.0"/>',
-' </GeocodedAddress>',
-' <GeocodedAddress>',
-' <gml:Point>',
-' <gml:pos>-71.4087296631643 41.8269575002255</gml:pos>',
-' </gml:Point>',
-' <Address countryCode="">',
-' <StreetAddress>',
-' <Street></Street>',
-' <Street/>',
-' </StreetAddress>',
-' <Place type="Municipality"></Place>',
-' <Place type="CountrySubdivision"></Place>',
-' <PostalCode></PostalCode>',
-' </Address>',
-' <GeocodeMatchCode accuracy="100.0"/>',
-' </GeocodedAddress>',
-' </GeocodeResponseList>',
-' </GeocodeResponse>',
-' </Response>',
-'</XLS>');
- response = responseList.join("");
- output = format.read(response);
- t.eq(output.version, "1.1", "Version correctly parsed");
- var responseList = output.responseLists[0];
- t.eq(responseList.numberOfGeocodedAddresses, 2, "2 addresses parsed");
- t.eq(responseList.features.length, 2, "2 features parsed");
- t.eq(responseList.features[0].attributes.matchCode.accuracy, 100.0, "Accuracy correctly parsed");
- }
-
- function test_write(t) {
- t.plan(1);
-
- var format = new OpenLayers.Format.XLS();
- var address = {
- countryCode: 'US',
- street: '1 Freedom Rd',
- municipality: 'Providence',
- countrySubdivision: 'RI',
- postalCode: '02909'
- };
- var request = format.write({addresses: [address]});
-
- var expected = '<xls:XLS xmlns:xls="http://www.opengis.net/xls" version="1.1" xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><xls:RequestHeader/><xls:Request methodName="GeocodeRequest" requestID="" version="1.1"><xls:GeocodeRequest><xls:Address countryCode="US"><xls:StreetAddress><xls:Street>1 Freedom Rd</xls:Street></xls:StreetAddress><xls:Place type="Municipality">Providence</xls:Place><xls:Place type="CountrySubdivision">RI</xls:Place><xls:PostalCode>02909</xls:PostalCode></xls:Address></xls:GeocodeRequest></xls:Request></xls:XLS>';
-
- t.xml_eq(request, expected, "XLS geocode request correctly written");
- }
-
- </script>
-</head>
-<body>
-</body>
-</html>
Copied: sandbox/tschaub/canvas/tests/Format/XLS/v1_1_0.html (from rev 11802, trunk/openlayers/tests/Format/XLS/v1_1_0.html)
===================================================================
--- sandbox/tschaub/canvas/tests/Format/XLS/v1_1_0.html (rev 0)
+++ sandbox/tschaub/canvas/tests/Format/XLS/v1_1_0.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -0,0 +1,98 @@
+<html>
+<head>
+ <script src="../../../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ function test_read(t) {
+ t.plan(16);
+ var response = '<xls:GeocodeResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd" xmlns:xls="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml"><xls:GeocodeResponseList numberOfGeocodedAddresses="1"><xls:GeocodedAddress><gml:Point srsName="EPSG:28992"><gml:pos dimension="2">122650 483904</gml:pos></gml:Point><xls:Address countryCode="NL"><xls:StreetAddress><xls:Building number="1"/><xls:Street>president kennedylaan</xls:Street></xls:StreetAddress><xls:Place type="MunicipalitySubdivision">amsterdam</xls:Place><xls:Place type="Municipality">amsterdam</xls:Place><xls:Place type="CountrySubdivision">noord holland</xls:Place><xls:PostalCode>1079MB</xls:PostalCode></xls:Address></xls:GeocodedAddress></xls:GeocodeResponseList></xls:GeocodeResponse>';
+ var format = new OpenLayers.Format.XLS();
+ var output = format.read(response);
+ t.eq(output.responseLists.length, 1, "Output contains 1 responseList");
+ var responseList = output.responseLists[0];
+ t.eq(responseList.numberOfGeocodedAddresses, 1, "Responselist contains 1 geocoded address");
+ t.eq(responseList.features.length, 1, "1 feature parsed");
+ var feature = responseList.features[0];
+ var address = feature.attributes.address;
+ t.eq(address.building["number"], "1", "Building number correctly parsed");
+ t.eq(address.countryCode, "NL", "Country code correctly parsed");
+ t.eq(address.place.CountrySubdivision, "noord holland", "CountrySubDivision correctly parsed");
+ t.eq(address.place.Municipality, "amsterdam", "Municipality correctly parsed");
+ t.eq(address.place.MunicipalitySubdivision, "amsterdam", "MunicipalitySubdivision correctly parsed");
+ t.eq(address.postalCode, "1079MB", "Postalcode correctly parsed");
+ t.eq(address.street[0], "president kennedylaan", "Street correctly parsed");
+ t.eq(feature.geometry.x, 122650, "Geometry [x] correctly parsed");
+ t.eq(feature.geometry.y, 483904, "Geometry [y] correctly parsed");
+
+ var responseList = [];
+ responseList.push('<?xml version="1.0" encoding="UTF-8" ?>',
+'<XLS xmlns="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/xls LocationUtilityService.xsd" version="1.1">',
+' <ResponseHeader/>',
+' <Response version="1.1" requestID="">',
+' <GeocodeResponse>',
+' <GeocodeResponseList numberOfGeocodedAddresses="2">',
+' <GeocodedAddress>',
+' <gml:Point>',
+' <gml:pos>-71.4589837781615 41.8317239069808</gml:pos>',
+' </gml:Point>',
+' <Address countryCode="">',
+' <StreetAddress>',
+' <Street></Street>',
+' <Street/>',
+' </StreetAddress>',
+' <Place type="Municipality"></Place>',
+' <Place type="CountrySubdivision"></Place>',
+' <PostalCode></PostalCode>',
+' </Address>',
+' <GeocodeMatchCode accuracy="100.0"/>',
+' </GeocodedAddress>',
+' <GeocodedAddress>',
+' <gml:Point>',
+' <gml:pos>-71.4087296631643 41.8269575002255</gml:pos>',
+' </gml:Point>',
+' <Address countryCode="">',
+' <StreetAddress>',
+' <Street></Street>',
+' <Street/>',
+' </StreetAddress>',
+' <Place type="Municipality"></Place>',
+' <Place type="CountrySubdivision"></Place>',
+' <PostalCode></PostalCode>',
+' </Address>',
+' <GeocodeMatchCode accuracy="100.0"/>',
+' </GeocodedAddress>',
+' </GeocodeResponseList>',
+' </GeocodeResponse>',
+' </Response>',
+'</XLS>');
+ response = responseList.join("");
+ output = format.read(response);
+ t.eq(output.version, "1.1", "Version correctly parsed");
+ var responseList = output.responseLists[0];
+ t.eq(responseList.numberOfGeocodedAddresses, 2, "2 addresses parsed");
+ t.eq(responseList.features.length, 2, "2 features parsed");
+ t.eq(responseList.features[0].attributes.matchCode.accuracy, 100.0, "Accuracy correctly parsed");
+ }
+
+ function test_write(t) {
+ t.plan(1);
+
+ var format = new OpenLayers.Format.XLS();
+ var address = {
+ countryCode: 'US',
+ street: '1 Freedom Rd',
+ municipality: 'Providence',
+ countrySubdivision: 'RI',
+ postalCode: '02909'
+ };
+ var request = format.write({addresses: [address]});
+
+ var expected = '<xls:XLS xmlns:xls="http://www.opengis.net/xls" version="1.1" xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><xls:RequestHeader/><xls:Request methodName="GeocodeRequest" requestID="" version="1.1"><xls:GeocodeRequest><xls:Address countryCode="US"><xls:StreetAddress><xls:Street>1 Freedom Rd</xls:Street></xls:StreetAddress><xls:Place type="Municipality">Providence</xls:Place><xls:Place type="CountrySubdivision">RI</xls:Place><xls:PostalCode>02909</xls:PostalCode></xls:Address></xls:GeocodeRequest></xls:Request></xls:XLS>';
+
+ t.xml_eq(request, expected, "XLS geocode request correctly written");
+ }
+
+ </script>
+</head>
+<body>
+</body>
+</html>
Modified: sandbox/tschaub/canvas/tests/Handler/Path.html
===================================================================
--- sandbox/tschaub/canvas/tests/Handler/Path.html 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/tests/Handler/Path.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -524,6 +524,43 @@
map.destroy();
}
+ function test_maxVertices(t) {
+ t.plan(1);
+ var map = new OpenLayers.Map("map", {
+ resolutions: [1]
+ });
+ var layer = new OpenLayers.Layer.Vector("foo", {
+ maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+ isBaseLayer: true
+ });
+ map.addLayer(layer);
+ var control = new OpenLayers.Control({});
+ var log = {};
+ var doneCallback = function(evt) {
+ t.ok(evt, 'When maxVertices is reached, the geometry is finalized automatically');
+ };
+ var handler = new OpenLayers.Handler.Path(control, {'done': doneCallback}, {maxVertices: 2});
+ control.handler = handler;
+ map.addControl(control);
+ map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+ // mock up feature drawing
+ handler.activate();
+ var evt = {xy: new OpenLayers.Pixel(0, 0)};
+ handler.mousemove(evt);
+ handler.mousedown(evt);
+ handler.mouseup(evt);
+ evt = {xy: new OpenLayers.Pixel(20, 20)};
+ handler.mousemove(evt);
+ handler.mousedown(evt);
+ handler.mouseup(evt);
+ evt = {xy: new OpenLayers.Pixel(40, 40)};
+ handler.mousemove(evt);
+ handler.mousedown(evt);
+ handler.mouseup(evt);
+ map.destroy();
+ }
+
//
// Sequence tests
//
Modified: sandbox/tschaub/canvas/tests/list-tests.html
===================================================================
--- sandbox/tschaub/canvas/tests/list-tests.html 2011-03-30 16:47:08 UTC (rev 11802)
+++ sandbox/tschaub/canvas/tests/list-tests.html 2011-03-30 19:38:59 UTC (rev 11803)
@@ -103,6 +103,7 @@
<li>Format/SOSGetObservation.html</li>
<li>Format/SOSGetFeatureOfInterest.html</li>
<li>Format/OWSContext/v0_3_1.html</li>
+ <li>Format/XLS/v1_1_0.html</li>
<li>Format/XML.html</li>
<li>Geometry.html</li>
<li>Geometry/Collection.html</li>
More information about the Commits
mailing list