import java.awt.*
import java.awt.BorderLayout as BL
import javax.swing.WindowConstants as WC
import org.jdesktop.swingx.mapviewer.*
import org.jdesktop.swingx.JXMapViewer
import groovy.swing.SwingBuilder
def mapViewer =
new JXMapViewer
()
def tfi =
new TileFactoryInfo
(0,
20,
17,
256,
true,
true,
"http://mt.google.com/mt?w=2.43",
"x",
"y",
"zoom")
mapViewer.
tileFactory =
new DefaultTileFactory
(tfi
)
mapViewer.
zoom =
9
mapViewer.
centerPosition =
[43.835,
2.329]
mapViewer.
preferredSize =
[800,
600]
frame =
new SwingBuilder
().
frame(title:
'Groovy Maps', defaultCloseOperation: WC.
DISPOSE_ON_CLOSE) {
panel
(layout:
new BL
()) {
panel
(constraints: BL.
CENTER) { widget
(mapViewer
) }
panel
(constraints: BL.
SOUTH) {
button
(text:
"+", actionPerformed:
{ mapViewer.
zoom -=
1 })
button
(text:
"-", actionPerformed:
{ mapViewer.
zoom +=
1 })
}
}
}
frame.
pack()
frame.
visible =
true