Re: [josm-dev] perform GET from Jython script

2011-09-17 Thread Paul Hartmann
On 09/15/2011 08:08 PM, Jo wrote:
 Hi Paul,
 
 I know how to set something selected, but now I'd like to also zoom into
 this selection automatically. Could you point me in the right direction for
 accomplishing that?

Open MainMenu and look for these Actions in the View menu (that's how I
would do it).

 PS: did you see the examples I posted?

Yes, much appreciated. :)

Cheers, Paul

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


Re: [josm-dev] perform GET from Jython script

2011-09-17 Thread Paul Hartmann
On 09/17/2011 04:19 PM, Jo wrote:
 I don't get any further than this:
 
 from javax.swing import JOptionPane
 from org.openstreetmap.josm import Main
 import org.openstreetmap.josm.data.osm.Node as Node
 import org.openstreetmap.josm.data.osm.Way as Way
 import org.openstreetmap.josm.data.osm.Relation as Relation
 import org.openstreetmap.josm.data.osm.TagCollection as TagCollection
 import org.openstreetmap.josm.data.osm.DataSet as DataSet
 import org.openstreetmap.josm.data.osm.RelationMember as RelationMember
 
 def getMapView():
 if Main.main and Main.main.map:
 return Main.main.map.mapView
 else:
 return None
 
 mv = getMapView()
 if mv and mv.editLayer and mv.editLayer.data:
 selected = mv.editLayer.data.getSelected()
 
 if not(selected):
 JOptionPane.showMessageDialog(Main.parent, Please select
 something)
 else:
 for element in selected:
 print dir(element.getBBox())
 print element.getBBox().bounds
 mv.zoomTo(element.getBBox().bounds)
 
 Mapview has a method of zoomTo, but I have no clue as to what to feed it.

You can try AutoScaleAction.zoomToSelection() or
AutoScaleAction.autoScale(selection).

Cheers, Paul

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