Changeset 5688
- Timestamp:
- 01/08/08 13:42:03 (1 year ago)
- Files:
-
- sandbox/tschaub/scalebar/examples/custom-control-point.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/examples/custom-control.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/examples/custom-style.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/examples/debug.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/examples/drag-feature.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/examples/draw-feature.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/examples/editingtoolbar-outside.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/examples/editingtoolbar.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/examples/example.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/examples/overviewmap.html (modified) (1 diff)
- sandbox/tschaub/scalebar/lib/OpenLayers/BaseTypes.js (modified) (5 diffs)
- sandbox/tschaub/scalebar/lib/OpenLayers/Control/OverviewMap.js (modified) (15 diffs)
- sandbox/tschaub/scalebar/lib/OpenLayers/Geometry/LinearRing.js (modified) (4 diffs)
- sandbox/tschaub/scalebar/lib/OpenLayers/Handler/Click.js (modified) (2 diffs)
- sandbox/tschaub/scalebar/lib/OpenLayers/Map.js (modified) (2 diffs)
- sandbox/tschaub/scalebar/lib/OpenLayers/Util.js (modified) (1 diff)
- sandbox/tschaub/scalebar/tests/Control/test_Attribution.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/tests/Control/test_OverviewMap.html (modified) (1 diff)
- sandbox/tschaub/scalebar/tests/Control/test_Scale.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/tests/Handler/test_Click.html (modified) (1 diff)
- sandbox/tschaub/scalebar/tests/Layer/test_MapServer.html (modified) (1 diff)
- sandbox/tschaub/scalebar/tests/data/geos_wkt_intersects.js (modified) (1 diff)
- sandbox/tschaub/scalebar/tests/grid_inittiles.html (modified) (2 diffs)
- sandbox/tschaub/scalebar/tests/test_BaseTypes.html (modified) (1 diff)
- sandbox/tschaub/scalebar/theme/default/img/blank.gif (copied) (copied from trunk/openlayers/theme/default/img/blank.gif)
- sandbox/tschaub/scalebar/theme/default/img/overview_replacement.gif (copied) (copied from trunk/openlayers/theme/default/img/overview_replacement.gif)
- sandbox/tschaub/scalebar/theme/default/style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/tschaub/scalebar/examples/custom-control-point.html
r5362 r5688 11 11 <script src="../lib/OpenLayers.js"></script> 12 12 <script type="text/javascript"> 13 <!--14 13 var lon = 5; 15 14 var lat = 40; … … 43 42 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 44 43 } 45 // -->46 44 </script> 47 45 </head> sandbox/tschaub/scalebar/examples/custom-control.html
r5370 r5688 11 11 <script src="../lib/OpenLayers.js"></script> 12 12 <script type="text/javascript"> 13 <!--14 13 var lon = 5; 15 14 var lat = 40; … … 47 46 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 48 47 } 49 // -->50 48 </script> 51 49 </head> sandbox/tschaub/scalebar/examples/custom-style.html
r5362 r5688 21 21 <script src="../lib/OpenLayers.js"></script> 22 22 <script type="text/javascript"> 23 <!--24 23 var lon = 5; 25 24 var lat = 40; … … 37 36 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 38 37 } 39 // -->40 38 </script> 41 39 </head> sandbox/tschaub/scalebar/examples/debug.html
r5362 r5688 8 8 <script src="../lib/OpenLayers.js"></script> 9 9 <script type="text/javascript"> 10 <!--11 10 function consoleLog() { 12 11 OpenLayers.Console.log("This is the result of an OpenLayers.Console.log() call"); … … 24 23 OpenLayers.Console.dirxml(document.getElementsByTagName('body')[0]); 25 24 } 26 // -->27 25 </script> 28 26 </head> sandbox/tschaub/scalebar/examples/drag-feature.html
r5362 r5688 21 21 <script src="../lib/OpenLayers.js"></script> 22 22 <script type="text/javascript"> 23 <!--24 23 var map, vectors, controls; 25 24 function init(){ … … 62 61 } 63 62 } 64 65 // -->66 63 </script> 67 64 </head> sandbox/tschaub/scalebar/examples/draw-feature.html
r5362 r5688 18 18 <script src="../lib/OpenLayers.js"></script> 19 19 <script type="text/javascript"> 20 <!--21 20 var map, drawControls; 22 21 OpenLayers.Util.onImageLoadErrorColor = "transparent"; … … 64 63 } 65 64 } 66 // -->67 65 </script> 68 66 </head> sandbox/tschaub/scalebar/examples/editingtoolbar-outside.html
r4825 r5688 19 19 <script src="../lib/OpenLayers.js"></script> 20 20 <script type="text/javascript"> 21 <!--22 21 var lon = 5; 23 22 var lat = 40; … … 44 43 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 45 44 } 46 // -->47 45 </script> 48 46 </head> sandbox/tschaub/scalebar/examples/editingtoolbar.html
r5362 r5688 14 14 <script src="../lib/Firebug/debug.js"></script> 15 15 <script type="text/javascript"> 16 <!--17 16 var lon = 5; 18 17 var lat = 40; … … 33 32 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 34 33 } 35 // -->36 34 </script> 37 35 </head> sandbox/tschaub/scalebar/examples/example.html
r5362 r5688 15 15 var map = null; 16 16 17 <!--18 17 function init(){ 19 18 … … 77 76 map.zoomToMaxExtent(); 78 77 } 79 // -->80 78 </script> 81 79 </head> sandbox/tschaub/scalebar/examples/overviewmap.html
r5362 r5688 87 87 map2.addControl(new OpenLayers.Control.LayerSwitcher()); 88 88 89 // create an overview map control with thedefault options89 // create an overview map control with non-default options 90 90 var controlOptions = { 91 91 mapOptions: mapOptions sandbox/tschaub/scalebar/lib/OpenLayers/BaseTypes.js
r5684 r5688 216 216 217 217 /** 218 * APIProperty: OpenLayers.Number.decimalSeparator218 * Property: OpenLayers.Number.decimalSeparator 219 219 * Decimal separator to use when formatting numbers. 220 220 */ … … 222 222 223 223 /** 224 * APIProperty: OpenLayers.Number.thousandsSeparator224 * Property: OpenLayers.Number.thousandsSeparator 225 225 * Thousands separator to use when formatting numbers. 226 226 */ … … 256 256 * Defaults to 0. Set to null to leave decimal places unchanged. 257 257 * tsep - {String} Thousands separator. 258 * Default s to OpenLayers.Number.thousandsSeparator258 * Default is ",". 259 259 * dsep - {String} Decimal separator. 260 * Default s to OpenLayers.Number.decimalSeparator260 * Default is ".". 261 261 * 262 262 * Returns: … … 275 275 276 276 var parts = num.toString().split("."); 277 if (parts.length == 1 && dec == null) { 278 // integer where we do not want to touch the decimals 279 dec = 0; 280 } 281 277 282 var integer = parts[0]; 278 283 if (tsep) { … … 283 288 } 284 289 290 var str; 285 291 if (dec == 0) { 286 292 str = integer; 287 293 } else { 288 294 var rem = parts.length > 1 ? parts[1] : "0"; 289 if (dec ) {295 if (dec != null) { 290 296 rem = rem + new Array(dec - rem.length + 1).join("0"); 291 297 } sandbox/tschaub/scalebar/lib/OpenLayers/Control/OverviewMap.js
r5614 r5688 21 21 22 22 /** 23 * Property: id24 * {String} For div.id25 */26 id: "OverviewMap",27 28 /**29 23 * Property: element 30 24 * {DOMElement} The DOM element that contains the overview map … … 37 31 */ 38 32 ovmap: null, 39 33 40 34 /** 41 35 * APIProperty: size … … 53 47 */ 54 48 layers: null, 49 50 /** 51 * APIProperty: minRectSize 52 * {Integer} The minimum width or height (in pixels) of the extent 53 * rectangle on the overview map. When the extent rectangle reaches 54 * this size, it will be replaced depending on the value of the 55 * <minRectDisplayClass> property. Default is 15 pixels. 56 */ 57 minRectSize: 15, 58 59 /** 60 * APIProperty: minRectDisplayClass 61 * {String} Replacement style class name for the extent rectangle when 62 * <minRectSize> is reached. This string will be suffixed on to the 63 * displayClass. Default is "RectReplacement". 64 * 65 * Example CSS declaration: 66 * (code) 67 * .olControlOverviewMapRectReplacement { 68 * overflow: hidden; 69 * cursor: move; 70 * background-image: url("img/overview_replacement.gif"); 71 * background-repeat: no-repeat; 72 * background-position: center; 73 * } 74 * (end) 75 */ 76 minRectDisplayClass: "RectReplacement", 55 77 56 78 /** … … 75 97 */ 76 98 mapOptions: null, 99 100 /** 101 * Property: dragHandler 102 * {<OpenLayers.Handler.Drag>} A handler for dragging the extent rectangle. 103 */ 104 dragHandler: null, 77 105 78 106 /** … … 98 126 return; 99 127 } 128 this.dragHandler.destroy(); 129 this.clickHandler.destroy(); 130 100 131 this.mapDiv.removeChild(this.extentRectangle); 101 132 this.extentRectangle = null; … … 108 139 this.element.removeChild(this.mapDiv); 109 140 this.mapDiv = null; 110 this.mapDivEvents.destroy();111 this.mapDivEvents = null;112 141 113 142 this.div.removeChild(this.element); 114 143 this.element = null; 115 this.elementEvents.destroy();116 this.elementEvents = null;117 144 118 145 if (this.maximizeDiv) { … … 166 193 this.extentRectangle.style.position = 'absolute'; 167 194 this.extentRectangle.style.zIndex = 1000; //HACK 168 this.extentRectangle.style.overflow = 'hidden';169 this.extentRectangle.style.backgroundImage = 'url(' +170 OpenLayers.Util.getImagesLocation() +171 'blank.gif)';172 195 this.extentRectangle.className = this.displayClass+'ExtentRectangle'; 173 196 this.mapDiv.appendChild(this.extentRectangle); 174 197 175 198 this.element.appendChild(this.mapDiv); 176 199 … … 178 201 179 202 this.map.events.register('moveend', this, this.update); 180 181 // Set up events. The image div recenters the map on click.182 // The extent rectangle can be dragged to recenter the map.183 // If the mousedown happened elsewhere, then mousemove and mouseup184 // should slip through.185 this.elementEvents = new OpenLayers.Events(this, this.element);186 this.elementEvents.register('mousedown', this, function(e) {187 OpenLayers.Event.stop(e);188 });189 this.elementEvents.register('click', this, function(e) {190 OpenLayers.Event.stop(e);191 });192 this.elementEvents.register('dblclick', this, function(e) {193 OpenLayers.Event.stop(e);194 });195 this.rectEvents = new OpenLayers.Events(this, this.extentRectangle,196 null, true);197 this.rectEvents.register('mouseout', this, this.rectMouseOut);198 this.rectEvents.register('mousedown', this, this.rectMouseDown);199 this.rectEvents.register('mousemove', this, this.rectMouseMove);200 this.rectEvents.register('mouseup', this, this.rectMouseUp);201 this.rectEvents.register('click', this, function(e) {202 OpenLayers.Event.stop(e);203 });204 this.rectEvents.register('dblclick', this, this.rectDblClick );205 this.mapDivEvents = new OpenLayers.Events(this, this.mapDiv);206 this.mapDivEvents.register('click', this, this.mapDivClick);207 203 208 204 // Optionally add min/max buttons if the control will go in the … … 277 273 278 274 /** 279 * Method: rectMouseOut 280 * Handle browser events 281 * 282 * Parameters: 283 * evt - {<OpenLayers.Event>} evt 284 */ 285 rectMouseOut: function (evt) { 286 if(this.rectDragStart != null) { 287 if(this.performedRectDrag) { 288 this.rectMouseMove(evt); 289 var rectPxBounds = this.getRectPxBounds(); 290 // if we're off of the overview map, update the main map 291 // otherwise, keep moving the rect 292 if((rectPxBounds.top <= 0) || (rectPxBounds.left <= 0) || 293 (rectPxBounds.bottom >= this.size.h - this.hComp) || 294 (rectPxBounds.right >= this.size.w - this.wComp)) { 295 this.updateMapToRect(); 296 } else { 297 return; 298 } 299 } 300 document.onselectstart = null; 301 this.rectDragStart = null; 302 } 303 }, 304 305 /** 306 * Method: rectMouseDown 307 * Handle browser events 308 * 309 * Parameters: 310 * evt - {<OpenLayers.Event>} evt 311 */ 312 rectMouseDown: function (evt) { 313 if(!OpenLayers.Event.isLeftClick(evt)) { 314 return; 315 } 316 this.rectDragStart = evt.xy.clone(); 317 this.performedRectDrag = false; 318 OpenLayers.Event.stop(evt); 319 }, 320 321 /** 322 * Method: rectMouseMove 323 * Handle browser events 324 * 325 * Parameters: 326 * evt - {<OpenLayers.Event>} evt 327 */ 328 rectMouseMove: function(evt) { 329 if(this.rectDragStart != null) { 330 var deltaX = this.rectDragStart.x - evt.xy.x; 331 var deltaY = this.rectDragStart.y - evt.xy.y; 332 var rectPxBounds = this.getRectPxBounds(); 333 var rectTop = rectPxBounds.top; 334 var rectLeft = rectPxBounds.left; 335 var rectHeight = Math.abs(rectPxBounds.getHeight()); 336 var rectWidth = rectPxBounds.getWidth(); 275 * Method: rectDrag 276 * Handle extent rectangle drag 277 * 278 * Parameters: 279 * px - {<OpenLayers.Pixel>} The pixel location of the drag. 280 */ 281 rectDrag: function(px) { 282 var deltaX = this.dragHandler.last.x - px.x; 283 var deltaY = this.dragHandler.last.y - px.y; 284 if(deltaX != 0 || deltaY != 0) { 285 var rectTop = this.rectPxBounds.top; 286 var rectLeft = this.rectPxBounds.left; 287 var rectHeight = Math.abs(this.rectPxBounds.getHeight()); 288 var rectWidth = this.rectPxBounds.getWidth(); 337 289 // don't allow dragging off of parent element 338 290 var newTop = Math.max(0, (rectTop - deltaY)); … … 346 298 newLeft + rectWidth, 347 299 newTop)); 348 this.rectDragStart = evt.xy.clone(); 349 this.performedRectDrag = true; 350 OpenLayers.Event.stop(evt); 351 } 352 }, 353 354 /** 355 * Method: rectMouseUp 356 * Handle browser events 357 * 358 * Parameters: 359 * evt - {<OpenLayers.Event>} evt 360 */ 361 rectMouseUp: function(evt) { 362 if(!OpenLayers.Event.isLeftClick(evt)) { 363 return; 364 } 365 if(this.performedRectDrag) { 366 this.updateMapToRect(); 367 OpenLayers.Event.stop(evt); 368 } 369 document.onselectstart = null; 370 this.rectDragStart = null; 371 }, 372 373 /** 374 * Method: rectDblClick 375 * Handle browser events 376 * 377 * Parameters: 378 * evt - {<OpenLayers.Event>} evt 379 */ 380 rectDblClick: function(evt) { 381 this.performedRectDrag = false; 382 OpenLayers.Event.stop(evt); 383 this.updateOverview(); 384 }, 385 300 } 301 }, 302 386 303 /** 387 304 * Method: mapDivClick … … 392 309 */ 393 310 mapDivClick: function(evt) { 394 var pxBounds = this.getRectPxBounds(); 395 var pxCenter = pxBounds.getCenterPixel(); 311 var pxCenter = this.rectPxBounds.getCenterPixel(); 396 312 var deltaX = evt.xy.x - pxCenter.x; 397 313 var deltaY = evt.xy.y - pxCenter.y; 398 var top = pxBounds.top;399 var left = pxBounds.left;400 var height = Math.abs( pxBounds.getHeight());401 var width = pxBounds.getWidth();314 var top = this.rectPxBounds.top; 315 var left = this.rectPxBounds.left; 316 var height = Math.abs(this.rectPxBounds.getHeight()); 317 var width = this.rectPxBounds.getWidth(); 402 318 var newTop = Math.max(0, (top + deltaY)); 403 319 newTop = Math.min(newTop, this.ovmap.size.h - height); … … 533 449 'border-bottom-width')); 534 450 this.hComp = (this.hComp) ? this.hComp : 2; 451 452 this.dragHandler = new OpenLayers.Handler.Drag( 453 this, {move: this.rectDrag, done: this.updateMapToRect}, 454 {map: this.ovmap} 455 ); 456 this.clickHandler = new OpenLayers.Handler.Click( 457 this, { 458 "click": this.mapDivClick 459 },{ 460 "single": true, "double": false, 461 "stopSingle": true, "stopDouble": true, 462 "pixelTolerance": 1, 463 map: this.ovmap 464 } 465 ); 466 this.clickHandler.activate(); 467 468 this.rectEvents = new OpenLayers.Events(this, this.extentRectangle, 469 null, true); 470 this.rectEvents.register("mouseover", this, function(e) { 471 if(!this.dragHandler.active && !this.map.dragging) { 472 // this click handler de/activation can be removed when 473 // ticket #1247 is addressed 474 this.clickHandler.deactivate(); 475 this.dragHandler.activate(); 476 this.clickHandler.activate(); 477 } 478 }); 479 this.rectEvents.register("mouseout", this, function(e) { 480 if(!this.dragHandler.dragging) { 481 this.dragHandler.deactivate(); 482 } 483 }); 484 535 485 }, 536 486 … … 549 499 var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent()); 550 500 if (pxBounds) { 551 this.setRectPxBounds(pxBounds);501 this.setRectPxBounds(pxBounds); 552 502 } 553 503 }, … … 558 508 */ 559 509 updateMapToRect: function() { 560 var pxBounds = this.getRectPxBounds(); 561 var lonLatBounds = this.getMapBoundsFromRectBounds(pxBounds); 510 var lonLatBounds = this.getMapBoundsFromRectBounds(this.rectPxBounds); 562 511 this.map.setCenter(lonLatBounds.getCenterLonLat(), this.map.zoom); 563 },564 565 /**566 * Method: getRectPxBounds567 * Get extent rectangle pixel bounds568 *569 * Returns:570 * {<OpenLayers.Bounds>} A bounds which is the extent rectangle's pixel571 * bounds (relative to the parent element)572 */573 getRectPxBounds: function() {574 var top = parseInt(this.extentRectangle.style.top);575 var left = parseInt(this.extentRectangle.style.left);576 var height = parseInt(this.extentRectangle.style.height);577 var width = parseInt(this.extentRectangle.style.width);578 return new OpenLayers.Bounds(left, top + height, left + width, top);579 512 }, 580 513 … … 593 526 var right = Math.min(pxBounds.left + pxBounds.getWidth(), 594 527 this.ovmap.size.w - this.wComp); 595 this.extentRectangle.style.top = parseInt(top) + 'px'; 596 this.extentRectangle.style.left = parseInt(left) + 'px'; 597 this.extentRectangle.style.height = parseInt(Math.max(bottom - top, 0))+ 'px'; 598 this.extentRectangle.style.width = parseInt(Math.max(right - left, 0)) + 'px'; 528 var width = Math.max(right - left, 0); 529 var height = Math.max(bottom - top, 0); 530 if(width < this.minRectSize || height < this.minRectSize) { 531 this.extentRectangle.className = this.displayClass + 532 this.minRectDisplayClass; 533 var rLeft = left + (width / 2) - (this.minRectSize / 2); 534 var rTop = top + (height / 2) - (this.minRectSize / 2); 535 this.extentRectangle.style.top = Math.round(rTop) + 'px'; 536 this.extentRectangle.style.left = Math.round(rLeft) + 'px'; 537 this.extentRectangle.style.height = this.minRectSize + 'px'; 538 this.extentRectangle.style.width = this.minRectSize + 'px'; 539 } else { 540 this.extentRectangle.className = this.displayClass + 541 'ExtentRectangle'; 542 this.extentRectangle.style.top = Math.round(top) + 'px'; 543 this.extentRectangle.style.left = Math.round(left) + 'px'; 544 this.extentRectangle.style.height = Math.round(height) + 'px'; 545 this.extentRectangle.style.width = Math.round(width) + 'px'; 546 } 547 this.rectPxBounds = new OpenLayers.Bounds( 548 Math.round(left), Math.round(bottom), 549 Math.round(right), Math.round(top) 550 ); 599 551 }, 600 552 sandbox/tschaub/scalebar/lib/OpenLayers/Geometry/LinearRing.js
r5614 r5688 213 213 */ 214 214 containsPoint: function(point) { 215 var px = point.x; 216 var py = point.y; 215 var approx = OpenLayers.Number.limitSigDigs; 216 var digs = 14; 217 var px = approx(point.x, digs); 218 var py = approx(point.y, digs); 217 219 function getX(y, x1, y1, x2, y2) { 218 220 return (((x1 - x2) * y) + ((x2 * y1) - (x1 * y2))) / (y1 - y2); … … 223 225 for(var i=0; i<numSeg; ++i) { 224 226 start = this.components[i]; 225 x1 = start.x;226 y1 = start.y;227 x1 = approx(start.x, digs); 228 y1 = approx(start.y, digs); 227 229 end = this.components[i + 1]; 228 x2 = end.x;229 y2 = end.y;230 x2 = approx(end.x, digs); 231 y2 = approx(end.y, digs); 230 232 231 233 /** … … 254 256 continue; 255 257 } 256 cx = getX(py, x1, y1, x2, y2);258 cx = approx(getX(py, x1, y1, x2, y2), digs); 257 259 if(cx == px) { 258 260 // point on line … … 268 270 continue; 269 271 } 270 if( cx < Math.min(x1, x2) || cx > Math.max(x1, x2)) {272 if(x1 != x2 && (cx < Math.min(x1, x2) || cx > Math.max(x1, x2))) { 271 273 // no crossing 272 274 continue; sandbox/tschaub/scalebar/lib/OpenLayers/Handler/Click.js
r5614 r5688 91 91 92 92 /** 93 * Property: cachedEvent94 * {Event} Since IE doesn't let us call window.setTimeout with extra95 * arguments, we cache the last click event here.96 */97 cachedEvent: null,98 99 /**100 93 * Constructor: OpenLayers.Handler.Click 101 94 * Create a new click handler. … … 212 205 * Method: delayedCall 213 206 * Sets <timerId> to null. And optionally triggers the click callback if 214 * <cachedEvent>is set.207 * evt is set. 215 208 */ 216 209 delayedCall: function(evt) { sandbox/tschaub/scalebar/lib/OpenLayers/Map.js
r5614 r5688 54 54 */ 55 55 div: null, 56 57 /** 58 * Property: dragging 59 * {Boolean} The map is currently being dragged. 60 */ 61 dragging: false, 56 62 57 63 /** … … 1222 1228 */ 1223 1229 setCenter: function (lonlat, zoom, dragging, forceZoomChange) { 1224 1230 this.dragging = !!dragging; 1231 1225 1232 if (!this.center && !this.isValidLonLat(lonlat)) { 1226 1233 lonlat = this.maxExtent.getCenterLonLat(); sandbox/tschaub/scalebar/lib/OpenLayers/Util.js
r5614 r5688 52 52 if(destination && source) { 53 53 for(var property in source) { 54 va lue = source[property];54 var value = source[property]; 55 55 if(value !== undefined) { 56 56 destination[property] = value; sandbox/tschaub/scalebar/tests/Control/test_Attribution.html
r4237 r5688 2 2 <head> 3 3 <script src="../../lib/OpenLayers.js"></script> 4 <script type="text/javascript"> <!--4 <script type="text/javascript"> 5 5 var map; 6 6 function test_01_Control_Attribution_constructor (t) { … … 36 36 37 37 } 38 // -->39 38 </script> 40 39 </head> sandbox/tschaub/scalebar/tests/Control/test_OverviewMap.html
r4792 r5688 52 52 t.eq(cent.lat, 42.17578125, "Clicking on the Overview Map has the correct effect on map lat"); 53 53 54 control.rectMouseDown({'xy':new OpenLayers.Pixel(5,5), 'which':1}); 55 control.rectMouseMove({'xy':new OpenLayers.Pixel(15,15), 'which':1}); 56 control.rectMouseUp({'xy':new OpenLayers.Pixel(15,15), 'which':1}); 54 control.dragHandler = { 55 last: new OpenLayers.Pixel(5,5), 56 destroy: function() {} 57 }; 58 control.rectDrag(new OpenLayers.Pixel(15, 15)); 59 control.updateMapToRect(); 57 60 58 61 var cent = map.getCenter(); sandbox/tschaub/scalebar/tests/Control/test_Scale.html
r4333 r5688 2 2 <head> 3 3 <script src="../../lib/OpenLayers.js"></script> 4 <script type="text/javascript"> <!--4 <script type="text/javascript"> 5 5 var map; 6 6 function test_01_Control_Scale_constructor (t) { … … 45 45 t.eq(control.div.firstChild.innerHTML, "Scale = 1 : 443M", "Internal scale displayed properly."); 46 46 } 47 // -->48 47 </script> 49 48 </head> sandbox/tschaub/scalebar/tests/Handler/test_Click.html
r5438 r5688 230 230 } 231 231 232 function test_Handler_Drag_submethods(t) {233 t.plan(4);234 235 var map = new OpenLayers.Map('map', {controls: []});236 237 var control = new OpenLayers.Control();238 map.addControl(control);239 240 241 var handler = new OpenLayers.Handler.Drag(control, {});242 // set test events243 var events = ["down", "move", "up", "out"];244 var testEvents = {};245 var type, px;246 for(var i=0; i<events.length; ++i) {247 type = events[i];248 px = new OpenLayers.Pixel(Math.random(), Math.random());249 testEvents[type] = {xy: px};250 setMethod(type);251 }252 function setMethod(type) {253 handler[type] = function(evt) {254 t.ok(evt.xy.x == testEvents[type].xy.x &&255 evt.xy.y == testEvents[type].xy.y,256 "handler." + type + " called with the right event");257 }258 }259 handler.activate();260 261 // test mousedown262 handler.checkModifiers = function(evt) {263 return true;264 }265 var oldIsLeftClick = OpenLayers.Event.isLeftClick;266 OpenLayers.Event.isLeftClick = function(evt) {267 return true;268 }269 map.events.triggerEvent("mousedown", testEvents.down);270 OpenLayers.Event.isLeftClick = oldIsLeftClick;271 272 // test mousemove273 map.events.triggerEvent("mousemove", testEvents.move);274 275 // test mouseup276 map.events.triggerEvent("mouseup", testEvents.up);277 278 // test mouseout279 var oldMouseLeft = OpenLayers.Util.mouseLeft;280 OpenLayers.Util.mouseLeft = function() {281 return true;282 };283 handler.started = true;284 map.events.triggerEvent("mouseout", testEvents.out);285 OpenLayers.Util.mouseLeft = oldMouseLeft;286 287 }288 289 232 function test_Handler_Click_deactivate(t) { 290 233 t.plan(4); sandbox/tschaub/scalebar/tests/Layer/test_MapServer.html
r5622 r5688 465 465 } 466 466 467 // -->468 467 </script> 469 468 </head> sandbox/tschaub/scalebar/tests/data/geos_wkt_intersects.js
r5458 r5688 489 489 {'wkt1':'MULTIPOINT (80 70,20 20,200 170,140 120)', 'wkt2':'MULTIPOINT (140 120,80 70)', result:true}, 490 490 {'wkt1':'MULTIPOINT (80 70,20 20,200 170,140 120)', 'wkt2':'MULTIPOINT (80 170,140 120,200 80)', result:true}, 491 {'wkt1':'MULTIPOINT (80 70,20 20,200 170,140 120)', 'wkt2':'MULTIPOINT (80 170,140 120,200 80,80 70)', result:true} 491 {'wkt1':'MULTIPOINT (80 70,20 20,200 170,140 120)', 'wkt2':'MULTIPOINT (80 170,140 120,200 80,80 70)', result:true}, 492 {'wkt1':'POLYGON((-8239529.462853361 4980952.065110421,-8224242.057199065 4980952.065110421,-8224242.057199064 4988844.188279452,-8239529.462853361 4988844.188279452,-8239529.462853361 4980952.065110421))', 'wkt2':'POINT(-8225445.94039435 4982695.78481786)', result:true}, 493 {'wkt1':'POLYGON((-8239529.462853361 4980952.065110421,-8224242.057199065 4980952.065110421,-8224242.057199064 4988844.188279452,-8239529.462853361 4988844.188279452,-8239529.462853361 4980952.065110421))', 'wkt2':'POINT(-8224242.0571985 4982695.78481786)', result:false}, 494 {'wkt1':'POLYGON((-8239529.462853361 4980952.065110421,-8224242.057199065 4980952.065110421,-8224242.057199064 4988844.188279452,-8239529.462853361 4988844.188279452,-8239529.462853361 4980952.065110421))', 'wkt2':'POINT(-8224242.0571995 4982695.78481786)', result:true} 492 495 ]; sandbox/tschaub/scalebar/tests/grid_inittiles.html
r2978 r5688 10 10 <script src="../lib/OpenLayers.js"></script> 11 11 <script type="text/javascript"> 12 <!--13 12 function init(){ 14 13 var map = new OpenLayers.Map('map', {'maxResolution': 1.40625/2, tileSize: new OpenLayers.Size(256,256)}); … … 22 21 map.zoomOut(); 23 22 } 24 // -->25 23 </script> 26 24 </head> sandbox/tschaub/scalebar/tests/test_BaseTypes.html
r5532 r5688 137 137 t.eq(OpenLayers.Number.limitSigDigs(num, 5), 1234.6, "running limSigDig() on a floating point number works fine"); 138 138 139 } 140 141 function test_Number_format(t) { 142 t.plan(9); 143 var format = O
