<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Great that you seem to get it to work. I did not have any problems
with non disappearing labels, but for the purpose of enabling/disabling
labeling I had added a removeText function which seems to be missing
from the diff I sent earlier, maybe it might be of use. <br>
<br>
Good luck.<br>
Piebe<br>
<br>
<br>
VML.js:<br>
removeText: function(node, style) {<br>
var label = this.nodeFactory("label" + node.id, "v:oval");<br>
// remove label <br>
if (label && label.firstChild) {<br>
label.removeChild(label.firstChild);<br>
}<br>
}, <br>
<br>
<br>
SVG.js:<br>
removeText: function(node, style) {<br>
var label = this.nodeFactory("label" + node.id, "text");<br>
<br>
// remove label <br>
if (label && label.firstChild) {<br>
label.removeChild(label.firstChild);<br>
}<br>
}, <br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Zer wrote:
<blockquote cite="mid:18238904.post@talk.nabble.com" type="cite">
<pre wrap="">Hello,
After some more investigation, I found out that I had to add the changes in
these files too. And now it works almost fine! There is oe issue regarding
removing of vectors. I call the destroyFeatures() function on a vector
layer. The vetctor objects are removed from the map, but the labels are are
not removed. Does anyone know what, and where, to add in the code to destroy
them?
Thanks,
-Z
sandbox/camptocamp/text/lib/OpenLayers/Geometry/Point.js
r5614         r7005         
173        173        
174        174         /**
        175         * APIMethod: getCentroid
        176         *
        177         * Returns:
        178         * {<OpenLayers.Geometry.Point>} The centroid of the collection
        179         */
        180         getCentroid: function() {
        181         return new OpenLayers.Geometry.Point(this.x, this.y);
        182         },
        183        
        184         /**
175        185         * APIMethod: intersects
176        186         * Determine if the input geometry intersects this one.
sandbox/camptocamp/text/lib/OpenLayers/Geometry/LinearRing.js
r5673         r7005         
197        197         }
198        198         return area;
        199         },
        200        
        201         /**
        202         * APIMethod: getCentroid
        203         *
        204         * Returns:
        205         * {<OpenLayers.Geometry.Point>} The centroid of the collection
        206         */
        207         getCentroid: function() {
        208         if ( this.components && (this.components.length > 2)) {
        209         var sumX = 0.0;
        210         var sumY = 0.0;
        211         for (var i = 0; i < this.components.length - 1; i++) {
        212         var b = this.components[i];
        213         var c = this.components[i+1];
        214         sumX += (b.x + c.x) * (b.x * c.y - c.x * b.y);
        215         sumY += (b.y + c.y) * (b.x * c.y - c.x * b.y);
        216         }
        217         var x = sumX / (6 * Math.abs(this.getArea()));
        218         var y = sumY / (6 * Math.abs(this.getArea()));
        219         }
        220         return new OpenLayers.Geometry.Point(x, y);
199        221         },
200        222        
#
#
sandbox/camptocamp/text/lib/OpenLayers/Geometry/Collection.js
r5614         r7005         
231        231         return area;
232        232         },
        233        
        234         /**
        235         * APIMethod: getCentroid
        236         *
        237         * Returns:
        238         * {<OpenLayers.Geometry.Point>} The centroid of the collection
        239         */
        240         getCentroid: function() {
        241         var centroid = this.components[0].getCentroid();
        242         return centroid;
        243         },
233        244        
234        245         /**
Arnd Wippermann wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
i would also like to display labels on a map. I have tried using
OpenLayers.Popup to do this. It seems to work. The labels could be moved
after creating, but after zooming the position will new calculated to
default values via OpenLayers.Popup. I have no idea, how to prevent this.
<a class="moz-txt-link-freetext" href="http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/labels.html">http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/labels.html</a>
<a class="moz-txt-link-freetext" href="http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/labels.html">http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/labels.html</a>
Arnd Wippermann
<a class="moz-txt-link-freetext" href="http://gis.ibbeck.de/ginfo">http://gis.ibbeck.de/ginfo</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>