Changeset 597 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2008-04-07T22:04:53+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r529 r597 83 83 84 84 /** 85 * true if this object has direction dependant tags (e.g. oneway) 86 */ 87 public boolean hasDirectionKeys = false; 88 89 /** 85 90 * If set to true, this object is currently selected. 86 91 */ … … 112 117 public static Collection<String> uninteresting = 113 118 new HashSet<String>(Arrays.asList(new String[] {"source", "note", "created_by"})); 119 120 /** 121 * Contains a list of direction-dependent keys that do not make an object 122 * direction dependent. 123 */ 124 public static Collection<String> directionKeys = 125 new HashSet<String>(Arrays.asList(new String[] {"oneway", "incline", "incline_steep", "aerialway"})); 114 126 115 127 /** … … 186 198 } 187 199 checkTagged(); 200 checkDirectionTagged(); 188 201 } 189 202 /** … … 197 210 } 198 211 checkTagged(); 212 checkDirectionTagged(); 199 213 } 200 214 … … 266 280 } 267 281 } 282 /** 283 * Updates the "hasDirectionKeys" flag. "keys" property should probably be made private 284 * to make sure this gets called when keys are set. 285 */ 286 public void checkDirectionTagged() { 287 hasDirectionKeys = false; 288 if (keys != null) { 289 for (Entry<String,String> e : keys.entrySet()) { 290 if (directionKeys.contains(e.getKey())) { 291 hasDirectionKeys = true; 292 break; 293 } 294 } 295 } 296 297 } 268 298 269 299 } -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r529 r597 53 53 */ 54 54 public Way(Way clone) { 55 cloneFrom(clone); 55 cloneFrom(clone); 56 56 } 57 57 … … 75 75 nodes.clear(); 76 76 nodes.addAll(((Way)osm).nodes); 77 checkDirectionTagged(); 77 78 } 78 79 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r596 r597 75 75 protected Color backgroundColor; 76 76 protected boolean showDirectionArrow; 77 protected boolean showRelevantDirectionsOnly; 77 78 protected boolean showOrderNumber; 78 79 … … 136 137 public void visit(Way w) { 137 138 double circum = Main.map.mapView.getScale()*100*Main.proj.scaleFactor()*40041455; // circumference of the earth in meter 138 boolean showDirection = showDirectionArrow && w.selected; 139 if (useRealWidth && showDirection) showDirection = false; 139 // show direction arrows, if draw.segment.relevant_directions_only is not set, the way is tagged with a direction key 140 // (even if the tag is negated as in oneway=false) or the way is selected 141 boolean showDirection = (!useRealWidth) 142 && (w.selected || (showDirectionArrow 143 && (!showRelevantDirectionsOnly || w.hasDirectionKeys))); 144 140 145 Color colour = untaggedColor; 141 146 int width = 2; 142 147 int realWidth = 0; //the real width of the element in meters 143 148 boolean dashed = false; 144 boolean area =false;149 boolean area = false; 145 150 ElemStyle wayStyle = MapPaintStyles.getStyle(w); 146 151 … … 352 357 textColor = getPreferencesColor ("text", Color.WHITE); 353 358 showDirectionArrow = Main.pref.getBoolean("draw.segment.direction"); 359 showRelevantDirectionsOnly = Main.pref.getBoolean("draw.segment.relevant_directions_only"); 354 360 showOrderNumber = Main.pref.getBoolean("draw.segment.order_number"); 355 361 useRealWidth = Main.pref.getBoolean("mappaint.useRealWidth",false); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r499 r597 54 54 protected Color incompleteColor; 55 55 protected Color backgroundColor; 56 protected boolean showDirectionArrow; 56 protected boolean showDirectionArrow; 57 protected boolean showRelevantDirectionsOnly; 57 58 protected boolean showOrderNumber; 58 59 … … 75 76 backgroundColor = getPreferencesColor("background", Color.BLACK); 76 77 showDirectionArrow = Main.pref.getBoolean("draw.segment.direction"); 78 showRelevantDirectionsOnly = Main.pref.getBoolean("draw.segment.relevant_directions_only"); 77 79 showOrderNumber = Main.pref.getBoolean("draw.segment.order_number"); 78 80 … … 126 128 if (w.incomplete) return; 127 129 130 // show direction arrows, if draw.segment.relevant_directions_only is not set, the way is tagged with a direction key 131 // (even if the tag is negated as in oneway=false) or the way is selected 132 133 boolean showThisDirectionArrow = w.selected 134 || (showDirectionArrow 135 && (!showRelevantDirectionsOnly || w.hasDirectionKeys)); 128 136 Color wayColor; 129 137 … … 141 149 for (int orderNumber = 1; it.hasNext(); orderNumber++) { 142 150 Point p = nc.getPoint(it.next().eastNorth); 143 drawSegment(lastP, p, w.selected && !inactive ? selectedColor : wayColor, show DirectionArrow || w.selected);151 drawSegment(lastP, p, w.selected && !inactive ? selectedColor : wayColor, showThisDirectionArrow); 144 152 if (showOrderNumber) 145 153 drawOrderNumber(lastP, p, orderNumber);
Note:
See TracChangeset
for help on using the changeset viewer.