OK, thanks Jesse for the prod in the right direction. For future people who
are trying to do this kind of thing with udig, I've attached a sample of the
styling code that's needed for the two styles I asked about.

I have a few more questions:

- is it possible to turn antialiasing on or off ?

- I would like to add at run time some extra layers containing lines.
Potentially there could be rather a lot of them, all kept in memory. Is
there any preferred method for doing this, any classical pitfals anyone
would advise to avoid?

- Is it possible to customise the way lines are drawn, for example for
adding special symbols along them? (I suppose this goes beyond using SLDs !)

Thanks,

Robbie Jameson


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of Robbie Jameson
> Sent: Thursday, April 06, 2006 18:43
> To: 'User-friendly Desktop Internet GIS'
> Subject: RE: [udig-devel] Re M7
> 
> 
> > > - style with name label snaking along (above or inside)
> > each annotated
> > > linestring rather than being displayed horizontaly
> > There is a way to more or less do this... I had thought 
> that it was  
> > on by default but it has been a while since I've looked into it.   
> > I'll check it out and let you know what I find out.
> 
> Ok, thanks, even if it's only by API there's no problem with that
> 
> > >
> > > - style with set of linestrings displayed as thick (e.g. white) 
> > > lines with outer rims (e.g. black) so as to look more like what 
> > > raster maps
> > > with roads
> > > on them look like.
> > In order to do this you have to make a custom SLD, currently
> > you have  
> > to use the XML editor to do it. For best appearance you can make 2  
> > FeatureTypeStyles one that is a line of 3 thickness and one 
> > that is a  
> > line of 1 thickness.  Currently this requires 2 passes through the  
> > data for shapefiles.  For a quick approximation ( a single 
> pass) you  
> > can have 2 rules in a single feature type style.  The problem with  
> > this solution is that intersections will look a little 
> funny.  This  
> > is because 1 case 1 all the thick lines are drawn then all 
> the thin  
> > lines are drawn but in the second case for each feature line 1 is  
> > drawn then line 2 is drawn (rather than all thick lines for all  
> > features).  When 2 features intersect the first feature will 
> > be drawn  
> > with both lines then the second feature will cover the 
> lines at the  
> > intersection.  (This explanation isn't the clearest, my apologies).
> Thanks, I'll try it out, I suspected SLDs were the answer.
> 
> Thanks for your reply Jesse,
> 
> Robbie
> 
> 
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
> 
> 
StyleBuilder styleBuilder = new StyleBuilder();

Style myStyle = styleBuilder.createStyle();

{
        LineSymbolizer lineSymbolizer = styleBuilder.createLineSymbolizer(new 
Color(181, 160, 0), 18);
        
myStyle.addFeatureTypeStyle(styleBuilder.createFeatureTypeStyle(lineSymbolizer, 
0, Double.MAX_VALUE);
}
{
        LineSymbolizer lineSymbolizer = styleBuilder.createLineSymbolizer(new 
Color(255, 252, 230), 15);
        Font targetFont = styleBuilder.createFont("Arial", false, true, 12);
        TextSymbolizer textSymbolizer = styleBuilder.createTextSymbolizer(new 
Color(112, 101, 13), targetFont, "ROAD_NAME");
        textSymbolizer.setPlacement(styleBuilder.createLinePlacement(0));
        myStyle.addFeatureTypeStyle(styleBuilder.createFeatureTypeStyle(new 
Symbolizer[] {lineSymbolizer, textSymbolizer}, 0, Double.MAX_VALUE));
}


((IMap) 
element).getMapLayers().get(0).getStyleBlackboard().put("net.refractions.udig.style.sld",
 myStyle);
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to