[OpenLayers-Commits] r12447 - in sandbox/august/trunk: . build lib
lib/OpenLayers lib/OpenLayers/Layer lib/OpenLayers/Raster
playground playground/mobile playground/mobile/img
playground/outofbox playground/raster playground/wfst
playground/wfst/request
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed Dec 21 15:44:56 EST 2011
Author: augusttown
Date: 2011-12-21 12:44:55 -0800 (Wed, 21 Dec 2011)
New Revision: 12447
Added:
sandbox/august/trunk/build/build.full.closure.bat
sandbox/august/trunk/lib/OpenLayers/Layer/Raster.js
sandbox/august/trunk/lib/OpenLayers/Raster.js
sandbox/august/trunk/lib/OpenLayers/Raster/
sandbox/august/trunk/lib/OpenLayers/Raster/Composite.js
sandbox/august/trunk/lib/OpenLayers/Raster/Grid.js
sandbox/august/trunk/lib/OpenLayers/Raster/Operation.js
sandbox/august/trunk/playground/mobile/
sandbox/august/trunk/playground/mobile/img/
sandbox/august/trunk/playground/mobile/img/mobile-layers.png
sandbox/august/trunk/playground/mobile/img/mobile-loc.png
sandbox/august/trunk/playground/mobile/img/mobile-zoombar.png
sandbox/august/trunk/playground/mobile/mobile-navigation.html
sandbox/august/trunk/playground/mobile/mobile-navigation.js
sandbox/august/trunk/playground/mobile/mobile.html
sandbox/august/trunk/playground/mobile/mobile.js
sandbox/august/trunk/playground/mobile/style.mobile-jq.css
sandbox/august/trunk/playground/mobile/style.mobile.css
sandbox/august/trunk/playground/outofbox/kinetic.html
sandbox/august/trunk/playground/outofbox/kinetic.js
sandbox/august/trunk/playground/raster/
sandbox/august/trunk/playground/raster/raster-array.html
sandbox/august/trunk/playground/raster/raster-array.js
sandbox/august/trunk/playground/raster/raster-classification.html
sandbox/august/trunk/playground/raster/raster-classification.js
sandbox/august/trunk/playground/raster/raster-grid-layer.html
sandbox/august/trunk/playground/raster/raster-grid-layer.js
sandbox/august/trunk/playground/raster/raster-magnify.html
sandbox/august/trunk/playground/raster/raster-magnify.js
sandbox/august/trunk/playground/raster/raster-operations.html
sandbox/august/trunk/playground/raster/raster-operations.js
sandbox/august/trunk/playground/raster/raster-query.html
sandbox/august/trunk/playground/raster/raster-query.js
sandbox/august/trunk/playground/wfst/request/
sandbox/august/trunk/playground/wfst/request/delete.point.without.lock.openlayers.req.xml
sandbox/august/trunk/playground/wfst/request/delete.polygon.without.lock.openlayers.req.xml
sandbox/august/trunk/playground/wfst/request/delete.polyline.without.lock.openlayers.req.xml
sandbox/august/trunk/playground/wfst/request/insert.point.without.lock.openlayers.req.xml
sandbox/august/trunk/playground/wfst/request/insert.polygon.without.lock.openlayers.req.xml
sandbox/august/trunk/playground/wfst/request/insert.polyline.without.lock.openlayers.req.xml
sandbox/august/trunk/playground/wfst/request/update.point.without.lock.openlayers.req.xml
sandbox/august/trunk/playground/wfst/request/update.polygon.without.lock.openlayers.req.xml
sandbox/august/trunk/playground/wfst/request/update.polyline.without.lock.openlayers.req.xml
sandbox/august/trunk/playground/wfst/response/
sandbox/august/trunk/playground/wfst/wfst-without-lock.html
sandbox/august/trunk/playground/wfst/wfst-without-lock.js
Modified:
sandbox/august/trunk/
sandbox/august/trunk/build/build.full.jsmin.bat
sandbox/august/trunk/lib/OpenLayers.js
sandbox/august/trunk/playground/index.html
sandbox/august/trunk/playground/wfst/wfst-with-lock.js
Log:
Property changes on: sandbox/august/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk/openlayers:10329-10354,10357-10502,10504-12437,12439
+ /trunk/openlayers:10329-10354,10357-10502,10504-12437,12439,12446
Added: sandbox/august/trunk/build/build.full.closure.bat
===================================================================
--- sandbox/august/trunk/build/build.full.closure.bat (rev 0)
+++ sandbox/august/trunk/build/build.full.closure.bat 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1 @@
+C:\yingqi\sazabi\programs\python\x64\2.7.1\python.exe build.py C:\yingqi\sazabi\programs\python\x64\2.7.1\python.exe build.py -c closure full OpenLayers-Closure.js
\ No newline at end of file
Modified: sandbox/august/trunk/build/build.full.jsmin.bat
===================================================================
--- sandbox/august/trunk/build/build.full.jsmin.bat 2011-12-05 06:47:12 UTC (rev 12446)
+++ sandbox/august/trunk/build/build.full.jsmin.bat 2011-12-21 20:44:55 UTC (rev 12447)
@@ -1 +1 @@
-C:\yingqi\sazabi\programs\python\x64\2.7.1\python.exe build.py -c jsmin full OpenLayers.js
\ No newline at end of file
+C:\yingqi\sazabi\programs\python\x64\2.7.1\python.exe build.py -c jsmin full OpenLayers-jsmin.js
\ No newline at end of file
Added: sandbox/august/trunk/lib/OpenLayers/Layer/Raster.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Layer/Raster.js (rev 0)
+++ sandbox/august/trunk/lib/OpenLayers/Layer/Raster.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,94 @@
+/**
+ * @requires OpenLayers/Layer.js
+ * @requires OpenLayers/Raster/Composite.js
+ */
+
+/**
+ * Class: OpenLayers.Layer.Raster
+ *
+ * Inherits from:
+ * - <OpenLayers.Layer>
+ */
+OpenLayers.Layer.Raster = OpenLayers.Class(OpenLayers.Layer, {
+
+ needsUpdate: false,
+
+ initialize: function(config) {
+ config = config || {};
+ var data = config.data;
+ delete config.data;
+ OpenLayers.Layer.prototype.initialize.apply(this, [config.name, config]);
+
+ this.canvas = document.createElement("canvas");
+ this.canvas.style.position = "absolute";
+ this.div.appendChild(this.canvas);
+ this.context = this.canvas.getContext("2d");
+ if (data) {
+ this.setData(data);
+ }
+
+ },
+
+ setData: function(data) {
+ this.clearData();
+ this.data = data;
+ data.events.register("update", this, this.onDataUpdate);
+ },
+
+ clearData: function() {
+ if (this.data) {
+ this.data.events.unregister("update", this, this.onDataUpdate);
+ delete this.data;
+ }
+ },
+
+ moveTo: function() {
+ this.needsUpdate = true;
+ OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
+ window.setTimeout(OpenLayers.Function.bind(this.afterMoveTo, this), 0);
+ },
+
+ afterMoveTo: function() {
+ if (this.needsUpdate) {
+ this.onDataUpdate();
+ }
+ },
+
+ onDataUpdate: function() {
+ var map = this.map;
+ if (map) {
+ var size = map.getSize();
+ var cols = this.data.numCols();
+ var rows = this.data.numRows();
+ var style = map.layerContainerDiv.style;
+ this.canvas.width = cols;
+ this.canvas.height = rows;
+ this.canvas.style.top = (-parseInt(style.top)) + "px";
+ this.canvas.style.left = (-parseInt(style.left)) + "px";
+ this.canvas.style.width = size.w + "px";
+ this.canvas.style.height = size.h + "px";
+
+ var imageData = this.context.createImageData(cols, rows);
+ var data = imageData.data;
+ this.data.forEach(function(value, index) {
+ var offset = 4 * index;
+ if (!value.length) {
+ value = [value, value, value];
+ }
+ data[offset + 0] = value[0]; // red
+ data[offset + 1] = value[1]; // green
+ data[offset + 2] = value[2]; // blue
+ if (value.length > 3) {
+ data[offset + 3] = value[3]; // opacity
+ } else {
+ data[offset + 3] = 255; // assume opaque
+ }
+ });
+ this.context.putImageData(imageData, 0, 0);
+ this.needsUpdate = false;
+ }
+ },
+
+ CLASS_NAME: "OpenLayers.Layer.Raster"
+
+});
Added: sandbox/august/trunk/lib/OpenLayers/Raster/Composite.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Raster/Composite.js (rev 0)
+++ sandbox/august/trunk/lib/OpenLayers/Raster/Composite.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,145 @@
+/**
+ * @requires OpenLayers/Raster/Grid.js
+ */
+
+OpenLayers.Raster.Composite = OpenLayers.Class(OpenLayers.Raster.Grid, (function() {
+
+ var grids;
+
+ return {
+
+ /**
+ * Constructor: OpenLayers.Raster.Composite
+ */
+ initialize: function(config) {
+ if (config.grids) {
+ grids = config.grids;
+ delete config.grids;
+ }
+ OpenLayers.Raster.Grid.prototype.initialize.apply(this, [config]);
+ if (grids) {
+ for (var i=0, ii=grids.length; i<ii; ++i) {
+ grids[i].events.register("update", this, function() {
+ this.events.triggerEvent("update");
+ });
+ }
+ }
+ },
+
+ numCols: function() {
+ return grids && grids[0] && grids[0].numCols();
+ },
+ numRows: function() {
+ return grids && grids[0] && grids[0].numRows();
+ },
+ getCount: function() {
+ return grids && grids.length;
+ },
+
+ getValue: function(col, row) {
+ var count = grids.length;
+ var values = new Array(count);
+ for (var c=0; c<count; ++c) {
+ values[c] = grids[c].getValue(col, row);
+ }
+ return values;
+ },
+
+ getGrid: function(index) {
+ if (typeof index !== "number" || isNaN(index) || index < 0 || index >= this.getCount()) {
+ throw new Error("Bad grid index.")
+ }
+ var composite = this;
+ return new OpenLayers.Raster.Grid({
+ numCols: function() {
+ return composite.numCols();
+ },
+ numRows: function() {
+ return composite.numRows();
+ },
+ getValue: function(col, row) {
+ return composite.getValue(col, row)[index];
+ }
+ });
+ },
+
+
+ CLASS_NAME: "OpenLayers.Raster.Composite"
+ };
+
+})());
+
+OpenLayers.Raster.Composite.fromLayer = function(layer) {
+
+ if (!(layer instanceof OpenLayers.Layer.Grid)) {
+ throw new Error("Only OpenLayers.Layer.Grid type layers can be used to create a raster");
+ }
+
+ var canvas = document.createElement("canvas");
+ var context = canvas.getContext("2d");
+
+ var composite = new OpenLayers.Raster.Composite({
+ numCols: function() {
+ return canvas.width;
+ },
+ numRows: function() {
+ return canvas.height;
+ },
+ getCount: function() {
+ return 4;
+ },
+ getValue: function(col, row) {
+ var pixelArray = getPixelArray();
+ var cols = canvas.width;
+ var offset = 4 * (col + (row * cols));
+ return Array.prototype.slice.apply(pixelArray, [offset, offset+4]);
+ }
+ });
+
+ var cache = {};
+ function getPixelArray() {
+ if (!cache.pixelArray) {
+ var imageData = context.getImageData(0, 0, canvas.width, canvas.height);
+ cache.pixelArray = imageData.data;
+ }
+ return cache.pixelArray;
+ }
+
+ function update() {
+ cache = {};
+ var map = layer.map;
+ var tileSize = layer.tileSize;
+ var mapSize = map.getSize();
+ canvas.width = mapSize.w;
+ canvas.height = mapSize.h;
+ var mapBounds = map.getExtent();
+ var tiles = layer.grid;
+ var array, tile, tileBounds, img, cornerLocation, cornerPixel;
+ for (var i=0, ii=tiles.length; i<ii; ++i) {
+ array = tiles[i];
+ for (var j=0, jj=array.length; j<jj; ++j) {
+ tile = array[j];
+ tileBounds = tile.bounds;
+ img = tile.imgDiv
+ if (img && img.style.display !== "none" && mapBounds.intersectsBounds(tileBounds)) {
+ cornerLocation = new OpenLayers.LonLat(tileBounds.left, tileBounds.top);
+ cornerPixel = map.getPixelFromLonLat(cornerLocation);
+ context.drawImage(img, cornerPixel.x, cornerPixel.y, tileSize.w, tileSize.h);
+ }
+ }
+ }
+ composite.events.triggerEvent("update");
+ }
+
+ if (layer.map) {
+ layer.map.events.register("moveend", null, update);
+ } else {
+ layer.events.register("added", null, function() {
+ layer.map.events.register("moveend", null, update);
+ });
+ }
+ layer.events.register("tileloaded", null, update);
+
+ return composite;
+
+};
Added: sandbox/august/trunk/lib/OpenLayers/Raster/Grid.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Raster/Grid.js (rev 0)
+++ sandbox/august/trunk/lib/OpenLayers/Raster/Grid.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,91 @@
+/**
+ * @requires OpenLayers/Raster.js
+ * @requires OpenLayers/BaseTypes/Class.js
+ */
+
+OpenLayers.Raster.Grid = OpenLayers.Class({
+
+ /**
+ * Constant: EVENT_TYPES
+ * {Array(String)} Supported application event types. Register a listener
+ * for a particular event with the following syntax:
+ * (code)
+ * grid.events.register(type, obj, listener);
+ * (end)
+ *
+ * Listeners will be called with a reference to an event object. The
+ * properties of this event depends on exactly what happened.
+ *
+ * Raster grid event types:
+ * update - Fired when the grid's underlying data is updated.
+ */
+ EVENT_TYPES: ["update"],
+
+ /**
+ * Constructor: OpenLayers.Raster.Grid
+ */
+ initialize: function(config) {
+ OpenLayers.Util.extend(this, config);
+ this.events = new OpenLayers.Events(this, null, this.EVENT_TYPES);
+ },
+
+ /**
+ * Method: getValue
+ */
+ getValue: function(col, row) {
+ throw new Error("getValue must be defined")
+ },
+ /**
+ * APIMethod: numCols
+ */
+ numCols: function() {
+ throw new Error("numCols must be defined")
+ },
+ /**
+ * APIMethod: numRows
+ */
+ numRows: function() {
+ throw new Error("numRows must be defined")
+ },
+
+ /**
+ * APIMethod: forEach
+ * Iterate through call values in the grid. The provided function
+ * will be called with each cell value.
+ *
+ * Parameters:
+ * fn - {Function}
+ */
+ forEach: function(fn) {
+ var cols = this.numCols();
+ var rows = this.numRows();
+ for (var j=0; j<rows; ++j) {
+ for (var i=0; i<cols; ++i) {
+ fn(this.getValue(i, j), i + j*cols);
+ }
+ }
+ },
+
+ CLASS_NAME: "OpenLayers.Raster.Grid"
+
+});
+
+OpenLayers.Raster.Grid.fromArray = function(array) {
+
+ var rows = array.length;
+ var cols = array[0] && array[0].length || 0;
+
+ return new OpenLayers.Raster.Grid({
+ numCols: function() {
+ return cols;
+ },
+ numRows: function() {
+ return rows;
+ },
+ getValue: function(col, row) {
+ return array[row][col];
+ }
+ });
+
+};
+
Added: sandbox/august/trunk/lib/OpenLayers/Raster/Operation.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Raster/Operation.js (rev 0)
+++ sandbox/august/trunk/lib/OpenLayers/Raster/Operation.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,84 @@
+/**
+ * @requires OpenLayers/Raster/Composite.js
+ */
+
+OpenLayers.Raster.Operation = (function() {
+ var Grid = OpenLayers.Raster.Grid;
+ var Composite = OpenLayers.Raster.Composite;
+ var operations = {};
+
+ return {
+
+ create: function(fn) {
+ var op = function() {
+ var args = Array.prototype.slice.call(arguments);
+ var len = args.length;
+
+ function getFirstGrid() {
+ var grid;
+ for (var i=0; i<len; ++i) {
+ if (args[i] instanceof Grid) {
+ grid = args[i];
+ break;
+ }
+ }
+ if (!grid) {
+ throw new Error("Operation must be called with at least one grid.");
+ }
+ return grid;
+ }
+
+ var count = 1;
+ for (var i=0; i<len; ++i) {
+ if (args[i] instanceof Composite) {
+ count = Math.max(count, args[i].getCount());
+ }
+ }
+
+ var Constructor = (count > 1) ? Composite : Grid;
+ var grid = new Constructor({
+ numCols: function() {
+ return getFirstGrid().numCols();
+ },
+ numRows: function() {
+ return getFirstGrid().numRows();
+ },
+ getValue: function(col, row) {
+ var values = new Array(len);
+ var arg;
+ for (var i=0; i<len; ++i) {
+ arg = args[i];
+ if (arg instanceof Grid) {
+ values[i] = arg.getValue(col, row);
+ } else {
+ values[i] = arg;
+ }
+ }
+ return fn.apply(null, values);
+ },
+ getCount: function() {
+ return count;
+ }
+ });
+
+ for (var i=0; i<len; ++i) {
+ if (args[i] instanceof Grid) {
+ args[i].events.register("update", null, function() {
+ grid.events.triggerEvent("update");
+ });
+ }
+ }
+
+ return grid;
+
+ };
+ return op;
+ },
+
+ get: function(name) {
+ return operations[name];
+ }
+
+ };
+
+})();
Added: sandbox/august/trunk/lib/OpenLayers/Raster.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Raster.js (rev 0)
+++ sandbox/august/trunk/lib/OpenLayers/Raster.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,4 @@
+/**
+ * @requires OpenLayers/SingleFile.js
+ */
+OpenLayers.Raster = {};
\ No newline at end of file
Modified: sandbox/august/trunk/lib/OpenLayers.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers.js 2011-12-05 06:47:12 UTC (rev 12446)
+++ sandbox/august/trunk/lib/OpenLayers.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -159,7 +159,7 @@
"OpenLayers/Layer/TileCache.js",
"OpenLayers/Layer/Zoomify.js",
"OpenLayers/Layer/Process.js",
- "OpenLayers/Layer/ArcGISCache.js",
+ "OpenLayers/Layer/ArcGISCache.js",
"OpenLayers/Popup/Anchored.js",
"OpenLayers/Popup/AnchoredBubble.js",
"OpenLayers/Popup/Framed.js",
@@ -403,7 +403,13 @@
"OpenLayers/Test/AgsRestAdmin.js",
// playground end
"OpenLayers/Lang.js",
- "OpenLayers/Lang/en.js"
+ "OpenLayers/Lang/en.js",
+ // raster exmaples from http://demo.opengeo.org/~tschaub/ol/raster
+ "OpenLayers/Layer/Raster.js",
+ "OpenLayers/Raster.js",
+ "OpenLayers/Raster/Grid.js",
+ "OpenLayers/Raster/Composite.js",
+ "OpenLayers/Raster/Operation.js",
]; // etc.
}
Modified: sandbox/august/trunk/playground/index.html
===================================================================
--- sandbox/august/trunk/playground/index.html 2011-12-05 06:47:12 UTC (rev 12446)
+++ sandbox/august/trunk/playground/index.html 2011-12-21 20:44:55 UTC (rev 12447)
@@ -22,11 +22,13 @@
<tr><td><a href="mapquest/mapquest-osm.html"><b>mapquest/mapquest-osm</b></a></td></tr>
<tr><td><a href="mapquest/mapquest-openaerial.html"><b>mapquest/mapquest-openaerial</b></a></td></tr>
<tr><td><a href="mobac/mobac.osmdroid.zip.html"><b>mobac/mobac.osmdroid.zip.html</b></a></td></tr>
+ <tr><td><a href="mobile/mobile-navigation.html"><b>mobile/mobile-navigation.html</b></a></td></tr>
<tr><td><a href="openscales/openscales.viewer.html"><b>openscales/openscales.viewer.html</b></a></td></tr>
<tr><td><a href="outofbox/arcgiscache_ags.html"><b>outofbox/arcgiscache_ags.html</b></a></td></tr>
<tr><td><a href="outofbox/arcgiscache_jsonp.html"><b>outofbox/arcgiscache_jsonp.html</b></a></td></tr>
<tr><td><a href="outofbox/csw.html"><b>outofbox/csw</b></a></td></tr>
<tr><td><a href="others/export-svg.html"><b>others/export-svg.html</b></a></td></tr>
+ <tr><td><a href="outofbox/kinetic.html"><b>outofbox/kinetic.html</b></a></td></tr>
<tr><td><a href="outofbox/graticule.html"><b>outofbox/graticule</b></a></td></tr>
<tr><td><a href="outofbox/wms-capabilities.html"><b>outofbox/wms-capabilities.html</b></a></td></tr>
<tr><td><a href="outofbox/proxyhost-function.html"><b>outofbox/proxyhost-function</b></a></td></tr>
@@ -37,9 +39,11 @@
<tr><td><a href="outofbox/wmts.html"><b>outofbox/wmts.html</b></a></td></tr>
<tr><td><a href="outofbox/wmts-capabilities.html"><b>outofbox/wmts-capabilities.html</b></a></td></tr>
<tr><td><a href="outofbox/zoomify.html"><b>outofbox/zoomify</b></a></td></tr>
+ <tr><td><a href="raster/raster-array.html"><b>raster/raster-array.html</b></a></td></tr>
<tr><td><a href="sld/agsstyles2sld.html"><b>sld/agsstyles2sld.html</b></a></td></tr>
<tr><td><a href="wfst/wfst-with-lock.html"><b>wfst/wfst-with-lock.html</b></a></td></tr>
<tr><td><a href="wfst/wfst-with-lock-no-map.html"><b>wfst/wfst-with-lock-no-map.html</b></a></td></tr>
+ <tr><td><a href="wfst/wfst-without-lock.html"><b>wfst/wfst-without-lock.html</b></a></td></tr>
<tr><td><a href="wfst/wfst-test.html"><b>wfst/wfst-test.html</b></a></td></tr>
<tr><td><a href="webmap.wms/webmap-wms-reqrecorder.html"><b>webmap.wms/webmap-wms-reqrecorder.html</b></a></td></tr>
<tr><td><a href="wmts/wmts.html"><b>wmts/wmts.html</b></a></td></tr>
Added: sandbox/august/trunk/playground/mobile/img/mobile-layers.png
===================================================================
(Binary files differ)
Property changes on: sandbox/august/trunk/playground/mobile/img/mobile-layers.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: sandbox/august/trunk/playground/mobile/img/mobile-loc.png
===================================================================
(Binary files differ)
Property changes on: sandbox/august/trunk/playground/mobile/img/mobile-loc.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: sandbox/august/trunk/playground/mobile/img/mobile-zoombar.png
===================================================================
(Binary files differ)
Property changes on: sandbox/august/trunk/playground/mobile/img/mobile-zoombar.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: sandbox/august/trunk/playground/mobile/mobile-navigation.html
===================================================================
--- sandbox/august/trunk/playground/mobile/mobile-navigation.html (rev 0)
+++ sandbox/august/trunk/playground/mobile/mobile-navigation.html 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <title>Playground Mobile Navigation Example</title>
+
+ <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?mobile"></script>
+ <script type="text/javascript" src="mobile-navigation.js"></script>
+ </head>
+ <body onload="init();">
+ <div id="map" class="mediummap"></div>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/mobile/mobile-navigation.js
===================================================================
--- sandbox/august/trunk/playground/mobile/mobile-navigation.js (rev 0)
+++ sandbox/august/trunk/playground/mobile/mobile-navigation.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,31 @@
+var map;
+
+function init() {
+
+ map = new OpenLayers.Map({
+ div: "map",
+ theme: null,
+ projection: new OpenLayers.Projection("EPSG:900913"),
+ units: "m",
+ numZoomLevels: 18,
+ maxResolution: 156543.0339,
+ maxExtent: new OpenLayers.Bounds(
+ -20037508.34, -20037508.34, 20037508.34, 20037508.34
+ ),
+ controls: [
+ new OpenLayers.Control.TouchNavigation({
+ dragPanOptions: {
+ enableKinetic: true
+ }
+ }),
+ new OpenLayers.Control.ZoomPanel()
+ ],
+ layers: [
+ new OpenLayers.Layer.OSM("OpenStreetMap", null, {
+ transitionEffect: 'resize'
+ })
+ ]
+ });
+ map.setCenter(new OpenLayers.LonLat(0, 0), 3);
+
+}
Added: sandbox/august/trunk/playground/mobile/mobile.html
===================================================================
--- sandbox/august/trunk/playground/mobile/mobile.html (rev 0)
+++ sandbox/august/trunk/playground/mobile/mobile.html 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+ <head>
+ <title>OpenLayers Mobile</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <link rel="stylesheet" href="style.mobile.css" type="text/css">
+ <script src="../../lib/OpenLayers.js?mobile"></script>
+ <script src="mobile.js"></script>
+ <style>
+ html, body {
+ margin : 0;
+ padding : 0;
+ height : 100%;
+ width : 100%;
+ }
+ @media only screen and (max-width: 600px) {
+ html, body {
+ height : 117%;
+ }
+ }
+ #map {
+ width : 100%;
+ position : relative;
+ height : 100%;
+ }
+ .olControlAttribution {
+ position : absolute;
+ font-size : 10px;
+ bottom : 0 !important;
+ right : 0 !important;
+ background : rgba(0,0,0,0.1);
+ font-family : Arial;
+ padding : 2px 4px;
+ border-radius : 5px 0 0 0;
+ }
+ 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;
+ }
+ </style>
+ </head>
+ <body>
+ <h1 id="title">Basic Mobile Example</h1>
+ <div id="tags">
+ mobile
+ </div>
+ <p id="shortdesc">
+ A basic full-screen map for mobile devices.
+ </p>
+ <div id="map"></div>
+ <script>
+ init();
+ </script>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/mobile/mobile.js
===================================================================
--- sandbox/august/trunk/playground/mobile/mobile.js (rev 0)
+++ sandbox/august/trunk/playground/mobile/mobile.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,39 @@
+// initialize map when page ready
+var map;
+
+// Get rid of address bar on iphone/ipod
+var fixSize = function() {
+ window.scrollTo(0,0);
+ document.body.style.height = '100%';
+ if (!(/(iphone|ipod)/.test(navigator.userAgent.toLowerCase()))) {
+ if (document.body.parentNode) {
+ document.body.parentNode.style.height = '100%';
+ }
+ }
+};
+setTimeout(fixSize, 700);
+setTimeout(fixSize, 1500);
+
+var init = function () {
+ // create map
+ map = new OpenLayers.Map({
+ div: "map",
+ theme: null,
+ controls: [
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.TouchNavigation({
+ dragPanOptions: {
+ enableKinetic: true
+ }
+ }),
+ new OpenLayers.Control.ZoomPanel()
+ ],
+ layers: [
+ new OpenLayers.Layer.OSM("OpenStreetMap", null, {
+ transitionEffect: 'resize'
+ })
+ ],
+ center: new OpenLayers.LonLat(742000, 5861000),
+ zoom: 3
+ });
+};
Added: sandbox/august/trunk/playground/mobile/style.mobile-jq.css
===================================================================
--- sandbox/august/trunk/playground/mobile/style.mobile-jq.css (rev 0)
+++ sandbox/august/trunk/playground/mobile/style.mobile-jq.css 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,62 @@
+html ,
+body {
+ margin: 0;
+ padding: 0;
+ height: 100%;
+}
+.ui-content {
+ padding: 0;
+}
+.ui-footer {
+ text-align: center;
+ padding: 5px 0;
+}
+.portrait, .portrait #mappage {
+ min-height: 0;
+}
+/*.portrait, .portrait .ui-page{*/
+ /*min-height: 0;*/
+/*}*/
+#mappage, #mappage .ui-content, #map {
+ width: 100%;
+ height: 100%;
+}
+.olControlAttribution {
+ font-size: 10px;
+ bottom: 5px;
+ right: 5px;
+}
+#navigation {
+ position: absolute;
+ bottom: 70px;
+ left: 10px;
+ z-index: 1000;
+}
+#navigation .ui-btn-icon-notext {
+ display: block;
+ padding: 7px 6px 7px 8px;
+}
+#title, #tags, #shortdesc {
+ display: none;
+}
+.ui-icon-check {
+ opacity: 0.3;
+}
+.checked .ui-icon-check {
+ opacity: 1;
+}
+.ui-icon-locate {
+ background-image: url(img/locate.png);
+}
+.ui-icon-layers {
+ background-image: url(img/openlayers.png);
+}
+.ui-content .ui-listview-inset, #search_results {
+ margin: 1em;
+}
+.ui-content .ui-listview {
+ margin: 0px;
+}
+#details-list li{
+ padding:15px 10px;
+}
Added: sandbox/august/trunk/playground/mobile/style.mobile.css
===================================================================
--- sandbox/august/trunk/playground/mobile/style.mobile.css (rev 0)
+++ sandbox/august/trunk/playground/mobile/style.mobile.css 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,25 @@
+div.olControlZoomPanel {
+ height: 108px;
+ width: 36px;
+ position: absolute;
+ top: 20px;
+ left: 20px;
+}
+div.olControlZoomPanel div {
+ width: 36px;
+ height: 36px;
+ background-image: url(img/mobile-zoombar.png);
+ left: 0;
+}
+div.olControlZoomPanel .olControlZoomInItemInactive {
+ top: 0;
+ background-position: 0 0;
+}
+div.olControlZoomPanel .olControlZoomToMaxExtentItemInactive {
+ top: 36px;
+ background-position: 0 -36px;
+}
+div.olControlZoomPanel .olControlZoomOutItemInactive {
+ top: 72px;
+ background-position: 0 -72px;
+}
Added: sandbox/august/trunk/playground/outofbox/kinetic.html
===================================================================
--- sandbox/august/trunk/playground/outofbox/kinetic.html (rev 0)
+++ sandbox/august/trunk/playground/outofbox/kinetic.html 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers Kinetic Dragging Example</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <link rel="stylesheet" href="../../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="../style.css" type="text/css">
+ </head>
+ <body>
+ <div id="map" class="bigmap"></div>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script src="kinetic.js"></script>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/outofbox/kinetic.js
===================================================================
--- sandbox/august/trunk/playground/outofbox/kinetic.js (rev 0)
+++ sandbox/august/trunk/playground/outofbox/kinetic.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,32 @@
+var map = new OpenLayers.Map({
+ div: "map",
+ resolutions: [0.087890625, 0.0439453125, 0.02197265625, 0.010986328125],
+ panDuration: 100,
+ controls: [
+ new OpenLayers.Control.Navigation({
+ dragPanOptions: {enableKinetic: true}
+ })
+ ]
+});
+
+var layer = new OpenLayers.Layer.TileCache(
+ "TileCache Layer",
+ [
+ "http://c0.tilecache.osgeo.org/wms-c/cache/",
+ "http://c1.tilecache.osgeo.org/wms-c/cache/",
+ "http://c2.tilecache.osgeo.org/wms-c/cache/",
+ "http://c3.tilecache.osgeo.org/wms-c/cache/",
+ "http://c4.tilecache.osgeo.org/wms-c/cache/"
+ ],
+ "basic",
+ {
+ serverResolutions: [0.703125, 0.3515625, 0.17578125, 0.087890625,
+ 0.0439453125, 0.02197265625, 0.010986328125,
+ 0.0054931640625, 0.00274658203125, 0.001373291015625,
+ 0.0006866455078125, 0.00034332275390625, 0.000171661376953125,
+ 0.0000858306884765625, 0.00004291534423828125, 0.000021457672119140625],
+ buffer: 4
+ }
+);
+map.addLayer(layer);
+map.setCenter(new OpenLayers.LonLat(0, 0), 0);
\ No newline at end of file
Added: sandbox/august/trunk/playground/raster/raster-array.html
===================================================================
--- sandbox/august/trunk/playground/raster/raster-array.html (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-array.html 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers Raster from Array Example</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+
+ <link rel="stylesheet" href="../../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="../style.css" type="text/css">
+ <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css" type="text/css">
+
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
+
+ <script src="../../lib/OpenLayers.js"></script>
+ <style>
+ .olControlZoomPanel {
+ top: 20px;
+ }
+
+ .widget-wrapper {
+ width: 492px;
+ background-color: #f9f9f9;
+ border: solid 1px #ddd;
+ padding: 10px;
+ margin: 10px 0;
+ }
+
+ .slider {
+ margin-top: 5px;
+ float: right;
+ width: 80%;
+ }
+
+ #reset {
+ padding-left: 1em;
+ font-size: 1.2em;
+ }
+ </style>
+ </head>
+ <body>
+ <h1 id="title">Array as Raster Data</h1>
+ <div id="tags">Raster, Grid, Array</div>
+ <p id="shortdesc">This demo generates a raster grid from array
+ data.</p>
+ <div id="map" class="smallmap"></div>
+ <div class="widget-wrapper ui-widget ui-corner-all">
+ <span>hue:</span>
+ <div id="slider" class="slider"></div>
+ </div>
+ <p>
+ See the <a href="raster-array.js" target="_blank">raster-array.js</a>
+ source for details on how this is done.
+ </p>
+ <script src="raster-array.js"></script>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/raster/raster-array.js
===================================================================
--- sandbox/august/trunk/playground/raster/raster-array.js (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-array.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,59 @@
+var cols = 256;
+var rows = 4;
+
+var array = new Array(rows);
+var values = new Array(cols);
+for (var i=0; i<cols; ++i) {
+ values[i] = i * 2 * Math.PI / cols;
+}
+// fill all rows with same
+for (var j=0; j<rows; ++j) {
+ array[j] = values;
+}
+
+var data = OpenLayers.Raster.Grid.fromArray(array);
+
+var color = OpenLayers.Raster.Operation.create(function(value, offset) {
+ return (Math.cos(value + offset) + 1) * 255 / 2;
+});
+
+var red = color(data, -Math.PI / 4);
+var green = color(data, -3 * Math.PI / 4);
+var blue = color(data, 3 * Math.PI / 4);
+
+var raster = new OpenLayers.Layer.Raster({
+ name: "Colors",
+ data: new OpenLayers.Raster.Composite({grids: [red, green, blue]}),
+ isBaseLayer: true
+});
+
+var map = new OpenLayers.Map({
+ div: "map",
+ theme: null,
+ controls: [
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.Navigation({
+ dragPanOptions: {
+ enableKinetic: true
+ }
+ }),
+ new OpenLayers.Control.ZoomPanel()
+ ],
+ layers: [raster],
+ center: new OpenLayers.LonLat(0, 0),
+ zoom: 1
+});
+
+// add a slider for color control
+var originalValues = values.slice();
+$("#slider").slider({
+ step: 2,
+ slide: function(event, ui) {
+ var offset = 2 * Math.PI * (ui.value / 100);
+ for (var i=0; i<cols; ++i) {
+ values[i] = originalValues[i] + offset;
+ }
+ data.events.triggerEvent("update");
+ }
+});
+
Added: sandbox/august/trunk/playground/raster/raster-classification.html
===================================================================
--- sandbox/august/trunk/playground/raster/raster-classification.html (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-classification.html 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers Raster Classification Example</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css" type="text/css">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
+ <script src="../OpenLayers.js"></script>
+ <style>
+ .olControlZoomPanel {
+ top: 20px;
+ }
+ .widget-wrapper {
+ width: 492px;
+ background-color: #f9f9f9;
+ border: solid 1px #ddd;
+ padding: 10px;
+ margin: 10px 0;
+ }
+ #slider {
+ margin-top: 5px;
+ float: right;
+ width: 80%;
+ }
+ div.docs p {
+ padding-top: 1em;
+ width: 512px;
+ }
+ </style>
+ </head>
+ <body>
+ <h1 id="title">Raster Classification</h1>
+ <div id="tags">
+ Raster, Grid, Operation
+ </div>
+ <p id="shortdesc">This demo uses a raster operation to classify layer based data.</p>
+ <div id="map" class="smallmap"></div>
+ <div class="widget-wrapper ui-widget ui-corner-all">
+ <span>breakpoints:</span>
+ <div id="slider"></div>
+ </div>
+ <div class="docs">
+ <p>
+ This example uses a <code>OpenLayers.Raster.Operation</code> to
+ create a hypothetical classification scheme for data derived from
+ a WMS layer. The resulting data is displayed on the map with
+ a <code>OpenLayers.Layer.Raster</code>. The classification
+ is run whenever breakpoint values are adjusted with the slider.
+ </p>
+ <p>
+ See the <a href="raster-classification.js" target="_blank">raster-classification.js</a>
+ source for details on how this is done.
+ </p>
+ </div>
+ <script src="raster-classification.js"></script>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/raster/raster-classification.js
===================================================================
--- sandbox/august/trunk/playground/raster/raster-classification.js (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-classification.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,65 @@
+
+// breakpoints to be used in the classification
+var breakpoints = [-0.2, 0.3, 0.5];
+
+// a pretend classification scheme
+var classification = OpenLayers.Raster.Operation.create(function(comp) {
+ var c1 = 2 * comp[2];
+ var c2 = comp[1];
+ var nd = (c1 - c2) / (c1 + c2);
+ var r, g, b;
+ if (nd < breakpoints[0]) {
+ r = 200, g = 200, b = 0;
+ } else if (nd < breakpoints[1]) {
+ r = 0, g = 200, b = 0;
+ } else if (nd < breakpoints[2]) {
+ r = 200, g = 255, b = 255;
+ } else {
+ r = 0, g = 0, b = 200;
+ }
+ return [r, g, b, comp[3]];
+});
+
+var marble = new OpenLayers.Layer.WMS(
+ "Blue Marble",
+ "/geoserver/gwc/service/wms",
+ {layers: "topp:bluemarble", format: "image/png"}
+);
+
+var data = OpenLayers.Raster.Composite.fromLayer(marble);
+var classified = classification(data);
+
+var raster = new OpenLayers.Layer.Raster({
+ name: "Classified Data",
+ data: classified
+});
+
+var map = new OpenLayers.Map({
+ div: "map",
+ theme: null,
+ controls: [
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.ZoomPanel(),
+ new OpenLayers.Control.LayerSwitcher()
+ ],
+ layers: [
+ marble, raster
+ ],
+ center: new OpenLayers.LonLat(0, 0),
+ zoom: 1
+});
+
+// add a slider for adjusting class breakpoints
+$("#slider").slider({
+ min: -1,
+ max: 1,
+ step: 0.1,
+ values: breakpoints,
+ stop: function(event, ui) {
+ breakpoints[0] = ui.values[0];
+ breakpoints[1] = ui.values[1];
+ breakpoints[2] = ui.values[2];
+ classified.events.triggerEvent("update");
+ }
+});
Added: sandbox/august/trunk/playground/raster/raster-grid-layer.html
===================================================================
--- sandbox/august/trunk/playground/raster/raster-grid-layer.html (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-grid-layer.html 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers Raster Grid Layer Example</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <script src="../OpenLayers.js"></script>
+ <style>
+ .olControlZoomPanel {
+ top: 20px;
+ }
+ div.docs p {
+ padding-top: 1em;
+ width: 512px;
+ }
+ </style>
+ </head>
+ <body>
+ <h1 id="title">Raster Layer from Grid Data</h1>
+ <div id="tags">
+ Raster, Grid, Layer
+ </div>
+ <p id="shortdesc">This demo generates a raster layer based on modified data from another layer.</p>
+ <div id="map" class="smallmap"></div>
+ <div id="view" class="smallmap"></div>
+ <div class="docs">
+ <p>
+ This example generates a <code>OpenLayers.Raster.Composite</code>
+ from a WMS layer. The composite data is a luminosity calculation
+ from a <code>OpenLayers.Raster.Operation</code> that works with
+ the source RGBA data. The resulting luminosity data is displayed
+ on a second map with a <code>OpenLayers.Layer.Raster</code>.
+ </p>
+ <p>
+ See the <a href="raster-grid-layer.js" target="_blank">raster-grid-layer.js</a>
+ source for details on how this is done.
+ </p>
+ <script src="raster-grid-layer.js"></script>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/raster/raster-grid-layer.js
===================================================================
--- sandbox/august/trunk/playground/raster/raster-grid-layer.js (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-grid-layer.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,44 @@
+
+var luminance = OpenLayers.Raster.Operation.create(function(rgba) {
+ var lum = Math.min(255, 30 + (0.299 * rgba[0]) + (0.587 * rgba[1]) + (0.114 * rgba[2]));
+ return [lum, lum, lum, rgba[3]];
+});
+
+var marble = new OpenLayers.Layer.WMS(
+ "Blue Marble",
+ "/geoserver/gwc/service/wms",
+ {layers: "topp:bluemarble", format: "image/png"}
+);
+
+var raster = new OpenLayers.Layer.Raster({
+ name: "Luminance",
+ data: luminance(OpenLayers.Raster.Composite.fromLayer(marble)),
+ isBaseLayer: true
+});
+
+var map = new OpenLayers.Map({
+ div: "map",
+ theme: null,
+ controls: [
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.ZoomPanel()
+ ],
+ layers: [
+ marble
+ ],
+ center: new OpenLayers.LonLat(0, 0),
+ zoom: 1
+});
+
+var view = new OpenLayers.Map({
+ div: "view",
+ theme: null,
+ controls: [],
+ layers: [
+ raster
+ ],
+ center: new OpenLayers.LonLat(0, 0),
+ zoom: 1
+});
+
Added: sandbox/august/trunk/playground/raster/raster-magnify.html
===================================================================
--- sandbox/august/trunk/playground/raster/raster-magnify.html (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-magnify.html 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers Raster Magnification Example</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <script src="../OpenLayers.js"></script>
+ <style>
+ .olControlZoomPanel {
+ top: 20px;
+ }
+ .olControlAttribution {
+ bottom: 3px;
+ font-size: 9px;
+ }
+ div.docs p {
+ padding-top: 1em;
+ width: 512px;
+ }
+ </style>
+ </head>
+ <body>
+ <h1 id="title">Magnify Raster</h1>
+ <div id="tags">
+ Raster, Grid, Resample
+ </div>
+ <p id="shortdesc">This demo shows how raster data can be resampled.</p>
+ <div id="map" class="smallmap"></div>
+ <div class="docs">
+ <p>
+ This example uses a <code>OpenLayers.Raster.Composite</code>
+ to resample data from a WMS layer. Move your mouse over the
+ map to change the center of the magnification lens.
+ </p>
+ <p>
+ See the <a href="raster-magnify.js" target="_blank">raster-magnify.js</a>
+ source for details on how this is done.
+ </p>
+ </div>
+ <script src="raster-magnify.js"></script>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/raster/raster-magnify.js
===================================================================
--- sandbox/august/trunk/playground/raster/raster-magnify.js (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-magnify.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,75 @@
+var marble = new OpenLayers.Layer.WMS(
+ "Blue Marble",
+ "/geoserver/gwc/service/wms",
+ {layers: "topp:bluemarble", format: "image/png"}
+);
+
+var data = OpenLayers.Raster.Composite.fromLayer(marble);
+
+var focus = [256, 128];
+var radius = 50;
+var magnification = 2.5;
+
+var magnified = new OpenLayers.Raster.Composite({
+ numRows: function() {
+ return data.numRows();
+ },
+ numCols: function() {
+ return data.numCols();
+ },
+ getCount: function() {
+ return data.getCount();
+ },
+ getValue: function(col, row) {
+ var dx = focus[0] - col;
+ var dy = focus[1] - row;
+ var d = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
+ var value;
+ if (d < radius) {
+ value = data.getValue(
+ Math.round(col + (dx / magnification)),
+ Math.round(row + (dy / magnification))
+ );
+ } else {
+ value = [0, 0, 0, 0];
+ }
+ return value;
+ }
+});
+
+data.events.on({
+ update: function() {
+ magnified.events.triggerEvent("update");
+ }
+});
+
+var raster = new OpenLayers.Layer.Raster({
+ name: "Magnified Blue Marble",
+ data: magnified
+});
+
+var map = new OpenLayers.Map({
+ div: "map",
+ theme: null,
+ controls: [
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.ZoomPanel(),
+ new OpenLayers.Control.LayerSwitcher(),
+ ],
+ layers: [
+ marble, raster
+ ],
+ center: new OpenLayers.LonLat(0, 0),
+ zoom: 1
+});
+
+map.events.on({
+ mousemove: function(event) {
+ if (!map.dragging) {
+ var pixel = event.xy;
+ focus = [pixel.x, pixel.y];
+ magnified.events.triggerEvent("update");
+ }
+ }
+});
Added: sandbox/august/trunk/playground/raster/raster-operations.html
===================================================================
--- sandbox/august/trunk/playground/raster/raster-operations.html (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-operations.html 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers Raster Operations Example</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css" type="text/css">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
+ <script src="../OpenLayers.js"></script>
+ <style>
+ .olControlZoomPanel {
+ top: 20px;
+ }
+ .widget-wrapper {
+ width: 492px;
+ background-color: #f9f9f9;
+ border: solid 1px #ddd;
+ padding: 10px;
+ margin: 10px 0;
+ }
+ .slider {
+ margin-top: 5px;
+ float: right;
+ width: 80%;
+ }
+ #reset {
+ margin-bottom: 1em;
+ }
+ div.docs p {
+ padding-top: 1em;
+ width: 512px;
+ }
+ </style>
+ </head>
+ <body>
+ <h1 id="title">Raster Operations</h1>
+ <div id="tags">
+ Raster, Grid, Operation
+ </div>
+ <p id="shortdesc">This demo uses raster operations to manipulate layer based data.</p>
+ <div id="map" class="smallmap"></div>
+ <div class="widget-wrapper ui-widget ui-corner-all">
+ <span>hue:</span>
+ <div id="hue-slider" class="slider"></div>
+ </div>
+ <div class="widget-wrapper ui-widget ui-corner-all">
+ <span>saturation:</span>
+ <div id="sat-slider" class="slider"></div>
+ </div>
+ <div class="widget-wrapper ui-widget ui-corner-all">
+ <span>lightness:</span>
+ <div id="lit-slider" class="slider"></div>
+ </div>
+ <a href="#" id="reset">reset</a>
+ <div class="docs">
+ <p>
+ This example manipulates data in a <code>OpenLayers.Raster.Composite</code>
+ using a series of <code>OpenLayers.Raster.Operation</code> methods.
+ RGB data from the WMS layer is translated to HSL, modified using
+ user supplied values, and translated back to RGB. The resulting
+ composite is displayed on the map with a <code>OpenLayers.Layer.Raster</code>.
+ </p>
+ <p>
+ See the <a href="raster-operations.js" target="_blank">raster-operations.js</a>
+ source for details on how this is done.
+ </p>
+ </div>
+ <script src="raster-operations.js"></script>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/raster/raster-operations.js
===================================================================
--- sandbox/august/trunk/playground/raster/raster-operations.js (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-operations.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,139 @@
+
+// alias for operations
+var op = OpenLayers.Raster.Operation;
+
+// operation for converting rgb values to hsl values
+var rgb2hsl = op.create(function(rgb) {
+ var r = rgb[0] / 255,
+ g = rgb[1] / 255,
+ b = rgb[2] / 255;
+ var max = Math.max(r, g, b),
+ min = Math.min(r, g, b);
+ var h, s, l = (max + min) / 2;
+
+ if (max == min) {
+ h = s = 0; // achromatic
+ } else {
+ var d = max - min;
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
+ switch (max) {
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
+ case g: h = (b - r) / d + 2; break;
+ case b: h = (r - g) / d + 4; break;
+ }
+ h /= 6;
+ }
+ return [h, s, l, rgb[3]];
+});
+
+// helper function for hsl2rgb operation
+function hue2rgb(p, q, t) {
+ if (t < 0) t += 1;
+ if (t > 1) t -= 1;
+ if (t < 1/6) return p + (q - p) * 6 * t;
+ if (t < 1/2) return q;
+ if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
+ return p;
+}
+
+// operation for converting hsl values to rgb values
+var hsl2rgb = op.create(function(hsl) {
+ var r, g, b;
+ var h = hsl[0],
+ s = hsl[1],
+ l = hsl[2];
+
+ if (s == 0) {
+ r = g = b = l; // achromatic
+ } else {
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
+ var p = 2 * l - q;
+ r = hue2rgb(p, q, h + 1/3);
+ g = hue2rgb(p, q, h);
+ b = hue2rgb(p, q, h - 1/3);
+ }
+
+ return [r * 255, g * 255, b * 255, hsl[3]];
+});
+
+var adjustments = {
+ hue: 0,
+ saturation: 0,
+ lightness: 0
+};
+
+var adjust = op.create(function(hsl, deltas) {
+ var h = (hsl[0] + deltas.hue) % 1;
+ if (h < 0) {
+ h += 1;
+ }
+ var s = Math.max(0 , Math.min(hsl[1] + deltas.saturation, 1));
+ var l = Math.max(0 , Math.min(hsl[2] + deltas.lightness, 1));
+ return [h, s, l, hsl[3]];
+});
+
+var marble = new OpenLayers.Layer.WMS(
+ "Blue Marble",
+ "/geoserver/gwc/service/wms",
+ {layers: "topp:bluemarble", format: "image/png"}
+);
+
+var data = OpenLayers.Raster.Composite.fromLayer(marble);
+var adjusted = hsl2rgb(adjust(rgb2hsl(data), adjustments));
+
+var raster = new OpenLayers.Layer.Raster({
+ name: "Adjusted Blue Marble",
+ data: adjusted
+});
+
+var map = new OpenLayers.Map({
+ div: "map",
+ theme: null,
+ controls: [
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.ZoomPanel(),
+ new OpenLayers.Control.LayerSwitcher()
+ ],
+ layers: [
+ marble, raster
+ ],
+ center: new OpenLayers.LonLat(0, 0),
+ zoom: 1
+});
+
+// add hsl sliders that modify properties of the adjustments object and update data
+$("#hue-slider").slider({
+ step: 2,
+ value: 50,
+ stop: function(event, ui) {
+ adjustments.hue = (ui.value / 100) - 0.5;
+ adjusted.events.triggerEvent("update");
+ }
+});
+$("#sat-slider").slider({
+ step: 2,
+ value: 50,
+ stop: function(event, ui) {
+ adjustments.saturation = (2 * ui.value / 100) - 1;
+ adjusted.events.triggerEvent("update");
+ }
+});
+$("#lit-slider").slider({
+ step: 2,
+ value: 50,
+ stop: function(event, ui) {
+ adjustments.lightness = (2 * ui.value / 100) - 1;
+ adjusted.events.triggerEvent("update");
+ }
+});
+$("#reset").button();
+$("#reset").click(function() {
+ $("#hue-slider").slider("value", 50);
+ adjustments.hue = 0;
+ $("#sat-slider").slider("value", 50);
+ adjustments.saturation = 0;
+ $("#lit-slider").slider("value", 50);
+ adjustments.lightness = 0;
+ adjusted.events.triggerEvent("update");
+});
Added: sandbox/august/trunk/playground/raster/raster-query.html
===================================================================
--- sandbox/august/trunk/playground/raster/raster-query.html (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-query.html 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers Raster Query Example</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <script src="../OpenLayers.js"></script>
+ <style>
+ .olControlZoomPanel {
+ top: 20px;
+ }
+ .olControlAttribution {
+ bottom: 3px;
+ font-size: 9px;
+ }
+ em {
+ font-style: italic;
+ }
+ div.docs p {
+ padding-top: 1em;
+ width: 512px;
+ }
+ </style>
+ </head>
+ <body>
+ <h1 id="title">Query Grid Data</h1>
+ <div id="tags">
+ Raster, Grid, Query
+ </div>
+ <p id="shortdesc">This demo shows querying of pixel data.</p>
+ <div id="map" class="smallmap"></div>
+ <p>
+ <strong>Selected pixel value (RGBA):</strong>
+ <span id="output"><em>none selected</em></span>
+ </p>
+ <p>
+ <strong>Area selected:</strong>
+ <span id="stats"><em>none</em></span>
+ </p>
+ <div class="docs">
+ <p>
+ This example uses a <code>OpenLayers.Raster.Operation</code>
+ to query composite data from a WMS layer. Click on the map to
+ query pixel data. The results of the query are displayed on
+ the map as a <code>OpenLayers.Layer.Raster</code>.
+ </p>
+ <p>
+ See the <a href="raster-query.js" target="_blank">raster-query.js</a>
+ source for details on how this is done.
+ </p>
+ </div>
+ <script src="raster-query.js"></script>
+ </body>
+</html>
Added: sandbox/august/trunk/playground/raster/raster-query.js
===================================================================
--- sandbox/august/trunk/playground/raster/raster-query.js (rev 0)
+++ sandbox/august/trunk/playground/raster/raster-query.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,83 @@
+
+var osm = new OpenLayers.Layer.OSM();
+var veg = new OpenLayers.Layer.WMS(
+ "Vegetation",
+ "/geoserver/gwc/service/wms",
+ {layers: "za:za_vegetation", format: "image/png8", transparent: "TRUE"},
+ {isBaseLayer: false, opacity: 0.5}
+);
+
+var vegData = OpenLayers.Raster.Composite.fromLayer(veg);
+
+var pixelValues;
+var Click = OpenLayers.Class(OpenLayers.Control, {
+ autoActivate: true,
+ initialize: function(options) {
+ OpenLayers.Control.prototype.initialize.apply(this, arguments);
+ this.handler = new OpenLayers.Handler.Click(this, {click: this.trigger});
+ },
+ trigger: function(event) {
+ var pixel = event.xy;
+ pixelValues = vegData.getValue(pixel.x, pixel.y);
+ selected.events.triggerEvent("update");
+ }
+});
+
+function close(a, b) {
+ return Math.abs(a - b) < 15;
+}
+var query = OpenLayers.Raster.Operation.create(function(vegValues) {
+ var rgba = [0, 0, 0, 0];
+ if (pixelValues) {
+ if (close(vegValues[0], pixelValues[0]) && close(vegValues[1], pixelValues[1]) &&
+ close(vegValues[2], pixelValues[2]) && close(vegValues[3], pixelValues[3])) {
+ rgba[3] = 150;
+ }
+ }
+ return rgba;
+});
+
+var selected = query(vegData);
+
+var map = new OpenLayers.Map({
+ div: "map",
+ theme: null,
+ projection: "EPSG:900913",
+ units: "m",
+ maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508),
+ maxResolution: 156543.0339,
+ controls: [
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.ZoomPanel(),
+ new OpenLayers.Control.LayerSwitcher(),
+ new Click()
+ ],
+ layers: [
+ osm, veg, new OpenLayers.Layer.Raster({name: "Selected", data: selected})
+ ],
+ center: new OpenLayers.LonLat(2622095, -3512434),
+ zoom: 5
+});
+
+selected.events.on({
+ update: function() {
+ if (pixelValues) {
+ document.getElementById("output").innerHTML = "[" + pixelValues.join(", ") + "]";
+ window.setTimeout(updateStats, 0);
+ }
+ }
+})
+
+function updateStats() {
+ var count = 0;
+ selected.forEach(function(value) {
+ if (value[3] > 0) {
+ ++count;
+ }
+ });
+ var res = map.getResolution();
+ var area = (count * res * res / 10e6).toFixed(0);
+
+ document.getElementById("stats").innerHTML = area + " km<sup>2</sup>";
+}
\ No newline at end of file
Added: sandbox/august/trunk/playground/wfst/request/delete.point.without.lock.openlayers.req.xml
===================================================================
--- sandbox/august/trunk/playground/wfst/request/delete.point.without.lock.openlayers.req.xml (rev 0)
+++ sandbox/august/trunk/playground/wfst/request/delete.point.without.lock.openlayers.req.xml 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,10 @@
+<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
+ service="WFS" version="1.1.0"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <wfs:Delete typeName="esri:cities_all" xmlns:esri="http://www.esri.com">
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="F238__345" />
+ </ogc:Filter>
+ </wfs:Delete>
+</wfs:Transaction>
\ No newline at end of file
Added: sandbox/august/trunk/playground/wfst/request/delete.polygon.without.lock.openlayers.req.xml
===================================================================
--- sandbox/august/trunk/playground/wfst/request/delete.polygon.without.lock.openlayers.req.xml (rev 0)
+++ sandbox/august/trunk/playground/wfst/request/delete.polygon.without.lock.openlayers.req.xml 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,10 @@
+<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
+ service="WFS" version="1.1.0"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <wfs:Delete typeName="esri:province_all" xmlns:esri="http://www.esri.com">
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="F237__34" />
+ </ogc:Filter>
+ </wfs:Delete>
+</wfs:Transaction>
\ No newline at end of file
Added: sandbox/august/trunk/playground/wfst/request/delete.polyline.without.lock.openlayers.req.xml
===================================================================
--- sandbox/august/trunk/playground/wfst/request/delete.polyline.without.lock.openlayers.req.xml (rev 0)
+++ sandbox/august/trunk/playground/wfst/request/delete.polyline.without.lock.openlayers.req.xml 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,10 @@
+<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
+ service="WFS" version="1.1.0"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <wfs:Delete typeName="esri:roads_all" xmlns:esri="http://www.esri.com">
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="F238__345" />
+ </ogc:Filter>
+ </wfs:Delete>
+</wfs:Transaction>
\ No newline at end of file
Added: sandbox/august/trunk/playground/wfst/request/insert.point.without.lock.openlayers.req.xml
===================================================================
--- sandbox/august/trunk/playground/wfst/request/insert.point.without.lock.openlayers.req.xml (rev 0)
+++ sandbox/august/trunk/playground/wfst/request/insert.point.without.lock.openlayers.req.xml 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,36 @@
+<!--
+ although setting "featurePrefix" to "esri", OpenLayers still hard code feature namespace prefix as "feature"
+ but this doesn't affect the processing of transactions
+-->
+<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
+ service="WFS" version="1.1.0"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <wfs:Insert>
+ <feature:cities_all xmlns:feature="http://www.esri.com">
+ <feature:Shape>
+ <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG:6.9:3857">
+ <gml:pos>-10933559.79393 7167750.4000335</gml:pos>
+ </gml:Point>
+ </feature:Shape>
+ </feature:cities_all>
+ </wfs:Insert>
+ <wfs:Insert>
+ <feature:cities_all xmlns:feature="http://www.esri.com">
+ <feature:Shape>
+ <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG:6.9:3857">
+ <gml:pos>-11031399.190121 7020991.3057464</gml:pos>
+ </gml:Point>
+ </feature:Shape>
+ </feature:cities_all>
+ </wfs:Insert>
+ <wfs:Insert>
+ <feature:cities_all xmlns:feature="http://www.esri.com">
+ <feature:Shape>
+ <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG:6.9:3857">
+ <gml:pos>-10874856.156215 6791068.7246966</gml:pos>
+ </gml:Point>
+ </feature:Shape>
+ </feature:cities_all>
+ </wfs:Insert>
+</wfs:Transaction>
\ No newline at end of file
Added: sandbox/august/trunk/playground/wfst/request/insert.polygon.without.lock.openlayers.req.xml
===================================================================
--- sandbox/august/trunk/playground/wfst/request/insert.polygon.without.lock.openlayers.req.xml (rev 0)
+++ sandbox/august/trunk/playground/wfst/request/insert.polygon.without.lock.openlayers.req.xml 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,30 @@
+<!--
+ although setting "featurePrefix" to "esri", OpenLayers still hard code feature namespace prefix as "feature"
+ but this doesn't affect the processing of transactions
+-->
+<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
+ service="WFS" version="1.1.0"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <wfs:Insert>
+ <feature:province_all xmlns:feature="http://www.esri.com">
+ <feature:Shape>
+ <gml:MultiSurface xmlns:gml="http://www.opengis.net/gml"
+ srsName="urn:ogc:def:crs:EPSG:6.9:3857">
+ <gml:surfaceMember>
+ <gml:Polygon>
+ <gml:exterior>
+ <gml:LinearRing>
+ <gml:posList>-17826345.255614 9408272.5728168 -17004494.327606
+ 9789846.2179633 -16965358.56913 9163674.0823383
+ -17845913.134852 8488582.2486176 -17982888.28952
+ 8977779.2295746 -17826345.255614 9408272.5728168</gml:posList>
+ </gml:LinearRing>
+ </gml:exterior>
+ </gml:Polygon>
+ </gml:surfaceMember>
+ </gml:MultiSurface>
+ </feature:Shape>
+ </feature:province_all>
+ </wfs:Insert>
+</wfs:Transaction>
\ No newline at end of file
Added: sandbox/august/trunk/playground/wfst/request/insert.polyline.without.lock.openlayers.req.xml
===================================================================
--- sandbox/august/trunk/playground/wfst/request/insert.polyline.without.lock.openlayers.req.xml (rev 0)
+++ sandbox/august/trunk/playground/wfst/request/insert.polyline.without.lock.openlayers.req.xml 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,26 @@
+<!--
+ although setting "featurePrefix" to "esri", OpenLayers still hard code feature namespace prefix as "feature"
+ but this doesn't affect the processing of transactions
+-->
+<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
+ service="WFS" version="1.1.0"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <wfs:Insert>
+ <feature:roads_all xmlns:feature="http://www.esri.com">
+ <feature:Shape>
+ <gml:MultiCurve xmlns:gml="http://www.opengis.net/gml"
+ srsName="urn:ogc:def:crs:EPSG:6.9:3857">
+ <gml:curveMember>
+ <gml:LineString>
+ <gml:posList>-11505920.26165 7705867.0790863 -11437432.684316
+ 7847734.2035638 -11349377.227743 7999385.2676605
+ -11129238.586313 7955357.5393744 -10884640.095834
+ 7759678.7469915 -11041183.12974 7598243.7432757</gml:posList>
+ </gml:LineString>
+ </gml:curveMember>
+ </gml:MultiCurve>
+ </feature:Shape>
+ </feature:roads_all>
+ </wfs:Insert>
+</wfs:Transaction>
\ No newline at end of file
Added: sandbox/august/trunk/playground/wfst/request/update.point.without.lock.openlayers.req.xml
===================================================================
--- sandbox/august/trunk/playground/wfst/request/update.point.without.lock.openlayers.req.xml (rev 0)
+++ sandbox/august/trunk/playground/wfst/request/update.point.without.lock.openlayers.req.xml 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,44 @@
+<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
+ service="WFS" version="1.1.0"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <wfs:Update typeName="esri:cities_all" xmlns:esri="http://www.esri.com">
+ <wfs:Property>
+ <wfs:Name>Shape</wfs:Name>
+ <wfs:Value>
+ <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG:6.9:3857">
+ <gml:pos>-10214440.231898695 7764570.716798835</gml:pos>
+ </gml:Point>
+ </wfs:Value>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="F236__68" />
+ </ogc:Filter>
+ </wfs:Update>
+ <wfs:Update typeName="esri:cities_all" xmlns:esri="http://www.esri.com">
+ <wfs:Property>
+ <wfs:Name>Shape</wfs:Name>
+ <wfs:Value>
+ <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG:6.9:3857">
+ <gml:pos>-10341631.446961109 7656947.3808639245</gml:pos>
+ </gml:Point>
+ </wfs:Value>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="F236__69" />
+ </ogc:Filter>
+ </wfs:Update>
+ <wfs:Update typeName="esri:cities_all" xmlns:esri="http://www.esri.com">
+ <wfs:Property>
+ <wfs:Name>Shape</wfs:Name>
+ <wfs:Value>
+ <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG:6.9:3857">
+ <gml:pos>-10106816.89607995 7784138.596026456</gml:pos>
+ </gml:Point>
+ </wfs:Value>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="F236__70" />
+ </ogc:Filter>
+ </wfs:Update>
+</wfs:Transaction>
\ No newline at end of file
Added: sandbox/august/trunk/playground/wfst/request/update.polygon.without.lock.openlayers.req.xml
===================================================================
--- sandbox/august/trunk/playground/wfst/request/update.polygon.without.lock.openlayers.req.xml (rev 0)
+++ sandbox/august/trunk/playground/wfst/request/update.polygon.without.lock.openlayers.req.xml 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,32 @@
+<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
+ service="WFS" version="1.1.0"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <wfs:Update typeName="esri:province_all" xmlns:esri="http://www.esri.com">
+ <wfs:Property>
+ <wfs:Name>Shape</wfs:Name>
+ <wfs:Value>
+ <gml:MultiSurface xmlns:gml="http://www.opengis.net/gml"
+ srsName="urn:ogc:def:crs:EPSG:6.9:3857">
+ <gml:surfaceMember>
+ <gml:Polygon>
+ <gml:exterior>
+ <gml:LinearRing>
+ <gml:posList>-18305758.296941206 10259475.31957571
+ -17982888.289531372 8977779.22956118 -17845913.13495566
+ 8488582.248526152 -16896870.99183777 8072764.814758439
+ -16965358.56911043 9163674.082338393 -16417457.950444004
+ 10866079.576230533 -18305758.296941206 10259475.31957571
+ </gml:posList>
+ </gml:LinearRing>
+ </gml:exterior>
+ </gml:Polygon>
+ </gml:surfaceMember>
+ </gml:MultiSurface>
+ </wfs:Value>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="F237__34" />
+ </ogc:Filter>
+ </wfs:Update>
+</wfs:Transaction>
\ No newline at end of file
Added: sandbox/august/trunk/playground/wfst/request/update.polyline.without.lock.openlayers.req.xml
===================================================================
--- sandbox/august/trunk/playground/wfst/request/update.polyline.without.lock.openlayers.req.xml (rev 0)
+++ sandbox/august/trunk/playground/wfst/request/update.polyline.without.lock.openlayers.req.xml 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,26 @@
+<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
+ service="WFS" version="1.1.0"
+ xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <wfs:Update typeName="esri:roads_all" xmlns:esri="http://www.esri.com">
+ <wfs:Property>
+ <wfs:Name>Shape</wfs:Name>
+ <wfs:Value>
+ <gml:MultiCurve xmlns:gml="http://www.opengis.net/gml"
+ srsName="urn:ogc:def:crs:EPSG:6.9:3857">
+ <gml:curveMember>
+ <gml:LineString>
+ <gml:posList>-11505920.26165 7705867.0790863 -11437432.684316
+ 7847734.2035638 -11349377.227743 7999385.2676605
+ -11280889.650409652 7603135.713085335 -10884640.095834
+ 7759678.7469915 -11041183.12974 7598243.7432757</gml:posList>
+ </gml:LineString>
+ </gml:curveMember>
+ </gml:MultiCurve>
+ </wfs:Value>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="F238__345" />
+ </ogc:Filter>
+ </wfs:Update>
+</wfs:Transaction>
\ No newline at end of file
Modified: sandbox/august/trunk/playground/wfst/wfst-with-lock.js
===================================================================
--- sandbox/august/trunk/playground/wfst/wfst-with-lock.js 2011-12-05 06:47:12 UTC (rev 12446)
+++ sandbox/august/trunk/playground/wfst/wfst-with-lock.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -110,7 +110,7 @@
//featureType: "blockgroups",
geometryName: "Shape",
featureNS: "http://www.esri.com",
- featurePrefix: "esri",
+ featurePrefix: "esri",
extractAttributes: false,
//xy: false,
lockExpiry: "1",
Added: sandbox/august/trunk/playground/wfst/wfst-without-lock.html
===================================================================
--- sandbox/august/trunk/playground/wfst/wfst-without-lock.html (rev 0)
+++ sandbox/august/trunk/playground/wfst/wfst-without-lock.html 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers WFST Without Lock Example</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <link rel="stylesheet" href="../../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="../style.css" type="text/css">
+ <script src="../../lib/OpenLayers.js"></script>
+ <!--[if lte IE 6]>
+ <style>
+ .customEditingToolbar {
+ width: 200px;
+ }
+ </style>
+ <![endif]-->
+ <style>
+ .customEditingToolbar {
+ float: right;
+ right: 0px;
+ height: 30px;
+ }
+ .customEditingToolbar div {
+ float: right;
+ margin: 5px;
+ width: 24px;
+ height: 24px;
+ }
+ .olControlNavigationItemActive {
+ background-image: url("../../theme/default/img/editing_tool_bar.png");
+ background-repeat: no-repeat;
+ background-position: -103px -23px;
+ }
+ .olControlNavigationItemInactive {
+ background-image: url("../../theme/default/img/editing_tool_bar.png");
+ background-repeat: no-repeat;
+ background-position: -103px -0px;
+ }
+ .olControlDrawFeaturePolygonItemInactive {
+ background-image: url("../../theme/default/img/editing_tool_bar.png");
+ background-repeat: no-repeat;
+ background-position: -26px 0px;
+ }
+ .olControlDrawFeaturePolygonItemActive {
+ background-image: url("../../theme/default/img/editing_tool_bar.png");
+ background-repeat: no-repeat;
+ background-position: -26px -23px ;
+ }
+ .olControlModifyFeatureItemActive {
+ background-image: url(../../theme/default/img/move_feature_on.png);
+ background-repeat: no-repeat;
+ background-position: 0px 1px;
+ }
+ .olControlModifyFeatureItemInactive {
+ background-image: url(../../theme/default/img/move_feature_off.png);
+ background-repeat: no-repeat;
+ background-position: 0px 1px;
+ }
+ .olControlDeleteFeatureItemActive {
+ background-image: url(../../theme/default/img/remove_point_on.png);
+ background-repeat: no-repeat;
+ background-position: 0px 1px;
+ }
+ .olControlDeleteFeatureItemInactive {
+ background-image: url(../../theme/default/img/remove_point_off.png);
+ background-repeat: no-repeat;
+ background-position: 0px 1px;
+ }
+ </style>
+ <script src="wfst-without-lock.js"></script>
+ </head>
+ <body onload="init();">
+ <div id="map" class="bigmap"></div>
+ </body>
+</html>
+
+
Added: sandbox/august/trunk/playground/wfst/wfst-without-lock.js
===================================================================
--- sandbox/august/trunk/playground/wfst/wfst-without-lock.js (rev 0)
+++ sandbox/august/trunk/playground/wfst/wfst-without-lock.js 2011-12-21 20:44:55 UTC (rev 12447)
@@ -0,0 +1,170 @@
+var map;
+var wfstLyr;
+
+var DeleteFeature = OpenLayers.Class(OpenLayers.Control, {
+
+ initialize: function(layer, options) {
+ OpenLayers.Control.prototype.initialize.apply(this, [options]);
+ this.layer = layer;
+ this.handler = new OpenLayers.Handler.Feature(
+ this, layer, {click: this.clickFeature}
+ );
+ },
+
+ clickFeature: function(feature) {
+ // if feature doesn't have a fid, destroy it
+ if(feature.fid == undefined) {
+ this.layer.destroyFeatures([feature]);
+ } else {
+ feature.state = OpenLayers.State.DELETE;
+ this.layer.events.triggerEvent("afterfeaturemodified",
+ {feature: feature});
+ feature.renderIntent = "select";
+ this.layer.drawFeature(feature);
+ }
+ },
+
+ setMap: function(map) {
+ this.handler.setMap(map);
+ OpenLayers.Control.prototype.setMap.apply(this, arguments);
+ },
+
+ CLASS_NAME: "OpenLayers.Control.DeleteFeature"
+});
+
+function init() {
+
+ // set OpenLayers proxy
+ //OpenLayers.ProxyHost= "/openlayers-trunk/ApacheProxyServlet?url=";
+
+ OpenLayers.ProxyHost= function(url) {
+ return "/openlayers-trunk/ApacheProxyServlet?url=" + url;
+ };
+
+ var lon = -115.391667;
+ var lat = 57.760628;
+ var zoom = 5;
+
+ var options = {
+ //panMethod: null, // set 'panMethod' to null to disable animated panning
+ controls: [
+ new OpenLayers.Control.LayerSwitcher(),
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.MousePosition()
+ ],
+ projection: "EPSG:900913",
+ units: "m",
+ maxResolution: 156543.0339,
+ maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34)
+ };
+ map = new OpenLayers.Map("map", options);
+
+ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {
+ name: "MapQuestOSM",
+ //attribution: "Data CC-By-SA by <a href='http://openstreetmap.org/'>OpenStreetMap</a>",
+ sphericalMercator: true,
+ url: 'http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png',
+ clone: function(obj) {
+ if (obj == null) {
+ obj = new OpenLayers.Layer.OSM(
+ this.name, this.url, this.getOptions());
+ }
+ obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
+ return obj;
+ },
+ CLASS_NAME: "OpenLayers.Layer.MapQuestOSM"
+ });
+
+ var mapquestosm = new OpenLayers.Layer.MapQuestOSM();
+
+ // save strategy
+ var saveStrategy = new OpenLayers.Strategy.Save();
+
+ wfstLyr = new OpenLayers.Layer.Vector("WFST Without Lock", {
+ strategies: [
+ new OpenLayers.Strategy.BBOX(),
+ saveStrategy
+ ],
+ projection: new OpenLayers.Projection("urn:ogc:def:crs:EPSG:6.9:3857"),
+ protocol: new OpenLayers.Protocol.WFS({
+ //version: "1.1.0",
+ version: "1.0.0",
+ srsName: "urn:ogc:def:crs:EPSG:6.9:3857",
+ url: "http://sazabiii:6080/arcgis/services/wfst.regression/wfst_all_trans_without_locks/MapServer/WFSServer?",
+ featureNS : "http://www.esri.com",
+ // the featurePrefix doesn't apply when encoding features using GML3 format
+ // OpenLayers.Format.WFSTWithLock fixes this by overriding the GML3 feature encoder
+ featurePrefix: "esri",
+ //featureType: "cities_all",
+ //featureType: "roads_all",
+ featureType: "province_all",
+ geometryName: "Shape",
+ //schema: "http://sazabiii:6080/arcgis/services/wfst.regression/wfst_all_trans_without_locks/MapServer/WFSServer?request=describefeaturetype&typename=cities_all",
+ //schema: "http://sazabiii:6080/arcgis/services/wfst.regression/wfst_all_trans_without_locks/MapServer/WFSServer?request=describefeaturetype&typename=roads_all",
+ schema: "http://sazabiii:6080/arcgis/services/wfst.regression/wfst_all_trans_without_locks/MapServer/WFSServer?request=describefeaturetype&typename=province_all",
+ formatOptions: {
+ // for now 'extractAttributes' has to be set to 'false' to avoid the update transaction overwrite "OBJECTID" read-only property, which causes transaction failure
+ extractAttributes: false
+ }
+ })
+ });
+ wfstLyr.setVisibility(false);
+
+ map.addLayers([mapquestosm, wfstLyr]);
+
+ // editing panel
+ var editPanel = new OpenLayers.Control.Panel({
+ displayClass: 'customEditingToolbar',
+ allowDepress: true
+ });
+
+ var draw = new OpenLayers.Control.DrawFeature(
+ wfstLyr,
+ //OpenLayers.Handler.Point,
+ //OpenLayers.Handler.Path,
+ OpenLayers.Handler.Polygon,
+ {
+ title: "Draw Feature",
+ //displayClass: "olControlDrawFeaturePoint",
+ displayClass: "olControlDrawFeaturePolygon",
+ multi: true
+ }
+ );
+
+ var edit = new OpenLayers.Control.ModifyFeature(
+ wfstLyr,
+ {
+ title: "Modify Feature",
+ displayClass: "olControlModifyFeature"
+ }
+ );
+
+ var del = new DeleteFeature(
+ wfstLyr,
+ {
+ title: "Delete Feature"
+ }
+ );
+
+ var save = new OpenLayers.Control.Button({
+ title: "Save Changes",
+ trigger: function() {
+ if(edit.feature) {
+ edit.selectControl.unselectAll();
+ }
+ saveStrategy.save();
+ },
+ displayClass: "olControlSaveFeatures"
+ });
+ editPanel.addControls([save, del, edit, draw]);
+ map.addControl(editPanel);
+
+ map.setCenter(
+ new OpenLayers.LonLat(lon, lat).transform(
+ new OpenLayers.Projection("EPSG:4326"),
+ map.getProjectionObject()
+ ),
+ zoom
+ );
+}
+
More information about the Commits
mailing list