Changeset 5798
- Timestamp:
- 01/17/08 11:46:25 (1 year ago)
- Files:
-
- sandbox/enjahova/openlayers/doc/authors.txt (modified) (1 diff)
- sandbox/enjahova/openlayers/examples/hover-handler.html (copied) (copied from trunk/openlayers/examples/hover-handler.html)
- sandbox/enjahova/openlayers/examples/point-track-markers.html (copied) (copied from trunk/openlayers/examples/point-track-markers.html)
- sandbox/enjahova/openlayers/examples/vector-features.html (modified) (1 diff)
- sandbox/enjahova/openlayers/examples/xml/track1.xml (copied) (copied from trunk/openlayers/examples/xml/track1.xml)
- sandbox/enjahova/openlayers/lib/OpenLayers.js (modified) (2 diffs)
- sandbox/enjahova/openlayers/lib/OpenLayers/Control/ZoomBox.js (modified) (2 diffs)
- sandbox/enjahova/openlayers/lib/OpenLayers/Handler/Hover.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Handler/Hover.js)
- sandbox/enjahova/openlayers/lib/OpenLayers/Layer.js (modified) (1 diff)
- sandbox/enjahova/openlayers/lib/OpenLayers/Layer/GML.js (modified) (1 diff)
- sandbox/enjahova/openlayers/lib/OpenLayers/Layer/PointTrack.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Layer/PointTrack.js)
- sandbox/enjahova/openlayers/lib/OpenLayers/Layer/SphericalMercator.js (modified) (1 diff)
- sandbox/enjahova/openlayers/lib/OpenLayers/Layer/TileCache.js (modified) (1 diff)
- sandbox/enjahova/openlayers/lib/OpenLayers/Renderer/Elements.js (modified) (1 diff)
- sandbox/enjahova/openlayers/lib/OpenLayers/Renderer/VML.js (modified) (1 diff)
- sandbox/enjahova/openlayers/lib/OpenLayers/Tile/WFS.js (modified) (3 diffs)
- sandbox/enjahova/openlayers/tests/Handler/test_Hover.html (copied) (copied from trunk/openlayers/tests/Handler/test_Hover.html)
- sandbox/enjahova/openlayers/tests/Layer/test_PointTrack.html (copied) (copied from trunk/openlayers/tests/Layer/test_PointTrack.html)
- sandbox/enjahova/openlayers/tests/Tile/test_WFS.html (modified) (3 diffs)
- sandbox/enjahova/openlayers/tests/list-tests.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/enjahova/openlayers/doc/authors.txt
r5518 r5798 11 11 Pierre Giraud 12 12 Andreas Hocevar 13 Ian Johnson 13 14 Eric Lemoine 14 15 Philip Lindsay sandbox/enjahova/openlayers/examples/vector-features.html
r5362 r5798 38 38 var style_green = { 39 39 strokeColor: "#00FF00", 40 strokeOpacity: 1,41 40 strokeWidth: 3, 42 41 pointRadius: 6, sandbox/enjahova/openlayers/lib/OpenLayers.js
r5797 r5798 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", … … 168 169 "OpenLayers/Renderer/VML.js", 169 170 "OpenLayers/Layer/Vector.js", 171 "OpenLayers/Layer/PointTrack.js", 170 172 "OpenLayers/Layer/GML.js", 171 173 "OpenLayers/Style.js", sandbox/enjahova/openlayers/lib/OpenLayers/Control/ZoomBox.js
r5719 r5798 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/enjahova/openlayers/lib/OpenLayers/Layer.js
r5719 r5798 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/enjahova/openlayers/lib/OpenLayers/Layer/GML.js
r5723 r5798 113 113 this.loadGML(); 114 114 }, 115 116 115 117 116 /** sandbox/enjahova/openlayers/lib/OpenLayers/Layer/SphericalMercator.js
r5719 r5798 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/enjahova/openlayers/lib/OpenLayers/Layer/TileCache.js
r5719 r5798 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/enjahova/openlayers/lib/OpenLayers/Renderer/Elements.js
r5719 r5798 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/enjahova/openlayers/lib/OpenLayers/Renderer/VML.js
r5719 r5798 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/enjahova/openlayers/lib/OpenLayers/Tile/WFS.js
r5719 r5798 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/enjahova/openlayers/tests/Tile/test_WFS.html
r5719 r5798 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/enjahova/openlayers/tests/list-tests.html
r5797 r5798 58 58 <li>Layer/test_Markers.html</li> 59 59 <li>Layer/test_MultiMap.html</li> 60 <li>Layer/test_PointTrack.html</li> 60 61 <li>Layer/test_SphericalMercator.html</li> 61 62 <li>Layer/test_Text.html</li> … … 92 93 <li>test_Handler.html</li> 93 94 <li>Handler/test_Click.html</li> 95 <li>Handler/test_Hover.html</li> 94 96 <li>Handler/test_Drag.html</li> 95 97 <li>Handler/test_Feature.html</li>
