|
From: Jody G. <jod...@gm...> - 2009-09-09 07:48:14
|
Good call Micheal - so let us ask the user list here for a shopping
list of examples; and once we get 2.6-M3 out the door we can swap code
examples back and forth in order to refine the docs; and the api.
I think styles also come across as hard as that is where the user
guide stops :-( Some code examples will go a long way here.
With that in mind here is an example of putting together a style with
an external graphic:
StyleBuilder styleBuilder = new StyleBuilder();
Style style = styleBuilder.createStyle();
{
{ PointSymbolizer pointSymbolizer =
styleBuilder.createPointSymbolizer();
{ Graphic graphic = styleBuilder.createGraphic();
ExternalGraphic external =
styleBuilder.createExternalGraphic( "file:///C:/images/house.gif",
"image/gif");
graphic.graphicalSymbols().add( external );
graphic.graphicalSymbols().add(
styleBuilder.createMark("circle"));
pointSymbolizer.setGraphic(graphic);
}
Rule rule = styleBuilder.createRule(pointSymbolizer);
FeatureTypeStyle featureTypeStyle =
styleBuilder.createFeatureTypeStyle("Feature", rule );
style.featureTypeStyles().add( featureTypeStyle );
}
}
I have added this to the page
http://docs.codehaus.org/display/GEOTDOC/04+Styling
Jody
On Wed, Sep 9, 2009 at 12:16 PM, Michael
Bedward<mic...@gm...> wrote:
> 2009/9/9 Jody Garnett <jod...@gm...>:
>> These examples will be in XML but the data structure being represented is
>> the same.
>
> But I think that illustrates part of the problem: you need to know
> GeoTools style API quite well to translate XML examples to
> programmatic examples in your head. So if you are new to the library
> or styling it's catch-22.
>
> Personally, I've found styling to be one of the most difficult aspects
> of the library to master and, in part, I think that has been because
> so much of the information here and elsewhere is written for users of
> GeoServer and similar tools. There is relatively little about
> programmatic use in stand-alone apps.
>
> This is an observation rather than a criticism. Everyone here
> struggles to find time to work on the docs.
>
> Michael
>
|