final ReferencedEnvelope env = new ReferencedEnvelope(fs.getBounds(),
CRS.decode("EPSG:3004"));
LOGGER.info("about to create map ctx for ProjectedPolygon with bounds " + env);
final WMSMapContent map = new WMSMapContent();
CoordinateReferenceSystem sourceCrs = CRS.decode("EPSG:3004");
CoordinateReferenceSystem targetCrs = CRS.decode("EPSG:3003");
MathTransform transform = CRS.findMathTransform(sourceCrs, targetCrs, true);
Envelope projEnv = JTS.transform(env, transform);
ReferencedEnvelope refEnv = new ReferencedEnvelope(projEnv, targetCrs);
map.getViewport().setBounds(refEnv);
map.setMapWidth(mapWidth);
map.setMapHeight(mapHeight);
map.setBgColor(Color.red);
map.setTransparent(false);
map.getViewport().setCoordinateReferenceSystem(targetCrs);
Style basicStyle = getTestStyle("BasicPolygons.sld");
map.addLayer(new FeatureLayer(fs, basicStyle));
EncodeHTMLImageMap result = mapProducer.produceMap(map);
assertTestResult("ProjectedPolygon", result);
}