hy to everybody,
a few years ago I used geotools to calculate and visualize itineraries for
bikers using shape files containing road information.
No I would like to provide an interface for the placement of antennas in the
territory, but it seems that everything changed in geotools. I did the
following to visualize a shapefile but nothing is visualized and no error
message occurs. Shapefile includes roads. Maybe someone more expert can have
a look on it?
thanks
dyiadgba
URL shapefileURL = getClass().getResource("data/str/str.shp");
ShapefileDataStore dsRoads = new ShapefileDataStore( shapefileURL );
FeatureSource source = dsRoads.getFeatureSource("str");
public Style demoStyle(String typeName) throws Exception {
StyleBuilder sb = new StyleBuilder();
LineSymbolizer lsStream = sb.createLineSymbolizer(Color.BLUE, 8);
Style style = sb.createStyle(lsStream);
JFrame frame = new JFrame("FOSS4G");
frame.setBounds(20,20,450,200);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JMapPane mp = new JMapPane();
frame.getContentPane().add( mp);
mp.setMapArea(source.getBounds());
MapContext context = new DefaultMapContext(DefaultGeographicCRS.WGS84);
context.setAreaOfInterest( new ReferencedEnvelope(-179.0,179.0,-80.0,80.0,
DefaultGeographicCRS.WGS84));
context.addLayer( source, style );
GTRenderer renderer = new StreamingRenderer();
HashMap hints = new HashMap();
hints.put("memoryPreloadingEnabled", Boolean.TRUE);
renderer.setRendererHints( hints );
mp.setRenderer(renderer);
mp.setContext(context);
frame.setVisible(true);
frame.repaint();
-------------------------------------------------------------------------
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