Changeset 488
- Timestamp:
- 05/31/06 22:04:41 (2 years ago)
- Files:
-
- trunk/openlayers/build/OpenLayers.js (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/build/OpenLayers.js
r475 r488 1 ////2 /// This blob sucks in all the files in uncompressed form for ease of use3 ///4 5 OpenLayers = new Object();6 OpenLayers._scriptName = "lib/OpenLayers.js";7 OpenLayers._getScriptLocation = function () {8 var scriptLocation = "";9 var SCRIPT_NAME = OpenLayers._scriptName;10 11 var scripts = document.getElementsByTagName('script');12 for (var i = 0; i < scripts.length; i++) {13 var src = scripts[i].getAttribute('src');14 if (src) {15 var index = src.lastIndexOf(SCRIPT_NAME);16 // is it found, at the end of the URL?17 if ((index > -1) && (index + SCRIPT_NAME.length == src.length)) {18 scriptLocation = src.slice(0, -SCRIPT_NAME.length);19 break;20 }21 }22 }23 return scriptLocation;24 }25 1 /* Prototype JavaScript framework, version 1.4.0 26 2 * (c) 2005 Sam Stephenson <sam@conio.net> … … 2691 2667 */ 2692 2668 getCenterPixel:function() { 2693 return new OpenLayers.Pixel( this.left + (this.getWidth() / 2),2694 this.bottom + (this.getHeight() / 2));2669 return new OpenLayers.Pixel( (this.left + this.right) / 2, 2670 (this.bottom + this.top) / 2); 2695 2671 }, 2696 2672 … … 2700 2676 */ 2701 2677 getCenterLonLat:function() { 2702 return new OpenLayers.LonLat( this.left + (this.getWidth() / 2),2703 this.bottom + (this.getHeight() / 2));2678 return new OpenLayers.LonLat( (this.left + this.right) / 2, 2679 (this.bottom + this.top) / 2); 2704 2680 }, 2705 2681 … … 2822 2798 OpenLayers.Bounds.fromString = function(str) { 2823 2799 var bounds = str.split(","); 2824 return new OpenLayers.Bounds(parseFloat(bounds[0]), 2825 parseFloat(bounds[1]), 2826 parseFloat(bounds[2]), 2827 parseFloat(bounds[3])); 2800 return OpenLayers.Bounds.fromArray(bounds); 2828 2801 }; 2829 2802 2803 /** Alternative constructor that builds a new OpenLayers.Bounds 2804 * from an array 2805 * 2806 * @constructor 2807 * 2808 * @param {Array} bbox Array of bounds values (ex. <i>[5,42,10,45]</i>) 2809 * 2810 * @returns New OpenLayers.Bounds object built from the passed-in Array. 2811 * @type OpenLayers.Bounds 2812 */ 2813 OpenLayers.Bounds.fromArray = function(bbox) { 2814 return new OpenLayers.Bounds(parseFloat(bbox[0]), 2815 parseFloat(bbox[1]), 2816 parseFloat(bbox[2]), 2817 parseFloat(bbox[3])); 2818 }; 2830 2819 2831 2820 /** … … 3260 3249 * Ajax reader for OpenLayers 3261 3250 * 3262 * Pay close attention to how this works:3263 *3264 3251 *@uri url to do remote XML http get 3265 3252 *@param 'get' format params (x=y&a=b...) 3266 *@who object which is providing a specificcallbacks for this request3267 *@complete the name of the function which must be defined in the callers.handler[] array3268 *@failure the name of the function which must be defined in the callers.handler[] array3253 *@who object to handle callbacks for this request 3254 *@complete the function to be called on success 3255 *@failure the function to be called on failure 3269 3256 * 3270 3257 * example usage from a caller: 3271 3258 * 3272 * this.handlers["caps"] = function(request){..} 3273 * OpenLayers.loadURL(url,params,this,"caps"); 3259 * caps: function(request) { 3260 * -blah- 3261 * }, 3262 * 3263 * OpenLayers.loadURL(url,params,this,caps); 3274 3264 * 3275 3265 * Notice the above example does not provide an error handler; a default empty 3276 * handler is provided which merely logs the error if a failure handler is not supplied 3266 * handler is provided which merely logs the error if a failure handler is not 3267 * supplied 3277 3268 * 3278 3269 */ … … 3310 3301 // ol.Log.debug("loadURL [" + uri + "]"); 3311 3302 3312 var successx; 3313 var failurex; 3314 var bind1 = null; 3315 var bind2 = null; 3316 3317 if (onComplete) { 3318 successx = caller.handlers[onComplete]; 3319 bind1 = caller; 3320 } else { 3321 successx = OpenLayers.nullHandler; 3322 } 3323 3324 if (onFailure) { 3325 failurex = caller.handlers[onFailure]; 3326 bind2=caller; 3327 } else { 3328 failurex = OpenLayers.nullHandler; 3329 } 3303 var success = (onComplete) ? onComplete.bind(caller) 3304 : OpenLayers.nullHandler; 3305 3306 var failure = (onFailure) ? onFailure.bind(caller) 3307 : OpenLayers.nullHandler; 3330 3308 3331 3309 // from prototype.js … … 3333 3311 { method: 'get', 3334 3312 parameters: params, 3335 onComplete: success x.bind(bind1),3336 onFailure: failure x.bind(bind2)3313 onComplete: success, 3314 onFailure: failure 3337 3315 } 3338 3316 ); … … 4367 4345 4368 4346 if (this.div != null) { 4369 this.div.style.width = this.size.w;4370 this.div.style.height = this.size.h;4371 }4347 this.div.style.width = this.size.w; 4348 this.div.style.height = this.size.h; 4349 } 4372 4350 }, 4373 4351 … … 4381 4359 4382 4360 if (this.div != null) { 4383 this.div.style.backgroundColor = this.backgroundColor;4384 }4361 this.div.style.backgroundColor = this.backgroundColor; 4362 } 4385 4363 }, 4386 4364 … … 4395 4373 if (this.div != null) { 4396 4374 // for Mozilla and Safari 4397 this.div.style.opacity = this.opacity;4375 this.div.style.opacity = this.opacity; 4398 4376 4399 4377 // for IE 4400 this.div.style.filter = 'alpha(opacity=' + this.opacity*100 + ')';4401 }4378 this.div.style.filter = 'alpha(opacity=' + this.opacity*100 + ')'; 4379 } 4402 4380 }, 4403 4381 … … 4412 4390 if (this.div != null) { 4413 4391 this.div.style.border = this.border; 4414 }4392 } 4415 4393 }, 4416 4394 … … 4713 4691 4714 4692 this.features = new Array(); 4715 4716 this.handlers = new Array();4717 this.handlers["requestSuccess"] = this.requestSuccess;4718 4693 }, 4719 4694 … … 4722 4697 draw:function() { 4723 4698 OpenLayers.Tile.prototype.draw.apply(this, arguments); 4724 this.loadFeaturesForRegion( "requestSuccess");4699 this.loadFeaturesForRegion(this.requestSuccess); 4725 4700 }, 4726 4701 … … 5607 5582 this.setRicoCorners(true); 5608 5583 5609 //set the popup color and opacity 5610 this.setBackgroundColor();5611 this.setOpacity();5584 //set the popup color and opacity 5585 this.setBackgroundColor(); 5586 this.setOpacity(); 5612 5587 5613 5588 return this.div; … … 5641 5616 5642 5617 if (this.div != null) { 5643 if (this.contentDiv != null) {5644 this.div.style.background = "transparent";5618 if (this.contentDiv != null) { 5619 this.div.style.background = "transparent"; 5645 5620 Rico.Corner.changeColor(this.contentDiv, this.backgroundColor); 5646 5621 } 5647 }5622 } 5648 5623 }, 5649 5624 … … 5659 5634 if (this.contentDiv != null) { 5660 5635 Rico.Corner.changeOpacity(this.contentDiv, this.opacity); 5661 }5636 } 5662 5637 } 5663 5638 }, … … 5705 5680 } else { 5706 5681 Rico.Corner.reRound(this.contentDiv, options); 5707 //set the popup color and opacity 5708 this.setBackgroundColor();5709 this.setOpacity();5682 //set the popup color and opacity 5683 this.setBackgroundColor(); 5684 this.setOpacity(); 5710 5685 } 5711 5686 },
