Changeset 64 in josm for src/org/openstreetmap/josm/gui
- Timestamp:
- 2006-03-16T19:35:44+01:00 (20 years ago)
- Location:
- src/org/openstreetmap/josm/gui
- Files:
-
- 9 edited
-
ImageProvider.java (modified) (1 diff)
-
MapStatus.java (modified) (2 diffs)
-
NavigatableComponent.java (modified) (6 diffs)
-
PreferenceDialog.java (modified) (1 diff)
-
SelectionManager.java (modified) (3 diffs)
-
dialogs/PropertiesDialog.java (modified) (7 diffs)
-
dialogs/SelectionListDialog.java (modified) (3 diffs)
-
layer/OsmDataLayer.java (modified) (4 diffs)
-
layer/RawGpsDataLayer.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/gui/ImageProvider.java
r41 r64 43 43 subdir += "/"; 44 44 URL path = Main.class.getResource("/images/"+subdir+name+".png"); 45 if (path == null) 46 throw new NullPointerException("/images/"+subdir+name+".png not found"); 45 47 ImageIcon icon = cache.get(path); 46 48 if (icon == null) { -
src/org/openstreetmap/josm/gui/MapStatus.java
r56 r64 28 28 import org.openstreetmap.josm.Main; 29 29 import org.openstreetmap.josm.data.GeoPoint; 30 import org.openstreetmap.josm.data.osm.Key;31 30 import org.openstreetmap.josm.data.osm.OsmPrimitive; 32 31 import org.openstreetmap.josm.data.osm.visitor.SelectionComponentVisitor; … … 141 140 text.append("<br>id="+osm.id); 142 141 if (osm.keys != null) 143 for (Entry< Key, String> e : osm.keys.entrySet())144 text.append("<br>"+e.getKey() .name+"="+e.getValue());142 for (Entry<String, String> e : osm.keys.entrySet()) 143 text.append("<br>"+e.getKey()+"="+e.getValue()); 145 144 final JLabel l = new JLabel("<html>"+text.toString()+"</html>", visitor.icon, JLabel.HORIZONTAL); 146 145 l.setFont(l.getFont().deriveFont(Font.PLAIN)); -
src/org/openstreetmap/josm/gui/NavigatableComponent.java
r42 r64 12 12 import org.openstreetmap.josm.data.osm.Node; 13 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 import org.openstreetmap.josm.data.osm. Track;14 import org.openstreetmap.josm.data.osm.Way; 15 15 import org.openstreetmap.josm.data.projection.Projection; 16 16 … … 118 118 * If no such line segment is found, and a non-pending line segment is 119 119 * within 10 pixel to p, this segment is returned, except when 120 * <code>whole Track</code> is <code>true</code>, in which case the121 * corresponding Trackis returned.120 * <code>wholeWay</code> is <code>true</code>, in which case the 121 * corresponding Way is returned. 122 122 * 123 123 * If no line segment is found and the point is within an area, return that … … 127 127 * 128 128 * @param p The point on screen. 129 * @param lsInstead TrackWhether the line segment (true) or only the whole130 * trackshould be returned.129 * @param lsInsteadWay Whether the line segment (true) or only the whole 130 * way should be returned. 131 131 * @return The primitive, that is nearest to the point p. 132 132 */ 133 public OsmPrimitive getNearest(Point p, boolean lsInstead Track) {133 public OsmPrimitive getNearest(Point p, boolean lsInsteadWay) { 134 134 double minDistanceSq = Double.MAX_VALUE; 135 135 OsmPrimitive minPrimitive = null; … … 149 149 return minPrimitive; 150 150 151 // for whole tracks, try thetracks first151 // for whole waies, try the waies first 152 152 minDistanceSq = Double.MAX_VALUE; 153 if (!lsInstead Track) {154 for ( Trackt : Main.main.ds.tracks) {153 if (!lsInsteadWay) { 154 for (Way t : Main.main.ds.waies) { 155 155 if (t.isDeleted()) 156 156 continue; … … 201 201 * If its a node, return all line segments and 202 202 * streets the node is part of, as well as all nodes 203 * (with their line segments and tracks) with the same203 * (with their line segments and waies) with the same 204 204 * location. 205 205 * 206 * If its a line segment, return all tracks this segment206 * If its a line segment, return all waies this segment 207 207 * belongs to as well as all line segments that are between 208 * the same nodes (in both direction) with all their tracks.208 * the same nodes (in both direction) with all their waies. 209 209 * 210 210 * @return A collection of all items or <code>null</code> … … 235 235 } 236 236 if (osm instanceof Node || osm instanceof LineSegment) { 237 for ( Trackt : Main.main.ds.tracks) {237 for (Way t : Main.main.ds.waies) { 238 238 if (t.isDeleted()) 239 239 continue; -
src/org/openstreetmap/josm/gui/PreferenceDialog.java
r43 r64 177 177 "An example: \"ignore ignore lat lon\" will use ' ' as delimiter, skip the first two values and read then lat/lon.<br>" + 178 178 "Other example: \"lat,lon\" will just read lat/lon values comma seperated.</html>"); 179 drawRawGpsLines.setToolTipText("If your gps device draw to few lines, select this to draw lines along your track.");179 drawRawGpsLines.setToolTipText("If your gps device draw to few lines, select this to draw lines along your way."); 180 180 drawRawGpsLines.setSelected(Main.pref.isDrawRawGpsLines()); 181 181 forceRawGpsLines.setToolTipText("Force drawing of lines if the imported data contain no line information."); -
src/org/openstreetmap/josm/gui/SelectionManager.java
r42 r64 19 19 import org.openstreetmap.josm.data.osm.Node; 20 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; 21 import org.openstreetmap.josm.data.osm. Track;21 import org.openstreetmap.josm.data.osm.Way; 22 22 23 23 /** … … 257 257 * @param alt Whether the alt key was pressed, which means select all objects 258 258 * that are touched, instead those which are completly covered. Also 259 * select whole tracks instead of line segments.259 * select whole waies instead of line segments. 260 260 */ 261 261 public Collection<OsmPrimitive> getObjectsInRectangle(Rectangle r, boolean alt) { … … 282 282 selection.add(ls); 283 283 284 // tracks285 for ( Trackt : Main.main.ds.tracks) {286 boolean whole TrackSelected = !t.segments.isEmpty();284 // waies 285 for (Way t : Main.main.ds.waies) { 286 boolean wholeWaySelected = !t.segments.isEmpty(); 287 287 for (LineSegment ls : t.segments) 288 288 if (rectangleContainLineSegment(r, alt, ls)) 289 289 selection.add(ls); 290 290 else 291 whole TrackSelected = false;292 if (whole TrackSelected)291 wholeWaySelected = false; 292 if (wholeWaySelected) 293 293 selection.add(t); 294 294 } -
src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r62 r64 14 14 import java.awt.event.WindowFocusListener; 15 15 import java.util.Collection; 16 import java.util.HashMap;17 16 import java.util.Iterator; 18 17 import java.util.TreeMap; … … 37 36 import org.openstreetmap.josm.command.ChangeKeyValueCommand; 38 37 import org.openstreetmap.josm.data.SelectionChangedListener; 39 import org.openstreetmap.josm.data.osm.Key;40 38 import org.openstreetmap.josm.data.osm.OsmPrimitive; 41 39 import org.openstreetmap.josm.gui.ImageProvider; … … 125 123 if (value.equals("")) 126 124 value = null; // delete the key 127 mv.editLayer().add(new ChangeKeyValueCommand(sel, Key.get(key), value));125 mv.editLayer().add(new ChangeKeyValueCommand(sel, key, value)); 128 126 129 127 if (value == null) … … 143 141 p.add(new JLabel("<html>This will change "+sel.size()+" object"+(sel.size()==1?"":"s")+".<br><br>"+ 144 142 "Please select a key"), BorderLayout.NORTH); 145 Vector<String> allKeys = new Vector<String>(Key.allKeys.keySet()); 143 Vector<String> allKeys = new Vector<String>(); 144 for (OsmPrimitive osm : Main.main.ds.allNonDeletedPrimitives()) 145 if (osm.keys != null) 146 allKeys.addAll(osm.keys.keySet()); 146 147 for (Iterator<String> it = allKeys.iterator(); it.hasNext();) { 147 148 String s = it.next(); … … 170 171 if (value.equals("")) 171 172 return; 172 mv.editLayer().add(new ChangeKeyValueCommand(sel, Key.get(key), value));173 mv.editLayer().add(new ChangeKeyValueCommand(sel, key, value)); 173 174 selectionChanged(sel); // update table 174 175 } … … 181 182 String key = data.getValueAt(row, 0).toString(); 182 183 Collection<OsmPrimitive> sel = Main.main.ds.getSelected(); 183 mv.editLayer().add(new ChangeKeyValueCommand(sel, Key.get(key), null));184 mv.editLayer().add(new ChangeKeyValueCommand(sel, key, null)); 184 185 selectionChanged(sel); // update table 185 186 } … … 293 294 data.setRowCount(0); 294 295 TreeMap<String, Collection<String>> props = new TreeMap<String, Collection<String>>(); 295 HashMap<String, Integer> valueCounts = new HashMap<String, Integer>();296 296 for (OsmPrimitive osm : newSelection) { 297 297 if (osm.keys != null) { 298 for (Entry< Key, String> e : osm.keys.entrySet()) {299 Collection<String> value = props.get(e.getKey() .name);298 for (Entry<String, String> e : osm.keys.entrySet()) { 299 Collection<String> value = props.get(e.getKey()); 300 300 if (value == null) { 301 301 value = new TreeSet<String>(); 302 props.put(e.getKey() .name, value);302 props.put(e.getKey(), value); 303 303 } 304 304 value.add(e.getValue()); 305 306 Integer count = valueCounts.get(e.getValue());307 if (count == null)308 count = 0;309 valueCounts.put(e.getValue(), count+1);310 305 } 311 306 } 312 307 } 313 int selCount = newSelection.size();314 308 for (Entry<String, Collection<String>> e : props.entrySet()) { 315 309 JComboBox value = new JComboBox(e.getValue().toArray()); 316 310 value.setEditable(true); 317 if (e.getValue().size() > 1 || valueCounts.get(e.getValue().iterator().next()) != selCount) 318 value.getEditor().setItem("<different>"); 311 value.getEditor().setItem(e.getValue().size() > 1 ? "<different>" : e.getValue().iterator().next()); 319 312 data.addRow(new Object[]{e.getKey(), value}); 320 313 } -
src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r62 r64 23 23 import org.openstreetmap.josm.Main; 24 24 import org.openstreetmap.josm.data.SelectionChangedListener; 25 import org.openstreetmap.josm.data.osm.Key;26 25 import org.openstreetmap.josm.data.osm.OsmPrimitive; 27 26 import org.openstreetmap.josm.gui.ImageProvider; … … 95 94 for (OsmPrimitive osm : Main.main.ds.allNonDeletedPrimitives()) { 96 95 if (osm.keys != null) { 97 for (Entry< Key, String> ent : osm.keys.entrySet()) {96 for (Entry<String, String> ent : osm.keys.entrySet()) { 98 97 if (match(lastSearch, ent.getKey(), ent.getValue())) { 99 98 osm.setSelected(true); … … 106 105 Main.main.getMapFrame().repaint(); 107 106 } 108 private boolean match(String search, Keykey, String value) {107 private boolean match(String search, String key, String value) { 109 108 int colon = search.indexOf(':'); 110 109 if (colon == -1) 111 return key. name.indexOf(search) != -1 || value.indexOf(search) != -1;112 return key. name.equals(search.substring(0, colon)) && value.indexOf(search.substring(colon+1)) != -1;110 return key.indexOf(search) != -1 || value.indexOf(search) != -1; 111 return key.equals(search.substring(0, colon)) && value.indexOf(search.substring(colon+1)) != -1; 113 112 } 114 113 }); -
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r57 r64 20 20 import org.openstreetmap.josm.data.osm.Node; 21 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 import org.openstreetmap.josm.data.osm. Track;22 import org.openstreetmap.josm.data.osm.Way; 23 23 import org.openstreetmap.josm.data.osm.visitor.BoundingVisitor; 24 24 import org.openstreetmap.josm.data.osm.visitor.MergeVisitor; … … 113 113 if (!osm.isDeleted()) 114 114 osm.visit(visitor); 115 for (OsmPrimitive osm : data. tracks)115 for (OsmPrimitive osm : data.waies) 116 116 if (!osm.isDeleted()) 117 117 osm.visit(visitor); … … 128 128 return undeletedSize(data.nodes)+" nodes, "+ 129 129 undeletedSize(data.lineSegments)+" segments, "+ 130 undeletedSize(data. tracks)+" streets.";130 undeletedSize(data.waies)+" streets."; 131 131 } 132 132 … … 238 238 for (Iterator<LineSegment> it = data.lineSegments.iterator(); it.hasNext();) 239 239 cleanIterator(it, processedSet); 240 for (Iterator< Track> it = data.tracks.iterator(); it.hasNext();)240 for (Iterator<Way> it = data.waies.iterator(); it.hasNext();) 241 241 cleanIterator(it, processedSet); 242 242 } -
src/org/openstreetmap/josm/gui/layer/RawGpsDataLayer.java
r38 r64 28 28 29 29 /** 30 * A list of tracks which containing a list of points.30 * A list of waies which containing a list of points. 31 31 */ 32 32 private final Collection<Collection<GeoPoint>> data; … … 78 78 @Override 79 79 public String getToolTipText() { 80 return data.size()+" tracks.";80 return data.size()+" waies."; 81 81 } 82 82
Note:
See TracChangeset
for help on using the changeset viewer.
