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:
> 
> 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.
> 
>  http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/labels.html
> http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/labels.html 
> 
> Arnd Wippermann
> http://gis.ibbeck.de/ginfo
> 

-- 
View this message in context: 
http://www.nabble.com/vector-labels-tp16589123p18238904.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.

_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev

Reply via email to