Changeset 8221 in josm for trunk


Ignore:
Timestamp:
2015-04-18T16:54:05+02:00 (10 years ago)
Author:
simon04
Message:

see #11000 - Remote control: allow to specify layer_name for load_and_zoom, load_object

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/DownloadPrimitiveAction.java

    r6973 r8221  
    4949    public static void processItems(boolean newLayer, final List<PrimitiveId> ids, boolean downloadReferrers, boolean full) {
    5050        final DownloadPrimitivesWithReferrersTask task =
    51                 new DownloadPrimitivesWithReferrersTask(newLayer, ids, downloadReferrers, full, null);
     51                new DownloadPrimitivesWithReferrersTask(newLayer, ids, downloadReferrers, full, null, null);
    5252        Main.worker.submit(task);
    5353        Main.worker.submit(new Runnable() {
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesWithReferrersTask.java

    r7896 r8221  
    6464     *     i.e., parent relations, and for nodes, additionally, parent ways
    6565     * @param full if the members of a relation should be downloaded as well
     66     * @param newLayerName the name to use for the new layer, can be {@code null}.
    6667     * @param monitor ProgressMonitor to use, or null to create a new one
    6768     */
    6869    public DownloadPrimitivesWithReferrersTask(boolean newLayer, List<PrimitiveId> ids, boolean downloadReferrers,
    69             boolean full, ProgressMonitor monitor) {
     70            boolean full, String newLayerName, ProgressMonitor monitor) {
    7071        super(tr("Download objects"), monitor, false);
    7172        this.ids = ids;
     
    7475        this.newLayer = newLayer;
    7576        // All downloaded primitives are put in a tmpLayer
    76         tmpLayer = new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null);
     77        tmpLayer = new OsmDataLayer(new DataSet(), newLayerName != null ? newLayerName : OsmDataLayer.createNewName(), null);
    7778    }
    7879
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java

    r7937 r8221  
    7373    @Override
    7474    public String[] getOptionalParams() {
    75         return new String[] {"new_layer", "addtags", "select", "zoom_mode", "changeset_comment", "changeset_source", "search"};
     75        return new String[] {"new_layer", "layer_name", "addtags", "select", "zoom_mode", "changeset_comment", "changeset_source", "search"};
    7676    }
    7777
     
    102102    @Override
    103103    protected void handleRequest() throws RequestHandlerErrorException {
    104         DownloadTask osmTask = new DownloadOsmTask();
     104        DownloadTask osmTask = new DownloadOsmTask() {
     105            {
     106                newLayerName = args.get("layer_name");
     107            }
     108        };
    105109        try {
    106110            boolean newLayer = isLoadInNewLayer();
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java

    r7937 r8221  
    4040    @Override
    4141    public String[] getOptionalParams() {
    42         return new String[] {"new_layer", "addtags", "relation_members", "referrers"};
     42        return new String[] {"new_layer", "layer_name", "addtags", "relation_members", "referrers"};
    4343    }
    4444
     
    6464            final boolean newLayer = isLoadInNewLayer();
    6565            final boolean relationMembers = Boolean.parseBoolean(args.get("relation_members"));
    66             final boolean referrers = args.containsKey("referrers") ? Boolean.parseBoolean(args.get("referrers")) : true;
     66            final boolean referrers = Boolean.parseBoolean(args.get("referrers"));
    6767            final DownloadPrimitivesWithReferrersTask task = new DownloadPrimitivesWithReferrersTask(
    68                     newLayer, ps, referrers, relationMembers, null);
     68                    newLayer, ps, referrers, relationMembers, args.get("layer_name"), null);
    6969            Main.worker.submit(task);
    7070            Main.worker.submit(new Runnable() {
Note: See TracChangeset for help on using the changeset viewer.