Problem for accessing to OSM WayList

Mike Thompson miketho16 at gmail.com
Tue Jan 12 18:57:10 UTC 2021


Might be better ways of doing this, but this worked for me:

    import org.openstreetmap.josm.gui.MainApplication;
    import org.openstreetmap.josm.data.osm.DataSet;

    DataSet activeDataSet =
MainApplication.getLayerManager().getActiveDataSet();
    Collection<OsmPrimitive> allSelected =
activeDataSet.getAllSelected();    // There is also a method to just get
the ways that are selected.

    Iterator itr = activeDataSet.getNodes().iterator();
    while (itr.hasNext()) {
        // do something
    }

Mike

On Tue, Jan 12, 2021 at 4:43 AM Volodia EL AZIMANI <
volodia.el.azimani at gmail.com> wrote:

> Hey,
>
> I have created a plugin for JOSM and I want to access the WayList on
> Selection windows (as you can see on picture).
> I want to access all the ways on the list and make a zoom on each component
> (Same action than Right-Click -> Zoom on selected element).
>
> Best regards,
>
> EL AZIMANI Volodia
>


More information about the josm-dev mailing list