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

Reply via email to