[OpenLayers-Dev] feature label enhancement
Christopher Schmidt
crschmidt at metacarta.com
Wed Feb 10 08:11:22 EST 2010
On Wed, Feb 10, 2010 at 11:29:48AM +0100, "Dominik Gärner" wrote:
> Hi everyone,
>
> I'd like to do some label enhancement for vector features. I want the label to follow the feature shape (e.g. see http://www.svgbasics.com/text2.html )
> It shouldn't be that hard by using SVG & VML. However, since this means some changes in the Renderers - and I'm not so familiar with the whole existing implementations - I need some ideas & help for creating a concept:
>
> - using SVG, a textpath needs a <path> element. In SVG i could link the text to the path element (using the xlink:href attribute), but currently only Polygon and Curve geometries are using <path> node types. And I'm not sure if VML allows links.
> The better way will be to create a separate path element for the text/label, using the feature's geometry (--> this means changes to the drawText methods in the Renderers)
>
> - maybe some additional style attributes for the label have to be added.
>
> - Who knows something about Canvas? Is it possible to implement curved text like in SVG & VML?
> Where or which component decides what to use (besides of IE->VML, Firefox->SVG)
I doubt it.
> - Rotating labels comes for free by rotating the vector feature. Does it make sense to create an extra Label/Text class for placing just labels (e.g. if I want to place just a text, not a feature with a label attribute)
No, because you can use a feature with no strokeWidth/strokeColor (an invisible
feature) if you really want to do that.
> - Did I forget something essential? Sees anyone bigger blockades for the programming of this?
I tried to do this at one point. Because OL ties a single SVG/VML object to a
single geometry, it was hard to do right, so I gave up after spending a couple
weekends on it. Good luck. :)
Regards,
--
Christopher Schmidt
MetaCarta
More information about the Dev
mailing list