[OpenLayers-Commits] r11763 - in sandbox/cmoullet/openlayers: .
build examples lib lib/OpenLayers/BaseTypes
lib/OpenLayers/Control lib/OpenLayers/Feature
lib/OpenLayers/Filter lib/OpenLayers/Format
lib/OpenLayers/Format/Filter lib/OpenLayers/Format/XLS
lib/OpenLayers/Handler lib/OpenLayers/Protocol
lib/OpenLayers/Renderer tests tests/BaseTypes tests/Control
tests/Format tests/Format/Filter tests/Format/XLS
tests/Handler tests/Protocol tests/manual theme/default tools
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Tue Mar 29 23:18:11 EDT 2011
Author: cmoullet
Date: 2011-03-29 20:18:10 -0700 (Tue, 29 Mar 2011)
New Revision: 11763
Added:
sandbox/cmoullet/openlayers/examples/openls.html
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/QueryStringFilter.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS/
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS/v1.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js
sandbox/cmoullet/openlayers/tests/Format/QueryStringFilter.html
sandbox/cmoullet/openlayers/tests/Format/XLS/
sandbox/cmoullet/openlayers/tests/Format/XLS/v1_1_0.html
sandbox/cmoullet/openlayers/tests/manual/box-quirks.html
sandbox/cmoullet/openlayers/tests/manual/box-strict.html
Removed:
sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/SimpleFilterSerializer.js
sandbox/cmoullet/openlayers/tests/Protocol/SimpleFilterSerializer.html
Modified:
sandbox/cmoullet/openlayers/
sandbox/cmoullet/openlayers/build/OpenLayers.js
sandbox/cmoullet/openlayers/examples/mobile-drawing.js
sandbox/cmoullet/openlayers/examples/proxy.cgi
sandbox/cmoullet/openlayers/examples/symbolizers-fill-stroke-graphic.html
sandbox/cmoullet/openlayers/lib/OpenLayers.js
sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Bounds.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Feature/Vector.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Filter/FeatureId.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Filter/v1.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Box.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Path.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Polygon.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/HTTP.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/Script.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Canvas.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/VML.js
sandbox/cmoullet/openlayers/tests/BaseTypes/Bounds.html
sandbox/cmoullet/openlayers/tests/Control/DrawFeature.html
sandbox/cmoullet/openlayers/tests/Control/PanZoomBar.html
sandbox/cmoullet/openlayers/tests/Feature.html
sandbox/cmoullet/openlayers/tests/Format/Filter/v1.html
sandbox/cmoullet/openlayers/tests/Handler/Box.html
sandbox/cmoullet/openlayers/tests/Handler/Path.html
sandbox/cmoullet/openlayers/tests/Handler/Point.html
sandbox/cmoullet/openlayers/tests/Handler/Polygon.html
sandbox/cmoullet/openlayers/tests/list-tests.html
sandbox/cmoullet/openlayers/theme/default/style.css
sandbox/cmoullet/openlayers/tools/mergejs.py
Log:
Merge with trunk and add OpenLS support with example
Property changes on: sandbox/cmoullet/openlayers
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11688,11690-11741
+ /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11688,11690-11762
Modified: sandbox/cmoullet/openlayers/build/OpenLayers.js
===================================================================
--- sandbox/cmoullet/openlayers/build/OpenLayers.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/build/OpenLayers.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -1007,7 +1007,8 @@
if(this.layerParams){OpenLayers.Util.applyDefaults(params,this.layerParams);}
var layer=null;var service=layerContext.service;if(service==OpenLayers.Format.Context.serviceTypes.WFS){options.strategies=[new OpenLayers.Strategy.BBOX()];options.protocol=new OpenLayers.Protocol.WFS({url:layerContext.url,featurePrefix:layerContext.name.split(":")[0],featureType:layerContext.name.split(":").pop()});layer=new OpenLayers.Layer.Vector(layerContext.title||layerContext.name,options);}else if(service==OpenLayers.Format.Context.serviceTypes.KML){options.strategies=[new OpenLayers.Strategy.Fixed()];options.protocol=new OpenLayers.Protocol.HTTP({url:layerContext.url,format:new OpenLayers.Format.KML()});layer=new OpenLayers.Layer.Vector(layerContext.title||layerContext.name,options);}else if(service==OpenLayers.Format.Context.serviceTypes.GML){options.strategies=[new OpenLayers.Strategy.Fixed()];options.protocol=new OpenLayers.Protocol.HTTP({url:layerContext.url,format:new OpenLayers.Format.GML()});layer=new OpenLayers.Layer.Vector(layerContext.title||layerContext.na
me,options);}else if(layerContext.features){layer=new OpenLayers.Layer.Vector(layerContext.title||layerContext.name,options);layer.addFeatures(layerContext.features);}else if(layerContext.categoryLayer!==true){layer=new OpenLayers.Layer.WMS(layerContext.title||layerContext.name,layerContext.url,params,options);}
return layer;},getLayersFromContext:function(layersContext){var layers=[];for(var i=0,len=layersContext.length;i<len;i++){var layer=this.getLayerFromContext(layersContext[i]);if(layer!==null){layers.push(layer);}}
-return layers;},contextToMap:function(context,options){options=OpenLayers.Util.applyDefaults({maxExtent:context.maxExtent,projection:context.projection},options);var map=new OpenLayers.Map(options);map.addLayers(this.getLayersFromContext(context.layersContext));map.setCenter(context.bounds.getCenterLonLat(),map.getZoomForExtent(context.bounds,true));return map;},mergeContextToMap:function(context,map){map.addLayers(this.getLayersFromContext(context.layersContext));return map;},write:function(obj,options){obj=this.toContext(obj);var version=options&&options.version;var parser=this.getParser(version);var context=parser.write(obj,options);return context;},CLASS_NAME:"OpenLayers.Format.Context"});OpenLayers.Format.Context.serviceTypes={"WMS":"urn:ogc:serviceType:WMS","WFS":"urn:ogc:serviceType:WFS","WCS":"urn:ogc:serviceType:WCS","GML":"urn:ogc:serviceType:GML","SLD":"urn:ogc:serviceType:SLD","FES":"urn:ogc:serviceType:FES","KML":"urn:ogc:serviceType:KML"};OpenLayers.Format.OWSC
ontext=OpenLayers.Class(OpenLayers.Format.Context,{defaultVersion:"0.3.1",getParser:function(version){var v=version||this.version||this.defaultVersion;if(v==="0.3.0"){v=this.defaultVersion;}
+return layers;},contextToMap:function(context,options){options=OpenLayers.Util.applyDefaults({maxExtent:context.maxExtent,projection:context.projection,units:context.units},options);if(options.maxExtent){options.maxResolution=options.maxExtent.getWidth()/OpenLayers.Map.TILE_WIDTH;}
+var map=new OpenLayers.Map(options);map.addLayers(this.getLayersFromContext(context.layersContext));map.setCenter(context.bounds.getCenterLonLat(),map.getZoomForExtent(context.bounds,true));return map;},mergeContextToMap:function(context,map){map.addLayers(this.getLayersFromContext(context.layersContext));return map;},write:function(obj,options){obj=this.toContext(obj);var version=options&&options.version;var parser=this.getParser(version);var context=parser.write(obj,options);return context;},CLASS_NAME:"OpenLayers.Format.Context"});OpenLayers.Format.Context.serviceTypes={"WMS":"urn:ogc:serviceType:WMS","WFS":"urn:ogc:serviceType:WFS","WCS":"urn:ogc:serviceType:WCS","GML":"urn:ogc:serviceType:GML","SLD":"urn:ogc:serviceType:SLD","FES":"urn:ogc:serviceType:FES","KML":"urn:ogc:serviceType:KML"};OpenLayers.Format.OWSContext=OpenLayers.Class(OpenLayers.Format.Context,{defaultVersion:"0.3.1",getParser:function(version){var v=version||this.version||this.defaultVersion;if(v==="0.3
.0"){v=this.defaultVersion;}
if(!this.parser||this.parser.VERSION!=v){var format=OpenLayers.Format.OWSContext["v"+v.replace(/\./g,"_")];if(!format){throw"Can't find a OWSContext parser for version "+v;}
this.parser=new format(this.options);}
return this.parser;},toContext:function(obj){var context={};if(obj.CLASS_NAME=="OpenLayers.Map"){context.bounds=obj.getExtent();context.maxExtent=obj.maxExtent;context.projection=obj.projection;context.size=obj.getSize();context.layers=obj.layers;}
@@ -1136,7 +1137,8 @@
var from=this.getPixelFromLonLat(center);var to=this.getPixelFromLonLat(lonlat);var vector={x:to.x-from.x,y:to.y-from.y};var last={x:0,y:0};this.panTween.start({x:0,y:0},vector,this.panDuration,{callbacks:{eachStep:OpenLayers.Function.bind(function(px){var x=px.x-last.x,y=px.y-last.y;this.moveByPx(x,y);last.x=Math.round(px.x);last.y=Math.round(px.y);},this),done:OpenLayers.Function.bind(function(px){this.moveTo(lonlat);this.dragging=false;this.events.triggerEvent("moveend");},this)}});}else{this.setCenter(lonlat);}},setCenter:function(lonlat,zoom,dragging,forceZoomChange){this.panTween&&this.panTween.stop();this.moveTo(lonlat,zoom,{'dragging':dragging,'forceZoomChange':forceZoomChange});},moveByPx:function(dx,dy){dx=Math.round(dx);dy=Math.round(dy);var hw=this.size.w/2;var hh=this.size.h/2;var x=hw+dx;var y=hh+dy;var wrapDateLine=this.baseLayer.wrapDateLine;var xRestriction=0;var yRestriction=0;if(this.restrictedExtent){xRestriction=hw;yRestriction=hh;wrapDateLine=false;}
var valid=y<=this.maxPx.y-yRestriction&&y>=this.minPx.y+yRestriction;var minX=this.minPx.x,maxX=this.maxPx.x;if(!wrapDateLine){valid=valid&&x<=this.maxPx.x-xRestriction&&x>=this.minPx.x+xRestriction;}
if(valid){if(!this.dragging){this.dragging=true;this.events.triggerEvent("movestart");}
-this.center=null;if(dx){this.layerContainerDiv.style.left=parseInt(this.layerContainerDiv.style.left)-dx+"px";this.minPx.x-=dx;this.maxPx.x-=dx;if(wrapDateLine){if(this.maxPx.x>maxX){this.maxPx.x-=(maxX-minX);};if(this.minPx.x<minX){this.minPx.x+=(maxX-minX);};}}
+this.center=null;if(dx){this.layerContainerDiv.style.left=parseInt(this.layerContainerDiv.style.left)-dx+"px";this.minPx.x-=dx;this.maxPx.x-=dx;if(wrapDateLine){if(this.maxPx.x>maxX){this.maxPx.x-=(maxX-minX);}
+if(this.minPx.x<minX){this.minPx.x+=(maxX-minX);}}}
if(dy){this.layerContainerDiv.style.top=parseInt(this.layerContainerDiv.style.top)-dy+"px";this.minPx.y-=dy;this.maxPx.y-=dy;}
var layer,i,len;for(i=0,len=this.layers.length;i<len;++i){layer=this.layers[i];if(layer.visibility){layer.moveByPx(dx,dy);layer.events.triggerEvent("move");}}
this.events.triggerEvent("move");}},moveTo:function(lonlat,zoom,options){if(!options){options={};}
@@ -1370,7 +1372,7 @@
maxExtent.bottom)/tileMapHeight));return new OpenLayers.Bounds(tileLeft,tileBottom,tileLeft+tileMapWidth,tileBottom+tileMapHeight);},CLASS_NAME:"OpenLayers.Layer.Grid"});OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(layer,position,bounds,url,size,options){this.layer=layer;this.position=position.clone();this.bounds=bounds.clone();this.url=url;this.size=size.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);OpenLayers.Util.extend(this,options);},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload");}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;this.events.destroy();this.events=null;},clone:function(obj){if(obj==null){obj=new OpenLayers.Tile(this.layer,this.position,this.bounds,t
his.url,this.size);}
OpenLayers.Util.applyDefaults(obj,this);return obj;},draw:function(){var maxExtent=this.layer.maxExtent;var withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));this.shouldDraw=(withinMaxExtent||this.layer.displayOutsideMaxExtent);this.clear();return this.shouldDraw;},moveTo:function(bounds,position,redraw){if(redraw==null){redraw=true;}
this.bounds=bounds.clone();this.position=position.clone();if(redraw){this.draw();}},clear:function(){},getBoundsFromBaseLayer:function(position){var msg=OpenLayers.i18n('reprojectDeprecated',{'layerName':this.layer.name});OpenLayers.Console.warn(msg);var topLeft=this.layer.map.getLonLatFromLayerPx(position);var bottomRightPx=position.clone();bottomRightPx.x+=this.size.w;bottomRightPx.y+=this.size.h;var bottomRight=this.layer.map.getLonLatFromLayerPx(bottomRightPx);if(topLeft.lon>bottomRight.lon){if(topLeft.lon<0){topLeft.lon=-180-(topLeft.lon+180);}else{bottomRight.lon=180+bottomRight.lon+180;}}
-var bounds=new OpenLayers.Bounds(topLeft.lon,bottomRight.lat,bottomRight.lon,topLeft.lat);return bounds;},showTile:function(){if(this.shouldDraw){this.show();}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,maxGetUrlLength:null,initialize:function(layer,position,bounds,url,size,options){OpenLayers.Tile.prototype.initialize.apply(this,arguments);if(this.maxGetUrlLength!=null){OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame);}
+var bounds=new OpenLayers.Bounds(topLeft.lon,bottomRight.lat,bottomRight.lon,topLeft.lat);return bounds;},showTile:function(){if(this.shouldDraw){this.show();}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,isFirstDraw:true,backBufferTile:null,maxGetUrlLength:null,initialize:function(layer,position,bounds,url,size,options){OpenLayers.Tile.prototype.initialize.apply(this,arguments);if(this.maxGetUrlLength!=null){OpenLayers.Util.extend(this,OpenLayers.Tile.Image.IFrame);}
this.url=url;this.frame=document.createElement('div');this.frame.style.overflow='hidden';this.frame.style.position='absolute';this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();},destroy:function(){if(this.imgDiv!=null){this.removeImgDiv();}
this.imgDiv=null;if((this.frame!=null)&&(this.frame.parentNode==this.layer.div)){this.layer.div.removeChild(this.frame);}
this.frame=null;if(this.backBufferTile){this.backBufferTile.destroy();this.backBufferTile=null;}
@@ -1391,9 +1393,8 @@
this.imgDiv.viewRequestID=this.layer.map.viewRequestID;},removeImgDiv:function(){OpenLayers.Event.stopObservingElement(this.imgDiv);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null;}
this.imgDiv.urls=null;var child=this.imgDiv.firstChild;if(child){OpenLayers.Event.stopObservingElement(child);this.imgDiv.removeChild(child);delete child;}else{this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif";}},checkImgURL:function(){if(this.layer){var loaded=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;if(!OpenLayers.Util.isEquivalentUrl(loaded,this.url)){this.hide();}}},startTransition:function(){if(!this.backBufferTile||!this.backBufferTile.imgDiv){return;}
var ratio=1;if(this.backBufferTile.resolution){ratio=this.backBufferTile.resolution/this.layer.getResolution();}
-if(ratio!=this.lastRatio){if(this.layer.transitionEffect=='resize'){var upperLeft=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var size=new OpenLayers.Size(this.backBufferTile.size.w*ratio,this.backBufferTile.size.h*ratio);var px=this.layer.map.getLayerPxFromLonLat(upperLeft);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,px,size);var imageSize=this.backBufferTile.imageSize;imageSize=new OpenLayers.Size(imageSize.w*ratio,imageSize.h*ratio);var imageOffset=this.backBufferTile.imageOffset;if(imageOffset){imageOffset=new OpenLayers.Pixel(imageOffset.x*ratio,imageOffset.y*ratio);}
-OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,imageOffset,imageSize);this.backBufferTile.show();}}else{if(this.layer.singleTile){this.backBufferTile.show();}else{this.backBufferTile.hide();}}
-this.lastRatio=ratio;},show:function(){this.frame.style.display='';if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(OpenLayers.IS_GECKO===true){this.frame.scrollLeft=this.frame.scrollLeft;}}},hide:function(){this.frame.style.display='none';},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.BROWSER_NAME=="safari"||OpenLayers.BROWSER_NAME=="opera");OpenLayers.Format.ArcXML=OpenLayers.Class(OpenLayers.Format.XML,{fontStyleKeys:['antialiasing','blockout','font','fontcolor','fontsize','fontstyle','glowing','interval','outline','printmode','shadow','transparency'],request:null,response:null,initialize:function(options){this.request=new OpenLayers.Format.ArcXML.Request();this.response=new OpenLayers.Format.ArcXML.Response();if(options){if(options.requesttype=="feature"){this.request.get_image=null;var qry=this.request.get_feature.query;this.addCoordSys(qry.featurecoordsys,options.featureCoordSys);thi
s.addCoordSys(qry.filtercoordsys,options.filterCoordSys);if(options.polygon){qry.isspatial=true;qry.spatialfilter.polygon=options.polygon;}else if(options.envelope){qry.isspatial=true;qry.spatialfilter.envelope={minx:0,miny:0,maxx:0,maxy:0};this.parseEnvelope(qry.spatialfilter.envelope,options.envelope);}}else if(options.requesttype=="image"){this.request.get_feature=null;var props=this.request.get_image.properties;this.parseEnvelope(props.envelope,options.envelope);this.addLayers(props.layerlist,options.layers);this.addImageSize(props.imagesize,options.tileSize);this.addCoordSys(props.featurecoordsys,options.featureCoordSys);this.addCoordSys(props.filtercoordsys,options.filterCoordSys);}else{this.request=null;}}
+if(ratio!=1){if(this.layer.transitionEffect=='resize'){var upperLeft=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var size=new OpenLayers.Size(this.backBufferTile.size.w*ratio,this.backBufferTile.size.h*ratio);var px=this.layer.map.getLayerPxFromLonLat(upperLeft);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,px,size);var imageSize=this.backBufferTile.imageSize;imageSize=new OpenLayers.Size(imageSize.w*ratio,imageSize.h*ratio);var imageOffset=this.backBufferTile.imageOffset;if(imageOffset){imageOffset=new OpenLayers.Pixel(imageOffset.x*ratio,imageOffset.y*ratio);}
+OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,imageOffset,imageSize);this.backBufferTile.show();}}else{if(this.layer.singleTile){this.backBufferTile.show();}else{this.backBufferTile.hide();}}},show:function(){this.frame.style.display='';if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(OpenLayers.IS_GECKO===true){this.frame.scrollLeft=this.frame.scrollLeft;}}},hide:function(){this.frame.style.display='none';},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.BROWSER_NAME=="safari"||OpenLayers.BROWSER_NAME=="opera");OpenLayers.Format.ArcXML=OpenLayers.Class(OpenLayers.Format.XML,{fontStyleKeys:['antialiasing','blockout','font','fontcolor','fontsize','fontstyle','glowing','interval','outline','printmode','shadow','transparency'],request:null,response:null,initialize:function(options){this.request=new OpenLayers.Format.ArcXML.Request();this.response=new OpenLayers.Format.ArcXML.R
esponse();if(options){if(options.requesttype=="feature"){this.request.get_image=null;var qry=this.request.get_feature.query;this.addCoordSys(qry.featurecoordsys,options.featureCoordSys);this.addCoordSys(qry.filtercoordsys,options.filterCoordSys);if(options.polygon){qry.isspatial=true;qry.spatialfilter.polygon=options.polygon;}else if(options.envelope){qry.isspatial=true;qry.spatialfilter.envelope={minx:0,miny:0,maxx:0,maxy:0};this.parseEnvelope(qry.spatialfilter.envelope,options.envelope);}}else if(options.requesttype=="image"){this.request.get_feature=null;var props=this.request.get_image.properties;this.parseEnvelope(props.envelope,options.envelope);this.addLayers(props.layerlist,options.layers);this.addImageSize(props.imagesize,options.tileSize);this.addCoordSys(props.featurecoordsys,options.featureCoordSys);this.addCoordSys(props.filtercoordsys,options.filterCoordSys);}else{this.request=null;}}
OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},parseEnvelope:function(env,arr){if(arr&&arr.length==4){env.minx=arr[0];env.miny=arr[1];env.maxx=arr[2];env.maxy=arr[3];}},addLayers:function(ll,lyrs){for(var lind=0,len=lyrs.length;lind<len;lind++){ll.push(lyrs[lind]);}},addImageSize:function(imsize,olsize){if(olsize!==null){imsize.width=olsize.w;imsize.height=olsize.h;imsize.printwidth=olsize.w;imsize.printheight=olsize.h;}},addCoordSys:function(featOrFilt,fsys){if(typeof fsys=="string"){featOrFilt.id=parseInt(fsys);featOrFilt.string=fsys;}
else if(typeof fsys=="object"&&fsys.proj!==null){featOrFilt.id=fsys.proj.srsProjNumber;featOrFilt.string=fsys.proj.srsCode;}else{featOrFilt=fsys;}},iserror:function(data){var ret=null;if(!data){ret=(this.response.error!=='');}else{data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);var errorNodes=data.documentElement.getElementsByTagName("ERROR");ret=(errorNodes!==null&&errorNodes.length>0);}
return ret;},read:function(data){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}
@@ -2037,7 +2038,23 @@
node.appendChild(style);}}
return node;},write_wmc_OnlineResource:function(href){var node=this.createElementDefaultNS("OnlineResource");this.setAttributeNS(node,this.namespaces.xlink,"xlink:type","simple");this.setAttributeNS(node,this.namespaces.xlink,"xlink:href",href);return node;},CLASS_NAME:"OpenLayers.Format.WMC.v1"});OpenLayers.Format.WMC.v1_1_0=OpenLayers.Class(OpenLayers.Format.WMC.v1,{VERSION:"1.1.0",schemaLocation:"http://www.opengis.net/context http://schemas.opengis.net/context/1.1.0/context.xsd",initialize:function(options){OpenLayers.Format.WMC.v1.prototype.initialize.apply(this,[options]);},read_sld_MinScaleDenominator:function(layerContext,node){var minScaleDenominator=parseFloat(this.getChildValue(node));if(minScaleDenominator>0){layerContext.maxScale=minScaleDenominator;}},read_sld_MaxScaleDenominator:function(layerContext,node){layerContext.minScale=parseFloat(this.getChildValue(node));},write_wmc_Layer:function(context){var node=OpenLayers.Format.WMC.v1.prototype.write_wmc_Layer.a
pply(this,[context]);if(context.maxScale){var minSD=this.createElementNS(this.namespaces.sld,"sld:MinScaleDenominator");minSD.appendChild(this.createTextNode(context.maxScale.toPrecision(16)));node.appendChild(minSD);}
if(context.minScale){var maxSD=this.createElementNS(this.namespaces.sld,"sld:MaxScaleDenominator");maxSD.appendChild(this.createTextNode(context.minScale.toPrecision(16)));node.appendChild(maxSD);}
-node.appendChild(this.write_wmc_FormatList(context));node.appendChild(this.write_wmc_StyleList(context));node.appendChild(this.write_wmc_LayerExtension(context));return node;},CLASS_NAME:"OpenLayers.Format.WMC.v1_1_0"});OpenLayers.Lang["sk"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Neobslúžené požiadavky vracajú ${statusText}",'permalink':"Trvalý odkaz",'overlays':"Prekrytia",'baseLayer':"Základná vrstva",'sameProjection':"Prehľadová mapka funguje iba vtedy, keď je v rovnakej projekcii ako hlavná mapa",'readNotImplemented':"Čítanie nie je implementované.",'writeNotImplemented':"Zápis nie je implementovaný.",'noFID':"Nie je možné aktualizovať vlastnosť, pre ktorú neexistuje FID.",'errorLoadingGML':"Chyba pri načítaní súboru GML ${url}",'browserNotSupported':"Váš prehliadač nepodporuje vykresľovanie vektorov. Momentálne podporované vykresľovače sú:\n${renderers}",'componentShouldBe':"addFeatures: komponent by mal byť ${geomType}",'
getFeatureError':"getFeatureFromEvent bola zavolaná na vrstve bez vykresľovača. To zvyčajne znamená, že ste odstránili vrstvu, ale nie niektorú z obslúh, ktorá je s ňou asociovaná.",'minZoomLevelError':"Vlastnosť minZoomLevel je určený iba na použitie s vrstvami odvodenými od FixedZoomLevels. To, že táto wfs vrstva kontroluje minZoomLevel je pozostatok z minulosti. Nemôžeme ho však odstrániť, aby sme sa vyhli možnému porušeniu aplikácií založených na Open Layers, ktoré na tomto môže závisieť. Preto ho označujeme ako zavrhovaný - dolu uvedená kontrola minZoomLevel bude odstránená vo verzii 3.0. Použite prosím namiesto toho kontrolu min./max. rozlíšenia podľa tu uvedeného popisu: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transakcia WFS: ÚSPEŠNÁ ${response}",'commitFailed':"Transakcia WFS: ZLYHALA ${response}",'googleWarning':"Vrstvu Google nebolo možné správne načítať.\x3cbr\x3e\x3cbr\x3eAby ste
sa tejto správy zbavili vyberte novú BaseLayer v prepínači vrstiev v pravom hornom rohu.\x3cbr\x3e\x3cbr\x3eToto sa stalo pravdepodobne preto, že skript knižnice Google Maps buď nebol načítaný alebo neobsahuje správny kľúč API pre vašu lokalitu.\x3cbr\x3e\x3cbr\x3eVývojári: Tu môžete získať \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3epomoc so sfunkčnením\x3c/a\x3e",'getLayerWarning':"Vrstvu ${layerType} nebolo možné správne načítať.\x3cbr\x3e\x3cbr\x3eAby ste sa tejto správy zbavili vyberte novú BaseLayer v prepínači vrstiev v pravom hornom rohu.\x3cbr\x3e\x3cbr\x3eToto sa stalo pravdepodobne preto, že skript knižnice ${layerType} buď nebol načítaný alebo neobsahuje správny kľúč API pre vašu lokalitu.\x3cbr\x3e\x3cbr\x3eVývojári: Tu môžete získať \x3ca href=\'http://trac.openlayers.org/wiki/${layerType}\' target=\'_blank\'\x3epomoc so sfunkčnením\x3c/a\x3e",'scale':"Mierka = 1 : ${scaleDenom}"
,'layerAlreadyAdded':"Pokúsili ste sa do mapy pridať vrstvu ${layerName}, ale tá už bola pridaná",'reprojectDeprecated':"Používate voľby „reproject“ vrstvy ${layerType}. Táto voľba je zzavrhovaná: jej použitie bolo navrhnuté na podporu zobrazovania údajov nad komerčnými základovými mapami, ale túto funkcionalitu je teraz možné dosiahnuť pomocou Spherical Mercator. Ďalšie informácie získate na stránke http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Táto metóda je zavrhovaná a bude odstránená vo verzii 3.0. Použite prosím namiesto nej metódu ${newMethod}.",'boundsAddError':"Sčítacej funkcii musíte dať hodnoty x aj y.",'lonlatAddError':"Sčítacej funkcii musíte dať hodnoty lon (zem. dĺžka) aj lat (zem. šírka).",'pixelAddError':"Sčítacej funkcii musíte dať hodnoty x aj y.",'unsupportedGeometryType':"Nepodporovaný typ geometrie: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition zlyhalo: p
rvok s id ${elemId} môže byť zle umiestnený.",'filterEvaluateNotImplemented':"evaluate nie je implementovaný pre tento typ filtra"});OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolMetrics:null,initialize:function(containerID){if(!this.supported()){return;}
+node.appendChild(this.write_wmc_FormatList(context));node.appendChild(this.write_wmc_StyleList(context));node.appendChild(this.write_wmc_LayerExtension(context));return node;},CLASS_NAME:"OpenLayers.Format.WMC.v1_1_0"});OpenLayers.Format.XLS=OpenLayers.Class(OpenLayers.Format.XML,{defaultVersion:"1.1.0",version:null,parser:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},write:function(request,options){var version=(options&&options.version)||this.version||this.defaultVersion;if(!this.parser||this.parser.VERSION!=version){var format=OpenLayers.Format.XLS["v"+version.replace(/\./g,"_")];if(!format){throw"Can't find an XLS parser for version "+
+version;}
+this.parser=new format(this.options);}
+var root=this.parser.write(request);return OpenLayers.Format.XML.prototype.write.apply(this,[root]);},read:function(data,options){if(typeof data=="string"){data=OpenLayers.Format.XML.prototype.read.apply(this,[data]);}
+var root=data.documentElement;var version=this.version;if(!version){version=root.getAttribute("version");if(!version){version=this.defaultVersion;}}
+if(!this.parser||this.parser.VERSION!=version){var format=OpenLayers.Format.XLS["v"+version.replace(/\./g,"_")];if(!format){throw"Can't find an XLS parser for version "+
+version;}
+this.parser=new format(this.options);}
+var xls=this.parser.read(data,options);return xls;},CLASS_NAME:"OpenLayers.Format.XLS"});OpenLayers.Format.XLS.v1=OpenLayers.Class(OpenLayers.Format.XML,{namespaces:{xls:"http://www.opengis.net/xls",gml:"http://www.opengis.net/gml",xsi:"http://www.w3.org/2001/XMLSchema-instance"},regExes:{trimSpace:(/^\s*|\s*$/g),removeSpace:(/\s*/g),splitSpace:(/\s+/),trimComma:(/\s*,\s*/g)},xy:true,defaultPrefix:"xls",schemaLocation:null,initialize:function(options){OpenLayers.Format.XML.prototype.initialize.apply(this,[options]);},read:function(data,options){options=OpenLayers.Util.applyDefaults(options,this.options);var xls={};this.readChildNodes(data,xls);return xls;},readers:{"xls":{"XLS":function(node,xls){xls.version=node.getAttribute("version");this.readChildNodes(node,xls);},"Response":function(node,xls){this.readChildNodes(node,xls);},"GeocodeResponse":function(node,xls){xls.responseLists=[];this.readChildNodes(node,xls);},"GeocodeResponseList":function(node,xls){var responseList=
{features:[],numberOfGeocodedAddresses:parseInt(node.getAttribute("numberOfGeocodedAddresses"))};xls.responseLists.push(responseList);this.readChildNodes(node,responseList);},"GeocodedAddress":function(node,responseList){var feature=new OpenLayers.Feature.Vector();responseList.features.push(feature);this.readChildNodes(node,feature);feature.geometry=feature.components[0];},"GeocodeMatchCode":function(node,feature){feature.attributes.matchCode={accuracy:parseFloat(node.getAttribute("accuracy")),matchType:node.getAttribute("matchType")};},"Address":function(node,feature){var address={countryCode:node.getAttribute("countryCode"),addressee:node.getAttribute("addressee"),street:[],place:[]};feature.attributes.address=address;this.readChildNodes(node,address);},"freeFormAddress":function(node,address){address.freeFormAddress=this.getChildValue(node);},"StreetAddress":function(node,address){this.readChildNodes(node,address);},"Building":function(node,address){address.building={'num
ber':node.getAttribute("number"),subdivision:node.getAttribute("subdivision"),buildingName:node.getAttribute("buildingName")};},"Street":function(node,address){address.street.push(this.getChildValue(node));},"Place":function(node,address){address.place[node.getAttribute("type")]=this.getChildValue(node);},"PostalCode":function(node,address){address.postalCode=this.getChildValue(node);}},"gml":OpenLayers.Format.GML.v3.prototype.readers.gml},write:function(request){return this.writers.xls.XLS.apply(this,[request]);},writers:{"xls":{"XLS":function(request){var root=this.createElementNSPlus("xls:XLS",{attributes:{"version":this.VERSION,"xsi:schemaLocation":this.schemaLocation}});this.writeNode("RequestHeader",request.header,root);this.writeNode("Request",request,root);return root;},"RequestHeader":function(header){return this.createElementNSPlus("xls:RequestHeader");},"Request":function(request){var node=this.createElementNSPlus("xls:Request",{attributes:{methodName:"GeocodeRequ
est",requestID:request.requestID||"",version:this.VERSION}});this.writeNode("GeocodeRequest",request.addresses,node);return node;},"GeocodeRequest":function(addresses){var node=this.createElementNSPlus("xls:GeocodeRequest");for(var i=0,len=addresses.length;i<len;i++){this.writeNode("Address",addresses[i],node);}
+return node;},"Address":function(address){var node=this.createElementNSPlus("xls:Address",{attributes:{countryCode:address.countryCode}});if(address.freeFormAddress){this.writeNode("freeFormAddess",address.freeFormAddress,node);}else{if(address.street){this.writeNode("StreetAddress",address,node);}
+if(address.municipality){this.writeNode("Municipality",address.municipality,node);}
+if(address.countrySubdivision){this.writeNode("CountrySubdivision",address.countrySubdivision,node);}
+if(address.postalCode){this.writeNode("PostalCode",address.postalCode,node);}}
+return node;},"freeFormAddress":function(freeFormAddress){return this.createElementNSPlus("freeFormAddress",{value:freeFormAddress});},"StreetAddress":function(address){var node=this.createElementNSPlus("xls:StreetAddress");if(address.building){this.writeNode(node,"Building",address.building);}
+var street=address.street;if(!(street instanceof Array)){street=[street];}
+for(var i=0,len=street.length;i<len;i++){this.writeNode("Street",street[i],node);}
+return node;},"Building":function(building){return this.createElementNSPlus("xls:Building",{attributes:{"number":building["number"],"subdivision":building.subdivision,"buildingName":building.buildingName}});},"Street":function(street){return this.createElementNSPlus("xls:Street",{value:street});},"Municipality":function(municipality){return this.createElementNSPlus("xls:Place",{attributes:{type:"Municipality"},value:municipality});},"CountrySubdivision":function(countrySubdivision){return this.createElementNSPlus("xls:Place",{attributes:{type:"CountrySubdivision"},value:countrySubdivision});},"PostalCode":function(postalCode){return this.createElementNSPlus("xls:PostalCode",{value:postalCode});}}},CLASS_NAME:"OpenLayers.Format.XLS.v1"});OpenLayers.Format.XLS.v1_1_0=OpenLayers.Class(OpenLayers.Format.XLS.v1,{VERSION:"1.1",schemaLocation:"http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd",initialize:function(options){OpenLayers.Format.X
LS.v1.prototype.initialize.apply(this,[options]);},CLASS_NAME:"OpenLayers.Format.XLS.v1_1_0"});OpenLayers.Lang["sk"]=OpenLayers.Util.applyDefaults({'unhandledRequest':"Neobslúžené požiadavky vracajú ${statusText}",'permalink':"Trvalý odkaz",'overlays':"Prekrytia",'baseLayer':"Základná vrstva",'sameProjection':"Prehľadová mapka funguje iba vtedy, keď je v rovnakej projekcii ako hlavná mapa",'readNotImplemented':"Čítanie nie je implementované.",'writeNotImplemented':"Zápis nie je implementovaný.",'noFID':"Nie je možné aktualizovať vlastnosť, pre ktorú neexistuje FID.",'errorLoadingGML':"Chyba pri načítaní súboru GML ${url}",'browserNotSupported':"Váš prehliadač nepodporuje vykresľovanie vektorov. Momentálne podporované vykresľovače sú:\n${renderers}",'componentShouldBe':"addFeatures: komponent by mal byť ${geomType}",'getFeatureError':"getFeatureFromEvent bola zavolaná na vrstve bez vykresľovača. To zvyčajne znamená, že ste odstránili
vrstvu, ale nie niektorú z obslúh, ktorá je s ňou asociovaná.",'minZoomLevelError':"Vlastnosť minZoomLevel je určený iba na použitie s vrstvami odvodenými od FixedZoomLevels. To, že táto wfs vrstva kontroluje minZoomLevel je pozostatok z minulosti. Nemôžeme ho však odstrániť, aby sme sa vyhli možnému porušeniu aplikácií založených na Open Layers, ktoré na tomto môže závisieť. Preto ho označujeme ako zavrhovaný - dolu uvedená kontrola minZoomLevel bude odstránená vo verzii 3.0. Použite prosím namiesto toho kontrolu min./max. rozlíšenia podľa tu uvedeného popisu: http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transakcia WFS: ÚSPEŠNÁ ${response}",'commitFailed':"Transakcia WFS: ZLYHALA ${response}",'googleWarning':"Vrstvu Google nebolo možné správne načítať.\x3cbr\x3e\x3cbr\x3eAby ste sa tejto správy zbavili vyberte novú BaseLayer v prepínači vrstiev v pravom hornom rohu.\x3cbr\x3e\x3cbr\x3eToto sa stalo
pravdepodobne preto, že skript knižnice Google Maps buď nebol načítaný alebo neobsahuje správny kľúč API pre vašu lokalitu.\x3cbr\x3e\x3cbr\x3eVývojári: Tu môžete získať \x3ca href=\'http://trac.openlayers.org/wiki/Google\' target=\'_blank\'\x3epomoc so sfunkčnením\x3c/a\x3e",'getLayerWarning':"Vrstvu ${layerType} nebolo možné správne načítať.\x3cbr\x3e\x3cbr\x3eAby ste sa tejto správy zbavili vyberte novú BaseLayer v prepínači vrstiev v pravom hornom rohu.\x3cbr\x3e\x3cbr\x3eToto sa stalo pravdepodobne preto, že skript knižnice ${layerType} buď nebol načítaný alebo neobsahuje správny kľúč API pre vašu lokalitu.\x3cbr\x3e\x3cbr\x3eVývojári: Tu môžete získať \x3ca href=\'http://trac.openlayers.org/wiki/${layerType}\' target=\'_blank\'\x3epomoc so sfunkčnením\x3c/a\x3e",'scale':"Mierka = 1 : ${scaleDenom}",'layerAlreadyAdded':"Pokúsili ste sa do mapy pridať vrstvu ${layerName}, ale tá už bola pridaná",'reprojectDeprecated':
"Používate voľby „reproject“ vrstvy ${layerType}. Táto voľba je zzavrhovaná: jej použitie bolo navrhnuté na podporu zobrazovania údajov nad komerčnými základovými mapami, ale túto funkcionalitu je teraz možné dosiahnuť pomocou Spherical Mercator. Ďalšie informácie získate na stránke http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Táto metóda je zavrhovaná a bude odstránená vo verzii 3.0. Použite prosím namiesto nej metódu ${newMethod}.",'boundsAddError':"Sčítacej funkcii musíte dať hodnoty x aj y.",'lonlatAddError':"Sčítacej funkcii musíte dať hodnoty lon (zem. dĺžka) aj lat (zem. šírka).",'pixelAddError':"Sčítacej funkcii musíte dať hodnoty x aj y.",'unsupportedGeometryType':"Nepodporovaný typ geometrie: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition zlyhalo: prvok s id ${elemId} môže byť zle umiestnený.",'filterEvaluateNotImplemented':"evaluate nie je implementovaný pre tento t
yp filtra"});OpenLayers.Renderer.SVG=OpenLayers.Class(OpenLayers.Renderer.Elements,{xmlns:"http://www.w3.org/2000/svg",xlinkns:"http://www.w3.org/1999/xlink",MAX_PIXEL:15000,translationParameters:null,symbolMetrics:null,initialize:function(containerID){if(!this.supported()){return;}
OpenLayers.Renderer.Elements.prototype.initialize.apply(this,arguments);this.translationParameters={x:0,y:0};this.symbolMetrics={};},destroy:function(){OpenLayers.Renderer.Elements.prototype.destroy.apply(this,arguments);},supported:function(){var svgFeature="http://www.w3.org/TR/SVG11/feature#";return(document.implementation&&(document.implementation.hasFeature("org.w3c.svg","1.0")||document.implementation.hasFeature(svgFeature+"SVG","1.1")||document.implementation.hasFeature(svgFeature+"BasicStructure","1.1")));},inValidRange:function(x,y,xyOnly){var left=x+(xyOnly?0:this.translationParameters.x);var top=y+(xyOnly?0:this.translationParameters.y);return(left>=-this.MAX_PIXEL&&left<=this.MAX_PIXEL&&top>=-this.MAX_PIXEL&&top<=this.MAX_PIXEL);},setExtent:function(extent,resolutionChanged){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();var left=-extent.left/resolution;var top=extent.top/resolution;if(resolutionChanged)
{this.left=left;this.top=top;var extentString="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",extentString);this.translate(0,0);return true;}else{var inRange=this.translate(left-this.left,top-this.top);if(!inRange){this.setExtent(extent,true);}
return inRange;}},translate:function(x,y){if(!this.inValidRange(x,y,true)){return false;}else{var transformString="";if(x||y){transformString="translate("+x+","+y+")";}
this.root.setAttributeNS(null,"transform",transformString);this.translationParameters={x:x,y:y};return true;}},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h);},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="image";}else if(this.isComplexSymbol(style.graphicName)){nodeType="svg";}else{nodeType="circle";}
@@ -2702,7 +2719,8 @@
var end=(closeLine)?" x e":" e";node.path="m"+parts.join("")+end;return node;},drawPolygon:function(node,geometry){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var path=[];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");points=geometry.components[j].components;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;pathComp=" "+x+","+y;path.push(pathComp);if(i==0){path.push(" l");}
if(!area){if(!first){first=pathComp;}else if(first!=pathComp){if(!second){second=pathComp;}else if(second!=pathComp){area=true;}}}}
path.push(area?" x ":" ");}
-path.push("e");node.path=path.join("");return node;},drawRectangle:function(node,geometry){var resolution=this.getResolution();node.style.left=((geometry.x/resolution-this.offset.x)|0)+"px";node.style.top=((geometry.y/resolution-this.offset.y)|0)+"px";node.style.width=((geometry.width/resolution)|0)+"px";node.style.height=((geometry.height/resolution)|0)+"px";return node;},drawText:function(featureId,style,location){var label=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX,"olv:rect");var textbox=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox");var resolution=this.getResolution();label.style.left=((location.x/resolution-this.offset.x)|0)+"px";label.style.top=((location.y/resolution-this.offset.y)|0)+"px";label.style.flip="y";textbox.innerText=style.label;if(style.fontColor){textbox.style.color=style.fontColor;}
+path.push("e");node.path=path.join("");return node;},drawRectangle:function(node,geometry){var resolution=this.getResolution();node.style.left=((geometry.x/resolution-this.offset.x)|0)+"px";node.style.top=((geometry.y/resolution-this.offset.y)|0)+"px";node.style.width=((geometry.width/resolution)|0)+"px";node.style.height=((geometry.height/resolution)|0)+"px";return node;},drawText:function(featureId,style,location){var label=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX,"olv:rect");var textbox=this.nodeFactory(featureId+this.LABEL_ID_SUFFIX+"_textbox","olv:textbox");var resolution=this.getResolution();label.style.left=((location.x/resolution-this.offset.x)|0)+"px";label.style.top=((location.y/resolution-this.offset.y)|0)+"px";label.style.flip="y";textbox.innerText=style.label;if(style.cursor!="inherit"&&style.cursor!=null){textbox.style.cursor=style.cursor;}
+if(style.fontColor){textbox.style.color=style.fontColor;}
if(style.fontOpacity){textbox.style.filter='alpha(opacity='+(style.fontOpacity*100)+')';}
if(style.fontFamily){textbox.style.fontFamily=style.fontFamily;}
if(style.fontSize){textbox.style.fontSize=style.fontSize;}
Modified: sandbox/cmoullet/openlayers/examples/mobile-drawing.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-drawing.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/examples/mobile-drawing.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -1,9 +1,30 @@
-
function init() {
+ // create a vector layer for drawing
var vector = new OpenLayers.Layer.Vector();
- var toolbar = new OpenLayers.Control.EditingToolbar(vector);
+ // OpenLayers' EditingToolbar internally creates a Navigation control, we
+ // want a TouchNavigation control here so we create our own editing toolbar
+ var toolbar = new OpenLayers.Control.Panel({
+ displayClass: 'olControlEditingToolbar'
+ });
+ toolbar.addControls([
+ // this control is just there to be able to deactivate the drawing
+ // tools
+ new OpenLayers.Control({
+ displayClass: 'olControlNavigation'
+ }),
+ new OpenLayers.Control.DrawFeature(vector, OpenLayers.Handler.Point, {
+ displayClass: 'olControlDrawFeaturePoint'
+ }),
+ new OpenLayers.Control.DrawFeature(vector, OpenLayers.Handler.Path, {
+ displayClass: 'olControlDrawFeaturePath'
+ }),
+ new OpenLayers.Control.DrawFeature(vector, OpenLayers.Handler.Polygon, {
+ displayClass: 'olControlDrawFeaturePolygon'
+ })
+ ]);
+
map = new OpenLayers.Map({
div: 'map',
projection: 'EPSG:900913',
@@ -28,6 +49,7 @@
theme: null
});
+ // activate the first control to render the "navigation icon"
+ // as active
toolbar.controls[0].activate();
-
};
Added: sandbox/cmoullet/openlayers/examples/openls.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/openls.html (rev 0)
+++ sandbox/cmoullet/openlayers/examples/openls.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -0,0 +1,85 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
+ <meta name="apple-mobile-web-app-capable" content="yes"/>
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css"/>
+ <link rel="stylesheet" href="style.css" type="text/css"/>
+ <title>OpenLS: Geocoding Example</title>
+ <script type="text/javascript" src="../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ var map, layer;
+
+ function init() {
+ OpenLayers.ProxyHost = "proxy.cgi?url=";
+ map = new OpenLayers.Map('map', {
+ controls: [
+ new OpenLayers.Control.PanZoom(),
+ new OpenLayers.Control.Permalink(),
+ new OpenLayers.Control.Navigation()
+ ]
+ });
+ layer = new OpenLayers.Layer.OSM("OpenStreetMap", null, {
+ transitionEffect: 'resize'
+ });
+ map.addLayers([layer]);
+ map.zoomToMaxExtent();
+ }
+ function submitform() {
+ var queryString = document.forms[0].query.value;
+ OpenLayers.Request.POST({
+ url: "http://www.openrouteservice.org/php/OpenLSLUS_Geocode.php",
+ scope: this,
+ failure: this.requestFailure,
+ success: this.requestSuccess,
+ headers: {"Content-Type": "application/x-www-form-urlencoded"},
+ data: "FreeFormAdress=" + encodeURIComponent(queryString) + "&MaxResponse=1"
+ });
+ }
+ function requestSuccess(response) {
+ var format = new OpenLayers.Format.XLS();
+ var output = format.read(response.responseXML);
+ if (output.responseLists[0]) {
+ var foundPosition = new OpenLayers.LonLat(output.responseLists[0].features[0].geometry.x, output.responseLists[0].features[0].geometry.y).transform(
+ new OpenLayers.Projection("EPSG:4326"),
+ map.getProjectionObject()
+ );
+ map.setCenter(foundPosition, 16);
+ } else {
+ alert("Sorry, no address found");
+ }
+ }
+ function requestFailure(response) {
+ alert("no");
+ }
+
+ </script>
+</head>
+<body onload="init()">
+<h1 id="title">OpenLS Geocoding Example</h1>
+
+<div id="tags">
+ OpenLS, XLS, Geocoding
+</div>
+
+<p id="shortdesc">
+ Show how to use an OpenLS service.
+</p>
+
+<form name="input" action="javascript: submitform();" method="post">
+ <label for="query">Search for address:</label> <input type="text" id="query" size=50 name="query"
+ value="Rue des Berges 37 Payerne"/>
+ <input type="submit" value="Submit"/>
+</form>
+
+<br>
+
+<div id="map" class="smallmap"></div>
+
+
+<div id="docs">
+ <p>
+ Geocoding example using the http://www.openrouteservice.org/ OpenLS service. Recenter to the first item of the results.
+ </p>
+</div>
+</body>
+</html>
Modified: sandbox/cmoullet/openlayers/examples/proxy.cgi
===================================================================
--- sandbox/cmoullet/openlayers/examples/proxy.cgi 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/examples/proxy.cgi 2011-03-30 03:18:10 UTC (rev 11763)
@@ -21,7 +21,7 @@
'sigma.openplans.org', 'demo.opengeo.org',
'www.openstreetmap.org', 'sample.azavea.com',
'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080',
- 'vmap0.tiles.osgeo.org']
+ 'vmap0.tiles.osgeo.org', 'www.openrouteservice.org']
method = os.environ["REQUEST_METHOD"]
Modified: sandbox/cmoullet/openlayers/examples/symbolizers-fill-stroke-graphic.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/symbolizers-fill-stroke-graphic.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/examples/symbolizers-fill-stroke-graphic.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -28,7 +28,8 @@
symbolizer: {
graphic: false,
label: "Label for invisible point",
- labelSelect: true
+ labelSelect: true,
+ fontStyle: "italic"
},
filter: new OpenLayers.Filter.Comparison({
type: "==",
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Bounds.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Bounds.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/BaseTypes/Bounds.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -121,11 +121,9 @@
*
* Returns:
* {String} String representation of bounds object.
- * (ex.<i>"left-bottom=(5,42) right-top=(10,45)"</i>)
*/
toString:function() {
- return ( "left-bottom=(" + this.left + "," + this.bottom + ")"
- + " right-top=(" + this.right + "," + this.top + ")" );
+ return [this.left, this.bottom, this.right, this.top].join(",");
},
/**
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -60,6 +60,14 @@
zoomWorldIcon: false,
/**
+ * APIProperty: panIcons
+ * {Boolean} Set this property to false not to display the pan icons. If
+ * false the zoom world icon is placed under the zoom bar. Defaults to
+ * true.
+ */
+ panIcons: true,
+
+ /**
* APIProperty: forceFixedZoomLevel
* {Boolean} Force a fixed zoom level even though the map has
* fractionalZoom
@@ -144,26 +152,37 @@
this.buttons = [];
var sz = new OpenLayers.Size(18,18);
- var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
- var wposition = sz.w;
+ if (this.panIcons) {
+ var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
+ var wposition = sz.w;
- if (this.zoomWorldIcon) {
- centered = new OpenLayers.Pixel(px.x+sz.w, px.y);
- }
+ if (this.zoomWorldIcon) {
+ centered = new OpenLayers.Pixel(px.x+sz.w, px.y);
+ }
- this._addButton("panup", "north-mini.png", centered, sz);
- px.y = centered.y+sz.h;
- this._addButton("panleft", "west-mini.png", px, sz);
- if (this.zoomWorldIcon) {
- this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz);
-
- wposition *= 2;
+ this._addButton("panup", "north-mini.png", centered, sz);
+ px.y = centered.y+sz.h;
+ this._addButton("panleft", "west-mini.png", px, sz);
+ if (this.zoomWorldIcon) {
+ this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz);
+
+ wposition *= 2;
+ }
+ this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz);
+ this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz);
+ this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz);
+ centered = this._addZoomBar(centered.add(0, sz.h*4 + 5));
+ this._addButton("zoomout", "zoom-minus-mini.png", centered, sz);
}
- this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz);
- this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz);
- this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz);
- centered = this._addZoomBar(centered.add(0, sz.h*4 + 5));
- this._addButton("zoomout", "zoom-minus-mini.png", centered, sz);
+ else {
+ this._addButton("zoomin", "zoom-plus-mini.png", px, sz);
+ centered = this._addZoomBar(px.add(0, sz.h));
+ this._addButton("zoomout", "zoom-minus-mini.png", centered, sz);
+ if (this.zoomWorldIcon) {
+ centered = centered.add(0, sz.h+3);
+ this._addButton("zoomworld", "zoom-world-mini.png", centered, sz);
+ }
+ }
return this.div;
},
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Feature/Vector.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Feature/Vector.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Feature/Vector.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -387,6 +387,7 @@
* fontOpacity - {Number} Opacity (0-1) for the label
* fontFamily - {String} The font family for the label, to be provided like in CSS.
* fontSize - {String} The font size for the label, to be provided like in CSS.
+ * fontStyle - {String} The font style for the label, to be provided like in CSS.
* fontWeight - {String} The font weight for the label, to be provided like in CSS.
* display - {String} Symbolizers will have no effect if display is set to "none". All other values have no effect.
*/
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Filter/FeatureId.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Filter/FeatureId.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Filter/FeatureId.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -26,6 +26,12 @@
fids: null,
/**
+ * Property: type
+ * {String} Type to identify this filter.
+ */
+ type: "FID",
+
+ /**
* Constructor: OpenLayers.Filter.FeatureId
* Creates an ogc:FeatureId rule.
*
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Filter/v1.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Filter/v1.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Filter/v1.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -273,6 +273,19 @@
},
/**
+ * Method: writeFeatureIdNodes
+ *
+ * Parameters:
+ * filter - {<OpenLayers.Filter.FeatureId}
+ * node - {DOMElement}
+ */
+ writeFeatureIdNodes: function(filter, node) {
+ for (var i=0, ii=filter.fids.length; i<ii; ++i) {
+ this.writeNode("FeatureId", filter.fids[i], node);
+ }
+ },
+
+ /**
* Property: writers
* As a compliment to the readers property, this structure contains public
* writing functions grouped by namespace alias and named like the
@@ -282,11 +295,8 @@
"ogc": {
"Filter": function(filter) {
var node = this.createElementNSPlus("ogc:Filter");
- var sub = filter.CLASS_NAME.split(".").pop();
- if(sub == "FeatureId") {
- for(var i=0; i<filter.fids.length; ++i) {
- this.writeNode("FeatureId", filter.fids[i], node);
- }
+ if (filter.type === "FID") {
+ this.writeFeatureIdNodes(filter, node);
} else {
this.writeNode(this.getFilterType(filter), filter, node);
}
@@ -300,31 +310,43 @@
"And": function(filter) {
var node = this.createElementNSPlus("ogc:And");
var childFilter;
- for(var i=0; i<filter.filters.length; ++i) {
+ for (var i=0, ii=filter.filters.length; i<ii; ++i) {
childFilter = filter.filters[i];
+ if (childFilter.type === "FID") {
+ this.writeFeatureIdNodes(childFilter, node);
+ } else {
this.writeNode(
this.getFilterType(childFilter), childFilter, node
);
}
+ }
return node;
},
"Or": function(filter) {
var node = this.createElementNSPlus("ogc:Or");
var childFilter;
- for(var i=0; i<filter.filters.length; ++i) {
+ for (var i=0, ii=filter.filters.length; i<ii; ++i) {
childFilter = filter.filters[i];
+ if (childFilter.type === "FID") {
+ this.writeFeatureIdNodes(childFilter, node);
+ } else {
this.writeNode(
this.getFilterType(childFilter), childFilter, node
);
}
+ }
return node;
},
"Not": function(filter) {
var node = this.createElementNSPlus("ogc:Not");
var childFilter = filter.filters[0];
+ if (childFilter.type === "FID") {
+ this.writeFeatureIdNodes(childFilter, node);
+ } else {
this.writeNode(
this.getFilterType(childFilter), childFilter, node
);
+ }
return node;
},
"PropertyIsLessThan": function(filter) {
@@ -460,7 +482,8 @@
"DWITHIN": "DWITHIN",
"WITHIN": "WITHIN",
"CONTAINS": "CONTAINS",
- "INTERSECTS": "INTERSECTS"
+ "INTERSECTS": "INTERSECTS",
+ "FID": "FeatureId"
},
CLASS_NAME: "OpenLayers.Format.Filter.v1"
Copied: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/QueryStringFilter.js (from rev 11762, trunk/openlayers/lib/OpenLayers/Format/QueryStringFilter.js)
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/QueryStringFilter.js (rev 0)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/QueryStringFilter.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -0,0 +1,180 @@
+/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format.js
+ * @requires OpenLayers/Filter/Comparison.js
+ */
+
+/**
+ * Class: OpenLayers.Format.QueryStringFilter
+ * Parser for reading a query string and creating a simple filter.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format>
+ */
+OpenLayers.Format.QueryStringFilter = (function() {
+
+ /**
+ * Map the OpenLayers.Filter.Comparison types to the operation strings of
+ * the protocol.
+ */
+ var cmpToStr = {};
+ cmpToStr[OpenLayers.Filter.Comparison.EQUAL_TO] = "eq";
+ cmpToStr[OpenLayers.Filter.Comparison.NOT_EQUAL_TO] = "ne";
+ cmpToStr[OpenLayers.Filter.Comparison.LESS_THAN] = "lt";
+ cmpToStr[OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO] = "lte";
+ cmpToStr[OpenLayers.Filter.Comparison.GREATER_THAN] = "gt";
+ cmpToStr[OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO] = "gte";
+ cmpToStr[OpenLayers.Filter.Comparison.LIKE] = "ilike";
+
+ /**
+ * Function: regex2value
+ * Convert the value from a regular expression string to a LIKE/ILIKE
+ * string known to the web service.
+ *
+ * Parameters:
+ * value - {String} The regex string.
+ *
+ * Returns:
+ * {String} The converted string.
+ */
+ function regex2value(value) {
+
+ // highly sensitive!! Do not change this without running the
+ // Protocol/HTTP.html unit tests
+
+ // convert % to \%
+ value = value.replace(/%/g, "\\%");
+
+ // convert \\. to \\_ (\\.* occurences converted later)
+ value = value.replace(/\\\\\.(\*)?/g, function($0, $1) {
+ return $1 ? $0 : "\\\\_";
+ });
+
+ // convert \\.* to \\%
+ value = value.replace(/\\\\\.\*/g, "\\\\%");
+
+ // convert . to _ (\. and .* occurences converted later)
+ value = value.replace(/(\\)?\.(\*)?/g, function($0, $1, $2) {
+ return $1 || $2 ? $0 : "_";
+ });
+
+ // convert .* to % (\.* occurnces converted later)
+ value = value.replace(/(\\)?\.\*/g, function($0, $1) {
+ return $1 ? $0 : "%";
+ });
+
+ // convert \. to .
+ value = value.replace(/\\\./g, ".");
+
+ // replace \* with * (watching out for \\*)
+ value = value.replace(/(\\)?\\\*/g, function($0, $1) {
+ return $1 ? $0 : "*";
+ });
+
+ return value;
+ }
+
+ return OpenLayers.Class(OpenLayers.Format, {
+
+ /**
+ * Property: wildcarded.
+ * {Boolean} If true percent signs are added around values
+ * read from LIKE filters, for example if the protocol
+ * read method is passed a LIKE filter whose property
+ * is "foo" and whose value is "bar" the string
+ * "foo__ilike=%bar%" will be sent in the query string;
+ * defaults to false.
+ */
+ wildcarded: false,
+
+ /**
+ * APIProperty: srsInBBOX
+ * {Boolean} Include the SRS identifier in BBOX query string parameter.
+ * Default is false. If true and the layer has a projection object set,
+ * any BBOX filter will be serialized with a fifth item identifying the
+ * projection. E.g. bbox=-1000,-1000,1000,1000,EPSG:900913
+ */
+ srsInBBOX: false,
+
+ /**
+ * APIMethod: write
+ * Serialize an <OpenLayers.Filter> objects using the "simple" filter syntax for
+ * query string parameters. This function must be called as a method of
+ * a protocol instance.
+ *
+ * Parameters:
+ * filter - {<OpenLayers.Filter>} filter to convert.
+ * params - {Object} The parameters object.
+ *
+ * Returns:
+ * {Object} The resulting parameters object.
+ */
+ write: function(filter, params) {
+ params = params || {};
+ var className = filter.CLASS_NAME;
+ var filterType = className.substring(className.lastIndexOf(".") + 1);
+ switch (filterType) {
+ case "Spatial":
+ switch (filter.type) {
+ case OpenLayers.Filter.Spatial.BBOX:
+ params.bbox = filter.value.toArray();
+ if (this.srsInBBOX && filter.projection) {
+ params.bbox.push(filter.projection.getCode());
+ }
+ break;
+ case OpenLayers.Filter.Spatial.DWITHIN:
+ params.tolerance = filter.distance;
+ // no break here
+ case OpenLayers.Filter.Spatial.WITHIN:
+ params.lon = filter.value.x;
+ params.lat = filter.value.y;
+ break;
+ default:
+ OpenLayers.Console.warn(
+ "Unknown spatial filter type " + filter.type);
+ }
+ break;
+ case "Comparison":
+ var op = cmpToStr[filter.type];
+ if (op !== undefined) {
+ var value = filter.value;
+ if (filter.type == OpenLayers.Filter.Comparison.LIKE) {
+ value = regex2value(value);
+ if (this.wildcarded) {
+ value = "%" + value + "%";
+ }
+ }
+ params[filter.property + "__" + op] = value;
+ params.queryable = params.queryable || [];
+ params.queryable.push(filter.property);
+ } else {
+ OpenLayers.Console.warn(
+ "Unknown comparison filter type " + filter.type);
+ }
+ break;
+ case "Logical":
+ if (filter.type === OpenLayers.Filter.Logical.AND) {
+ for (var i=0,len=filter.filters.length; i<len; i++) {
+ params = this.write(filter.filters[i], params);
+ }
+ } else {
+ OpenLayers.Console.warn(
+ "Unsupported logical filter type " + filter.type);
+ }
+ break;
+ default:
+ OpenLayers.Console.warn("Unknown filter type " + filterType);
+ }
+ return params;
+ },
+
+ CLASS_NAME: "OpenLayers.Format.QueryStringFilter"
+
+ });
+
+
+})();
\ No newline at end of file
Added: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS/v1.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS/v1.js (rev 0)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS/v1.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -0,0 +1,307 @@
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XLS.js
+ * @requires OpenLayers/Format/GML/v3.js
+ */
+
+/**
+ * Class: OpenLayers.Format.XLS.v1
+ * Superclass for XLS version 1 parsers. Only supports GeocodeRequest for now.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.XLS.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
+
+ /**
+ * Property: namespaces
+ * {Object} Mapping of namespace aliases to namespace URIs.
+ */
+ namespaces: {
+ xls: "http://www.opengis.net/xls",
+ gml: "http://www.opengis.net/gml",
+ xsi: "http://www.w3.org/2001/XMLSchema-instance"
+ },
+
+ /**
+ * Property: regExes
+ * Compiled regular expressions for manipulating strings.
+ */
+ regExes: {
+ trimSpace: (/^\s*|\s*$/g),
+ removeSpace: (/\s*/g),
+ splitSpace: (/\s+/),
+ trimComma: (/\s*,\s*/g)
+ },
+
+ /**
+ * APIProperty: xy
+ * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)
+ * Changing is not recommended, a new Format should be instantiated.
+ */
+ xy: true,
+
+ /**
+ * Property: defaultPrefix
+ */
+ defaultPrefix: "xls",
+
+ /**
+ * Property: schemaLocation
+ * {String} Schema location for a particular minor version.
+ */
+ schemaLocation: null,
+
+ /**
+ * Constructor: OpenLayers.Format.XLS.v1
+ * Instances of this class are not created directly. Use the
+ * <OpenLayers.Format.XLS> constructor instead.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
+ initialize: function(options) {
+ OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
+ },
+
+ /**
+ * Method: read
+ *
+ * Parameters:
+ * data - {DOMElement} An XLS document element.
+ * options - {Object} Options for the reader.
+ *
+ * Returns:
+ * {Object} An object representing the XLSResponse.
+ */
+ read: function(data, options) {
+ options = OpenLayers.Util.applyDefaults(options, this.options);
+ var xls = {};
+ this.readChildNodes(data, xls);
+ return xls;
+ },
+
+ /**
+ * Property: readers
+ * Contains public functions, grouped by namespace prefix, that will
+ * be applied when a namespaced node is found matching the function
+ * name. The function will be applied in the scope of this parser
+ * with two arguments: the node being read and a context object passed
+ * from the parent.
+ */
+ readers: {
+ "xls": {
+ "XLS": function(node, xls) {
+ xls.version = node.getAttribute("version");
+ this.readChildNodes(node, xls);
+ },
+ "Response": function(node, xls) {
+ this.readChildNodes(node, xls);
+ },
+ "GeocodeResponse": function(node, xls) {
+ xls.responseLists = [];
+ this.readChildNodes(node, xls);
+ },
+ "GeocodeResponseList": function(node, xls) {
+ var responseList = {
+ features: [],
+ numberOfGeocodedAddresses:
+ parseInt(node.getAttribute("numberOfGeocodedAddresses"))
+ };
+ xls.responseLists.push(responseList);
+ this.readChildNodes(node, responseList);
+ },
+ "GeocodedAddress": function(node, responseList) {
+ var feature = new OpenLayers.Feature.Vector();
+ responseList.features.push(feature);
+ this.readChildNodes(node, feature);
+ // post-process geometry
+ feature.geometry = feature.components[0];
+ },
+ "GeocodeMatchCode": function(node, feature) {
+ feature.attributes.matchCode = {
+ accuracy: parseFloat(node.getAttribute("accuracy")),
+ matchType: node.getAttribute("matchType")
+ };
+ },
+ "Address": function(node, feature) {
+ var address = {
+ countryCode: node.getAttribute("countryCode"),
+ addressee: node.getAttribute("addressee"),
+ street: [],
+ place: []
+ };
+ feature.attributes.address = address;
+ this.readChildNodes(node, address);
+ },
+ "freeFormAddress": function(node, address) {
+ address.freeFormAddress = this.getChildValue(node);
+ },
+ "StreetAddress": function(node, address) {
+ this.readChildNodes(node, address);
+ },
+ "Building": function(node, address) {
+ address.building = {
+ 'number': node.getAttribute("number"),
+ subdivision: node.getAttribute("subdivision"),
+ buildingName: node.getAttribute("buildingName")
+ };
+ },
+ "Street": function(node, address) {
+ // only support the built-in primitive type for now
+ address.street.push(this.getChildValue(node));
+ },
+ "Place": function(node, address) {
+ // type is one of CountrySubdivision,
+ // CountrySecondarySubdivision, Municipality or
+ // MunicipalitySubdivision
+ address.place[node.getAttribute("type")] =
+ this.getChildValue(node);
+ },
+ "PostalCode": function(node, address) {
+ address.postalCode = this.getChildValue(node);
+ }
+ },
+ "gml": OpenLayers.Format.GML.v3.prototype.readers.gml
+ },
+
+ /**
+ * Method: write
+ *
+ * Parameters:
+ * request - {Object} An object representing the geocode request.
+ *
+ * Returns:
+ * {DOMElement} The root of an XLS document.
+ */
+ write: function(request) {
+ return this.writers.xls.XLS.apply(this, [request]);
+ },
+
+ /**
+ * Property: writers
+ * As a compliment to the readers property, this structure contains public
+ * writing functions grouped by namespace alias and named like the
+ * node names they produce.
+ */
+ writers: {
+ "xls": {
+ "XLS": function(request) {
+ var root = this.createElementNSPlus(
+ "xls:XLS",
+ {attributes: {
+ "version": this.VERSION,
+ "xsi:schemaLocation": this.schemaLocation
+ }}
+ );
+ this.writeNode("RequestHeader", request.header, root);
+ this.writeNode("Request", request, root);
+ return root;
+ },
+ "RequestHeader": function(header) {
+ return this.createElementNSPlus("xls:RequestHeader");
+ },
+ "Request": function(request) {
+ var node = this.createElementNSPlus("xls:Request", {
+ attributes: {
+ methodName: "GeocodeRequest",
+ requestID: request.requestID || "",
+ version: this.VERSION
+ }
+ });
+ this.writeNode("GeocodeRequest", request.addresses, node);
+ return node;
+ },
+ "GeocodeRequest": function(addresses) {
+ var node = this.createElementNSPlus("xls:GeocodeRequest");
+ for (var i=0, len=addresses.length; i<len; i++) {
+ this.writeNode("Address", addresses[i], node);
+ }
+ return node;
+ },
+ "Address": function(address) {
+ var node = this.createElementNSPlus("xls:Address", {
+ attributes: {
+ countryCode: address.countryCode
+ }
+ });
+ if (address.freeFormAddress) {
+ this.writeNode("freeFormAddess", address.freeFormAddress, node);
+ } else {
+ if (address.street) {
+ this.writeNode("StreetAddress", address, node);
+ }
+ if (address.municipality) {
+ this.writeNode("Municipality", address.municipality, node);
+ }
+ if (address.countrySubdivision) {
+ this.writeNode("CountrySubdivision", address.countrySubdivision, node);
+ }
+ if (address.postalCode) {
+ this.writeNode("PostalCode", address.postalCode, node);
+ }
+ }
+ return node;
+ },
+ "freeFormAddress": function(freeFormAddress) {
+ return this.createElementNSPlus("freeFormAddress",
+ {value: freeFormAddress});
+ },
+ "StreetAddress": function(address) {
+ var node = this.createElementNSPlus("xls:StreetAddress");
+ if (address.building) {
+ this.writeNode(node, "Building", address.building);
+ }
+ var street = address.street;
+ if (!(street instanceof Array)) {
+ street = [street];
+ }
+ for (var i=0, len=street.length; i < len; i++) {
+ this.writeNode("Street", street[i], node);
+ }
+ return node;
+ },
+ "Building": function(building) {
+ return this.createElementNSPlus("xls:Building", {
+ attributes: {
+ "number": building["number"],
+ "subdivision": building.subdivision,
+ "buildingName": building.buildingName
+ }
+ });
+ },
+ "Street": function(street) {
+ return this.createElementNSPlus("xls:Street", {value: street});
+ },
+ "Municipality": function(municipality) {
+ return this.createElementNSPlus("xls:Place", {
+ attributes: {
+ type: "Municipality"
+ },
+ value: municipality
+ });
+ },
+ "CountrySubdivision": function(countrySubdivision) {
+ return this.createElementNSPlus("xls:Place", {
+ attributes: {
+ type: "CountrySubdivision"
+ },
+ value: countrySubdivision
+ });
+ },
+ "PostalCode": function(postalCode) {
+ return this.createElementNSPlus("xls:PostalCode", {
+ value: postalCode
+ });
+ }
+ }
+ },
+
+ CLASS_NAME: "OpenLayers.Format.XLS.v1"
+
+});
Added: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js (rev 0)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS/v1_1_0.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -0,0 +1,53 @@
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XLS/v1.js
+ */
+
+/**
+ * Class: OpenLayers.Format.XLS.v1_1_0
+ * Read / write XLS version 1.1.0.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.XLS.v1>
+ */
+OpenLayers.Format.XLS.v1_1_0 = OpenLayers.Class(
+ OpenLayers.Format.XLS.v1, {
+
+ /**
+ * Constant: VERSION
+ * {String} 1.1
+ */
+ VERSION: "1.1",
+
+ /**
+ * Property: schemaLocation
+ * {String} http://www.opengis.net/xls
+ * http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd
+ */
+ schemaLocation: "http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd",
+
+ /**
+ * Constructor: OpenLayers.Format.XLS.v1_1_0
+ * Instances of this class are not created directly. Use the
+ * <OpenLayers.Format.XLS> constructor instead.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
+ initialize: function(options) {
+ OpenLayers.Format.XLS.v1.prototype.initialize.apply(
+ this, [options]
+ );
+ },
+
+ CLASS_NAME: "OpenLayers.Format.XLS.v1_1_0"
+
+});
+
+// Support non standard implementation
+OpenLayers.Format.XLS.v1_1 = OpenLayers.Format.XLS.v1_1_0;
Added: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS.js (rev 0)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/XLS.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -0,0 +1,118 @@
+/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/XML.js
+ */
+
+/**
+ * Class: OpenLayers.Format.XLS
+ * Read/Wite XLS (OpenLS). Create a new instance with the <OpenLayers.Format.XLS>
+ * constructor. Currently only implemented for Location Utility Services, more
+ * specifically only for Geocoding. No support for Reverse Geocoding as yet.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.XML>
+ */
+OpenLayers.Format.XLS = OpenLayers.Class(OpenLayers.Format.XML, {
+
+ /**
+ * APIProperty: defaultVersion
+ * {String} Version number to assume if none found. Default is "1.1.0".
+ */
+ defaultVersion: "1.1.0",
+
+ /**
+ * APIProperty: version
+ * {String} Specify a version string if one is known.
+ */
+ version: null,
+
+ /**
+ * Property: parser
+ * {Object} Instance of the versioned parser. Cached for multiple read and
+ * write calls of the same version.
+ */
+ parser: null,
+
+ /**
+ * Constructor: OpenLayers.Format.XLS
+ * Create a new parser for XLS.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
+ initialize: function(options) {
+ OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
+ },
+
+ /**
+ * APIMethod: write
+ * Write out an XLS request.
+ *
+ * Parameters:
+ * request - {Object} An object representing the LUS request.
+ * options - {Object} Optional configuration object.
+ *
+ * Returns:
+ * {String} An XLS document string.
+ */
+ write: function(request, options) {
+ var version = (options && options.version) ||
+ this.version || this.defaultVersion;
+ if(!this.parser || this.parser.VERSION != version) {
+ var format = OpenLayers.Format.XLS[
+ "v" + version.replace(/\./g, "_")
+ ];
+ if(!format) {
+ throw "Can't find an XLS parser for version " +
+ version;
+ }
+ this.parser = new format(this.options);
+ }
+ var root = this.parser.write(request);
+ return OpenLayers.Format.XML.prototype.write.apply(this, [root]);
+ },
+
+ /**
+ * APIMethod: read
+ * Read an XLS doc and return an object representing the result.
+ *
+ * Parameters:
+ * data - {String | DOMElement} Data to read.
+ * options - {Object} Options for the reader.
+ *
+ * Returns:
+ * {Object} An object representing the GeocodeResponse.
+ */
+ read: function(data, options) {
+ if(typeof data == "string") {
+ data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
+ }
+ var root = data.documentElement;
+ var version = this.version;
+ if(!version) {
+ version = root.getAttribute("version");
+ if(!version) {
+ version = this.defaultVersion;
+ }
+ }
+ if(!this.parser || this.parser.VERSION != version) {
+ var format = OpenLayers.Format.XLS[
+ "v" + version.replace(/\./g, "_")
+ ];
+ if(!format) {
+ throw "Can't find an XLS parser for version " +
+ version;
+ }
+ this.parser = new format(this.options);
+ }
+ var xls = this.parser.read(data, options);
+ return xls;
+ },
+
+ CLASS_NAME: "OpenLayers.Format.XLS"
+});
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Box.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Box.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Box.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -32,11 +32,11 @@
boxDivClassName: 'olHandlerBoxZoomBox',
/**
- * Property: boxCharacteristics
- * {Object} Caches some box characteristics from css. This is used
- * by the getBoxCharacteristics method.
+ * Property: boxOffsets
+ * {Object} Caches box offsets from css. This is used by the getBoxOffsets
+ * method.
*/
- boxCharacteristics: null,
+ boxOffsets: null,
/**
* Constructor: OpenLayers.Handler.Box
@@ -96,7 +96,13 @@
new OpenLayers.Pixel(-9999, -9999));
this.zoomBox.className = this.boxDivClassName;
this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
+
this.map.eventsDiv.appendChild(this.zoomBox);
+
+ var offset = this.getBoxOffsets();
+ var pos = this.dragHandler.start;
+ this.zoomBox.style.left = (pos.x - offset.left) + "px";
+ this.zoomBox.style.top = (pos.y - offset.top) + "px";
OpenLayers.Element.addClass(
this.map.eventsDiv, "olDrawBox"
@@ -111,24 +117,14 @@
var startY = this.dragHandler.start.y;
var deltaX = Math.abs(startX - xy.x);
var deltaY = Math.abs(startY - xy.y);
- this.zoomBox.style.width = Math.max(1, deltaX) + "px";
- this.zoomBox.style.height = Math.max(1, deltaY) + "px";
- this.zoomBox.style.left = xy.x < startX ? xy.x+"px" : startX+"px";
- this.zoomBox.style.top = xy.y < startY ? xy.y+"px" : startY+"px";
- // depending on the box model, modify width and height to take borders
- // of the box into account
- var box = this.getBoxCharacteristics();
- if (box.newBoxModel) {
- if (xy.x > startX) {
- this.zoomBox.style.width =
- Math.max(1, deltaX - box.xOffset) + "px";
- }
- if (xy.y > startY) {
- this.zoomBox.style.height =
- Math.max(1, deltaY - box.yOffset) + "px";
- }
- }
+ var offset = this.getBoxOffsets();
+ this.zoomBox.style.width = (deltaX + offset.width + 1) + "px";
+ this.zoomBox.style.height = (deltaY + offset.height + 1) + "px";
+ this.zoomBox.style.left = (xy.x < startX ?
+ startX - deltaX - offset.left : startX - offset.left) + "px";
+ this.zoomBox.style.top = (xy.y < startY ?
+ startY - deltaY - offset.top : startY - offset.top) + "px";
},
/**
@@ -159,7 +155,7 @@
removeBox: function() {
this.map.eventsDiv.removeChild(this.zoomBox);
this.zoomBox = null;
- this.boxCharacteristics = null;
+ this.boxOffsets = null;
OpenLayers.Element.removeClass(
this.map.eventsDiv, "olDrawBox"
);
@@ -195,34 +191,53 @@
},
/**
- * Method: getCharacteristics
- * Determines offset and box model for a box.
+ * Method: getBoxOffsets
+ * Determines border offsets for a box, according to the box model.
*
* Returns:
- * {Object} a hash with the following properties:
- * - xOffset - Corner offset in x-direction
- * - yOffset - Corner offset in y-direction
- * - newBoxModel - true for all browsers except IE in quirks mode
+ * {Object} an object with the following offsets:
+ * - left
+ * - right
+ * - top
+ * - bottom
+ * - width
+ * - height
*/
- getBoxCharacteristics: function() {
- if (!this.boxCharacteristics) {
- var xOffset = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
- "border-left-width")) + parseInt(OpenLayers.Element.getStyle(
- this.zoomBox, "border-right-width")) + 1;
- var yOffset = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
- "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.BROWSER_NAME == "msie" ?
- document.compatMode != "BackCompat" : true;
- this.boxCharacteristics = {
- xOffset: xOffset,
- yOffset: yOffset,
- newBoxModel: newBoxModel
+ getBoxOffsets: function() {
+ if (!this.boxOffsets) {
+ // Determine the box model. If the testDiv's clientWidth is 3, then
+ // the borders are outside and we are dealing with the w3c box
+ // model. Otherwise, the browser uses the traditional box model and
+ // the borders are inside the box bounds, leaving us with a
+ // clientWidth of 1.
+ var testDiv = document.createElement("div");
+ //testDiv.style.visibility = "hidden";
+ testDiv.style.position = "absolute";
+ testDiv.style.border = "1px solid black";
+ testDiv.style.width = "3px";
+ document.body.appendChild(testDiv);
+ var w3cBoxModel = testDiv.clientWidth == 3;
+ document.body.removeChild(testDiv);
+
+ var left = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
+ "border-left-width"));
+ var right = parseInt(OpenLayers.Element.getStyle(
+ this.zoomBox, "border-right-width"));
+ var top = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
+ "border-top-width"));
+ var bottom = parseInt(OpenLayers.Element.getStyle(
+ this.zoomBox, "border-bottom-width"));
+ this.boxOffsets = {
+ left: left,
+ right: right,
+ top: top,
+ bottom: bottom,
+ width: w3cBoxModel === false ? left + right : 0,
+ height: w3cBoxModel === false ? top + bottom : 0
};
}
- return this.boxCharacteristics;
+ return this.boxOffsets;
},
-
+
CLASS_NAME: "OpenLayers.Handler.Box"
});
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Path.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Path.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Path.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -79,13 +79,14 @@
* feature.
*/
createFeature: function(pixel) {
- if(!pixel) {
- pixel = new OpenLayers.Pixel(-50, -50);
+ var geometry;
+ if(pixel) {
+ var lonlat = this.map.getLonLatFromPixel(pixel);
+ geometry = new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat);
+ } else {
+ geometry = new OpenLayers.Geometry.Point();
}
- var lonlat = this.control.map.getLonLatFromPixel(pixel);
- this.point = new OpenLayers.Feature.Vector(
- new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat)
- );
+ this.point = new OpenLayers.Feature.Vector(geometry);
this.line = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LineString([this.point.geometry])
);
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -98,11 +98,11 @@
/**
* APIProperty: pixelTolerance
- * {Number} Maximum number of pixels between mouseup and mousedown for an
- * event to be considered a click. Default is 5. If set to an
- * integer value, clicks with a drag greater than the value will be
- * ignored. This property can only be set when the handler is
- * constructed.
+ * {Number} Maximum number of pixels between down and up (mousedown
+ * and mouseup, or touchstart and touchend) for the handler to
+ * add a new point. If set to an integer value, if the
+ * displacement between down and up is great to this value
+ * no point will be added. Default value is 5.
*/
pixelTolerance: 5,
@@ -420,7 +420,7 @@
this.last = evt.xy;
if (this.timerId &&
- this.passesTolerance(last, evt.xy, this.dblclickTolerance)) {
+ this.passesTolerance(last, evt.xy, this.dblclickTolerance)) {
this.isDblclick = true;
// a valid touch immediately adds a component and leaves us with a
// complete geometry
@@ -521,7 +521,7 @@
down: function(evt) {
this.mouseDown = true;
this.lastDown = evt.xy;
- if (!this.touch) {
+ if(!this.touch) { // no point displayed until up on touch devices
this.modifyFeature(evt.xy);
}
this.stoppedDown = this.stopDown;
@@ -540,7 +540,8 @@
* {Boolean} Allow event propagation
*/
move: function (evt) {
- if(!this.touch && (!this.mouseDown || this.stoppedDown)) {
+ if(!this.touch // no point displayed until up on touch devices
+ && (!this.mouseDown || this.stoppedDown)) {
this.modifyFeature(evt.xy);
}
return true;
@@ -567,11 +568,11 @@
}
// ignore double-clicks
if (this.lastUp && this.passesTolerance(this.lastUp, evt.xy,
- this.dblclickTolerance)) {
+ this.dblclickTolerance)) {
return true;
}
if (this.lastDown && this.passesTolerance(this.lastDown, evt.xy,
- this.pixelTolerance)) {
+ this.pixelTolerance)) {
if (this.touch) {
this.modifyFeature(evt.xy);
}
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Polygon.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Polygon.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Polygon.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -75,13 +75,14 @@
* feature.
*/
createFeature: function(pixel) {
- if(!pixel) {
- pixel = new OpenLayers.Pixel(-50, -50);
+ var geometry;
+ if(pixel) {
+ var lonlat = this.map.getLonLatFromPixel(pixel);
+ geometry = new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat);
+ } else {
+ geometry = new OpenLayers.Geometry.Point();
}
- var lonlat = this.control.map.getLonLatFromPixel(pixel);
- this.point = new OpenLayers.Feature.Vector(
- new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat)
- );
+ this.point = new OpenLayers.Feature.Vector(geometry);
this.line = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LinearRing([this.point.geometry])
);
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/HTTP.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/HTTP.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/HTTP.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -15,7 +15,7 @@
/**
* TODO: remove this dependency in 3.0
- * @requires OpenLayers/Protocol/SimpleFilterSerializer.js
+ * @requires OpenLayers/Format/QueryStringFilter.js
*/
/**
@@ -115,10 +115,14 @@
this.headers = {};
OpenLayers.Protocol.prototype.initialize.apply(this, arguments);
- if (!this.filterToParams && OpenLayers.Protocol.simpleFilterSerializer) {
- this.filterToParams = OpenLayers.Function.bind(
- OpenLayers.Protocol.simpleFilterSerializer, this
- );
+ if (!this.filterToParams && OpenLayers.Format.QueryStringFilter) {
+ var format = new OpenLayers.Format.QueryStringFilter({
+ wildcarded: this.wildcarded,
+ srsInBBOX: this.srsInBBOX
+ });
+ this.filterToParams = function(filter, params) {
+ return format.write(filter, params);
+ }
}
},
@@ -146,7 +150,7 @@
* Returns:
* {Object} The resulting parameters object.
*/
-
+
/**
* APIMethod: read
* Construct a request for reading new features.
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/Script.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/Script.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/Script.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -91,6 +91,17 @@
pendingRequests: null,
/**
+ * APIProperty: srsInBBOX
+ * {Boolean} Include the SRS identifier in BBOX query string parameter.
+ * Setting this property has no effect if a custom filterToParams method
+ * is provided. Default is false. If true and the layer has a
+ * projection object set, any BBOX filter will be serialized with a
+ * fifth item identifying the projection.
+ * E.g. bbox=-1000,-1000,1000,1000,EPSG:900913
+ */
+ srsInBBOX: false,
+
+ /**
* Constructor: OpenLayers.Protocol.Script
* A class for giving layers generic Script protocol.
*
@@ -113,10 +124,13 @@
this.format = new OpenLayers.Format.GeoJSON();
}
- if (!this.filterToParams && OpenLayers.Protocol.simpleFilterSerializer) {
- this.filterToParams = OpenLayers.Function.bind(
- OpenLayers.Protocol.simpleFilterSerializer, this
- );
+ if (!this.filterToParams && OpenLayers.Format.QueryStringFilter) {
+ var format = new OpenLayers.Format.QueryStringFilter({
+ srsInBBOX: this.srsInBBOX
+ });
+ this.filterToParams = function(filter, params) {
+ return format.write(filter, params);
+ }
}
},
Deleted: sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/SimpleFilterSerializer.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/SimpleFilterSerializer.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/SimpleFilterSerializer.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -1,145 +0,0 @@
-/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
- * full list of contributors). Published under the Clear BSD license.
- * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
- * full text of the license. */
-
-/**
- * @requires OpenLayers/Protocol.js
- */
-
-/**
- * Function: OpenLayers.Protocol.simpleFilterSerializer
- * Serialize an <OpenLayers.Filter> objects using the "simple" filter syntax for
- * query string parameters. This function must be called as a method of
- * a protocol instance.
- *
- * Parameters:
- * filter - {<OpenLayers.Filter>} filter to convert.
- * params - {Object} The parameters object.
- *
- * Returns:
- * {Object} The resulting parameters object.
- */
-OpenLayers.Protocol.simpleFilterSerializer = (function() {
-
- /**
- * Map the OpenLayers.Filter.Comparison types to the operation strings of
- * the protocol.
- */
- var cmpToStr = {};
- cmpToStr[OpenLayers.Filter.Comparison.EQUAL_TO] = "eq";
- cmpToStr[OpenLayers.Filter.Comparison.NOT_EQUAL_TO] = "ne";
- cmpToStr[OpenLayers.Filter.Comparison.LESS_THAN] = "lt";
- cmpToStr[OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO] = "lte";
- cmpToStr[OpenLayers.Filter.Comparison.GREATER_THAN] = "gt";
- cmpToStr[OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO] = "gte";
- cmpToStr[OpenLayers.Filter.Comparison.LIKE] = "ilike";
-
- /**
- * Function: regex2value
- * Convert the value from a regular expression string to a LIKE/ILIKE
- * string known to the web service.
- *
- * Parameters:
- * value - {String} The regex string.
- *
- * Returns:
- * {String} The converted string.
- */
- function regex2value(value) {
-
- // highly sensitive!! Do not change this without running the
- // Protocol/HTTP.html unit tests
-
- // convert % to \%
- value = value.replace(/%/g, "\\%");
-
- // convert \\. to \\_ (\\.* occurences converted later)
- value = value.replace(/\\\\\.(\*)?/g, function($0, $1) {
- return $1 ? $0 : "\\\\_";
- });
-
- // convert \\.* to \\%
- value = value.replace(/\\\\\.\*/g, "\\\\%");
-
- // convert . to _ (\. and .* occurences converted later)
- value = value.replace(/(\\)?\.(\*)?/g, function($0, $1, $2) {
- return $1 || $2 ? $0 : "_";
- });
-
- // convert .* to % (\.* occurnces converted later)
- value = value.replace(/(\\)?\.\*/g, function($0, $1) {
- return $1 ? $0 : "%";
- });
-
- // convert \. to .
- value = value.replace(/\\\./g, ".");
-
- // replace \* with * (watching out for \\*)
- value = value.replace(/(\\)?\\\*/g, function($0, $1) {
- return $1 ? $0 : "*";
- });
-
- return value;
- }
-
- return function simpleFilterSerializer(filter, params) {
- params = params || {};
- var className = filter.CLASS_NAME;
- var filterType = className.substring(className.lastIndexOf(".") + 1);
- switch (filterType) {
- case "Spatial":
- switch (filter.type) {
- case OpenLayers.Filter.Spatial.BBOX:
- params.bbox = filter.value.toArray();
- if (this.srsInBBOX && filter.projection) {
- params.bbox.push(filter.projection.getCode());
- }
- break;
- case OpenLayers.Filter.Spatial.DWITHIN:
- params.tolerance = filter.distance;
- // no break here
- case OpenLayers.Filter.Spatial.WITHIN:
- params.lon = filter.value.x;
- params.lat = filter.value.y;
- break;
- default:
- OpenLayers.Console.warn(
- "Unknown spatial filter type " + filter.type);
- }
- break;
- case "Comparison":
- var op = cmpToStr[filter.type];
- if (op !== undefined) {
- var value = filter.value;
- if (filter.type == OpenLayers.Filter.Comparison.LIKE) {
- value = regex2value(value);
- if (this.wildcarded) {
- value = "%" + value + "%";
- }
- }
- params[filter.property + "__" + op] = value;
- params.queryable = params.queryable || [];
- params.queryable.push(filter.property);
- } else {
- OpenLayers.Console.warn(
- "Unknown comparison filter type " + filter.type);
- }
- break;
- case "Logical":
- if (filter.type === OpenLayers.Filter.Logical.AND) {
- for (var i=0,len=filter.filters.length; i<len; i++) {
- params = this.filterToParams(filter.filters[i], params);
- }
- } else {
- OpenLayers.Console.warn(
- "Unsupported logical filter type " + filter.type);
- }
- break;
- default:
- OpenLayers.Console.warn("Unknown filter type " + filterType);
- }
- return params;
- };
-
-})();
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Canvas.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Canvas.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/Canvas.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -333,7 +333,11 @@
this.setCanvasStyle("reset");
this.canvas.fillStyle = style.fontColor;
this.canvas.globalAlpha = style.fontOpacity || 1.0;
- var fontStyle = style.fontWeight + " " + style.fontSize + " " + style.fontFamily;
+ var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
+ "normal", // "font-variant" not supported
+ style.fontWeight ? style.fontWeight : "normal",
+ style.fontSize ? style.fontSize : "10px",
+ style.fontFamily ? style.fontFamily : "sans-serif"].join(" ");
if (this.canvas.fillText) {
// HTML5
var labelAlign =
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -712,6 +712,9 @@
if (style.fontWeight) {
label.setAttributeNS(null, "font-weight", style.fontWeight);
}
+ if (style.fontStyle) {
+ label.setAttributeNS(null, "font-style", style.fontStyle);
+ }
if(style.labelSelect === true) {
label.setAttributeNS(null, "pointer-events", "visible");
label._featureId = featureId;
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -606,6 +606,9 @@
if (style.fontWeight) {
text.setAttributeNS(null, "font-weight", style.fontWeight);
}
+ if (style.fontStyle) {
+ text.setAttributeNS(null, "font-style", style.fontStyle);
+ }
if(style.labelSelect === true) {
text.setAttributeNS(null, "pointer-events", "visible");
text._featureId = featureId;
@@ -790,4 +793,4 @@
*/
OpenLayers.Renderer.SVG2.preventDefault = function(e) {
e.preventDefault && e.preventDefault();
-};
\ No newline at end of file
+};
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/VML.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/VML.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/VML.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -855,6 +855,9 @@
if (style.fontWeight) {
textbox.style.fontWeight = style.fontWeight;
}
+ if (style.fontStyle) {
+ textbox.style.fontStyle = style.fontStyle;
+ }
if(style.labelSelect === true) {
label._featureId = featureId;
textbox._featureId = featureId;
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers.js 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers.js 2011-03-30 03:18:10 UTC (rev 11763)
@@ -247,7 +247,6 @@
"OpenLayers/Filter/Function.js",
"OpenLayers/Protocol.js",
"OpenLayers/Protocol/HTTP.js",
- "OpenLayers/Protocol/SimpleFilterSerializer.js",
"OpenLayers/Protocol/SQL.js",
"OpenLayers/Protocol/SQL/Gears.js",
"OpenLayers/Protocol/WFS.js",
@@ -264,6 +263,7 @@
"OpenLayers/StyleMap.js",
"OpenLayers/Rule.js",
"OpenLayers/Format.js",
+ "OpenLayers/Format/QueryStringFilter.js",
"OpenLayers/Format/XML.js",
"OpenLayers/Format/Context.js",
"OpenLayers/Format/ArcXML.js",
@@ -329,6 +329,9 @@
"OpenLayers/Format/OWSContext/v0_3_1.js",
"OpenLayers/Format/WMTSCapabilities.js",
"OpenLayers/Format/WMTSCapabilities/v1_0_0.js",
+ "OpenLayers/Format/XLS.js",
+ "OpenLayers/Format/XLS/v1.js",
+ "OpenLayers/Format/XLS/v1_1_0.js",
"OpenLayers/Layer/WFS.js",
"OpenLayers/Control/GetFeature.js",
"OpenLayers/Control/MouseToolbar.js",
Modified: sandbox/cmoullet/openlayers/tests/BaseTypes/Bounds.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/BaseTypes/Bounds.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tests/BaseTypes/Bounds.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -76,7 +76,7 @@
function test_Bounds_toString(t) {
t.plan( 1 );
bounds = new OpenLayers.Bounds(1,2,3,4);
- t.eq( bounds.toString(), "left-bottom=(1,2) right-top=(3,4)", "toString() returns correct value." );
+ t.eq( bounds.toString(), "1,2,3,4", "toString() returns correct value." );
}
function test_Bounds_toArray(t) {
t.plan( 1 );
Modified: sandbox/cmoullet/openlayers/tests/Control/DrawFeature.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/DrawFeature.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tests/Control/DrawFeature.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -94,7 +94,8 @@
log = {};
control.activate();
t.eq(log.sketchstarted.type, "sketchstarted", "[activate] sketchstarted triggered");
- t.geom_eq(log.sketchstarted.vertex, new OpenLayers.Geometry.Point(-250, 175), "[activate] correct vertex");
+ t.ok(isNaN(log.sketchstarted.vertex.x) && isNaN(log.sketchstarted.vertex.y),
+ "[activate] correct vertex (NaN)");
log = {};
map.events.triggerEvent("mousemove", {xy: new OpenLayers.Pixel(0, 0)});
@@ -123,7 +124,8 @@
]),
"[dblclick] correct geometry");
t.eq(log.sketchstarted.type, "sketchstarted", "[dblclick] sketchstarted triggered");
- t.geom_eq(log.sketchstarted.vertex, new OpenLayers.Geometry.Point(-250, 175), "[dblclick] correct vertex");
+ t.ok(isNaN(log.sketchstarted.vertex.x) && isNaN(log.sketchstarted.vertex.y),
+ "[dblclick] correct vertex (NaN)");
map.destroy();
}
Modified: sandbox/cmoullet/openlayers/tests/Control/PanZoomBar.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/PanZoomBar.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tests/Control/PanZoomBar.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -166,6 +166,50 @@
t.ok(map.zoom >= 0, 'map.zoom is never < 0 after random handle drag with forceFixedZoomLevel=true and fractionalZoom=true');
}
}
+
+ function test_Control_PanZoomBar_shows (t) {
+ t.plan(22);
+
+ var control, map;
+
+ control = new OpenLayers.Control.PanZoomBar({panIcons: true, zoomWorldIcon: false});
+ map = new OpenLayers.Map('map', {controls: [control]});
+ t.eq(control.buttons.length, 6, "(a) pan, no world - expected number of buttons");
+ t.ok(control.buttons[0].id.match("_panup$"), "(a) pan, no world - pan up");
+ t.ok(control.buttons[1].id.match("_panleft$"), "(a) pan, no world - pan left");
+ t.ok(control.buttons[2].id.match("_panright$"), "(a) pan, no world - pan right");
+ t.ok(control.buttons[3].id.match("_pandown$"), "(a) pan, no world - pan down");
+ t.ok(control.buttons[4].id.match("_zoomin$"), "(a) pan, no world - zoom in");
+ t.ok(control.buttons[5].id.match("_zoomout$"), "(a) pan, no world - zoom out");
+ map.destroy();
+
+ control = new OpenLayers.Control.PanZoomBar({panIcons: true, zoomWorldIcon: true});
+ map = new OpenLayers.Map('map', {controls:[control]});
+ t.eq(control.buttons.length, 7, "(b) pan, world - expected number of buttons");
+ t.ok(control.buttons[0].id.match("_panup$"), "(b) pan, world - pan up");
+ t.ok(control.buttons[1].id.match("_panleft$"), "(b) pan, world - pan left");
+ t.ok(control.buttons[2].id.match("_zoomworld$"), "(b) pan, world - zoom world");
+ t.ok(control.buttons[3].id.match("_panright$"), "(b) pan, world - pan right");
+ t.ok(control.buttons[4].id.match("_pandown$"), "(b) pan, world - pan down");
+ t.ok(control.buttons[5].id.match("_zoomin$"), "(b) pan, world - zoom in");
+ t.ok(control.buttons[6].id.match("_zoomout$"), "(b) pan, world - zoom out");
+ map.destroy();
+
+ control = new OpenLayers.Control.PanZoomBar({panIcons: false, zoomWorldIcon: false});
+ map = new OpenLayers.Map('map', {controls:[control]});
+ t.eq(control.buttons.length, 2, "(c) no pan, no world - expected number of buttons");
+ t.ok(control.buttons[0].id.match("_zoomin$"), "(c) no pan, no world - zoom in");
+ t.ok(control.buttons[1].id.match("_zoomout$"), "(c) no pan, no world - zoom out");
+ map.destroy();
+
+ control = new OpenLayers.Control.PanZoomBar({panIcons: false, zoomWorldIcon: true});
+ map = new OpenLayers.Map('map', {controls:[control]});
+ t.eq(control.buttons.length, 3, "(d) no pan, world - expected number of buttons");
+ t.ok(control.buttons[0].id.match("_zoomin$"), "(d) no pan, world - zoom in");
+ t.ok(control.buttons[1].id.match("_zoomout$"), "(d) no pan, world - zoom out");
+ t.ok(control.buttons[2].id.match("_zoomworld$"), "(d) no pan, world - zoom world");
+ map.destroy();
+ }
</script>
</head>
<body>
Modified: sandbox/cmoullet/openlayers/tests/Feature.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Feature.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tests/Feature.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -122,7 +122,7 @@
t.ok( !feature2.onScreen(), "feature knows it's offscreen" );
}
- function test_Feature_createPopup(t) {
+ function test_Feature_createPopup_2(t) {
t.plan(11);
//no lonlat
Modified: sandbox/cmoullet/openlayers/tests/Format/Filter/v1.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/Filter/v1.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tests/Format/Filter/v1.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -166,9 +166,96 @@
}
+ function test_logical_fid(t) {
+ // the Filter Encoding spec doesn't allow for FID filters inside logical filters
+ // however, to be liberal, we will write them without complaining
+ t.plan(3);
+ var filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.OR,
+ filters: [
+ new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LIKE,
+ property: "person",
+ value: "me"
+ }),
+ new OpenLayers.Filter.FeatureId({fids: ["foo.1", "foo.2"]})
+ ]
+ });
+ var format = new OpenLayers.Format.Filter.v1_0_0();
+
+ var got = format.write(filter);
+ var exp = readXML("LogicalFeatureId");
+ t.xml_eq(got, exp, "wrote FID filter in logical OR without complaint");
+
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.AND,
+ filters: [
+ new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LIKE,
+ property: "person",
+ value: "me"
+ }),
+ new OpenLayers.Filter.FeatureId({fids: ["foo.1", "foo.2"]})
+ ]
+ });
+ got = format.write(filter);
+ exp = readXML("LogicalFeatureIdAnd");
+ t.xml_eq(got, exp, "wrote FID filter in logical AND without complaint");
+
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.NOT,
+ filters: [
+ new OpenLayers.Filter.FeatureId({fids: ["foo.2"]})
+ ]
+ });
+ got = format.write(filter);
+ exp = readXML("LogicalFeatureIdNot");
+ t.xml_eq(got, exp, "wrote FID filter in logical NOT without complaint");
+ }
+
+
+ function readXML(id) {
+ var xml = document.getElementById(id).firstChild.nodeValue;
+ return new OpenLayers.Format.XML().read(xml).documentElement;
+ }
+
+
</script>
</head>
<body>
+
+<div id="LogicalFeatureId"><!--
+<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:Or>
+ <ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
+ <ogc:PropertyName>person</ogc:PropertyName>
+ <ogc:Literal>me</ogc:Literal>
+ </ogc:PropertyIsLike>
+ <ogc:FeatureId fid="foo.1"/>
+ <ogc:FeatureId fid="foo.2"/>
+ </ogc:Or>
+</ogc:Filter>
+--></div>
+<div id="LogicalFeatureIdAnd"><!--
+<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:And>
+ <ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
+ <ogc:PropertyName>person</ogc:PropertyName>
+ <ogc:Literal>me</ogc:Literal>
+ </ogc:PropertyIsLike>
+ <ogc:FeatureId fid="foo.1"/>
+ <ogc:FeatureId fid="foo.2"/>
+ </ogc:And>
+</ogc:Filter>
+--></div>
+<div id="LogicalFeatureIdNot"><!--
+<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:Not>
+ <ogc:FeatureId fid="foo.2"/>
+ </ogc:Not>
+</ogc:Filter>
+--></div>
+
</body>
</html>
Copied: sandbox/cmoullet/openlayers/tests/Format/QueryStringFilter.html (from rev 11762, trunk/openlayers/tests/Format/QueryStringFilter.html)
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/QueryStringFilter.html (rev 0)
+++ sandbox/cmoullet/openlayers/tests/Format/QueryStringFilter.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -0,0 +1,306 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+
+ function test_constructor(t) {
+ t.plan(4);
+ var options = {'foo': 'bar'};
+ var format = new OpenLayers.Format.QueryStringFilter(options);
+ t.ok(format instanceof OpenLayers.Format.QueryStringFilter,
+ "new OpenLayers.Format.QueryStringFilter object");
+ t.eq(format.foo, "bar", "constructor sets options correctly")
+ t.eq(typeof format.write, 'function', 'format has a write function');
+ t.eq(format.options, options, "format.options correctly set");
+ }
+
+ function test_write(t) {
+ t.plan(30);
+
+ // setup
+
+ var format, filter, params;
+
+ format = new OpenLayers.Format.QueryStringFilter();
+
+ // 1 test
+ filter = new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.BBOX,
+ value: new OpenLayers.Bounds(0, 1, 2, 3)
+ });
+ params = format.write(filter);
+ t.eq(params.bbox, [0, 1, 2, 3], "correct bbox param if passed a BBOX filter");
+
+ // 3 tests
+ var lon = 100, lat = 200, tolerance = 10;
+ filter = new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.DWITHIN,
+ value: new OpenLayers.Geometry.Point(lon, lat),
+ distance: tolerance
+ });
+ params = format.write(filter);
+ t.eq(params.lon, lon, "correct lon param if passed a DWITHIN filter");
+ t.eq(params.lat, lat, "correct lat param if passed a DWITHIN filter");
+ t.eq(params.tolerance, tolerance, "correct tolerance param if passed a DWITHIN filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.WITHIN,
+ value: new OpenLayers.Geometry.Point(lon, lat)
+ });
+ params = format.write(filter);
+ t.eq(params.lon, lon, "correct lon param if passed a WITHIN filter");
+ t.eq(params.lat, lat, "correct lat param if passed a WITHIN filter");
+
+ // Some bbox filters used in the next tests.
+
+ var bboxFilter1 = new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.BBOX,
+ value: new OpenLayers.Bounds(0, 0, 10, 10)
+ });
+
+ var bboxFilter2 = new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.BBOX,
+ value: new OpenLayers.Bounds(0, 0, 20, 20)
+ });
+
+ // 1 test
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.AND,
+ filters: []
+ });
+ params = format.write(filter);
+ t.eq(params, {}, "returns empty object if given empty AND Logical filter");
+
+ // 1 test
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.OR,
+ filters: [
+ bboxFilter1
+ ]
+ });
+ params = format.write(filter);
+ t.eq(params, {}, "does not support OR Logical filter");
+
+ // 1 test
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.AND,
+ filters: [
+ bboxFilter1
+ ]
+ });
+ params = format.write(filter);
+ t.eq(params.bbox, [0, 0, 10, 10],
+ "correct bbox param if passed a Logical filter containing a BBOX");
+
+ // 1 test
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.AND,
+ filters: [
+ bboxFilter1, bboxFilter2
+ ]
+ });
+ params = format.write(filter);
+ t.eq(params.bbox, [0, 0, 20, 20],
+ "correct bbox param if passed multiple BBOX filter in a Logical filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.EQUAL_TO,
+ property: "foo",
+ value: "bar"
+ });
+ params = format.write(filter);
+ t.eq(params.queryable[0], "foo",
+ "correct queryable param if passed an EQUAL_TO filter");
+ t.eq(params["foo__eq"], "bar",
+ "correct param key and value if passed an EQUAL_TO filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.NOT_EQUAL_TO,
+ property: "foo",
+ value: "bar"
+ });
+ params = format.write(filter);
+ t.eq(params.queryable[0], "foo",
+ "correct queryable param if passed an NOT_EQUAL_TO filter");
+ t.eq(params["foo__ne"], "bar",
+ "correct param key and value if passed an NOT_EQUAL_TO filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LESS_THAN,
+ property: "foo",
+ value: "bar"
+ });
+ var params = format.write(filter);
+ t.eq(params.queryable[0], "foo",
+ "correct queryable param if passed an LESS_THAN filter");
+ t.eq(params["foo__lt"], "bar",
+ "correct param key and value if passed an LESS_THAN filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO,
+ property: "foo",
+ value: "bar"
+ });
+ var params = format.write(filter);
+ t.eq(params.queryable[0], "foo",
+ "correct queryable param if passed an LESS_THAN_OR_EQUAL_TO filter");
+ t.eq(params["foo__lte"], "bar",
+ "correct param key and value if passed an LESS_THAN_OR_EQUAL_TO filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.GREATER_THAN,
+ property: "foo",
+ value: "bar"
+ });
+ params = format.write(filter);
+ t.eq(params.queryable[0], "foo",
+ "correct queryable param if passed an GREATER_THAN filter");
+ t.eq(params["foo__gt"], "bar",
+ "correct param key and value if passed an GREATER_THAN filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
+ property: "foo",
+ value: "bar"
+ });
+ params = format.write(filter);
+ t.eq(params.queryable[0], "foo",
+ "correct queryable param if passed an GREATER_THAN_OR_EQUAL_TO filter");
+ t.eq(params["foo__gte"], "bar",
+ "correct param key and value if passed an GREATER_THAN_OR_EQUAL_TO filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LIKE,
+ property: "foo",
+ value: "bar"
+ });
+ params = format.write(filter);
+ t.eq(params.queryable[0], "foo",
+ "correct queryable param if passed a LIKE filter");
+ t.eq(params["foo__ilike"], "bar",
+ "correct param key and value if passed an LIKE filter");
+
+ // 4 tests
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.AND,
+ filters: [
+ new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.EQUAL_TO,
+ property: "foo",
+ value: "bar"
+ }),
+ new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LESS_THAN,
+ property: "foo2",
+ value: "baz"
+ })
+ ]
+ });
+ params = format.write(filter);
+ t.eq(params.queryable[0], "foo",
+ "correct queryable param if passed an EQUAL_TO filter within a AND filter");
+ t.eq(params["foo__eq"], "bar",
+ "correct param key and value if passed an EQUAL_TO filter within a AND filter");
+ t.eq(params.queryable[1], "foo2",
+ "correct queryable param if passed a LESS_THAN filter within a AND filter");
+ t.eq(params["foo2__lt"], "baz",
+ "correct param key and value if passed a LESS_THAN filter within a AND filter");
+
+ // 2 tests
+ format = new OpenLayers.Format.QueryStringFilter({wildcarded: true});
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LIKE,
+ property: "foo",
+ value: "bar"
+ });
+ params = format.write(filter);
+ t.eq(params.queryable[0], "foo",
+ "correct queryable param if passed a LIKE filter (wildcarded true)");
+ t.eq(params["foo__ilike"], "%bar%",
+ "correct param key and value if passed an LIKE filter (wildcarded true)");
+ }
+
+ function test_regex2value(t) {
+ t.plan(16);
+
+ // setup
+
+ var format = new OpenLayers.Format.QueryStringFilter();
+
+ var value;
+ var filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LIKE,
+ property: "prop"
+ });
+
+ function serialize(value) {
+ filter.value = value;
+ return format.write(filter).prop__ilike;
+ }
+
+ // test
+
+ value = serialize("foo");
+ t.eq(value, "foo", 'regex2value converts "foo" to "foo"');
+
+ value = serialize("foo%");
+ t.eq(value, "foo\\%", 'regex2value converts "foo%" to "foo\\%"');
+
+ value = serialize("foo.*");
+ t.eq(value, "foo%", 'regex2value converts "foo.*" to "foo%"');
+
+ value = serialize("f.*oo.*");
+ t.eq(value, "f%oo%", 'regex2value converts "f.*oo.*" to "f%oo%"');
+
+ value = serialize("foo.");
+ t.eq(value, "foo_", 'regex2value converts "foo." to "foo_"');
+
+ value = serialize("f.oo.");
+ t.eq(value, "f_oo_", 'regex2value converts "f.oo." to "f_oo_"');
+
+ value = serialize("f.oo.*");
+ t.eq(value, "f_oo%", 'regex2value converts "f.oo.*" to "f_oo%"');
+
+ value = serialize("foo\\\\");
+ t.eq(value, "foo\\\\", 'regex2value converts "foo\\\\" to "foo\\\\"');
+
+ value = serialize("foo\\.");
+ t.eq(value, "foo.", 'regex2value converts "foo\\." to "foo."');
+
+ value = serialize("foo\\\\.");
+ t.eq(value, "foo\\\\_", 'regex2value converts "foo\\\\." to "foo\\\\_"');
+
+ value = serialize("foo\\*");
+ t.eq(value, "foo*", 'regex2value converts "foo\\*" to "foo*"');
+
+ value = serialize("foo\\\\*");
+ t.eq(value, "foo\\\\*", 'regex2value converts "foo\\\\*" to "foo\\\\*"');
+
+ value = serialize("foo\\\\.*");
+ t.eq(value, "foo\\\\%", 'regex2value converts "foo\\\\.*" to "foo\\\\%"');
+
+ value = serialize("fo\\.o.*");
+ t.eq(value, "fo.o%", 'regex2value converts from "fo\\.o.*" to "fo.o%"');
+
+ value = serialize("fo.*o\\.");
+ t.eq(value, "fo%o.", 'regex2value converts from "fo.*o\\." to "to%o."');
+
+ value = serialize("\\*\\..*.\\\\.*\\\\.%");
+ t.eq(value, "*.%_\\\\%\\\\_\\%",
+ 'regex2value converts from "\\*\\..*.\\\\.*\\\\.%" ' +
+ 'to "*.%_\\\\%\\\\_\\%"');
+ }
+
+ </script>
+</head>
+<body>
+</body>
+</html>
Added: sandbox/cmoullet/openlayers/tests/Format/XLS/v1_1_0.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/XLS/v1_1_0.html (rev 0)
+++ sandbox/cmoullet/openlayers/tests/Format/XLS/v1_1_0.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -0,0 +1,98 @@
+<html>
+<head>
+ <script src="../../../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ function test_read(t) {
+ t.plan(16);
+ var response = '<xls:GeocodeResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd" xmlns:xls="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml"><xls:GeocodeResponseList numberOfGeocodedAddresses="1"><xls:GeocodedAddress><gml:Point srsName="EPSG:28992"><gml:pos dimension="2">122650 483904</gml:pos></gml:Point><xls:Address countryCode="NL"><xls:StreetAddress><xls:Building number="1"/><xls:Street>president kennedylaan</xls:Street></xls:StreetAddress><xls:Place type="MunicipalitySubdivision">amsterdam</xls:Place><xls:Place type="Municipality">amsterdam</xls:Place><xls:Place type="CountrySubdivision">noord holland</xls:Place><xls:PostalCode>1079MB</xls:PostalCode></xls:Address></xls:GeocodedAddress></xls:GeocodeResponseList></xls:GeocodeResponse>';
+ var format = new OpenLayers.Format.XLS();
+ var output = format.read(response);
+ t.eq(output.responseLists.length, 1, "Output contains 1 responseList");
+ var responseList = output.responseLists[0];
+ t.eq(responseList.numberOfGeocodedAddresses, 1, "Responselist contains 1 geocoded address");
+ t.eq(responseList.features.length, 1, "1 feature parsed");
+ var feature = responseList.features[0];
+ var address = feature.attributes.address;
+ t.eq(address.building["number"], "1", "Building number correctly parsed");
+ t.eq(address.countryCode, "NL", "Country code correctly parsed");
+ t.eq(address.place.CountrySubdivision, "noord holland", "CountrySubDivision correctly parsed");
+ t.eq(address.place.Municipality, "amsterdam", "Municipality correctly parsed");
+ t.eq(address.place.MunicipalitySubdivision, "amsterdam", "MunicipalitySubdivision correctly parsed");
+ t.eq(address.postalCode, "1079MB", "Postalcode correctly parsed");
+ t.eq(address.street[0], "president kennedylaan", "Street correctly parsed");
+ t.eq(feature.geometry.x, 122650, "Geometry [x] correctly parsed");
+ t.eq(feature.geometry.y, 483904, "Geometry [y] correctly parsed");
+
+ var responseList = [];
+ responseList.push('<?xml version="1.0" encoding="UTF-8" ?>',
+'<XLS xmlns="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/xls LocationUtilityService.xsd" version="1.1">',
+' <ResponseHeader/>',
+' <Response version="1.1" requestID="">',
+' <GeocodeResponse>',
+' <GeocodeResponseList numberOfGeocodedAddresses="2">',
+' <GeocodedAddress>',
+' <gml:Point>',
+' <gml:pos>-71.4589837781615 41.8317239069808</gml:pos>',
+' </gml:Point>',
+' <Address countryCode="">',
+' <StreetAddress>',
+' <Street></Street>',
+' <Street/>',
+' </StreetAddress>',
+' <Place type="Municipality"></Place>',
+' <Place type="CountrySubdivision"></Place>',
+' <PostalCode></PostalCode>',
+' </Address>',
+' <GeocodeMatchCode accuracy="100.0"/>',
+' </GeocodedAddress>',
+' <GeocodedAddress>',
+' <gml:Point>',
+' <gml:pos>-71.4087296631643 41.8269575002255</gml:pos>',
+' </gml:Point>',
+' <Address countryCode="">',
+' <StreetAddress>',
+' <Street></Street>',
+' <Street/>',
+' </StreetAddress>',
+' <Place type="Municipality"></Place>',
+' <Place type="CountrySubdivision"></Place>',
+' <PostalCode></PostalCode>',
+' </Address>',
+' <GeocodeMatchCode accuracy="100.0"/>',
+' </GeocodedAddress>',
+' </GeocodeResponseList>',
+' </GeocodeResponse>',
+' </Response>',
+'</XLS>');
+ response = responseList.join("");
+ output = format.read(response);
+ t.eq(output.version, "1.1", "Version correctly parsed");
+ var responseList = output.responseLists[0];
+ t.eq(responseList.numberOfGeocodedAddresses, 2, "2 addresses parsed");
+ t.eq(responseList.features.length, 2, "2 features parsed");
+ t.eq(responseList.features[0].attributes.matchCode.accuracy, 100.0, "Accuracy correctly parsed");
+ }
+
+ function test_write(t) {
+ t.plan(1);
+
+ var format = new OpenLayers.Format.XLS();
+ var address = {
+ countryCode: 'US',
+ street: '1 Freedom Rd',
+ municipality: 'Providence',
+ countrySubdivision: 'RI',
+ postalCode: '02909'
+ };
+ var request = format.write({addresses: [address]});
+
+ var expected = '<xls:XLS xmlns:xls="http://www.opengis.net/xls" version="1.1" xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.1.0/LocationUtilityService.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><xls:RequestHeader/><xls:Request methodName="GeocodeRequest" requestID="" version="1.1"><xls:GeocodeRequest><xls:Address countryCode="US"><xls:StreetAddress><xls:Street>1 Freedom Rd</xls:Street></xls:StreetAddress><xls:Place type="Municipality">Providence</xls:Place><xls:Place type="CountrySubdivision">RI</xls:Place><xls:PostalCode>02909</xls:PostalCode></xls:Address></xls:GeocodeRequest></xls:Request></xls:XLS>';
+
+ t.xml_eq(request, expected, "XLS geocode request correctly written");
+ }
+
+ </script>
+</head>
+<body>
+</body>
+</html>
Modified: sandbox/cmoullet/openlayers/tests/Handler/Box.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Box.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tests/Handler/Box.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -2,6 +2,64 @@
<head>
<script src="../OLLoader.js"></script>
<script type="text/javascript">
+ function test_Handler_Box_constructor(t) {
+ t.plan(4);
+ var control = new OpenLayers.Control();
+ control.id = Math.random();
+ var callbacks = {done: "bar"};
+ var options = {bar: "foo"};
+
+ var handler = new OpenLayers.Handler.Box(control, callbacks, options);
+
+ t.eq(handler.control.id, control.id, "handler created with the correct control");
+ t.eq(handler.callbacks.done, "bar", "handler created with the correct callback");
+ t.eq(handler.bar, "foo", "handler created with the correct options");
+ t.ok(handler.dragHandler instanceof OpenLayers.Handler.Drag, "drag handler created");
+ }
+
+ function test_Handler_Box_draw(t) {
+ var testAll = true;
+ if (document.defaultView && document.defaultView.getComputedStyle &&
+ !document.defaultView.getComputedStyle(document.body)) {
+ // we don't get dimensions for hidden frames in FF4, and our test
+ // runs in a hidden frame.
+ testAll = false;
+ }
+
+ t.plan(testAll ? 12 : 2);
+
+ var map = new OpenLayers.Map('map');
+ var control = new OpenLayers.Control();
+ map.addControl(control);
+ var handler = new OpenLayers.Handler.Box(control, {done: function(e) {
+ t.ok(e.equals(new OpenLayers.Bounds(5, 11, 11, 5)), "box result correct");
+ }});
+ handler.activate();
+ handler.dragHandler.start = {x: 5, y: 5};
+ handler.startBox({x: 5, y: 5});
+ var offset = handler.getBoxOffsets();
+ if (testAll) {
+ t.eq(parseInt(handler.zoomBox.style.left), 5 - offset.left, "x position of box correct");
+ t.eq(parseInt(handler.zoomBox.style.top), 5 - offset.top, "y position of box correct");
+ }
+ handler.moveBox({x: 10, y: 10});
+ if (testAll) {
+ t.eq(parseInt(handler.zoomBox.style.left), 5 - offset.left, "x position of box still correct");
+ t.eq(parseInt(handler.zoomBox.style.top), 5 - offset.top, "y position of box still correct");
+ t.eq(parseInt(handler.zoomBox.style.width), 5 + offset.width + 1, "x dimension of box correct");
+ t.eq(parseInt(handler.zoomBox.style.height), 5 + offset.height + 1, "y dimension of box correct");
+ }
+ handler.moveBox({x: 0, y: 0});
+ if (testAll) {
+ t.eq(parseInt(handler.zoomBox.style.left), 0 - offset.left, "new x position of box correct");
+ t.eq(parseInt(handler.zoomBox.style.top), 0 - offset.top, "new y position of box correct");
+ t.eq(parseInt(handler.zoomBox.style.width), 5 + offset.width + 1, "x dimension of box still correct");
+ t.eq(parseInt(handler.zoomBox.style.height), 5 + offset.height + 1, "y dimension of box still correct");
+ }
+ handler.endBox({x: 11, y: 11});
+ t.eq(handler.zoomBox, null, "box removed after endBox");
+ }
+
function test_Handler_Box_destroy(t) {
t.plan(1);
var map = new OpenLayers.Map('map');
@@ -21,6 +79,6 @@
</script>
</head>
<body>
- <div id="map" style="width: 300px; height: 150px;"/>
+ <div id="map" style="width: 300px; height: 150px;"></div>
</body>
</html>
Modified: sandbox/cmoullet/openlayers/tests/Handler/Path.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Path.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tests/Handler/Path.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -67,7 +67,7 @@
"activate adds the line feature to the layer");
t.eq(log.length, 1,
"activate calls \"create\" once");
- t.geom_eq(log[0].geometry, handler.point.geometry,
+ t.ok(log[0].geometry == handler.point.geometry,
"\"create\" called with expected geometry");
t.ok(log[0].feature == handler.line,
"\"create\" called with expected feature");
@@ -78,6 +78,32 @@
map.destroy();
}
+ // See: http://trac.osgeo.org/openlayers/ticket/3179
+ function test_activate_before_map_is_centered(t) {
+ t.plan(1);
+ var map = new OpenLayers.Map('map', {
+ resolutions: [1]
+ });
+ var layer = new OpenLayers.Layer.Vector("foo", {
+ maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+ isBaseLayer: true
+ });
+ map.addLayer(layer);
+ var control = new OpenLayers.Control();
+ var handler = new OpenLayers.Handler.Path(control, {});
+ control.handler = handler;
+ map.addControl(control);
+
+ var error;
+ try {
+ handler.activate();
+ error = false;
+ } catch(err) {
+ error = true;
+ }
+ t.ok(!error, "no error on activate");
+ }
+
function test_bounds(t) {
t.plan(2);
var geometry;
@@ -159,8 +185,8 @@
t.eq(logs.length, 1, "[activate] called back");
log = logs.shift();
t.eq(log.type, "create", "[activate] create called");
- t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
- "[activate] correct point");
+ t.ok(isNaN(log.args[0].x) && isNaN(log.args[0].y),
+ "[activate] initial point");
t.ok(log.args[1] == handler.line,
"[activate] correct feature");
// mouse move
@@ -260,8 +286,8 @@
);
log = logs.shift();
t.eq(log.type, "create", "[dblclick] create called");
- t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
- "[dblclick] correct point");
+ t.ok(isNaN(log.args[0].x) && isNaN(log.args[0].y),
+ "[dblclick] initial point");
t.ok(log.args[1] == handler.line,
"[dblclick] correct feature");
// cancel
@@ -269,16 +295,13 @@
t.eq(logs.length, 2, "[cancel] called back");
log = logs.shift();
t.eq(log.type, "cancel", "[cancel] canced called");
- t.geom_eq(log.args[0],
- new OpenLayers.Geometry.LineString([
- new OpenLayers.Geometry.Point(-200, 125)
- ]),
- "[cancel] correct linestring"
+ t.ok(isNaN(log.args[0].components[0].x) && isNaN(log.args[0].components[0].y),
+ "[cancel] initial linestring"
);
log = logs.shift();
t.eq(log.type, "create", "[cancel] create called");
- t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
- "[cancel] correct point");
+ t.ok(isNaN(log.args[0].x) && isNaN(log.args[0].y),
+ "[cancel] initial point");
map.destroy();
}
@@ -749,95 +772,180 @@
]), "geometry is correct after mousemove");
}
- function test_sequence_touch_1(t) {
- t.plan(19);
-
- log = [];
- var map = new OpenLayers.Map("map", { // 300 x 150
+
+ // a) tap
+ // b) tap
+ // c) doubletap
+ function test_touch_sequence1(t) {
+ t.plan(17);
+
+ // set up
+
+ var log;
+ var map = new OpenLayers.Map("map", {
resolutions: [1]
});
var layer = new OpenLayers.Layer.Vector("foo", {
- maxExtent: new OpenLayers.Bounds(-100, -100, 100, 100),
+ maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
isBaseLayer: true
});
map.addLayer(layer);
var control = new OpenLayers.Control({});
var handler = new OpenLayers.Handler.Path(control, {
- "done": function(g, f) {
- log.push({geometry: g, feature: f});
+ done: function(g, f) {
+ log = {type: 'done', geometry: g, feature: f};
+ },
+ modify: function(g, f) {
+ log = {type: 'modify', geometry: g, feature: f};
}
+ }, {
+ dblclickTolerance: 2
});
control.handler = handler;
map.addControl(control);
- map.setCenter(new OpenLayers.LonLat(0, 0), 5);
+ map.setCenter(new OpenLayers.LonLat(0, 0), 0);
handler.activate();
- handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(49, 75)});
- t.eq(log.length, 0, "touch start 1");
+ // test
- handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(50, 75)});
- t.eq(log.length, 0, "touch move");
+ var ret;
- handler.touchend({type: "touchend"});
- t.eq(log.length, 0, "touch end");
- t.geom_eq(handler.line.geometry,
+ // tap on (1, 0)
+ log = null;
+ ret = handler.touchstart({xy: new OpenLayers.Pixel(0, 0)});
+ t.ok(ret, '[touchstart] event propagates');
+ t.eq(log, null, '[touchstart] feature not finalized or modified');
+ ret = handler.touchmove({xy: new OpenLayers.Pixel(1, 0)});
+ t.ok(ret, '[touchmove] event propagates');
+ t.eq(log, null, '[touchmove] feature not finalized or modified');
+ ret = handler.touchend({});
+ t.ok(ret, '[touchend] event propagates');
+ t.eq(log.type, 'modify', '[touchend] feature modified');
+ t.geom_eq(log.geometry, new OpenLayers.Geometry.Point(-149, 75),
+ "[touchend] correct point");
+
+ // tap on (10, 10)
+ log = null;
+ ret = handler.touchstart({xy: new OpenLayers.Pixel(9, 10)});
+ t.ok(ret, '[touchstart] event propagates');
+ t.eq(log, null, '[touchstart] feature not finalized or modified');
+ ret = handler.touchmove({xy: new OpenLayers.Pixel(10, 10)});
+ t.ok(ret, '[touchmove] event propagates');
+ t.eq(log, null, '[touchmove] feature not finalized or modified');
+ ret = handler.touchend({});
+ t.ok(ret, '[touchend] event propagates');
+ t.eq(log.type, 'modify', '[touchend] feature modified');
+ t.geom_eq(log.geometry, new OpenLayers.Geometry.Point(-140, 65),
+ "[touchend] correct point");
+
+ // tap on (11, 10) -> doubletap
+ log = null;
+ ret = handler.touchstart({xy: new OpenLayers.Pixel(11, 10)});
+ t.ok(!ret, '[touchstart] event does not propagate');
+ t.eq(log.type, 'done', '[touchend] feature finalized');
+ t.geom_eq(log.geometry,
new OpenLayers.Geometry.LineString([
- new OpenLayers.Geometry.Point(-100, 0),
- new OpenLayers.Geometry.Point(-100, 0)
- ]), "geometry is correct");
+ new OpenLayers.Geometry.Point(-149, 75), // (1, 0)
+ new OpenLayers.Geometry.Point(-140, 65) // (10, 10)
+ ]), "[touchstart] final geometry is correct");
- handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(100, 75)});
- t.eq(log.length, 0, "touch start 2");
+ // tear down
- handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(250, 75)});
- t.eq(log.length, 0, "touch move");
+ map.destroy();
+ }
- handler.touchend({type: "touchend"});
- t.eq(log.length, 0, "touch end");
- t.geom_eq(handler.line.geometry,
- new OpenLayers.Geometry.LineString([
- new OpenLayers.Geometry.Point(-100, 0),
- new OpenLayers.Geometry.Point(-100, 0)
- ]), "geometry is correct");
-
- handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(100, 75)});
- t.eq(log.length, 0, "touch start 3");
+ // a) tap
+ // b) tap-move
+ // c) tap
+ // d) doubletap
+ function test_touch_sequence2(t) {
+ t.plan(23);
- handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(100, 75)});
- t.eq(log.length, 0, "touch move");
+ // set up
- handler.touchend({type: "touchend"});
- t.eq(log.length, 0, "touch end");
- t.geom_eq(handler.line.geometry,
- new OpenLayers.Geometry.LineString([
- new OpenLayers.Geometry.Point(-100, 0),
- new OpenLayers.Geometry.Point(-50, 0),
- new OpenLayers.Geometry.Point(-50, 0)
- ]), "geometry is correct");
-
- handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(252, 100)});
- t.eq(log.length, 0, "touch start 4");
+ var log;
+ var map = new OpenLayers.Map("map", {
+ resolutions: [1]
+ });
+ var layer = new OpenLayers.Layer.Vector("foo", {
+ maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+ isBaseLayer: true
+ });
+ map.addLayer(layer);
+ var control = new OpenLayers.Control({});
+ var handler = new OpenLayers.Handler.Path(control, {
+ done: function(g, f) {
+ log = {type: 'done', geometry: g, feature: f};
+ },
+ modify: function(g, f) {
+ log = {type: 'modify', geometry: g, feature: f};
+ }
+ }, {
+ dblclickTolerance: 2
+ });
+ control.handler = handler;
+ map.addControl(control);
+ map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+ handler.activate();
- handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(252, 100)});
- t.eq(log.length, 0, "touch move");
+ // test
- handler.touchend({type: "touchend"});
- t.eq(log.length, 0, "touch end");
-
- handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(250, 100)});
- t.eq(log.length, 1, "touch start");
+ var ret;
- handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(250, 100)});
- t.eq(log.length, 1, "touch move");
+ // tap on (1, 0)
+ log = null;
+ ret = handler.touchstart({xy: new OpenLayers.Pixel(0, 0)});
+ t.ok(ret, '[touchstart] event propagates');
+ t.eq(log, null, '[touchstart] feature not finalized or modified');
+ ret = handler.touchmove({xy: new OpenLayers.Pixel(1, 0)});
+ t.ok(ret, '[touchmove] event propagates');
+ t.eq(log, null, '[touchmove] feature not finalized or modified');
+ ret = handler.touchend({});
+ t.ok(ret, '[touchend] event propagates');
+ t.eq(log.type, 'modify', '[touchend] feature modified');
+ t.geom_eq(log.geometry, new OpenLayers.Geometry.Point(-149, 75),
+ "[touchend] correct point");
- handler.touchend({type: "touchend"});
- t.eq(log.length, 1, "touch end");
- t.geom_eq(log[0].geometry,
+ // tap-move
+ log = null;
+ ret = handler.touchstart({xy: new OpenLayers.Pixel(9, 10)});
+ t.ok(ret, '[touchstart] event propagates');
+ t.eq(log, null, '[touchstart] feature not finalized or modified');
+ ret = handler.touchmove({xy: new OpenLayers.Pixel(20, 20)});
+ t.ok(ret, '[touchmove] event propagates');
+ t.eq(log, null, '[touchmove] feature not finalized or modified');
+ ret = handler.touchend({});
+ t.ok(ret, '[touchend] event propagates');
+ t.eq(log, null, '[touchend] feature not finalized or modified');
+
+ // tap on (10, 10)
+ log = null;
+ ret = handler.touchstart({xy: new OpenLayers.Pixel(9, 10)});
+ t.ok(ret, '[touchstart] event propagates');
+ t.eq(log, null, '[touchstart] feature not finalized or modified');
+ ret = handler.touchmove({xy: new OpenLayers.Pixel(10, 10)});
+ t.ok(ret, '[touchmove] event propagates');
+ t.eq(log, null, '[touchmove] feature not finalized or modified');
+ ret = handler.touchend({});
+ t.ok(ret, '[touchend] event propagates');
+ t.eq(log.type, 'modify', '[touchend] feature modified');
+ t.geom_eq(log.geometry, new OpenLayers.Geometry.Point(-140, 65),
+ "[touchend] correct point");
+
+ // tap on (11, 10) -> doubletap
+ log = null;
+ ret = handler.touchstart({xy: new OpenLayers.Pixel(11, 10)});
+ t.ok(!ret, '[touchstart] event does not propagate');
+ t.eq(log.type, 'done', '[touchend] feature finalized');
+ t.geom_eq(log.geometry,
new OpenLayers.Geometry.LineString([
- new OpenLayers.Geometry.Point(-100, 0),
- new OpenLayers.Geometry.Point(-50, 0),
- new OpenLayers.Geometry.Point(102, -25)
- ]), "geometry is correct");
+ new OpenLayers.Geometry.Point(-149, 75), // (1, 0)
+ new OpenLayers.Geometry.Point(-140, 65) // (10, 10)
+ ]), "[touchstart] final geometry is correct");
+
+ // tear down
+
+ map.destroy();
}
</script>
Modified: sandbox/cmoullet/openlayers/tests/Handler/Point.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Point.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tests/Handler/Point.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -416,50 +416,121 @@
t.eq(handler.point, null,
"handler.point is null after destroy");
}
-
- function test_sequence_touch_1(t) {
- t.plan(7);
- log = [];
- var map = new OpenLayers.Map("map", { // 300 x 150
+ //
+ // Sequence tests
+ //
+ // Sequence tests basically involve executing a sequence of events
+ // and testing the resulting geometry.
+ //
+ // Below are tests for various drawing sequences. Tests can be
+ // added here each a non-working sequence is found.
+ //
+
+ // tap
+ function test_touch_sequence1(t) {
+ t.plan(8);
+
+ // set up
+
+ var log;
+ var map = new OpenLayers.Map("map", {
resolutions: [1]
});
var layer = new OpenLayers.Layer.Vector("foo", {
- maxExtent: new OpenLayers.Bounds(-100, -100, 100, 100),
+ maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
isBaseLayer: true
});
map.addLayer(layer);
- var control = new OpenLayers.Control();
+ var control = new OpenLayers.Control({});
var handler = new OpenLayers.Handler.Point(control, {
- "done": function(g, f) {
- log.push({geometry: g, feature: f});
+ done: function(g, f) {
+ log = {geometry: g, feature: f};
}
});
control.handler = handler;
map.addControl(control);
- map.setCenter(new OpenLayers.LonLat(0, 0), 5);
+ map.setCenter(new OpenLayers.LonLat(0, 0), 0);
handler.activate();
-
- handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(50, 75)});
- t.eq(log.length, 0, "touch start 1");
-
- handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(250, 75)});
- t.eq(log.length, 0, "touch move");
- handler.touchend({type: "touchend"});
- t.eq(log.length, 0, "touch end");
-
- handler.touchstart({type: "touchstart", xy: new OpenLayers.Pixel(99, 75)});
- t.eq(log.length, 0, "touch start 2");
+ // test
- handler.touchmove({type: "touchmove", xy: new OpenLayers.Pixel(100, 75)});
- t.eq(log.length, 0, "touch move");
+ var ret;
- handler.touchend({type: "touchend"});
- t.eq(log.length, 1, "touch end");
- t.geom_eq(log[0].geometry, new OpenLayers.Geometry.Point(-50, 0), "geometry is correct");
+ // tap on (1, 0)
+ log = null;
+ ret = handler.touchstart({xy: new OpenLayers.Pixel(0, 0)});
+ t.ok(ret, '[touchstart] event propagates');
+ t.eq(log, null, '[touchstart] no finalization');
+ t.ok(isNaN(handler.point.geometry.x) && isNaN(handler.point.geometry.y),
+ '[touchstart] feature not modified');
+ ret = handler.touchmove({xy: new OpenLayers.Pixel(1, 0)});
+ t.ok(ret, '[touchmove] event propagates');
+ t.eq(log, null, '[touchmove] no finalization');
+ t.ok(isNaN(handler.point.geometry.x) && isNaN(handler.point.geometry.y),
+ '[touchmove] feature not modified');
+ ret = handler.touchend({});
+ t.ok(ret, '[touchend] event propagates');
+ t.geom_eq(log.geometry, new OpenLayers.Geometry.Point(-149, 75),
+ "[touchend] correct point");
+ // tear down
+
+ map.destroy();
}
+ // tap-move
+ function test_touch_sequence2(t) {
+ t.plan(9);
+
+ // set up
+
+ var log;
+ var map = new OpenLayers.Map("map", {
+ resolutions: [1]
+ });
+ var layer = new OpenLayers.Layer.Vector("foo", {
+ maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+ isBaseLayer: true
+ });
+ map.addLayer(layer);
+ var control = new OpenLayers.Control({});
+ var handler = new OpenLayers.Handler.Point(control, {
+ done: function(g, f) {
+ log = {geometry: g, feature: f};
+ }
+ });
+ control.handler = handler;
+ map.addControl(control);
+ map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+ handler.activate();
+
+ // test
+
+ var ret;
+
+ // tap-move (0, 0) -> (9, 0)
+ log = null;
+ ret = handler.touchstart({xy: new OpenLayers.Pixel(0, 0)});
+ t.ok(ret, '[touchstart] event propagates');
+ t.eq(log, null, '[touchstart] no finalization');
+ t.ok(isNaN(handler.point.geometry.x) && isNaN(handler.point.geometry.y),
+ '[touchstart] feature not modified');
+ ret = handler.touchmove({xy: new OpenLayers.Pixel(9, 0)});
+ t.ok(ret, '[touchmove] event propagates');
+ t.eq(log, null, '[touchmove] no finalization');
+ t.ok(isNaN(handler.point.geometry.x) && isNaN(handler.point.geometry.y),
+ '[touchmove] feature not modified');
+ ret = handler.touchend({});
+ t.ok(ret, '[touchend] event propagates');
+ t.eq(log, null, '[touchend] no finalization');
+ t.ok(isNaN(handler.point.geometry.x) && isNaN(handler.point.geometry.y),
+ '[touchend] feature not modified');
+
+ // tear down
+
+ map.destroy();
+ }
+
</script>
</head>
<body>
Modified: sandbox/cmoullet/openlayers/tests/Handler/Polygon.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Polygon.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tests/Handler/Polygon.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -69,7 +69,7 @@
"activate adds the polygin feature to the layer");
t.eq(log.length, 1,
"activate calls \"create\" once");
- t.geom_eq(log[0].geometry, handler.point.geometry,
+ t.ok(log[0].geometry == handler.point.geometry,
"\"create\" called with expected geometry");
t.ok(log[0].feature == handler.polygon,
"\"create\" called with expected feature");
@@ -80,6 +80,32 @@
map.destroy();
}
+ // See: http://trac.osgeo.org/openlayers/ticket/3179
+ function test_activate_before_map_is_centered(t) {
+ t.plan(1);
+ var map = new OpenLayers.Map('map', {
+ resolutions: [1]
+ });
+ var layer = new OpenLayers.Layer.Vector("foo", {
+ maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+ isBaseLayer: true
+ });
+ map.addLayer(layer);
+ var control = new OpenLayers.Control();
+ var handler = new OpenLayers.Handler.Polygon(control, {});
+ control.handler = handler;
+ map.addControl(control);
+
+ var error;
+ try {
+ handler.activate();
+ error = false;
+ } catch(err) {
+ error = true;
+ }
+ t.ok(!error, "no error on activate");
+ }
+
function test_bounds_stopDown_true(t) {
t.plan(2);
var map = new OpenLayers.Map('map');
@@ -157,8 +183,8 @@
t.eq(logs.length, 1, "[activate] called back");
log = logs.shift();
t.eq(log.type, "create", "[activate] create called");
- t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
- "[activate] correct point");
+ t.ok(isNaN(log.args[0].x) && isNaN(log.args[0].y),
+ "[activate] initial point");
t.ok(log.args[1] == handler.polygon,
"[activate] correct feature");
handler.mousemove(
@@ -279,8 +305,8 @@
);
log = logs.shift();
t.eq(log.type, "create", "[dblclick] create called");
- t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
- "[dblclick] correct point");
+ t.ok(isNaN(log.args[0].x) && isNaN(log.args[0].y),
+ "[dblclick] initial point");
t.ok(log.args[1] == handler.polygon,
"[dblclick] correct feature");
// cancel
@@ -290,8 +316,8 @@
t.eq(log.type, "cancel", "[cancel] canced called");
log = logs.shift();
t.eq(log.type, "create", "[cancel] create called");
- t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
- "[cancel] correct point");
+ t.ok(isNaN(log.args[0].x) && isNaN(log.args[0].y),
+ "[cancel] initial point");
map.destroy();
}
Deleted: sandbox/cmoullet/openlayers/tests/Protocol/SimpleFilterSerializer.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Protocol/SimpleFilterSerializer.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tests/Protocol/SimpleFilterSerializer.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -1,310 +0,0 @@
-<html>
-<head>
- <script src="../../lib/OpenLayers.js"></script>
- <script type="text/javascript">
-
-
- function test_filterToParams(t) {
- t.plan(30);
-
- // setup
-
- var protocol, filter, params;
-
- protocol = new OpenLayers.Protocol.HTTP({
- filterToParams: OpenLayers.Protocol.simpleFilterSerializer
- });
-
- // 1 test
- var filter = new OpenLayers.Filter.Spatial({
- type: OpenLayers.Filter.Spatial.BBOX,
- value: new OpenLayers.Bounds(0, 1, 2, 3)
- });
- params = protocol.filterToParams(filter);
- t.eq(params.bbox, [0, 1, 2, 3],
- "filterToParams sets correct bbox param if passed a BBOX filter");
-
- // 3 tests
- var lon = 100, lat = 200, tolerance = 10;
- filter = new OpenLayers.Filter.Spatial({
- type: OpenLayers.Filter.Spatial.DWITHIN,
- value: new OpenLayers.Geometry.Point(lon, lat),
- distance: tolerance
- });
- params = protocol.filterToParams(filter);
- t.eq(params.lon, lon,
- "filterToParams sets correct lon param if passed a DWITHIN filter");
- t.eq(params.lat, lat,
- "filterToParams sets correct lat param if passed a DWITHIN filter");
- t.eq(params.tolerance, tolerance,
- "filterToParams sets correct tolerance param if passed a DWITHIN filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Spatial({
- type: OpenLayers.Filter.Spatial.WITHIN,
- value: new OpenLayers.Geometry.Point(lon, lat)
- });
- params = protocol.filterToParams(filter);
- t.eq(params.lon, lon,
- "filterToParams sets correct lon param if passed a WITHIN filter");
- t.eq(params.lat, lat,
- "filterToParams sets correct lat param if passed a WITHIN filter");
-
- // Some bbox filters used in the next tests.
-
- var bboxFilter1 = new OpenLayers.Filter.Spatial({
- type: OpenLayers.Filter.Spatial.BBOX,
- value: new OpenLayers.Bounds(0, 0, 10, 10)
- });
-
- var bboxFilter2 = new OpenLayers.Filter.Spatial({
- type: OpenLayers.Filter.Spatial.BBOX,
- value: new OpenLayers.Bounds(0, 0, 20, 20)
- });
-
- // 1 test
- filter = new OpenLayers.Filter.Logical({
- type: OpenLayers.Filter.Logical.AND,
- filters: []
- });
- params = protocol.filterToParams(filter);
- t.eq(params, {},
- "filterToParams returns empty object if given empty AND Logical filter");
-
- // 1 test
- filter = new OpenLayers.Filter.Logical({
- type: OpenLayers.Filter.Logical.OR,
- filters: [
- bboxFilter1
- ]
- });
- params = protocol.filterToParams(filter);
- t.eq(params, {},
- "filterToParams does not support OR Logical filter");
-
- // 1 test
- filter = new OpenLayers.Filter.Logical({
- type: OpenLayers.Filter.Logical.AND,
- filters: [
- bboxFilter1
- ]
- });
- params = protocol.filterToParams(filter);
- t.eq(params.bbox, [0, 0, 10, 10],
- "filterToParams sets correct bbox param if passed " +
- "a Logical filter containing a BBOX");
-
- // 1 test
- filter = new OpenLayers.Filter.Logical({
- type: OpenLayers.Filter.Logical.AND,
- filters: [
- bboxFilter1, bboxFilter2
- ]
- });
- params = protocol.filterToParams(filter);
- t.eq(params.bbox, [0, 0, 20, 20],
- "filterToParams sets correct bbox param if passed " +
- "multiple BBOX filter in a Logical filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.EQUAL_TO,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an EQUAL_TO filter");
- t.eq(params["foo__eq"], "bar",
- "filterToParams sets correct param key and value if passed an EQUAL_TO filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.NOT_EQUAL_TO,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an NOT_EQUAL_TO filter");
- t.eq(params["foo__ne"], "bar",
- "filterToParams sets correct param key and value if passed an NOT_EQUAL_TO filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LESS_THAN,
- property: "foo",
- value: "bar"
- });
- var params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an LESS_THAN filter");
- t.eq(params["foo__lt"], "bar",
- "filterToParams sets correct param key and value if passed an LESS_THAN filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO,
- property: "foo",
- value: "bar"
- });
- var params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an LESS_THAN_OR_EQUAL_TO filter");
- t.eq(params["foo__lte"], "bar",
- "filterToParams sets correct param key and value if passed an LESS_THAN_OR_EQUAL_TO filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.GREATER_THAN,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an GREATER_THAN filter");
- t.eq(params["foo__gt"], "bar",
- "filterToParams sets correct param key and value if passed an GREATER_THAN filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an GREATER_THAN_OR_EQUAL_TO filter");
- t.eq(params["foo__gte"], "bar",
- "filterToParams sets correct param key and value if passed an GREATER_THAN_OR_EQUAL_TO filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LIKE,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed a LIKE filter");
- t.eq(params["foo__ilike"], "bar",
- "filterToParams sets correct param key and value if passed an LIKE filter");
-
- // 4 tests
- filter = new OpenLayers.Filter.Logical({
- type: OpenLayers.Filter.Logical.AND,
- filters: [
- new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.EQUAL_TO,
- property: "foo",
- value: "bar"
- }),
- new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LESS_THAN,
- property: "foo2",
- value: "baz"
- })
- ]
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an EQUAL_TO filter within a AND filter");
- t.eq(params["foo__eq"], "bar",
- "filterToParams sets correct param key and value if passed an EQUAL_TO filter within a AND filter");
- t.eq(params.queryable[1], "foo2",
- "filterToParams sets correct queryable param if passed a LESS_THAN filter within a AND filter");
- t.eq(params["foo2__lt"], "baz",
- "filterToParams sets correct param key and value if passed a LESS_THAN filter within a AND filter");
-
- // 2 tests
- protocol = new OpenLayers.Protocol.HTTP({wildcarded: true});
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LIKE,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed a LIKE filter (wildcarded true)");
- t.eq(params["foo__ilike"], "%bar%",
- "filterToParams sets correct param key and value if passed an LIKE filter (wildcarded true)");
- }
-
- function test_regex2value(t) {
- t.plan(16);
-
- // setup
-
- var protocol = new OpenLayers.Protocol.HTTP({
- filterToParams: OpenLayers.Protocol.simpleFilterSerializer
- });
-
- var value;
- var filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LIKE,
- property: "prop"
- });
-
- function serialize(value) {
- filter.value = value;
- return protocol.filterToParams(filter).prop__ilike;
- }
-
- // test
-
- value = serialize("foo");
- t.eq(value, "foo", 'regex2value converts "foo" to "foo"');
-
- value = serialize("foo%");
- t.eq(value, "foo\\%", 'regex2value converts "foo%" to "foo\\%"');
-
- value = serialize("foo.*");
- t.eq(value, "foo%", 'regex2value converts "foo.*" to "foo%"');
-
- value = serialize("f.*oo.*");
- t.eq(value, "f%oo%", 'regex2value converts "f.*oo.*" to "f%oo%"');
-
- value = serialize("foo.");
- t.eq(value, "foo_", 'regex2value converts "foo." to "foo_"');
-
- value = serialize("f.oo.");
- t.eq(value, "f_oo_", 'regex2value converts "f.oo." to "f_oo_"');
-
- value = serialize("f.oo.*");
- t.eq(value, "f_oo%", 'regex2value converts "f.oo.*" to "f_oo%"');
-
- value = serialize("foo\\\\");
- t.eq(value, "foo\\\\", 'regex2value converts "foo\\\\" to "foo\\\\"');
-
- value = serialize("foo\\.");
- t.eq(value, "foo.", 'regex2value converts "foo\\." to "foo."');
-
- value = serialize("foo\\\\.");
- t.eq(value, "foo\\\\_", 'regex2value converts "foo\\\\." to "foo\\\\_"');
-
- value = serialize("foo\\*");
- t.eq(value, "foo*", 'regex2value converts "foo\\*" to "foo*"');
-
- value = serialize("foo\\\\*");
- t.eq(value, "foo\\\\*", 'regex2value converts "foo\\\\*" to "foo\\\\*"');
-
- value = serialize("foo\\\\.*");
- t.eq(value, "foo\\\\%", 'regex2value converts "foo\\\\.*" to "foo\\\\%"');
-
- value = serialize("fo\\.o.*");
- t.eq(value, "fo.o%", 'regex2value converts from "fo\\.o.*" to "fo.o%"');
-
- value = serialize("fo.*o\\.");
- t.eq(value, "fo%o.", 'regex2value converts from "fo.*o\\." to "to%o."');
-
- value = serialize("\\*\\..*.\\\\.*\\\\.%");
- t.eq(value, "*.%_\\\\%\\\\_\\%",
- 'regex2value converts from "\\*\\..*.\\\\.*\\\\.%" ' +
- 'to "*.%_\\\\%\\\\_\\%"');
- }
-
- </script>
-</head>
-<body>
-</body>
-</html>
Modified: sandbox/cmoullet/openlayers/tests/list-tests.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/list-tests.html 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tests/list-tests.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -74,6 +74,7 @@
<li>Format/Filter/v1.html</li>
<li>Format/Filter/v1_0_0.html</li>
<li>Format/Filter/v1_1_0.html</li>
+ <li>Format/QueryStringFilter.html</li>
<li>Format/WFS.html</li>
<li>Format/WFSCapabilities.html</li>
<li>Format/WFSCapabilities/v1.html</li>
@@ -102,6 +103,7 @@
<li>Format/SOSGetObservation.html</li>
<li>Format/SOSGetFeatureOfInterest.html</li>
<li>Format/OWSContext/v0_3_1.html</li>
+ <li>Format/XLS/v1_1_0.html</li>
<li>Format/XML.html</li>
<li>Geometry.html</li>
<li>Geometry/Collection.html</li>
@@ -179,7 +181,6 @@
<li>Protocol.html</li>
<li>Protocol/HTTP.html</li>
<li>Protocol/Script.html</li>
- <li>Protocol/SimpleFilterSerializer.html</li>
<li>Protocol/SQL.html</li>
<li>Protocol/SQL/Gears.html</li>
<li>Protocol/WFS.html</li>
Copied: sandbox/cmoullet/openlayers/tests/manual/box-quirks.html (from rev 11762, trunk/openlayers/tests/manual/box-quirks.html)
===================================================================
--- sandbox/cmoullet/openlayers/tests/manual/box-quirks.html (rev 0)
+++ sandbox/cmoullet/openlayers/tests/manual/box-quirks.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -0,0 +1,52 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Box Handler Quirks Mode 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">
+ /* simulate quirks mode (traditional box model) in browsers other than IE */
+ div {
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -ms-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ }
+
+ .olHandlerBoxZoomBox {
+ border: 20px solid red;
+ border-left-width: 10px;
+ border-bottom-width: 30px;
+ }
+ </style>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ var map, layer;
+ 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.zoomToMaxExtent();
+ }
+ </script>
+ </head>
+ <body onload="init()">
+ <h1 id="title">Box handler Quirks Mode Test</h1>
+
+ <div id="shortdesc">Test the correct appearance of the ZoomBox in quirks mode</div>
+
+ <div id="map" class="smallmap"></div>
+
+ <div id="docs">
+ <p>For the box to be positioned correctly, we need to know the
+ width of the borders.</p>
+ <p>Shift-click on the map. A red box should be visible around the mouse
+ cursor position, with 20 pixels to the top and right, 10 pixels to
+ the left and 30 pixels to the bottom edge of the box.</p>
+ <p>Drag the box both to the top-left and the bottom-right. The cursor
+ should always be at the top-left or bottom-right inner corner of
+ the box.</p>
+ </div>
+ </body>
+</html>
Copied: sandbox/cmoullet/openlayers/tests/manual/box-strict.html (from rev 11762, trunk/openlayers/tests/manual/box-strict.html)
===================================================================
--- sandbox/cmoullet/openlayers/tests/manual/box-strict.html (rev 0)
+++ sandbox/cmoullet/openlayers/tests/manual/box-strict.html 2011-03-30 03:18:10 UTC (rev 11763)
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <head>
+ <title>Box Handler Strict Mode 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">
+ .olHandlerBoxZoomBox {
+ border: 20px solid red;
+ border-left-width: 10px;
+ border-bottom-width: 30px;
+ }
+ </style>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ var map, layer;
+ 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.zoomToMaxExtent();
+ }
+ </script>
+ </head>
+ <body onload="init()">
+ <h1 id="title">Box Handler Strict Mode Test</h1>
+
+ <div id="shortdesc">Test the correct appearance of the ZoomBox in strict mode</div>
+
+ <div id="map" class="smallmap"></div>
+
+ <div id="docs">
+ <p>For the box to be positioned correctly, we need to know the
+ width of the borders.</p>
+ <p>Shift-click on the map. A red box should be visible around the mouse
+ cursor position, with 20 pixels to the top and right, 10 pixels to
+ the left and 30 pixels to the bottom edge of the box.</p>
+ <p>Drag the box both to the top-left and the bottom-right. The cursor
+ should always be at the top-left or bottom-right inner corner of
+ the box.</p>
+ </div>
+ </body>
+</html>
Modified: sandbox/cmoullet/openlayers/theme/default/style.css
===================================================================
--- sandbox/cmoullet/openlayers/theme/default/style.css 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/theme/default/style.css 2011-03-30 03:18:10 UTC (rev 11763)
@@ -1,7 +1,7 @@
div.olMap {
z-index: 0;
- padding: 0px!important;
- margin: 0px!important;
+ padding: 0 !important;
+ margin: 0 !important;
cursor: default;
}
@@ -80,8 +80,8 @@
.olControlOverviewMapContainer {
position: absolute;
- bottom: 0px;
- right: 0px;
+ bottom: 0;
+ right: 0;
}
.olControlOverviewMapElement {
@@ -91,13 +91,13 @@
}
.olControlOverviewMapMinimizeButton {
- right: 0px;
+ right: 0;
bottom: 80px;
cursor: pointer;
}
.olControlOverviewMapMaximizeButton {
- right: 0px;
+ right: 0;
bottom: 80px;
cursor: pointer;
}
@@ -146,13 +146,13 @@
}
.olControlNavigationHistoryPreviousItemActive {
- background-position: 0px 0px;
+ background-position: 0 0;
}
.olControlNavigationHistoryPreviousItemInactive {
- background-position: 0px -24px;
+ background-position: 0 -24px;
}
.olControlNavigationHistoryNextItemActive {
- background-position: -24px 0px;
+ background-position: -24px 0;
}
.olControlNavigationHistoryNextItemInactive {
background-position: -24px -24px;
@@ -161,12 +161,12 @@
div.olControlSaveFeaturesItemActive {
background-image: url(img/save_features_on.png);
background-repeat: no-repeat;
- background-position: 0px 1px;
+ background-position: 0 1px;
}
div.olControlSaveFeaturesItemInactive {
background-image: url(img/save_features_off.png);
background-repeat: no-repeat;
- background-position: 0px 1px;
+ background-position: 0 1px;
}
.olHandlerBoxZoomBox {
@@ -200,20 +200,20 @@
}
.olControlPanPanel .olControlPanNorthItemInactive {
- top: 0px;
+ top: 0;
left: 9px;
- background-position: 0px 0px;
+ background-position: 0 0;
}
.olControlPanPanel .olControlPanSouthItemInactive {
top: 36px;
left: 9px;
- background-position: 18px 0px;
+ background-position: 18px 0;
}
.olControlPanPanel .olControlPanWestItemInactive {
position: absolute;
top: 18px;
- left: 0px;
- background-position: 0px 18px;
+ left: 0;
+ background-position: 0 18px;
}
.olControlPanPanel .olControlPanEastItemInactive {
top: 18px;
@@ -235,21 +235,21 @@
}
.olControlZoomPanel .olControlZoomInItemInactive {
- top: 0px;
- left: 0px;
- background-position: 0px 0px;
+ top: 0;
+ left: 0;
+ background-position: 0 0;
}
.olControlZoomPanel .olControlZoomToMaxExtentItemInactive {
top: 18px;
- left: 0px;
- background-position: 0px -18px;
+ left: 0;
+ background-position: 0 -18px;
}
.olControlZoomPanel .olControlZoomOutItemInactive {
top: 36px;
- left: 0px;
- background-position: 0px 18px;
+ left: 0;
+ background-position: 0 18px;
}
/*
@@ -307,7 +307,7 @@
.olControlLayerSwitcher {
position: absolute;
top: 25px;
- right: 0px;
+ right: 0;
width: 20em;
font-family: sans-serif;
font-weight: bold;
@@ -344,7 +344,7 @@
.olControlLayerSwitcher .maximizeDiv,
.olControlLayerSwitcher .minimizeDiv {
top: 5px;
- right: 0px;
+ right: 0;
cursor: pointer;
}
@@ -361,21 +361,21 @@
*/
.olControlNavToolbar ,
.olControlEditingToolbar {
- margin: 5px 5px 0px 0px;
+ margin: 5px 5px 0 0;
}
.olControlNavToolbar div,
.olControlEditingToolbar div {
background-image: url("img/editing_tool_bar.png");
background-repeat: no-repeat;
- margin: 0px 0px 5px 5px;
+ margin: 0 0 5px 5px;
width: 24px;
height: 22px;
cursor: pointer
}
/* positions */
.olControlEditingToolbar {
- right: 0px;
- top: 0px;
+ right: 0;
+ top: 0;
width: 200px; /* Only for IE6 or IE without DOCTYPE */
}
.olControlNavToolbar {
Modified: sandbox/cmoullet/openlayers/tools/mergejs.py
===================================================================
--- sandbox/cmoullet/openlayers/tools/mergejs.py 2011-03-30 02:33:13 UTC (rev 11762)
+++ sandbox/cmoullet/openlayers/tools/mergejs.py 2011-03-30 03:18:10 UTC (rev 11763)
@@ -43,7 +43,7 @@
SUFFIX_JAVASCRIPT = ".js"
-RE_REQUIRE = "@requires:? (.*)\n" # TODO: Ensure in comment?
+RE_REQUIRE = "@requires?:? (.*)\n" # TODO: Ensure in comment?
class MissingImport(Exception):
"""Exception raised when a listed import is not found in the lib."""
More information about the Commits
mailing list