The following example shows how to modify the rendering
of the graphic objects produced by this data source by changing the
style of the IlvMapLayer
of the data source.
// create the data source
IlvShapeDataSource source = new IlvShapeDataSource(fileName);
source.setManager(manager);
// Assuming that the geometry of the shape file are areas.
IlvGraphicPathStyle style = new IlvGraphicPathStyle();
source.getInsertionLayer().setStyle(style);
style.setPaint(Color.blue);
try {
source.start();
} catch (Exception e) {
e.printStackTrace();
}
If you are not sure of the type of objects contained
in the shape file, you can use the setAttribute
method
on the layer style, for example:
IlvMapLayer layer = source.getInsertionLayer();
layer.getStyle().setAttribute(IlvPolylineStyle.FOREGROUND,Color.black);
layer.getStyle().setAttribute(IlvPolylineStyle.BACKGROUND,new
Color(1,1,0.8f));