This project has moved. For the latest updates, please go here.

Symbols under a Label

Topics: General Topics
Jan 30, 2007 at 1:01 PM
SharpMap rocks :)

I would like to display an interstate symbol under a label, so that it looks like this:

Has anyone done something like this?

I thought I might be able to handle the LabelFilter event and add a Geometry provider for label locations with the interstate symbol. But unfortunately I need to render the Label layer after the symbol layer so that the label shows on top. So my symbol layer effectively ends up rendering for the last map view :(
Jan 30, 2007 at 5:29 PM
It looks like I have it working, although my solution is pretty kludgey. Ideally, SharpMap would have the ability to define symbols right within a LabelLayer.

But for now, if anyone is interested, my workaround was:

I first added a "dummy" label layer to use as a location for the symbols I wanted under my "real" label layer.

Then I create a Symbol layer. I define it and leave its DataSource set to an empty List<Geometry>.

Then I create the "real" label layer to overlay the symbol layer above.

Finally, in the "dummy" label layer's LabelFilter event handler, I create Geometry objects for the symbols in the Symbol layer.

Ugly I know but it seems to work.