@@ -2,6 +2,7 @@ package org.geoshell.map
22
33import geoscript.geom.Bounds
44import geoscript.proj.Projection
5+ import geoscript.render.MapCube
56import geoscript.render.MapWindow
67import geoscript.render.Window
78import org.geoshell.Catalog
@@ -197,4 +198,33 @@ class MapCommands implements CommandMarker {
197198 " Unable to find Map ${ name} "
198199 }
199200 }
201+
202+ @CliCommand (value = " map cube" , help = " Draw a map cube." )
203+ String renderMapCube (
204+ @CliOption (key = " name" , mandatory = true , help = " The map name" ) MapName name ,
205+ @CliOption (key = " draw-outline" , mandatory = false , specifiedDefaultValue = " false" , unspecifiedDefaultValue = " false" , help = " Whether to draw outline or now" ) boolean drawOutline ,
206+ @CliOption (key = " draw-tabs" , mandatory = false , specifiedDefaultValue = " false" , unspecifiedDefaultValue = " false" , help = " Whether to draw tabs or not" ) boolean drawTabs ,
207+ @CliOption (key = " tab-size" , mandatory = false , unspecifiedDefaultValue = " 30" , specifiedDefaultValue = " 30" , help = " The size of the tabs" ) int tabSize ,
208+ @CliOption (key = " title" , mandatory = false , unspecifiedDefaultValue = " " , specifiedDefaultValue = " " , help = " The map title" ) String title ,
209+ @CliOption (key = " source" , mandatory = false , unspecifiedDefaultValue = " " , specifiedDefaultValue = " " , help = " The map source" ) String source ,
210+ @CliOption (key = " type" , mandatory = false , unspecifiedDefaultValue = " png" , specifiedDefaultValue = " png" , help = " The type" ) String type ,
211+ @CliOption (key = " file" , mandatory = false , help = " The file" ) File file
212+ ) throws Exception {
213+ org.geoshell.map.Map map = catalog. maps[name]
214+ if (map) {
215+ MapCube mapCube = new MapCube (
216+ drawOutline : drawOutline,
217+ drawTabs : drawTabs,
218+ tabSize : tabSize,
219+ title : title,
220+ source : source,
221+ imageType : type
222+ )
223+ file = file ? file : new File (" image.${ type} " )
224+ mapCube. render(map. getLayers(), file)
225+ " Done drawing ${ file.absolutePath} !"
226+ } else {
227+ " Unable to find Map ${ name} "
228+ }
229+ }
200230}
0 commit comments