protected LiteShape2 createShape(Symbolizer symbolizer, double w, double h) {
try {
if (symbolizer instanceof LineSymbolizer) {
if (line == null) {
List<Coordinate> coords = new ArrayList<Coordinate>();
coords.add(new Coordinate(0, 0));
coords.add(new Coordinate(0.75 * w, 0.25 * h));
coords.add(new Coordinate(0.25 * w, 0.75 * h));
coords.add(new Coordinate(w, h));
LineString linestring = geometryFactory.createLineString(
coords.toArray(new Coordinate[coords.size()]));
line = new LiteShape2(linestring, null, null, false);
}
return line;
} else if (symbolizer instanceof PolygonSymbolizer) {
if (polygon == null) {
List<Coordinate> coords = new ArrayList<Coordinate>();
coords.add(new Coordinate(0, 0));
coords.add(new Coordinate(w, 0));
coords.add(new Coordinate(w, h));
coords.add(new Coordinate(0, h));
coords.add(new Coordinate(0, 0));
LinearRing ring = geometryFactory.createLinearRing(coords.toArray(new Coordinate[coords.size()]));
Polygon p = geometryFactory.createPolygon(ring, null);
polygon = new LiteShape2(p, null, null, false);
}
return polygon;
} else if (symbolizer instanceof PointSymbolizer) {
if (point == null) {
Coordinate coord = new Coordinate(w / 2, h / 2);
Point p = geometryFactory.createPoint(coord);
point = new LiteShape2(p, null, null, false);
}
return point;
} else {