Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-dev] SLD and embedded icons

Florian, is it required to store styles as sld files or is it possible to create styles programatically?

Within a bundle I create styles with geotools:

final StyleBuilder styleBuilder = new StyleBuilder();

// within my bundle I have stored down below img my image icons NOTE: don't forget to add img folder in build.properties

final java.net.URL imageURL = MyClass.class.getResource("/img/myIcon.gif"); //$NON-NLS-1$
final ExternalGraphic icon = styleBuilder.createExternalGraphic(imageURL, "image/gif"); //$NON-NLS-1$
...
final Graphic graphic = styleBuilder.createGraphic(icon, null, null, 0.5, 15, 0);

final PointSymbolizer pointSymbolizer = styleBuilder.createPointSymbolizer(graphic);

final Style style = styleBuilder.createStyle(pointSymbolizer);

return style;

At runtime you can open the style editor and have a look what kind of URL is used, its bundleresource://

 xlink:href="" style="font-family:courier new,monospace">myIcon.gif"

that can be resolved from Eclipse OSGi runtime.
HTH
- Frank





2014-10-30 15:22 GMT+01:00 Florian Dubois <florian.dubois.kr@xxxxxxxxx>:
Hello everyone,

First of all, thanks to the Udig team for their support, it helps me a lot in my understanding of the tool.
My need is simple : I want to render my layer points as icons, using the PointSymbolizer coming with SLDs.
The problem is : I want to package these icons in my build, then what would be the xlink to the icons ? Right now I'm putting my icons on my desktop, but at the end I want to package my icons in my udig java plugin.

<sld:PointSymbolizer>
        <sld:Graphic>
               <sld:ExternalGraphic>
                    <sld:OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="">                    <sld:Format>image/gif</sld:Format>
               </sld:ExternalGraphic>
       </sld:Graphic>
</sld:PointSymbolizer>


Thanks in advance.

Florian

_______________________________________________
udig-dev mailing list
udig-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://locationtech.org/mailman/listinfo/udig-dev


Back to the top