Problem for accessing to OSM WayList

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem for accessing to OSM WayList

Volodia EL AZIMANI
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
Reply | Threaded
Open this post in threaded view
|

Re: Problem for accessing to OSM WayList

Mike Thompson
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 <
[hidden email]> 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
>