added new graphicName symbolizer property, which allows to render well-known graphic symbols named "square", "cross", "x" and "triangle", in addition to the existing "circle". Thanks Tim for the tweaks and the example. r=tschaub,elemoine (closes #1398)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@7634 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+33
-1
@@ -371,8 +371,40 @@
|
||||
t.eq(string, "2,-4", "returned string is correct");
|
||||
}
|
||||
|
||||
|
||||
function test_svg_getnodetype(t) {
|
||||
if (!OpenLayers.Renderer.SVG.prototype.supported()) {
|
||||
t.plan(0);
|
||||
return;
|
||||
}
|
||||
|
||||
t.plan(1);
|
||||
|
||||
var r = new OpenLayers.Renderer.SVG(document.body);
|
||||
|
||||
var g = {CLASS_NAME: "OpenLayers.Geometry.Point"}
|
||||
var s = {graphicName: "square"};
|
||||
|
||||
t.eq(r.getNodeType(g, s), "use", "Correct node type for well known symbols");
|
||||
}
|
||||
|
||||
function test_svg_importsymbol(t) {
|
||||
if (!OpenLayers.Renderer.SVG.prototype.supported()) {
|
||||
t.plan(0);
|
||||
return;
|
||||
}
|
||||
|
||||
t.plan(2);
|
||||
|
||||
var r = new OpenLayers.Renderer.SVG(document.body);
|
||||
|
||||
r.importSymbol("square");
|
||||
|
||||
var polygon = document.getElementById("ol-renderer-defs").firstChild.firstChild;
|
||||
|
||||
t.eq(polygon.getAttribute("points"), "0,0 0,1 1,1 1,0 0,0", "Square symbol rendered correctly");
|
||||
t.ok(r.symbolSize["-square"], "Symbol size cached correctly.");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -338,7 +338,39 @@
|
||||
t.eq(node.style.height, "8px", "node.style.height is correct");
|
||||
}
|
||||
|
||||
function test_vml_getnodetype(t) {
|
||||
if (!OpenLayers.Renderer.VML.prototype.supported()) {
|
||||
t.plan(0);
|
||||
return;
|
||||
}
|
||||
|
||||
t.plan(1);
|
||||
|
||||
var r = new OpenLayers.Renderer.VML(document.body);
|
||||
|
||||
var g = {CLASS_NAME: "OpenLayers.Geometry.Point"}
|
||||
var s = {graphicName: "square"};
|
||||
|
||||
t.eq(r.getNodeType(g, s), "olv:shape", "Correct node type for well known symbols");
|
||||
}
|
||||
|
||||
function test_vml_importsymbol(t) {
|
||||
if (!OpenLayers.Renderer.VML.prototype.supported()) {
|
||||
t.plan(0);
|
||||
return;
|
||||
}
|
||||
|
||||
t.plan(2);
|
||||
|
||||
var r = new OpenLayers.Renderer.VML(document.body);
|
||||
|
||||
var cache = r.importSymbol("square");
|
||||
|
||||
t.eq(cache.path, "m 0 0 l 0 1 1 1 1 0 0 0 x e", "Square symbol rendered correctly");
|
||||
t.ok(r.symbolCache["-square"], "Symbol has been cached correctly.");
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user