Changeset 367 in josm for trunk/src/org
- Timestamp:
- 2007-10-12T01:28:49+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r362 r367 5 5 import java.text.SimpleDateFormat; 6 6 import java.util.ArrayList; 7 import java.util.Arrays; 7 8 import java.util.Collection; 8 9 import java.util.Collections; 9 10 import java.util.Date; 10 11 import java.util.HashMap; 12 import java.util.HashSet; 11 13 import java.util.Map; 12 14 import java.util.Map.Entry; … … 81 83 82 84 /** 85 * true if this object is considered "tagged". To be "tagged", an object 86 * must have one or more "non-standard" tags. "created_by" and "source" 87 * are typically considered "standard" tags and do not make an object 88 * "tagged". 89 */ 90 public boolean tagged = false; 91 92 /** 83 93 * If set to true, this object is currently selected. 84 94 */ … … 104 114 public boolean incomplete = false; 105 115 116 /** 117 * Contains a list of "uninteresting" keys that do not make an object 118 * "tagged". 119 */ 120 public static Collection<String> uninteresting = 121 new HashSet<String>(Arrays.asList(new String[] {"source", "note", "created_by"})); 122 106 123 /** 107 124 * Implementation of the visitor scheme. Subclases have to call the correct … … 176 193 keys.put(key, value); 177 194 } 195 checkTagged(); 178 196 } 179 197 /** … … 186 204 keys = null; 187 205 } 206 checkTagged(); 188 207 } 189 208 … … 215 234 selected = osm.selected; 216 235 timestamp = osm.timestamp; 236 tagged = osm.tagged; 217 237 } 218 238 … … 237 257 } 238 258 259 /** 260 * Updates the "tagged" flag. "keys" property should probably be made private 261 * to make sure this gets called when keys are set. 262 */ 263 public void checkTagged() { 264 tagged = false; 265 if (keys != null) { 266 for (Entry<String,String> e : keys.entrySet()) { 267 if (!uninteresting.contains(e.getKey())) { 268 tagged = true; 269 break; 270 } 271 } 272 } 273 } 239 274 240 275 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r357 r367 7 7 import java.awt.Point; 8 8 import java.awt.Rectangle; 9 import java.awt.Stroke; 9 10 import java.awt.geom.GeneralPath; 10 11 import java.awt.geom.Line2D; … … 51 52 protected Color nodeColor; 52 53 protected Color dfltWayColor; 54 protected Color untaggedWayColor; 53 55 protected Color incompleteColor; 54 56 protected Color backgroundColor; … … 68 70 nodeColor = getPreferencesColor("node", Color.RED); 69 71 dfltWayColor = getPreferencesColor("way", darkblue); 72 untaggedWayColor = getPreferencesColor("untagged way", darkgreen); 70 73 incompleteColor = getPreferencesColor("incomplete way", darkerblue); 71 74 backgroundColor = getPreferencesColor("background", Color.BLACK); … … 73 76 showOrderNumber = Main.pref.getBoolean("draw.segment.order_number"); 74 77 78 // draw tagged ways first, then untagged ways. takes 79 // time to iterate through list twice, OTOH does not 80 // require changing the colour while painting... 75 81 for (final OsmPrimitive osm : data.ways) 76 if (!osm.deleted && !osm.selected )82 if (!osm.deleted && !osm.selected && osm.tagged) 77 83 osm.visit(this); 78 84 displaySegments(null); 85 86 for (final OsmPrimitive osm : data.ways) 87 if (!osm.deleted && !osm.selected && !osm.tagged) 88 osm.visit(this); 89 displaySegments(null); 90 79 91 for (final OsmPrimitive osm : data.nodes) 80 92 if (!osm.deleted && !osm.selected) 81 93 osm.visit(this); 94 82 95 for (final OsmPrimitive osm : data.getSelected()) 83 96 if (!osm.deleted) … … 113 126 114 127 Color wayColor; 115 if (inactive) 128 129 if (inactive) { 116 130 wayColor = inactiveColor; 117 else { 131 } else if (!w.tagged) { 132 wayColor = untaggedWayColor; 133 } else { 118 134 wayColor = dfltWayColor; 119 135 } … … 171 187 172 188 if (screen.contains(p.x, p.y)) 173 g.drawRect(p.x-1, p.y-1, 2, 2); 189 if (n.tagged) { 190 g.drawRect(p.x, p.y, 0, 0); 191 g.drawRect(p.x-2, p.y-2, 4, 4); 192 } else { 193 g.drawRect(p.x-1, p.y-1, 2, 2); 194 } 174 195 } 175 196 … … 179 200 protected void drawSegment(Node n1, Node n2, Color col, boolean showDirection) { 180 201 181 if (col != currentColor) { 182 displaySegments(col); 183 } 202 if (col != currentColor) displaySegments(col); 184 203 185 204 Point p1 = nc.getPoint(n1.eastNorth); -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r362 r367 88 88 osm.user = user; 89 89 osm.visible = visible; 90 osm.checkTagged(); 90 91 } 91 92 }
Note:
See TracChangeset
for help on using the changeset viewer.