Tabs patch from Erik, to change tabs to spaces so we don't have commit
conflicts later on. git-svn-id: http://svn.openlayers.org/trunk/openlayers@2920 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -3,24 +3,24 @@
|
|||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
border: 0px;
|
border: 0px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
#map {
|
#map {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border: 0px;
|
border: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script src="../lib/OpenLayers.js"></script>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
var lat = 900863;
|
var lat = 900863;
|
||||||
var lon = 235829;
|
var lon = 235829;
|
||||||
var zoom = 6;
|
var zoom = 6;
|
||||||
var map, layer;
|
var map, layer;
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
<script src="../lib/OpenLayers.js" type="text/javascript"></script>
|
<script src="../lib/OpenLayers.js" type="text/javascript"></script>
|
||||||
<style>
|
<style>
|
||||||
#map{
|
#map{
|
||||||
width:100%;
|
width:100%;
|
||||||
height:500px;
|
height:500px;
|
||||||
border:1px solid;
|
border:1px solid;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@@ -16,32 +16,32 @@
|
|||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<script defer="defer" type="text/javascript">
|
<script defer="defer" type="text/javascript">
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
// my city
|
// my city
|
||||||
var constantina = new OpenLayers.LonLat(-5.6165,37.8623);
|
var constantina = new OpenLayers.LonLat(-5.6165,37.8623);
|
||||||
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||||
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
||||||
var nasa_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
|
var nasa_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
|
||||||
"http://wms.jpl.nasa.gov/wms.cgi", {layers: "modis,global_mosaic"} );
|
"http://wms.jpl.nasa.gov/wms.cgi", {layers: "modis,global_mosaic"} );
|
||||||
|
|
||||||
map.addLayers([
|
map.addLayers([
|
||||||
nasa_wms,
|
nasa_wms,
|
||||||
wms
|
wms
|
||||||
]);
|
]);
|
||||||
|
|
||||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
layers: [wms.clone()],
|
layers: [wms.clone()],
|
||||||
minRatio: 8,
|
minRatio: 8,
|
||||||
maxRatio: 128
|
maxRatio: 128
|
||||||
};
|
};
|
||||||
var overview = new OpenLayers.Control.OverviewMap(options);
|
var overview = new OpenLayers.Control.OverviewMap(options);
|
||||||
|
|
||||||
map.addControl(overview);
|
map.addControl(overview);
|
||||||
|
|
||||||
map.setCenter(constantina, 4);
|
map.setCenter(constantina, 4);
|
||||||
|
|
||||||
overview.maximizeControl();
|
overview.maximizeControl();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ var map,ia_wms;
|
|||||||
"http://wms.jpl.nasa.gov/wms.cgi",
|
"http://wms.jpl.nasa.gov/wms.cgi",
|
||||||
{layers: "modis,global_mosaic"});
|
{layers: "modis,global_mosaic"});
|
||||||
|
|
||||||
ia_wms = new OpenLayers.Layer.WMS("Nexrad","http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?",{layers:"nexrad-n0r-wmst",transparent:true,format:'image/png',time:OpenLayers.Util.getElement('time').value});
|
ia_wms = new OpenLayers.Layer.WMS("Nexrad","http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?",{layers:"nexrad-n0r-wmst",transparent:true,format:'image/png',time:OpenLayers.Util.getElement('time').value});
|
||||||
|
|
||||||
jpl_wms.setVisibility(false);
|
jpl_wms.setVisibility(false);
|
||||||
|
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ OpenLayers.Control.OverviewMap.prototype =
|
|||||||
'click',
|
'click',
|
||||||
this.maximizeControl.bindAsEventListener(this));
|
this.maximizeControl.bindAsEventListener(this));
|
||||||
OpenLayers.Event.observe(this.maximizeDiv,
|
OpenLayers.Event.observe(this.maximizeDiv,
|
||||||
'dblclick',
|
'dblclick',
|
||||||
function(e) {
|
function(e) {
|
||||||
OpenLayers.Event.stop(e);
|
OpenLayers.Event.stop(e);
|
||||||
});
|
});
|
||||||
this.div.appendChild(this.maximizeDiv);
|
this.div.appendChild(this.maximizeDiv);
|
||||||
@@ -186,8 +186,8 @@ OpenLayers.Control.OverviewMap.prototype =
|
|||||||
'click',
|
'click',
|
||||||
this.minimizeControl.bindAsEventListener(this));
|
this.minimizeControl.bindAsEventListener(this));
|
||||||
OpenLayers.Event.observe(this.minimizeDiv,
|
OpenLayers.Event.observe(this.minimizeDiv,
|
||||||
'dblclick',
|
'dblclick',
|
||||||
function(e) {
|
function(e) {
|
||||||
OpenLayers.Event.stop(e);
|
OpenLayers.Event.stop(e);
|
||||||
});
|
});
|
||||||
this.div.appendChild(this.minimizeDiv);
|
this.div.appendChild(this.minimizeDiv);
|
||||||
|
|||||||
@@ -180,24 +180,24 @@ OpenLayers.Format.GML.prototype =
|
|||||||
* @param DOMElement xmlNode
|
* @param DOMElement xmlNode
|
||||||
*/
|
*/
|
||||||
parseAttributes: function(xmlNode) {
|
parseAttributes: function(xmlNode) {
|
||||||
var nodes = xmlNode.childNodes;
|
var nodes = xmlNode.childNodes;
|
||||||
var attributes = {};
|
var attributes = {};
|
||||||
for(var i = 0; i < nodes.length; i++) {
|
for(var i = 0; i < nodes.length; i++) {
|
||||||
var name = nodes[i].nodeName;
|
var name = nodes[i].nodeName;
|
||||||
var value = OpenLayers.Util.getXmlNodeValue(nodes[i]);
|
var value = OpenLayers.Util.getXmlNodeValue(nodes[i]);
|
||||||
// Ignore Geometry attributes
|
// Ignore Geometry attributes
|
||||||
// match ".//gml:pos|.//gml:posList|.//gml:coordinates"
|
// match ".//gml:pos|.//gml:posList|.//gml:coordinates"
|
||||||
if((name.search(":pos")!=-1)
|
if((name.search(":pos")!=-1)
|
||||||
||(name.search(":posList")!=-1)
|
||(name.search(":posList")!=-1)
|
||||||
||(name.search(":coordinates")!=-1)){
|
||(name.search(":coordinates")!=-1)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for a leaf node
|
// Check for a leaf node
|
||||||
if((nodes[i].childNodes.length == 1 && nodes[i].childNodes[0].nodeName == "#text")
|
if((nodes[i].childNodes.length == 1 && nodes[i].childNodes[0].nodeName == "#text")
|
||||||
|| (nodes[i].childNodes.length == 0 && nodes[i].nodeName!="#text")) {
|
|| (nodes[i].childNodes.length == 0 && nodes[i].nodeName!="#text")) {
|
||||||
attributes[name] = value;
|
attributes[name] = value;
|
||||||
}
|
}
|
||||||
OpenLayers.Util.extend(attributes, this.parseAttributes(nodes[i]))
|
OpenLayers.Util.extend(attributes, this.parseAttributes(nodes[i]))
|
||||||
}
|
}
|
||||||
return attributes;
|
return attributes;
|
||||||
|
|||||||
@@ -93,24 +93,24 @@ OpenLayers.Format.KML.prototype =
|
|||||||
* @param DOMElement xmlNode
|
* @param DOMElement xmlNode
|
||||||
*/
|
*/
|
||||||
parseAttributes: function(xmlNode) {
|
parseAttributes: function(xmlNode) {
|
||||||
var nodes = xmlNode.childNodes;
|
var nodes = xmlNode.childNodes;
|
||||||
var attributes = {};
|
var attributes = {};
|
||||||
for(var i = 0; i < nodes.length; i++) {
|
for(var i = 0; i < nodes.length; i++) {
|
||||||
var name = nodes[i].nodeName;
|
var name = nodes[i].nodeName;
|
||||||
var value = OpenLayers.Util.getXmlNodeValue(nodes[i]);
|
var value = OpenLayers.Util.getXmlNodeValue(nodes[i]);
|
||||||
// Ignore Geometry attributes
|
// Ignore Geometry attributes
|
||||||
// match ".//gml:pos|.//gml:posList|.//gml:coordinates"
|
// match ".//gml:pos|.//gml:posList|.//gml:coordinates"
|
||||||
if((name.search(":pos")!=-1)
|
if((name.search(":pos")!=-1)
|
||||||
||(name.search(":posList")!=-1)
|
||(name.search(":posList")!=-1)
|
||||||
||(name.search(":coordinates")!=-1)){
|
||(name.search(":coordinates")!=-1)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for a leaf node
|
// Check for a leaf node
|
||||||
if((nodes[i].childNodes.length == 1 && nodes[i].childNodes[0].nodeName == "#text")
|
if((nodes[i].childNodes.length == 1 && nodes[i].childNodes[0].nodeName == "#text")
|
||||||
|| (nodes[i].childNodes.length == 0 && nodes[i].nodeName!="#text")) {
|
|| (nodes[i].childNodes.length == 0 && nodes[i].nodeName!="#text")) {
|
||||||
attributes[name] = value;
|
attributes[name] = value;
|
||||||
}
|
}
|
||||||
OpenLayers.Util.extend(attributes, this.parseAttributes(nodes[i]))
|
OpenLayers.Util.extend(attributes, this.parseAttributes(nodes[i]))
|
||||||
}
|
}
|
||||||
return attributes;
|
return attributes;
|
||||||
|
|||||||
@@ -126,8 +126,8 @@ OpenLayers.Geometry.prototype = {
|
|||||||
var bounds = this.getBounds();
|
var bounds = this.getBounds();
|
||||||
if ((bounds != null) && (lonlat != null)) {
|
if ((bounds != null) && (lonlat != null)) {
|
||||||
|
|
||||||
var dX = (toleranceLon != null) ? toleranceLon : 0;
|
var dX = (toleranceLon != null) ? toleranceLon : 0;
|
||||||
var dY = (toleranceLat != null) ? toleranceLat : 0;
|
var dY = (toleranceLat != null) ? toleranceLat : 0;
|
||||||
|
|
||||||
var toleranceBounds =
|
var toleranceBounds =
|
||||||
new OpenLayers.Bounds(this.bounds.left - dX,
|
new OpenLayers.Bounds(this.bounds.left - dX,
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ OpenLayers.Geometry.LineString.prototype =
|
|||||||
* @param {Array(OpenLayers.Geometry.Point)} points
|
* @param {Array(OpenLayers.Geometry.Point)} points
|
||||||
*/
|
*/
|
||||||
initialize: function(points) {
|
initialize: function(points) {
|
||||||
OpenLayers.Geometry.Curve.prototype.initialize.apply(this,
|
OpenLayers.Geometry.Curve.prototype.initialize.apply(this,
|
||||||
arguments);
|
arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ OpenLayers.Geometry.MultiLineString.prototype =
|
|||||||
* @param {Array(OpenLayers.Geometry.LineString)} components
|
* @param {Array(OpenLayers.Geometry.LineString)} components
|
||||||
*/
|
*/
|
||||||
initialize: function(components) {
|
initialize: function(components) {
|
||||||
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
||||||
arguments);
|
arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ OpenLayers.Geometry.MultiPoint.prototype =
|
|||||||
* @param {Array(OpenLayers.Geometry.Point)} components
|
* @param {Array(OpenLayers.Geometry.Point)} components
|
||||||
*/
|
*/
|
||||||
initialize: function(components) {
|
initialize: function(components) {
|
||||||
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
||||||
arguments);
|
arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ OpenLayers.Geometry.MultiPolygon.prototype =
|
|||||||
* @param {Array(OpenLayers.Geometry.Polygon)} components
|
* @param {Array(OpenLayers.Geometry.Polygon)} components
|
||||||
*/
|
*/
|
||||||
initialize: function(components) {
|
initialize: function(components) {
|
||||||
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
||||||
arguments);
|
arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ OpenLayers.Geometry.Point.prototype =
|
|||||||
* @param {float} y
|
* @param {float} y
|
||||||
*/
|
*/
|
||||||
initialize: function(x, y) {
|
initialize: function(x, y) {
|
||||||
OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
|
OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
|
||||||
OpenLayers.LonLat.prototype.initialize.apply(this, arguments);
|
OpenLayers.LonLat.prototype.initialize.apply(this, arguments);
|
||||||
|
|
||||||
this.x = this.lon;
|
this.x = this.lon;
|
||||||
this.y = this.lat;
|
this.y = this.lat;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,8 +61,8 @@ OpenLayers.Geometry.Point.prototype =
|
|||||||
* @param {float} x
|
* @param {float} x
|
||||||
*/
|
*/
|
||||||
setX: function(x) {
|
setX: function(x) {
|
||||||
this.lon = x;
|
this.lon = x;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,22 +71,22 @@ OpenLayers.Geometry.Point.prototype =
|
|||||||
* @param {float} y
|
* @param {float} y
|
||||||
*/
|
*/
|
||||||
setY: function(y) {
|
setY: function(y) {
|
||||||
this.lat = y;
|
this.lat = y;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type float
|
* @type float
|
||||||
*/
|
*/
|
||||||
getX: function() {
|
getX: function() {
|
||||||
return this.lon;
|
return this.lon;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type float
|
* @type float
|
||||||
*/
|
*/
|
||||||
getY: function() {
|
getY: function() {
|
||||||
return this.lat;
|
return this.lat;
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Create a new Bounds based on the lon/lat
|
/** Create a new Bounds based on the lon/lat
|
||||||
@@ -117,7 +117,7 @@ OpenLayers.Geometry.Point.prototype =
|
|||||||
* @type String
|
* @type String
|
||||||
*/
|
*/
|
||||||
toString: function() {
|
toString: function() {
|
||||||
return this.toShortString();
|
return this.toShortString();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ OpenLayers.Geometry.Polygon.prototype =
|
|||||||
* @param {Array(OpenLayers.Geometry.LinearRing)}
|
* @param {Array(OpenLayers.Geometry.LinearRing)}
|
||||||
*/
|
*/
|
||||||
initialize: function(components) {
|
initialize: function(components) {
|
||||||
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
||||||
arguments);
|
arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ OpenLayers.Layer.GML.prototype =
|
|||||||
*/
|
*/
|
||||||
moveTo:function(bounds, zoomChanged, minor) {
|
moveTo:function(bounds, zoomChanged, minor) {
|
||||||
OpenLayers.Layer.Vector.prototype.moveTo.apply(this, arguments);
|
OpenLayers.Layer.Vector.prototype.moveTo.apply(this, arguments);
|
||||||
// Wait until initialisation is complete before loading GML
|
// Wait until initialisation is complete before loading GML
|
||||||
// otherwise we can get a race condition where the root HTML DOM is
|
// otherwise we can get a race condition where the root HTML DOM is
|
||||||
// loaded after the GML is paited.
|
// loaded after the GML is paited.
|
||||||
// See http://trac.openlayers.org/ticket/404
|
// See http://trac.openlayers.org/ticket/404
|
||||||
if(this.visibility && !this.loaded){
|
if(this.visibility && !this.loaded){
|
||||||
this.loadGML();
|
this.loadGML();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ OpenLayers.Layer.Image.prototype =
|
|||||||
// If nothing to do with resolutions has been set, assume a single
|
// If nothing to do with resolutions has been set, assume a single
|
||||||
// resolution determined by extent/size
|
// resolution determined by extent/size
|
||||||
if( this.options.maxResolution == null ) {
|
if( this.options.maxResolution == null ) {
|
||||||
this.options.maxResolution = this.extent.getWidth() / this.size.w;
|
this.options.maxResolution = this.extent.getWidth() / this.size.w;
|
||||||
}
|
}
|
||||||
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
OpenLayers.Layer.prototype.setMap.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -43,14 +43,14 @@ OpenLayers.Layer.MapServer.prototype =
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} obj
|
* @param {Object} obj
|
||||||
*
|
*
|
||||||
* @returns A clone of this OpenLayers.Layer.MapServer
|
* @returns A clone of this OpenLayers.Layer.MapServer
|
||||||
* @type OpenLayers.Layer.MapServer
|
* @type OpenLayers.Layer.MapServer
|
||||||
*/
|
*/
|
||||||
clone: function (obj) {
|
clone: function (obj) {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
obj = new OpenLayers.Layer.MapServer(this.name,
|
obj = new OpenLayers.Layer.MapServer(this.name,
|
||||||
this.url,
|
this.url,
|
||||||
this.params,
|
this.params,
|
||||||
|
|||||||
@@ -209,10 +209,10 @@ OpenLayers.Popup.prototype = {
|
|||||||
this.div.style.width = this.size.w + "px";
|
this.div.style.width = this.size.w + "px";
|
||||||
this.div.style.height = this.size.h + "px";
|
this.div.style.height = this.size.h + "px";
|
||||||
}
|
}
|
||||||
if (this.contentDiv != null){
|
if (this.contentDiv != null){
|
||||||
this.contentDiv.style.width = this.size.w + "px";
|
this.contentDiv.style.width = this.size.w + "px";
|
||||||
this.contentDiv.style.height = this.size.h + "px";
|
this.contentDiv.style.height = this.size.h + "px";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -84,11 +84,11 @@
|
|||||||
|
|
||||||
t.eq(contentDiv.className, "olPopupContent", "correct content div className");
|
t.eq(contentDiv.className, "olPopupContent", "correct content div className");
|
||||||
t.eq(contentDiv.id, "chicken_contentDiv", "correct content div id");
|
t.eq(contentDiv.id, "chicken_contentDiv", "correct content div id");
|
||||||
t.eq(contentDiv.style.width, "500px", "correct content div width");
|
t.eq(contentDiv.style.width, "500px", "correct content div width");
|
||||||
t.eq(contentDiv.style.height, "400px", "correct content div height");
|
t.eq(contentDiv.style.height, "400px", "correct content div height");
|
||||||
t.eq(contentDiv.style.position, "relative", "correct content div position");
|
t.eq(contentDiv.style.position, "relative", "correct content div position");
|
||||||
t.eq(contentDiv.style.overflow, "hidden", "correct content div overflow");
|
t.eq(contentDiv.style.overflow, "hidden", "correct content div overflow");
|
||||||
t.eq(contentDiv.innerHTML, content, "correct content div content");
|
t.eq(contentDiv.innerHTML, content, "correct content div content");
|
||||||
|
|
||||||
var bColor = popup.div.style.backgroundColor;
|
var bColor = popup.div.style.backgroundColor;
|
||||||
var goodColor = ( (bColor == color) || (bColor == hexColor));
|
var goodColor = ( (bColor == color) || (bColor == hexColor));
|
||||||
|
|||||||
Reference in New Issue
Block a user