@@ -5,6 +5,7 @@ import geoscript.geom.Point
55import geoscript.layer.Raster
66import geoscript.layer.Renderable
77import geoscript.proj.Projection
8+ import org.geotools.referencing.operation.projection.MapProjection
89
910import javax.imageio.ImageIO
1011import java.awt.Color
@@ -53,6 +54,8 @@ class MapCube {
5354
5455 void render (List<Renderable > layers , OutputStream out ) {
5556
57+ MapProjection . SKIP_SANITY_CHECKS = true
58+
5659 BufferedImage image = new BufferedImage (1800 , 1500 , BufferedImage . TYPE_INT_ARGB )
5760 Graphics2D g2d = image. createGraphics()
5861 g2d. paint = java.awt.Color . WHITE
@@ -88,8 +91,8 @@ class MapCube {
8891 [id : " 5" , image : [500 , 940 ], center : new Point (-45 , -90 + 0.1 ), bounds : new Bounds (-180.0 , -45.0 , 180.0 , -90.0 , " EPSG:4326" )]
8992 ]
9093
91- cubes . each { java.util.Map cube ->
92- if (preRaster) {
94+ if (preRaster) {
95+ cubes . each { java.util.Map cube ->
9396 Point center = cube. center
9497 Projection p = new Projection (" AUTO:97001,9001,${ center.x} ,${ center.y} " )
9598 Bounds b = cube. bounds. reproject(p)
@@ -106,7 +109,10 @@ class MapCube {
106109 BufferedImage img = map. renderToImage()
107110 g2d. drawImage(img, cube. image[0 ], cube. image[1 ], null )
108111 }
109- if (drawOutline) {
112+ }
113+
114+ if (drawOutline) {
115+ cubes. each { java.util.Map cube ->
110116 g2d. paint = new Color (0 , 0 , 0 )
111117 g2d. drawRect(cube. image[0 ], cube. image[1 ], 400 , 400 )
112118 }
@@ -142,6 +148,7 @@ class MapCube {
142148 ImageIO . write(image, imageType, out)
143149 out. close()
144150
151+ MapProjection . SKIP_SANITY_CHECKS = false
145152 }
146153
147154 protected void drawTab (Graphics2D g , int x , int y , String side , int tab ) {
0 commit comments