Changeset 25083 in osm for applications/editors/josm/plugins/scripting/scripts/HelloWorld.js
- Timestamp:
- 2011-01-16T19:47:42+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/scripting/scripts/HelloWorld.js
r25072 r25083 1 1 /* 2 * HelloWorld.js - sample JOSM script in JavaScript2 * HelloWorld.js - displays the number of actually open layers 3 3 */ 4 4 importClass(Packages.javax.swing.JOptionPane) 5 5 importClass(Packages.org.openstreetmap.josm.Main) 6 6 7 JOptionPane.showMessageDialog(Main.parent, "[JavaScript] Hello World!") 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 TracChangeset
for help on using the changeset viewer.