Changeset 5827
- Timestamp:
- 01/20/08 15:12:48 (1 year ago)
- Files:
-
- sandbox/crschmidt/osm/doc/authors.txt (modified) (1 diff)
- sandbox/crschmidt/osm/examples/boxes-vector.html (copied) (copied from trunk/openlayers/examples/boxes-vector.html)
- sandbox/crschmidt/osm/examples/hover-handler.html (copied) (copied from trunk/openlayers/examples/hover-handler.html)
- sandbox/crschmidt/osm/examples/vector-features.html (modified) (1 diff)
- sandbox/crschmidt/osm/lib/OpenLayers.js (modified) (1 diff)
- sandbox/crschmidt/osm/lib/OpenLayers/Control/ArgParser.js (modified) (1 diff)
- sandbox/crschmidt/osm/lib/OpenLayers/Control/ZoomBox.js (modified) (2 diffs)
- sandbox/crschmidt/osm/lib/OpenLayers/Handler/Hover.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Handler/Hover.js)
- sandbox/crschmidt/osm/lib/OpenLayers/Layer.js (modified) (1 diff)
- sandbox/crschmidt/osm/lib/OpenLayers/Layer/GML.js (modified) (1 diff)
- sandbox/crschmidt/osm/lib/OpenLayers/Layer/SphericalMercator.js (modified) (1 diff)
- sandbox/crschmidt/osm/lib/OpenLayers/Layer/TileCache.js (modified) (1 diff)
- sandbox/crschmidt/osm/lib/OpenLayers/Projection.js (modified) (1 diff)
- sandbox/crschmidt/osm/lib/OpenLayers/Renderer/Elements.js (modified) (1 diff)
- sandbox/crschmidt/osm/lib/OpenLayers/Renderer/SVG.js (modified) (1 diff)
- sandbox/crschmidt/osm/lib/OpenLayers/Renderer/VML.js (modified) (1 diff)
- sandbox/crschmidt/osm/lib/OpenLayers/Tile/WFS.js (modified) (3 diffs)
- sandbox/crschmidt/osm/tests/Handler/test_Hover.html (copied) (copied from trunk/openlayers/tests/Handler/test_Hover.html)
- sandbox/crschmidt/osm/tests/Layer/test_GML.html (modified) (2 diffs)
- sandbox/crschmidt/osm/tests/Renderer/test_SVG.html (modified) (2 diffs)
- sandbox/crschmidt/osm/tests/Tile/test_WFS.html (modified) (3 diffs)
- sandbox/crschmidt/osm/tests/list-tests.html (modified) (1 diff)
- sandbox/crschmidt/osm/tests/mice.xml (copied) (copied from trunk/openlayers/tests/mice.xml)
- sandbox/crschmidt/osm/tests/run-tests.html (modified) (1 diff)
- sandbox/crschmidt/osm/tests/test_Projection.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/crschmidt/osm/doc/authors.txt
r5743 r5827 11 11 Pierre Giraud 12 12 Andreas Hocevar 13 Ian Johnson 13 14 Eric Lemoine 14 15 Philip Lindsay sandbox/crschmidt/osm/examples/vector-features.html
r5743 r5827 38 38 var style_green = { 39 39 strokeColor: "#00FF00", 40 strokeOpacity: 1,41 40 strokeWidth: 3, 42 41 pointRadius: 6, sandbox/crschmidt/osm/lib/OpenLayers.js
r5743 r5827 118 118 "OpenLayers/Handler.js", 119 119 "OpenLayers/Handler/Click.js", 120 "OpenLayers/Handler/Hover.js", 120 121 "OpenLayers/Handler/Point.js", 121 122 "OpenLayers/Handler/Path.js", sandbox/crschmidt/osm/lib/OpenLayers/Control/ArgParser.js
r5743 r5827 1 /* C pyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD 2 2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the 3 3 * full text of the license. */ sandbox/crschmidt/osm/lib/OpenLayers/Control/ZoomBox.js
r5743 r5827 22 22 23 23 /** 24 * Property: out 25 * {Boolean} Should the control be used for zooming out? 26 */ 27 out: false, 28 29 /** 24 30 * Method: draw 25 31 */ … … 37 43 zoomBox: function (position) { 38 44 if (position instanceof OpenLayers.Bounds) { 39 var minXY = this.map.getLonLatFromPixel( 45 if (!this.out) { 46 var minXY = this.map.getLonLatFromPixel( 40 47 new OpenLayers.Pixel(position.left, position.bottom)); 41 var maxXY = this.map.getLonLatFromPixel(48 var maxXY = this.map.getLonLatFromPixel( 42 49 new OpenLayers.Pixel(position.right, position.top)); 43 var bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,50 var bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat, 44 51 maxXY.lon, maxXY.lat); 52 } else { 53 var pixWidth = Math.abs(position.right-position.left); 54 var pixHeight = Math.abs(position.top-position.bottom); 55 var zoomFactor = Math.min((this.map.size.h / pixHeight), 56 (this.map.size.w / pixWidth)); 57 var extent = map.getExtent(); 58 var center = this.map.getLonLatFromPixel( 59 position.getCenterPixel()); 60 var xmin = center.lon - (extent.getWidth()/2)*zoomFactor; 61 var xmax = center.lon + (extent.getWidth()/2)*zoomFactor; 62 var ymin = center.lat - (extent.getHeight()/2)*zoomFactor; 63 var ymax = center.lat + (extent.getHeight()/2)*zoomFactor; 64 var bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax); 65 } 45 66 this.map.zoomToExtent(bounds); 46 67 } else { // it's a pixel 47 this.map.setCenter(this.map.getLonLatFromPixel(position), 68 if (!this.out) { 69 this.map.setCenter(this.map.getLonLatFromPixel(position), 48 70 this.map.getZoom() + 1); 71 } else { 72 this.map.setCenter(this.map.getLonLatFromPixel(position), 73 this.map.getZoom() - 1); 74 } 49 75 } 50 76 }, sandbox/crschmidt/osm/lib/OpenLayers/Layer.js
r5743 r5827 625 625 } 626 626 627 // Do not use the scales/resolutions at the map level if 628 // minScale/minResolution and maxScale/maxResolution are 629 // specified at the layer level 630 if (this.options.minScale != null && 631 this.options.maxScale != null && 632 this.options.scales == null) { 633 confProps.scales = null; 634 } 635 if (this.options.minResolution != null && 636 this.options.maxResolution != null && 637 this.options.resolutions == null) { 638 confProps.resolutions = null; 639 } 640 627 641 // If numZoomLevels hasn't been set and the maxZoomLevel *has*, 628 642 // then use maxZoomLevel to calculate numZoomLevels sandbox/crschmidt/osm/lib/OpenLayers/Layer/GML.js
r5743 r5827 98 98 } 99 99 }, 100 100 101 /** 102 * Method: setUrl 103 * Change the URL and reload the GML 104 * 105 * Parameters: 106 * url - {String} URL of a GML file. 107 */ 108 setUrl:function(url) { 109 this.url = url; 110 this.destroyFeatures(); 111 this.loaded = false; 112 this.events.triggerEvent("loadstart"); 113 this.loadGML(); 114 }, 101 115 102 116 /** sandbox/crschmidt/osm/lib/OpenLayers/Layer/SphericalMercator.js
r5743 r5827 129 129 130 130 /** 131 * Method: project Forward131 * Method: projectInverse 132 132 * Given an object with x and y properties in Spherical Mercator, modify 133 133 * the x,y properties on the object to be the unprojected coordinates. sandbox/crschmidt/osm/lib/OpenLayers/Layer/TileCache.js
r5743 r5827 104 104 var bbox = this.maxExtent; 105 105 var size = this.tileSize; 106 var tileX = Math. floor((bounds.left - bbox.left) / (res * size.w));107 var tileY = Math. floor((bounds.bottom - bbox.bottom) / (res * size.h));106 var tileX = Math.round((bounds.left - bbox.left) / (res * size.w)); 107 var tileY = Math.round((bounds.bottom - bbox.bottom) / (res * size.h)); 108 108 var tileZ = this.map.zoom; 109 109 /** sandbox/crschmidt/osm/lib/OpenLayers/Projection.js
r5743 r5827 90 90 */ 91 91 equals: function(projection) { 92 return this.getCode() == projection.getCode(); 92 if (projection && projection.getCode) { 93 return this.getCode() == projection.getCode(); 94 } else { 95 return false; 96 } 93 97 }, 94 98 sandbox/crschmidt/osm/lib/OpenLayers/Renderer/Elements.js
r5743 r5827 135 135 //now actually draw the node, and style it 136 136 node = this.drawGeometryNode(node, geometry); 137 this.root.appendChild(node); 137 138 // append the node to root (but only if it's new) 139 if (node.parentNode != this.root) { 140 this.root.appendChild(node); 141 } 138 142 this.postDraw(node); 139 143 } else { sandbox/crschmidt/osm/lib/OpenLayers/Renderer/SVG.js
r5749 r5827 337 337 node.setAttributeNS(null, "r", radius); 338 338 } else { 339 if (node.parentNode ) {339 if (node.parentNode == this.root) { 340 340 this.root.removeChild(node); 341 } 341 } 342 342 } 343 343 }, sandbox/crschmidt/osm/lib/OpenLayers/Renderer/VML.js
r5743 r5827 241 241 node.appendChild(stroke); 242 242 } 243 stroke.setAttribute("opacity", style.strokeOpacity); 243 if (style.strokeOpacity) { 244 stroke.setAttribute("opacity", style.strokeOpacity); 245 } 244 246 stroke.setAttribute("endcap", !style.strokeLinecap || style.strokeLinecap == 'butt' ? 'flat' : style.strokeLinecap); 245 247 } sandbox/crschmidt/osm/lib/OpenLayers/Tile/WFS.js
r5743 r5827 68 68 if(this.request) { 69 69 this.request.transport.abort(); 70 //this.request.destroy(); 71 this.request = null; 70 72 } 71 73 }, … … 109 111 */ 110 112 loadFeaturesForRegion:function(success, failure) { 113 if(this.request) { 114 this.request.transport.abort(); 115 //this.request.destroy(); 116 } 111 117 this.request = OpenLayers.loadURL(this.url, null, this, success); 112 118 }, … … 142 148 this.events.triggerEvent("loadend"); 143 149 } 150 151 //request produced with success, we can delete the request object. 152 //this.request.destroy(); 153 this.request = null; 144 154 }, 145 155 sandbox/crschmidt/osm/tests/Layer/test_GML.html
r4252 r5827 7 7 8 8 var gml = "./owls.xml"; 9 var gml2 = "./mice.xml"; 9 10 10 11 // if this test is running online, different rules apply … … 41 42 42 43 } 44 function test_GML_setUrl(t) { 45 t.plan(2); 46 var layer = new OpenLayers.Layer.GML(name, gml); 47 var map = new OpenLayers.Map("map"); 48 map.addLayer(layer); 49 t.eq(layer.url, gml, "layer has correct original url"); 50 layer.setUrl(gml2); 51 t.eq(layer.url, gml2, "layer has correctly changed url"); 52 } 43 53 </script> 44 54 </head> sandbox/crschmidt/osm/tests/Renderer/test_SVG.html
r5743 r5827 128 128 } 129 129 130 t.plan( 3);130 t.plan(6); 131 131 132 132 var r = new OpenLayers.Renderer.SVG(document.body); … … 143 143 144 144 r.drawCircle(node, geometry, 3); 145 146 t.eq(node.getAttributeNS(null, 'cx'), '2', "cx is correct"); 147 t.eq(node.getAttributeNS(null, 'cy'), '-4', "cy is correct"); 148 t.eq(node.getAttributeNS(null, 'r'), '3', "r is correct"); 149 150 // #1274: out of bound node fails when first added 151 var geometry = { 152 x: 10000000, 153 y: 200000000 154 } 155 156 r.drawCircle(node, geometry, "blah_4000"); 145 157 146 158 t.eq(node.getAttributeNS(null, 'cx'), '2', "cx is correct"); sandbox/crschmidt/osm/tests/Tile/test_WFS.html
r5743 r5827 28 28 29 29 function test_Tile_WFS_requestSuccess(t) { 30 t.plan(1); 30 t.plan(2); 31 32 var tile = { 33 'request': {} 34 }; 35 36 OpenLayers.Tile.WFS.prototype.requestSuccess.apply(tile, []); 37 38 t.ok(tile.request == null, "request property on tile set to null"); 39 31 40 var layer = {}; // bogus layer 32 41 var position = new OpenLayers.Pixel(10,20); … … 42 51 } 43 52 53 function test_Tile_WFS_loadFeaturesForRegion(t) { 54 t.plan(9); 55 56 var tile = { 57 'url': {} 58 }; 59 60 var g_Success = {}; 61 62 var tLoadURL = OpenLayers.loadURL; 63 OpenLayers.loadURL = function(url, params, caller, onComplete) { 64 t.ok(url == tile.url, "tile's url correctly passed as 1st param to loadURL"); 65 t.ok(params == null, "null passed as 2nd param to loadURL"); 66 t.ok(caller == tile, "tile passed as 3rd param to loadURL"); 67 t.ok(onComplete == g_Success, "success param from loadFeaturesForRegion() passed as 4th param to loadURL"); 68 }; 69 70 //no running request -- 4 tests 71 OpenLayers.Tile.WFS.prototype.loadFeaturesForRegion.apply(tile, [g_Success]); 72 73 //running request (cancelled) -- 4 tests + 1 test (for request abort) 74 tile.request = { 75 'transport': { 76 'abort': function() { 77 t.ok(true, "request aborted"); 78 } 79 } 80 }; 81 OpenLayers.Tile.WFS.prototype.loadFeaturesForRegion.apply(tile, [g_Success]); 82 83 OpenLayers.loadURL = tLoadURL; 84 } 85 44 86 function test_Tile_WFS_destroy(t) { 45 t.plan( 8);87 t.plan(9); 46 88 47 89 var layer = {}; // bogus layer … … 74 116 t.ok(tile.position == null, "tile.position set to null"); 75 117 t.ok(_gAbort, "request transport is aborted"); 118 t.ok(tile.request == null, "tile.request set to null"); 76 119 77 120 t.ok(tile.events == null, "tile.events set to null"); sandbox/crschmidt/osm/tests/list-tests.html
r5816 r5827 90 90 <li>test_Handler.html</li> 91 91 <li>Handler/test_Click.html</li> 92 <li>Handler/test_Hover.html</li> 92 93 <li>Handler/test_Drag.html</li> 93 94 <li>Handler/test_Feature.html</li> sandbox/crschmidt/osm/tests/run-tests.html
r5743 r5827 799 799 { 800 800 var test_page=Test.AnotherWay._g_tests_queue[0]; 801 test_page.loading_timeout_milliseconds= 6000;801 test_page.loading_timeout_milliseconds=12000; 802 802 test_page.timeout_id=setTimeout( Test.AnotherWay._loading_timeout, Test.AnotherWay._g_timeout_granularity ); 803 803 test_page.wait_msg=Test.AnotherWay._print_counter_result( test_page.url, "loading...", test_page.loading_timeout_milliseconds, "loading" ); sandbox/crschmidt/osm/tests/test_Projection.html
r5743 r5827 19 19 t.eq(out.x, 10, "Null transform has no effect"); 20 20 t.eq(out.y, 12, "Null transform has no effect"); 21 22 t.eq(projection.equals(null), false, "equals on null projection returns false"); 23 t.eq(projection.equals({}), false, "equals on null projection object returns false (doesn't call getCode)"); 21 24 } 22 25
