public Shape getTransformedShape(float x, float y, float rotation) {
if (shape != null) {
Rectangle2D bounds = shape.getBounds2D();
double shapeSize = (maxMarkSizeEnabled ? Math.max(bounds.getWidth(), bounds.getHeight()) : bounds.getHeight());
double scale = size / shapeSize;
TransformedShape ts = new TransformedShape();
ts.shape = shape;
ts.translate(x, y);
ts.rotate(rotation);
// flip the symbol to take into account the screen orientation
// where the y grows from top to bottom
ts.scale(scale, -scale);
return ts;
} else {
return null;
}