Move SVG2 renderer to deprecated.js

This commit is contained in:
fredj
2012-02-14 15:09:39 +01:00
committed by Frederic Junod
parent a462be52a8
commit 420a6f4dd2
9 changed files with 793 additions and 900 deletions
-48
View File
@@ -723,54 +723,6 @@
(-y + customStyle6.graphicYOffset).toFixed().toString(),
"graphicYOffset correctly set");
}
if (layer.renderer.CLASS_NAME == 'OpenLayers.Renderer.SVG2') {
feature.style = customStyle1;
layer.drawFeature(feature);
var resolution = map.getResolution();
t.eq(root.firstChild.getAttributeNS(null, 'width'),
(2*customStyle1.pointRadius*resolution).toString(),
"given a pointRadius, width equals 2*pointRadius");
t.eq(root.firstChild.getAttributeNS(null, 'height'),
(2*customStyle1.pointRadius*resolution).toString(),
"given a pointRadius, height equals 2*pointRadius");
feature.style = customStyle2;
layer.drawFeature(feature);
t.eq(root.firstChild.getAttributeNS(null, 'width'),
root.firstChild.getAttributeNS(null, 'height'),
"given a graphicWidth, width equals height");
t.eq(root.firstChild.getAttributeNS(null, 'width'),
(customStyle2.graphicWidth*resolution).toString(),
"width is set correctly");
feature.style = customStyle3;
layer.drawFeature(feature);
t.eq(root.firstChild.getAttributeNS(null, 'height'),
root.firstChild.getAttributeNS(null, 'width'),
"given a graphicHeight, height equals width");
t.eq(root.firstChild.getAttributeNS(null, 'height'),
(customStyle3.graphicHeight*resolution).toString(),
"height is set correctly");
feature.style = customStyle4;
layer.drawFeature(feature);
t.eq(root.firstChild.getAttributeNS(null, 'height'),
(customStyle4.graphicHeight*resolution).toString(),
"given graphicHeight and graphicWidth, both are set: height");
t.eq(root.firstChild.getAttributeNS(null, 'width'),
(customStyle4.graphicWidth*resolution).toString(),
"given graphicHeight and graphicWidth, both are set: width");
feature.style = customStyle5;
layer.drawFeature(feature);
t.eq(root.firstChild.getAttributeNS(null, 'style'),
'opacity: '+customStyle5.graphicOpacity.toString()+((OpenLayers.Util.getBrowserName() == "opera" || OpenLayers.Util.getBrowserName() == "safari") ? "" : ';'),
"graphicOpacity correctly set");
feature.style = customStyle6;
layer.drawFeature(feature);
t.eq(root.firstChild.getAttributeNS(null, 'x'),
(geometryX + customStyle6.graphicXOffset*resolution).toString(),
"graphicXOffset correctly set");
t.eq(root.firstChild.getAttributeNS(null, 'y'),
(-geometryY + customStyle6.graphicYOffset*resolution).toString(),
"graphicYOffset correctly set");
}
if (layer.renderer.CLASS_NAME == 'OpenLayers.Renderer.VML') {
feature.style = customStyle1;
layer.drawFeature(feature);
@@ -1,6 +1,7 @@
<html>
<head>
<script src="../OLLoader.js"></script>
<script src="../../OLLoader.js"></script>
<script src="../../../lib/deprecated.js"></script>
<script type="text/javascript">
var geometry = null, node = null;
+1 -1
View File
@@ -202,7 +202,6 @@
<li>Renderer/Canvas.html</li>
<li>Renderer/Elements.html</li>
<li>Renderer/SVG.html</li>
<li>Renderer/SVG2.html</li>
<li>Renderer/VML.html</li>
<li>Request.html</li>
<li>Request/XMLHttpRequest.html</li>
@@ -245,6 +244,7 @@
<li>deprecated/Layer/WMS/Post.html</li>
<li>deprecated/Protocol/SQL.html</li>
<li>deprecated/Protocol/SQL/Gears.html</li>
<li>deprecated/Renderer/SVG2.html</li>
<li>deprecated/Layer/Yahoo.html</li>
<li>deprecated/Tile/WFS.html</li>
</ul>
-50
View File
@@ -1,50 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<link rel="stylesheet" href="../../theme/default/style.css" type="text/css" />
<style type="text/css">
#map {
width: 512px;
height: 512px;
border: 1px solid gray;
}
</style>
<title>SVG2 coordinate range check</title>
<script type="text/javascript" src="../../lib/OpenLayers.js"></script>
<script>
var WGS84 = new OpenLayers.Projection("EPSG:4326");
var Mercator = new OpenLayers.Projection("EPSG:900913");
var wkt = new OpenLayers.Format.WKT({ internalProjection: Mercator, externalProjection: WGS84 });
function init() {
var externalGraphic, baseURL, baseLayer, layerOptions, hidemessenger;
var map = new OpenLayers.Map('map', {
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoom(),
new OpenLayers.Control.Attribution()
],
theme: null
});
baseLayer = new OpenLayers.Layer.OSM("OSM");
var viewLayer = new OpenLayers.Layer.Vector("View Layer", {renderers: ["SVG2"]});
map.addLayers([baseLayer, viewLayer]);
viewLayer.addFeatures([wkt.read("LINESTRING(2.4356174739332 48.816618174539, 2.4313688548536 48.826083884311)")]);
var lonLat = new OpenLayers.LonLat( 2.43686, 48.81742) .transform( WGS84, Mercator);
map.setCenter (lonLat, 16);
}
</script>
<body onload="init()">
<div id="map"></div>
<p>The map should show a line on top of the OSM layer. If it does not, then
either the CSS or the SVG coordinate range is exceeded.</p>
<p>This test only works on browsers that support SVG.</p>
</body>
</html>