Line | |
---|
1 | /*
|
---|
2 | * HelloWorld.js - displays the number of actually open layers
|
---|
3 | */
|
---|
4 | importClass(Packages.javax.swing.JOptionPane)
|
---|
5 | importClass(Packages.org.openstreetmap.josm.Main)
|
---|
6 |
|
---|
7 | function getMapView() {
|
---|
8 | if (Main.main == null) return null
|
---|
9 | if (Main.main.map == null) return null
|
---|
10 | return Main.main.map.mapView
|
---|
11 | }
|
---|
12 |
|
---|
13 | var numlayers = 0
|
---|
14 | var mv = getMapView()
|
---|
15 | if (mv != null){
|
---|
16 | numlayers = mv.getNumLayers()
|
---|
17 | }
|
---|
18 | JOptionPane.showMessageDialog(Main.parent, "[JavaScript] Hello World! You have " + numlayers + " layer(s).")
|
---|
19 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.