Skip to content

Commit

Permalink
Pullup Changes for 2.8 RC6.
Browse files Browse the repository at this point in the history
 * VML support for IE8 (Closes #1910)
 * Fix for Opera 9.27 support (Closes #2103)
 * Minor ArcXML change for exact renderer (Closes #2117)
 * Missing semicolons (Closes #2134)
 * vector labels in IE7 standards mode (Closes #2135)


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.8@9478 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
  • Loading branch information
crschmidt committed Jun 15, 2009
1 parent d250372 commit 07fd731
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 36 deletions.
2 changes: 1 addition & 1 deletion examples/wfs-protocol.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
var layer = new OpenLayers.Layer.Vector("WFS", {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
url: "http://publicus.opengeo.org/geoserver/wfs",
url: "http://demo.opengeo.org/geoserver/wfs",
featureType: "tasmania_roads",
featureNS: "http://www.openplans.org/topp"
})
Expand Down
2 changes: 1 addition & 1 deletion examples/wmst.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"http://t1.hypercube.telascience.org/cgi-bin/landsat7",
{layers: "landsat7"});

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:"2005-08-29T13:00:00Z"});
ia_wms = new OpenLayers.Layer.WMS("Nexrad","http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi?",{layers:"nexrad-n0r-wmst",transparent:true,format:'image/png',time:"2005-08-29T13:00:00Z"});

jpl_wms.setVisibility(false);

Expand Down
2 changes: 1 addition & 1 deletion lib/OpenLayers/BaseTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ OpenLayers.String = {
* Used to find tokens in a string.
* Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
*/
tokenRegEx: /\${([\w.]+?)}/g,
tokenRegEx: /\$\{([\w.]+?)\}/g,

/**
* Property: OpenLayers.String.numberRegEx
Expand Down
4 changes: 2 additions & 2 deletions lib/OpenLayers/Format/ArcXML.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ OpenLayers.Format.ArcXML = OpenLayers.Class(OpenLayers.Format.XML, {
var keys = this.fontStyleKeys;
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i];
if (symbol[key]) {
selem.setAttribute(key, renderer[key]);
if (exact.symbol[key]) {
selem.setAttribute(key, exact.symbol[key]);
}
}
eelem.appendChild(selem);
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenLayers/Format/WMSGetFeatureInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ OpenLayers.Format.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Format.XML, {
var attributes = {};
if (node.nodeType == 1) {
var children = node.childNodes;
n = children.length
n = children.length;
for (var i = 0; i < n; ++i) {
var child = children[i];
if (child.nodeType == 1) {
Expand Down
64 changes: 35 additions & 29 deletions lib/OpenLayers/Renderer/VML.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
if (!document.namespaces.olv) {
document.namespaces.add("olv", this.xmlns);
var style = document.createStyleSheet();
style.addRule('olv\\:*', "behavior: url(#default#VML); " +
"position: absolute; display: inline-block;");
var shapes = ['shape','rect', 'oval', 'fill', 'stroke', 'imagedata', 'group','textbox'];
for (var i = 0, len = shapes.length; i < len; i++) {

style.addRule('olv\\:' + shapes[i], "behavior: url(#default#VML); " +
"position: absolute; display: inline-block;");
}
}

OpenLayers.Renderer.Elements.prototype.initialize.apply(this,
Expand Down Expand Up @@ -111,14 +115,14 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {


var org = left + " " + top;
this.root.setAttribute("coordorigin", org);
this.root.coordorigin = org;
var roots = [this.root, this.vectorRoot, this.textRoot];
var root;
for(var i=0, len=roots.length; i<len; ++i) {
root = roots[i];

var size = this.size.w + " " + this.size.h;
root.setAttribute("coordsize", size);
root.coordsize = size;

}
// flip the VML display Y axis upside down so it
Expand Down Expand Up @@ -240,11 +244,10 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
options.isStroked = false;
} else if (this.isComplexSymbol(style.graphicName)) {
var cache = this.importSymbol(style.graphicName);
node.setAttribute("path", cache.path);
node.setAttribute("coordorigin", cache.left + "," +
cache.bottom);
node.path = cache.path;
node.coordorigin = cache.left + "," + cache.bottom;
var size = cache.size;
node.setAttribute("coordsize", size + "," + size);
node.coordsize = size + "," + size;
this.drawCircle(node, geometry, style.pointRadius);
node.style.flip = "y";
} else {
Expand All @@ -254,9 +257,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {

// fill
if (options.isFilled) {
node.setAttribute("fillcolor", style.fillColor);
node.fillcolor = style.fillColor;
} else {
node.setAttribute("filled", "false");
node.filled = "false";
}
var fills = node.getElementsByTagName("fill");
var fill = (fills.length == 0) ? null : fills[0];
Expand All @@ -268,18 +271,18 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
if (!fill) {
fill = this.createNode('olv:fill', node.id + "_fill");
}
fill.setAttribute("opacity", style.fillOpacity);
fill.opacity = style.fillOpacity;

if (node._geometryClass == "OpenLayers.Geometry.Point" &&
style.externalGraphic) {

// override fillOpacity
if (style.graphicOpacity) {
fill.setAttribute("opacity", style.graphicOpacity);
fill.opacity = style.graphicOpacity;
}

fill.setAttribute("src", style.externalGraphic);
fill.setAttribute("type", "frame");
fill.src = style.externalGraphic;
fill.type = "frame";

if (!(style.graphicWidth && style.graphicHeight)) {
fill.aspect = "atmost";
Expand All @@ -298,18 +301,18 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
// the graphic as imagedata element. We cannot just remove
// the fill, because this is part of the hack described
// in graphicRotate
fill.setAttribute("opacity", 0);
fill.opacity = 0;
} else {
node.style.rotation = style.rotation;
}
}

// stroke
if (options.isStroked) {
node.setAttribute("strokecolor", style.strokeColor);
node.setAttribute("strokeweight", style.strokeWidth + "px");
node.strokecolor = style.strokeColor;
node.strokeweight = style.strokeWidth + "px";
} else {
node.setAttribute("stroked", "false");
node.stroked = false;
}
var strokes = node.getElementsByTagName("stroke");
var stroke = (strokes.length == 0) ? null : strokes[0];
Expand All @@ -322,9 +325,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
stroke = this.createNode('olv:stroke', node.id + "_stroke");
node.appendChild(stroke);
}
stroke.setAttribute("opacity", style.strokeOpacity);
stroke.setAttribute("endcap", !style.strokeLinecap || style.strokeLinecap == 'butt' ? 'flat' : style.strokeLinecap);
stroke.setAttribute("dashstyle", this.dashStyle(style));
stroke.opacity = style.strokeOpacity;
stroke.endcap = !style.strokeLinecap || style.strokeLinecap == 'butt' ? 'flat' : style.strokeLinecap;
stroke.dashstyle = this.dashStyle(style);
}

if (style.cursor != "inherit" && style.cursor != null) {
Expand Down Expand Up @@ -453,12 +456,12 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
var fillColor = node._style.fillColor;
var strokeColor = node._style.strokeColor;
if (fillColor == "none" &&
node.getAttribute("fillcolor") != fillColor) {
node.setAttribute("fillcolor", fillColor);
node.fillcolor != fillColor) {
node.fillcolor = fillColor;
}
if (strokeColor == "none" &&
node.getAttribute("strokecolor") != strokeColor) {
node.setAttribute("strokecolor", strokeColor);
node.strokecolor != strokeColor) {
node.strokecolor = strokeColor;
}
},

Expand Down Expand Up @@ -544,12 +547,12 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
createNode: function(type, id) {
var node = document.createElement(type);
if (id) {
node.setAttribute('id', id);
node.id = id;
}

// IE hack to make elements unselectable, to prevent 'blue flash'
// while dragging vectors; #1410
node.setAttribute('unselectable', 'on', 0);
node.unselectable = 'on';
node.onselectstart = function() { return(false); };

return node;
Expand Down Expand Up @@ -816,7 +819,10 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
textbox.style.fontWeight = style.fontWeight;
}
textbox.style.whiteSpace = "nowrap";
textbox.inset = "0px,0px,0px,0px";
// fun with IE: IE7 in standards compliant mode does not display any
// text with a left inset of 0. So we set this to 1px and subtract one
// pixel later when we set label.style.left
textbox.inset = "1px,0px,0px,0px";

if(!label.parentNode) {
label.appendChild(textbox);
Expand All @@ -828,7 +834,7 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(0,1)]);
var yshift = textbox.clientHeight *
(OpenLayers.Renderer.VML.LABEL_SHIFT[align.substr(1,1)]);
label.style.left = parseInt(label.style.left)-xshift+"px";
label.style.left = parseInt(label.style.left)-xshift-1+"px";
label.style.top = parseInt(label.style.top)+yshift+"px";
},

Expand Down
2 changes: 1 addition & 1 deletion lib/OpenLayers/Style.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ OpenLayers.Style = OpenLayers.Class({
var defaults = this.defaultStyle;
OpenLayers.Util.applyDefaults(symbolizer, {
pointRadius: defaults.pointRadius
})
});
if(symbolizer.stroke === true || symbolizer.graphic === true) {
OpenLayers.Util.applyDefaults(symbolizer, {
strokeWidth: defaults.strokeWidth,
Expand Down
103 changes: 103 additions & 0 deletions tests/manual/arcims-2117.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ArcIMS Test Ticket #2117</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="../../examples/style.css" type="text/css" />
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript">
var lon = 0;
var lat = 0;
var zoom = 1;
var map, layer;

function init(){
OpenLayers.ProxyHost = "../../examples/proxy.cgi?url=";

map = new OpenLayers.Map( 'map' );

var options = {
serviceName: "OpenLayers_Sample",
async: true,
layers: [{
id:1,
visible:'true',
/*query:{
where: '1=1',
spatialfilter: true
},*/
renderer:{
type: 'valuemaplabel',
lookupfield: 'FIPS_ID',
labelfield: 'FIPS_CNTRY',
exacts:[{
value: '227',
symbol: {
type: 'text',
antialiasing: 'true',
interval: 6,
blockout: '255,255,255',
font: 'Arial',
fontcolor: '0,0,0',
fontsize: 11,
transparency: 0.7
}
},{
value: '150',
symbol: {
type: 'text',
antialiasing: 'true',
interval: 6,
blockout: '255,255,255',
font: 'Arial',
fontcolor: '0,0,0',
fontsize: 11,
transparency: 0.7
}
},{
value: '75',
symbol: {
type: 'text',
antialiasing: 'true',
interval: 6,
blockout: '255,255,255',
font: 'Arial',
fontcolor: '0,0,0',
fontsize: 11,
transparency: 0.7
}
}]
}
}]
};

layer = new OpenLayers.Layer.ArcIMS( "Global Sample Map",
"http://sample.avencia.com/servlet/com.esri.esrimap.Esrimap", options );
map.addLayer(layer);

map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl( new OpenLayers.Control.LayerSwitcher() );
}
</script>
</head>
<body onload="init()">
<h1 id="title">ArcIMS Test Ticket #2117</h1>

<div id="tags">
</div>
<p id="shortdesc">
<a href="http://trac.openlayers.org/ticket/2117">Testing ticket #2117</a>
</p>

<div id="map" class="smallmap"></div>

<div id="docs">
This is an example of a bug in the ArcXML format writer.
If you don't see a map, it's broken.
</div>

</body>
</html>




0 comments on commit 07fd731

Please sign in to comment.