diff --git a/src/org/openstreetmap/josm/actions/DownloadPrimitiveAction.java b/src/org/openstreetmap/josm/actions/DownloadPrimitiveAction.java
index b6af62e..c2abb91 100644
|
a
|
b
|
import static org.openstreetmap.josm.tools.I18n.trn;
|
| 9 | 9 | import java.awt.Font; |
| 10 | 10 | import java.awt.GridBagLayout; |
| 11 | 11 | import java.awt.event.ActionEvent; |
| | 12 | import java.awt.event.ActionListener; |
| 12 | 13 | import java.awt.event.KeyEvent; |
| 13 | 14 | import java.lang.reflect.InvocationTargetException; |
| 14 | 15 | import java.util.Collections; |
| … |
… |
public class DownloadPrimitiveAction extends JosmAction {
|
| 93 | 94 | layout.setAutoCreateContainerGaps(true); |
| 94 | 95 | |
| 95 | 96 | JLabel lbl1 = new JLabel(tr("Object type:")); |
| 96 | | OsmPrimitiveTypesComboBox cbType = new OsmPrimitiveTypesComboBox(); |
| | 97 | final OsmPrimitiveTypesComboBox cbType = new OsmPrimitiveTypesComboBox(); |
| 97 | 98 | cbType.addItem(trc("osm object types", "mixed")); |
| 98 | 99 | cbType.setToolTipText(tr("Choose the OSM object type")); |
| 99 | 100 | JLabel lbl2 = new JLabel(tr("Object ID:")); |
| … |
… |
public class DownloadPrimitiveAction extends JosmAction {
|
| 112 | 113 | JCheckBox layer = new JCheckBox(tr("Separate Layer")); |
| 113 | 114 | layer.setToolTipText(tr("Select if the data should be downloaded into a new layer")); |
| 114 | 115 | layer.setSelected(Main.pref.getBoolean("download.newlayer")); |
| 115 | | JCheckBox referrers = new JCheckBox(tr("Download referrers")); |
| 116 | | referrers.setToolTipText(tr("Select if the referrers of the object should be downloaded as well")); |
| | 116 | final JCheckBox referrers = new JCheckBox(tr("Download referrers (parent relations)")); |
| | 117 | referrers.setToolTipText(tr("Select if the referrers of the object should be downloaded as well, i.e.," |
| | 118 | + "parent relations and for nodes, additionally, parent ways")); |
| 117 | 119 | referrers.setSelected(Main.pref.getBoolean("downloadprimitive.referrers")); |
| | 120 | JCheckBox full = new JCheckBox(tr("Download relation members")); |
| | 121 | full.setToolTipText(tr("Select if the members of a relation should be downloaded as well")); |
| | 122 | full.setSelected(Main.pref.getBoolean("downloadprimitive.full", true)); |
| 118 | 123 | HtmlPanel help = new HtmlPanel(tr("Object IDs can be separated by comma or space.<br/>" |
| 119 | 124 | + " Examples: <b><ul><li>1 2 5</li><li>1,2,5</li></ul><br/></b>" |
| 120 | 125 | + " In mixed mode, specify objects like this: <b>w123, n110, w12, r15</b><br/>")); |
| … |
… |
public class DownloadPrimitiveAction extends JosmAction {
|
| 128 | 133 | .addComponent(lbl2) |
| 129 | 134 | .addComponent(cbId, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) |
| 130 | 135 | .addComponent(referrers) |
| | 136 | .addComponent(full) |
| 131 | 137 | .addComponent(layer) |
| 132 | 138 | .addComponent(help) |
| 133 | 139 | ); |
| 134 | 140 | |
| | 141 | cbType.addActionListener(new ActionListener() { |
| | 142 | |
| | 143 | @Override |
| | 144 | public void actionPerformed(ActionEvent ae) { |
| | 145 | referrers.setText(cbType.getType() == OsmPrimitiveType.NODE |
| | 146 | ? tr("Download referrers (parent relations and ways)") |
| | 147 | : tr("Download referrers (parent relations)")); |
| | 148 | } |
| | 149 | }); |
| | 150 | |
| 135 | 151 | layout.setHorizontalGroup(layout.createParallelGroup() |
| 136 | 152 | .addGroup(layout.createSequentialGroup() |
| 137 | 153 | .addGroup(layout.createParallelGroup() |
| … |
… |
public class DownloadPrimitiveAction extends JosmAction {
|
| 143 | 159 | .addComponent(cbId)) |
| 144 | 160 | ) |
| 145 | 161 | .addComponent(referrers) |
| | 162 | .addComponent(full) |
| 146 | 163 | .addComponent(layer) |
| 147 | 164 | .addComponent(help) |
| 148 | 165 | ); |
| … |
… |
public class DownloadPrimitiveAction extends JosmAction {
|
| 178 | 195 | return; |
| 179 | 196 | } |
| 180 | 197 | remindPrimitivesHistory(cbId); |
| 181 | | processItems(layer.isSelected(), tfId.getIds(), referrers.isSelected()); |
| | 198 | processItems(layer.isSelected(), tfId.getIds(), referrers.isSelected(), full.isSelected()); |
| 182 | 199 | } |
| 183 | 200 | |
| 184 | | void processItems(boolean newLayer, final List<PrimitiveId> ids, boolean downloadReferrers) { |
| | 201 | void processItems(boolean newLayer, final List<PrimitiveId> ids, boolean downloadReferrers, boolean full) { |
| 185 | 202 | OsmDataLayer layer = getEditLayer(); |
| 186 | 203 | if ((layer == null) || newLayer) { |
| 187 | 204 | layer = new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null); |
| 188 | 205 | Main.main.addLayer(layer); |
| 189 | 206 | } |
| 190 | | final DownloadPrimitivesTask task = new DownloadPrimitivesTask(layer, ids); |
| | 207 | final DownloadPrimitivesTask task = new DownloadPrimitivesTask(layer, ids, full); |
| 191 | 208 | Main.worker.submit(task); |
| 192 | 209 | |
| 193 | 210 | if (downloadReferrers) { |
diff --git a/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java b/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java
index 2cd6764..c1433d6 100644
|
a
|
b
|
public class DownloadPrimitivesTask extends PleaseWaitRunnable {
|
| 38 | 38 | private Set<PrimitiveId> missingPrimitives; |
| 39 | 39 | |
| 40 | 40 | private OsmDataLayer layer; |
| | 41 | private boolean fullRelation; |
| 41 | 42 | private MultiFetchServerObjectReader multiObjectReader; |
| 42 | 43 | private OsmServerObjectReader objectReader; |
| 43 | 44 | |
| … |
… |
public class DownloadPrimitivesTask extends PleaseWaitRunnable {
|
| 47 | 48 | * @param layer the layer in which primitives are updated. Must not be null. |
| 48 | 49 | * @param toUpdate a collection of primitives to update from the server. Set to |
| 49 | 50 | * the empty collection if null. |
| | 51 | * @param fullRelation true if a full download is required, i.e., |
| | 52 | * a download including the immediate children of a relation. |
| 50 | 53 | * @throws IllegalArgumentException thrown if layer is null. |
| 51 | 54 | */ |
| 52 | | public DownloadPrimitivesTask(OsmDataLayer layer, List<PrimitiveId> ids) throws IllegalArgumentException { |
| | 55 | public DownloadPrimitivesTask(OsmDataLayer layer, List<PrimitiveId> ids, boolean fullRelation) throws IllegalArgumentException { |
| 53 | 56 | super(tr("Download objects"), false /* don't ignore exception */); |
| 54 | 57 | ensureParameterNotNull(layer, "layer"); |
| 55 | 58 | this.ids = ids; |
| 56 | 59 | this.layer = layer; |
| | 60 | this.fullRelation = fullRelation; |
| 57 | 61 | } |
| 58 | 62 | |
| 59 | 63 | @Override |
| … |
… |
public class DownloadPrimitivesTask extends PleaseWaitRunnable {
|
| 144 | 148 | if (r.hasIncompleteMembers()) { |
| 145 | 149 | synchronized(this) { |
| 146 | 150 | if (canceled) return; |
| 147 | | objectReader = new OsmServerObjectReader(r.getId(), OsmPrimitiveType.RELATION, true /* full */); |
| | 151 | objectReader = new OsmServerObjectReader(r.getId(), OsmPrimitiveType.RELATION, fullRelation); |
| 148 | 152 | } |
| 149 | 153 | theirDataSet = objectReader.parseOsm(progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)); |
| 150 | 154 | synchronized (this) { |