large scale syntactic clean up adding missing semi-colons and curly braces around blocks.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@5002 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Paul Spencer
2007-10-18 12:27:35 +00:00
parent 954df47c30
commit 3e9beffc99
36 changed files with 154 additions and 98 deletions

View File

@@ -109,6 +109,7 @@
"OpenLayers/Layer/Boxes.js", "OpenLayers/Layer/Boxes.js",
"OpenLayers/Layer/TMS.js", "OpenLayers/Layer/TMS.js",
"OpenLayers/Layer/TileCache.js", "OpenLayers/Layer/TileCache.js",
"OpenLayers/Layer/DigitalGlobe.js",
"OpenLayers/Popup/Anchored.js", "OpenLayers/Popup/Anchored.js",
"OpenLayers/Popup/AnchoredBubble.js", "OpenLayers/Popup/AnchoredBubble.js",
"OpenLayers/Feature.js", "OpenLayers/Feature.js",
@@ -196,7 +197,9 @@
h.appendChild(s); h.appendChild(s);
} }
} }
if (allScriptTags) document.write(allScriptTags); if (allScriptTags) {
document.write(allScriptTags);
}
} }
})(); })();

View File

@@ -135,9 +135,9 @@ OpenLayers.Ajax = {
*/ */
getTransport: function() { getTransport: function() {
return OpenLayers.Util.Try( return OpenLayers.Util.Try(
function() {return new ActiveXObject('Msxml2.XMLHTTP')}, function() {return new ActiveXObject('Msxml2.XMLHTTP');},
function() {return new ActiveXObject('Microsoft.XMLHTTP')}, function() {return new ActiveXObject('Microsoft.XMLHTTP');},
function() {return new XMLHttpRequest()} function() {return new XMLHttpRequest();}
) || false; ) || false;
}, },
@@ -167,9 +167,11 @@ OpenLayers.Ajax.Responders = {
* responderToAdd - {?} * responderToAdd - {?}
*/ */
register: function(responderToAdd) { register: function(responderToAdd) {
for (var i = 0; i < this.responders.length; i++) for (var i = 0; i < this.responders.length; i++){
if (responderToAdd == this.responders[i]) if (responderToAdd == this.responders[i]){
return; return;
}
}
this.responders.push(responderToAdd); this.responders.push(responderToAdd);
}, },
@@ -289,8 +291,9 @@ OpenLayers.Ajax.Request = OpenLayers.Class(OpenLayers.Ajax.Base, {
*/ */
request: function(url) { request: function(url) {
var parameters = this.options.parameters || ''; var parameters = this.options.parameters || '';
if (parameters.length > 0) parameters += '&_='; if (parameters.length > 0) {
parameters += '&_=';
}
try { try {
this.url = url; this.url = url;
if (this.options.method == 'get' && parameters.length > 0) { if (this.options.method == 'get' && parameters.length > 0) {
@@ -307,7 +310,7 @@ OpenLayers.Ajax.Request = OpenLayers.Class(OpenLayers.Ajax.Base, {
if (this.options.asynchronous) { if (this.options.asynchronous) {
setTimeout(OpenLayers.Function.bind( setTimeout(OpenLayers.Function.bind(
(function() {this.respondToReadyState(1)}),this), 10 (function() {this.respondToReadyState(1);}),this), 10
); );
} }
@@ -525,4 +528,4 @@ OpenLayers.Ajax.serializeXMLToString = function(xmldom) {
var serializer = new XMLSerializer(); var serializer = new XMLSerializer();
data = serializer.serializeToString(xmldom); data = serializer.serializeToString(xmldom);
return data; return data;
} };

View File

@@ -31,7 +31,7 @@ OpenLayers.Class = function() {
if (arguments && arguments[0] != OpenLayers.Class.isPrototype) { if (arguments && arguments[0] != OpenLayers.Class.isPrototype) {
this.initialize.apply(this, arguments); this.initialize.apply(this, arguments);
} }
} };
var extended = {}; var extended = {};
var parent; var parent;
for(var i=0; i<arguments.length; ++i) { for(var i=0; i<arguments.length; ++i) {
@@ -46,7 +46,7 @@ OpenLayers.Class = function() {
} }
Class.prototype = extended; Class.prototype = extended;
return Class; return Class;
} };
/** /**
* Property: isPrototype * Property: isPrototype
@@ -64,10 +64,11 @@ OpenLayers.Class.isPrototype = function () {};
*/ */
OpenLayers.Class.create = function() { OpenLayers.Class.create = function() {
return function() { return function() {
if (arguments && arguments[0] != OpenLayers.Class.isPrototype) if (arguments && arguments[0] != OpenLayers.Class.isPrototype) {
this.initialize.apply(this, arguments); this.initialize.apply(this, arguments);
} }
} };
};
/** /**
@@ -92,4 +93,4 @@ OpenLayers.Class.inherit = function () {
OpenLayers.Util.extend(proto, arguments[i]); OpenLayers.Util.extend(proto, arguments[i]);
} }
return proto; return proto;
} };

View File

@@ -36,7 +36,7 @@ OpenLayers.Control.EditingToolbar = OpenLayers.Class(
new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Polygon, {'displayClass': 'olControlDrawFeaturePolygon'}) new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Polygon, {'displayClass': 'olControlDrawFeaturePolygon'})
]; ];
for (var i = 0; i < controls.length; i++) { for (var i = 0; i < controls.length; i++) {
controls[i].featureAdded = function(feature) { feature.state = OpenLayers.State.INSERT; } controls[i].featureAdded = function(feature) { feature.state = OpenLayers.State.INSERT; };
} }
this.addControls(controls); this.addControls(controls);
}, },

View File

@@ -281,7 +281,7 @@ OpenLayers.Control.LayerSwitcher =
'inputElem': inputElem, 'inputElem': inputElem,
'layer': layer, 'layer': layer,
'layerSwitcher': this 'layerSwitcher': this
} };
OpenLayers.Event.observe(inputElem, "mouseup", OpenLayers.Event.observe(inputElem, "mouseup",
OpenLayers.Function.bindAsEventListener(this.onInputClick, OpenLayers.Function.bindAsEventListener(this.onInputClick,
context) context)

View File

@@ -104,7 +104,9 @@ OpenLayers.Control.MouseDefaults = OpenLayers.Class(OpenLayers.Control, {
* {Boolean} * {Boolean}
*/ */
defaultClick: function (evt) { defaultClick: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
var notAfterDrag = !this.performedDrag; var notAfterDrag = !this.performedDrag;
this.performedDrag = false; this.performedDrag = false;
return notAfterDrag; return notAfterDrag;
@@ -130,7 +132,9 @@ OpenLayers.Control.MouseDefaults = OpenLayers.Class(OpenLayers.Control, {
* evt - {Event} * evt - {Event}
*/ */
defaultMouseDown: function (evt) { defaultMouseDown: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
this.mouseDragStart = evt.xy.clone(); this.mouseDragStart = evt.xy.clone();
this.performedDrag = false; this.performedDrag = false;
if (evt.shiftKey) { if (evt.shiftKey) {
@@ -148,7 +152,7 @@ OpenLayers.Control.MouseDefaults = OpenLayers.Class(OpenLayers.Control, {
this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
this.map.viewPortDiv.appendChild(this.zoomBox); this.map.viewPortDiv.appendChild(this.zoomBox);
} }
document.onselectstart=function() { return false; } document.onselectstart=function() { return false; };
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);
}, },
@@ -196,7 +200,9 @@ OpenLayers.Control.MouseDefaults = OpenLayers.Class(OpenLayers.Control, {
* evt - {<OpenLayers.Event>} * evt - {<OpenLayers.Event>}
*/ */
defaultMouseUp: function (evt) { defaultMouseUp: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
if (this.zoomBox) { if (this.zoomBox) {
this.zoomBoxEnd(evt); this.zoomBoxEnd(evt);
} else { } else {

View File

@@ -123,7 +123,9 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
* evt - {Event} * evt - {Event}
*/ */
buttonDown: function(evt) { buttonDown: function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
this.buttonClicked = evt.element.action; this.buttonClicked = evt.element.action;
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);
}, },
@@ -135,7 +137,9 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
* evt - {Event} * evt - {Event}
*/ */
buttonUp: function(evt) { buttonUp: function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
if (this.buttonClicked != null) { if (this.buttonClicked != null) {
if (this.buttonClicked == evt.element.action) { if (this.buttonClicked == evt.element.action) {
this.switchModeTo(evt.element.action); this.switchModeTo(evt.element.action);
@@ -167,7 +171,9 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
* evt - {Event} * evt - {Event}
*/ */
defaultMouseDown: function (evt) { defaultMouseDown: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
this.mouseDragStart = evt.xy.clone(); this.mouseDragStart = evt.xy.clone();
this.performedDrag = false; this.performedDrag = false;
this.startViaKeyboard = false; this.startViaKeyboard = false;
@@ -242,7 +248,7 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
this.map.div.style.cursor = "move"; this.map.div.style.cursor = "move";
break; break;
} }
document.onselectstart = function() { return false; } document.onselectstart = function() { return false; };
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);
}, },
@@ -333,11 +339,15 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
* evt - {Event} * evt - {Event}
*/ */
defaultMouseUp: function (evt) { defaultMouseUp: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
switch (this.mode) { switch (this.mode) {
case "zoombox": case "zoombox":
this.zoomBoxEnd(evt); this.zoomBoxEnd(evt);
if (this.startViaKeyboard) this.leaveMode(); if (this.startViaKeyboard) {
this.leaveMode();
}
break; break;
case "pan": case "pan":
if (this.performedDrag) { if (this.performedDrag) {
@@ -360,7 +370,9 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
&& OpenLayers.Util.mouseLeft(evt, this.map.div)) { && OpenLayers.Util.mouseLeft(evt, this.map.div)) {
if (this.zoomBox) { if (this.zoomBox) {
this.removeZoomBox(); this.removeZoomBox();
if (this.startViaKeyboard) this.leaveMode(); if (this.startViaKeyboard) {
this.leaveMode();
}
} }
this.mouseDragStart = null; this.mouseDragStart = null;
this.map.div.style.cursor = "default"; this.map.div.style.cursor = "default";

View File

@@ -108,8 +108,9 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
*/ */
wheelChange: function(evt, deltaZ) { wheelChange: function(evt, deltaZ) {
var newZoom = this.map.getZoom() + deltaZ; var newZoom = this.map.getZoom() + deltaZ;
if (!this.map.isValidZoomLevel(newZoom)) return; if (!this.map.isValidZoomLevel(newZoom)) {
return;
}
var size = this.map.getSize(); var size = this.map.getSize();
var deltaX = size.w/2 - evt.xy.x; var deltaX = size.w/2 - evt.xy.x;
var deltaY = evt.xy.y - size.h/2; var deltaY = evt.xy.y - size.h/2;

View File

@@ -308,7 +308,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
* evt - {<OpenLayers.Event>} evt * evt - {<OpenLayers.Event>} evt
*/ */
rectMouseDown: function (evt) { rectMouseDown: function (evt) {
if(!OpenLayers.Event.isLeftClick(evt)) return; if(!OpenLayers.Event.isLeftClick(evt)) {
return;
}
this.rectDragStart = evt.xy.clone(); this.rectDragStart = evt.xy.clone();
this.performedRectDrag = false; this.performedRectDrag = false;
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);
@@ -355,7 +357,9 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
* evt - {<OpenLayers.Event>} evt * evt - {<OpenLayers.Event>} evt
*/ */
rectMouseUp: function(evt) { rectMouseUp: function(evt) {
if(!OpenLayers.Event.isLeftClick(evt)) return; if(!OpenLayers.Event.isLeftClick(evt)) {
return;
}
if(this.performedRectDrag) { if(this.performedRectDrag) {
this.updateMapToRect(); this.updateMapToRect();
OpenLayers.Event.stop(evt); OpenLayers.Event.stop(evt);

View File

@@ -151,7 +151,9 @@ OpenLayers.Control.PanZoom = OpenLayers.Class(OpenLayers.Control, {
* evt - {Event} * evt - {Event}
*/ */
buttonDown: function (evt) { buttonDown: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
switch (this.action) { switch (this.action) {
case "panup": case "panup":

View File

@@ -72,7 +72,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
this.divEvents = null; this.divEvents = null;
this.map.events.unregister("zoomend", this, this.moveZoomBar); this.map.events.unregister("zoomend", this, this.moveZoomBar);
this.map.events.unregister("changebaselayer", this, this.redraw) this.map.events.unregister("changebaselayer", this, this.redraw);
OpenLayers.Control.PanZoom.prototype.destroy.apply(this, arguments); OpenLayers.Control.PanZoom.prototype.destroy.apply(this, arguments);
}, },
@@ -155,7 +155,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
sz = new OpenLayers.Size(); sz = new OpenLayers.Size();
sz.h = this.zoomStopHeight * this.map.getNumZoomLevels(); sz.h = this.zoomStopHeight * this.map.getNumZoomLevels();
sz.w = this.zoomStopWidth; sz.w = this.zoomStopWidth;
var div = null var div = null;
if (OpenLayers.Util.alphaHack()) { if (OpenLayers.Util.alphaHack()) {
var id = "OpenLayers_Control_PanZoomBar" + this.map.id; var id = "OpenLayers_Control_PanZoomBar" + this.map.id;
@@ -211,7 +211,9 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
* and sets the zoom level appropriately. * and sets the zoom level appropriately.
*/ */
divClick: function (evt) { divClick: function (evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
var y = evt.xy.y; var y = evt.xy.y;
var top = OpenLayers.Util.pagePosition(evt.object)[1]; var top = OpenLayers.Util.pagePosition(evt.object)[1];
var levels = Math.floor((y - top)/this.zoomStopHeight); var levels = Math.floor((y - top)/this.zoomStopHeight);
@@ -227,7 +229,9 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
* evt - {<OpenLayers.Event>} * evt - {<OpenLayers.Event>}
*/ */
zoomBarDown:function(evt) { zoomBarDown:function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
this.map.events.register("mousemove", this, this.passEventToSlider); this.map.events.register("mousemove", this, this.passEventToSlider);
this.map.events.register("mouseup", this, this.passEventToSlider); this.map.events.register("mouseup", this, this.passEventToSlider);
this.mouseDragStart = evt.xy.clone(); this.mouseDragStart = evt.xy.clone();
@@ -250,7 +254,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
*/ */
zoomBarDrag:function(evt) { zoomBarDrag:function(evt) {
if (this.mouseDragStart != null) { if (this.mouseDragStart != null) {
var deltaY = this.mouseDragStart.y - evt.xy.y var deltaY = this.mouseDragStart.y - evt.xy.y;
var offsets = OpenLayers.Util.pagePosition(this.zoombarDiv); var offsets = OpenLayers.Util.pagePosition(this.zoombarDiv);
if ((evt.clientY - offsets[1]) > 0 && if ((evt.clientY - offsets[1]) > 0 &&
(evt.clientY - offsets[1]) < parseInt(this.zoombarDiv.style.height) - 2) { (evt.clientY - offsets[1]) < parseInt(this.zoombarDiv.style.height) - 2) {
@@ -271,12 +275,14 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
* evt - {<OpenLayers.Event>} * evt - {<OpenLayers.Event>}
*/ */
zoomBarUp:function(evt) { zoomBarUp:function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return; if (!OpenLayers.Event.isLeftClick(evt)) {
return;
}
if (this.zoomStart) { if (this.zoomStart) {
this.div.style.cursor=""; this.div.style.cursor="";
this.map.events.unregister("mouseup", this, this.passEventToSlider); this.map.events.unregister("mouseup", this, this.passEventToSlider);
this.map.events.unregister("mousemove", this, this.passEventToSlider); this.map.events.unregister("mousemove", this, this.passEventToSlider);
var deltaY = this.zoomStart.y - evt.xy.y var deltaY = this.zoomStart.y - evt.xy.y;
this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight)); this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight));
this.moveZoomBar(); this.moveZoomBar();
this.mouseDragStart = null; this.mouseDragStart = null;

View File

@@ -55,7 +55,9 @@ OpenLayers.Control.Scale = OpenLayers.Class(OpenLayers.Control, {
*/ */
updateScale: function() { updateScale: function() {
var scale = this.map.getScale(); var scale = this.map.getScale();
if (!scale) return; if (!scale) {
return;
}
if (scale >= 9500 && scale <= 950000) { if (scale >= 9500 && scale <= 950000) {
scale = Math.round(scale / 1000) + "K"; scale = Math.round(scale / 1000) + "K";

View File

@@ -145,8 +145,9 @@ OpenLayers.Event = {
findElement: function(event, tagName) { findElement: function(event, tagName) {
var element = OpenLayers.Event.element(event); var element = OpenLayers.Event.element(event);
while (element.parentNode && (!element.tagName || while (element.parentNode && (!element.tagName ||
(element.tagName.toUpperCase() != tagName.toUpperCase()))) (element.tagName.toUpperCase() != tagName.toUpperCase()))){
element = element.parentNode; element = element.parentNode;
}
return element; return element;
}, },
@@ -637,7 +638,7 @@ OpenLayers.Events = OpenLayers.Class({
*/ */
handleBrowserEvent: function (evt) { handleBrowserEvent: function (evt) {
evt.xy = this.getMousePosition(evt); evt.xy = this.getMousePosition(evt);
this.triggerEvent(evt.type, evt) this.triggerEvent(evt.type, evt);
}, },
/** /**

View File

@@ -9,7 +9,7 @@ OpenLayers.State = {
INSERT: 'Insert', INSERT: 'Insert',
UPDATE: 'Update', UPDATE: 'Update',
DELETE: 'Delete' DELETE: 'Delete'
} };
/** /**
* @requires OpenLayers/Feature.js * @requires OpenLayers/Feature.js

View File

@@ -27,7 +27,7 @@ OpenLayers.Feature.WFS = OpenLayers.Class(OpenLayers.Feature, {
initialize: function(layer, xmlNode) { initialize: function(layer, xmlNode) {
var newArguments = arguments; var newArguments = arguments;
var data = this.processXMLNode(xmlNode); var data = this.processXMLNode(xmlNode);
newArguments = new Array(layer, data.lonlat, data) newArguments = new Array(layer, data.lonlat, data);
OpenLayers.Feature.prototype.initialize.apply(this, newArguments); OpenLayers.Feature.prototype.initialize.apply(this, newArguments);
this.createMarker(); this.createMarker();
this.layer.addMarker(this.marker); this.layer.addMarker(this.marker);

View File

@@ -174,7 +174,7 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
case "FeatureCollection": case "FeatureCollection":
// allow for any type to be converted to a feature collection // allow for any type to be converted to a feature collection
valid = true; valid = true;
break break;
default: default:
// for GeometryCollection and Feature, types must match // for GeometryCollection and Feature, types must match
if(obj.type == type) { if(obj.type == type) {
@@ -489,7 +489,7 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
*/ */
createCRSObject: function(object) { createCRSObject: function(object) {
var proj = object.layer.projection; var proj = object.layer.projection;
var crs = {} var crs = {};
if (proj.match(/epsg:/i)) { if (proj.match(/epsg:/i)) {
var code = parseInt(proj.substring(proj.indexOf(":") + 1)); var code = parseInt(proj.substring(proj.indexOf(":") + 1));
if (code == 4326) { if (code == 4326) {
@@ -534,7 +534,7 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
"id": feature.fid == null ? feature.id : feature.fid, "id": feature.fid == null ? feature.id : feature.fid,
"properties": feature.attributes, "properties": feature.attributes,
"geometry": geom "geometry": geom
} };
}, },
/** /**
@@ -553,7 +553,7 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
return { return {
"type": geometryType, "type": geometryType,
"coordinates": data "coordinates": data
} };
}, },
/** /**

View File

@@ -281,7 +281,7 @@ OpenLayers.Format.WKT = OpenLayers.Class(OpenLayers.Format, {
for(var i=0; i<rings.length; ++i) { for(var i=0; i<rings.length; ++i) {
ring = rings[i].replace(this.regExes.trimParens, '$1'); ring = rings[i].replace(this.regExes.trimParens, '$1');
linestring = this.parse.linestring.apply(this, [ring]).geometry; linestring = this.parse.linestring.apply(this, [ring]).geometry;
linearring = new OpenLayers.Geometry.LinearRing(linestring.components) linearring = new OpenLayers.Geometry.LinearRing(linestring.components);
components.push(linearring); components.push(linearring);
} }
return new OpenLayers.Feature.Vector( return new OpenLayers.Feature.Vector(

View File

@@ -86,4 +86,4 @@ OpenLayers.Geometry.Polygon.createRegularPolygon = function(origin, radius, side
} }
var ring = new OpenLayers.Geometry.LinearRing(points); var ring = new OpenLayers.Geometry.LinearRing(points);
return new OpenLayers.Geometry.Polygon([ring]); return new OpenLayers.Geometry.Polygon([ring]);
} };

View File

@@ -157,7 +157,7 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
if(!this.oldOnselectstart) { if(!this.oldOnselectstart) {
this.oldOnselectstart = document.onselectstart; this.oldOnselectstart = document.onselectstart;
document.onselectstart = function() {return false;} document.onselectstart = function() {return false;};
} }
propagate = false; propagate = false;
@@ -187,7 +187,7 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
this.callback("move", [evt.xy]); this.callback("move", [evt.xy]);
if(!this.oldOnselectstart) { if(!this.oldOnselectstart) {
this.oldOnselectstart = document.onselectstart; this.oldOnselectstart = document.onselectstart;
document.onselectstart = function() {return false;} document.onselectstart = function() {return false;};
} }
this.last = evt.xy; this.last = evt.xy;
} }
@@ -240,7 +240,7 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
if(document.onselectstart) { if(document.onselectstart) {
document.onselectstart = this.oldOnselectstart; document.onselectstart = this.oldOnselectstart;
} }
this.callback("done", [evt.xy]) this.callback("done", [evt.xy]);
} }
return true; return true;
}, },

View File

@@ -65,8 +65,9 @@ OpenLayers.Handler.MouseWheel = OpenLayers.Class(OpenLayers.Handler, {
*/ */
onWheelEvent: function(e){ onWheelEvent: function(e){
// first check keyboard modifiers // first check keyboard modifiers
if (!this.checkModifiers(e)) return; if (!this.checkModifiers(e)) {
return;
}
// first determine whether or not the wheeling was inside the map // first determine whether or not the wheeling was inside the map
var inMap = false; var inMap = false;
var elem = OpenLayers.Event.element(e); var elem = OpenLayers.Event.element(e);

View File

@@ -666,7 +666,7 @@ OpenLayers.Layer = OpenLayers.Class({
// now we have numZoomLevels and maxResolution, // now we have numZoomLevels and maxResolution,
// we can populate the resolutions array // we can populate the resolutions array
for (var i=0; i < confProps.numZoomLevels; i++) { for (var i=0; i < confProps.numZoomLevels; i++) {
var res = confProps.maxResolution / Math.pow(2, i) var res = confProps.maxResolution / Math.pow(2, i);
confProps.resolutions.push(res); confProps.resolutions.push(res);
} }
} }

View File

@@ -256,7 +256,7 @@ OpenLayers.Layer.EventPane = OpenLayers.Class(OpenLayers.Layer, {
if ( (this.mapObject != null) && if ( (this.mapObject != null) &&
(this.getMapObjectCenter() != null) ) { (this.getMapObjectCenter() != null) ) {
var moPixel = this.getMapObjectPixelFromOLPixel(viewPortPx); var moPixel = this.getMapObjectPixelFromOLPixel(viewPortPx);
var moLonLat = this.getMapObjectLonLatFromMapObjectPixel(moPixel) var moLonLat = this.getMapObjectLonLatFromMapObjectPixel(moPixel);
lonlat = this.getOLLonLatFromMapObjectLonLat(moLonLat); lonlat = this.getOLLonLatFromMapObjectLonLat(moLonLat);
} }
return lonlat; return lonlat;
@@ -281,7 +281,7 @@ OpenLayers.Layer.EventPane = OpenLayers.Class(OpenLayers.Layer, {
(this.getMapObjectCenter() != null) ) { (this.getMapObjectCenter() != null) ) {
var moLonLat = this.getMapObjectLonLatFromOLLonLat(lonlat); var moLonLat = this.getMapObjectLonLatFromOLLonLat(lonlat);
var moPixel = this.getMapObjectPixelFromMapObjectLonLat(moLonLat) var moPixel = this.getMapObjectPixelFromMapObjectLonLat(moLonLat);
viewPortPx = this.getOLPixelFromMapObjectPixel(moPixel); viewPortPx = this.getOLPixelFromMapObjectPixel(moPixel);
} }

View File

@@ -195,9 +195,13 @@ OpenLayers.Layer.GeoRSS = OpenLayers.Class(OpenLayers.Layer.Markers, {
if ((title != null) && (description != null)) { if ((title != null) && (description != null)) {
contentHTML = '<div class="olLayerGeoRSSClose">[x]</div>'; contentHTML = '<div class="olLayerGeoRSSClose">[x]</div>';
contentHTML += '<div class="olLayerGeoRSSTitle">'; contentHTML += '<div class="olLayerGeoRSSTitle">';
if (link) contentHTML += '<a class="link" href="'+link+'" target="_blank">'; if (link) {
contentHTML += '<a class="link" href="'+link+'" target="_blank">';
}
contentHTML += title; contentHTML += title;
if (link) contentHTML += '</a>'; if (link) {
contentHTML += '</a>';
}
contentHTML += '</div>'; contentHTML += '</div>';
contentHTML += '<div style="" class="olLayerGeoRSSDescription">'; contentHTML += '<div style="" class="olLayerGeoRSSDescription">';
contentHTML += description; contentHTML += description;

View File

@@ -296,7 +296,7 @@ OpenLayers.Layer.Google = OpenLayers.Class(
var html = ""; var html = "";
html += "The Google Layer was unable to load correctly.<br>"; html += "The Google Layer was unable to load correctly.<br>";
html += "<br>"; html += "<br>";
html += "To get rid of this message, select a new BaseLayer " html += "To get rid of this message, select a new BaseLayer ";
html += "in the layer switcher in the upper-right corner.<br>"; html += "in the layer switcher in the upper-right corner.<br>";
html += "<br>"; html += "<br>";
html += "Most likely, this is because the Google Maps library"; html += "Most likely, this is because the Google Maps library";
@@ -304,7 +304,7 @@ OpenLayers.Layer.Google = OpenLayers.Class(
html += " correct API key for your site.<br>"; html += " correct API key for your site.<br>";
html += "<br>"; html += "<br>";
html += "Developers: For help getting this working correctly, "; html += "Developers: For help getting this working correctly, ";
html += "<a href='http://trac.openlayers.org/wiki/Google' " html += "<a href='http://trac.openlayers.org/wiki/Google' ";
html += "target='_blank'>"; html += "target='_blank'>";
html += "click here"; html += "click here";
html += "</a>"; html += "</a>";

View File

@@ -99,14 +99,14 @@ OpenLayers.Layer.MultiMap = OpenLayers.Class(
var html = ""; var html = "";
html += "The MM Layer was unable to load correctly.<br>"; html += "The MM Layer was unable to load correctly.<br>";
html += "<br>"; html += "<br>";
html += "To get rid of this message, select a new BaseLayer " html += "To get rid of this message, select a new BaseLayer ";
html += "in the layer switcher in the upper-right corner.<br>"; html += "in the layer switcher in the upper-right corner.<br>";
html += "<br>"; html += "<br>";
html += "Most likely, this is because the MM library"; html += "Most likely, this is because the MM library";
html += " script was either not correctly included.<br>"; html += " script was either not correctly included.<br>";
html += "<br>"; html += "<br>";
html += "Demmlopers: For help getting this working correctly, "; html += "Demmlopers: For help getting this working correctly, ";
html += "<a href='http://trac.openlayers.org/wiki/MultiMap' " html += "<a href='http://trac.openlayers.org/wiki/MultiMap' ";
html += "target='_blank'>"; html += "target='_blank'>";
html += "click here"; html += "click here";
html += "</a>"; html += "</a>";

View File

@@ -106,12 +106,12 @@ OpenLayers.Layer.Text = OpenLayers.Class(OpenLayers.Layer.Markers, {
} else if (columns[valIndex] == 'lon') { } else if (columns[valIndex] == 'lon') {
location.lon = parseFloat(vals[valIndex]); location.lon = parseFloat(vals[valIndex]);
set = true; set = true;
} else if (columns[valIndex] == 'title') } else if (columns[valIndex] == 'title') {
title = vals[valIndex]; title = vals[valIndex];
else if (columns[valIndex] == 'image' || } else if (columns[valIndex] == 'image' ||
columns[valIndex] == 'icon') columns[valIndex] == 'icon') {
url = vals[valIndex]; url = vals[valIndex];
else if (columns[valIndex] == 'iconSize') { } else if (columns[valIndex] == 'iconSize') {
var size = vals[valIndex].split(','); var size = vals[valIndex].split(',');
iconSize = new OpenLayers.Size(parseFloat(size[0]), iconSize = new OpenLayers.Size(parseFloat(size[0]),
parseFloat(size[1])); parseFloat(size[1]));

View File

@@ -121,14 +121,14 @@ OpenLayers.Layer.VirtualEarth = OpenLayers.Class(
var html = ""; var html = "";
html += "The VE Layer was unable to load correctly.<br>"; html += "The VE Layer was unable to load correctly.<br>";
html += "<br>"; html += "<br>";
html += "To get rid of this message, select a new BaseLayer " html += "To get rid of this message, select a new BaseLayer ";
html += "in the layer switcher in the upper-right corner.<br>"; html += "in the layer switcher in the upper-right corner.<br>";
html += "<br>"; html += "<br>";
html += "Most likely, this is because the VE library"; html += "Most likely, this is because the VE library";
html += " script was either not correctly included.<br>"; html += " script was either not correctly included.<br>";
html += "<br>"; html += "<br>";
html += "Developers: For help getting this working correctly, "; html += "Developers: For help getting this working correctly, ";
html += "<a href='http://trac.openlayers.org/wiki/VirtualEarth' " html += "<a href='http://trac.openlayers.org/wiki/VirtualEarth' ";
html += "target='_blank'>"; html += "target='_blank'>";
html += "click here"; html += "click here";
html += "</a>"; html += "</a>";

View File

@@ -154,10 +154,12 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
bounds = this.adjustBounds(bounds); bounds = this.adjustBounds(bounds);
var imageSize = this.getImageSize(); var imageSize = this.getImageSize();
return this.getFullRequestString( var s = this.getFullRequestString(
{BBOX: this.encodeBBOX ? bounds.toBBOX() : bounds.toArray(), {BBOX: this.encodeBBOX ? bounds.toBBOX() : bounds.toArray(),
WIDTH:imageSize.w, WIDTH:imageSize.w,
HEIGHT:imageSize.h}); HEIGHT:imageSize.h});
//console.log(s);
return s;
}, },
/** /**

View File

@@ -130,9 +130,9 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
fixYahooEventPane: function() { fixYahooEventPane: function() {
var yahooEventPane = OpenLayers.Util.getElement("ygddfdiv"); var yahooEventPane = OpenLayers.Util.getElement("ygddfdiv");
if (yahooEventPane != null) { if (yahooEventPane != null) {
if (yahooEventPane.parentNode != null) if (yahooEventPane.parentNode != null) {
yahooEventPane.parentNode.removeChild(yahooEventPane); yahooEventPane.parentNode.removeChild(yahooEventPane);
}
this.map.events.unregister("moveend", this, this.map.events.unregister("moveend", this,
this.fixYahooEventPane); this.fixYahooEventPane);
} }
@@ -150,14 +150,14 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
var html = ""; var html = "";
html += "The Yahoo Layer was unable to load correctly.<br>"; html += "The Yahoo Layer was unable to load correctly.<br>";
html += "<br>"; html += "<br>";
html += "To get rid of this message, select a new BaseLayer " html += "To get rid of this message, select a new BaseLayer ";
html += "in the layer switcher in the upper-right corner.<br>"; html += "in the layer switcher in the upper-right corner.<br>";
html += "<br>"; html += "<br>";
html += "Most likely, this is because the Yahoo library"; html += "Most likely, this is because the Yahoo library";
html += " script was either not correctly included.<br>"; html += " script was either not correctly included.<br>";
html += "<br>"; html += "<br>";
html += "Developers: For help getting this working correctly, "; html += "Developers: For help getting this working correctly, ";
html += "<a href='http://trac.openlayers.org/wiki/Yahoo' " html += "<a href='http://trac.openlayers.org/wiki/Yahoo' ";
html += "target='_blank'>"; html += "target='_blank'>";
html += "click here"; html += "click here";
html += "</a>"; html += "</a>";

View File

@@ -905,8 +905,9 @@ OpenLayers.Map = OpenLayers.Class({
this.events.element.offsets = null; this.events.element.offsets = null;
var newSize = this.getCurrentSize(); var newSize = this.getCurrentSize();
var oldSize = this.getSize(); var oldSize = this.getSize();
if (oldSize == null) if (oldSize == null) {
this.size = oldSize = newSize; this.size = oldSize = newSize;
}
if (!newSize.equals(oldSize)) { if (!newSize.equals(oldSize)) {
// store the new size // store the new size

View File

@@ -169,7 +169,7 @@ OpenLayers.Popup = OpenLayers.Class({
var closePopup = closeBoxCallback || function(e) { var closePopup = closeBoxCallback || function(e) {
this.hide(); this.hide();
OpenLayers.Event.stop(e); OpenLayers.Event.stop(e);
} };
OpenLayers.Event.observe(closeImg, "click", OpenLayers.Event.observe(closeImg, "click",
OpenLayers.Function.bindAsEventListener(closePopup, this)); OpenLayers.Function.bindAsEventListener(closePopup, this));

View File

@@ -395,7 +395,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
var linearRing = geometry.components[j]; var linearRing = geometry.components[j];
d += " M"; d += " M";
for (var i = 0; i < linearRing.components.length; i++) { for (var i = 0; i < linearRing.components.length; i++) {
var component = this.getShortString(linearRing.components[i]) var component = this.getShortString(linearRing.components[i]);
if (component) { if (component) {
d += " " + component; d += " " + component;
} else { } else {

View File

@@ -524,9 +524,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
var y = geometry.components[i].y / resolution; var y = geometry.components[i].y / resolution;
if ((i%3)==0 && (i/3)==0) { if ((i%3)==0 && (i/3)==0) {
path += "m" path += "m";
} else if ((i%3)==1) { } else if ((i%3)==1) {
path += " c" path += " c";
} }
path += " " + x + "," + y; path += " " + x + "," + y;
} }

View File

@@ -203,7 +203,7 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
this.isLoading = false; this.isLoading = false;
this.events.triggerEvent("loadend"); this.events.triggerEvent("loadend");
} }
} };
OpenLayers.Event.observe(this.imgDiv, 'load', OpenLayers.Event.observe(this.imgDiv, 'load',
OpenLayers.Function.bind(onload, this)); OpenLayers.Function.bind(onload, this));

View File

@@ -117,7 +117,9 @@ OpenLayers.Util.clearArray = function(array) {
OpenLayers.Util.indexOf = function(array, obj) { OpenLayers.Util.indexOf = function(array, obj) {
for(var i=0; i < array.length; i++) { for(var i=0; i < array.length; i++) {
if (array[i] == obj) return i; if (array[i] == obj) {
return i;
}
} }
return -1; return -1;
}; };
@@ -293,7 +295,7 @@ OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border,
OpenLayers.Util.setOpacity = function(element, opacity) { OpenLayers.Util.setOpacity = function(element, opacity) {
OpenLayers.Util.modifyDOMElement(element, null, null, null, OpenLayers.Util.modifyDOMElement(element, null, null, null,
null, null, null, opacity); null, null, null, opacity);
} };
/** /**
* Function: onImageLoad * Function: onImageLoad
@@ -373,7 +375,7 @@ OpenLayers.Util.alphaHack = function() {
return ( filter && return ( filter &&
(version >= 5.5) && (version < 7) ); (version >= 5.5) && (version < 7) );
} };
/** /**
* Function: modifyAlphaImageDiv * Function: modifyAlphaImageDiv
@@ -587,7 +589,7 @@ OpenLayers.Util.Try = function() {
} }
return returnValue; return returnValue;
} };
/** /**
@@ -681,10 +683,12 @@ OpenLayers.Util.getXmlNodeValue = function(node) {
OpenLayers.Util.Try( OpenLayers.Util.Try(
function() { function() {
val = node.text; val = node.text;
if (!val) if (!val) {
val = node.textContent; val = node.textContent;
if (!val) }
if (!val) {
val = node.firstChild.nodeValue; val = node.firstChild.nodeValue;
}
}, },
function() { function() {
val = node.textContent; val = node.textContent;
@@ -747,7 +751,9 @@ OpenLayers.Util.distVincenty=function(p1, p2) {
var sinLambda = Math.sin(lambda), cosLambda = Math.cos(lambda); var sinLambda = Math.sin(lambda), cosLambda = Math.cos(lambda);
var sinSigma = Math.sqrt((cosU2*sinLambda) * (cosU2*sinLambda) + var sinSigma = Math.sqrt((cosU2*sinLambda) * (cosU2*sinLambda) +
(cosU1*sinU2-sinU1*cosU2*cosLambda) * (cosU1*sinU2-sinU1*cosU2*cosLambda)); (cosU1*sinU2-sinU1*cosU2*cosLambda) * (cosU1*sinU2-sinU1*cosU2*cosLambda));
if (sinSigma==0) return 0; // co-incident points if (sinSigma==0) {
return 0; // co-incident points
}
var cosSigma = sinU1*sinU2 + cosU1*cosU2*cosLambda; var cosSigma = sinU1*sinU2 + cosU1*cosU2*cosLambda;
var sigma = Math.atan2(sinSigma, cosSigma); var sigma = Math.atan2(sinSigma, cosSigma);
var alpha = Math.asin(cosU1 * cosU2 * sinLambda / sinSigma); var alpha = Math.asin(cosU1 * cosU2 * sinLambda / sinSigma);
@@ -758,7 +764,9 @@ OpenLayers.Util.distVincenty=function(p1, p2) {
lambda = L + (1-C) * f * Math.sin(alpha) * lambda = L + (1-C) * f * Math.sin(alpha) *
(sigma + C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM))); (sigma + C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));
} }
if (iterLimit==0) return NaN // formula failed to converge if (iterLimit==0) {
return NaN; // formula failed to converge
}
var uSq = cosSqAlpha * (a*a - b*b) / (b*b); var uSq = cosSqAlpha * (a*a - b*b) / (b*b);
var A = 1 + uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq))); var A = 1 + uSq/16384*(4096+uSq*(-768+uSq*(320-175*uSq)));
var B = uSq/1024 * (256+uSq*(-128+uSq*(74-47*uSq))); var B = uSq/1024 * (256+uSq*(-128+uSq*(74-47*uSq)));
@@ -783,9 +791,9 @@ OpenLayers.Util.distVincenty=function(p1, p2) {
* {Object} An object of key/value pairs from the query string. * {Object} An object of key/value pairs from the query string.
*/ */
OpenLayers.Util.getParameters = function(url) { OpenLayers.Util.getParameters = function(url) {
//if no url specified, take it from the location bar /* if no url specified, take it from the location bar */
url = url || window.location.href url = url || window.location.href;
if(url == null) { if (url == null) {
url = window.location.href; url = window.location.href;
} }
@@ -980,7 +988,7 @@ OpenLayers.Util.safeStopPropagation = function(evt) {
* Parameters: * Parameters:
* forElement - {DOMElement} * forElement - {DOMElement}
* *
* Returns:<EFBFBD> * Returns:´
* {Array} two item array, L value then T value. * {Array} two item array, L value then T value.
*/ */
OpenLayers.Util.pagePosition = function(forElement) { OpenLayers.Util.pagePosition = function(forElement) {
@@ -1184,7 +1192,7 @@ OpenLayers.Util.createUrlObject = function(url, options) {
var index = relStr.indexOf("../"); var index = relStr.indexOf("../");
if (index == 0) { if (index == 0) {
backs++ backs++;
relStr = relStr.substr(3); relStr = relStr.substr(3);
} else if (index >= 0) { } else if (index >= 0) {
var prevChunk = relStr.substr(0,index - 1); var prevChunk = relStr.substr(0,index - 1);

View File

@@ -79,5 +79,4 @@ function (fn, expectedException, doc) {
} else { } else {
this.fail(doc); this.fail(doc);
} }
} };