[josm-dev] JOSM tested

2011-04-14 Thread Paul Hartmann

Hi,

We have released 4021 as a new tested version. 


The problem regarding the Licence Change Phase III is (hopefully) fixed. Please 
keep the repository stable until the changes to the server are implemented, so 
we can add a point release if necessary.

Paul

___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] Scripting plugin

2011-04-14 Thread Paul Hartmann

Jo wrote:

I'm back on track with the scripting plugin. I created a Jython script that
helps to find probable spelling errors in street names. It's quite specific
in that it supports the bilingual status of Brussels.

#!/bin/jython

#
# Spell checking.py  - Helps to locate probable spell errors
#
from javax.swing import JOptionPane
from org.openstreetmap.josm import Main
import org.openstreetmap.josm.command as Command
import org.openstreetmap.josm.data.osm.Node as Node
import org.openstreetmap.josm.data.osm.Way as Way
import org.openstreetmap.josm.data.osm.TagCollection as TagCollection
import org.openstreetmap.josm.data.osm.DataSet as DataSet

corrections = {'fr': [('Dr. ', 'Docteur '),('R. ', 'Rue '), ('Av. ',
'Avenue '), ('Bd. ', 'Boulevard '),
  ('Sq.', 'Square'), ('Pl.', 'Place'),
  (' De ', ' de '), (' Le ', ' le '), (' La ', ' la '),
(' Du ', ' du '), (' Des ', ' des '), (' Les ', ' les '),
  (' Au ', ' au '),(' Aux ', ' aux '),('À', 'à'),(' Den
',' den '), ( Sur ,  sur ),
  ( D', d'), ( L', l'), (' ,'),
  (Ecole ,École ), (Eglise, Église),
(Chateau, Château), (Cable, Câble), (General, Général)],
   'nl': [( Voor ,  voor ), ( Op ,  op ), ( Pour , 
pour ), ( Naar ,  naar ), ( Ter ,  ter ), ( En ,  en ), ( Van
,  van ),
  ('T , 't ), ('S , 's ), (-Ter-, -ter-),
( Het ,  het ),
  ( Straat, straat), ( Weg, weg), ( Laan,
laan), ( Steenweg, steenweg),
  ( Baan, baan), (Oudebaan, Oude Baan),
(Grotebaan, Grote Baan),
  (de Lijn, De Lijn)]}

commandsList = []
streetnames = {}

def getMapView():
if Main.main and Main.main.map:
return Main.main.map.mapView
else:
return None

def myOwnCapitalize(word):
# JOptionPane.showMessageDialog(Main.parent, word.decode('utf-8'))
if word:
return word[0].upper() + word[1:]
else:
return u

mv = getMapView()

if mv and mv.editLayer and mv.editLayer.data:
selectedNodes = mv.editLayer.data.getSelectedNodes()
selectedWays = mv.editLayer.data.getWays()
selectedRelations = mv.editLayer.data.getSelectedRelations()

if not(selectedNodes or selectedWays or selectedRelations):
JOptionPane.showMessageDialog(Main.parent, Please select
something)
else:
for way in selectedWays:
for isoLang in ['nl', 'fr', '']:
correctedName = result = u''
if isoLang:
nameColonIso = 'name:' + isoLang
else:
nameColonIso = 'name'
if way.hasKey(nameColonIso):
name=str(way.get(nameColonIso).encode('utf-8'))
if name in streetnames:
if streetnames[name] == 'ignore':
continue
else:
correctedName = streetnames[name]
else:
Main.main.getCurrentDataSet().setSelected(way)
# dummy = mv.editLayer.data.getSelected()
#
mv.zoomTo(Main.main.getEditLayer().data.getSelected())
# JOptionPane.showMessageDialog(Main.parent,
name.decode('utf-8'))
for subname in name.split(;):
for word in subname.split( ):
if word:
if - in word and len(word)1:
dashes = word.split(-)

correctedName +=
myOwnCapitalize(dashes[0])
for dash in dashes[1:]:
# if dash[0] == ' ':
# correctedName += u- +
myOwnCapitalize(dash[1:])
# else:
correctedName += u- +
myOwnCapitalize(dash.strip())
elif ' in word and not(. in word):
apo=word.split(')
if apo[0]: correctedName +=
myOwnCapitalize(apo[0])
correctedName += '
if apo[1]: correctedName +=
myOwnCapitalize(apo[1])
elif . in word or len(word)1 and
word[1]==word[1].upper() or len(word)2 and word[2]==word[2].upper():
correctedName += word
else:
correctedName +=
myOwnCapitalize(word)
correctedName += ' '
correctedName = correctedName.strip() + ';'
if correctedName and correctedName[-1] == ';':
correctedName = 

Re: [josm-dev] Scripting plugin

2011-04-14 Thread Jo
I will add it myself, but I'm still working on it, that's why I didn't do it
yet.

Cheers,

Polyglot

2011/4/14 Karl Guggisberg karl.guggisb...@guggis.ch

 A russian user created another script in JavaScript and announced it on the
 OSM blog. I've added a link to the ScriptingPlugin page,
 http://wiki.openstreetmap.org/wiki/JOSM/Plugins/Scripting. I'd like to add
 yours too, please let me know about an URL, if you publish it somewhere. Of
 course, you can add it to the Wiki yourself, if you want to.

 Regards
 Karl


 2011/4/14 Paul Hartmann phaau...@googlemail.com

 Jo wrote:

 I'm back on track with the scripting plugin. I created a Jython script
 that
 helps to find probable spelling errors in street names. It's quite
 specific
 in that it supports the bilingual status of Brussels.

 #!/bin/jython

 #
 # Spell checking.py  - Helps to locate probable spell errors
 #
 from javax.swing import JOptionPane
 from org.openstreetmap.josm import Main
 import org.openstreetmap.josm.command as Command
 import org.openstreetmap.josm.data.osm.Node as Node
 import org.openstreetmap.josm.data.osm.Way as Way
 import org.openstreetmap.josm.data.osm.TagCollection as TagCollection
 import org.openstreetmap.josm.data.osm.DataSet as DataSet

 corrections = {'fr': [('Dr. ', 'Docteur '),('R. ', 'Rue '), ('Av. ',
 'Avenue '), ('Bd. ', 'Boulevard '),
  ('Sq.', 'Square'), ('Pl.', 'Place'),
  (' De ', ' de '), (' Le ', ' le '), (' La ', ' la
 '),
 (' Du ', ' du '), (' Des ', ' des '), (' Les ', ' les '),
  (' Au ', ' au '),(' Aux ', ' aux '),('À', 'à'),('
 Den
 ',' den '), ( Sur ,  sur ),
  ( D', d'), ( L', l'), (' ,'),
  (Ecole ,École ), (Eglise, Église),
 (Chateau, Château), (Cable, Câble), (General, Général)],
   'nl': [( Voor ,  voor ), ( Op ,  op ), ( Pour ,
 
 pour ), ( Naar ,  naar ), ( Ter ,  ter ), ( En ,  en ), (
 Van
 ,  van ),
  ('T , 't ), ('S , 's ), (-Ter-, -ter-),
 ( Het ,  het ),
  ( Straat, straat), ( Weg, weg), ( Laan,
 laan), ( Steenweg, steenweg),
  ( Baan, baan), (Oudebaan, Oude Baan),
 (Grotebaan, Grote Baan),
  (de Lijn, De Lijn)]}

 commandsList = []
 streetnames = {}

 def getMapView():
if Main.main and Main.main.map:
return Main.main.map.mapView
else:
return None

 def myOwnCapitalize(word):
# JOptionPane.showMessageDialog(Main.parent, word.decode('utf-8'))
if word:
return word[0].upper() + word[1:]
else:
return u

 mv = getMapView()

 if mv and mv.editLayer and mv.editLayer.data:
selectedNodes = mv.editLayer.data.getSelectedNodes()
selectedWays = mv.editLayer.data.getWays()
selectedRelations = mv.editLayer.data.getSelectedRelations()

if not(selectedNodes or selectedWays or selectedRelations):
JOptionPane.showMessageDialog(Main.parent, Please select
 something)
else:
for way in selectedWays:
for isoLang in ['nl', 'fr', '']:
correctedName = result = u''
if isoLang:
nameColonIso = 'name:' + isoLang
else:
nameColonIso = 'name'
if way.hasKey(nameColonIso):
name=str(way.get(nameColonIso).encode('utf-8'))
if name in streetnames:
if streetnames[name] == 'ignore':
continue
else:
correctedName = streetnames[name]
else:
Main.main.getCurrentDataSet().setSelected(way)
# dummy = mv.editLayer.data.getSelected()
#
 mv.zoomTo(Main.main.getEditLayer().data.getSelected())
# JOptionPane.showMessageDialog(Main.parent,
 name.decode('utf-8'))
for subname in name.split(;):
for word in subname.split( ):
if word:
if - in word and len(word)1:
dashes = word.split(-)

correctedName +=
 myOwnCapitalize(dashes[0])
for dash in dashes[1:]:
# if dash[0] == ' ':
# correctedName += u- +
 myOwnCapitalize(dash[1:])
# else:
correctedName += u- +
 myOwnCapitalize(dash.strip())
elif ' in word and not(. in
 word):
apo=word.split(')
if apo[0]: correctedName +=
 myOwnCapitalize(apo[0])
correctedName += '