New SVG2 renderer for increased performance and smaller library size. Not enabled by default. To use, include 'SVG2' in the renderers array of your OpenLayers.Layer.Vector instance. r=crschmidt (closes #2802)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11616 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+50
-3
@@ -458,9 +458,7 @@
|
||||
t.plan(9);
|
||||
|
||||
var map = new OpenLayers.Map("map");
|
||||
var layer = new OpenLayers.Layer.Vector(null, {
|
||||
drawn: true
|
||||
});
|
||||
var layer = new OpenLayers.Layer.Vector();
|
||||
map.addLayer(layer);
|
||||
var feature = new OpenLayers.Feature.Vector(
|
||||
new OpenLayers.Geometry.Point(10, 10)
|
||||
@@ -477,6 +475,7 @@
|
||||
};
|
||||
|
||||
// draw feature with no state
|
||||
layer.drawn = true;
|
||||
layer.drawFeature(feature);
|
||||
t.ok(log.feature === feature, "[no state] drawFeature called with correct feature");
|
||||
t.ok(log.style.display !== "none", "[no state] drawFeature called with style display not none");
|
||||
@@ -707,6 +706,54 @@
|
||||
(-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);
|
||||
|
||||
Reference in New Issue
Block a user