* @param context
* A MapContext object, responsible for actual drawing.
*/
public void paint(Paintable paintable, Object group, MapContext context) {
if (paintable != null) {
GfxGeometry gfxGeometry = (GfxGeometry) paintable;
Geometry geometry = gfxGeometry.getGeometry();
ShapeStyle shapeStyle = gfxGeometry.getStyle();
if (geometry instanceof LineString) {
context.getVectorContext().drawLine(group, gfxGeometry.getId(), (LineString) geometry, shapeStyle);
} else if (geometry instanceof MultiLineString) {
MultiLineString m = (MultiLineString) geometry;
String gfxId = gfxGeometry.getId();
GraphicsContext gc = context.getVectorContext();
for (int i = 0; i < m.getNumGeometries(); i++) {
gc.drawLine(group, gfxId + "." + i, (LineString) m.getGeometryN(i), shapeStyle);
}
} else if (geometry instanceof Polygon) {
context.getVectorContext().drawPolygon(group, gfxGeometry.getId(), (Polygon) geometry, shapeStyle);
} else if (geometry instanceof MultiPolygon) {
MultiPolygon m = (MultiPolygon) geometry;
String gfxId = gfxGeometry.getId();
GraphicsContext gc = context.getVectorContext();
for (int i = 0; i < m.getNumGeometries(); i++) {
gc.drawPolygon(group, gfxId + "." + i, (Polygon) m.getGeometryN(i), shapeStyle);
}
} else if (geometry instanceof Point) {
context.getVectorContext().drawSymbolDefinition(group, gfxGeometry.getId() + ".def",
gfxGeometry.getSymbolInfo(), shapeStyle, null);
context.getVectorContext().drawSymbol(group, gfxGeometry.getId(), geometry.getCoordinate(), shapeStyle,
gfxGeometry.getId() + ".def");
} else if (geometry instanceof MultiPoint) {
Coordinate[] coordinates = geometry.getCoordinates();
String gfxId = gfxGeometry.getId();
GraphicsContext gc = context.getVectorContext();
String styleTypeDef = gfxGeometry.getId() + ".def";
context.getVectorContext().drawSymbolDefinition(group, styleTypeDef, gfxGeometry.getSymbolInfo(),
shapeStyle, null);
for (int i = 0; i < coordinates.length; i++) {
gc.drawSymbol(group, gfxId + "." + i, coordinates[i], shapeStyle, styleTypeDef);
}
}