Thanks Tom,
That was exactly what was needed. I'll save the details for my work on
the style documentation.
--adrian
On Sun, 2006-07-30 at 08:38 -0500, Tom Howe wrote:
> Sorry, accidently clicked send before I was done.
>
> StyleBuilder builder = new StyleBuilder();
> Mark mark = builder.createMark("square", Color.BLACK);
> Graphic g = builder.createGraphic(null,mark,null);
> Symbolizer s = builder.createPointSymbolizer(g);
> Style style = builder.createStyle(s);
>
> this will automatically create the FeatureTypeStyle, Rule hierarchy
> for you. The rule will always apply and the FeatureType will not be
> specific otherwise, you could do:
>
> StyleBuilder builder = new StyleBuilder();
> Mark mark = builder.createMark("square", Color.BLACK);
> Graphic g = builder.createGraphic(null,mark,null);
> Symbolizer s = builder.createPointSymbolizer(g);
> Rule r = builder.createRule(s);
> rule.setFilter(. . . ) //If you want to set a filter on the rule.
> FeatureTypeStyle fts = builder.createFeatureTypeStyle("featureName", r);
> Style s = builder.createStyle();
> s.setFeatureTypeStyles(new FeatureTypeStyles[]{fts};
>
> or if you have multiple rules:
>
> StyleBuilder builder = new StyleBuilder();
> Mark mark = builder.createMark("square", Color.BLACK);
> Graphic g = builder.createGraphic(null,mark,null);
> Symbolizer s = builder.createPointSymbolizer(g);
> Rule[] rules = new Rule[];
> rules[0] = builder.createRule(s);
> . . . create more rules for your style. . .
> Style s = builder.createStyle(rules);
>
> this should create a style with multiple rules. The key here is that
> FeatureTypeStyle is automatically created for you by the builder. In
> fact the simplest way to do this is:
>
> StyleBuilder builder = new StyleBuilder();
> Style s = builder.createStyle(builder.createPointSymbolizer());
>
> This will create a style that draws the point with the default
> symbolizer (which I believe is a dark gray square).
>
> Anyhoo, sorry for the verbose email.
>
> -Tom
>
> On 7/30/06, Tom Howe <[EMAIL PROTECTED]> wrote:
> > Here's one way to do it:
> >
> > StyleBuilder builder = new StyleBuilder();
> > Mark mark = builder.createMark("square", Color.BLACK);
> > Graphic g = builder.createGraphic(null,mark,null);
> > Symbolizer s = builder.createPointSymbolizer(g);
> > Rule rule = builder.createRule(s);
> >
> >
> > On 7/30/06, Adrian Custer <[EMAIL PROTECTED]> wrote:
> > > hey all,
> > >
> > > I'd like to display a point (London) on the screen (via JMapPane).
> > >
> > > I have created the FeatureSource for the point feature. I need to create
> > > the Style and then I can add the two via:
> > > context.addLayer(memFS,memStyl);
> > >
> > > So I'm trying to create a style for a point. As I understand it, the
> > > hierarchy is:
> > > Style
> > > FeatureTypeStyle
> > > Rule
> > > Symbolizer
> > >
> > > so here's what I have so far:
> > > // Create the memStyl from scratch
> > > StyleBuilder sb = new StyleBuilder();
> > > memStyl = sb.createStyle();
> > > PointSymbolizer ptSymbl = sb.createPointSymbolizer();
> > > FeatureTypeStyle ftStyl = sb.createFeatureTypeStyle(ptSymbl);
> > > memStyl.addFeatureTypeStyle(ftStyl);
> > >
> > > and an earlier attempt:
> > > org.geotools.styling.Style s = sf.getDefaultStyle();
> > > FeatureTypeStyle fts = sf.createFeatureTypeStyle();
> > > fts.setFeatureTypeName("Metropolis");
> > > s.addFeatureTypeStyle(fts);
> > > Rule r = sf.createRule();
> > > r.setName("MetroRule");
> > >
> > > I can see that I haven't asked anywhere for a glyph (a graphic?) but I'm
> > > not at all sure how to do this.
> > >
> > > Any help would be appreciated,
> > >
> > > --adrian
> > >
> > >
> > > -------------------------------------------------------------------------
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > > your
> > > opinions on IT & business topics through brief surveys -- and earn cash
> > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > _______________________________________________
> > > Geotools-gt2-users mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> > >
> >
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users