Changeset 25083 in osm for applications/editors/josm
- Timestamp:
- 2011-01-16T19:47:42+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/scripting/scripts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/scripting/scripts/HelloWorld.groovy
r25071 r25083 1 /* 2 * HelloWorld.groovy - displays the number of actually open layers 3 */ 1 4 import javax.swing.JOptionPane; 2 5 import org.openstreetmap.josm.Main; 3 6 7 def numlayers = Main.main?.map?.mapView?.numLayers 8 if (numlayers == null) numlayers = 0 4 9 5 JOptionPane.showMessageDialog(Main.parent, "[Groovy] Hello World! ")10 JOptionPane.showMessageDialog(Main.parent, "[Groovy] Hello World!\nYou have ${numlayers} layer(s).") -
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 -
applications/editors/josm/plugins/scripting/scripts/HelloWorld.py
r25072 r25083 1 1 # 2 # HelloWorld.py - sample JOSM script in Python2 # HelloWorld.py - displays the number of actually open layers 3 3 # 4 4 from javax.swing import JOptionPane 5 5 from org.openstreetmap.josm import Main 6 6 7 JOptionPane.showMessageDialog(Main.parent, "[Python] Hello World!") 7 def getMapView(): 8 if Main.main == None: 9 return None 10 if Main.main.map == None: 11 return None 12 return Main.main.map.mapView 13 14 15 numlayers = 0 16 mv = getMapView() 17 if mv != None: 18 numlayers = mv.getNumLayers() 19 20 JOptionPane.showMessageDialog(Main.parent, "[Python] Hello World! You have %s layer(s)." % numlayers)
Note:
See TracChangeset
for help on using the changeset viewer.