[OpenLayers-Commits] r10941 - in sandbox/august/trunk: . build
examples lib lib/OpenLayers lib/OpenLayers/BaseTypes
lib/OpenLayers/Control lib/OpenLayers/Format
lib/OpenLayers/Format/OWSCommon lib/OpenLayers/Format/SLD
lib/OpenLayers/Handler lib/OpenLayers/Layer
lib/OpenLayers/Layer/Google lib/OpenLayers/Layer/WMS
lib/OpenLayers/Popup lib/OpenLayers/Renderer
lib/OpenLayers/Strategy lib/OpenLayers/Tile
lib/OpenLayers/Tile/Image tests tests/BaseTypes tests/Control
tests/Format tests/Format/WFST tests/Format/WMC tests/Handler
tests/Layer tests/Layer/WMS tests/Marker tests/Popup
tests/Renderer tests/Strategy tests/manual theme/default tools
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Fri Dec 3 01:40:11 EST 2010
Author: augusttown
Date: 2010-12-02 22:40:11 -0800 (Thu, 02 Dec 2010)
New Revision: 10941
Added:
sandbox/august/trunk/examples/donut.html
sandbox/august/trunk/examples/donut.js
sandbox/august/trunk/examples/kml-layer.js
sandbox/august/trunk/examples/single-tile.html
sandbox/august/trunk/examples/single-tile.js
sandbox/august/trunk/examples/strategy-cluster-extended.html
sandbox/august/trunk/examples/strategy-cluster-extended.js
sandbox/august/trunk/tests/OpenLayers1.html
sandbox/august/trunk/tests/OpenLayers2.html
sandbox/august/trunk/tests/OpenLayers3.html
sandbox/august/trunk/tests/OpenLayers4.html
sandbox/august/trunk/tests/manual/page-position.html
Removed:
sandbox/august/trunk/examples/notile.html
sandbox/august/trunk/tests/OpenLayers.html
Modified:
sandbox/august/trunk/
sandbox/august/trunk/build/full.cfg
sandbox/august/trunk/build/library.cfg
sandbox/august/trunk/build/license.txt
sandbox/august/trunk/build/lite.cfg
sandbox/august/trunk/examples/Jugl.js
sandbox/august/trunk/examples/example-list.html
sandbox/august/trunk/examples/getfeature-wfs.html
sandbox/august/trunk/examples/kml-layer.html
sandbox/august/trunk/examples/measure.html
sandbox/august/trunk/examples/proxy.cgi
sandbox/august/trunk/examples/snapping.html
sandbox/august/trunk/examples/sos.html
sandbox/august/trunk/examples/strategy-cluster.html
sandbox/august/trunk/examples/sundials-spherical-mercator.html
sandbox/august/trunk/examples/vector-features.html
sandbox/august/trunk/lib/OpenLayers.js
sandbox/august/trunk/lib/OpenLayers/BaseTypes.js
sandbox/august/trunk/lib/OpenLayers/BaseTypes/Class.js
sandbox/august/trunk/lib/OpenLayers/Control/GetFeature.js
sandbox/august/trunk/lib/OpenLayers/Control/Measure.js
sandbox/august/trunk/lib/OpenLayers/Control/ModifyFeature.js
sandbox/august/trunk/lib/OpenLayers/Control/OverviewMap.js
sandbox/august/trunk/lib/OpenLayers/Control/PanZoomBar.js
sandbox/august/trunk/lib/OpenLayers/Control/Panel.js
sandbox/august/trunk/lib/OpenLayers/Control/SLDSelect.js
sandbox/august/trunk/lib/OpenLayers/Control/WMTSGetFeatureInfo.js
sandbox/august/trunk/lib/OpenLayers/Events.js
sandbox/august/trunk/lib/OpenLayers/Format/OWSCommon/v1.js
sandbox/august/trunk/lib/OpenLayers/Format/SLD/v1.js
sandbox/august/trunk/lib/OpenLayers/Format/SOSGetObservation.js
sandbox/august/trunk/lib/OpenLayers/Handler/Box.js
sandbox/august/trunk/lib/OpenLayers/Handler/Drag.js
sandbox/august/trunk/lib/OpenLayers/Handler/Path.js
sandbox/august/trunk/lib/OpenLayers/Handler/Polygon.js
sandbox/august/trunk/lib/OpenLayers/Lang.js
sandbox/august/trunk/lib/OpenLayers/Layer.js
sandbox/august/trunk/lib/OpenLayers/Layer/AgsTiled.js
sandbox/august/trunk/lib/OpenLayers/Layer/EventPane.js
sandbox/august/trunk/lib/OpenLayers/Layer/Google/v3.js
sandbox/august/trunk/lib/OpenLayers/Layer/SphericalMercator.js
sandbox/august/trunk/lib/OpenLayers/Layer/TileCache.js
sandbox/august/trunk/lib/OpenLayers/Layer/Vector.js
sandbox/august/trunk/lib/OpenLayers/Layer/WMS.js
sandbox/august/trunk/lib/OpenLayers/Layer/WMS/Post.js
sandbox/august/trunk/lib/OpenLayers/Layer/XYZ.js
sandbox/august/trunk/lib/OpenLayers/Map.js
sandbox/august/trunk/lib/OpenLayers/Popup.js
sandbox/august/trunk/lib/OpenLayers/Popup/Anchored.js
sandbox/august/trunk/lib/OpenLayers/Projection.js
sandbox/august/trunk/lib/OpenLayers/Renderer/Canvas.js
sandbox/august/trunk/lib/OpenLayers/Renderer/Elements.js
sandbox/august/trunk/lib/OpenLayers/Renderer/SVG.js
sandbox/august/trunk/lib/OpenLayers/Renderer/VML.js
sandbox/august/trunk/lib/OpenLayers/SingleFile.js
sandbox/august/trunk/lib/OpenLayers/Strategy/Filter.js
sandbox/august/trunk/lib/OpenLayers/Tile/Image.js
sandbox/august/trunk/lib/OpenLayers/Tile/Image/IFrame.js
sandbox/august/trunk/lib/OpenLayers/Util.js
sandbox/august/trunk/readme.txt
sandbox/august/trunk/release-license.txt
sandbox/august/trunk/tests/BaseTypes/Element.html
sandbox/august/trunk/tests/Control/LayerSwitcher.html
sandbox/august/trunk/tests/Control/Measure.html
sandbox/august/trunk/tests/Control/ModifyFeature.html
sandbox/august/trunk/tests/Control/PanZoom.html
sandbox/august/trunk/tests/Control/Panel.html
sandbox/august/trunk/tests/Control/SLDSelect.html
sandbox/august/trunk/tests/Feature.html
sandbox/august/trunk/tests/Format/GML.html
sandbox/august/trunk/tests/Format/SOSGetObservation.html
sandbox/august/trunk/tests/Format/WFST/v1_1_0.html
sandbox/august/trunk/tests/Format/WMC.html
sandbox/august/trunk/tests/Format/WMC/v1_1_0.html
sandbox/august/trunk/tests/Handler/Polygon.html
sandbox/august/trunk/tests/Layer/EventPane.html
sandbox/august/trunk/tests/Layer/GeoRSS.html
sandbox/august/trunk/tests/Layer/MapServer.html
sandbox/august/trunk/tests/Layer/SphericalMercator.html
sandbox/august/trunk/tests/Layer/Text.html
sandbox/august/trunk/tests/Layer/Vector.html
sandbox/august/trunk/tests/Layer/WMS.html
sandbox/august/trunk/tests/Layer/WMS/Post.html
sandbox/august/trunk/tests/Layer/XYZ.html
sandbox/august/trunk/tests/Marker/Box.html
sandbox/august/trunk/tests/Popup.html
sandbox/august/trunk/tests/Popup/Anchored.html
sandbox/august/trunk/tests/Projection.html
sandbox/august/trunk/tests/Renderer/Canvas.html
sandbox/august/trunk/tests/Renderer/Elements.html
sandbox/august/trunk/tests/Renderer/VML.html
sandbox/august/trunk/tests/Request.html
sandbox/august/trunk/tests/Strategy/Filter.html
sandbox/august/trunk/tests/Util.html
sandbox/august/trunk/tests/list-tests-2.html
sandbox/august/trunk/tests/list-tests.html
sandbox/august/trunk/tests/run-tests-2.html
sandbox/august/trunk/theme/default/style.css
sandbox/august/trunk/tools/mergejs.py
Log:
Merge with trunk at revision 10940.
Property changes on: sandbox/august/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk/openlayers:10329-10354,10357-10502,10504-10808
+ /trunk/openlayers:10329-10354,10357-10502,10504-10940
Modified: sandbox/august/trunk/build/full.cfg
===================================================================
--- sandbox/august/trunk/build/full.cfg 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/build/full.cfg 2010-12-03 06:40:11 UTC (rev 10941)
@@ -3,7 +3,6 @@
[first]
OpenLayers/SingleFile.js
-OpenLayers.js
OpenLayers/BaseTypes.js
OpenLayers/BaseTypes/Class.js
OpenLayers/Util.js
@@ -14,19 +13,6 @@
[include]
[exclude]
-Firebug/firebug.js
-Firebug/firebugx.js
-OpenLayers/Lang/ca.js
-OpenLayers/Lang/cs-CZ.js
-OpenLayers/Lang/da-DK.js
-OpenLayers/Lang/de.js
-OpenLayers/Lang/en-CA.js
-OpenLayers/Lang/es.js
-OpenLayers/Lang/fr.js
-OpenLayers/Lang/it.js
-OpenLayers/Lang/nb.js
-OpenLayers/Lang/nl.js
-OpenLayers/Lang/pt-BR.js
-OpenLayers/Lang/sv-SE.js
-OpenLayers/Lang/zh-TW.js
-OpenLayers/Lang/zh-CN.js
+Firebug
+OpenLayers.js
+OpenLayers/Lang
Modified: sandbox/august/trunk/build/library.cfg
===================================================================
--- sandbox/august/trunk/build/library.cfg 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/build/library.cfg 2010-12-03 06:40:11 UTC (rev 10941)
@@ -4,7 +4,6 @@
[first]
OpenLayers/SingleFile.js
-OpenLayers.js
OpenLayers/BaseTypes.js
OpenLayers/BaseTypes/Class.js
OpenLayers/Util.js
@@ -15,8 +14,8 @@
[include]
[exclude]
-Firebug/firebug.js
-Firebug/firebugx.js
+Firebug
+OpenLayers.js
OpenLayers/Format/GeoRSS.js
OpenLayers/Format/GML.js
OpenLayers/Format/WKT.js
@@ -50,19 +49,6 @@
OpenLayers/Renderer/SVG.js
OpenLayers/Renderer/VML.js
OpenLayers/Renderer.js
-OpenLayers/Lang/ca.js
-OpenLayers/Lang/cs-CZ.js
-OpenLayers/Lang/da-DK.js
-OpenLayers/Lang/de.js
-OpenLayers/Lang/en-CA.js
-OpenLayers/Lang/es.js
-OpenLayers/Lang/fr.js
-OpenLayers/Lang/it.js
-OpenLayers/Lang/nb.js
-OpenLayers/Lang/nl.js
-OpenLayers/Lang/pt-BR.js
-OpenLayers/Lang/sv-SE.js
-OpenLayers/Lang/zh-TW.js
-OpenLayers/Lang/zh-CN.js
+OpenLayers/Lang
Modified: sandbox/august/trunk/build/license.txt
===================================================================
--- sandbox/august/trunk/build/license.txt 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/build/license.txt 2010-12-03 06:40:11 UTC (rev 10941)
@@ -90,3 +90,36 @@
* issues. Applications that use the code below will continue to work seamlessly
* when that happens.
*/
+
+/**
+ * OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is
+ * Copyright (c) 2006, Yahoo! Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use of this software in source and binary forms, with or
+ * without modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Yahoo! Inc. nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission of Yahoo! Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
\ No newline at end of file
Modified: sandbox/august/trunk/build/lite.cfg
===================================================================
--- sandbox/august/trunk/build/lite.cfg 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/build/lite.cfg 2010-12-03 06:40:11 UTC (rev 10941)
@@ -6,7 +6,6 @@
[first]
OpenLayers/SingleFile.js
-OpenLayers.js
OpenLayers/BaseTypes.js
OpenLayers/BaseTypes/Class.js
OpenLayers/Util.js
Modified: sandbox/august/trunk/examples/Jugl.js
===================================================================
--- sandbox/august/trunk/examples/Jugl.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/Jugl.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -1,84 +1,8 @@
-/**
+/*
* Jugl.js -- JavaScript Template Library
*
- * Copyright 2007 Tim Schaub
- * Released under the MIT license. Please see
- * http://svn.tschaub.net/jugl/trunk/license.txt for the full license.
+ * Copyright 2007-2010 Tim Schaub
+ * Released under the MIT license. Please see
+ * http://github.com/tschaub/jugl/blob/master/license.txt for the full license.
*/
-
-(function(){var Jugl={prefix:"jugl",namespaceURI:"http://namespace.jugl.org/"};Jugl.Array={indexOf:function(array,obj){for(var i=0;i<array.length;i++){if(array[i]==obj)return i;}
-return-1;}};Jugl.Function={bind:function(method,object){var args=[];for(var i=2;i<arguments.length;++i){args.push(arguments[i]);}
-return function(){for(var i=0;i<arguments.length;++i){args.push(arguments[i]);}
-return method.apply(object,args);}}};Jugl.Node={appendChild:function(parent,child){if(typeof(parent)=="string"){var obj=document.getElementById(parent);if(!obj){throw Error("Element id not found: "+parent);}
-parent=obj;}
-if(typeof(child)=="string"){var obj=document.getElementById(child);if(!obj){throw Error("Element id not found: "+child);}
-child=obj;}
-if(child.namespaceURI&&child.xml){var wrapper=document.createElement('div');wrapper.innerHTML=child.xml;var children=wrapper.childNodes;for(var i=0;i<children.length;++i){parent.appendChild(children[i]);}}else{if(parent.ownerDocument&&parent.ownerDocument.importNode){child=parent.ownerDocument.importNode(child,true);}
-parent.appendChild(child);}
-return child;}};Jugl.Object={extend:function(destination,source){destination=destination||{};source=source||{};for(property in source){destination[property]=source[property];}
-return destination;},applyDefaults:function(destination,source){destination=destination||{};source=source||{};for(property in source){if(destination[property]===undefined){destination[property]=source[property];}}
-return destination;}};Jugl.Request={loadTemplate:function(url,onComplete,caller){var createTemplate=function(request){var doc,template;try{doc=request.responseXML;template=new Jugl.Template(doc.documentElement);}catch(invalidXML){try{doc=document.createElement("div");doc.innerHTML=request.responseText;template=new Jugl.Template(doc.firstChild);}catch(invalidHTML){var msg="Can't make HTML out of response: "+
-request.responseText;Jugl.Console.error(msg);throw invalidHTML;}}
-var complete=Jugl.Function.bind(onComplete,caller);complete(template);}
-Jugl.Request.loadUrl(url,createTemplate);},loadUrl:function(url,onComplete,caller){var complete=(caller)?Jugl.Function.bind(onComplete,caller):onComplete;var request=Jugl.Request.createXMLHttpRequest();request.open("GET",url);request.onreadystatechange=function(){if(request.readyState==4){complete(request);}}
-request.send(null);},createXMLHttpRequest:function(){if(typeof XMLHttpRequest!="undefined"){return new XMLHttpRequest();}else if(typeof ActiveXObject!="undefined"){return new ActiveXObject("Microsoft.XMLHTTP");}else{throw new Error("XMLHttpRequest not supported");}}};Jugl.Class=function(){var Class=function(){if(this===Jugl){var msg="Create an instance of a Jugl "+"class with the new keyword";throw Error(msg);}
-this.initialize.apply(this,arguments);}
-var extended={toString:function(){return"["+this.CLASS_NAME+"]";}};var parent;for(var i=0;i<arguments.length;++i){if(typeof arguments[i]=="function"){parent=arguments[i].prototype;}else{parent=arguments[i];}
-Jugl.Object.extend(extended,parent);}
-Class.prototype=extended;return Class;};Jugl.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){}};(function(){if(window.console){var scripts=document.getElementsByTagName("script");for(var i=0;i<scripts.length;++i){if(scripts[i].src.indexOf("firebug.js")!=-1){Jugl.Object.extend(Jugl.Console,console);break;}}}})();Jugl.Attribute=Jugl.Class({element:null,node:null,type:null,nodeValue:null,template:null,initialize:function(element,node,type){this.element=element;this.node=node;this.type=type;this.nodeValue=node.nodeValue;this.nodeName=node.nodeName;this.template=element.template;},splitAttributeValue:function(value){value=(value!=null)?value:this.nodeValue;var matches=this.template.regExes.trimSpace.exec(value);var
items;if(matches&&matches.length==3){items=[matches[1],matches[2]];}
-return items;},splitExpressionPrefix:function(){var items=this.splitAttributeValue();if(!items||(items[0]!='structure'&&items[0]!='text')){items=[null,this.nodeValue];}
-return items;},getAttributeValues:function(){var trimmed=this.nodeValue.replace(/[\t\n]/g,"").replace(/;\s*$/,"");var tabbed=trimmed.replace(/;;/g,"\t");var newlined=tabbed.split(";").join("\n");return newlined.replace(/\t/g,";").split(/\n/g);},removeSelf:function(){this.element.removeAttributeNode(this);},process:function(){return this.processAttribute[this.type].apply(this,[]);},evalInScope:function(str){var expression="with(this.element.scope){"+str+"}";return eval(expression);},processAttribute:{"define":function(){var values=this.getAttributeValues();var pair;for(var i=0;i<values.length;++i){pair=this.splitAttributeValue(values[i]);this.element.scope[pair[0]]=this.evalInScope(pair[1]);}
-this.removeSelf();return true;},"condition":function(){var proceed;try{proceed=!!(this.evalInScope(this.nodeValue));}catch(err){var message=err.name+": "+err.message+"\n"+"attribute: "+this.nodeName;Jugl.Console.error(message);throw err;}
-this.removeSelf();if(!proceed){this.element.removeSelf();}
-return proceed;},"repeat":function(){var pair=this.splitAttributeValue();var key=pair[0];var list=this.evalInScope(pair[1]);this.removeSelf();if(!(list instanceof Array)){var items=new Array();for(var p in list){items.push(p);}
-list=items;}
-var element;var previousSibling=this.element;var length=list.length;for(var i=0;i<length;++i){element=this.element.clone();element.scope[key]=list[i];element.scope.repeat[key]={index:i,number:i+1,even:!(i%2),odd:!!(i%2),start:(i==0),end:(i==length-1),length:length};previousSibling.insertAfter(element);element.process();previousSibling=element;}
-this.element.removeSelf();return false;},"content":function(){var pair=this.splitExpressionPrefix();var str;try{str=this.evalInScope(pair[1]);}catch(err){Jugl.Console.error("Failed to eval in element scope: "+
-pair[1]);throw err;}
-this.removeSelf();if(pair[0]=='structure'){try{this.element.node.innerHTML=str;}catch(err){var wrapper=document.createElement('div');var msg;try{wrapper.innerHTML=str;}catch(invalidHTML){msg="Can't transform string into valid HTML : "+
-str;Jugl.Console.error(msg);throw invalidHTML;}
-if(this.element.node.xml&&this.template.xmldom){while(this.element.node.firstChild){this.element.node.removeChild(this.element.node.firstChild);}
-this.template.xmldom.loadXML(wrapper.outerHTML);var children=this.template.xmldom.firstChild.childNodes;try{for(var i=0;i<children.length;++i){this.element.node.appendChild(children[i]);}}catch(invalidXML){msg="Can't transform string into valid XHTML : "+
-str;Jugl.Console.error(msg);throw invalidXML;}}else{try{this.element.node.innerHTML=wrapper.innerHTML;}catch(invalidXML){msg="Can't transform string into valid XHTML : "+
-str;Jugl.Console.error(msg);throw invalidXML;}}}}else{var text;if(this.element.node.xml&&this.template.xmldom){text=this.template.xmldom.createTextNode(str);}else{text=document.createTextNode(str);}
-var child=new Jugl.Element(this.template,text);this.element.removeChildNodes();this.element.appendChild(child);}
-return true;},"replace":function(){var pair=this.splitExpressionPrefix();var str;try{str=this.evalInScope(pair[1]);}catch(err){Jugl.Console.error("Failed to eval in element scope: "+
-pair[1]);throw err;}
-this.removeSelf();if(pair[0]=='structure'){var wrapper=document.createElement('div');try{wrapper.innerHTML=str;}catch(err){msg="Can't transform string into valid HTML : "+
-str;Jugl.Console.error(msg);throw err;}
-if(this.element.node.xml&&this.template.xmldom){try{this.template.xmldom.loadXML(wrapper.outerHTML);}catch(err){msg="Can't transform string into valid XML : "+
-str;Jugl.Console.error(msg);throw err;}
-wrapper=this.template.xmldom.firstChild;}
-while(wrapper.firstChild){var child=wrapper.removeChild(wrapper.firstChild);if(this.element.node.ownerDocument&&this.element.node.ownerDocument.importNode){if(child.ownerDocument!=this.element.node.ownerDocument){child=this.element.node.ownerDocument.importNode(child,true);}}
-this.element.node.parentNode.insertBefore(child,this.element.node);}}else{var text;if(this.element.node.xml&&this.template.xmldom){text=this.template.xmldom.createTextNode(str);}else{text=document.createTextNode(str);}
-var replacement=new Jugl.Element(this.template,text);this.element.insertBefore(replacement);}
-this.element.removeSelf();return true;},"attributes":function(){var values=this.getAttributeValues();var pair,name,value;for(var i=0;i<values.length;++i){pair=this.splitAttributeValue(values[i]);name=pair[0];value=this.evalInScope(pair[1]);if(value!==false){this.element.setAttribute(name,value);}}
-this.removeSelf();return true;},"omit-tag":function(){var omit;try{omit=((this.nodeValue=="")||!!(this.evalInScope(this.nodeValue)));}catch(err){Jugl.Console.error("Failed to eval in element scope: "+
-this.nodeValue);throw err;}
-this.removeSelf();if(omit){var children=this.element.getChildNodes();var child;for(var i=0;i<children.length;++i){this.element.insertBefore(children[i]);}
-this.element.removeSelf();}},"reflow":function(){var reflow;try{reflow=((this.nodeValue=="")||!!(this.evalInScope(this.nodeValue)));}catch(err){Jugl.Console.error("Failed to eval in element scope: "+
-this.nodeValue);throw err;}
-this.removeSelf();if(reflow){if(this.element.node.outerHTML){this.element.node.outerHTML=this.element.node.outerHTML;}else{this.element.node.innerHTML=this.element.node.innerHTML;}}}},CLASS_NAME:"Jugl.Attribute"});Jugl.Element=Jugl.Class({template:null,node:null,scope:null,initialize:function(template,node){this.template=template;this.node=node;this.scope=new Object();this.scope.repeat=new Object();},clone:function(){var node=this.node.cloneNode(true);node.removeAttribute("id");var element=new Jugl.Element(this.template,node);Jugl.Object.extend(element.scope,this.scope);return element;},getAttribute:function(localName){var node;if(this.node.nodeType==1){if(this.template.usingNS){node=this.node.getAttributeNodeNS(Jugl.namespaceURI,localName);}else{node=this.node.getAttributeNode(Jugl.prefix+":"+
-localName);}
-if(node&&!node.specified){node=false;}}
-var attribute;if(node){attribute=new Jugl.Attribute(this,node,localName);}else{attribute=node;}
-return attribute;},setAttribute:function(name,value){this.node.setAttribute(name,value);},removeAttributeNode:function(attribute){this.node.removeAttributeNode(attribute.node);},getChildNodes:function(){var numNodes=this.node.childNodes.length;var children=new Array(numNodes);var node,scope;for(var i=0;i<numNodes;++i){node=new Jugl.Element(this.template,this.node.childNodes[i]);node.scope=Jugl.Object.extend({},this.scope);children[i]=node;}
-return children;},removeChildNodes:function(){while(this.node.hasChildNodes()){this.node.removeChild(this.node.firstChild);}},removeChild:function(element){this.node.removeChild(element.node);return node;},removeSelf:function(){this.node.parentNode.removeChild(this.node);},importNode:function(element){if(this.node.ownerDocument&&this.node.ownerDocument.importNode){if(element.node.ownerDocument!=this.node.ownerDocument){element.node=this.node.ownerDocument.importNode(element.node,true);}}},appendChild:function(element){this.importNode(element);this.node.appendChild(element.node);},insertAfter:function(element){this.importNode(element);var parent=this.node.parentNode;var sibling=this.node.nextSibling;if(sibling){parent.insertBefore(element.node,sibling);}else{parent.appendChild(element.node);}},insertBefore:function(element){this.importNode(element);var parent=this.node.parentNode;parent.insertBefore(element.node,this.node);},process:function(){var attribute;var keepProcessing
=true;var series=["define","condition","repeat"];for(var i=0;i<series.length;++i){attribute=this.getAttribute(series[i]);if(attribute){try{keepProcessing=attribute.process();}catch(err){Jugl.Console.error("Failed to process "+
-series[i]+" attribute");throw err;}
-if(!keepProcessing){return;}}}
-var content=this.getAttribute("content");if(content){try{content.process();}catch(err){Jugl.Console.error("Failed to process content attribute");throw err;}}else{var replace=this.getAttribute("replace");if(replace){try{replace.process();}catch(err){Jugl.Console.error("Failed to process replace attribute");throw err;}}}
-var attributes=this.getAttribute("attributes");if(attributes){try{attributes.process();}catch(err){Jugl.Console.error("Failed to process attributes attribute");throw err;}}
-if(!content&&!replace){this.processChildNodes();}
-var omit=this.getAttribute("omit-tag");if(omit){try{omit.process();}catch(err){Jugl.Console.error("Failed to process omit-tag attribute");throw err;}}
-var reflow=this.getAttribute("reflow");if(reflow){try{reflow.process();}catch(err){Jugl.Console.error("Failed to process reflow attribute");throw err;}}},processChildNodes:function(){var children=this.getChildNodes();for(var i=0;i<children.length;++i){try{children[i].process();}catch(err){Jugl.Console.error("Failed to process child node: "+i);throw err;}}},CLASS_NAME:"Jugl.Element"});Jugl.Template=Jugl.Class({node:null,usingNS:false,xhtmlns:"http://www.w3.org/1999/xhtml",xmldom:window.ActiveXObject?new ActiveXObject("Microsoft.XMLDOM"):null,regExes:{trimSpace:(/^\s*(\w+)\s+(.*?)\s*$/)},loaded:false,loading:false,initialize:function(config){if(typeof config=="string"||(config&&config.nodeType==1)){config={node:config};}
-config=config||{};if(typeof(config.node)=="string"){config.node=document.getElementById(config.node);if(!config.node){throw Error("Element id not found: "+config.node);}}
-if(config.node){this.node=config.node;this.loaded=true;}else if(config.url){this.load({url:config.url,callback:config.callback,scope:config.scope});}},process:function(config){if(config&&!config.context&&!config.clone&&!config.string&&!config.parent){config={context:config}}
-config=Jugl.Object.applyDefaults(config,{context:null,clone:false,string:false});if(this.node.getAttributeNodeNS){if(this.node.getAttributeNodeNS(Jugl.xhtmlns,Jugl.prefix)){this.usingNS=true;}}
-var element=new Jugl.Element(this,this.node);if(config.clone){element=element.clone();}
-if(config.context){element.scope=config.context;}
-try{element.process();}catch(err){Jugl.Console.error("Failed to process "+
-this.node.nodeName+" node");throw err;}
-var data;if(config.string){if(element.node.innerHTML){data=element.node.innerHTML;}else{if(this.xmldom){data=element.node.xml;}else{var serializer=new XMLSerializer();data=serializer.serializeToString(element.node);}}}else{data=element.node;if(config.parent){if(config.clone){data=Jugl.Node.appendChild(config.parent,element.node);}else{this.appendTo(config.parent);}}}
-return data;},load:function(config){if(typeof config=="string"){config={url:config};}
-config=config||{};this.loading=true;var setNode=function(template){this.node=template.node;this.loading=false;this.loaded=true;if(config.callback){config.callback.apply(config.scope,[template]);}}
-Jugl.Request.loadTemplate(config.url,setNode,this);},appendTo:function(parent){this.node=Jugl.Node.appendChild(parent,this.node);return this;},CLASS_NAME:"Jugl.Template"});window["http://jugl.tschaub.net/trunk/lib/Jugl.js"]=Jugl;})();
\ No newline at end of file
+(function(){var f={prefix:"jugl",namespaceURI:null,loadTemplate:function(h){var i=function(l){var m,k,n=!l.status||(l.status>=200&&l.status<300);if(n){try{m=l.responseXML;k=new e(m.documentElement)}catch(j){m=document.createElement("div");m.innerHTML=l.responseText;k=new e(m.firstChild)}if(h.callback){h.callback.call(h.scope,k)}}else{if(h.failure){h.failure.call(h.scope,l)}}};d(h.url,i)}};var g=function(h,j){h=h||{};j=j||{};for(var i in j){h[i]=j[i]}return h};var a=function(l,o){var m,n,k,j,h;if(typeof(l)==="string"){m=document.getElementById(l);if(!m){throw Error("Element id not found: "+l)}l=m}if(typeof(o)==="string"){m=document.getElementById(o);if(!m){throw Error("Element id not found: "+o)}o=m}if(o.namespaceURI&&o.xml){n=document.createElement("div");n.innerHTML=o.xml;k=n.childNodes;for(j=0,h=k.length;j<h;++j){l.appendChild(k[j])}}else{if(l.ownerDocument&&l.ownerDocument.importNode&&l.ownerDocument!==o.ownerDocument){o=l.ownerDocument.importNode(o,true)}l.appendChild(o)
}return o};var d=function(h,k,i){var j;if(typeof XMLHttpRequest!=="undefined"){j=new XMLHttpRequest()}else{if(typeof ActiveXObject!=="undefined"){j=new ActiveXObject("Microsoft.XMLHTTP")}else{throw new Error("XMLHttpRequest not supported")}}j.open("GET",h);j.onreadystatechange=function(){if(j.readyState===4){k.call(i,j)}};j.send(null)};var b=function(h,i){this.template=h;this.node=i;this.scope={};this.scope.repeat={}};g(b.prototype,{clone:function(){var i=this.node.cloneNode(true);i.removeAttribute("id");var h=new b(this.template,i);g(h.scope,this.scope);return h},getAttribute:function(h){var j;if(this.node.nodeType===1){if(this.template.usingNS){j=this.node.getAttributeNodeNS(f.namespaceURI,h)}else{j=this.node.getAttributeNode(f.prefix+":"+h)}if(j&&!j.specified){j=false}}var i;if(j){i=new c(this,j,h)}else{i=j}return i},setAttribute:function(h,i){this.node.setAttribute(h,i)},removeAttributeNode:function(h){this.node.removeAttributeNode(h.node)},getChildNodes:function(){var k
=this.node.childNodes.length;var j=new Array(k);var l;for(var h=0;h<k;++h){l=new b(this.template,this.node.childNodes[h]);l.scope=g({},this.scope);j[h]=l}return j},removeChildNodes:function(){while(this.node.hasChildNodes()){this.node.removeChild(this.node.firstChild)}},removeChild:function(h){this.node.removeChild(h.node);return node},removeSelf:function(){this.node.parentNode.removeChild(this.node)},importNode:function(h){if(this.node.ownerDocument&&this.node.ownerDocument.importNode){if(h.node.ownerDocument!==this.node.ownerDocument){h.node=this.node.ownerDocument.importNode(h.node,true)}}},appendChild:function(h){this.importNode(h);this.node.appendChild(h.node)},insertAfter:function(h){this.importNode(h);var j=this.node.parentNode;var i=this.node.nextSibling;if(i){j.insertBefore(h.node,i)}else{j.appendChild(h.node)}},insertBefore:function(h){this.importNode(h);var i=this.node.parentNode;i.insertBefore(h.node,this.node)},process:function(){var j;var r=true;var n=["define"
,"condition","repeat"];for(var o=0,p=n.length;o<p;++o){j=this.getAttribute(n[o]);if(j){r=j.process();if(!r){return}}}var q=this.getAttribute("content");if(q){q.process()}else{var k=this.getAttribute("replace");if(k){k.process()}}var m=this.getAttribute("attributes");if(m){m.process()}if(!q&&!k){this.processChildNodes()}var h=this.getAttribute("omit-tag");if(h){h.process()}var l=this.getAttribute("reflow");if(l){l.process()}},processChildNodes:function(){var k=this.getChildNodes();for(var j=0,h=k.length;j<h;++j){k[j].process()}}});var e=function(h){h=h||{};if(typeof h==="string"||(h.nodeType===1)){h={node:h}}if(typeof(h.node)==="string"){h.node=document.getElementById(h.node);if(!h.node){throw Error("Element id not found: "+h.node)}}if(h.node){this.node=h.node;this.loaded=true}else{if(h.url){this.load({url:h.url,callback:h.callback,scope:h.scope})}}};g(e.prototype,{node:null,usingNS:false,xmldom:window.ActiveXObject?new ActiveXObject("Microsoft.XMLDOM"):null,trimSpace:(/^\s*(
\w+)\s+(.*?)\s*$/),loaded:false,loading:false,process:function(h){var i,j;h=g({context:null,clone:false,string:false},h);this.usingNS=this.node.getAttributeNodeNS&&f.namespaceURI;i=new b(this,this.node);if(h.clone||h.string){i=i.clone()}if(h.context){i.scope=h.context}i.process();if(h.string){if(i.node.innerHTML){j=i.node.innerHTML}else{if(this.xmldom){j=i.node.xml}else{j=(new XMLSerializer).serializeToString(i.node)}}}else{j=i.node;if(h.parent){if(h.clone){j=a(h.parent,i.node)}else{this.appendTo(h.parent)}}}return j},load:function(j){if(typeof j==="string"){j={url:j}}j=j||{};this.loading=true;var h=function(k){this.node=k.node;this.loading=false;this.loaded=true;if(j.callback){j.callback.apply(j.scope,[k])}};var i;if(j.failure){i=(function(){return function(k){j.failure.call(j.scope,k)}})()}f.loadTemplate({url:j.url,callback:h,failure:i,scope:this})},appendTo:function(h){this.node=a(h,this.node);return this}});var c=function(h,j,i){this.element=h;this.node=j;this.type=i;thi
s.nodeValue=j.nodeValue;this.nodeName=j.nodeName;this.template=h.template};g(c.prototype,{splitAttributeValue:function(i){i=(i!=null)?i:this.nodeValue;var h=this.template.trimSpace.exec(i);return h&&h.length===3&&[h[1],h[2]]},splitExpressionPrefix:function(){var h=this.splitAttributeValue();if(!h||(h[0]!="structure"&&h[0]!="text")){h=[null,this.nodeValue]}return h},getAttributeValues:function(){return this.nodeValue.replace(/[\t\n]/g,"").replace(/;\s*$/,"").replace(/;;/g,"\t").split(";").join("\n").replace(/\t/g,";").split(/\n/g)},removeSelf:function(){this.element.removeAttributeNode(this)},process:function(){return this.processAttribute[this.type].apply(this,[])},evalInScope:function(k){var i=this.element.scope;var h=[];var j=[];for(key in i){h.push(key);j.push(i[key])}var l=new Function(h.join(","),"return "+k);return l.apply({},j)},processAttribute:{define:function(){var l,k,j,h=this.getAttributeValues();for(k=0,j=h.length;k<j;++k){l=this.splitAttributeValue(h[k]);this.e
lement.scope[l[0]]=this.evalInScope(l[1])}this.removeSelf();return true},condition:function(){var h=!!(this.evalInScope(this.nodeValue));this.removeSelf();if(!h){this.element.removeSelf()}return h},repeat:function(){var l=this.splitAttributeValue();var r=l[0];var o=this.evalInScope(l[1]);this.removeSelf();if(!(o instanceof Array)){var q=new Array();for(var j in o){q.push(j)}o=q}var m;var h=this.element;for(var n=0,k=o.length;n<k;++n){m=this.element.clone();m.scope[r]=o[n];m.scope.repeat[r]={index:n,number:n+1,even:!(n%2),odd:!!(n%2),start:(n===0),end:(n===k-1),length:k};h.insertAfter(m);m.process();h=m}this.element.removeSelf();return false},content:function(){var m=this.splitExpressionPrefix();var p=this.evalInScope(m[1]);this.removeSelf();if(m[0]==="structure"){try{this.element.node.innerHTML=p}catch(l){var h=document.createElement("div");h.innerHTML=p;if(this.element.node.xml&&this.template.xmldom){while(this.element.node.firstChild){this.element.node.removeChild(this.ele
ment.node.firstChild)}this.template.xmldom.loadXML(h.outerHTML);var k=this.template.xmldom.firstChild.childNodes;for(var n=0,o=k.length;n<o;++n){this.element.node.appendChild(k[n])}}else{this.element.node.innerHTML=h.innerHTML}}}else{var q;if(this.element.node.xml&&this.template.xmldom){q=this.template.xmldom.createTextNode(p)}else{q=document.createTextNode(p)}var j=new b(this.template,q);this.element.removeChildNodes();this.element.appendChild(j)}return true},replace:function(){var k=this.splitExpressionPrefix();var j=this.evalInScope(k[1]);this.removeSelf();if(k[0]==="structure"){var m=document.createElement("div");m.innerHTML=j;if(this.element.node.xml&&this.template.xmldom){this.template.xmldom.loadXML(m.outerHTML);m=this.template.xmldom.firstChild}while(m.firstChild){var l=m.removeChild(m.firstChild);if(this.element.node.ownerDocument&&this.element.node.ownerDocument.importNode){if(l.ownerDocument!=this.element.node.ownerDocument){l=this.element.node.ownerDocument.impor
tNode(l,true)}}this.element.node.parentNode.insertBefore(l,this.element.node)}}else{var i;if(this.element.node.xml&&this.template.xmldom){i=this.template.xmldom.createTextNode(j)}else{i=document.createTextNode(j)}var h=new b(this.template,i);this.element.insertBefore(h)}this.element.removeSelf();return true},attributes:function(){var h=this.getAttributeValues();var n,k,m;for(var l=0,j=h.length;l<j;++l){n=this.splitAttributeValue(h[l]);k=n[0];m=this.evalInScope(n[1]);if(m!==false){this.element.setAttribute(k,m)}}this.removeSelf();return true},"omit-tag":function(){var l=((this.nodeValue==="")||!!(this.evalInScope(this.nodeValue)));this.removeSelf();if(l){var k=this.element.getChildNodes();for(var j=0,h=k.length;j<h;++j){this.element.insertBefore(k[j])}this.element.removeSelf()}},reflow:function(){var h=((this.nodeValue==="")||!!(this.evalInScope(this.nodeValue)));this.removeSelf();if(h){if(this.element.node.outerHTML){this.element.node.outerHTML=this.element.node.outerHTML}el
se{this.element.node.innerHTML=this.element.node.innerHTML}}}}});window.jugl=g(f,{Template:e})})();
\ No newline at end of file
Copied: sandbox/august/trunk/examples/donut.html (from rev 10940, trunk/openlayers/examples/donut.html)
===================================================================
--- sandbox/august/trunk/examples/donut.html (rev 0)
+++ sandbox/august/trunk/examples/donut.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers Polygon Hole Digitizing</title>
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <style>
+ #controlToggle li {
+ list-style: none;
+ }
+ .olControlAttribution {
+ font-size: 9px;
+ bottom: 2px;
+ }
+ #output {
+ margin: 1em;
+ font-size: 0.9em;
+ }
+ </style>
+ </head>
+ <body>
+ <h1 id="title">Drawing Holes in Polygons</h1>
+ <div id="tags">
+ draw polygon hole
+ </div>
+ <p id="shortdesc">
+ The DrawFeature control can be used to digitize donut polygons.
+ </p>
+
+ <div id="map" class="smallmap"></div>
+ <ul id="controlToggle">
+ <li>
+ <input type="radio" name="type" value="none" id="noneToggle"
+ onclick="toggleControl(this);" checked="checked">
+ <label for="noneToggle">navigate</label>
+ </li>
+ <li>
+ <input type="radio" name="type" value="polygon" id="polygonToggle" onclick="toggleControl(this);">
+ <label for="polygonToggle">draw polygon</label>
+ </li>
+ </ul>
+ <div id="output"></div>
+ <div id="docs">
+ <p>
+ To digitize holes in polygons, hold down the <code>Alt</code>
+ key and draw over an existing polygon. By default, the
+ <code>Shift</code> key triggers freehand drawing. Use a
+ combination of the <code>Shift</code> and <code>Alt</code> keys
+ to digitize holes in freehand mode.
+ </p>
+ <p>
+ See the <a href="donut.js" target="_blank">
+ donut.js source</a> for details on how this is done.
+ </p>
+ </div>
+ <script src="../lib/OpenLayers.js"></script>
+ <script src="donut.js"></script>
+ </body>
+</html>
Copied: sandbox/august/trunk/examples/donut.js (from rev 10940, trunk/openlayers/examples/donut.js)
===================================================================
--- sandbox/august/trunk/examples/donut.js (rev 0)
+++ sandbox/august/trunk/examples/donut.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,38 @@
+var map = new OpenLayers.Map({
+ div: "map",
+ layers: [
+ new OpenLayers.Layer.OSM(),
+ new OpenLayers.Layer.Vector()
+ ],
+ center: new OpenLayers.LonLat(0, 0),
+ zoom: 1
+});
+
+var draw = new OpenLayers.Control.DrawFeature(
+ map.layers[1],
+ OpenLayers.Handler.Polygon,
+ {handlerOptions: {holeModifier: "altKey"}}
+);
+map.addControl(draw);
+
+// optionally listen for sketch events on the layer
+var output = document.getElementById("output");
+function updateOutput(event) {
+ window.setTimeout(function() {
+ output.innerHTML = event.type + " " + event.feature.id;
+ }, 100);
+}
+map.layers[1].events.on({
+ sketchmodified: updateOutput,
+ sketchcomplete: updateOutput
+})
+
+// add behavior to UI elements
+function toggleControl(element) {
+ if (element.value === "polygon" && element.checked) {
+ draw.activate();
+ } else {
+ draw.deactivate();
+ }
+}
+document.getElementById("noneToggle").checked = true;
\ No newline at end of file
Modified: sandbox/august/trunk/examples/example-list.html
===================================================================
--- sandbox/august/trunk/examples/example-list.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/example-list.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -98,8 +98,6 @@
<script type="text/javascript" src="Jugl.js"></script>
<script type="text/javascript" src="example-list.js"></script>
<script type="text/javascript">
- // import
- var Jugl = window["http://jugl.tschaub.net/trunk/lib/Jugl.js"];
var template, target;
function listExamples(examples) {
@@ -201,7 +199,7 @@
}
}
window.onload = function() {
- template = new Jugl.Template("template");
+ template = new jugl.Template("template");
target = document.getElementById("examples");
listExamples(info.examples);
document.getElementById("exwin").src = "../examples/example.html";
Modified: sandbox/august/trunk/examples/getfeature-wfs.html
===================================================================
--- sandbox/august/trunk/examples/getfeature-wfs.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/getfeature-wfs.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -18,8 +18,8 @@
});
layer = new OpenLayers.Layer.WMS(
"States WMS/WFS",
- "http://demo.opengeo.org/geoserver/ows",
- {layers: 'topp:states', format: 'image/gif'}
+ "http://v2.suite.opengeo.org/geoserver/ows",
+ {layers: 'usa:states', format: 'image/gif'}
);
select = new OpenLayers.Layer.Vector("Selection", {styleMap:
new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
Modified: sandbox/august/trunk/examples/kml-layer.html
===================================================================
--- sandbox/august/trunk/examples/kml-layer.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/kml-layer.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -1,45 +1,33 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <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>
- <script type="text/javascript">
- var lon = 5;
- var lat = 40;
- var zoom = 5;
- var map, layer;
+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ </head>
+ <body>
+ <h1 id="title">KML Layer Example</h1>
- function init(){
- map = new OpenLayers.Map('map');
- layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
- "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
- map.addLayer(layer);
- map.addLayer(new OpenLayers.Layer.GML("KML", "kml/lines.kml",
- {
- format: OpenLayers.Format.KML,
- formatOptions: {
- extractStyles: true,
- extractAttributes: true,
- maxDepth: 2
- }
- }));
- map.zoomToExtent(new OpenLayers.Bounds(-112.306698,36.017792,-112.03204,36.18087));
- }
- </script>
- </head>
- <body onload="init()">
- <h1 id="title">KML Layer Example</h1>
+ <div id="tags">KML</div>
- <div id="tags">
- KML
- </div>
-
- <p id="shortdesc">
- Demonstrates loading and displaying a KML file on top of a basemap.
+ <p id="shortdesc">
+ Demonstrates loading and displaying a KML file on top of a basemap.
</p>
<div id="map" class="smallmap"></div>
- <div id="docs"></div>
- </body>
+ <div id="docs">
+ <p>
+ A vector layer can be populated with features from a KML document
+ by configuring the layer with an HTTP protocol that points to the
+ KML document and is configured with a KML format for parsing features.
+ The fixed strategy is used to load all features at once.
+ </p>
+ <p>
+ View the <a href="kml-layer.js" target="_blank">kml-layer.js</a>
+ source to see how this is done.
+ </p>
+ </div>
+ <script src="../lib/OpenLayers.js"></script>
+ <script src="kml-layer.js"></script>
+ </body>
</html>
Copied: sandbox/august/trunk/examples/kml-layer.js (from rev 10940, trunk/openlayers/examples/kml-layer.js)
===================================================================
--- sandbox/august/trunk/examples/kml-layer.js (rev 0)
+++ sandbox/august/trunk/examples/kml-layer.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,22 @@
+var map = new OpenLayers.Map({
+ div: "map",
+ layers: [
+ new OpenLayers.Layer.WMS(
+ "WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0",
+ {layers: "basic"}
+ ),
+ new OpenLayers.Layer.Vector("KML", {
+ strategies: [new OpenLayers.Strategy.Fixed()],
+ protocol: new OpenLayers.Protocol.HTTP({
+ url: "kml/lines.kml",
+ format: new OpenLayers.Format.KML({
+ extractStyles: true,
+ extractAttributes: true,
+ maxDepth: 2
+ })
+ })
+ })
+ ],
+ center: new OpenLayers.LonLat(-112.169, 36.099),
+ zoom: 11
+});
Modified: sandbox/august/trunk/examples/measure.html
===================================================================
--- sandbox/august/trunk/examples/measure.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/measure.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -132,6 +132,13 @@
control.geodesic = element.checked;
}
}
+
+ function toggleImmediate(element) {
+ for(key in measureControls) {
+ var control = measureControls[key];
+ control.setImmediate(element.checked);
+ }
+ }
</script>
</head>
<body onload="init()">
@@ -164,13 +171,19 @@
<input type="checkbox" name="geodesic" id="geodesicToggle" onclick="toggleGeodesic(this);" />
<label for="geodesicToggle">use geodesic measures</label>
</li>
+ <li>
+ <input type="checkbox" name="immediate" id="immediateToggle" onclick="toggleImmediate(this);" />
+ <label for="immediateToggle">use immediate measures</label>
+ </li>
</ul>
<p>Note that the geometries drawn are planar geometries and the
metrics returned by the measure control are planar measures by
default. If your map is in a geographic projection or you have the
appropriate projection definitions to transform your geometries into
geographic coordinates, you can set the "geodesic" property of the control
- to true to calculate geodesic measures instead of planar measures.</p>
+ to true to calculate geodesic measures instead of planar measures.
+ Also you have the possibility to set the "immediate" property to true
+ to get a new calculated value once the mouse has been mooved.</p>
</div>
</body>
</html>
Deleted: sandbox/august/trunk/examples/notile.html
===================================================================
--- sandbox/august/trunk/examples/notile.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/notile.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -1,42 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>OpenLayers: Single Tile</title>
- <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>
- <script type="text/javascript">
- var map;
- function init(){
- map = new OpenLayers.Map('mapDiv', {maxResolution: 'auto'});
-
- var old_ol_wms = new OpenLayers.Layer.WMS.Untiled( "WMS.Untiled",
- "http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'} );
- old_ol_wms.addOptions({isBaseLayer: true});
-
- var new_ol_wms = new OpenLayers.Layer.WMS( "WMS w/singleTile",
- "http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'},
- { singleTile: true, ratio: 1 } );
- new_ol_wms.addOptions({isBaseLayer: true});
-
- map.addLayers([old_ol_wms, new_ol_wms]);
- map.addControl(new OpenLayers.Control.LayerSwitcher());
- map.setCenter(new OpenLayers.LonLat(6.5, 40.5), 4);
- }
- </script>
- </head>
- <body onload="init()">
- <h1 id="title">Untiled Example</h1>
- <div id="tags">
- tile, ratio, singleTile, performance
- </div>
- <p id="shortdesc">
- Create an untiled WMS layer using the singleTile: true, option or the deprecated
- WMS.Untiled layer.
- </p>
- <div id="mapDiv" class="smallmap"></div>
- <p> The first layer is an old OpenLayers.Layer.WMS.Untiled layer, using
- a default ratio value of 1.5.
- <p> The second layer is an OpenLayers.Layer.WMS layer with singleTile set
- to true, and with a ratio of 1.
- </body>
-</html>
Modified: sandbox/august/trunk/examples/proxy.cgi
===================================================================
--- sandbox/august/trunk/examples/proxy.cgi 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/proxy.cgi 2010-12-03 06:40:11 UTC (rev 10941)
@@ -20,7 +20,7 @@
'prototype.openmnnd.org', 'geo.openplans.org',
'sigma.openplans.org', 'demo.opengeo.org',
'www.openstreetmap.org', 'sample.azavea.com',
- 'v-swe.uni-muenster.de:8080',
+ 'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080',
'vmap0.tiles.osgeo.org']
method = os.environ["REQUEST_METHOD"]
Copied: sandbox/august/trunk/examples/single-tile.html (from rev 10940, trunk/openlayers/examples/single-tile.html)
===================================================================
--- sandbox/august/trunk/examples/single-tile.html (rev 0)
+++ sandbox/august/trunk/examples/single-tile.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers: Single Tile</title>
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ </head>
+ <body>
+ <h1 id="title">Single Tile Example</h1>
+ <div id="tags">tile, ratio, singleTile, performance</div>
+ <p id="shortdesc">
+ Use the singleTile option on gridded layers to request a single tile.
+ </p>
+ <div id="mapDiv" class="smallmap"></div>
+ <div id="docs">
+ <p>
+ This map demonstrates the use of the singleTile property as an
+ alternative to the default tiled behavior of layers. The first
+ layer in the map is a WMS layer with the singleTile option set
+ true. The second layer is a WMS layer with the default options.
+ </p>
+ <p>
+ View the <a href="single-tile.js" target="_blank">single-tile.js</a>
+ source to see how this is done.
+ </p>
+ </div>
+ <script src="../lib/OpenLayers.js"></script>
+ <script src="single-tile.js"></script>
+ </body>
+</html>
Copied: sandbox/august/trunk/examples/single-tile.js (from rev 10940, trunk/openlayers/examples/single-tile.js)
===================================================================
--- sandbox/august/trunk/examples/single-tile.js (rev 0)
+++ sandbox/august/trunk/examples/single-tile.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,20 @@
+var map = new OpenLayers.Map({
+ div: "mapDiv",
+ layers: [
+ new OpenLayers.Layer.WMS(
+ "Single Tile",
+ "http://vmap0.tiles.osgeo.org/wms/vmap0",
+ {layers: "basic"},
+ {singleTile: true, ratio: 1}
+ ),
+ new OpenLayers.Layer.WMS(
+ "Multiple Tiles",
+ "http://vmap0.tiles.osgeo.org/wms/vmap0",
+ {layers: "basic"}
+ )
+ ],
+ center: new OpenLayers.LonLat(6.5, 40.5),
+ zoom: 4
+});
+
+map.addControl(new OpenLayers.Control.LayerSwitcher());
Modified: sandbox/august/trunk/examples/snapping.html
===================================================================
--- sandbox/august/trunk/examples/snapping.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/snapping.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -164,7 +164,7 @@
});
draw = new OpenLayers.Control.DrawFeature(
poly, OpenLayers.Handler.Polygon,
- {displayClass: "olControlDrawFeaturePoint", title: "Draw Features"}
+ {displayClass: "olControlDrawFeaturePoint", title: "Draw Features", handlerOptions: {holeModifier: "altKey"}}
);
modify = new OpenLayers.Control.ModifyFeature(
poly, {displayClass: "olControlModifyFeature", title: "Modify Features"}
Modified: sandbox/august/trunk/examples/sos.html
===================================================================
--- sandbox/august/trunk/examples/sos.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/sos.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -133,7 +133,7 @@
responseMode: 'inline',
procedure: feature.attributes.id,
offering: name,
- observedProperty: offering.observedProperties[0],
+ observedProperties: offering.observedProperties,
responseFormat: this.responseFormat
});
OpenLayers.Request.POST({
Copied: sandbox/august/trunk/examples/strategy-cluster-extended.html (from rev 10940, trunk/openlayers/examples/strategy-cluster-extended.html)
===================================================================
--- sandbox/august/trunk/examples/strategy-cluster-extended.html (rev 0)
+++ sandbox/august/trunk/examples/strategy-cluster-extended.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,122 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Extended clustering example</title>
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <style type="text/css">
+ label {
+ cursor: pointer
+ }
+
+ #wrap {
+ width: 925px;
+ margin: 10px;
+ }
+
+ #strategy-chooser, #generalinfo, #info {
+ width: 400px;
+ padding: 0;
+ float: right;
+ clear: right;
+ margin-bottom: 4px;
+ }
+
+ #map {
+ float: left;
+ }
+ </style>
+ </head>
+ <body>
+ <h1 id="title">Extended clustering</h1>
+ <div id="tags">
+ cluster, advanced
+ </div>
+ <p id="shortdesc">
+ Shows the usage of custom classes for a fine grained control about
+ the clustering behaviour.
+ </p>
+ <div id="wrap">
+ <div id="map" class="smallmap">
+ </div>
+ <div id="strategy-chooser">
+ <p>
+ Select the desired clustering strategy:
+ </p>
+ <label>
+ <input type="radio" name="strategy" value="none" id="no-strategy" checked="checked">No strategy
+ </label>
+ <br/>
+ <label>
+ <input type="radio" name="strategy" value="cluster" id="cluster-strategy">Simple cluster-strategy
+ </label>
+ <br/>
+ <label>
+ <input type="radio" name="strategy" value="attribute-cluster" id="attributive-cluster-strategy">Attributive cluster-strategy
+ </label>
+ <br/>
+ <label>
+ <input type="radio" name="strategy" value="rule-cluster" id="rulebased-cluster-strategy">Rulebased cluster-strategy
+ </label>
+ </div>
+ <div id="generalinfo">
+ </div>
+ <div id="info">
+ </div>
+ </div>
+ <div id="docs" style="clear: both; padding-top: 10px">
+ <p>
+ The vectorlayer in this example contains random data with an
+ attribute "clazz" that can take the values 1, 2, 3 and 4. The
+ features with clazz = 4 are considered more important than the
+ others.
+ </p>
+ <p>
+ The radiobuttons on the right of the map control the
+ cluster strategy to be applied to the features.
+ </p>
+ <ul>
+ <li>
+ <strong>No strategy</strong>
+ means that all features are
+ rendered, no clustering shall be applied
+ </li>
+ <li>
+ <strong>Simple cluster-strategy</strong>
+ applies the cluster
+ strategy with default options to the layer. You should notice
+ that many of the important features with clazz = 4 are getting
+ lost, since clustering happens regardless of feature attributes
+ </li>
+ <li>
+ <strong>Attributive cluster-strategy</strong>
+ uses a
+ customized cluster strategy. This strategy is configured to
+ cluster features of the same clazz only. You should be able to see all
+ red points (clazz = 4) even though the data is clustered. A
+ cluster now contains only features of the same clazz.
+ </li>
+ <li>
+ <strong>Rulebased cluster-strategy</strong>
+ uses another
+ customized cluster strategy. This strategy is configured to
+ cluster features that follow a certain rule only. In this case only
+ features with a clazz different from 4 are considered as
+ candidates for clustering. That means that usually you have fewer
+ clusters on the map, yet all with clazz = 4 are easily
+ distinguishable
+ </li>
+ </ul>
+ <p>
+ Hover over the features to get a short infomation about the
+ feature or cluster of features.
+ </p>
+ </div>
+ <p>
+ View the <a href="strategy-cluster-extended.js" target="_blank">strategy-cluster-extended.js</a>
+ source to see how this is done.
+ </p>
+ <script type="text/javascript" src="../lib/OpenLayers.js"></script>
+ <script type="text/javascript" src="strategy-cluster-extended.js"></script>
+ </body>
+</html>
Copied: sandbox/august/trunk/examples/strategy-cluster-extended.js (from rev 10940, trunk/openlayers/examples/strategy-cluster-extended.js)
===================================================================
--- sandbox/august/trunk/examples/strategy-cluster-extended.js (rev 0)
+++ sandbox/august/trunk/examples/strategy-cluster-extended.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,247 @@
+/**
+ * Class: OpenLayers.Strategy.AttributeCluster
+ * Strategy for vector feature clustering based on feature attributes.
+ *
+ * Inherits from:
+ * - <OpenLayers.Strategy.Cluster>
+ */
+OpenLayers.Strategy.AttributeCluster = OpenLayers.Class(OpenLayers.Strategy.Cluster, {
+ /**
+ * the attribute to use for comparison
+ */
+ attribute: null,
+ /**
+ * Method: shouldCluster
+ * Determine whether to include a feature in a given cluster.
+ *
+ * Parameters:
+ * cluster - {<OpenLayers.Feature.Vector>} A cluster.
+ * feature - {<OpenLayers.Feature.Vector>} A feature.
+ *
+ * Returns:
+ * {Boolean} The feature should be included in the cluster.
+ */
+ shouldCluster: function(cluster, feature) {
+ var cc_attrval = cluster.cluster[0].attributes[this.attribute];
+ var fc_attrval = feature.attributes[this.attribute];
+ var superProto = OpenLayers.Strategy.Cluster.prototype;
+ return cc_attrval === fc_attrval &&
+ superProto.shouldCluster.apply(this, arguments);
+ },
+ CLASS_NAME: "OpenLayers.Strategy.AttributeCluster"
+});
+
+/**
+ * Class: OpenLayers.Strategy.RuleCluster
+ * Strategy for vector feature clustering according to a given rule.
+ *
+ * Inherits from:
+ * - <OpenLayers.Strategy.Cluster>
+ */
+OpenLayers.Strategy.RuleCluster = OpenLayers.Class(OpenLayers.Strategy.Cluster, {
+ /**
+ * the rule to use for comparison
+ */
+ rule: null,
+ /**
+ * Method: shouldCluster
+ * Determine whether to include a feature in a given cluster.
+ *
+ * Parameters:
+ * cluster - {<OpenLayers.Feature.Vector>} A cluster.
+ * feature - {<OpenLayers.Feature.Vector>} A feature.
+ *
+ * Returns:
+ * {Boolean} The feature should be included in the cluster.
+ */
+ shouldCluster: function(cluster, feature) {
+ var superProto = OpenLayers.Strategy.Cluster.prototype;
+ return this.rule.evaluate(cluster.cluster[0]) &&
+ this.rule.evaluate(feature) &&
+ superProto.shouldCluster.apply(this, arguments);
+ },
+ CLASS_NAME: "OpenLayers.Strategy.RuleCluster"
+});
+
+
+// global variables
+var map, vectorlayer, features, stylemap, select;
+
+// wrap the instanciation code in an anonymous function that gets executed
+// immeadeately
+(function(){
+
+ // The function that gets called on feature selection: shows information
+ // about the feature/cluser in a div on the page
+ var showInformation = function(evt){
+ var feature = evt.feature;
+ var info = 'Last hovered feature:<br>';
+ if (feature.cluster) {
+ info += ' Cluster of ' + feature.attributes.count + ' features:';
+ var clazzes = {
+ '1': 0,
+ '2': 0,
+ '3': 0,
+ '4': 0
+ };
+ for (var i = 0; i < feature.attributes.count; i++) {
+ var feat = feature.cluster[i];
+ clazzes[feat.attributes.clazz]++;
+ }
+ for (var j=1; j<=4; j++) {
+ var plural_s = (clazzes[j] !== 1) ? 's' : '';
+ info += '<br> • clazz ' + j + ': ' + clazzes[j] + ' feature' + plural_s;
+ }
+ } else {
+ info += ' Single feature of clazz = ' + feature.attributes.clazz;
+ }
+ $('info').innerHTML = info;
+ };
+
+ // The function that gets called on feature selection. Shows information
+ // about the number of "points" on the map.
+ var updateGeneralInformation = function() {
+ var info = 'Currently ' + vectorlayer.features.length + ' points are shown on the map.';
+ $('generalinfo').innerHTML = info;
+ };
+
+ // instanciate the map
+ map = new OpenLayers.Map("map");
+
+ // background WMS
+ var ol_wms = new OpenLayers.Layer.WMS("OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0", {
+ layers: "basic"
+ });
+
+ // context to style the vectorlayer
+ var context = {
+ getColor: function(feature){
+ var color = '#aaaaaa';
+ if (feature.attributes.clazz && feature.attributes.clazz === 4) {
+ color = '#ee0000';
+ } else if(feature.cluster) {
+ var onlyFour = true;
+ for (var i = 0; i < feature.cluster.length; i++) {
+ if (onlyFour && feature.cluster[i].attributes.clazz !== 4) {
+ onlyFour = false;
+ }
+ }
+ if (onlyFour === true) {
+ color = '#ee0000';
+ }
+ }
+ return color;
+ }
+ };
+
+ // style the vectorlayer
+ stylemap = new OpenLayers.StyleMap({
+ 'default': new OpenLayers.Style({
+ pointRadius: 5,
+ fillColor: "${getColor}",
+ fillOpacity: 0.7,
+ strokeColor: "#666666",
+ strokeWidth: 1,
+ strokeOpacity: 1,
+ graphicZIndex: 1
+ }, {
+ context: context
+ }),
+ 'select' : new OpenLayers.Style({
+ pointRadius: 5,
+ fillColor: "#ffff00",
+ fillOpacity: 1,
+ strokeColor: "#666666",
+ strokeWidth: 1,
+ strokeOpacity: 1,
+ graphicZIndex: 2
+ })
+ });
+
+ // the vectorlayer
+ vectorlayer = new OpenLayers.Layer.Vector('Vectorlayer', {styleMap: stylemap, strategies: []});
+
+ // the select control
+ select = new OpenLayers.Control.SelectFeature(
+ vectorlayer, {hover: true}
+ );
+ map.addControl(select);
+ select.activate();
+ vectorlayer.events.on({"featureselected": showInformation});
+
+ map.addLayers([ol_wms, vectorlayer]);
+ map.addControl(new OpenLayers.Control.LayerSwitcher());
+ map.zoomToMaxExtent();
+
+ features = [];
+ // adding lots of features:
+ for (var i = 0; i < 700; i++) {
+ var r1 = Math.random();
+ var r2 = Math.random();
+ var r3 = Math.random();
+ var r4 = Math.random();
+ var px = r1 * 180 * ((r2 < 0.5) ? -1 : 1);
+ var py = r3 * 90 * ((r4 < 0.5) ? -1 : 1);
+ var p = new OpenLayers.Geometry.Point(px, py);
+ var clazz = (i % 10 === 0) ? 4 : Math.ceil(r4 * 3);
+ var f = new OpenLayers.Feature.Vector(p, {clazz: clazz});
+ features.push(f);
+ }
+ vectorlayer.addFeatures(features);
+ updateGeneralInformation();
+
+ // the behaviour and methods for the radioboxes
+ var changeStrategy = function() {
+ var strategies = [];
+ // this is the checkbox
+ switch(this.value) {
+ case 'cluster':
+ // standard clustering
+ strategies.push(new OpenLayers.Strategy.Cluster());
+ break;
+ case 'attribute-cluster':
+ // use the custom class: only cluster features of the same clazz
+ strategies.push(new OpenLayers.Strategy.AttributeCluster({
+ attribute:'clazz'
+ }));
+ break;
+ case 'rule-cluster':
+ // use the custom class: only cluster features that have a
+ // clazz smaller than 4
+ strategies.push(new OpenLayers.Strategy.RuleCluster({
+ rule: new OpenLayers.Rule({
+ filter: new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LESS_THAN,
+ property: "clazz",
+ value: 4
+ })
+ })
+ }));
+ break;
+ }
+ // remove layer and control
+ map.removeLayer(vectorlayer);
+ map.removeControl(select);
+ // rebuild layer
+ vectorlayer = new OpenLayers.Layer.Vector('Vectorlayer', {styleMap: stylemap, strategies: strategies});
+ map.addLayer( vectorlayer );
+ vectorlayer.addFeatures(features);
+ // rebuild select control
+ select = new OpenLayers.Control.SelectFeature(
+ vectorlayer, {hover: true}
+ );
+ map.addControl(select);
+ select.activate();
+ vectorlayer.events.on({"featureselected": showInformation});
+ // update meta information
+ updateGeneralInformation();
+ };
+ // bind the behviour to the radios
+ var inputs = document.getElementsByTagName('input');
+ for( var cnt = 0; cnt < inputs.length; cnt++) {
+ var input = inputs[cnt];
+ if (input.name === 'strategy') {
+ input.onclick = changeStrategy;
+ }
+ }
+})();
Modified: sandbox/august/trunk/examples/strategy-cluster.html
===================================================================
--- sandbox/august/trunk/examples/strategy-cluster.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/strategy-cluster.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -66,7 +66,6 @@
<script src="animator.js"></script>
<script type="text/javascript">
var map, template;
- var Jugl = window["http://jugl.tschaub.net/trunk/lib/Jugl.js"];
OpenLayers.ProxyHost = (window.location.host == "localhost") ?
"/cgi-bin/proxy.cgi?url=" : "proxy.cgi?url=";
@@ -135,7 +134,7 @@
map.setCenter(new OpenLayers.LonLat(0, 0), 1);
// template setup
- template = new Jugl.Template("template");
+ template = new jugl.Template("template");
}
Modified: sandbox/august/trunk/examples/sundials-spherical-mercator.html
===================================================================
--- sandbox/august/trunk/examples/sundials-spherical-mercator.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/sundials-spherical-mercator.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -31,15 +31,7 @@
20037508.34, 20037508.34)
};
map = new OpenLayers.Map('map', options);
- var mapnik = new OpenLayers.Layer.TMS(
- "OpenStreetMap (Mapnik)",
- "http://tile.openstreetmap.org/",
- {
- type: 'png', getURL: osm_getTileURL,
- displayOutsideMaxExtent: true,
- attribution: '<a href="http://www.openstreetmap.org/">OpenStreetMap</a>'
- }
- );
+ var mapnik = new OpenLayers.Layer.OSM("OpenStreetMap (Mapnik)");
var gmap = new OpenLayers.Layer.Google("Google", {sphericalMercator:true});
var sundials = new OpenLayers.Layer.Vector("KML", {
projection: map.displayProjection,
@@ -96,20 +88,6 @@
delete feature.popup;
}
}
- function osm_getTileURL(bounds) {
- var res = this.map.getResolution();
- var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
- var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
- var z = this.map.getZoom();
- var limit = Math.pow(2, z);
-
- if (y < 0 || y >= limit) {
- return OpenLayers.Util.getImagesLocation() + "404.png";
- } else {
- x = ((x % limit) + limit) % limit;
- return this.url + z + "/" + x + "/" + y + "." + this.type;
- }
- }
</script>
</head>
<body onload="init()">
Modified: sandbox/august/trunk/examples/vector-features.html
===================================================================
--- sandbox/august/trunk/examples/vector-features.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/examples/vector-features.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers: Vector Features</title>
Modified: sandbox/august/trunk/lib/OpenLayers/BaseTypes/Class.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/BaseTypes/Class.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/BaseTypes/Class.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -23,49 +23,22 @@
*
*/
OpenLayers.Class = function() {
- var Class = function() {
- /**
- * This following condition can be removed at 3.0 - this is only for
- * backwards compatibility while the Class.inherit method is still
- * in use. So at 3.0, the following three lines would be replaced with
- * simply:
- * this.initialize.apply(this, arguments);
- */
- if (arguments && arguments[0] != OpenLayers.Class.isPrototype) {
- this.initialize.apply(this, arguments);
- }
- };
- var extended = {};
- var parent, initialize, Type;
- for(var i=0, len=arguments.length; i<len; ++i) {
- Type = arguments[i];
- if(typeof Type == "function") {
- // make the class passed as the first argument the superclass
- if(i == 0 && len > 1) {
- initialize = Type.prototype.initialize;
- // replace the initialize method with an empty function,
- // because we do not want to create a real instance here
- Type.prototype.initialize = function() {};
- // the line below makes sure that the new class has a
- // superclass
- extended = new Type();
- // restore the original initialize method
- if(initialize === undefined) {
- delete Type.prototype.initialize;
- } else {
- Type.prototype.initialize = initialize;
- }
- }
- // get the prototype of the superclass
- parent = Type.prototype;
- } else {
- // in this case we're extending with the prototype
- parent = Type;
- }
- OpenLayers.Util.extend(extended, parent);
+ var len = arguments.length;
+ var P = arguments[0];
+ var F = arguments[len-1];
+
+ var C = typeof F.initialize == "function" ?
+ F.initialize :
+ function(){ P.apply(this, arguments); };
+
+ if (len > 1) {
+ var newArgs = [C, P].concat(
+ Array.prototype.slice.call(arguments).slice(1, len-1), F);
+ OpenLayers.inherit.apply(null, newArgs);
+ } else {
+ C.prototype = F;
}
- Class.prototype = extended;
- return Class;
+ return C;
};
/**
@@ -90,7 +63,6 @@
};
};
-
/**
* APIFunction: inherit
* *Deprecated*. Old method to inherit from one or more OpenLayers style
@@ -102,15 +74,35 @@
* Returns:
* An object prototype
*/
-OpenLayers.Class.inherit = function () {
- var superClass = arguments[0];
- var proto = new superClass(OpenLayers.Class.isPrototype);
- for (var i=1, len=arguments.length; i<len; i++) {
- if (typeof arguments[i] == "function") {
- var mixin = arguments[i];
- arguments[i] = new mixin(OpenLayers.Class.isPrototype);
- }
- OpenLayers.Util.extend(proto, arguments[i]);
- }
- return proto;
+OpenLayers.Class.inherit = function (P) {
+ var C = function() {
+ P.call(this);
+ };
+ var newArgs = [C].concat(Array.prototype.slice.call(arguments));
+ OpenLayers.inherit.apply(null, newArgs);
+ return C.prototype;
};
+
+/**
+ * Function: OpenLayers.inherit
+ *
+ * Parameters:
+ * C - {Object} the class that inherits
+ * P - {Object} the superclass to inherit from
+ *
+ * In addition to the mandatory C and P parameters, an arbitrary number of
+ * objects can be passed, which will extend C.
+ */
+OpenLayers.inherit = function(C, P) {
+ var F = function() {};
+ F.prototype = P.prototype;
+ C.prototype = new F;
+ var i, l, o;
+ for(i=2, l=arguments.length; i<l; i++) {
+ o = arguments[i];
+ if(typeof o === "function") {
+ o = o.prototype;
+ }
+ OpenLayers.Util.extend(C.prototype, o);
+ }
+};
Modified: sandbox/august/trunk/lib/OpenLayers/BaseTypes.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/BaseTypes.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/BaseTypes.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -593,7 +593,7 @@
if ("toISOString" in Date.prototype) {
return function(date) {
return date.toISOString();
- }
+ };
} else {
function pad(num, len) {
var str = num + "";
@@ -619,7 +619,7 @@
pad(date.getUTCMilliseconds(), 3) + "Z";
}
return str;
- }
+ };
}
})(),
@@ -649,7 +649,6 @@
date = new Date(elapsed);
} else {
var match = str.match(/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{1,2}):(\d{2}):(\d{2}(?:\.\d+)?)(Z|(?:[+-]\d{1,2}(?::(\d{2}))?)))?$/);
- var date;
if (match && (match[1] || match[7])) { // must have at least year or time
var year = parseInt(match[1], 10) || 0;
var month = (parseInt(match[2], 10) - 1) || 0;
@@ -679,4 +678,4 @@
return date;
}
-};
\ No newline at end of file
+};
Modified: sandbox/august/trunk/lib/OpenLayers/Control/GetFeature.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Control/GetFeature.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Control/GetFeature.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -207,7 +207,8 @@
*
* Parameters:
* options - {Object} A configuration object which at least has to contain
- * a <protocol> property
+ * a <protocol> property (if not, it has to be set before a request is
+ * made)
*/
initialize: function(options) {
// concatenate events specific to vector with those from the base
Modified: sandbox/august/trunk/lib/OpenLayers/Control/Measure.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Control/Measure.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Control/Measure.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -33,7 +33,8 @@
* will receive an event with measure, units, order, and geometry
* properties.
* measurepartial - Triggered when a new point is added to the
- * measurement sketch. Listeners receive an event with measure,
+ * measurement sketch or if the <immediate> property is true and the
+ * measurement sketch is modified. Listeners receive an event with measure,
* units, order, and geometry.
*/
EVENT_TYPES: ['measure', 'measurepartial'],
@@ -104,6 +105,14 @@
persist: false,
/**
+ * APIProperty: immediate
+ * {Boolean} Activates the immediate measurement so that the "measurepartial"
+ * event is also fired once the measurement sketch is modified.
+ * Default is false.
+ */
+ immediate : false,
+
+ /**
* Constructor: OpenLayers.Control.Measure
*
* Parameters:
@@ -117,10 +126,12 @@
OpenLayers.Control.prototype.EVENT_TYPES
);
OpenLayers.Control.prototype.initialize.apply(this, [options]);
- this.callbacks = OpenLayers.Util.extend(
- {done: this.measureComplete, point: this.measurePartial},
- this.callbacks
- );
+ var callbacks = {done: this.measureComplete,
+ point: this.measurePartial};
+ if (this.immediate){
+ callbacks.modify = this.measureImmediate;
+ }
+ this.callbacks = OpenLayers.Util.extend(callbacks, this.callbacks);
// let the handler options override, so old code that passes 'persist'
// directly to the handler does not need an update
@@ -147,6 +158,20 @@
this.cancelDelay();
this.handler.cancel();
},
+
+ /**
+ * APIMethod: setImmediate
+ * Sets the <immediate> property. Changes the activity of immediate
+ * measurement.
+ */
+ setImmediate: function(immediate) {
+ this.immediate = immediate;
+ if (this.immediate){
+ this.callbacks.modify = this.measureImmediate;
+ } else {
+ delete this.callbacks.modify;
+ }
+ },
/**
* Method: updateHandler
@@ -206,6 +231,20 @@
},
/**
+ * Method: measureImmediate
+ * Called each time the measurement sketch is modified.
+ *
+ * Parameters: point - {<OpenLayers.Geometry.Point>} The point at the
+ * mouseposition. feature - {<OpenLayers.Feature.Vector>} The sketch feature.
+ */
+ measureImmediate : function(point, feature) {
+ if (this.delayedTrigger === null &&
+ !this.handler.freehandMode(this.handler.evt)) {
+ this.measure(feature.geometry, "measurepartial");
+ }
+ },
+
+ /**
* Method: cancelDelay
* Cancels the delay measurement that measurePartial began.
*/
Modified: sandbox/august/trunk/lib/OpenLayers/Control/ModifyFeature.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Control/ModifyFeature.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Control/ModifyFeature.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -113,6 +113,15 @@
* {Object} A symbolizer to be used for virtual vertices.
*/
virtualStyle: null,
+
+ /**
+ * APIProperty: vertexRenderIntent
+ * {String} The renderIntent to use for vertices. If no <virtualStyle> is
+ * provided, this renderIntent will also be used for virtual vertices, with
+ * a fillOpacity and strokeOpacity of 0.3. Default is null, which means
+ * that the layer's default style will be used for vertices.
+ */
+ vertexRenderIntent: null,
/**
* APIProperty: mode
@@ -193,11 +202,14 @@
* control.
*/
initialize: function(layer, options) {
+ options = options || {};
this.layer = layer;
this.vertices = [];
this.virtualVertices = [];
this.virtualStyle = OpenLayers.Util.extend({},
- this.layer.style || this.layer.styleMap.createSymbolizer());
+ this.layer.style ||
+ this.layer.styleMap.createSymbolizer(null, options.vertexRenderIntent)
+ );
this.virtualStyle.fillOpacity = 0.3;
this.virtualStyle.strokeOpacity = 0.3;
this.deleteCodes = [46, 68];
@@ -622,6 +634,7 @@
if(geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
vertex = new OpenLayers.Feature.Vector(geometry);
vertex._sketch = true;
+ vertex.renderIntent = control.vertexRenderIntent;
control.vertices.push(vertex);
} else {
var numVert = geometry.components.length;
@@ -633,6 +646,7 @@
if(component.CLASS_NAME == "OpenLayers.Geometry.Point") {
vertex = new OpenLayers.Feature.Vector(component);
vertex._sketch = true;
+ vertex.renderIntent = control.vertexRenderIntent;
control.vertices.push(vertex);
} else {
collectComponentVertices(component);
Modified: sandbox/august/trunk/lib/OpenLayers/Control/OverviewMap.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Control/OverviewMap.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Control/OverviewMap.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -157,7 +157,7 @@
this.handlers.drag.destroy();
}
- this.mapDiv.removeChild(this.extentRectangle);
+ this.ovmap && this.ovmap.viewPortDiv.removeChild(this.extentRectangle);
this.extentRectangle = null;
if (this.rectEvents) {
@@ -229,7 +229,6 @@
this.extentRectangle.style.position = 'absolute';
this.extentRectangle.style.zIndex = 1000; //HACK
this.extentRectangle.className = this.displayClass+'ExtentRectangle';
- this.mapDiv.appendChild(this.extentRectangle);
this.element.appendChild(this.mapDiv);
@@ -490,6 +489,7 @@
{controls: [], maxResolution: 'auto',
fallThrough: false}, this.mapOptions);
this.ovmap = new OpenLayers.Map(this.mapDiv, options);
+ this.ovmap.viewPortDiv.appendChild(this.extentRectangle);
// prevent ovmap from being destroyed when the page unloads, because
// the OverviewMap control has to do this (and does it).
Modified: sandbox/august/trunk/lib/OpenLayers/Control/PanZoomBar.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Control/PanZoomBar.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Control/PanZoomBar.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -286,9 +286,7 @@
if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
- var y = evt.xy.y;
- var top = OpenLayers.Util.pagePosition(evt.object)[1];
- var levels = (y - top)/this.zoomStopHeight;
+ var levels = evt.xy.y / this.zoomStopHeight;
if(this.forceFixedZoomLevel || !this.map.fractionalZoom) {
levels = Math.floor(levels);
}
Modified: sandbox/august/trunk/lib/OpenLayers/Control/Panel.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Control/Panel.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Control/Panel.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -95,7 +95,6 @@
* APIMethod: destroy
*/
destroy: function() {
- this.deactivate();
OpenLayers.Control.prototype.destroy.apply(this, arguments);
for(var i = this.controls.length - 1 ; i >= 0; i--) {
if(this.controls[i].events) {
Modified: sandbox/august/trunk/lib/OpenLayers/Control/SLDSelect.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Control/SLDSelect.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Control/SLDSelect.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -5,7 +5,7 @@
/**
* @requires OpenLayers/Control.js
- * @requires OpenLayers/Layer/WMS/Post.js
+ * @requires OpenLayers/Layer/WMS.js
* @requires OpenLayers/Handler/RegularPolygon.js
* @requires OpenLayers/Handler/Polygon.js
* @requires OpenLayers/Handler/Path.js
@@ -119,7 +119,7 @@
* APIProperty: layerCache
* {Object} Cache to use for storing references to the selection layers.
* Normally each source layer will have exactly 1 selection layer of
- * type OpenLayers.Layer.WMS.Post. If not provided, layers will
+ * type OpenLayers.Layer.WMS. If not provided, layers will
* be cached on the prototype. Note that if <clearOnDeactivate> is
* true, the layer will no longer be cached after deactivating the
* control.
@@ -158,7 +158,8 @@
click: this.select}, this.callbacks);
this.handlerOptions = this.handlerOptions || {};
this.layerOptions = OpenLayers.Util.applyDefaults(this.layerOptions, {
- displayInLayerSwitcher: false
+ displayInLayerSwitcher: false,
+ tileOptions: {maxGetUrlLength: 2048}
});
if (this.sketchStyle) {
this.handlerOptions.layerOptions = OpenLayers.Util.applyDefaults(
@@ -207,14 +208,14 @@
* is performed.
*
* Returns:
- * {<OpenLayers.Layer.WMS.Post>} A WMS Post layer since SLD selections can
- * easily get quite long.
+ * {<OpenLayers.Layer.WMS>} A WMS layer with maxGetUrlLength configured to 2048
+ * since SLD selections can easily get quite long.
*/
createSelectionLayer: function(source) {
// check if we already have a selection layer for the source layer
var selectionLayer;
if (!this.layerCache[source.id]) {
- selectionLayer = new OpenLayers.Layer.WMS.Post(source.name,
+ selectionLayer = new OpenLayers.Layer.WMS(source.name,
source.url, source.params,
OpenLayers.Util.applyDefaults(
this.layerOptions,
@@ -567,4 +568,4 @@
},
CLASS_NAME: "OpenLayers.Control.SLDSelect"
-});
\ No newline at end of file
+});
Modified: sandbox/august/trunk/lib/OpenLayers/Control/WMTSGetFeatureInfo.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Control/WMTSGetFeatureInfo.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Control/WMTSGetFeatureInfo.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -213,35 +213,6 @@
},
/**
- * Method: activate
- * Activates the control.
- *
- * Returns:
- * {Boolean} The control was effectively activated.
- */
- activate: function () {
- if (!this.active) {
- this.handler.activate();
- }
- return OpenLayers.Control.prototype.activate.apply(
- this, arguments
- );
- },
-
- /**
- * Method: deactivate
- * Deactivates the control.
- *
- * Returns:
- * {Boolean} The control was effectively deactivated.
- */
- deactivate: function () {
- return OpenLayers.Control.prototype.deactivate.apply(
- this, arguments
- );
- },
-
- /**
* Method: getInfoForClick
* Called on click
*
@@ -425,18 +396,6 @@
}
}
},
-
- /**
- * Method: setMap
- * Set the map property for the control.
- *
- * Parameters:
- * map - {<OpenLayers.Map>}
- */
- setMap: function(map) {
- this.handler.setMap(map);
- OpenLayers.Control.prototype.setMap.apply(this, arguments);
- },
CLASS_NAME: "OpenLayers.Control.WMTSGetFeatureInfo"
});
Modified: sandbox/august/trunk/lib/OpenLayers/Events.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Events.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Events.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -449,8 +449,8 @@
* Construct an OpenLayers.Events object.
*
* Parameters:
- * object - {Object} The js object to which this Events object is being
- * added element - {DOMElement} A dom element to respond to browser events
+ * object - {Object} The js object to which this Events object is being added
+ * element - {DOMElement} A dom element to respond to browser events
* eventTypes - {Array(String)} Array of custom application events
* fallThrough - {Boolean} Allow events to fall through after these have
* been handled?
@@ -786,10 +786,15 @@
* evt - {Event}
*/
handleBrowserEvent: function (evt) {
+ var type = evt.type, listeners = this.listeners[type];
+ if(!listeners || listeners.length == 0) {
+ // noone's listening, bail out
+ return;
+ }
if (this.includeXY) {
evt.xy = this.getMousePosition(evt);
}
- this.triggerEvent(evt.type, evt);
+ this.triggerEvent(type, evt);
},
/**
@@ -823,11 +828,10 @@
}
if (!this.element.scrolls) {
+ var viewportElement = OpenLayers.Util.getViewportElement();
this.element.scrolls = [
- (document.documentElement.scrollLeft
- || document.body.scrollLeft),
- (document.documentElement.scrollTop
- || document.body.scrollTop)
+ viewportElement.scrollLeft,
+ viewportElement.scrollTop
];
}
@@ -840,8 +844,6 @@
if (!this.element.offsets) {
this.element.offsets = OpenLayers.Util.pagePosition(this.element);
- this.element.offsets[0] += this.element.scrolls[0];
- this.element.offsets[1] += this.element.scrolls[1];
}
return new OpenLayers.Pixel(
(evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
Modified: sandbox/august/trunk/lib/OpenLayers/Format/OWSCommon/v1.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Format/OWSCommon/v1.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Format/OWSCommon/v1.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -247,6 +247,28 @@
var node = this.createElementNSPlus("ows:OutputFormat", {
value: format });
return node;
+ },
+ "Identifier": function(identifier) {
+ var node = this.createElementNSPlus("ows:Identifier",
+ {
+ attributes: {
+ // TODO: attribute codeSpace
+ },
+ value: identifier
+ }
+ );
+ return node;
+ },
+ "Version": function(version) {
+ var node = this.createElementNSPlus("ows:Version",
+ {
+ attributes: {
+ // TODO: attribute codeSpace
+ },
+ value: version
+ }
+ );
+ return node;
}
}
},
Modified: sandbox/august/trunk/lib/OpenLayers/Format/SLD/v1.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Format/SLD/v1.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Format/SLD/v1.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -155,7 +155,7 @@
},
"NamedStyle": function(node, layer) {
layer.namedStyles.push(
- this.getChildName(node.firstChild)
+ this.getChildValue(node.firstChild)
);
},
"UserStyle": function(node, layer) {
Modified: sandbox/august/trunk/lib/OpenLayers/Format/SOSGetObservation.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Format/SOSGetObservation.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Format/SOSGetObservation.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -2,261 +2,304 @@
* 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
- * @requires OpenLayers/Format/GML.js
- * @requires OpenLayers/Format/GML/v3.js
- */
-
-/**
- * Class: OpenLayers.Format.SOSGetObservation
- * Read and write SOS GetObersation (to get the actual values from a sensor)
- * version 1.0.0
- *
- * Inherits from:
- * - <OpenLayers.Format.XML>
- */
-OpenLayers.Format.SOSGetObservation = OpenLayers.Class(OpenLayers.Format.XML, {
-
- /**
- * Property: namespaces
- * {Object} Mapping of namespace aliases to namespace URIs.
- */
- namespaces: {
- ows: "http://www.opengis.net/ows",
- gml: "http://www.opengis.net/gml",
- sos: "http://www.opengis.net/sos/1.0",
- ogc: "http://www.opengis.net/ogc",
- om: "http://www.opengis.net/om/1.0",
- xlink: "http://www.w3.org/1999/xlink",
- 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)
- },
-
- /**
- * Constant: VERSION
- * {String} 1.0.0
- */
- VERSION: "1.0.0",
-
- /**
- * Property: schemaLocation
- * {String} Schema location
- */
- schemaLocation: "http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosGetObservation.xsd",
-
- /**
- * Property: defaultPrefix
- */
- defaultPrefix: "sos",
-
- /**
- * Constructor: OpenLayers.Format.SOSGetObservation
- *
- * 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 - {String} or {DOMElement} data to read/parse.
- *
- * Returns:
- * {Object} An object containing the measurements
- */
- read: function(data) {
- if(typeof data == "string") {
- data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
- }
- if(data && data.nodeType == 9) {
- data = data.documentElement;
- }
- var info = {measurements: []};
- this.readNode(data, info);
- return info;
- },
-
- /**
- * Method: write
- *
- * Parameters:
- * options - {Object} Optional object.
- *
- * Returns:
- * {String} An SOS GetObservation request XML string.
- */
- write: function(options) {
- var node = this.writeNode("sos:GetObservation", options);
+
+/**
+ * @requires OpenLayers/Format/XML.js
+ * @requires OpenLayers/Format/SOSGetFeatureOfInterest.js
+ */
+
+/**
+ * Class: OpenLayers.Format.SOSGetObservation
+ * Read and write SOS GetObersation (to get the actual values from a sensor)
+ * version 1.0.0
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.SOSGetObservation = OpenLayers.Class(OpenLayers.Format.XML, {
+
+ /**
+ * Property: namespaces
+ * {Object} Mapping of namespace aliases to namespace URIs.
+ */
+ namespaces: {
+ ows: "http://www.opengis.net/ows",
+ gml: "http://www.opengis.net/gml",
+ sos: "http://www.opengis.net/sos/1.0",
+ ogc: "http://www.opengis.net/ogc",
+ om: "http://www.opengis.net/om/1.0",
+ sa: "http://www.opengis.net/sampling/1.0",
+ xlink: "http://www.w3.org/1999/xlink",
+ 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)
+ },
+
+ /**
+ * Constant: VERSION
+ * {String} 1.0.0
+ */
+ VERSION: "1.0.0",
+
+ /**
+ * Property: schemaLocation
+ * {String} Schema location
+ */
+ schemaLocation: "http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosGetObservation.xsd",
+
+ /**
+ * Property: defaultPrefix
+ */
+ defaultPrefix: "sos",
+
+ /**
+ * Constructor: OpenLayers.Format.SOSGetObservation
+ *
+ * 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 - {String} or {DOMElement} data to read/parse.
+ *
+ * Returns:
+ * {Object} An object containing the measurements
+ */
+ read: function(data) {
+ if(typeof data == "string") {
+ data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
+ }
+ if(data && data.nodeType == 9) {
+ data = data.documentElement;
+ }
+ var info = {measurements: [], observations: []};
+ this.readNode(data, info);
+ return info;
+ },
+
+ /**
+ * Method: write
+ *
+ * Parameters:
+ * options - {Object} Optional object.
+ *
+ * Returns:
+ * {String} An SOS GetObservation request XML string.
+ */
+ write: function(options) {
+ var node = this.writeNode("sos:GetObservation", options);
node.setAttribute("xmlns:om", this.namespaces.om);
- this.setAttributeNS(
- node, this.namespaces.xsi,
- "xsi:schemaLocation", this.schemaLocation
- );
- return OpenLayers.Format.XML.prototype.write.apply(this, [node]);
- },
-
- /**
- * 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: {
- "om": {
- "ObservationCollection": function(node, obj) {
- obj.id = this.getAttributeNS(node, this.namespaces.gml, "id");
- this.readChildNodes(node, obj);
- },
- "member": function(node, observationCollection) {
- this.readChildNodes(node, observationCollection);
- },
- "Measurement": function(node, observationCollection) {
- var measurement = {};
- observationCollection.measurements.push(measurement);
- this.readChildNodes(node, measurement);
- },
- "samplingTime": function(node, measurement) {
- var samplingTime = {};
- measurement.samplingTime = samplingTime;
- this.readChildNodes(node, samplingTime);
- },
- "observedProperty": function(node, measurement) {
- measurement.observedProperty =
- this.getAttributeNS(node, this.namespaces.xlink, "href");
- this.readChildNodes(node, measurement);
- },
- "procedure": function(node, measurement) {
- measurement.procedure =
- this.getAttributeNS(node, this.namespaces.xlink, "href");
- this.readChildNodes(node, measurement);
- },
- "result": function(node, measurement) {
- var result = {};
- measurement.result = result;
- if (this.getChildValue(node) !== '') {
- result.value = this.getChildValue(node);
- result.uom = node.getAttribute("uom");
- } else {
- this.readChildNodes(node, result);
- }
- }
- },
- "gml": OpenLayers.Util.applyDefaults({
- "TimeInstant": function(node, samplingTime) {
- var timeInstant = {};
- samplingTime.timeInstant = timeInstant;
- this.readChildNodes(node, timeInstant);
- },
- "timePosition": function(node, timeInstant) {
- timeInstant.timePosition = this.getChildValue(node);
- }
- }, OpenLayers.Format.GML.v3.prototype.readers.gml)
- },
-
- /**
- * 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: {
- "sos": {
- "GetObservation": function(options) {
- var node = this.createElementNSPlus("GetObservation", {
- attributes: {
- version: this.VERSION,
- service: 'SOS'
- }
- });
- this.writeNode("offering", options, node);
- this.writeNode("eventTime", options, node);
- this.writeNode("procedure", options, node);
- this.writeNode("observedProperty", options, node);
- this.writeNode("responseFormat", options, node);
- this.writeNode("resultModel", options, node);
- this.writeNode("responseMode", options, node);
- return node;
- },
- "responseFormat": function(options) {
- return this.createElementNSPlus("responseFormat",
- {value: options.responseFormat});
- },
- "procedure": function(options) {
- return this.createElementNSPlus("procedure",
- {value: options.procedure});
- },
- "offering": function(options) {
- return this.createElementNSPlus("offering", {value:
- options.offering});
- },
- "observedProperty": function(options) {
- return this.createElementNSPlus("observedProperty",
- {value: options.observedProperty});
- },
- "eventTime": function(options) {
- var node = this.createElementNSPlus("eventTime");
- if (options.eventTime === 'latest') {
- this.writeNode("ogc:TM_Equals", options, node);
- }
- return node;
- },
- "resultModel": function(options) {
- return this.createElementNSPlus("resultModel", {value:
- options.resultModel});
- },
- "responseMode": function(options) {
- return this.createElementNSPlus("responseMode", {value:
- options.responseMode});
- }
- },
- "ogc": {
- "TM_Equals": function(options) {
- var node = this.createElementNSPlus("ogc:TM_Equals");
- this.writeNode("ogc:PropertyName", {property:
- "urn:ogc:data:time:iso8601"}, node);
- if (options.eventTime === 'latest') {
- this.writeNode("gml:TimeInstant", {value: 'latest'}, node);
- }
- return node;
- },
- "PropertyName": function(options) {
- return this.createElementNSPlus("ogc:PropertyName",
- {value: options.property});
- }
- },
- "gml": {
- "TimeInstant": function(options) {
- var node = this.createElementNSPlus("gml:TimeInstant");
- this.writeNode("gml:timePosition", options, node);
- return node;
- },
- "timePosition": function(options) {
- var node = this.createElementNSPlus("gml:timePosition",
- {value: options.value});
- return node;
- }
- }
- },
-
- CLASS_NAME: "OpenLayers.Format.SOSGetObservation"
-
-});
+ node.setAttribute("xmlns:ogc", this.namespaces.ogc);
+ this.setAttributeNS(
+ node, this.namespaces.xsi,
+ "xsi:schemaLocation", this.schemaLocation
+ );
+ return OpenLayers.Format.XML.prototype.write.apply(this, [node]);
+ },
+
+ /**
+ * 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: {
+ "om": {
+ "ObservationCollection": function(node, obj) {
+ obj.id = this.getAttributeNS(node, this.namespaces.gml, "id");
+ this.readChildNodes(node, obj);
+ },
+ "member": function(node, observationCollection) {
+ this.readChildNodes(node, observationCollection);
+ },
+ "Measurement": function(node, observationCollection) {
+ var measurement = {};
+ observationCollection.measurements.push(measurement);
+ this.readChildNodes(node, measurement);
+ },
+ "Observation": function(node, observationCollection) {
+ var observation = {};
+ observationCollection.observations.push(observation);
+ this.readChildNodes(node, observation);
+ },
+ "samplingTime": function(node, measurement) {
+ var samplingTime = {};
+ measurement.samplingTime = samplingTime;
+ this.readChildNodes(node, samplingTime);
+ },
+ "observedProperty": function(node, measurement) {
+ measurement.observedProperty =
+ this.getAttributeNS(node, this.namespaces.xlink, "href");
+ this.readChildNodes(node, measurement);
+ },
+ "procedure": function(node, measurement) {
+ measurement.procedure =
+ this.getAttributeNS(node, this.namespaces.xlink, "href");
+ this.readChildNodes(node, measurement);
+ },
+ "featureOfInterest": function(node, observation) {
+ var foi = {features: []};
+ observation.fois = [];
+ observation.fois.push(foi);
+ this.readChildNodes(node, foi);
+ // postprocessing to get actual features
+ var features = [];
+ for (var i=0, len=foi.features.length; i<len; i++) {
+ var feature = foi.features[i];
+ features.push(new OpenLayers.Feature.Vector(
+ feature.components[0], feature.attributes));
+ }
+ foi.features = features;
+ },
+ "result": function(node, measurement) {
+ var result = {};
+ measurement.result = result;
+ if (this.getChildValue(node) !== '') {
+ result.value = this.getChildValue(node);
+ result.uom = node.getAttribute("uom");
+ } else {
+ this.readChildNodes(node, result);
+ }
+ }
+ },
+ "sa": OpenLayers.Format.SOSGetFeatureOfInterest.prototype.readers.sa,
+ "gml": OpenLayers.Util.applyDefaults({
+ "TimeInstant": function(node, samplingTime) {
+ var timeInstant = {};
+ samplingTime.timeInstant = timeInstant;
+ this.readChildNodes(node, timeInstant);
+ },
+ "timePosition": function(node, timeInstant) {
+ timeInstant.timePosition = this.getChildValue(node);
+ }
+ }, OpenLayers.Format.SOSGetFeatureOfInterest.prototype.readers.gml)
+ },
+
+ /**
+ * 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: {
+ "sos": {
+ "GetObservation": function(options) {
+ var node = this.createElementNSPlus("GetObservation", {
+ attributes: {
+ version: this.VERSION,
+ service: 'SOS'
+ }
+ });
+ this.writeNode("offering", options, node);
+ if (options.eventTime) {
+ this.writeNode("eventTime", options, node);
+ }
+ for (var procedure in options.procedures) {
+ this.writeNode("procedure", options.procedures[procedure], node);
+ }
+ for (var observedProperty in options.observedProperties) {
+ this.writeNode("observedProperty", options.observedProperties[observedProperty], node);
+ }
+ if (options.foi) {
+ this.writeNode("featureOfInterest", options.foi, node);
+ }
+ this.writeNode("responseFormat", options, node);
+ if (options.resultModel) {
+ this.writeNode("resultModel", options, node);
+ }
+ if (options.responseMode) {
+ this.writeNode("responseMode", options, node);
+ }
+ return node;
+ },
+ "featureOfInterest": function(foi) {
+ var node = this.createElementNSPlus("featureOfInterest");
+ this.writeNode("ObjectID", foi.objectId, node);
+ return node;
+ },
+ "ObjectID": function(options) {
+ return this.createElementNSPlus("ObjectID",
+ {value: options});
+ },
+ "responseFormat": function(options) {
+ return this.createElementNSPlus("responseFormat",
+ {value: options.responseFormat});
+ },
+ "procedure": function(procedure) {
+ return this.createElementNSPlus("procedure",
+ {value: procedure});
+ },
+ "offering": function(options) {
+ return this.createElementNSPlus("offering", {value:
+ options.offering});
+ },
+ "observedProperty": function(observedProperty) {
+ return this.createElementNSPlus("observedProperty",
+ {value: observedProperty});
+ },
+ "eventTime": function(options) {
+ var node = this.createElementNSPlus("eventTime");
+ if (options.eventTime === 'latest') {
+ this.writeNode("ogc:TM_Equals", options, node);
+ }
+ return node;
+ },
+ "resultModel": function(options) {
+ return this.createElementNSPlus("resultModel", {value:
+ options.resultModel});
+ },
+ "responseMode": function(options) {
+ return this.createElementNSPlus("responseMode", {value:
+ options.responseMode});
+ }
+ },
+ "ogc": {
+ "TM_Equals": function(options) {
+ var node = this.createElementNSPlus("ogc:TM_Equals");
+ this.writeNode("ogc:PropertyName", {property:
+ "urn:ogc:data:time:iso8601"}, node);
+ if (options.eventTime === 'latest') {
+ this.writeNode("gml:TimeInstant", {value: 'latest'}, node);
+ }
+ return node;
+ },
+ "PropertyName": function(options) {
+ return this.createElementNSPlus("ogc:PropertyName",
+ {value: options.property});
+ }
+ },
+ "gml": {
+ "TimeInstant": function(options) {
+ var node = this.createElementNSPlus("gml:TimeInstant");
+ this.writeNode("gml:timePosition", options, node);
+ return node;
+ },
+ "timePosition": function(options) {
+ var node = this.createElementNSPlus("gml:timePosition",
+ {value: options.value});
+ return node;
+ }
+ }
+ },
+
+ CLASS_NAME: "OpenLayers.Format.SOSGetObservation"
+
+});
Modified: sandbox/august/trunk/lib/OpenLayers/Handler/Box.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Handler/Box.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Handler/Box.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -206,7 +206,7 @@
"border-top-width")) + parseInt(OpenLayers.Element.getStyle(
this.zoomBox, "border-bottom-width")) + 1;
// all browsers use the new box model, except IE in quirks mode
- var newBoxModel = OpenLayers.Util.getBrowserName() == "msie" ?
+ var newBoxModel = OpenLayers.BROWSER_NAME == "msie" ?
document.compatMode != "BackCompat" : true;
this.boxCharacteristics = {
xOffset: xOffset,
Modified: sandbox/august/trunk/lib/OpenLayers/Handler/Drag.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Handler/Drag.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Handler/Drag.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -397,7 +397,7 @@
* evt - {Object}
*/
adjustXY: function(evt) {
- var pos = OpenLayers.Util.pagePosition(this.map.div);
+ var pos = OpenLayers.Util.pagePosition(this.map.viewPortDiv);
evt.xy.x -= pos[0];
evt.xy.y -= pos[1];
},
Modified: sandbox/august/trunk/lib/OpenLayers/Handler/Path.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Handler/Path.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Handler/Path.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -276,11 +276,21 @@
}
return true;
},
+
+ /**
+ * APIMethod: finishGeometry
+ * Finish the geometry and send it back to the control.
+ */
+ finishGeometry: function() {
+ var index = this.line.geometry.components.length - 1;
+ this.line.geometry.removeComponent(this.line.geometry.components[index]);
+ this.removePoint();
+ this.finalize();
+ },
/**
* Method: dblclick
- * Handle double-clicks. Finish the geometry and send it back
- * to the control.
+ * Handle double-clicks.
*
* Parameters:
* evt - {Event} The browser event
@@ -290,10 +300,7 @@
*/
dblclick: function(evt) {
if(!this.freehandMode(evt)) {
- var index = this.line.geometry.components.length - 1;
- this.line.geometry.removeComponent(this.line.geometry.components[index]);
- this.removePoint();
- this.finalize();
+ this.finishGeometry();
}
return false;
},
Modified: sandbox/august/trunk/lib/OpenLayers/Handler/Polygon.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Handler/Polygon.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Handler/Polygon.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -20,7 +20,21 @@
*/
OpenLayers.Handler.Polygon = OpenLayers.Class(OpenLayers.Handler.Path, {
+ /**
+ * APIProperty: holeModifier
+ * {String} Key modifier to trigger hole digitizing. Acceptable values are
+ * "altKey", "shiftKey", or "ctrlKey". If not set, no hole digitizing
+ * will take place. Default is null.
+ */
+ holeModifier: null,
+
/**
+ * Property: drawingHole
+ * {Boolean} Currently drawing an interior ring.
+ */
+ drawingHole: false,
+
+ /**
* Parameter: polygon
* {<OpenLayers.Feature.Vector>}
*/
@@ -68,15 +82,152 @@
this.line = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LinearRing([this.point.geometry])
);
- this.polygon = new OpenLayers.Feature.Vector(
- new OpenLayers.Geometry.Polygon([this.line.geometry])
- );
+
+ // check for hole digitizing
+ var polygon;
+ if (this.holeModifier && (this.evt[this.holeModifier])) {
+ var geometry = this.point.geometry;
+ var features = this.control.layer.features;
+ var candidate;
+ // look for intersections, last drawn gets priority
+ for (var i=features.length-1; i>=0; --i) {
+ candidate = features[i].geometry;
+ if ((candidate instanceof OpenLayers.Geometry.Polygon ||
+ candidate instanceof OpenLayers.Geometry.MultiPolygon) &&
+ candidate.intersects(geometry)) {
+ polygon = features[i];
+ this.control.layer.removeFeatures([polygon], {silent: true});
+ this.control.layer.events.registerPriority(
+ "sketchcomplete", this, this.finalizeInteriorRing
+ );
+ this.control.layer.events.registerPriority(
+ "sketchmodified", this, this.enforceTopology
+ );
+ polygon.geometry.addComponent(this.line.geometry);
+ this.polygon = polygon;
+ this.drawingHole = true;
+ break;
+ }
+ }
+ }
+ if (!polygon) {
+ this.polygon = new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Polygon([this.line.geometry])
+ );
+ }
+
this.callback("create", [this.point.geometry, this.getSketch()]);
this.point.geometry.clearBounds();
this.layer.addFeatures([this.polygon, this.point], {silent: true});
},
+
+ /**
+ * Method: enforceTopology
+ * Simple topology enforcement for drawing interior rings. Ensures vertices
+ * of interior rings are contained by exterior ring. Other topology
+ * rules are enforced in <finalizeInteriorRing> to allow drawing of
+ * rings that intersect only during the sketch (e.g. a "C" shaped ring
+ * that nearly encloses another ring).
+ */
+ enforceTopology: function(event) {
+ var point = event.vertex;
+ var components = this.line.geometry.components;
+ // ensure that vertices of interior ring are contained by exterior ring
+ if (!this.polygon.geometry.intersects(point)) {
+ var last = components[components.length-3];
+ point.x = last.x;
+ point.y = last.y;
+ }
+ },
+
+ /**
+ * Method: finalizeInteriorRing
+ * Enforces that new ring has some area and doesn't contain vertices of any
+ * other rings.
+ */
+ finalizeInteriorRing: function() {
+ var ring = this.line.geometry;
+ // ensure that ring has some area
+ var modified = (ring.getArea() !== 0);
+ if (modified) {
+ // ensure that new ring doesn't intersect any other rings
+ var rings = this.polygon.geometry.components;
+ for (var i=rings.length-2; i>=0; --i) {
+ if (ring.intersects(rings[i])) {
+ modified = false;
+ break;
+ }
+ }
+ if (modified) {
+ // ensure that new ring doesn't contain any other rings
+ var target;
+ outer: for (var i=rings.length-2; i>0; --i) {
+ points = rings[i].components;
+ for (var j=0, jj=points.length; j<jj; ++j) {
+ if (ring.containsPoint(points[j])) {
+ modified = false;
+ break outer;
+ }
+ }
+ }
+ }
+ }
+ if (modified) {
+ if (this.polygon.state !== OpenLayers.State.INSERT) {
+ this.polygon.state = OpenLayers.State.UPDATE;
+ }
+ } else {
+ this.polygon.geometry.removeComponent(ring);
+ }
+ this.restoreFeature();
+ return false;
+ },
/**
+ * APIMethod: cancel
+ * Finish the geometry and call the "cancel" callback.
+ */
+ cancel: function() {
+ if (this.drawingHole) {
+ this.polygon.geometry.removeComponent(this.line.geometry);
+ this.restoreFeature(true);
+ }
+ return OpenLayers.Handler.Path.prototype.cancel.apply(this, arguments);
+ },
+
+ /**
+ * Method: restoreFeature
+ * Move the feature from the sketch layer to the target layer.
+ *
+ * Properties:
+ * cancel - {Boolean} Cancel drawing. If falsey, the "sketchcomplete" event
+ * will be fired.
+ */
+ restoreFeature: function(cancel) {
+ this.control.layer.events.unregister(
+ "sketchcomplete", this, this.finalizeInteriorRing
+ );
+ this.control.layer.events.unregister(
+ "sketchmodified", this, this.enforceTopology
+ );
+ this.layer.removeFeatures([this.polygon], {silent: true});
+ this.control.layer.addFeatures([this.polygon], {silent: true});
+ this.drawingHole = false;
+ if (!cancel) {
+ // Re-trigger "sketchcomplete" so other listeners can do their
+ // business. While this is somewhat sloppy (if a listener is
+ // registered with registerPriority - not common - between the start
+ // and end of a single ring drawing - very uncommon - it will be
+ // called twice).
+ // TODO: In 3.0, collapse sketch handlers into geometry specific
+ // drawing controls.
+ this.control.layer.events.triggerEvent(
+ "sketchcomplete", {feature : this.polygon}
+ );
+ }
+ },
+
+ /**
* Method: destroyFeature
* Destroy temporary geometries
*/
Modified: sandbox/august/trunk/lib/OpenLayers/Lang.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Lang.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Lang.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -58,7 +58,7 @@
setCode: function(code) {
var lang;
if(!code) {
- code = (OpenLayers.Util.getBrowserName() == "msie") ?
+ code = (OpenLayers.BROWSER_NAME == "msie") ?
navigator.userLanguage : navigator.language;
}
var parts = code.split('-');
Modified: sandbox/august/trunk/lib/OpenLayers/Layer/AgsTiled.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Layer/AgsTiled.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Layer/AgsTiled.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -106,7 +106,7 @@
*/
getURL: function (bounds) {
bounds = this.adjustBounds(bounds);
-
+ //OpenLayers.Console.debug(bounds.toString());
var res = this.map.getResolution();
var path = null;
@@ -161,6 +161,7 @@
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
*/
addTile:function(bounds,position) {
+ //OpenLayers.Console.debug(position.toString());
return new OpenLayers.Tile.Image(this, position, bounds,
null, this.tileSize);
},
Modified: sandbox/august/trunk/lib/OpenLayers/Layer/EventPane.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Layer/EventPane.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Layer/EventPane.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -102,7 +102,7 @@
this.pane.style.display = this.div.style.display;
this.pane.style.width="100%";
this.pane.style.height="100%";
- if (OpenLayers.Util.getBrowserName() == "msie") {
+ if (OpenLayers.BROWSER_NAME == "msie") {
this.pane.style.background =
"url(" + OpenLayers.Util.getImagesLocation() + "blank.gif)";
}
Modified: sandbox/august/trunk/lib/OpenLayers/Layer/Google/v3.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Layer/Google/v3.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Layer/Google/v3.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -90,7 +90,8 @@
keyboardShortcuts: false,
draggable: false,
disableDoubleClickZoom: true,
- scrollwheel: false
+ scrollwheel: false,
+ streetViewControl: false
});
// cache elements for use by any other google layers added to
Modified: sandbox/august/trunk/lib/OpenLayers/Layer/SphericalMercator.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Layer/SphericalMercator.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Layer/SphericalMercator.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -186,11 +186,32 @@
};
/**
- * Note: Two transforms declared
- * Transforms from EPSG:4326 to EPSG:900913 and from EPSG:900913 to EPSG:4326
- * are set by this class.
+ * Note: Transforms for web mercator <-> EPSG:4326
+ * OpenLayers recognizes EPSG:3857, EPSG:900913, EPSG:102113 and EPSG:102100.
+ * OpenLayers originally started referring to EPSG:900913 as web mercator.
+ * The EPSG has declared EPSG:3857 to be web mercator.
+ * ArcGIS 10 recognizes the EPSG:3857, EPSG:102113, and EPSG:102100 as
+ * equivalent. See http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/11/20/ArcGIS-Online-moving-to-Google-_2F00_-Bing-tiling-scheme_3A00_-What-does-this-mean-for-you_3F00_.aspx#12084
*/
-OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:900913",
- OpenLayers.Layer.SphericalMercator.projectForward);
-OpenLayers.Projection.addTransform("EPSG:900913", "EPSG:4326",
- OpenLayers.Layer.SphericalMercator.projectInverse);
+(function() {
+
+ // list of equivalent codes for web mercator
+ var codes = ["EPSG:900913", "EPSG:3857", "EPSG:102113", "EPSG:102100"];
+
+ var add = OpenLayers.Projection.addTransform;
+ var merc = OpenLayers.Layer.SphericalMercator;
+ var same = OpenLayers.Projection.nullTransform;
+
+ var i, len, code, other, j;
+ for (i=0, len=codes.length; i<len; ++i) {
+ code = codes[i];
+ add("EPSG:4326", code, merc.projectForward);
+ add(code, "EPSG:4326", merc.projectInverse);
+ for (j=i+1; j<len; ++j) {
+ other = codes[j];
+ add(code, other, same);
+ add(other, code, same);
+ }
+ }
+
+})();
Modified: sandbox/august/trunk/lib/OpenLayers/Layer/TileCache.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Layer/TileCache.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Layer/TileCache.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -6,6 +6,7 @@
/**
* @requires OpenLayers/Layer/Grid.js
+ * @requires OpenLayers/Tile/Image.js
*/
/**
Modified: sandbox/august/trunk/lib/OpenLayers/Layer/Vector.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Layer/Vector.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Layer/Vector.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -64,6 +64,10 @@
* featuresremoved - Triggered after features are removed. The event
* object passed to listeners will have a *features* property with a
* reference to an array of removed features.
+ * beforefeatureselected - Triggered after a feature is selected. Listeners
+ * will receive an object with a *feature* property referencing the
+ * feature to be selected. To stop the feature from being selectd, a
+ * listener should return false.
* featureselected - Triggered after a feature is selected. Listeners
* will receive an object with a *feature* property referencing the
* selected feature.
@@ -123,12 +127,6 @@
isFixed: false,
/**
- * APIProperty: isVector
- * {Boolean} Whether the layer is a vector layer.
- */
- isVector: true,
-
- /**
* APIProperty: features
* {Array(<OpenLayers.Feature.Vector>)}
*/
@@ -482,7 +480,7 @@
// Force a reflow on gecko based browsers to prevent jump/flicker.
// This seems to happen on only certain configurations; it was originally
// noticed in FF 2.0 and Linux.
- if (navigator.userAgent.toLowerCase().indexOf("gecko") != -1) {
+ if (OpenLayers.IS_GECKO === true) {
this.div.scrollLeft = this.div.scrollLeft;
}
Modified: sandbox/august/trunk/lib/OpenLayers/Layer/WMS/Post.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Layer/WMS/Post.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Layer/WMS/Post.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -33,7 +33,7 @@
* effects of viewport-shaking when panning the map. Both browsers, Opera
* and Firefox/Mozilla, have no problem with long urls, which is the reason
* for using POST instead of GET. The strings to pass to this array are
- * the ones returned by <OpenLayers.Util.getBrowserName()>.
+ * the ones returned by <OpenLayers.BROWSER_NAME>.
*/
unsupportedBrowsers: ["mozilla", "firefox", "opera"],
@@ -77,7 +77,7 @@
OpenLayers.Layer.WMS.prototype.initialize.apply(this, newArguments);
this.usePost = OpenLayers.Util.indexOf(
- this.unsupportedBrowsers, OpenLayers.Util.getBrowserName()) == -1;
+ this.unsupportedBrowsers, OpenLayers.BROWSER_NAME) == -1;
},
/**
Modified: sandbox/august/trunk/lib/OpenLayers/Layer/WMS.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Layer/WMS.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Layer/WMS.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -188,7 +188,7 @@
*/
getURL: function (bounds) {
bounds = this.adjustBounds(bounds);
-
+ //OpenLayers.Console.debug(bounds.toString());
var imageSize = this.getImageSize();
var newParams = {};
// WMS 1.3 introduced axis order
@@ -214,6 +214,7 @@
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
*/
addTile:function(bounds,position) {
+ //OpenLayers.Console.debug(position.toString());
return new OpenLayers.Tile.Image(this, position, bounds,
null, this.tileSize, this.tileOptions);
},
@@ -252,7 +253,10 @@
* {String}
*/
getFullRequestString:function(newParams, altUrl) {
- var projectionCode = this.map.getProjection();
+ var mapProjection = this.map.getProjectionObject();
+ var projectionCode = this.projection.equals(mapProjection) ?
+ this.projection.getCode() :
+ mapProjection.getCode();
var value = (projectionCode == "none") ? null : projectionCode
if (parseFloat(this.params.VERSION) >= 1.3) {
this.params.CRS = this.params.CRS || value;
Modified: sandbox/august/trunk/lib/OpenLayers/Layer/XYZ.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Layer/XYZ.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Layer/XYZ.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -40,11 +40,20 @@
* for a requested tile. For example, if you supply a zoomOffset
* of 3, when the map is at the zoom 0, tiles will be requested from
* level 3 of your cache. Default is 0 (assumes cache level and map
- * zoom are equivalent).
+ * zoom are equivalent). Using <zoomOffset> is an alternative to
+ * setting <serverResolutions> if you only want to expose a subset
+ * of the server resolutions.
*/
zoomOffset: 0,
/**
+ * APIProperty: serverResolutions
+ * {Array} A list of all resolutions available on the server. Only set this
+ * property if the map resolutions differs from the server.
+ */
+ serverResolutions: null,
+
+ /**
* Constructor: OpenLayers.Layer.XYZ
*
* Parameters:
@@ -114,7 +123,9 @@
/ (res * this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top)
/ (res * this.tileSize.h));
- var z = this.map.getZoom() + this.zoomOffset;
+ var z = this.serverResolutions != null ?
+ OpenLayers.Util.indexOf(this.serverResolutions, res) :
+ this.map.getZoom() + this.zoomOffset;
var url = this.url;
var s = '' + x + y + z;
Modified: sandbox/august/trunk/lib/OpenLayers/Layer.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Layer.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Layer.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -704,7 +704,9 @@
/**
* APIMethod: display
- * Hide or show the Layer
+ * Hide or show the Layer. This is designed to be used internally, and
+ * is not generally the way to enable or disable the layer. For that,
+ * use the setVisibility function instead..
*
* Parameters:
* display - {Boolean}
Modified: sandbox/august/trunk/lib/OpenLayers/Map.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Map.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Map.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -513,7 +513,7 @@
this.viewPortDiv.appendChild(this.layerContainerDiv);
this.events = new OpenLayers.Events(this,
- this.div,
+ this.viewPortDiv,
this.EVENT_TYPES,
this.fallThrough,
{includeXY: true});
@@ -610,7 +610,6 @@
render: function(div) {
this.div = OpenLayers.Util.getElement(div);
OpenLayers.Element.addClass(this.div, 'olMap');
- this.events.attachToElement(this.div);
this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);
this.div.appendChild(this.viewPortDiv);
this.updateSize();
Modified: sandbox/august/trunk/lib/OpenLayers/Popup/Anchored.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Popup/Anchored.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Popup/Anchored.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -186,10 +186,10 @@
var size = this.size || this.contentSize;
var top = (this.relativePosition.charAt(0) == 't');
- newPx.y += (top) ? -(size.h + this.anchor.size.h) : this.anchor.size.h;
+ newPx.y += (top) ? -size.h : this.anchor.size.h;
var left = (this.relativePosition.charAt(1) == 'l');
- newPx.x += (left) ? -(size.w + this.anchor.size.w) : this.anchor.size.w;
+ newPx.x += (left) ? -size.w : this.anchor.size.w;
return newPx;
},
Modified: sandbox/august/trunk/lib/OpenLayers/Popup.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Popup.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Popup.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -337,7 +337,7 @@
}
//listen to movestart, moveend to disable overflow (FF bug)
- if (!this.disableFirefoxOverflowHack && OpenLayers.Util.getBrowserName() == 'firefox') {
+ if (!this.disableFirefoxOverflowHack && OpenLayers.BROWSER_NAME == 'firefox') {
this.map.events.register("movestart", this, function() {
var style = document.defaultView.getComputedStyle(
this.contentDiv, null
@@ -478,7 +478,7 @@
//now if our browser is IE, we need to actually make the contents
// div itself bigger to take its own padding into effect. this makes
// me want to shoot someone, but so it goes.
- if (OpenLayers.Util.getBrowserName() == "msie") {
+ if (OpenLayers.BROWSER_NAME == "msie") {
this.contentSize.w +=
contentDivPadding.left + contentDivPadding.right;
this.contentSize.h +=
Modified: sandbox/august/trunk/lib/OpenLayers/Projection.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Projection.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Projection.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -26,6 +26,12 @@
* {String}
*/
projCode: null,
+
+ /**
+ * Property: titleRegEx
+ * {RegEx} regular expression to strip the title from a proj4js definition
+ */
+ titleRegEx: /\+title=[^\+]*/,
/**
* Constructor: OpenLayers.Projection
@@ -92,11 +98,20 @@
* {Boolean} The two projections are equivalent.
*/
equals: function(projection) {
- if (projection && projection.getCode) {
- return this.getCode() == projection.getCode();
- } else {
- return false;
- }
+ var p = projection, equals = false;
+ if (p) {
+ if (window.Proj4js && this.proj.defData && p.proj.defData) {
+ equals = this.proj.defData.replace(this.titleRegEx, "") ==
+ p.proj.defData.replace(this.titleRegEx, "");
+ } else if (p.getCode) {
+ var source = this.getCode(), target = p.getCode();
+ equals = source == target ||
+ !!OpenLayers.Projection.transforms[source] &&
+ OpenLayers.Projection.transforms[source][target] ===
+ OpenLayers.Projection.nullTransform;
+ }
+ }
+ return equals;
},
/* Method: destroy
@@ -176,3 +191,23 @@
}
return point;
};
+
+/**
+ * APIFunction: nullTransform
+ * A null transformation - useful for defining projection aliases when
+ * proj4js is not available:
+ *
+ * (code)
+ * OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857",
+ * OpenLayers.Layer.SphericalMercator.projectForward);
+ * OpenLayers.Projection.addTransform("EPSG:3857", "EPSG:3857",
+ * OpenLayers.Layer.SphericalMercator.projectInverse);
+ * OpenLayers.Projection.addTransform("EPSG:3857", "EPSG:900913",
+ * OpenLayers.Projection.nullTransform);
+ * OpenLayers.Projection.addTransform("EPSG:900913", "EPSG:3857",
+ * OpenLayers.Projection.nullTransform);
+ * (end)
+ */
+OpenLayers.Projection.nullTransform = function(point) {
+ return point;
+};
Modified: sandbox/august/trunk/lib/OpenLayers/Renderer/Canvas.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Renderer/Canvas.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Renderer/Canvas.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -68,22 +68,6 @@
},
/**
- * Method: setExtent
- * Set the visible part of the layer.
- *
- * Resolution has probably changed, so we nullify the resolution
- * cache (this.resolution), then redraw.
- *
- * Parameters:
- * extent - {<OpenLayers.Bounds>}
- */
- setExtent: function(extent) {
- this.extent = extent.clone();
- this.resolution = null;
- this.redraw();
- },
-
- /**
* Method: setSize
* Sets the size of the drawing surface.
*
Modified: sandbox/august/trunk/lib/OpenLayers/Renderer/Elements.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Renderer/Elements.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Renderer/Elements.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -509,10 +509,13 @@
};
rendered = false;
+ var removeBackground = false;
if (style.display != "none") {
if (style.backgroundGraphic) {
this.redrawBackgroundNode(geometry.id, geometry, style,
featureId);
+ } else {
+ removeBackground = true;
}
rendered = this.redrawNode(geometry.id, geometry, style,
featureId);
@@ -521,12 +524,18 @@
var node = document.getElementById(geometry.id);
if (node) {
if (node._style.backgroundGraphic) {
- node.parentNode.removeChild(document.getElementById(
- geometry.id + this.BACKGROUND_ID_SUFFIX));
+ removeBackground = true;
}
node.parentNode.removeChild(node);
}
}
+ if (removeBackground) {
+ var node = document.getElementById(
+ geometry.id + this.BACKGROUND_ID_SUFFIX);
+ if (node) {
+ node.parentNode.removeChild(node);
+ }
+ }
return rendered;
},
Modified: sandbox/august/trunk/lib/OpenLayers/Renderer/SVG.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Renderer/SVG.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Renderer/SVG.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -50,12 +50,6 @@
symbolMetrics: null,
/**
- * Property: isGecko
- * {Boolean}
- */
- isGecko: null,
-
- /**
* Property: supportUse
* {Boolean} true if defs/use is supported - known to not work as expected
* at least in some applewebkit/5* builds.
@@ -77,7 +71,6 @@
arguments);
this.translationParameters = {x: 0, y: 0};
this.supportUse = (navigator.userAgent.toLowerCase().indexOf("applewebkit/5") == -1);
- this.isGecko = (navigator.userAgent.toLowerCase().indexOf("gecko/") != -1);
this.symbolMetrics = {};
},
@@ -735,7 +728,7 @@
label.setAttributeNS(null, "text-anchor",
OpenLayers.Renderer.SVG.LABEL_ALIGN[align[0]] || "middle");
- if (this.isGecko) {
+ if (OpenLayers.IS_GECKO === true) {
label.setAttributeNS(null, "dominant-baseline",
OpenLayers.Renderer.SVG.LABEL_ALIGN[align[1]] || "central");
} else {
Modified: sandbox/august/trunk/lib/OpenLayers/Renderer/VML.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Renderer/VML.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Renderer/VML.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -751,21 +751,43 @@
var resolution = this.getResolution();
var path = [];
- var linearRing, i, j, len, ilen, comp, x, y;
- for (j = 0, len=geometry.components.length; j<len; j++) {
- linearRing = geometry.components[j];
-
+ var j, jj, points, area, first, second, i, ii, comp, pathComp, x, y;
+ for (j=0, jj=geometry.components.length; j<jj; j++) {
path.push("m");
- for (i=0, ilen=linearRing.components.length; i<ilen; i++) {
- comp = linearRing.components[i];
+ points = geometry.components[j].components;
+ // we only close paths of interior rings with area
+ area = (j === 0);
+ first = null;
+ second = null;
+ for (i=0, ii=points.length; i<ii; i++) {
+ comp = points[i];
x = (comp.x / resolution - this.offset.x) | 0;
y = (comp.y / resolution - this.offset.y) | 0;
- path.push(" " + x + "," + y);
+ pathComp = " " + x + "," + y;
+ path.push(pathComp)
if (i==0) {
path.push(" l");
}
+ if (!area) {
+ // IE improperly renders sub-paths that have no area.
+ // Instead of checking the area of every ring, we confirm
+ // the ring has at least three distinct points. This does
+ // not catch all non-zero area cases, but it greatly improves
+ // interior ring digitizing and is a minor performance hit
+ // when rendering rings with many points.
+ if (!first) {
+ first = pathComp;
+ } else if (first != pathComp) {
+ if (!second) {
+ second = pathComp;
+ } else if (second != pathComp) {
+ // stop looking
+ area = true;
+ }
+ }
+ }
}
- path.push(" x ");
+ path.push(area ? " x " : " ");
}
path.push("e");
node.path = path.join("");
Modified: sandbox/august/trunk/lib/OpenLayers/SingleFile.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/SingleFile.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/SingleFile.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -4,7 +4,40 @@
* full text of the license. */
var OpenLayers = {
- singleFile: true
-};
+ /**
+ * Constant: VERSION_NUMBER
+ */
+ VERSION_NUMBER: "$Revision$",
+ /**
+ * Constant: singleFile
+ * TODO: remove this in 3.0 when we stop supporting build profiles that
+ * include OpenLayers.js
+ */
+ singleFile: true,
+ /**
+ * Method: _getScriptLocation
+ * Return the path to this script. This is also implemented in
+ * OpenLayers.js
+ *
+ * Returns:
+ * {String} Path to this script
+ */
+ _getScriptLocation: (function() {
+ var r = new RegExp("(^|(.*?\\/))(OpenLayers\.js)(\\?|$)"),
+ s = document.getElementsByTagName('script'),
+ src, m, l = "";
+ for(var i=0, len=s.length; i<len; i++) {
+ src = s[i].getAttribute('src');
+ if(src) {
+ var m = src.match(r);
+ if(m) {
+ l = m[1];
+ break;
+ }
+ }
+ }
+ return (function() { return l; });
+ })()
+};
Property changes on: sandbox/august/trunk/lib/OpenLayers/SingleFile.js
___________________________________________________________________
Added: svn:keywords
+ Revision
Modified: sandbox/august/trunk/lib/OpenLayers/Strategy/Filter.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Strategy/Filter.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Strategy/Filter.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -45,14 +45,10 @@
*
* Parameters:
* options - {Object} Optional object whose properties will be set on the
- * instance. Strategy must be constructed with at least a <filter>
- * property.
+ * instance.
*/
initialize: function(options) {
OpenLayers.Strategy.prototype.initialize.apply(this, [options]);
- if (!this.filter || !(this.filter instanceof OpenLayers.Filter)) {
- throw new Error("Filter strategy must be constructed with a filter");
- }
},
/**
@@ -102,7 +98,7 @@
* Method: handleAdd
*/
handleAdd: function(event) {
- if (!this.caching) {
+ if (!this.caching && this.filter) {
var features = event.features;
event.features = [];
var feature;
Modified: sandbox/august/trunk/lib/OpenLayers/Tile/Image/IFrame.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Tile/Image/IFrame.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Tile/Image/IFrame.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -84,7 +84,7 @@
if (this.imgDiv == null) {
var eventPane = document.createElement("div");
- if(OpenLayers.Util.getBrowserName() == "msie") {
+ if(OpenLayers.BROWSER_NAME == "msie") {
// IE cannot handle events on elements without backgroundcolor.
// So we use this little hack to make elements transparent
eventPane.style.backgroundColor = '#FFFFFF';
@@ -131,7 +131,7 @@
createIFrame: function() {
var id = this.id+'_iFrame';
var iframe;
- if(OpenLayers.Util.getBrowserName() == "msie") {
+ if(OpenLayers.BROWSER_NAME == "msie") {
// InternetExplorer does not set the name attribute of an iFrame
// properly via DOM manipulation, so we need to do it on our own with
// this hack.
Modified: sandbox/august/trunk/lib/OpenLayers/Tile/Image.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Tile/Image.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Tile/Image.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -589,7 +589,7 @@
// before continuing execution.
if (OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,
this.layer.transitionEffect) != -1) {
- if (navigator.userAgent.toLowerCase().indexOf("gecko") != -1) {
+ if (OpenLayers.IS_GECKO === true) {
this.frame.scrollLeft = this.frame.scrollLeft;
}
}
@@ -608,5 +608,5 @@
);
OpenLayers.Tile.Image.useBlankTile = (
- OpenLayers.Util.getBrowserName() == "safari" ||
- OpenLayers.Util.getBrowserName() == "opera");
+ OpenLayers.BROWSER_NAME == "safari" ||
+ OpenLayers.BROWSER_NAME == "opera");
Modified: sandbox/august/trunk/lib/OpenLayers/Util.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers/Util.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers/Util.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -1336,51 +1336,142 @@
/**
* Function: pagePositon
- * Calculates the position of an element on the page.
+ * Calculates the position of an element on the page (see
+ * http://code.google.com/p/doctype/wiki/ArticlePageOffset)
*
+ * OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is
+ * Copyright (c) 2006, Yahoo! Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use of this software in source and binary forms, with or
+ * without modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Yahoo! Inc. nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission of Yahoo! Inc.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
* Parameters:
* forElement - {DOMElement}
*
* Returns:
- * {Array} two item array, L value then T value.
+ * {Array} two item array, Left value then Top value.
*/
-OpenLayers.Util.pagePosition = function(forElement) {
- var valueT = 0, valueL = 0;
+OpenLayers.Util.pagePosition = function(forElement) {
+ // NOTE: If element is hidden (display none or disconnected or any the
+ // ancestors are hidden) we get (0,0) by default but we still do the
+ // accumulation of scroll position.
- var element = forElement;
- var child = forElement;
- while(element) {
+ var pos = [0, 0];
+ var viewportElement = OpenLayers.Util.getViewportElement();
+ if (!forElement || forElement == window || forElement == viewportElement) {
+ // viewport is always at 0,0 as that defined the coordinate system for
+ // this function - this avoids special case checks in the code below
+ return pos;
+ }
- if(element == document.body) {
- if(OpenLayers.Element.getStyle(child, 'position') == 'absolute') {
- break;
+ // Gecko browsers normally use getBoxObjectFor to calculate the position.
+ // When invoked for an element with an implicit absolute position though it
+ // can be off by one. Therefore the recursive implementation is used in
+ // those (relatively rare) cases.
+ var BUGGY_GECKO_BOX_OBJECT =
+ OpenLayers.IS_GECKO && document.getBoxObjectFor &&
+ OpenLayers.Element.getStyle(forElement, 'position') == 'absolute' &&
+ (forElement.style.top == '' || forElement.style.left == '');
+
+ var parent = null;
+ var box;
+
+ if (forElement.getBoundingClientRect) { // IE
+ box = forElement.getBoundingClientRect();
+ var scrollTop = viewportElement.scrollTop;
+ var scrollLeft = viewportElement.scrollLeft;
+
+ pos[0] = box.left + scrollLeft;
+ pos[1] = box.top + scrollTop;
+
+ } else if (document.getBoxObjectFor && !BUGGY_GECKO_BOX_OBJECT) { // gecko
+ // Gecko ignores the scroll values for ancestors, up to 1.9. See:
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=328881 and
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=330619
+
+ box = document.getBoxObjectFor(forElement);
+ var vpBox = document.getBoxObjectFor(viewportElement);
+ pos[0] = box.screenX - vpBox.screenX;
+ pos[1] = box.screenY - vpBox.screenY;
+
+ } else { // safari/opera
+ pos[0] = forElement.offsetLeft;
+ pos[1] = forElement.offsetTop;
+ parent = forElement.offsetParent;
+ if (parent != forElement) {
+ while (parent) {
+ pos[0] += parent.offsetLeft;
+ pos[1] += parent.offsetTop;
+ parent = parent.offsetParent;
}
}
-
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- child = element;
- try {
- // wrapping this in a try/catch because IE chokes on the offsetParent
- element = element.offsetParent;
- } catch(e) {
- OpenLayers.Console.error(OpenLayers.i18n(
- "pagePositionFailed",{'elemId':element.id}));
- break;
+ var browser = OpenLayers.BROWSER_NAME;
+
+ // opera & (safari absolute) incorrectly account for body offsetTop
+ if (browser == "opera" || (browser == "safari" &&
+ OpenLayers.Element.getStyle(forElement, 'position') == 'absolute')) {
+ pos[1] -= document.body.offsetTop;
}
- }
- element = forElement;
- while(element) {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
- element = element.parentNode;
+ // accumulate the scroll positions for everything but the body element
+ parent = forElement.offsetParent;
+ while (parent && parent != document.body) {
+ pos[0] -= parent.scrollLeft;
+ // see https://bugs.opera.com/show_bug.cgi?id=249965
+ if (browser != "opera" || parent.tagName != 'TR') {
+ pos[1] -= parent.scrollTop;
+ }
+ parent = parent.offsetParent;
+ }
}
- return [valueL, valueT];
+ return pos;
};
+/**
+ * Function: getViewportElement
+ * Returns die viewport element of the document. The viewport element is
+ * usually document.documentElement, except in IE,where it is either
+ * document.body or document.documentElement, depending on the document's
+ * compatibility mode (see
+ * http://code.google.com/p/doctype/wiki/ArticleClientViewportElement)
+ */
+OpenLayers.Util.getViewportElement = function() {
+ var viewportElement = arguments.callee.viewportElement;
+ if (viewportElement == undefined) {
+ viewportElement = (OpenLayers.BROWSER_NAME == "msie" &&
+ document.compatMode != 'CSS1Compat') ? document.body :
+ document.documentElement;
+ arguments.callee.viewportElement = viewportElement;
+ }
+ return viewportElement;
+};
/**
* Function: isEquivalentUrl
@@ -1540,8 +1631,46 @@
return head;
};
+/**
+ * Constant: IS_GECKO
+ * {Boolean} True if the userAgent reports the browser to use the Gecko engine
+ */
+OpenLayers.IS_GECKO = (function() {
+ var ua = navigator.userAgent.toLowerCase();
+ return ua.indexOf("webkit") == -1 && ua.indexOf("gecko") != -1;
+})();
/**
+ * Constant: BROWSER_NAME
+ * {String}
+ * A substring of the navigator.userAgent property. Depending on the userAgent
+ * property, this will be the empty string or one of the following:
+ * * "opera" -- Opera
+ * * "msie" -- Internet Explorer
+ * * "safari" -- Safari
+ * * "firefox" -- FireFox
+ * * "mozilla" -- Mozilla
+ */
+OpenLayers.BROWSER_NAME = (function() {
+ var name = "";
+ var ua = navigator.userAgent.toLowerCase();
+ if (ua.indexOf("opera") != -1) {
+ name = "opera";
+ } else if (ua.indexOf("msie") != -1) {
+ name = "msie";
+ } else if (ua.indexOf("safari") != -1) {
+ name = "safari";
+ } else if (ua.indexOf("mozilla") != -1) {
+ if (ua.indexOf("firefox") != -1) {
+ name = "firefox";
+ } else {
+ name = "mozilla";
+ }
+ }
+ return name;
+})();
+
+/**
* Function: getBrowserName
*
* Returns:
@@ -1559,29 +1688,9 @@
* return an empty string.
*/
OpenLayers.Util.getBrowserName = function() {
- var browserName = "";
-
- var ua = navigator.userAgent.toLowerCase();
- if ( ua.indexOf( "opera" ) != -1 ) {
- browserName = "opera";
- } else if ( ua.indexOf( "msie" ) != -1 ) {
- browserName = "msie";
- } else if ( ua.indexOf( "safari" ) != -1 ) {
- browserName = "safari";
- } else if ( ua.indexOf( "mozilla" ) != -1 ) {
- if ( ua.indexOf( "firefox" ) != -1 ) {
- browserName = "firefox";
- } else {
- browserName = "mozilla";
- }
- }
-
- return browserName;
+ return OpenLayers.BROWSER_NAME;
};
-
-
-
/**
* Method: getRenderedDimensions
* Renders the contentHTML offscreen to determine actual dimensions for
Modified: sandbox/august/trunk/lib/OpenLayers.js
===================================================================
--- sandbox/august/trunk/lib/OpenLayers.js 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/lib/OpenLayers.js 2010-12-03 06:40:11 UTC (rev 10941)
@@ -7,62 +7,58 @@
* @requires OpenLayers/BaseTypes.js
* @requires OpenLayers/Lang/en.js
* @requires OpenLayers/Console.js
- */
+ */
+
+/*
+ * TODO: In 3.0, we will stop supporting build profiles that include
+ * OpenLayers.js. This means we will not need the singleFile and scriptFile
+ * variables, because we don't have to handle the singleFile case any more.
+ */
(function() {
/**
* Before creating the OpenLayers namespace, check to see if
* OpenLayers.singleFile is true. This occurs if the
* OpenLayers/SingleFile.js script is included before this one - as is the
- * case with single file builds.
+ * case with old single file build profiles that included both
+ * OpenLayers.js and OpenLayers/SingleFile.js.
*/
var singleFile = (typeof OpenLayers == "object" && OpenLayers.singleFile);
/**
- * Cache for the script location returned from
- * OpenLayers._getScriptLocation
+ * Relative path of this script.
*/
- var scriptLocation;
+ var scriptName = (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js";
/**
* Namespace: OpenLayers
* The OpenLayers object provides a namespace for all things OpenLayers
*/
window.OpenLayers = {
-
/**
- * Property: _scriptName
- * {String} Relative path of this script.
- */
- _scriptName: (!singleFile) ? "lib/OpenLayers.js" : "OpenLayers.js",
-
- /**
- * Function: _getScriptLocation
- * Return the path to this script.
+ * Method: _getScriptLocation
+ * Return the path to this script. This is also implemented in
+ * OpenLayers/SingleFile.js
*
* Returns:
* {String} Path to this script
*/
- _getScriptLocation: function () {
- if (scriptLocation != undefined) {
- return scriptLocation;
- }
- scriptLocation = "";
- var isOL = new RegExp("(^|(.*?\\/))(" + OpenLayers._scriptName + ")(\\?|$)");
-
- var scripts = document.getElementsByTagName('script');
- for (var i=0, len=scripts.length; i<len; i++) {
- var src = scripts[i].getAttribute('src');
- if (src) {
- var match = src.match(isOL);
- if(match) {
- scriptLocation = match[1];
+ _getScriptLocation: (function() {
+ var r = new RegExp("(^|(.*?\\/))(" + scriptName + ")(\\?|$)"),
+ s = document.getElementsByTagName('script'),
+ src, m, l = "";
+ for(var i=0, len=s.length; i<len; i++) {
+ src = s[i].getAttribute('src');
+ if(src) {
+ var m = src.match(r);
+ if(m) {
+ l = m[1];
break;
}
}
}
- return scriptLocation;
- }
+ return (function() { return l; });
+ })()
};
/**
* OpenLayers.singleFile is a flag indicating this file is being included
@@ -73,7 +69,7 @@
*
* When we *are* part of a SFL build we do not dynamically include the
* OpenLayers library code as it will be appended at the end of this file.
- */
+ */
if(!singleFile) {
var jsfiles = new Array(
"OpenLayers/Util.js",
@@ -316,16 +312,14 @@
"OpenLayers/Format/WMSGetFeatureInfo.js",
"OpenLayers/Format/SOSCapabilities.js",
"OpenLayers/Format/SOSCapabilities/v1_0_0.js",
- "OpenLayers/Format/SOSGetObservation.js",
"OpenLayers/Format/SOSGetFeatureOfInterest.js",
+ "OpenLayers/Format/SOSGetObservation.js",
"OpenLayers/Format/OWSContext.js",
"OpenLayers/Format/OWSContext/v0_3_1.js",
"OpenLayers/Format/WMTSCapabilities.js",
"OpenLayers/Format/WMTSCapabilities/v1_0_0.js",
- "OpenLayers/Format/WPSCapabilities.js",
- "OpenLayers/Format/WPSCapabilities/v1_0_0.js",
- "OpenLayers/Format/WPSDescribeProcess.js",
- "OpenLayers/Format/WPSDescribeProcess/v1_0_0.js",
+ "OpenLayers/Format/WPSCommon.js",
+ "OpenLayers/Format/WPSCommon/v1_0_0.js",
"OpenLayers/Layer/WFS.js",
"OpenLayers/Control/GetFeature.js",
"OpenLayers/Control/MouseToolbar.js",
@@ -342,6 +336,8 @@
"OpenLayers/Symbolizer/Polygon.js",
"OpenLayers/Symbolizer/Text.js",
"OpenLayers/Symbolizer/Raster.js",
+ "OpenLayers/Process.js",
+ "OpenLayers/Process/WPS.js",
"OpenLayers/Lang.js",
"OpenLayers/Lang/en.js"
); // etc.
Modified: sandbox/august/trunk/readme.txt
===================================================================
--- sandbox/august/trunk/readme.txt 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/readme.txt 2010-12-03 06:40:11 UTC (rev 10941)
@@ -31,7 +31,7 @@
As an example, using bash (with the release files in ~/openlayers ):
$ cd /var/www/html
-$ cp ~/openlayers/build/OpenLayers.js ./
+$ cp ~/openlayers/OpenLayers.js ./
$ cp -R ~/openlayers/theme ./
$ cp -R ~/openlayers/img ./
Modified: sandbox/august/trunk/release-license.txt
===================================================================
--- sandbox/august/trunk/release-license.txt 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/release-license.txt 2010-12-03 06:40:11 UTC (rev 10941)
@@ -1,3 +1,3 @@
This license information is now available at:
-
+
http://svn.openlayers.org/trunk/openlayers/license.txt
Modified: sandbox/august/trunk/tests/BaseTypes/Element.html
===================================================================
--- sandbox/august/trunk/tests/BaseTypes/Element.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/BaseTypes/Element.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -212,7 +212,7 @@
style = "chickenHead";
t.ok(OpenLayers.Element.getStyle(elem, style) == null, "get style on 'auto' style returns null");
- if (OpenLayers.Util.getBrowserName() == "opera") {
+ if (OpenLayers.BROWSER_NAME == "opera") {
elem.style.top = "15px";
style = "top";
Modified: sandbox/august/trunk/tests/Control/LayerSwitcher.html
===================================================================
--- sandbox/august/trunk/tests/Control/LayerSwitcher.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Control/LayerSwitcher.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -71,7 +71,7 @@
function test_Control_LayerSwitcher_redraw (t) {
- t.plan( (OpenLayers.Util.getBrowserName() == "opera" ? 9 : 19 ) );
+ t.plan( (OpenLayers.BROWSER_NAME == "opera" ? 9 : 19 ) );
map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS("WMS",
@@ -98,7 +98,7 @@
t.eq(markersInput.value, markers.name, "wms correctly valued");
t.eq(false, control.checkRedraw(), "check redraw is false");
- if (OpenLayers.Util.getBrowserName() != "opera") {
+ if (OpenLayers.BROWSER_NAME != "opera") {
control = new OpenLayers.Control.LayerSwitcher();
var myredraw = control.redraw;
control.redraw = function() {
Modified: sandbox/august/trunk/tests/Control/Measure.html
===================================================================
--- sandbox/august/trunk/tests/Control/Measure.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Control/Measure.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -222,6 +222,142 @@
);
}
+
+ function test_immediate(t) {
+ t.plan(29);
+
+ var map = new OpenLayers.Map({
+ div: "map",
+ units: "m",
+ resolutions: [1],
+ layers: [
+ new OpenLayers.Layer(null, {
+ isBaseLayer: true
+ })
+ ],
+ center: new OpenLayers.LonLat(0, 0)
+ });
+
+ var log = [];
+ var control = new OpenLayers.Control.Measure(
+ OpenLayers.Handler.Path, {
+ persist: true,
+ immediate: true,
+ eventListeners: {
+ measurepartial: function(evt) {
+ log.push(evt);
+ },
+ measure: function(evt){
+ log.push(evt);
+ }
+ }
+ }
+ );
+ map.addControl(control);
+ control.activate();
+
+ // convenience function to trigger mouse events
+ function trigger(type, x, y) {
+ map.events.triggerEvent(type, {
+ xy: new OpenLayers.Pixel(x, y)
+ })
+ };
+
+ // delay in seconds
+ var delay = control.partialDelay / 1000;
+
+ // a) establish first point
+ trigger("mousedown", 0, 0);
+ trigger("mouseup", 0, 0);
+
+ // move 10 pixels
+ trigger("mousemove", 0, 10);
+
+ t.eq(log.length, 0, "a) no event fired yet");
+
+ t.delay_call(
+ delay, function() {
+ // confirm measurepartial is fired
+ t.eq(log.length, 1, "a) event logged");
+ t.eq(log[0].type, "measurepartial", "a) correct type");
+ // mousemove within the partialDelay fires no event, so the
+ // measure below is the one of the initial point
+ t.eq(log[0].measure, 0, "a) correct measure");
+
+ // b) move 10 pixels
+ trigger("mousemove", 0, 20);
+ // c) move 10 pixels again
+ trigger("mousemove", 0, 30);
+
+ // confirm measurepartial is fired 2 times
+ t.eq(log.length, 3, "b) event logged");
+ t.eq(log[1].type, "measurepartial", "b) correct type");
+ t.eq(log[1].measure, 20, "b) correct measure");
+ t.eq(log[2].type, "measurepartial", "c) correct type");
+ t.eq(log[2].measure, 30, "c) correct measure");
+
+ // d) switch immediate measurement off
+ control.setImmediate(false);
+ t.eq(control.immediate, false, "d) immediate is false");
+
+ // e) move 10 pixels and click
+ trigger("mousemove", 0, 40);
+ trigger("mousedown", 0, 40);
+ trigger("mouseup", 0, 40);
+ // confirm measurepartial is not fired before delay
+ t.eq(log.length, 3, "e) no event fired yet")
+ },
+ // wait for delay then confirm event was logged
+ delay, function() {
+ t.eq(log.length, 4, "e) event logged")
+ t.eq(log[3].type, "measurepartial", "e) correct type");
+ t.eq(log[3].measure, 40, "e) correct measure");
+
+ // f) switch immediate measurement on
+ control.setImmediate(true);
+ t.eq(control.immediate, true, "f) immediate is true");
+
+ // g) move 10 pixels
+ trigger("mousemove", 0, 50);
+ },
+ delay, function() {
+ t.eq(log.length, 5, "g) event logged");
+ t.eq(log[4].type, "measurepartial", "g) correct type");
+ t.eq(log[4].measure, 50, "g) correct measure");
+
+ // h) move 10 pixels
+ trigger("mousemove", 0, 60);
+
+ t.eq(log.length, 6, "h) event logged");
+ t.eq(log[5].type, "measurepartial", "h) correct type");
+ t.eq(log[5].measure, 60, "h) correct measure");
+
+ // i) double click to finish
+ trigger("mousedown", 0, 60);
+ trigger("mouseup", 0, 60);
+ t.eq(log.length, 6, "i) no event fired yet");
+ },
+ delay, function() {
+ t.eq(log.length, 7, "i) event logged");
+ t.eq(log[6].type, "measurepartial", "i) correct type");
+ t.eq(log[6].measure, 60, "i) correct measure");
+
+ trigger("dblclick", 0, 60);
+ t.eq(log.length, 8, "i) event logged");
+ t.eq(log[7].type, "measure", "i) correct type");
+ t.eq(log[7].measure, 60, "i) correct measure");
+ // clear log
+ log = [];
+
+ // j) clean up
+ map.destroy();
+ // wait for delay and confirm event not logged
+ },
+ delay, function() {
+ t.eq(log.length, 0, "j) no event fired after destroy");
+ }
+ );
+ }
</script>
</head>
Modified: sandbox/august/trunk/tests/Control/ModifyFeature.html
===================================================================
--- sandbox/august/trunk/tests/Control/ModifyFeature.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Control/ModifyFeature.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -473,9 +473,13 @@
}
function test_onModificationStart(t) {
- t.plan(1);
+ t.plan(5);
var map = new OpenLayers.Map("map");
- var layer = new OpenLayers.Layer.Vector();
+ var layer = new OpenLayers.Layer.Vector(null, {
+ styleMap: new OpenLayers.StyleMap({
+ "vertex": new OpenLayers.Style({foo: "bar"})
+ }, {extendDefault: false})
+ });
map.addLayer(layer);
var control = new OpenLayers.Control.ModifyFeature(layer);
map.addControl(control);
@@ -483,14 +487,38 @@
// make sure onModificationStart is called on feature selection
var testFeature = new OpenLayers.Feature.Vector(
- new OpenLayers.Geometry.Point(Math.random(), Math.random())
+ OpenLayers.Geometry.fromWKT("LINESTRING(3 4,10 50,20 25)")
);
+ layer.addFeatures([testFeature]);
control.onModificationStart = function(feature) {
t.eq(feature.id, testFeature.id,
"onModificationStart called with the right feature");
};
control.selectFeature(testFeature);
+ // make sure styles are set correctly from default style
+ t.eq(control.virtualStyle, OpenLayers.Util.applyDefaults({
+ strokeOpacity: 0.3,
+ fillOpacity: 0.3
+ }, OpenLayers.Feature.Vector.style["default"]), "virtual style set correctly");
+ var vertex = layer.features[layer.features.length-1];
+ t.eq(vertex.renderIntent, null, "vertex style set correctly - uses default style");
+ control.unselectFeature(testFeature);
+
+ // make sure styles are set correctly with vertexRenderIntent
+ control = new OpenLayers.Control.ModifyFeature(layer, {vertexRenderIntent: "vertex"});
+ map.addControl(control);
+ control.activate();
+ control.selectFeature(testFeature);
+ t.eq(control.virtualStyle, {
+ strokeOpacity: 0.3,
+ fillOpacity: 0.3,
+ foo: "bar"
+ }, "virtual style set correctly");
+ var vertex = layer.features[layer.features.length-1];
+ t.eq(vertex.renderIntent, "vertex", "vertex style set correctly - uses 'vertex' renderIntent");
+ control.unselectFeature(testFeature);
+
map.destroy();
}
Modified: sandbox/august/trunk/tests/Control/PanZoom.html
===================================================================
--- sandbox/august/trunk/tests/Control/PanZoom.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Control/PanZoom.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -43,7 +43,7 @@
function test_Control_PanZoom_control_events (t) {
- if ( !window.document.createEvent || OpenLayers.Util.getBrowserName() == "opera" || !t.open_window) {
+ if ( !window.document.createEvent || OpenLayers.BROWSER_NAME == "opera" || !t.open_window) {
//ie can't simulate mouseclicks
t.plan(0);
t.debug_print("FIXME: This browser does not support the PanZoom test at this time.");
Modified: sandbox/august/trunk/tests/Control/Panel.html
===================================================================
--- sandbox/august/trunk/tests/Control/Panel.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Control/Panel.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -227,8 +227,8 @@
t.ok(!controlNoDeactive.active, "Tool control autoActivate:true is not active");
}
- function test_Control_Panel_dectivate (t) {
- t.plan(3);
+ function test_Control_Panel_deactivate (t) {
+ t.plan(2);
var map = new OpenLayers.Map('map');
var control = new OpenLayers.Control();
var panel = new OpenLayers.Control.Panel();
@@ -239,12 +239,7 @@
panel.deactivate();
t.ok(panel.div.innerHTML == "",
"Panel is not displayed after deactivate without any active control");
-
- panel.activate();
- var div = panel.div;
- panel.destroy();
- t.ok(panel.div.innerHTML == "",
- "Panel is not displayed after destroy without any active control");
+
map.destroy();
}
</script>
Modified: sandbox/august/trunk/tests/Control/SLDSelect.html
===================================================================
--- sandbox/august/trunk/tests/Control/SLDSelect.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Control/SLDSelect.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -31,7 +31,7 @@
}
function test_select(t) {
- t.plan(8);
+ t.plan(9);
var parser = new OpenLayers.Format.WFSDescribeFeatureType();
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS('Foo', 'http://foo', {LAYERS: 'AAA64'});
@@ -80,7 +80,8 @@
control.select(geometry);
control.events.unregister("selected", this, testEvent);
t.eq(map.layers.length, 2, "Selection layer has been created and added to the map");
- t.eq(map.layers[1] instanceof OpenLayers.Layer.WMS.Post, true, "A WMS Post layer has been created as the selection layer");
+ t.eq(map.layers[1] instanceof OpenLayers.Layer.WMS, true, "A WMS layer has been created as the selection layer");
+ t.eq(map.layers[1].tileOptions.maxGetUrlLength, 2048, "Selection layer will automatically switch to HTTP Post if content gets longer than 2048");
var expected_sld = '<sld:StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><sld:NamedLayer><sld:Name>AAA64</sld:Name><sld:UserStyle><sld:Name>default</sld:Name><sld:FeatureTypeStyle><sld:Rule><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geometry</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml"><gml:coordinates decimal="." cs="," ts=" ">-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter><sld:LineSymbolizer><sld:Stroke><sld:CssParameter name="stroke">#FF0000</sld:CssParameter><sld:CssParameter name="stroke-width">2</sld:CssParameter></sld:Stroke></sld:LineSymbolizer></sld:Rule></sld:Featur
eTypeStyle></sld:UserStyle></sld:NamedLayer></sld:StyledLayerDescriptor>';
t.xml_eq(map.layers[1].params.SLD_BODY, expected_sld, "SLD generated correctly");
Modified: sandbox/august/trunk/tests/Feature.html
===================================================================
--- sandbox/august/trunk/tests/Feature.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Feature.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -43,7 +43,7 @@
feature = new OpenLayers.Feature(layer, lonlat, data);
popup = feature.createPopup();
//Safari 3 separates style overflow into overflow-x and overflow-y
- var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+ var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
t.eq(popup.contentDiv.style[prop], "auto", 'overflow on popup is correct');
}
function test_Feature_createMarker (t) {
Modified: sandbox/august/trunk/tests/Format/GML.html
===================================================================
--- sandbox/august/trunk/tests/Format/GML.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Format/GML.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -411,7 +411,7 @@
];
var shell_start = '<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs"><gml:featureMember xmlns:gml="http://www.opengis.net/gml"><feature:features xmlns:feature="http://mapserver.gis.umn.edu/mapserver" fid="221"><feature:geometry>';
- if (OpenLayers.Util.getBrowserName() == "opera") {
+ if (OpenLayers.BROWSER_NAME == "opera") {
shell_start = '<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs"><gml:featureMember xmlns:gml="http://www.opengis.net/gml"><feature:features fid="221" xmlns:feature="http://mapserver.gis.umn.edu/mapserver"><feature:geometry>';
}
var shell_end = '</feature:geometry></feature:features></gml:featureMember></wfs:FeatureCollection>';
Modified: sandbox/august/trunk/tests/Format/SOSGetObservation.html
===================================================================
--- sandbox/august/trunk/tests/Format/SOSGetObservation.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Format/SOSGetObservation.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -4,7 +4,7 @@
<script type="text/javascript">
function test_read_SOSGetObservation(t) {
- t.plan(7);
+ t.plan(13);
var parser = new OpenLayers.Format.SOSGetObservation();
var text =
@@ -49,16 +49,131 @@
t.eq(measurement.result.uom, "Cel", "Units of measurement correctly parsed");
t.eq(measurement.result.value, "4.9", "Value correctly parsed");
t.eq(measurement.samplingTime.timeInstant.timePosition, "2009-12-02T10:35:00.000+01:00", "Sampling time correctly parsed");
+
+ var response = [];
+ response.push('<?xml version="1.0" encoding="UTF-8"?>',
+'<om:ObservationCollection gml:id="oc_0" xsi:schemaLocation="http://www.opengis.net/om/1.0 http://schemas.opengis.net/om/1.0.0/om.xsd http://www.opengis.net/sampling/1.0 http://schemas.opengis.net/sampling/1.0.0/sampling.xsd" xmlns:om="http://www.opengis.net/om/1.0" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:swe="http://www.opengis.net/swe/1.0.1" xmlns:sa="http://www.opengis.net/sampling/1.0">',
+' <gml:boundedBy>',
+' <gml:Envelope srsName="urn:ogc:def:crs:EPSG:4326">',
+' <gml:lowerCorner>46.611644 7.6103</gml:lowerCorner>',
+' <gml:upperCorner>51.9412 13.883498</gml:upperCorner>',
+' </gml:Envelope>',
+' </gml:boundedBy>',
+' <om:member>',
+' <om:Observation gml:id="ot_583227">',
+' <om:samplingTime>',
+' <gml:TimePeriod xsi:type="gml:TimePeriodType">',
+' <gml:beginPosition>2009-09-28T13:45:00.000+02:00</gml:beginPosition>',
+' <gml:endPosition>2009-09-28T13:45:00.000+02:00</gml:endPosition>',
+' </gml:TimePeriod>',
+' </om:samplingTime>',
+' <om:procedure xlink:href="urn:ogc:object:feature:OSIRIS-HWS:efeb807b-bd24-4128-a920-f6729bcdd111"/>',
+' <om:observedProperty>',
+' <swe:CompositePhenomenon gml:id="cpid0" dimension="1">',
+' <gml:name>resultComponents</gml:name>',
+' <swe:component xlink:href="urn:ogc:data:time:iso8601"/>',
+' <swe:component xlink:href="urn:ogc:def:property:OGC::Precipitation1Hour"/>',
+' </swe:CompositePhenomenon>',
+' </om:observedProperty>',
+' <om:featureOfInterest>',
+' <gml:FeatureCollection>',
+' <gml:featureMember>',
+' <sa:SamplingPoint gml:id="urn:ogc:object:feature:OSIRIS-HWS:efeb807b-bd24-4128-a920-f6729bcdd111" xsi:schemaLocation=" http://www.opengis.net/sampling/1.0 http://schemas.opengis.net/sampling/1.0.0/sampling.xsd">',
+' <gml:name>waether @ roof of the FH Kaernten, Villach, Austria</gml:name>',
+' <sa:sampledFeature xlink:href="urn:ogc:def:nil:OGC:unknown"/>',
+' <sa:position>',
+' <gml:Point>',
+' <gml:pos srsName="urn:ogc:def:crs:EPSG:4326">46.611644 13.883498</gml:pos>',
+' </gml:Point>',
+' </sa:position>',
+' </sa:SamplingPoint>',
+' </gml:featureMember>',
+' </gml:FeatureCollection>',
+' </om:featureOfInterest>',
+' <om:result>',
+' <swe:DataArray>',
+' <swe:elementCount>',
+' <swe:Count>',
+' <swe:value>1</swe:value>',
+' </swe:Count>',
+' </swe:elementCount>',
+' <swe:elementType name="Components">',
+' <swe:DataRecord>',
+' <swe:field name="Time">',
+' <swe:Time definition="urn:ogc:data:time:iso8601"/>',
+' </swe:field>',
+' <swe:field name="feature">',
+' <swe:Text definition="urn:ogc:data:feature"/>',
+' </swe:field>',
+' <swe:field name="urn:ogc:def:property:OGC::Precipitation1Hour">',
+' <swe:Quantity definition="urn:ogc:def:property:OGC::Precipitation1Hour">',
+' <swe:uom code="mm"/>',
+' </swe:Quantity>',
+' </swe:field>',
+' </swe:DataRecord>',
+' </swe:elementType>',
+' <swe:encoding>',
+' <swe:TextBlock decimalSeparator="." tokenSeparator="," blockSeparator=";"/>',
+' </swe:encoding>',
+' <swe:values>2009-09-28T13:45:00.000+02:00,urn:ogc:object:feature:OSIRIS-HWS:efeb807b-bd24-4128-a920-f6729bcdd111,0.0;</swe:values>',
+' </swe:DataArray>',
+' </om:result>',
+' </om:Observation>',
+' </om:member>',
+'</om:ObservationCollection>');
+ text = response.join("");
+ var res = parser.read(text);
+ t.eq(res.observations.length, 1, "1 observation parsed");
+ var observation = res.observations[0];
+ t.eq(observation.procedure, "urn:ogc:object:feature:OSIRIS-HWS:efeb807b-bd24-4128-a920-f6729bcdd111", "procedure parsed correctly");
+ t.eq(observation.fois.length, 1, "One foi parsed for the observation");
+ var foi = observation.fois[0];
+ var feature = foi.features[0];
+ t.eq(feature.attributes.id, "urn:ogc:object:feature:OSIRIS-HWS:efeb807b-bd24-4128-a920-f6729bcdd111", "Foi id correctly parsed");
+ t.eq(feature.attributes.name, "waether @ roof of the FH Kaernten, Villach, Austria", "Foi name correctly parsed");
+ t.ok(feature.geometry instanceof OpenLayers.Geometry.Point, "Geometry correctly parsed");
}
function test_write_SOSGetObservation(t) {
- t.plan(1);
+ t.plan(2);
var expect = '<GetObservation xmlns="http://www.opengis.net/sos/1.0" version="1.0.0" service="SOS" xsi:schemaLocation="http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosGetObservation.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><offering>TEMPERATURE</offering><eventTime><ogc:TM_Equals xmlns:ogc="http://www.opengis.net/ogc"><ogc:PropertyName>urn:ogc:data:time:iso8601</ogc:PropertyName><gml:TimeInstant xmlns:gml="http://www.opengis.net/gml"><gml:timePosition>latest</gml:timePosition></gml:TimeInstant></ogc:TM_Equals></eventTime><procedure>urn:ogc:object:feature:OSIRIS-HWS:4fc335bc-06d7-4d5e-a72a-1ac73b9f3b56</procedure><observedProperty>urn:x-ogc:def:property:OGC::Temperature</observedProperty><responseFormat>text/xml;subtype="om/1.0.0"</responseFormat><resultModel>Measurement</resultModel><responseMode>inline</responseMode></GetObservation>';
var format = new OpenLayers.Format.SOSGetObservation();
var output = format.write({eventTime: 'latest', resultModel: 'Measurement', responseMode: 'inline',
- procedure: 'urn:ogc:object:feature:OSIRIS-HWS:4fc335bc-06d7-4d5e-a72a-1ac73b9f3b56', responseFormat: 'text/xml;subtype="om/1.0.0"',
- offering: 'TEMPERATURE', observedProperty: 'urn:x-ogc:def:property:OGC::Temperature'});
+ procedures: ['urn:ogc:object:feature:OSIRIS-HWS:4fc335bc-06d7-4d5e-a72a-1ac73b9f3b56'], responseFormat: 'text/xml;subtype="om/1.0.0"',
+ offering: 'TEMPERATURE', observedProperties: ['urn:x-ogc:def:property:OGC::Temperature']});
t.xml_eq(output, expect, "Request XML is written out correctly");
+
+ var expected = [];
+
+ expected.push('<?xml version="1.0" encoding="UTF-8"?>',
+'<GetObservation xmlns="http://www.opengis.net/sos/1.0"',
+' xmlns:gml="http://www.opengis.net/gml"',
+' xmlns:om="http://www.opengis.net/om/1.0"',
+' xmlns:ogc="http://www.opengis.net/ogc"',
+' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"',
+' xsi:schemaLocation="http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosGetObservation.xsd"',
+' service="SOS" version="1.0.0">',
+' <offering>RAIN_GAUGE</offering>',
+' <eventTime>',
+' <ogc:TM_Equals>',
+' <ogc:PropertyName>urn:ogc:data:time:iso8601</ogc:PropertyName>',
+' <gml:TimeInstant>',
+' <gml:timePosition>latest</gml:timePosition>',
+' </gml:TimeInstant>',
+' </ogc:TM_Equals>',
+' </eventTime>',
+' <observedProperty>urn:ogc:def:property:OGC::Precipitation1Hour</observedProperty>',
+' <featureOfInterest>',
+' <ObjectID>urn:ogc:object:feature:OSIRIS-HWS:3d3b239f-7696-4864-9d07-15447eae2b93</ObjectID>',
+' </featureOfInterest>',
+' <responseFormat>text/xml;subtype="om/1.0.0"</responseFormat>',
+'</GetObservation>');
+ expect = expected.join("");
+ var output = format.write({eventTime: 'latest', offering: 'RAIN_GAUGE',
+ observedProperties: ['urn:ogc:def:property:OGC::Precipitation1Hour'],
+ responseFormat: 'text/xml;subtype="om/1.0.0"',
+ foi: {objectId: 'urn:ogc:object:feature:OSIRIS-HWS:3d3b239f-7696-4864-9d07-15447eae2b93'}});
+ t.xml_eq(output, expect, "Request XML is written out correctly");
}
</script>
Modified: sandbox/august/trunk/tests/Format/WFST/v1_1_0.html
===================================================================
--- sandbox/august/trunk/tests/Format/WFST/v1_1_0.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Format/WFST/v1_1_0.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -40,6 +40,7 @@
featureNS: "http://www.openplans.org/topp",
featureType: "states",
featurePrefix: "topp",
+ srsName: "urn:ogc:def:crs:EPSG::4326",
geometryName: "the_geom"
});
@@ -109,11 +110,11 @@
</wfs:TransactionResponse>
--></div>
<div id="query0"><!--
-<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
+<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">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
- <gml:Envelope xmlns:gml="http://www.opengis.net/gml">
+ <gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG::4326">
<gml:lowerCorner>1 2</gml:lowerCorner>
<gml:upperCorner>3 4</gml:upperCorner>
</gml:Envelope>
@@ -127,7 +128,7 @@
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" xmlns:topp="http://www.openplans.org/topp">
+ <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:PropertyName>STATE_NAME</wfs:PropertyName>
<wfs:PropertyName>STATE_FIPS</wfs:PropertyName>
<wfs:PropertyName>STATE_ABBR</wfs:PropertyName>
Modified: sandbox/august/trunk/tests/Format/WMC/v1_1_0.html
===================================================================
--- sandbox/august/trunk/tests/Format/WMC/v1_1_0.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Format/WMC/v1_1_0.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -4,7 +4,7 @@
<script type="text/javascript">
function test_write_wmc_Layer(t) {
- if (OpenLayers.Util.getBrowserName() == "safari") {
+ if (OpenLayers.BROWSER_NAME == "safari") {
t.plan(0);
t.debug_print("Safari has wierd behavior with getElementsByTagNameNS: the result is that we can't run these tests there. Patches welcome.");
return;
Modified: sandbox/august/trunk/tests/Format/WMC.html
===================================================================
--- sandbox/august/trunk/tests/Format/WMC.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Format/WMC.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -130,7 +130,7 @@
*/
// test v1.1.0
- if(OpenLayers.Util.getBrowserName()== "opera") {
+ if(OpenLayers.BROWSER_NAME== "opera") {
t.plan(0);
t.debug_print("WMC writing works but is not tested in Opera");
} else {
Modified: sandbox/august/trunk/tests/Handler/Polygon.html
===================================================================
--- sandbox/august/trunk/tests/Handler/Polygon.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Handler/Polygon.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -158,6 +158,187 @@
map.destroy();
}
+ function test_rings(t) {
+ t.plan(12);
+
+ var log = [];
+ var map = new OpenLayers.Map({
+ div: "map",
+ resolutions: [1],
+ maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+ layers: [
+ new OpenLayers.Layer.Vector(null, {
+ isBaseLayer: true,
+ eventListeners: {
+ featureadded: function(event) {
+ log.push(event);
+ },
+ sketchmodified: function(event) {
+ log.push(event);
+ },
+ sketchcomplete: function(event) {
+ log.push(event);
+ }
+ }
+ })
+ ],
+ center: new OpenLayers.LonLat(0, 0),
+ zoom: 0
+ });
+
+ // create control for drawing polygons with holes
+ var draw = new OpenLayers.Control.DrawFeature(
+ map.layers[0],
+ OpenLayers.Handler.Polygon,
+ {handlerOptions: {holeModifier: "altKey"}}
+ );
+ map.addControl(draw);
+ draw.activate();
+
+ var event;
+ function trigger(type, event) {
+ map.events.triggerEvent(type, OpenLayers.Util.extend({}, event));
+ }
+
+ // a) draw a polygon
+ log = [];
+ // start at -9, 9
+ event = {xy: new OpenLayers.Pixel(-9, 9)};
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to -1, 9
+ event = {xy: new OpenLayers.Pixel(-1, 9)};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to -1, 1
+ event = {xy: new OpenLayers.Pixel(-1, 1)};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to -9, 1
+ event = {xy: new OpenLayers.Pixel(-9, 1)};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // finish
+ event = {xy: new OpenLayers.Pixel(-9, 1)};
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ trigger("dblclick", event);
+
+ // make assertions
+ t.eq(log.length, 9, "a) correct number of events");
+ t.eq(log[log.length-1].type, "featureadded", "a) featureadded event last");
+ t.eq(log[log.length-1].feature.geometry.getArea(), 64, "a) correct polygon area");
+
+ // b) draw a hole
+ log = [];
+ // start at -6, 6
+ event = {xy: new OpenLayers.Pixel(-6, 6), altKey: true};
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to -3, 6
+ event = {xy: new OpenLayers.Pixel(-3, 6), altKey: true};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to -3, 3
+ event = {xy: new OpenLayers.Pixel(-3, 3), altKey: true};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to -6, 3
+ event = {xy: new OpenLayers.Pixel(-6, 3), altKey: true};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // finish
+ event = {xy: new OpenLayers.Pixel(-6, 3), altKey: true};
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ trigger("dblclick", event);
+
+ // make assertions
+ t.eq(log.length, 8, "b) correct number of events");
+ t.eq(log[log.length-1].type, "sketchcomplete", "b) sketchcomplete event last");
+ t.eq(log[log.length-1].feature.geometry.getArea(), 55, "b) correct polygon area");
+
+
+ // c) draw a polygon that overlaps the first
+ log = [];
+ // start at -2, 2
+ event = {xy: new OpenLayers.Pixel(-2, 2)};
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to 2, 2
+ event = {xy: new OpenLayers.Pixel(2, 2)};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to 2, -2
+ event = {xy: new OpenLayers.Pixel(2, -2)};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to -2, -2
+ event = {xy: new OpenLayers.Pixel(-2, -2)};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // finish
+ event = {xy: new OpenLayers.Pixel(-2, -2)};
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ trigger("dblclick", event);
+
+ // make assertions
+ t.eq(log.length, 9, "c) correct number of events");
+ t.eq(log[log.length-1].type, "featureadded", "c) featureadded event last");
+ t.eq(log[log.length-1].feature.geometry.getArea(), 16, "c) correct polygon area");
+
+ // d) draw a hole that tries to go outside the exterior ring
+ log = [];
+ // start at -1, 1
+ event = {xy: new OpenLayers.Pixel(-1, 1), altKey: true};
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to 1, 1
+ event = {xy: new OpenLayers.Pixel(1, 1), altKey: true};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // try to draw to -8, 8 (ouside active polygon)
+ event = {xy: new OpenLayers.Pixel(-8, 8), altKey: true};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to 1, -1
+ event = {xy: new OpenLayers.Pixel(1, -1), altKey: true};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // draw to -1, -1
+ event = {xy: new OpenLayers.Pixel(-1, -1), altKey: true};
+ trigger("mousemove", event);
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ // finish
+ event = {xy: new OpenLayers.Pixel(-1, 1), altKey: true};
+ trigger("mousedown", event);
+ trigger("mouseup", event);
+ trigger("dblclick", event);
+
+ // make assertions
+ t.eq(log.length, 11, "d) correct number of events");
+ t.eq(log[log.length-1].type, "sketchcomplete", "d) sketchcomplete event last");
+ t.eq(log[log.length-1].feature.geometry.getArea(), 12, "d) correct polygon area");
+
+
+ map.destroy();
+ }
+
+
function test_Handler_Polygon_destroy(t) {
t.plan(8);
var map = new OpenLayers.Map('map');
Modified: sandbox/august/trunk/tests/Layer/EventPane.html
===================================================================
--- sandbox/august/trunk/tests/Layer/EventPane.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Layer/EventPane.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -57,7 +57,7 @@
// MOUSEMOVE test does not seem to work...
// t.plan( 2 );
- if (OpenLayers.Util.getBrowserName() != "firefox" && OpenLayers.Util.getBrowserName() != "mozilla") {
+ if (OpenLayers.BROWSER_NAME != "firefox" && OpenLayers.BROWSER_NAME != "mozilla") {
t.plan(4);
} else {
t.plan(0);
Modified: sandbox/august/trunk/tests/Layer/GeoRSS.html
===================================================================
--- sandbox/august/trunk/tests/Layer/GeoRSS.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Layer/GeoRSS.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -172,7 +172,7 @@
});
}
function test_Layer_GeoRSS_loadend_Event(t) {
- var browserCode = OpenLayers.Util.getBrowserName();
+ var browserCode = OpenLayers.BROWSER_NAME;
if (browserCode == "msie") {
t.plan(1);
t.ok(true, "IE fails the GeoRSS test. This could probably be fixed by someone with enough energy to fix it.");
Modified: sandbox/august/trunk/tests/Layer/MapServer.html
===================================================================
--- sandbox/august/trunk/tests/Layer/MapServer.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Layer/MapServer.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -226,7 +226,7 @@
(window.location.host == "localhost") ||
(window.location.host == "openlayers.org");
- if (OpenLayers.Util.getBrowserName() == "opera" || OpenLayers.Util.getBrowserName() == "safari") {
+ if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.BROWSER_NAME == "safari") {
t.plan(1);
t.debug_print("Can't test google reprojection in Opera or Safari.");
} else if(validkey) {
Modified: sandbox/august/trunk/tests/Layer/SphericalMercator.html
===================================================================
--- sandbox/august/trunk/tests/Layer/SphericalMercator.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Layer/SphericalMercator.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -69,7 +69,7 @@
t.eq(strToFixed(point.toString()),
strToFixed("POINT(10.000000828446318 20.000000618997227)"),
- "point transforms from EPSG:4326 to Spherical Mercator");
+ "point transforms from Spherical Mercator to EPSG:4326");
}
function test_SphericalMercator_addTransform(t) {
@@ -88,6 +88,48 @@
"from EPSG:900913 to EPSG:4326 correctly defined");
}
+ function test_equivalence(t) {
+
+ // list of equivalent codes for web mercator
+ var codes = ["EPSG:900913", "EPSG:3857", "EPSG:102113", "EPSG:102100"];
+ var len = codes.length;
+
+ t.plan(len + (len * len));
+
+ var ggPoint = new OpenLayers.Geometry.Point(10, 20);
+ var smPoint = new OpenLayers.Geometry.Point(1113195, 2273031);
+
+ var gg = new OpenLayers.Projection("EPSG:4326");
+
+ var i, proj, forward, inverse, other, j, equiv;
+ for (i=0, len=codes.length; i<len; ++i) {
+ proj = new OpenLayers.Projection(codes[i]);
+
+ // confirm that forward/inverse work
+ forward = ggPoint.clone().transform(gg, proj);
+ t.eq(
+ strToFixed(forward.toString()),
+ strToFixed("POINT(1113194.9077777779 2273030.9266712805)"),
+ "transforms from EPSG:4326 to " + proj
+ );
+ inverse = smPoint.clone().transform(proj, gg);
+ t.eq(
+ strToFixed(inverse.toString()),
+ strToFixed("POINT(10.000000828446318 20.000000618997227)"),
+ "transforms from " + proj + " to EPSG:4326"
+ );
+
+ // confirm that null transform works
+ for (j=i+1; j<len; ++j) {
+ other = new OpenLayers.Projection(codes[j]);
+ equiv = ggPoint.clone().transform(proj, other);
+ t.ok(proj.equals(other), proj + " and " + other + " are equivalent");
+ t.ok(ggPoint.equals(equiv), "transform from " + proj + " to " + other + " preserves geometry");
+ }
+ }
+
+ }
+
</script>
</head>
<body>
Modified: sandbox/august/trunk/tests/Layer/Text.html
===================================================================
--- sandbox/august/trunk/tests/Layer/Text.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Layer/Text.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -132,7 +132,7 @@
layer.markers[1].events.triggerEvent('click', event);
t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
//Safari 3 separates style overflow into overflow-x and overflow-y
- var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+ var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
t.eq(map.popups[0].contentDiv.style[prop],"auto", "default Popup overflow correct");
});
}
@@ -151,12 +151,12 @@
layer.markers[0].events.triggerEvent('click', event);
t.eq(map.popups.length, 1, "Popup opened correctly");
//Safari 3 separates style overflow into overflow-x and overflow-y
- var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+ var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
t.eq(map.popups[0].contentDiv.style[prop],"auto", "Popup overflow read from file");
layer.markers[1].events.triggerEvent('click', event);
t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
//Safari 3 separates style overflow into overflow-x and overflow-y
- var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+ var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
t.eq(map.popups[0].contentDiv.style[prop],"hidden", "Popup overflow read from file");
});
}
Modified: sandbox/august/trunk/tests/Layer/Vector.html
===================================================================
--- sandbox/august/trunk/tests/Layer/Vector.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Layer/Vector.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -610,7 +610,7 @@
feature.style = customStyle5;
layer.drawFeature(feature);
t.eq(root.firstChild.getAttributeNS(null, 'style'),
- 'opacity: '+customStyle5.graphicOpacity.toString()+((OpenLayers.Util.getBrowserName() == "opera" || OpenLayers.Util.getBrowserName() == "safari") ? "" : ';'),
+ 'opacity: '+customStyle5.graphicOpacity.toString()+((OpenLayers.BROWSER_NAME == "opera" || OpenLayers.BROWSER_NAME == "safari") ? "" : ';'),
"graphicOpacity correctly set");
feature.style = customStyle6;
layer.drawFeature(feature);
Modified: sandbox/august/trunk/tests/Layer/WMS/Post.html
===================================================================
--- sandbox/august/trunk/tests/Layer/WMS/Post.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Layer/WMS/Post.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -16,8 +16,8 @@
t.plan( 2 );
var url = "http://octo.metacarta.com/cgi-bin/mapserv";
- var options = { unsupportedBrowsers: []};
- layer = new OpenLayers.Layer.WMS.Post(name, url, params);
+ var options = {unsupportedBrowsers: []};
+ layer = new OpenLayers.Layer.WMS.Post(name, url, params, options);
t.eq(
layer.usePost, true,
@@ -25,7 +25,7 @@
layer.destroy();
- var options = { unsupportedBrowsers: [OpenLayers.Util.getBrowserName()]};
+ var options = { unsupportedBrowsers: [OpenLayers.BROWSER_NAME]};
layer = new OpenLayers.Layer.WMS.Post(name, url, params, options);
t.eq(
layer.usePost, false,
@@ -55,11 +55,10 @@
}
map.destroy();
- var browserName = OpenLayers.Util.getBrowserName();
- var options = { unsupportedBrowsers: [browserName]};
-
// test the unsupported browser
- layer = new OpenLayers.Layer.WMS.Post(name, url, params, options);
+ layer = new OpenLayers.Layer.WMS.Post(name, url, params, {
+ unsupportedBrowsers: [OpenLayers.BROWSER_NAME]
+ });
map = new OpenLayers.Map('map');
map.addLayer(layer);
tile = layer.addTile(bounds, pixel);
@@ -69,8 +68,9 @@
layer.destroy();
// test a supported browser
- OpenLayers.Util.getBrowserName = function () { return 'not_' + browserName };
- layer = new OpenLayers.Layer.WMS.Post(name, url, params, options);
+ layer = new OpenLayers.Layer.WMS.Post(name, url, params, {
+ unsupportedBrowsers: []
+ });
map.addLayer(layer);
var tile2 = layer.addTile(bounds, pixel);
t.ok(
Modified: sandbox/august/trunk/tests/Layer/WMS.html
===================================================================
--- sandbox/august/trunk/tests/Layer/WMS.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Layer/WMS.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -230,15 +230,15 @@
function test_Layer_WMS_getFullRequestString (t) {
- t.plan( 2 );
+ t.plan( 3 );
var map = new OpenLayers.Map('map');
map.projection = "xx";
- tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
- tParams = { layers: 'basic',
+ var tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
+ var tParams = { layers: 'basic',
format: 'image/png'};
var tLayer = new OpenLayers.Layer.WMS(name, tUrl, tParams);
map.addLayer(tLayer);
- str = tLayer.getFullRequestString();
+ var str = tLayer.getFullRequestString();
var tParams = {
LAYERS: "basic", FORMAT: "image/png", SERVICE: "WMS",
VERSION: "1.1.1", REQUEST: "GetMap", STYLES: "",
@@ -257,6 +257,20 @@
tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
"getFullRequestString() by default does *not* add SRS value if projection is 'none'");
map.destroy();
+
+ map = new OpenLayers.Map("map", {projection: "EPSG:4326"});
+ var layerProj = new OpenLayers.Projection("FOO", {
+ equals: function() {return true},
+ getCode: function() {return "FOO"}
+ });
+ tLayer = new OpenLayers.Layer.WMS(name, tUrl, tParams, {projection: layerProj});
+ map.addLayer(tLayer);
+ str = tLayer.getFullRequestString();
+ tParams.SRS = "FOO";
+ t.eq(str,
+ tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
+ "getFullRequestString() uses the layer projection if it equals the map projection");
+ map.destroy();
}
@@ -289,7 +303,7 @@
var validkey = (window.location.protocol == "file:") ||
(window.location.host == "localhost") ||
(window.location.host == "openlayers.org");
- if (OpenLayers.Util.getBrowserName() == "opera" || OpenLayers.Util.getBrowserName() == "safari") {
+ if (OpenLayers.BROWSER_NAME == "opera" || OpenLayers.BROWSER_NAME == "safari") {
t.plan(1);
t.debug_print("Can't test google reprojection in Opera or Safari.");
} else if(validkey) {
Modified: sandbox/august/trunk/tests/Layer/XYZ.html
===================================================================
--- sandbox/august/trunk/tests/Layer/XYZ.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Layer/XYZ.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -148,6 +148,31 @@
map.destroy();
}
+ function test_Layer_XYZ_serverResolutions(t) {
+ t.plan(2);
+
+ var map = new OpenLayers.Map('map', {
+ resolutions: [13,11]
+ });
+
+ var layer = new OpenLayers.Layer.XYZ(name, url, options);
+ map.addLayer(layer);
+ map.setCenter(new OpenLayers.LonLat(0,0), 1);
+
+ var tileurl = layer.getURL(new OpenLayers.Bounds(0,0,0,0));
+ var level = parseInt(tileurl.split('/')[7]);
+ t.eq(map.getZoom(), level, "Tile zoom level is correct without serverResolutions");
+
+ layer.serverResolutions = [14,13,12,11,10];
+ tileurl = layer.getURL(new OpenLayers.Bounds(0,0,0,0));
+ level = parseInt(tileurl.split('/')[7]);
+ var res = map.getResolution();
+ var gotLevel = OpenLayers.Util.indexOf(layer.serverResolutions, res);
+ t.eq(gotLevel, level, "Tile zoom level is correct with serverResolutions");
+
+ map.destroy();
+ }
+
function test_zoomOffset(t) {
t.plan(2);
Modified: sandbox/august/trunk/tests/Marker/Box.html
===================================================================
--- sandbox/august/trunk/tests/Marker/Box.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Marker/Box.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -26,7 +26,7 @@
t.ok( box.bounds.equals(bounds), "bounds object correctly set");
t.ok( box.div != null, "div created");
//Safari 3 separates style overflow into overflow-x and overflow-y
- var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+ var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
t.eq( box.div.style[prop], "hidden", "div style overflow hidden");
t.ok( box.events != null, "events object created");
t.eq( g_Color, borderColor, "setBorder called with correct border color");
Deleted: sandbox/august/trunk/tests/OpenLayers.html
===================================================================
--- sandbox/august/trunk/tests/OpenLayers.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/OpenLayers.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -1,31 +0,0 @@
-<html>
-<head>
- <script src="bogus/1/OpenLayers.js-foo"></script>
- <script src="bogus/2/foo-OpenLayers.js"></script>
- <script id="script" src="../lib/OpenLayers.js"></script>
- <script type="text/javascript">
- function test_OpenLayers(t) {
- t.plan(3);
-
- var script = document.getElementById("script");
-
- t.eq(OpenLayers._getScriptLocation(), "../", "Script location correctly detected.");
-
- // create a clone of OpenLayers._getScriptLocation
- eval("var getScriptLocation = " + OpenLayers._getScriptLocation.toString());
- var scriptLocation;
-
- script.setAttribute("src", "../lib/OpenLayers.js?foo");
- t.eq(getScriptLocation(), "../", "Script location with search string correctly detected.");
- scriptLocation = null;
-
- // now pretend we're using a built script
- OpenLayers._scriptName = "OpenLayers.js";
- t.eq(getScriptLocation(), "../lib/", "not fooled by bogus paths");
-
- }
- </script>
-</head>
-<body>
-</body>
-</html>
Copied: sandbox/august/trunk/tests/OpenLayers1.html (from rev 10940, trunk/openlayers/tests/OpenLayers1.html)
===================================================================
--- sandbox/august/trunk/tests/OpenLayers1.html (rev 0)
+++ sandbox/august/trunk/tests/OpenLayers1.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,16 @@
+<html>
+<head>
+ <script src="../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ function test_OpenLayers(t) {
+ t.plan(1);
+
+ var script = document.getElementById("script");
+
+ t.eq(OpenLayers._getScriptLocation(), "../", "Script location correctly detected.");
+ }
+ </script>
+</head>
+<body>
+</body>
+</html>
Copied: sandbox/august/trunk/tests/OpenLayers2.html (from rev 10940, trunk/openlayers/tests/OpenLayers2.html)
===================================================================
--- sandbox/august/trunk/tests/OpenLayers2.html (rev 0)
+++ sandbox/august/trunk/tests/OpenLayers2.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,19 @@
+<html>
+<head>
+ <script src="bogus/1/OpenLayers.js-foo"></script>
+ <script src="bogus/2/foo-OpenLayers.js"></script>
+ <script src="../lib/OpenLayers.js?foo"></script>
+ <script src="bogus/3/after-OpenLayers.js"></script>
+ <script type="text/javascript">
+ function test_OpenLayers(t) {
+ t.plan(1);
+
+ var script = document.getElementById("script");
+
+ t.eq(OpenLayers._getScriptLocation(), "../", "Script location with search string correctly detected, and not fooled by other scripts.");
+ }
+ </script>
+</head>
+<body>
+</body>
+</html>
Copied: sandbox/august/trunk/tests/OpenLayers3.html (from rev 10940, trunk/openlayers/tests/OpenLayers3.html)
===================================================================
--- sandbox/august/trunk/tests/OpenLayers3.html (rev 0)
+++ sandbox/august/trunk/tests/OpenLayers3.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,19 @@
+<html>
+<head>
+ <script>
+ var OpenLayers = {singleFile: true};
+ </script>
+ <script src="../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ function test_OpenLayers(t) {
+ t.plan(1);
+
+ var script = document.getElementById("script");
+
+ t.eq(OpenLayers._getScriptLocation(), "../lib/", "Script location for single file build correctly detected.");
+ }
+ </script>
+</head>
+<body>
+</body>
+</html>
Copied: sandbox/august/trunk/tests/OpenLayers4.html (from rev 10940, trunk/openlayers/tests/OpenLayers4.html)
===================================================================
--- sandbox/august/trunk/tests/OpenLayers4.html (rev 0)
+++ sandbox/august/trunk/tests/OpenLayers4.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,18 @@
+<html>
+<head>
+ <script type="text/javascript">
+ OpenLayers = {singleFile: true}; // just to make the test run faster
+ document.write('<scr'+'ipt src="../lib/OpenLayers.js"></scr'+'ipt>');
+ document.write('<scr'+'ipt src="bogus/foo-/OpenLayers.js"></scr'+'ipt>');
+ </script>
+ <script type="text/javascript">
+ function test_OpenLayers(t) {
+ t.plan(1);
+ t.eq(OpenLayers._getScriptLocation(), "../lib/",
+ "Script location correctly detected, and not fooled by other scripts.");
+ }
+ </script>
+</head>
+<body>
+</body>
+</html>
Modified: sandbox/august/trunk/tests/Popup/Anchored.html
===================================================================
--- sandbox/august/trunk/tests/Popup/Anchored.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Popup/Anchored.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -11,7 +11,7 @@
popup = new OpenLayers.Popup.Anchored();
t.ok( popup instanceof OpenLayers.Popup.Anchored, "new OpenLayers.Popup.Anchored returns Popup.Anchored object" );
- t.ok(popup.id.startsWith("OpenLayers.Popup.Anchored"), "valid default popupid");
+ t.ok(OpenLayers.String.startsWith(popup.id, "OpenLayers.Popup.Anchored"), "valid default popupid");
var firstID = popup.id;
t.eq(popup.contentHTML, null, "good default popup.contentHTML");
Modified: sandbox/august/trunk/tests/Popup.html
===================================================================
--- sandbox/august/trunk/tests/Popup.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Popup.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -88,8 +88,8 @@
}
function test_Popup_keepInMap(t) {
- var gb = OpenLayers.Util.getBrowserName;
- OpenLayers.Util.getBrowserName = function() { return "mock"; }
+ var bn = OpenLayers.BROWSER_NAME;
+ OpenLayers.BROWSER_NAME = "mock";
t.plan(3);
var map = new OpenLayers.Map("map");
map.addLayer(new OpenLayers.Layer("", {isBaseLayer: true}));
@@ -120,7 +120,7 @@
t.ok(safeSizePan.equals(safeSizePanKeep), "Panning means that all sizes are equal");
t.ok(safeSize.w < safeSizePan.w, "Width of non-panning is less");
t.ok(safeSize.h < safeSizePan.h, "Height of non-panning is less");
- OpenLayers.Util.getBrowserName = gb;
+ OpenLayers.BROWSER_NAME = bn;
}
function test_Popup_draw(t) {
t.plan( 15 );
@@ -155,7 +155,7 @@
t.eq(contentDiv.id, "chicken_contentDiv", "correct content div id");
t.eq(contentDiv.style.position, "relative", "correct content div position");
//Safari 3 separates style overflow into overflow-x and overflow-y
- var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+ var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
t.eq(contentDiv.style[prop], "", "correct content div overflow");
t.eq(contentDiv.innerHTML, content, "correct content div content");
@@ -169,7 +169,7 @@
t.eq(popup.div.style.filter, "alpha(opacity=" + opacity*100 + ")", "good default popup.opacity");
}
//Safari 3 separates the border style into separate entities when reading it
- if (OpenLayers.Util.getBrowserName() == 'safari') {
+ if (OpenLayers.BROWSER_NAME == 'safari') {
var s = border.split(' ');
t.ok(popup.div.style.borderTopWidth == s[0] && popup.div.style.borderTopStyle == s[1], "good default popup.border")
} else {
Modified: sandbox/august/trunk/tests/Projection.html
===================================================================
--- sandbox/august/trunk/tests/Projection.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Projection.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -21,7 +21,47 @@
t.eq(projection.equals(null), false, "equals on null projection returns false");
t.eq(projection.equals({}), false, "equals on null projection object returns false (doesn't call getCode)");
- }
+ }
+
+ function test_Projection_equals(t) {
+ t.plan(8);
+ var origTransforms = OpenLayers.Util.extend({}, OpenLayers.Projection.transforms);
+ OpenLayers.Projection.addTransform("EPSG:4326", "FOO", OpenLayers.Projection.nullTransform);
+ OpenLayers.Projection.addTransform("FOO", "EPSG:4326", OpenLayers.Projection.nullTransform);
+ var projection = new OpenLayers.Projection("FOO");
+ t.eq(projection.equals(new OpenLayers.Projection("EPSG:4326")), true, "EPSG:4326 and FOO are equal without proj4js");
+ t.eq(projection.equals(new OpenLayers.Projection("EPSG:900913")), false, "EPSG:900913 and FOO are not equal without proj4js");
+ t.eq(new OpenLayers.Projection("EPSG:4326").equals(new OpenLayers.Projection("EPSG:4326")), true, "EPSG:4326 and EPSG:4326 are equal without proj4js");
+ t.eq(new OpenLayers.Projection("BAR").equals(new OpenLayers.Projection("EPSG:4326")), false, "Projection.equals() returns false for unknown projections withoug proj4js");
+ OpenLayers.Projection.transforms = origTransforms;
+
+ var proj1 = new OpenLayers.Projection("EPSG:4326");
+ var proj2 = new OpenLayers.Projection("FOO");
+ var proj3 = new OpenLayers.Projection("EPSG:900913");
+ var proj4 = new OpenLayers.Projection("EPSG:4326");
+ var proj5 = new OpenLayers.Projection("BAR");
+
+ // conditionally mock up proj4js
+ var hasProj = !!window.Proj4js;
+ if (!hasProj) {
+ window.Proj4js = true;
+ }
+ proj1.proj = {defData: "+title= WGS84 +foo=bar +x=0"};
+ proj2.proj = {defData: "+title=FOO +foo=bar +x=0", srsCode: "FOO"};
+ proj3.proj = {defData: "+title=Web Mercator +foo=bar +x=0 +I=am-different"};
+ proj4.proj = proj1.proj;
+ proj5.proj = {srsCode: "BAR"};
+
+ t.eq(proj2.equals(proj1), true, "EPSG:4326 and FOO are equal with proj4js");
+ t.eq(proj2.equals(proj3), false, "EPSG:900913 and FOO are not equal with proj4js");
+ t.eq(proj1.equals(proj4), true, "EPSG:4326 and EPSG:4326 are equal with proj4js");
+ t.eq(proj2.equals(proj5), false, "Projection.equals() returns false for unknown projections with proj4js");
+
+ if (!hasProj) {
+ delete window.Proj4js
+ }
+
+ }
</script>
</head>
Modified: sandbox/august/trunk/tests/Renderer/Canvas.html
===================================================================
--- sandbox/august/trunk/tests/Renderer/Canvas.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Renderer/Canvas.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -23,7 +23,7 @@
var extent = new OpenLayers.Bounds(1,2,3,4);
r.resolution = 1;
- r.setExtent(extent);
+ r.setExtent(extent, true);
t.ok(r.extent.equals(extent), "extent is correctly set");
t.eq(r.resolution, null, "resolution nullified");
}
Modified: sandbox/august/trunk/tests/Renderer/Elements.html
===================================================================
--- sandbox/august/trunk/tests/Renderer/Elements.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Renderer/Elements.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -561,8 +561,63 @@
tearDown();
}
+ function test_Elements_drawGeometry_3(t) {
+ t.plan(2);
+ setUp();
+ var r = create_renderer();
+
+ var element = document.createElement("div");
+ r.vectorRoot = element;
+
+ r.nodeFactory = function(id, type) {
+ return document.createElement("div");
+ };
+ var g_Node = null;
+ var b_Node = null;
+ r.drawGeometryNode = function(node, geometry, style) {
+ g_Node = node;
+ return {node: node, complete: true};
+ };
+ r.redrawBackgroundNode = function(id, geometry, style, featureId) {
+ b_Node = r.nodeFactory();
+ b_Node.id = "foo_background";
+ element.appendChild(b_Node);
+ };
+
+ r.getNodeType = function(geometry, style) {
+ return "div";
+ };
+ var geometry = {
+ id: 'foo',
+ CLASS_NAME: 'bar',
+ getBounds: function() {return {bottom: 0}}
+ };
+ var style = {'backgroundGraphic': 'foo'};
+ var featureId = 'dude';
+ r.drawGeometry(geometry, style, featureId);
+ t.ok(b_Node.parentNode == element, "redrawBackgroundNode appended background node");
+
+ var returnNode = function(id) {
+ return id == "foo_background" ? b_Node : g_Node;
+ }
+
+ var _getElement = document.getElementById;
+ document.getElementById = returnNode;
+ OpenLayers.Util.getElement = returnNode;
+
+ style = {};
+ r.drawGeometry(geometry, style, featureId);
+ t.ok(b_Node.parentNode != element, "background node correctly removed")
+
+ document.getElementById = _getElement;
+
+ tearDown();
+ }
+
+
+
</script>
</head>
<body>
Modified: sandbox/august/trunk/tests/Renderer/VML.html
===================================================================
--- sandbox/august/trunk/tests/Renderer/VML.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Renderer/VML.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -305,7 +305,7 @@
return;
}
- t.plan(2);
+ t.plan(3);
var r = new OpenLayers.Renderer.VML(document.body);
r.offset = {x: 0, y: 0};
@@ -318,30 +318,16 @@
var node = document.createElement('div');
- var linearRing = {
- components: [{
- x: 1,
- y: 2
- },{
- x: 3,
- y: 4
- }]
- };
- var linearRing2 = {
- components: [{
- x: 5,
- y: 6
- },{
- x: 7,
- y: 8
- }]
- };
- var geometry = {
- components: [linearRing, linearRing2]
- };
+ var geometry = OpenLayers.Geometry.fromWKT(
+ "POLYGON((1 2, 3 4), (5 6, 7 8))"
+ );
r.drawPolygon(node, geometry, true);
t.ok(g_SetNodeDimension, "setNodeDimension is called");
- t.eq(node.path, "m 2,4 l 6,8 x m 10,12 l 14,16 x e", "path attribute is correct");
+ t.eq(node.path, "m 2,4 l 6,8 2,4 x m 10,12 l 14,16 10,12 e", "path attribute is correct - inner ring has no area and is not closed");
+
+ geometry.components[1].addComponent(new OpenLayers.Geometry.Point(8, 7));
+ r.drawPolygon(node, geometry, true);
+ t.eq(node.path, "m 2,4 l 6,8 2,4 x m 10,12 l 14,16 16,14 10,12 x e", "path attribute is correct - inner ring has an area and is closed");
}
function test_VML_drawrectangle(t) {
Modified: sandbox/august/trunk/tests/Request.html
===================================================================
--- sandbox/august/trunk/tests/Request.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Request.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -372,19 +372,41 @@
}
function test_abort(t) {
+
t.plan(0);
- var fail = false;
- OpenLayers.Request.XMLHttpRequest.onsend = function(args) {
- fail = true;
- }
+
+ var sendCalled;
+
+ // set up
+
+ var _open = OpenLayers.Request.XMLHttpRequest.prototype.open;
+ OpenLayers.Request.XMLHttpRequest.prototype.open = function() {
+ this.readyState = OpenLayers.Request.XMLHttpRequest.OPENED;
+ };
+
+ var _setRequestHeader = OpenLayers.Request.XMLHttpRequest.prototype.setRequestHeader;
+ OpenLayers.Request.XMLHttpRequest.prototype.setRequestHeader = function() {};
+
+ var _send = OpenLayers.Request.XMLHttpRequest.prototype.send;
+ OpenLayers.Request.XMLHttpRequest.prototype.send = function() {
+ sendCalled = true;
+ };
+
+ // test
+
+ sendCalled = false;
+ OpenLayers.Request.issue().abort();
+
t.delay_call(0.5, function() {
- if (fail === true) {
+ if (sendCalled) {
t.fail("Send should not be called because request is aborted");
}
- OpenLayers.Request.XMLHttpRequest.onsend = null;
+
+ // tear down
+ OpenLayers.Request.XMLHttpRequest.prototype.open = _open;
+ OpenLayers.Request.XMLHttpRequest.prototype.setRequestHeader = _setRequestHeader;
+ OpenLayers.Request.XMLHttpRequest.prototype.send = _send;
});
- var protocol = new OpenLayers.Protocol.HTTP();
- protocol.abort(protocol.read());
}
</script>
Modified: sandbox/august/trunk/tests/Strategy/Filter.html
===================================================================
--- sandbox/august/trunk/tests/Strategy/Filter.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Strategy/Filter.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -21,7 +21,7 @@
function test_initialize(t) {
- t.plan(3);
+ t.plan(4);
var strategy = new OpenLayers.Strategy.Filter({filter: filter});
@@ -31,6 +31,14 @@
t.ok(strategy.filter === filter, "has filter");
strategy.destroy();
+
+ try {
+ strategy = new OpenLayers.Strategy.Filter();
+ t.ok(true, "strategy without filter works");
+ } catch (err) {
+ t.fail("strategy without filter should not throw");
+ }
+
}
Modified: sandbox/august/trunk/tests/Util.html
===================================================================
--- sandbox/august/trunk/tests/Util.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/Util.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -97,7 +97,7 @@
t.eq( div.style.position, position, "div.style.positionset correctly");
//Safari 3 separates the border style into separate entities when reading it
- if (OpenLayers.Util.getBrowserName() == 'safari') {
+ if (OpenLayers.BROWSER_NAME == 'safari') {
var s = border.split(' ');
t.ok(div.style.borderTopWidth == s[0] && div.style.borderTopStyle == s[1], "good default popup.border")
} else {
@@ -105,11 +105,11 @@
}
//Safari 3 separates style overflow into overflow-x and overflow-y
- var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+ var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
t.eq( div.style[prop], overflow, "div.style.overflow set correctly");
t.eq( parseFloat(div.style.opacity), opacity, "element.style.opacity set correctly");
//Safari 3 returns null for this value, which is okay
- var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+ var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
t.eq( div.style.filter, filterString, "element.style.filter set correctly");
//test defaults
@@ -130,13 +130,13 @@
t.eq( div.style.position, "absolute", "div.style.positionset correctly");
//Safari 3 separates the border style into separate entities when reading it
- if (OpenLayers.Util.getBrowserName() == 'safari') {
+ if (OpenLayers.BROWSER_NAME == 'safari') {
t.ok(div.style.borderTopWidth == '' && div.style.borderTopStyle == '', "good default popup.border")
} else {
t.eq( div.style.border, "", "div.style.border set correctly");
}
//Safari 3 separates style overflow into overflow-x and overflow-y
- var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+ var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
t.eq(div.style[prop], "", "div.style.overflow set correctly");
t.ok( !div.style.opacity, "element.style.opacity set correctly");
t.ok( !div.style.filter, "element.style.filter set correctly");
@@ -168,7 +168,7 @@
t.eq( image.style.height, sz.h + "px", "image.style.height set correctly");
//Safari 3 separates the border style into separate entities when reading it
- if (OpenLayers.Util.getBrowserName() == 'safari') {
+ if (OpenLayers.BROWSER_NAME == 'safari') {
var s = border.split(' ');
t.ok(image.style.borderTopWidth == s[0] && image.style.borderTopStyle == s[1], "good default popup.border")
} else {
@@ -178,7 +178,7 @@
t.eq( image.style.position, position, "image.style.position set correctly");
t.eq( parseFloat(image.style.opacity), opacity, "image.style.opacity set correctly");
//Safari 3 returns null for this value, which is okay
- var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+ var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
t.eq( image.style.filter, filterString, "element.style.filter set correctly");
//test defaults
@@ -369,7 +369,7 @@
filterString = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.openlayers.org/images/OpenLayers.trac.png', sizingMethod='crop') alpha(opacity=50)";
} else {
//Safari 3 returns null for this value, which is okay
- var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+ var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
}
t.eq( imageDiv.style.filter, filterString, "element.style.filter set correctly");
@@ -385,7 +385,7 @@
t.eq( image.style.height, sz.h + "px", "image.style.height set correctly");
//Safari 3 separates the border style into separate entities when reading it
- if (OpenLayers.Util.getBrowserName() == 'safari') {
+ if (OpenLayers.BROWSER_NAME == 'safari') {
var s = border.split(' ');
t.ok(image.style.borderTopWidth == s[0] && image.style.borderTopStyle == s[1], "good default popup.border")
} else {
@@ -437,7 +437,7 @@
t.eq(parseFloat(element.style.opacity), opacity,
"element.style.opacity set correctly when opacity = " + opacity);
//Safari 3 returns null for this value, which is okay
- var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+ var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
t.eq(element.style.filter, filterString,
"element.style.filter set correctly when opacity = " + opacity);
@@ -447,7 +447,7 @@
t.eq(parseFloat(element.style.opacity), opacity,
"element.style.opacity not changed if the value is incorrect");
//Safari 3 returns null for this value, which is okay
- var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+ var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
t.eq(element.style.filter, filterString,
"element.style.filter not changed if the value is incorrect");
@@ -457,7 +457,7 @@
t.eq(parseFloat(element.style.opacity), opacity,
"element.style.opacity not changed if the value is incorrect");
//Safari 3 returns null for this value, which is okay
- var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+ var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
t.eq(element.style.filter, filterString,
"element.style.filter not changed if the value is incorrect");
@@ -468,7 +468,7 @@
t.eq(element.style.opacity, '',
"element.style.opacity is removed when opacity = " + opacity);
//Safari 3 returns null for this value, which is okay
- var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : '';
+ var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : '';
t.eq(element.style.filter, filterString,
"element.style.filter is removed when opacity = " + opacity);
}
@@ -498,18 +498,18 @@
t.eq( element.style.position, position, "element.style.position set correctly");
//Safari 3 separates the border style into separate entities when reading it
- if (OpenLayers.Util.getBrowserName() == 'safari') {
+ if (OpenLayers.BROWSER_NAME == 'safari') {
var s = border.split(' ');
t.ok(element.style.borderTopWidth == s[0] && element.style.borderTopStyle == s[1], "good default popup.border")
} else {
t.ok( (element.style.border.indexOf(border) != -1), "element.style.border set correctly");
}
//Safari 3 separates style overflow into overflow-x and overflow-y
- var prop = (OpenLayers.Util.getBrowserName() == 'safari') ? 'overflowX' : 'overflow';
+ var prop = (OpenLayers.BROWSER_NAME == 'safari') ? 'overflowX' : 'overflow';
t.eq( element.style[prop], overflow, "element.style.overflow set correctly");
t.eq( parseFloat(element.style.opacity), opacity, "element.style.opacity set correctly");
//Safari 3 returns null for this value, which is okay
- var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+ var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
t.eq( element.style.filter, filterString, "element.style.filter set correctly");
}
@@ -553,7 +553,7 @@
t.ok( true, "skipping element test outside of Mozilla");
} else {
//Safari 3 returns null for this value, which is okay
- var filterString = (OpenLayers.Util.getBrowserName() == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
+ var filterString = (OpenLayers.BROWSER_NAME == 'safari') ? null : 'alpha(opacity=' + (opacity * 100) + ')';
t.ok( image.nodeName == "IMG", "createImage creates a valid HTMLImageElement" );
}
t.eq( imageDiv.style.filter, filterString, "element.style.filter set correctly");
@@ -563,7 +563,7 @@
t.eq( image.style.height, sz.h + "px", "image.style.height set correctly");
//Safari 3 separates the border style into separate entities when reading it
- if (OpenLayers.Util.getBrowserName() == 'safari') {
+ if (OpenLayers.BROWSER_NAME == 'safari') {
var s = border.split(' ');
t.ok(image.style.borderTopWidth == s[0] && image.style.borderTopStyle == s[1], "good default popup.border")
} else {
Modified: sandbox/august/trunk/tests/list-tests-2.html
===================================================================
--- sandbox/august/trunk/tests/list-tests-2.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/list-tests-2.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -1,15 +1,17 @@
<ul id="testlist">
<!--
<li>Format/AgsJsAdapter.html</li>
- -->
<li>Format/AgsJsAdapter_Renderer.html</li>
- <!--
<li>Format/WMTSCapabilities.html</li>
<li>Format/WMTSCapabilities/v1_0_0.html</li>
<li>Format/WFSTWithLock.html</li>
<li>Format/WFSTWithLock/v1.html</li>
<li>Format/WFSTWithLock/v1_0_0.html</li>
- <li>Format/WFSTWithLock/v1_1_0.html</li>
+ <li>Format/WFSTWithLock/v1_1_0.html</li>
+ -->
+ <li>Format/WPSCommon.html</li>
+ <li>Format/WPSCommon/v1_0_0.html</li>
+ <!--
<li>Protocol/WFSTWithLock.html</li>
<li>Strategy/SaveWithLock.html</li>
<li>Strategy/Lock.html</li>
Modified: sandbox/august/trunk/tests/list-tests.html
===================================================================
--- sandbox/august/trunk/tests/list-tests.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/list-tests.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -156,7 +156,10 @@
<li>Map.html</li>
<li>Marker.html</li>
<li>Marker/Box.html</li>
- <li>OpenLayers.html</li>
+ <li>OpenLayers1.html</li>
+ <li>OpenLayers2.html</li>
+ <li>OpenLayers3.html</li>
+ <li>OpenLayers4.html</li>
<li>Popup.html</li>
<li>Popup/Anchored.html</li>
<li>Popup/AnchoredBubble.html</li>
Copied: sandbox/august/trunk/tests/manual/page-position.html (from rev 10940, trunk/openlayers/tests/manual/page-position.html)
===================================================================
--- sandbox/august/trunk/tests/manual/page-position.html (rev 0)
+++ sandbox/august/trunk/tests/manual/page-position.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -0,0 +1,103 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>Page Position Test</title>
+
+ <link rel="stylesheet" href="../../theme/default/style.css" type="text/css" />
+ <link rel="stylesheet" href="../../examples/style.css" type="text/css" />
+ <style type="text/css">
+ #mapwrap {
+ border: 10px solid red;
+ width: 532px;
+ height: 276px;
+ }
+ #map {
+ position: absolute;
+ border: 10px solid #ccc;
+ width: 512px;
+ height: 256px;
+ }
+ #controlToggle li {
+ list-style: none;
+ }
+ p {
+ width: 512px;
+ }
+ #scrollspace {
+ height: 500px;
+ }
+ </style>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ var map, drawControls;
+ function init(){
+ map = new OpenLayers.Map('map');
+
+ var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
+ "http://vmap0.tiles.osgeo.org/wms/vmap0?", {layers: 'basic'});
+
+ var lineLayer = new OpenLayers.Layer.Vector("Line Layer");
+
+ map.addLayers([wmsLayer, lineLayer]);
+ map.addControl(new OpenLayers.Control.LayerSwitcher());
+ map.addControl(new OpenLayers.Control.MousePosition());
+
+ drawControl = new OpenLayers.Control.DrawFeature(lineLayer,
+ OpenLayers.Handler.Path);
+
+ map.addControl(drawControl);
+
+ map.setCenter(new OpenLayers.LonLat(0, 0), 3);
+
+ document.getElementById('noneToggle').checked = true;
+ }
+
+ function toggleControl(element) {
+ var control = drawControl;
+ if(element.value == "draw" && element.checked) {
+ control.activate();
+ } else {
+ control.deactivate();
+ }
+ }
+ </script>
+ </head>
+ <body onload="init()">
+ <h1 id="title">OpenLayers Page Position Test</h1>
+
+ <p id="shortdesc">
+ Test if borders and scroll position cause unwanted offsets on the
+ mouse positions reported by map events.
+ </p>
+ <div id="mapwrap">
+ <div id="map"></div>
+ </div>
+
+ <ul id="controlToggle">
+ <li>
+ <input type="radio" name="type" value="none" id="noneToggle"
+ onclick="toggleControl(this);" checked="checked" />
+ <label for="noneToggle">navigate</label>
+ </li>
+ <li>
+ <input type="radio" name="type" value="draw" id="lineToggle" onclick="toggleControl(this);" />
+ <label for="lineToggle">draw line</label>
+ </li>
+ </ul>
+
+ <div id="docs">
+ <p>This map's div has a border and absolute positioning, wrapped
+ by a container which also has a border. The page is also
+ scrollable. Neither the borders nor scrolling the page should
+ result in unwanted offsets on pixel positions reported by map
+ events.</p>
+ <p>With the line drawing control active, click on the map to add a
+ point. The point should be drawn at the exact mouse location.</p>
+ <p>With the navigation control active, shift-drag a zoom rectangle.
+ The rectangle's corner should align exactly with the mouse
+ cursor.</p>
+ <p>Scroll the page and repeat the above tests.</p>
+ <div id="scrollspace"><div>
+ </div>
+ </body>
+</html>
Modified: sandbox/august/trunk/tests/run-tests-2.html
===================================================================
--- sandbox/august/trunk/tests/run-tests-2.html 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tests/run-tests-2.html 2010-12-03 06:40:11 UTC (rev 10941)
@@ -1,7 +1,8 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><title> Run the testsuite</title>
<noscript>Javascript is disabled in your browser. This page cannot be displayed correctly without Javascript. Sorry. <br/> If you want to view this page, please change your browser settings so that Javascript is enabled.</noscript>
-<script type="text/javascript" src="Format/AgsJsAdapter_Renderer.js"></script>
+<script type="text/javascript" src="Format/WPSCommon.js"></script>
+<script type="text/javascript" src="Format/WPSCommon/v1_0_0.js"></script>
<!--
Test.AnotherWay version 0.5
Modified: sandbox/august/trunk/theme/default/style.css
===================================================================
--- sandbox/august/trunk/theme/default/style.css 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/theme/default/style.css 2010-12-03 06:40:11 UTC (rev 10941)
@@ -11,6 +11,7 @@
div.olLayerDiv {
-moz-user-select: none;
+ -khtml-user-select: none;
}
.olLayerGoogleCopyright {
@@ -322,6 +323,7 @@
.olControlNoSelect {
-moz-user-select: none;
+ -khtml-user-select: none;
}
.olImageLoadError {
Modified: sandbox/august/trunk/tools/mergejs.py
===================================================================
--- sandbox/august/trunk/tools/mergejs.py 2010-12-01 22:47:34 UTC (rev 10940)
+++ sandbox/august/trunk/tools/mergejs.py 2010-12-03 06:40:11 UTC (rev 10941)
@@ -94,6 +94,7 @@
[exclude]
3rd/logger.js
+ exclude/this/dir
All headings are required.
@@ -122,6 +123,20 @@
self.include = lines[lines.index("[include]") + 1:lines.index("[exclude]")]
self.exclude = lines[lines.index("[exclude]") + 1:]
+def undesired(filepath, excludes):
+ # exclude file if listed
+ exclude = filepath in excludes
+ if not exclude:
+ # check if directory is listed
+ for excludepath in excludes:
+ if not excludepath.endswith("/"):
+ excludepath += "/"
+ if filepath.startswith(excludepath):
+ exclude = True
+ break
+ return exclude
+
+
def run (sourceDirectory, outputFilename = None, configFile = None):
cfg = None
if configFile:
@@ -138,7 +153,7 @@
if cfg and cfg.include:
if filepath in cfg.include or filepath in cfg.forceFirst:
allFiles.append(filepath)
- elif (not cfg) or (filepath not in cfg.exclude):
+ elif (not cfg) or (not undesired(filepath, cfg.exclude)):
allFiles.append(filepath)
## Header inserted at the start of each file in the output
More information about the Commits
mailing list