MapModel model = map.getModel();
writer.write(",rectangles:[");
for(Iterator<Rectangle> rectangles = model.getRectangles().iterator(); rectangles.hasNext();) {
Rectangle rectangle = (Rectangle) rectangles.next();
writer.write("new google.maps.Rectangle({");
writer.write("id:'" + rectangle.getId() + "'");
LatLng ne = rectangle.getBounds().getNorthEast();
LatLng sw = rectangle.getBounds().getSouthWest();
writer.write(",bounds:new google.maps.LatLngBounds( new google.maps.LatLng(" + ne.getLat() + "," + ne.getLng() +"), new google.maps.LatLng(" + sw.getLat() + "," + sw.getLng() +"))");
writer.write(",strokeOpacity:" + rectangle.getStrokeOpacity());
writer.write(",strokeWeight:" + rectangle.getStrokeWeight());
writer.write(",fillOpacity:" + rectangle.getFillOpacity());
if(rectangle.getStrokeColor() != null) writer.write(",strokeColor:'" + rectangle.getStrokeColor() + "'");
if(rectangle.getFillColor() != null) writer.write(",fillColor:'" + rectangle.getFillColor() + "'");
if(rectangle.getZindex() > Integer.MIN_VALUE) writer.write(",zIndex:" + rectangle.getZindex());
writer.write("})");
if(rectangles.hasNext())
writer.write(",");