Changeset 4106 in josm
- Timestamp:
- 2011-06-01T20:23:46+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r4102 r4106 27 27 import java.util.Comparator; 28 28 import java.util.HashMap; 29 import java.util.HashSet; 29 30 import java.util.Iterator; 30 31 import java.util.List; … … 33 34 import java.util.TreeMap; 34 35 import java.util.Vector; 36 import java.util.Set; 35 37 36 38 import javax.swing.AbstractAction; … … 81 83 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 82 84 import org.openstreetmap.josm.gui.dialogs.properties.PresetListPanel.PresetHandler; 85 import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationMemberTask; 83 86 import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor; 84 87 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 606 609 menu.add(new SelectRelationAction(relation, true)); 607 610 menu.add(new SelectRelationAction(relation, false)); 611 menu.add(new SelectRelationMembersAction(relation)); 612 menu.add(new DownloadIncompleteMembersAction(relation)); 608 613 menu.addSeparator(); 609 614 menu.add(helpAction); … … 1183 1188 } 1184 1189 } 1190 1191 1192 /** 1193 * Sets the current selection to the members of selected relation 1194 * 1195 */ 1196 class SelectRelationMembersAction extends AbstractAction { 1197 Relation relation; 1198 public SelectRelationMembersAction(Relation r) { 1199 relation = r; 1200 putValue(SHORT_DESCRIPTION,tr("Select the members of selected relation")); 1201 putValue(SMALL_ICON, ImageProvider.get("selectall")); 1202 putValue(NAME, tr("Select members")); 1203 } 1204 1205 public void actionPerformed(ActionEvent e) { 1206 HashSet<OsmPrimitive> members = new HashSet<OsmPrimitive>(); 1207 members.addAll(relation.getMemberPrimitives()); 1208 Main.map.mapView.getEditLayer().data.setSelected(members); 1209 } 1210 1211 } 1212 1213 /** 1214 * Action for downloading incomplete members of selected relation 1215 * 1216 */ 1217 class DownloadIncompleteMembersAction extends AbstractAction { 1218 Relation relation; 1219 public DownloadIncompleteMembersAction(Relation r) { 1220 relation = r; 1221 putValue(SHORT_DESCRIPTION, tr("Download incomplete members of selected relations")); 1222 putValue(SMALL_ICON, ImageProvider.get("dialogs/relation", "downloadincompleteselected")); 1223 putValue(NAME, tr("Download incomplete members")); 1224 } 1225 1226 public Set<OsmPrimitive> buildSetOfIncompleteMembers(Relation r) { 1227 Set<OsmPrimitive> ret = new HashSet<OsmPrimitive>(); 1228 ret.addAll(r.getIncompleteMembers()); 1229 return ret; 1230 } 1231 1232 public void actionPerformed(ActionEvent e) { 1233 if (!relation.hasIncompleteMembers()) return; 1234 ArrayList<Relation> rels = new ArrayList<Relation>(); 1235 rels.add(relation); 1236 Main.worker.submit(new DownloadRelationMemberTask( 1237 rels, 1238 buildSetOfIncompleteMembers(relation), 1239 Main.map.mapView.getEditLayer() 1240 )); 1241 } 1242 } 1243 1244 1185 1245 }
Note:
See TracChangeset
for help on using the changeset viewer.