Pullup trunk for RC4.

Fixes:
#694    Safari 1.3.2 doesn't work with OL 2.4
#695    GeoRSS serializer is broken
#696    events need to fall through the overview map extent rectangle
#697    Vector example to show how to use styles
#698    add close box option to AnchoredBubble
#701    SVG render does not always clear features when map extent changes
#703    OpenLayers.Layer.Vector do not properly destroy its features
#706    Full CSS support fails when Control.OverviewMap is loaded
#708    change WKT format to deal in features instead of geometries
#710    Install instructions unclear
#711    OpenLayers.Layer.Image requires OpenLayers.Tile.Image
#715    layer.js needs sanity check
#718    WMS.Untiled Clone doesn't work
#719    SVG renderer does not always redraw LineStrings and Polygons
#720    remove console.log() from OpenLayers.Format.WKT


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.4@3177 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-05-24 14:43:07 +00:00
parent 3c6cd6f559
commit d8b8f44803
27 changed files with 352 additions and 194 deletions

View File

@@ -1,6 +1,7 @@
OpenLayers contributors: OpenLayers contributors:
Howard Butler Howard Butler
Bertil Chaupis Bertil Chaupis
John Cole
Jeff Dege Jeff Dege
Schuyler Erle Schuyler Erle
Christian López Espínola Christian López Espínola

View File

@@ -2,7 +2,7 @@
<head> <head>
<style type="text/css"> <style type="text/css">
#map { #map {
width: 512px; width: 45%;
height: 350px; height: 350px;
border: 1px solid gray; border: 1px solid gray;
} }
@@ -42,8 +42,8 @@
</head> </head>
<body onload="init()"> <body onload="init()">
<h1>OpenLayers Draw Point Example</h1> <h1>OpenLayers Draw Point Example</h1>
<div style="float:right"> <div style="float:right;width:50%">
<textarea id="gml" cols="80" rows="30"></textarea> <textarea id="gml" style="width:100%" rows="30"></textarea>
</div> </div>
<div id="map"></div> <div id="map"></div>
</body> </body>

View File

@@ -47,7 +47,7 @@
popup = new OpenLayers.Popup.Anchored("chicken", popup = new OpenLayers.Popup.Anchored("chicken",
new OpenLayers.LonLat(5,40), new OpenLayers.LonLat(5,40),
new OpenLayers.Size(200,200), new OpenLayers.Size(200,200),
"example popup"); "example popup", true);
map.addPopup(popup); map.addPopup(popup);
} }
@@ -69,8 +69,17 @@
} }
function mousedown(evt) { function mousedown(evt) {
// check to see if the popup was hidden by the close box
// if so, then destroy it before continuing
if (popup != null) {
if (!popup.visible()) {
markers.map.removePopup(popup);
popup.destroy();
popup = null;
}
}
if (popup == null) { if (popup == null) {
popup = feature.createPopup(); popup = feature.createPopup(true);
popup.setContentHTML("<a href='http://www.somethingconstructive.net' target='_blank'>click me</a>"); popup.setContentHTML("<a href='http://www.somethingconstructive.net' target='_blank'>click me</a>");
popup.setBackgroundColor("yellow"); popup.setBackgroundColor("yellow");
popup.setOpacity(0.7); popup.setOpacity(0.7);

View File

@@ -17,11 +17,23 @@
var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(layer); map.addLayer(layer);
var style_blue = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
style_blue.strokeColor = "blue";
style_blue.fillColor = "blue";
var style_green = {
strokeColor: "#00FF00",
strokeOpacity: 1,
strokeWidth: 3,
pointRadius: 6,
pointerEvents: "visiblePainted"
};
var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry"); var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry");
// create a point feature // create a point feature
var point = new OpenLayers.Geometry.Point(-111.04, 45.68); var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
var pointFeature = new OpenLayers.Feature.Vector(point); var pointFeature = new OpenLayers.Feature.Vector(point,null,style_blue);
// create a line feature from a list of points // create a line feature from a list of points
var pointList = []; var pointList = [];
@@ -32,7 +44,7 @@
pointList.push(newPoint); pointList.push(newPoint);
} }
var lineFeature = new OpenLayers.Feature.Vector( var lineFeature = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LineString(pointList)); new OpenLayers.Geometry.LineString(pointList),null,style_green);
// create a polygon feature from a linear ring of points // create a polygon feature from a linear ring of points
var pointList = []; var pointList = [];
@@ -59,5 +71,9 @@
</head> </head>
<body onload="init()"> <body onload="init()">
<div id="map"></div> <div id="map"></div>
<p>This example shows drawing simple vector features -- point, line, polygon
in different styles, created 'manually', by constructing the entire style
object, via 'copy', extending the default style object, and by
inheriting the default style from the layer.</p>
</body> </body>
</html> </html>

View File

@@ -78,7 +78,7 @@
} }
function displayWKT(feature) { function displayWKT(feature) {
var str = wkt.write(feature.geometry); var str = wkt.write(feature);
// not a good idea in general, just for this demo // not a good idea in general, just for this demo
str = str.replace(/,/g, ', '); str = str.replace(/,/g, ', ');
document.getElementById('info').innerHTML = str; document.getElementById('info').innerHTML = str;
@@ -86,19 +86,18 @@
function parseWKT() { function parseWKT() {
var element = document.getElementById('wkt'); var element = document.getElementById('wkt');
var collection = wkt.read(element.value); var features = wkt.read(element.value);
var bounds; var bounds;
if(collection) { if(features) {
if(collection.constructor != Array) { if(features.constructor != Array) {
collection = [collection]; features = [features];
} }
var features = []; for(var i=0; i<features.length; ++i) {
for(var i=0; i<collection.length; ++i) {
features.push(new OpenLayers.Feature.Vector(collection[i]));
if (!bounds) { if (!bounds) {
bounds = collection[i].getBounds(); bounds = features[i].geometry.getBounds();
} else {
bounds.extend(features[i].geometry.getBounds());
} }
bounds.extend(collection[i].getBounds());
} }
vectors.addFeatures(features); vectors.addFeatures(features);

View File

@@ -31,8 +31,9 @@ OpenLayers.Class = {
// so the util.extend() doesnt copy it over. we do it manually. // so the util.extend() doesnt copy it over. we do it manually.
// //
// to be revisited in 3.0 // to be revisited in 3.0
// //
if (arguments[i].hasOwnProperty('toString')) { if((arguments[i].hasOwnProperty && arguments[i].hasOwnProperty('toString')) ||
(!arguments[i].hasOwnProperty && arguments[i].toString)) {
proto.toString = arguments[i].toString; proto.toString = arguments[i].toString;
} }
} }

View File

@@ -180,7 +180,8 @@ OpenLayers.Control.OverviewMap.prototype =
this.elementEvents.register('dblclick', this, function(e) { this.elementEvents.register('dblclick', this, function(e) {
OpenLayers.Event.stop(e); OpenLayers.Event.stop(e);
}); });
this.rectEvents = new OpenLayers.Events(this, this.extentRectangle); this.rectEvents = new OpenLayers.Events(this, this.extentRectangle,
null, true);
this.rectEvents.register('mouseout', this, this.rectMouseOut); this.rectEvents.register('mouseout', this, this.rectMouseOut);
this.rectEvents.register('mousedown', this, this.rectMouseDown); this.rectEvents.register('mousedown', this, this.rectMouseDown);
this.rectEvents.register('mousemove', this, this.rectMouseMove); this.rectEvents.register('mousemove', this, this.rectMouseMove);

View File

@@ -121,6 +121,7 @@ OpenLayers.Feature.prototype= {
}, },
/** /**
* @param {Boolean} closeBox create popup with closebox or not
* @returns A Popup Object created from the 'lonlat', 'popupSize', * @returns A Popup Object created from the 'lonlat', 'popupSize',
* and 'popupContentHTML' properties set in this.data. It uses * and 'popupContentHTML' properties set in this.data. It uses
* this.marker.icon as default anchor. * this.marker.icon as default anchor.
@@ -132,7 +133,7 @@ OpenLayers.Feature.prototype= {
* *
* @type OpenLayers.Popup.AnchoredBubble * @type OpenLayers.Popup.AnchoredBubble
*/ */
createPopup: function() { createPopup: function(closeBox) {
if (this.lonlat != null) { if (this.lonlat != null) {
@@ -143,7 +144,7 @@ OpenLayers.Feature.prototype= {
this.lonlat, this.lonlat,
this.data.popupSize, this.data.popupSize,
this.data.popupContentHTML, this.data.popupContentHTML,
anchor); anchor, closeBox);
} }
return this.popup; return this.popup;
}, },

View File

@@ -97,10 +97,10 @@ OpenLayers.Format.GeoRSS.prototype =
var path = ""; var path = "";
if (points) { if (points) {
for (var i = 0; i < points.length; i++) { for (var i = 0; i < points.length; i++) {
path += points[i].lat + " " + points[i].lon + " "; path += points[i].y + " " + points[i].x + " ";
} }
} else { } else {
path += geometry.lat + " " + geometry.lon + " "; path += geometry.y + " " + geometry.x + " ";
} }
return document.createTextNode(path); return document.createTextNode(path);
}, },

View File

@@ -25,38 +25,41 @@ OpenLayers.Format.WKT.prototype =
}, },
/** /**
* Deserialize a WKT string and return an OpenLayers.Geometry or an array * Deserialize a WKT string and return an OpenLayers.Feature.Vector or an
* of OpenLayers.Geometry. Supports WKT for POINT, MULTIPOINT, LINESTRING, * array of OpenLayers.Feature.Vector. Supports WKT for POINT, MULTIPOINT,
* MULTILINESTRING, POLYGON, MULTIPOLYGON, and GEOMETRYCOLLECTION. * LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and
* GEOMETRYCOLLECTION.
* @param {String} wkt A WKT string * @param {String} wkt A WKT string
* @returns {OpenLayers.Geometry|Array} A geometry or array of geometries * @returns {OpenLayers.Feature.Vector|Array} A feature or array of
* for GEOMETRYCOLLECTION WKT. * features for
* GEOMETRYCOLLECTION WKT.
*/ */
read: function(wkt) { read: function(wkt) {
var geometry, type, str; var features, type, str;
var matches = this.regExes.typeStr.exec(wkt); var matches = this.regExes.typeStr.exec(wkt);
if(matches) { if(matches) {
type = matches[1].toLowerCase(); type = matches[1].toLowerCase();
str = matches[2]; str = matches[2];
if(this.parse[type]) { if(this.parse[type]) {
geometry = this.parse[type].apply(this, [str]); features = this.parse[type].apply(this, [str]);
} }
} }
return geometry; return features;
}, },
/** /**
* Serialize a geometry or array of geometries into a WKT string. * Serialize a feature or array of features into a WKT string.
* @param {OpenLayers.Geometry|Array} geom A geometry or array of geometries * @param {OpenLayers.Feature.Vector|Array} features A feature or array of
* features
* @returns {String} The WKT string representation of the input geometries * @returns {String} The WKT string representation of the input geometries
*/ */
write: function(geom) { write: function(features) {
var collection, geometry, type, data, isCollection; var collection, geometry, type, data, isCollection;
if(geom.constructor == Array) { if(features.constructor == Array) {
collection = geom; collection = features;
isCollection = true; isCollection = true;
} else { } else {
collection = [geom]; collection = [features];
isCollection = false; isCollection = false;
} }
var pieces = []; var pieces = [];
@@ -67,7 +70,7 @@ OpenLayers.Format.WKT.prototype =
if(isCollection && i>0) { if(isCollection && i>0) {
pieces.push(','); pieces.push(',');
} }
geometry = collection[i]; geometry = collection[i].geometry;
type = geometry.CLASS_NAME.split('.')[2].toLowerCase(); type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
if(!this.extract[type]) { if(!this.extract[type]) {
return null; return null;
@@ -178,47 +181,57 @@ OpenLayers.Format.WKT.prototype =
*/ */
parse: { parse: {
/** /**
* Return point geometry given a point WKT fragment. * Return point feature given a point WKT fragment.
* @param {String} str A WKT fragment representing the point * @param {String} str A WKT fragment representing the point
* @returns {OpenLayers.Geometry.Point} A point geometry * @returns {OpenLayers.Feature.Vector} A point feature
* @private
*/ */
'point': function(str) { 'point': function(str) {
var coords = str.trim().split(this.regExes.spaces); var coords = str.trim().split(this.regExes.spaces);
return new OpenLayers.Geometry.Point(coords[0], coords[1]); return new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(coords[0], coords[1])
);
}, },
/** /**
* Return a multipoint geometry given a multipoint WKT fragment. * Return a multipoint feature given a multipoint WKT fragment.
* @param {String} A WKT fragment representing the multipoint * @param {String} A WKT fragment representing the multipoint
* @returns {OpenLayers.Geometry.MultiPoint} A multipoint geometry * @returns {OpenLayers.Feature.Vector} A multipoint feature
* @private
*/ */
'multipoint': function(str) { 'multipoint': function(str) {
var points = str.trim().split(','); var points = str.trim().split(',');
var components = []; var components = [];
for(var i=0; i<points.length; ++i) { for(var i=0; i<points.length; ++i) {
components.push(this.parse.point.apply(this, [points[i]])); components.push(this.parse.point.apply(this, [points[i]]).geometry);
} }
return new OpenLayers.Geometry.MultiPoint(components); return new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.MultiPoint(components)
);
}, },
/** /**
* Return a linestring geometry given a linestring WKT fragment. * Return a linestring feature given a linestring WKT fragment.
* @param {String} A WKT fragment representing the linestring * @param {String} A WKT fragment representing the linestring
* @returns {OpenLayers.Geometry.LineString} A linestring geometry * @returns {OpenLayers.Feature.Vector} A linestring feature
* @private
*/ */
'linestring': function(str) { 'linestring': function(str) {
var points = str.trim().split(','); var points = str.trim().split(',');
var components = []; var components = [];
for(var i=0; i<points.length; ++i) { for(var i=0; i<points.length; ++i) {
components.push(this.parse.point.apply(this, [points[i]])); components.push(this.parse.point.apply(this, [points[i]]).geometry);
} }
return new OpenLayers.Geometry.LineString(components); return new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LineString(components)
);
}, },
/** /**
* Return a multilinestring geometry given a multilinestring WKT fragment. * Return a multilinestring feature given a multilinestring WKT fragment.
* @param {String} A WKT fragment representing the multilinestring * @param {String} A WKT fragment representing the multilinestring
* @returns {OpenLayers.Geometry.LineString} A multilinestring geometry * @returns {OpenLayers.Feature.Vector} A multilinestring feature
* @private
*/ */
'multilinestring': function(str) { 'multilinestring': function(str) {
var line; var line;
@@ -226,15 +239,18 @@ OpenLayers.Format.WKT.prototype =
var components = []; var components = [];
for(var i=0; i<lines.length; ++i) { for(var i=0; i<lines.length; ++i) {
line = lines[i].replace(this.regExes.trimParens, '$1'); line = lines[i].replace(this.regExes.trimParens, '$1');
components.push(this.parse.linestring.apply(this, [line])); components.push(this.parse.linestring.apply(this, [line]).geometry);
} }
return new OpenLayers.Geometry.MultiLineString(components); return new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.MultiLineString(components)
);
}, },
/** /**
* Return a polygon geometry given a polygon WKT fragment. * Return a polygon feature given a polygon WKT fragment.
* @param {String} A WKT fragment representing the polygon * @param {String} A WKT fragment representing the polygon
* @returns {OpenLayers.Geometry.Polygon} A polygon geometry * @returns {OpenLayers.Feature.Vector} A polygon feature
* @private
*/ */
'polygon': function(str) { 'polygon': function(str) {
var ring, linestring, linearring; var ring, linestring, linearring;
@@ -242,17 +258,20 @@ OpenLayers.Format.WKT.prototype =
var components = []; var components = [];
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]); 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.Geometry.Polygon(components); return new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Polygon(components)
);
}, },
/** /**
* Return a multipolygon geometry given a multipolygon WKT fragment. * Return a multipolygon feature given a multipolygon WKT fragment.
* @param {String} A WKT fragment representing the multipolygon * @param {String} A WKT fragment representing the multipolygon
* @returns {OpenLayers.Geometry.MultiPolygon} A multipolygon geometry * @returns {OpenLayers.Feature.Vector} A multipolygon feature
* @private
*/ */
'multipolygon': function(str) { 'multipolygon': function(str) {
var polygon; var polygon;
@@ -260,15 +279,18 @@ OpenLayers.Format.WKT.prototype =
var components = []; var components = [];
for(var i=0; i<polygons.length; ++i) { for(var i=0; i<polygons.length; ++i) {
polygon = polygons[i].replace(this.regExes.trimParens, '$1'); polygon = polygons[i].replace(this.regExes.trimParens, '$1');
components.push(this.parse.polygon.apply(this, [polygon])); components.push(this.parse.polygon.apply(this, [polygon]).geometry);
} }
return new OpenLayers.Geometry.MultiPolygon(components); return new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.MultiPolygon(components)
);
}, },
/** /**
* Return an array of geometries given a geometrycollection WKT fragment. * Return an array of features given a geometrycollection WKT fragment.
* @param {String} A WKT fragment representing the geometrycollection * @param {String} A WKT fragment representing the geometrycollection
* @returns {Array} An array of OpenLayers.Geometry * @returns {Array} An array of OpenLayers.Feature.Vector
* @private
*/ */
'geometrycollection': function(str) { 'geometrycollection': function(str) {
// separate components of the collection with | // separate components of the collection with |

View File

@@ -5,6 +5,7 @@
/** /**
* @class * @class
* @requires OpenLayers/Format/WKT.js * @requires OpenLayers/Format/WKT.js
* @requires OpenLayers/Feature/Vector.js
*/ */
OpenLayers.Geometry = OpenLayers.Class.create(); OpenLayers.Geometry = OpenLayers.Class.create();
OpenLayers.Geometry.prototype = { OpenLayers.Geometry.prototype = {
@@ -150,7 +151,9 @@ OpenLayers.Geometry.prototype = {
* @type String * @type String
*/ */
toString: function() { toString: function() {
return OpenLayers.Format.WKT.prototype.write(this); return OpenLayers.Format.WKT.prototype.write(
new OpenLayers.Feature.Vector(this)
);
}, },
/** @final @type String */ /** @final @type String */

View File

@@ -608,13 +608,15 @@ OpenLayers.Layer.prototype = {
if (viewPortPx != null) { if (viewPortPx != null) {
var size = this.map.getSize(); var size = this.map.getSize();
var center = this.map.getCenter(); var center = this.map.getCenter();
var res = this.map.getResolution(); if (center) {
var res = this.map.getResolution();
var delta_x = viewPortPx.x - (size.w / 2); var delta_x = viewPortPx.x - (size.w / 2);
var delta_y = viewPortPx.y - (size.h / 2); var delta_y = viewPortPx.y - (size.h / 2);
lonlat = new OpenLayers.LonLat(center.lon + delta_x * res , lonlat = new OpenLayers.LonLat(center.lon + delta_x * res ,
center.lat - delta_y * res); center.lat - delta_y * res);
} // else { DEBUG STATEMENT }
} }
return lonlat; return lonlat;
}, },

View File

@@ -11,6 +11,7 @@
* @class * @class
* *
* @requires OpenLayers/Layer.js * @requires OpenLayers/Layer.js
* @requires OpenLayers/Tile/Image.js
*/ */
OpenLayers.Layer.Image = OpenLayers.Class.create(); OpenLayers.Layer.Image = OpenLayers.Class.create();
OpenLayers.Layer.Image.prototype = OpenLayers.Layer.Image.prototype =

View File

@@ -97,8 +97,7 @@ OpenLayers.Layer.Vector.prototype =
destroy: function() { destroy: function() {
OpenLayers.Layer.prototype.destroy.apply(this, arguments); OpenLayers.Layer.prototype.destroy.apply(this, arguments);
// HACK HACK -- I believe we should be iterating and this.destroyFeatures();
// calling feature[i].destroy() here.
this.features = null; this.features = null;
this.selectedFeatures = null; this.selectedFeatures = null;
if (this.renderer) { if (this.renderer) {
@@ -247,8 +246,10 @@ OpenLayers.Layer.Vector.prototype =
var feature = features[i]; var feature = features[i];
this.features = OpenLayers.Util.removeItem(this.features, feature); this.features = OpenLayers.Util.removeItem(this.features, feature);
this.renderer.eraseGeometry(feature.geometry); if (feature.geometry) {
this.renderer.eraseGeometry(feature.geometry);
}
//in the case that this feature is one of the selected features, //in the case that this feature is one of the selected features,
// remove it from that array as well. // remove it from that array as well.
if (OpenLayers.Util.indexOf(this.selectedFeatures, feature) != -1){ if (OpenLayers.Util.indexOf(this.selectedFeatures, feature) != -1){

View File

@@ -92,7 +92,9 @@ OpenLayers.Layer.WMS.Untiled.prototype =
obj = OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this, [obj]); obj = OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this, [obj]);
// copy/set any non-init, non-simple values here // copy/set any non-init, non-simple values here
obj.tile = null;
return obj; return obj;
}, },

View File

@@ -199,11 +199,25 @@ OpenLayers.Map.prototype = {
// only append link stylesheet if the theme property is set // only append link stylesheet if the theme property is set
if(this.theme) { if(this.theme) {
var cssNode = document.createElement('link'); // check existing links for equivalent url
cssNode.setAttribute('rel', 'stylesheet'); var addNode = true;
cssNode.setAttribute('type', 'text/css'); var nodes = document.getElementsByTagName('link');
cssNode.setAttribute('href', this.theme); for(var i=0; i<nodes.length; ++i) {
document.getElementsByTagName('head')[0].appendChild(cssNode); if(OpenLayers.Util.isEquivalentUrl(nodes.item(i).href,
this.theme)) {
addNode = false;
break;
}
}
// only add a new node if one with an equivalent url hasn't already
// been added
if(addNode) {
var cssNode = document.createElement('link');
cssNode.setAttribute('rel', 'stylesheet');
cssNode.setAttribute('type', 'text/css');
cssNode.setAttribute('href', this.theme);
document.getElementsByTagName('head')[0].appendChild(cssNode);
}
} }
this.layers = []; this.layers = [];

View File

@@ -45,6 +45,9 @@ OpenLayers.Popup.prototype = {
/** @type DOMElement */ /** @type DOMElement */
contentDiv:null, contentDiv:null,
/** @type DOMElement */
groupDiv:null,
/** @type int */ /** @type int */
padding: 5, padding: 5,
@@ -84,13 +87,18 @@ OpenLayers.Popup.prototype = {
this.div = OpenLayers.Util.createDiv(this.id, null, null, this.div = OpenLayers.Util.createDiv(this.id, null, null,
null, null, null, "hidden"); null, null, null, "hidden");
this.div.className = 'olPopup'; this.div.className = 'olPopup';
this.groupDiv = OpenLayers.Util.createDiv(null, null, null,
null, "relative", null,
"hidden");
var id = this.div.id + "_contentDiv"; var id = this.div.id + "_contentDiv";
this.contentDiv = OpenLayers.Util.createDiv(id, null, this.size.clone(), this.contentDiv = OpenLayers.Util.createDiv(id, null, this.size.clone(),
null, "relative", null, null, "relative", null,
"hidden"); "hidden");
this.contentDiv.className = 'olPopupContent'; this.contentDiv.className = 'olPopupContent';
this.div.appendChild(this.contentDiv); this.groupDiv.appendChild(this.contentDiv);
this.div.appendChild(this.groupDiv);
if (closeBox == true) { if (closeBox == true) {
// close icon // close icon
@@ -102,7 +110,7 @@ OpenLayers.Popup.prototype = {
img); img);
closeImg.style.right = this.padding + "px"; closeImg.style.right = this.padding + "px";
closeImg.style.top = this.padding + "px"; closeImg.style.top = this.padding + "px";
this.div.appendChild(closeImg); this.groupDiv.appendChild(closeImg);
var closePopup = function(e) { var closePopup = function(e) {
this.hide(); this.hide();

View File

@@ -139,7 +139,7 @@ OpenLayers.Popup.AnchoredBubble.prototype =
if (firstTime) { if (firstTime) {
OpenLayers.Rico.Corner.round(this.div, options); OpenLayers.Rico.Corner.round(this.div, options);
} else { } else {
OpenLayers.Rico.Corner.reRound(this.contentDiv, options); OpenLayers.Rico.Corner.reRound(this.groupDiv, options);
//set the popup color and opacity //set the popup color and opacity
this.setBackgroundColor(); this.setBackgroundColor();
this.setOpacity(); this.setOpacity();

View File

@@ -282,9 +282,7 @@ OpenLayers.Renderer.SVG.prototype =
node.setAttributeNS(null, "cy", y); node.setAttributeNS(null, "cy", y);
node.setAttributeNS(null, "r", radius); node.setAttributeNS(null, "r", radius);
} else { } else {
node.setAttributeNS(null, "cx", ""); this.root.removeChild(node);
node.setAttributeNS(null, "cy", "");
node.setAttributeNS(null, "r", 0);
} }
}, },
@@ -434,8 +432,9 @@ OpenLayers.Renderer.SVG.prototype =
var strings = []; var strings = [];
for(var i = 0; i < components.length; i++) { for(var i = 0; i < components.length; i++) {
var component = this.getShortString(components[i]); var component = this.getShortString(components[i]);
if (!component) { return false; } if (component) {
strings.push(component); strings.push(component);
}
} }
return strings.join(","); return strings.join(",");
}, },

View File

@@ -20,17 +20,30 @@ Installing OpenLayers
--------------------- ---------------------
You can use OpenLayers as-is by copying build/OpenLayers.js and the You can use OpenLayers as-is by copying build/OpenLayers.js and the
entire lib/ directory up to your webserver, putting them in the same entire theme/ and img/ directories up to your webserver, putting them
directory. To include the OpenLayers library in your web page, use: in the same directory. The files can be in subdirectories on your website, or right in the root of the site, as in these examples. To include the OpenLayers library in your web page from the root of the site, use:
<script type="text/javascript" src="OpenLayers.js" /> <script type="text/javascript" src="/OpenLayers.js" />
As an example, using bash (with the release files in ~/openlayers ):
$ cd /var/www/html
$ cp ~/openlayers/build/OpenLayers.js ./
$ cp -R ~/openlayers/theme ./
$ cp -R ~/openlayers/img ./
If you want to use the multiple-file version of OpenLayers (for, say, If you want to use the multiple-file version of OpenLayers (for, say,
debugging or development purposes), copy the lib/ directory up to your debugging or development purposes), copy the lib/ directory up to your
webserver in the same directory you put the img/ folder. Then add webserver in the same directory you put the img/ folder. Then add
the following to your web page instead: the following to your web page instead:
<script type="text/javascript" src="lib/OpenLayers.js" /> <script type="text/javascript" src="/lib/OpenLayers.js" />
As an example, using bash (with the release files in ~/openlayers ):
$ cd /var/www/html
$ cp -R ~/openlayers/lib ./
$ cp -R ~/openlayers/theme ./
$ cp -R ~/openlayers/img ./
------------------------------------ ------------------------------------
Using OpenLayers in Your Own Website Using OpenLayers in Your Own Website

View File

@@ -0,0 +1,34 @@
<html>
<head>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
function test_Format_GeoRSS_constructor(t) {
t.plan(4);
var options = {'foo': 'bar'};
var format = new OpenLayers.Format.GeoRSS(options);
t.ok(format instanceof OpenLayers.Format.GeoRSS,
"new OpenLayers.Format.GeoRSS returns object" );
t.eq(format.foo, "bar", "constructor sets options correctly");
t.eq(typeof format.read, "function", "format has a read function");
t.eq(typeof format.write, "function", "format has a write function");
}
function test_Format_GeoRSS_serializeline(t) {
t.plan(1);
var parser = new OpenLayers.Format.GeoRSS();
var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
var point2 = new OpenLayers.Geometry.Point(-112.04, 45.68);
var l = new OpenLayers.Geometry.LineString([point, point2]);
var f = new OpenLayers.Feature.Vector(l);
var data = parser.write([f]);
t.eq(data.firstChild.childNodes[2].firstChild.nodeValue, '45.68 -111.04 45.68 -112.04 ', 'GeoRSS serializes a line correctly');
}
// -->
</script>
</head>
<body>
</body>
</html>

View File

@@ -5,37 +5,53 @@
var points = []; var points = [];
for(var i=0; i<12; ++i) { for(var i=0; i<12; ++i) {
points.push(new OpenLayers.Geometry.Point(Math.random() * 100, points.push(new OpenLayers.Feature.Vector(
Math.random() * 100)); new OpenLayers.Geometry.Point(Math.random() * 100,
Math.random() * 100))
);
} }
var multipoint = new OpenLayers.Geometry.MultiPoint([ var multipoint = new OpenLayers.Feature.Vector(
points[0], points[1], points[2] new OpenLayers.Geometry.MultiPoint([
]); points[0].geometry, points[1].geometry, points[2].geometry
])
);
var linestrings = [ var linestrings = [
new OpenLayers.Geometry.LineString([points[0], points[1], points[2]]), new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LineString([points[3], points[4], points[5]]) new OpenLayers.Geometry.LineString([points[0].geometry, points[1].geometry, points[2].geometry])
),
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LineString([points[3].geometry, points[4].geometry, points[5].geometry])
)
]; ];
var multilinestring = new OpenLayers.Geometry.MultiLineString([ var multilinestring = new OpenLayers.Feature.Vector(
linestrings[0], linestrings[1] new OpenLayers.Geometry.MultiLineString([
]); linestrings[0].geometry, linestrings[1].geometry
])
);
var rings = [ var rings = [
new OpenLayers.Geometry.LinearRing([points[0], points[1], points[2]]), new OpenLayers.Geometry.LinearRing([points[0].geometry, points[1].geometry, points[2].geometry]),
new OpenLayers.Geometry.LinearRing([points[3], points[4], points[5]]), new OpenLayers.Geometry.LinearRing([points[3].geometry, points[4].geometry, points[5].geometry]),
new OpenLayers.Geometry.LinearRing([points[6], points[7], points[8]]), new OpenLayers.Geometry.LinearRing([points[6].geometry, points[7].geometry, points[8].geometry]),
new OpenLayers.Geometry.LinearRing([points[9], points[10], points[11]]) new OpenLayers.Geometry.LinearRing([points[9].geometry, points[10].geometry, points[11].geometry])
]; ];
var polygons = [ var polygons = [
new OpenLayers.Geometry.Polygon([rings[0], rings[1]]), new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Polygon([rings[2], rings[3]]) new OpenLayers.Geometry.Polygon([rings[0], rings[1]])
),
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Polygon([rings[2], rings[3]])
)
]; ];
var multipolygon = new OpenLayers.Geometry.MultiPolygon([ var multipolygon = new OpenLayers.Feature.Vector(
polygons[0], polygons[1] new OpenLayers.Geometry.MultiPolygon([
]); polygons[0].geometry, polygons[1].geometry
])
);
var collection = [points[0], linestrings[0]]; var collection = [points[0], linestrings[0]];
@@ -53,74 +69,74 @@
function test_Format_WKT_write(t) { function test_Format_WKT_write(t) {
t.plan(7); t.plan(7);
var format = new OpenLayers.Format.WKT(); var format = new OpenLayers.Format.WKT();
// test a point // test a point
t.eq(format.write(points[0]), t.eq(format.write(points[0]),
"POINT(" + points[0].x + " " + points[0].y + ")", "POINT(" + points[0].geometry.x + " " + points[0].geometry.y + ")",
"format correctly writes Point WKT"); "format correctly writes Point WKT");
// test a multipoint // test a multipoint
t.eq(format.write(multipoint), t.eq(format.write(multipoint),
"MULTIPOINT(" + points[0].x + " " + points[0].y + "," + "MULTIPOINT(" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].x + " " + points[1].y + "," + points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].x + " " + points[2].y + ")", points[2].geometry.x + " " + points[2].geometry.y + ")",
"format correctly writes MultiPoint WKT"); "format correctly writes MultiPoint WKT");
// test a linestring // test a linestring
t.eq(format.write(linestrings[0]), t.eq(format.write(linestrings[0]),
"LINESTRING(" + points[0].x + " " + points[0].y + "," + "LINESTRING(" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].x + " " + points[1].y + "," + points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].x + " " + points[2].y + ")", points[2].geometry.x + " " + points[2].geometry.y + ")",
"format correctly writes LineString WKT"); "format correctly writes LineString WKT");
// test a multilinestring // test a multilinestring
t.eq(format.write(multilinestring), t.eq(format.write(multilinestring),
"MULTILINESTRING((" + points[0].x + " " + points[0].y + "," + "MULTILINESTRING((" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].x + " " + points[1].y + "," + points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].x + " " + points[2].y + ")," + points[2].geometry.x + " " + points[2].geometry.y + ")," +
"(" + points[3].x + " " + points[3].y + "," + "(" + points[3].geometry.x + " " + points[3].geometry.y + "," +
points[4].x + " " + points[4].y + "," + points[4].geometry.x + " " + points[4].geometry.y + "," +
points[5].x + " " + points[5].y + "))", points[5].geometry.x + " " + points[5].geometry.y + "))",
"format correctly writes MultiLineString WKT"); "format correctly writes MultiLineString WKT");
// test a polygon // test a polygon
t.eq(format.write(polygons[0]), t.eq(format.write(polygons[0]),
"POLYGON((" + points[0].x + " " + points[0].y + "," + "POLYGON((" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].x + " " + points[1].y + "," + points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].x + " " + points[2].y + "," + points[2].geometry.x + " " + points[2].geometry.y + "," +
points[0].x + " " + points[0].y + ")," + points[0].geometry.x + " " + points[0].geometry.y + ")," +
"(" + points[3].x + " " + points[3].y + "," + "(" + points[3].geometry.x + " " + points[3].geometry.y + "," +
points[4].x + " " + points[4].y + "," + points[4].geometry.x + " " + points[4].geometry.y + "," +
points[5].x + " " + points[5].y + "," + points[5].geometry.x + " " + points[5].geometry.y + "," +
points[3].x + " " + points[3].y + "))", points[3].geometry.x + " " + points[3].geometry.y + "))",
"format correctly writes Polygon WKT"); "format correctly writes Polygon WKT");
// test a multipolygon // test a multipolygon
t.eq(format.write(multipolygon), t.eq(format.write(multipolygon),
"MULTIPOLYGON(((" + points[0].x + " " + points[0].y + "," + "MULTIPOLYGON(((" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].x + " " + points[1].y + "," + points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].x + " " + points[2].y + "," + points[2].geometry.x + " " + points[2].geometry.y + "," +
points[0].x + " " + points[0].y + ")," + points[0].geometry.x + " " + points[0].geometry.y + ")," +
"(" + points[3].x + " " + points[3].y + "," + "(" + points[3].geometry.x + " " + points[3].geometry.y + "," +
points[4].x + " " + points[4].y + "," + points[4].geometry.x + " " + points[4].geometry.y + "," +
points[5].x + " " + points[5].y + "," + points[5].geometry.x + " " + points[5].geometry.y + "," +
points[3].x + " " + points[3].y + "))," + points[3].geometry.x + " " + points[3].geometry.y + "))," +
"((" + points[6].x + " " + points[6].y + "," + "((" + points[6].geometry.x + " " + points[6].geometry.y + "," +
points[7].x + " " + points[7].y + "," + points[7].geometry.x + " " + points[7].geometry.y + "," +
points[8].x + " " + points[8].y + "," + points[8].geometry.x + " " + points[8].geometry.y + "," +
points[6].x + " " + points[6].y + ")," + points[6].geometry.x + " " + points[6].geometry.y + ")," +
"(" + points[9].x + " " + points[9].y + "," + "(" + points[9].geometry.x + " " + points[9].geometry.y + "," +
points[10].x + " " + points[10].y + "," + points[10].geometry.x + " " + points[10].geometry.y + "," +
points[11].x + " " + points[11].y + "," + points[11].geometry.x + " " + points[11].geometry.y + "," +
points[9].x + " " + points[9].y + ")))", points[9].geometry.x + " " + points[9].geometry.y + ")))",
"format correctly writes MultiPolygon WKT"); "format correctly writes MultiPolygon WKT");
// test a geometrycollection // test a geometrycollection
t.eq(format.write(collection), t.eq(format.write(collection),
"GEOMETRYCOLLECTION(POINT(" + points[0].x + " " + points[0].y + ")," + "GEOMETRYCOLLECTION(POINT(" + points[0].geometry.x + " " + points[0].geometry.y + ")," +
"LINESTRING(" + points[0].x + " " + points[0].y + "," + "LINESTRING(" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].x + " " + points[1].y + "," + points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].x + " " + points[2].y + "))", points[2].geometry.x + " " + points[2].geometry.y + "))",
"format correctly writes GeometryCollection WKT"); "format correctly writes GeometryCollection WKT");
} }
@@ -134,35 +150,35 @@
*/ */
// test a point // test a point
t.ok(points[0].equals(format.read(format.write(points[0]))), t.ok(points[0].geometry.equals(format.read(format.write(points[0])).geometry),
"format correctly reads Point WKT"); "format correctly reads Point WKT");
// test a multipoint // test a multipoint
t.ok(multipoint.equals(format.read(format.write(multipoint))), t.ok(multipoint.geometry.equals(format.read(format.write(multipoint)).geometry),
"format correctly reads MultiPoint WKT"); "format correctly reads MultiPoint WKT");
// test a linestring // test a linestring
t.ok(linestrings[0].equals(format.read(format.write(linestrings[0]))), t.ok(linestrings[0].geometry.equals(format.read(format.write(linestrings[0])).geometry),
"format correctly reads LineString WKT"); "format correctly reads LineString WKT");
// test a multilinestring // test a multilinestring
t.ok(multilinestring.equals(format.read(format.write(multilinestring))), t.ok(multilinestring.geometry.equals(format.read(format.write(multilinestring)).geometry),
"format correctly reads MultiLineString WKT"); "format correctly reads MultiLineString WKT");
// test a polygon // test a polygon
t.ok(polygons[0].equals(format.read(format.write(polygons[0]))), t.ok(polygons[0].geometry.equals(format.read(format.write(polygons[0])).geometry),
"format correctly reads Polygon WKT"); "format correctly reads Polygon WKT");
// test a multipolygon // test a multipolygon
t.ok(multipolygon.equals(format.read(format.write(multipolygon))), t.ok(multipolygon.geometry.equals(format.read(format.write(multipolygon)).geometry),
"format correctly reads MultiPolygon WKT"); "format correctly reads MultiPolygon WKT");
// test a geometrycollection // test a geometrycollection
t.eq(format.write(collection), t.eq(format.write(collection),
"GEOMETRYCOLLECTION(POINT(" + points[0].x + " " + points[0].y + ")," + "GEOMETRYCOLLECTION(POINT(" + points[0].geometry.x + " " + points[0].geometry.y + ")," +
"LINESTRING(" + points[0].x + " " + points[0].y + "," + "LINESTRING(" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].x + " " + points[1].y + "," + points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].x + " " + points[2].y + "))", points[2].geometry.x + " " + points[2].geometry.y + "))",
"format correctly writes GeometryCollection WKT"); "format correctly writes GeometryCollection WKT");
} }

View File

@@ -187,8 +187,9 @@
layer = new OpenLayers.Layer.WMS(name, url, params); layer = new OpenLayers.Layer.WMS(name, url, params);
map.addLayer(layer); map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5); map.setCenter(new OpenLayers.LonLat(0,0), 10);
//grab a reference to one of the tiles //grab a reference to one of the tiles
var tile = layer.grid[1][1]; var tile = layer.grid[1][1];
t.eq( tile.imgDiv.className, "olTileImage", "Tile has an image" ); t.eq( tile.imgDiv.className, "olTileImage", "Tile has an image" );

View File

@@ -188,13 +188,14 @@
map.setCenter(new OpenLayers.LonLat(0,0), 5); map.setCenter(new OpenLayers.LonLat(0,0), 5);
var tile = layer.grid[0][0]; var tile = layer.grid[0][0];
t.ok(tile.layer.imageSize.equals(tile.size), t.ok(tile.layer.imageSize.equals(tile.size),
"zero size gutter doesn't change image size"); "zero size gutter doesn't change image size");
t.ok(tile.layer.imageOffset.equals(new OpenLayers.Pixel(0, 0)), t.ok(tile.layer.imageOffset.equals(new OpenLayers.Pixel(0, 0)),
"zero size gutter doesn't affect image offset"); "zero size gutter doesn't affect image offset");
var zero_gutter_bounds = tile.bounds;
map.destroy(); map.destroy();
var gutter = 15; var gutter = 15;
@@ -209,8 +210,7 @@
t.ok(tile.layer.imageOffset.equals(new OpenLayers.Pixel(-gutter, -gutter)), t.ok(tile.layer.imageOffset.equals(new OpenLayers.Pixel(-gutter, -gutter)),
"gutter properly sets image offset"); "gutter properly sets image offset");
t.ok(tile.bounds.equals(zero_gutter_bounds),
t.ok(tile.bounds.equals(new OpenLayers.Bounds(-33.75, 33.75, -22.5, 45)),
"gutter doesn't affect tile bounds"); "gutter doesn't affect tile bounds");
map.destroy(); map.destroy();

View File

@@ -17,6 +17,7 @@
<li>Geometry/test_Rectangle.html</li> <li>Geometry/test_Rectangle.html</li>
<li>Geometry/test_Surface.html</li> <li>Geometry/test_Surface.html</li>
<li>test_Format.html</li> <li>test_Format.html</li>
<li>Format/test_GeoRSS.html</li>
<li>Format/test_GML.html</li> <li>Format/test_GML.html</li>
<li>Format/test_WKT.html</li> <li>Format/test_WKT.html</li>
<li>test_Icon.html</li> <li>test_Icon.html</li>
@@ -38,7 +39,7 @@
<li>Layer/test_Image.html</li> <li>Layer/test_Image.html</li>
<li>Layer/test_KaMap.html</li> <li>Layer/test_KaMap.html</li>
<li>Layer/test_Markers.html</li> <li>Layer/test_Markers.html</li>
<li>Layer/test_Multimap.html</li> <li>Layer/test_MultiMap.html</li>
<li>Layer/test_MapServer.html</li> <li>Layer/test_MapServer.html</li>
<li>Layer/test_MapServer_Untiled.html</li> <li>Layer/test_MapServer_Untiled.html</li>
<li>Layer/test_Text.html</li> <li>Layer/test_Text.html</li>
@@ -58,6 +59,5 @@
<li>Control/test_PanZoomBar.html</li> <li>Control/test_PanZoomBar.html</li>
<li>Control/test_Permalink.html</li> <li>Control/test_Permalink.html</li>
<li>Control/test_Scale.html</li> <li>Control/test_Scale.html</li>
<li>test_Format.html</li>
<li>test_Map.html</li> <li>test_Map.html</li>
</ul> </ul>

View File

@@ -336,34 +336,48 @@
function test_01_Map_defaultTheme(t) { function test_01_Map_defaultTheme(t) {
t.plan(5); t.plan(5);
var head = document.getElementsByTagName('head')[0]; var links = document.getElementsByTagName('link');
var nodeCount = head.childNodes.length;
map = new OpenLayers.Map('map'); map = new OpenLayers.Map('map');
var lastNode = head.childNodes[head.childNodes.length - 1]; var gotNodes = 0;
var themeNode = null;
t.eq(nodeCount + 1, head.childNodes.length, "by default, a node is added to document head" ); for(var i=0; i<links.length; ++i) {
t.eq(lastNode.tagName, "LINK", "node added is a link element"); if(OpenLayers.Util.isEquivalentUrl(map.theme, links.item(i).href)) {
t.eq(lastNode.rel, "stylesheet", "node added has rel set to stylesheet"); gotNodes += 1;
t.eq(lastNode.type, "text/css", "node added has type set to text/css"); themeNode = links.item(i);
t.ok(OpenLayers.Util.isEquivalentUrl(map.theme, lastNode.href), "node added has href equivalent to map.theme"); }
}
t.eq(gotNodes, 1, "by default, a single link node is added to document");
t.ok(themeNode != null, "a link node with the theme href was added");
t.eq(themeNode.rel, "stylesheet", "node added has rel set to stylesheet");
t.eq(themeNode.type, "text/css", "node added has type set to text/css");
// reconstruct the map to prove that another link is not added
map = new OpenLayers.Map('map');
t.eq(links.length, document.getElementsByTagName('link').length,
"calling the map constructor twice with the same theme doesn't add duplicate link nodes");
} }
function test_01_Map_customTheme(t) { function test_01_Map_customTheme(t) {
t.plan(5); t.plan(5);
var head = document.getElementsByTagName('head')[0]; var customTheme = 'foo';
var nodeCount = head.childNodes.length; var options = {theme: customTheme};
var options = {theme: 'foo'};
map = new OpenLayers.Map('map', options); map = new OpenLayers.Map('map', options);
var lastNode = head.childNodes[head.childNodes.length - 1]; var links = document.getElementsByTagName('link');
var gotNodes = 0;
t.eq(nodeCount + 1, head.childNodes.length, "with custom theme, a node is added to document head" ); var themeNode = null;
t.eq(lastNode.tagName, "LINK", "node added is a link element"); for(var i=0; i<links.length; ++i) {
t.eq(lastNode.rel, "stylesheet", "node added has rel set to stylesheet"); if(OpenLayers.Util.isEquivalentUrl(map.theme, links.item(i).href)) {
t.eq(lastNode.type, "text/css", "node added has type set to text/css"); gotNodes += 1;
t.ok(OpenLayers.Util.isEquivalentUrl(map.theme, lastNode.href), "node added has href equivalent to map.theme"); themeNode = links.item(i);
}
}
t.eq(map.theme, customTheme, "map theme is properly set");
t.eq(gotNodes, 1, "with custom theme, a single link node is added to document");
t.ok(themeNode != null, "a link node with the theme href was added");
t.eq(themeNode.rel, "stylesheet", "node added has rel set to stylesheet");
t.eq(themeNode.type, "text/css", "node added has type set to text/css");
} }
function test_01_Map_noTheme(t) { function test_01_Map_noTheme(t) {
t.plan(1); t.plan(1);

View File

@@ -80,7 +80,7 @@
t.eq(popup.div.style.width, w + "px", "width position of popup.div set correctly"); t.eq(popup.div.style.width, w + "px", "width position of popup.div set correctly");
t.eq(popup.div.style.height, h + "px", "heightposition of popup.div set correctly"); t.eq(popup.div.style.height, h + "px", "heightposition of popup.div set correctly");
var contentDiv = popup.div.childNodes[0]; var contentDiv = popup.div.childNodes[0].childNodes[0];
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");