* @param context
* A MapContext object, responsible for actual drawing.
*/
public void paint(Paintable paintable, Object group, MapContext context) {
if (paintable != null) {
Feature feature = (Feature) paintable;
WorldViewTransformer worldViewTransformer = feature.getLayer().getMapModel().getMapView()
.getWorldViewTransformer();
Geometry geometry = worldViewTransformer.worldToPan(feature.getGeometry());
ShapeStyle style = createStyleForFeature(feature);
PaintableGroup selectionGroup = feature.getLayer().getSelectionGroup();
context.getVectorContext().drawGroup(selectionGroup, feature);
String name = feature.getLayer().getId() + "-" + feature.getId();
if (geometry instanceof LineString) {
context.getVectorContext().drawLine(feature, name, (LineString) geometry, style);
} else if (geometry instanceof MultiLineString) {
MultiLineString m = (MultiLineString) geometry;
for (int i = 0; i < m.getNumGeometries(); i++) {
context.getVectorContext().drawLine(feature, name + "." + i, (LineString) m.getGeometryN(i), style);
}
} else if (geometry instanceof Polygon) {
context.getVectorContext().drawPolygon(feature, name, (Polygon) geometry, style);
} else if (geometry instanceof MultiPolygon) {
MultiPolygon m = (MultiPolygon) geometry;
for (int i = 0; i < m.getNumGeometries(); i++) {
context.getVectorContext().drawPolygon(feature, name + "." + i, (Polygon) m.getGeometryN(i), style);
}
} else if (geometry instanceof Point) {
if (hasImageSymbol(feature)) {
context.getVectorContext().drawSymbol(feature, name, geometry.getCoordinate(), null,
feature.getStyleId() + "-selection");
} else {
context.getVectorContext().drawSymbol(feature, name, geometry.getCoordinate(), style,
feature.getStyleId());
}
} else if (geometry instanceof MultiPoint) {
Coordinate[] coordinates = geometry.getCoordinates();
if (hasImageSymbol(feature)) {
for (int i = 0; i < coordinates.length; i++) {
context.getVectorContext().drawSymbol(feature, name + "." + i, coordinates[i], null,
feature.getStyleId() + "-selection");
}
} else {
for (int i = 0; i < coordinates.length; i++) {
context.getVectorContext().drawSymbol(feature, name + "." + i, coordinates[i], style,
feature.getStyleId());
}
}
}
}
}