added support for text labels. This also adds getCentroid methods to all

geometries. Thanks crschmidt for the great help with this patch, and 
thanks to camptocamp for the initial work on this and rcoup for creating 
the first patches. r=crschmidt (closes #1895)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@9262 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2009-04-10 16:05:26 +00:00
parent dd556be0be
commit cc2e19d789
15 changed files with 560 additions and 50 deletions
+12 -4
View File
@@ -5,7 +5,6 @@
var layer, map;
function test_RootContainer_collectResetRoots(t) {
t.plan(4);
map = new OpenLayers.Map("map");
var layer1 = new OpenLayers.Layer.Vector("layer1");
@@ -13,15 +12,24 @@
layer = new OpenLayers.Layer.Vector.RootContainer("layer_1_2", {
layers: [layer1, layer2]
});
// we cannot test this with a renderer that does not hava a rendererRoot
var plan = layer.renderer.rendererRoot ? 4 : 0;
t.plan(plan);
if(plan == 0) {
return;
}
var numRoots = layer.renderer.rendererRoot.childNodes.length;
// addLayers will call setMap() for layer, which will call collectRoots()
map.addLayers([layer1, layer2, layer]);
t.eq(layer.renderer.rendererRoot.childNodes.length, 3, "layer has correct number of renderer roots");
t.eq(layer.renderer.rendererRoot.childNodes.length, numRoots * 3, "layer has correct number of renderer roots");
t.eq(layer1.renderer.rendererRoot.childNodes.length, 0, "layer1 has no own renderer root");
layer.resetRoots();
t.eq(layer.renderer.rendererRoot.childNodes.length, 1, "roots removed from container");
t.eq(layer1.renderer.rendererRoot.childNodes.length, 1, "root re-added to original layer");
t.eq(layer.renderer.rendererRoot.childNodes.length, numRoots, "roots removed from container");
t.eq(layer1.renderer.rendererRoot.childNodes.length, numRoots, "root re-added to original layer");
}
function test_RootContainer_getFeatureFromEvent(t) {