Changeset 11728 in josm for trunk/src/org
- Timestamp:
- 2017-03-13T19:10:48+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r11726 r11728 1532 1532 settingsMap.keySet().stream() 1533 1533 .filter(key -> key.startsWith("color.")) 1534 . map(key -> {1534 .flatMap(key -> { 1535 1535 final String newKey = ColorProperty.getColorKey(key.substring("color.".length())); 1536 return new AbstractMap.SimpleImmutableEntry<>(key, newKey); 1537 }) 1538 .filter(entry -> { 1539 return !entry.getKey().equals(entry.getValue()) && !settingsMap.containsKey(entry.getValue()); 1536 return key.equals(newKey) || settingsMap.containsKey(newKey) 1537 ? Stream.empty() 1538 : Stream.of(new AbstractMap.SimpleImmutableEntry<>(key, newKey)); 1540 1539 }) 1541 1540 .collect(Collectors.toList()) // to avoid ConcurrentModificationException -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java
r11726 r11728 15 15 import org.openstreetmap.josm.gui.mappaint.Environment; 16 16 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 17 import org.openstreetmap.josm.gui.util.RotationAngle; 17 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 18 19 import org.openstreetmap.josm.tools.Utils; … … 62 63 public Float extentThreshold; 63 64 64 protected AreaElement(Cascade c, Color color, MapImage fillImage, Float extent, Float extentThreshold, TextLabel text) { 65 /** 66 * The icon that is displayed on the center of the area. 67 */ 68 private final MapImage iconImage; 69 70 /** 71 * The rotation of the {@link #iconImageAngle} 72 */ 73 private final RotationAngle iconImageAngle; 74 75 protected AreaElement(Cascade c, Color color, MapImage fillImage, Float extent, 76 Float extentThreshold, TextLabel text, MapImage iconImage, RotationAngle iconImageAngle) { 65 77 super(c, 1f); 66 78 CheckParameterUtil.ensureParameterNotNull(color); … … 70 82 this.extentThreshold = extentThreshold; 71 83 this.text = text; 84 this.iconImage = iconImage; 85 this.iconImageAngle = iconImageAngle; 72 86 } 73 87 … … 105 119 106 120 TextLabel text = null; // <- text is handled by TextElement 121 MapImage iconImage = NodeElement.createIcon(env); 122 RotationAngle rotationAngle = NodeElement.createRotationAngle(env); 123 124 if (iconImage != null) { 125 // fake a transparent color. 126 color = new Color(0, 0, 0, 0); 127 } 107 128 108 129 if (color != null) { … … 110 131 Float extentThreshold = c.get(FILL_EXTENT_THRESHOLD, null, float.class); 111 132 112 return new AreaElement(c, color, fillImage, extent, extentThreshold, text); 133 return new AreaElement(c, color, fillImage, extent, extentThreshold, text, iconImage, rotationAngle); 113 134 } else { 114 135 return null; … … 135 156 painter.drawArea((Relation) osm, myColor, fillImage, extent, extentThreshold, painter.isInactiveMode() || osm.isDisabled(), text); 136 157 } 158 159 if (iconImage != null && painter.isShowIcons()) { 160 painter.drawAreaIcon(osm, iconImage, painter.isInactiveMode() || osm.isDisabled(), selected, member, 161 iconImageAngle == null ? 0.0 : iconImageAngle.getRotationAngle(osm)); 162 } 137 163 } 138 164 … … 147 173 Objects.equals(text, that.text) && 148 174 Objects.equals(extent, that.extent) && 149 Objects.equals(extentThreshold, that.extentThreshold); 175 Objects.equals(extentThreshold, that.extentThreshold) && 176 Objects.equals(iconImage, that.iconImage) && 177 Objects.equals(iconImageAngle, that.iconImageAngle); 150 178 } 151 179 152 180 @Override 153 181 public int hashCode() { 154 return Objects.hash(super.hashCode(), color, fillImage, text, extent, extentThreshold); 182 return Objects.hash(super.hashCode(), color, fillImage, text, extent, extentThreshold, iconImage, iconImageAngle); 155 183 } 156 184 … … 158 186 public String toString() { 159 187 return "AreaElemStyle{" + super.toString() + "color=" + Utils.toString(color) + 160 " fillImage=[" + fillImage + "]}"; 188 " fillImage=[" + fillImage + "] iconImage=[" + iconImage + "] iconImageAngle=[" + iconImageAngle + "]}"; 161 189 } 162 190 }
Note:
See TracChangeset
for help on using the changeset viewer.