Changeset 4497 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2011-10-07T21:50:14+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/DownloadPrimitiveAction.java
r4343 r4497 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; … … 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")); … … 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>" … … 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 ); 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 }); 134 150 135 151 layout.setHorizontalGroup(layout.createParallelGroup() … … 144 160 ) 145 161 .addComponent(referrers) 162 .addComponent(full) 146 163 .addComponent(layer) 147 164 .addComponent(help) … … 165 182 Main.pref.putInteger("downloadprimitive.lasttype", cbType.getSelectedIndex()); 166 183 Main.pref.put("downloadprimitive.referrers", referrers.isSelected()); 184 Main.pref.put("downloadprimitive.full", full.isSelected()); 167 185 Main.pref.put("download.newlayer", layer.isSelected()); 168 186 … … 179 197 } 180 198 remindPrimitivesHistory(cbId); 181 processItems(layer.isSelected(), tfId.getIds(), referrers.isSelected() );182 } 183 184 void processItems(boolean newLayer, final List<PrimitiveId> ids, boolean downloadReferrers ) {199 processItems(layer.isSelected(), tfId.getIds(), referrers.isSelected(), full.isSelected()); 200 } 201 202 void processItems(boolean newLayer, final List<PrimitiveId> ids, boolean downloadReferrers, boolean full) { 185 203 OsmDataLayer layer = getEditLayer(); 186 204 if ((layer == null) || newLayer) { … … 188 206 Main.main.addLayer(layer); 189 207 } 190 final DownloadPrimitivesTask task = new DownloadPrimitivesTask(layer, ids );208 final DownloadPrimitivesTask task = new DownloadPrimitivesTask(layer, ids, full); 191 209 Main.worker.submit(task); 192 210 -
trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java
r4191 r4497 39 39 40 40 private OsmDataLayer layer; 41 private boolean fullRelation; 41 42 private MultiFetchServerObjectReader multiObjectReader; 42 43 private OsmServerObjectReader objectReader; … … 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 … … 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));
Note:
See TracChangeset
for help on using the changeset viewer.