Changeset 18399 in josm
- Timestamp:
- 2022-03-13T13:40:25+01:00 (2 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r18287 r18399 1093 1093 } 1094 1094 1095 /** 1096 * Put a key / value pair as a new attribute. Overrides key / value pair with the same key (if present). 1097 * 1098 * @param key the key 1099 * @param value the value 1100 */ 1095 1101 @Override 1096 1102 public void put(String key, Object value) { 1103 put(key, value, true); 1104 } 1105 1106 /** 1107 * Put a key / value pair as a new attribute. Overrides key / value pair with the same key (if present). 1108 * Only sets the modified state when setModified is true. 1109 * 1110 * @param key the key 1111 * @param value the value 1112 * @param setModified whether to change the modified state 1113 * @since 18399 1114 */ 1115 public void put(String key, Object value, boolean setModified) { 1097 1116 super.put(key, value); 1098 invalidate();1117 fireInvalidate(setModified); 1099 1118 } 1100 1119 … … 1133 1152 1134 1153 private void fireInvalidate(boolean setModified) { 1154 if (setModified) { 1155 setModified(true); 1156 } 1135 1157 if (updating || initializing) { 1136 1158 suppressedInvalidate = true; 1137 1159 } else { 1138 if (setModified) {1139 setModified(true);1140 }1141 1160 if (listeners.hasListeners()) { 1142 1161 GpxDataChangeEvent e = new GpxDataChangeEvent(this); … … 1159 1178 */ 1160 1179 public void endUpdate() { 1161 boolean setModified = updating;1162 1180 updating = initializing = false; 1163 1181 if (suppressedInvalidate) { 1164 fireInvalidate( setModified);1182 fireInvalidate(false); 1165 1183 suppressedInvalidate = false; 1166 1184 } -
trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java
r18211 r18399 83 83 @Override 84 84 public void setColor(Color color) { 85 setColorExtension (color);85 setColorExtensionGPXD(color, true); 86 86 colorCache = color; 87 87 } 88 88 89 private void setColorExtension (Color color) {89 private void setColorExtensionGPXD(Color color, boolean invalidate) { 90 90 getExtensions().findAndRemove("gpxx", "DisplayColor"); 91 91 if (color == null) { … … 94 94 getExtensions().addOrUpdate("gpxd", "color", String.format("#%02X%02X%02X", color.getRed(), color.getGreen(), color.getBlue())); 95 95 } 96 fireInvalidate(); 96 colorFormat = ColorFormat.GPXD; 97 if (invalidate) { 98 fireInvalidate(); 99 } 97 100 } 98 101 … … 168 171 getExtensions().addIfNotPresent("gpxx", "TrackExtension").getExtensions().addOrUpdate("gpxx", "DisplayColor", colorString); 169 172 } else if (cFormat == ColorFormat.GPXD) { 170 setColor (c);173 setColorExtensionGPXD(c, false); 171 174 } 172 175 colorFormat = cFormat; -
trunk/src/org/openstreetmap/josm/io/GpxWriter.java
r18287 r18399 124 124 }); 125 125 } 126 data.put(META_TIME, (metaTime != null ? metaTime : Instant.now()).toString() );126 data.put(META_TIME, (metaTime != null ? metaTime : Instant.now()).toString(), false); 127 127 data.endUpdate(); 128 128
Note:
See TracChangeset
for help on using the changeset viewer.