Changeset 15497 in josm for trunk/src/org
- Timestamp:
- 2019-11-02T16:28:02+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r15496 r15497 132 132 133 133 /** rename keys that equal */ 134 private final staticMap<String, String> UPDATE_PREF_KEYS = getUpdatePrefKeys();134 private static final Map<String, String> UPDATE_PREF_KEYS = getUpdatePrefKeys(); 135 135 136 136 private static Map<String, String> getUpdatePrefKeys() { -
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r15496 r15497 1208 1208 * Creates a schema with prefix, URI and location. 1209 1209 * Does NOT try to determine prefix from URI! 1210 * @param prefix 1211 * @param uri 1212 * @param location 1210 * @param prefix XML namespace prefix 1211 * @param uri XML namespace URI 1212 * @param location XML namespace location 1213 1213 */ 1214 1214 public XMLNamespace(String prefix, String uri, String location) { -
trunk/src/org/openstreetmap/josm/data/gpx/GpxExtension.java
r15496 r15497 12 12 * @since 15496 13 13 */ 14 public class GpxExtension extends WithAttributes implements IWithAttributes,GpxConstants {14 public class GpxExtension extends WithAttributes implements GpxConstants { 15 15 private final String qualifiedName, prefix, key; 16 16 private IWithAttributes parent; … … 60 60 /** 61 61 * Finds the default prefix used by JOSM for the given namespaceURI as the document is free specify another one. 62 * @param namespaceURI 62 * @param namespaceURI namespace URI 63 63 * @return the prefix 64 64 */ -
trunk/src/org/openstreetmap/josm/data/gpx/GpxExtensionCollection.java
r15496 r15497 20 20 */ 21 21 public class GpxExtensionCollection extends ArrayList<GpxExtension> { 22 23 private static final long serialVersionUID = 1L; 22 24 23 25 private Stack<GpxExtension> childStack = new Stack<>(); -
trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java
r15496 r15497 95 95 96 96 private void setColorExtension(Color color) { 97 getExtensions().findAndRemove("gpxx", 97 getExtensions().findAndRemove("gpxx", "DisplayColor"); 98 98 if (color == null) { 99 getExtensions().findAndRemove("gpxd", 99 getExtensions().findAndRemove("gpxd", "color"); 100 100 } else { 101 101 getExtensions().addOrUpdate("gpxd", "color", String.format("#%02X%02X%02X", color.getRed(), color.getGreen(), color.getBlue())); -
trunk/src/org/openstreetmap/josm/data/gpx/IGpxTrack.java
r15496 r15497 42 42 /** 43 43 * Sets the color of this track. Not necessarily supported by all implementations. 44 * @param color 44 * @param color color of this track 45 45 * @since 15496 46 46 */ -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r15496 r15497 175 175 * Will not be saved to .osm files, but that's not necessary because GPX files won't automatically be overridden after that. 176 176 */ 177 private List<XMLNamespace> GPXNamespaces;177 private List<XMLNamespace> gpxNamespaces; 178 178 179 179 /** … … 1206 1206 */ 1207 1207 public List<XMLNamespace> getGPXNamespaces() { 1208 return GPXNamespaces;1208 return gpxNamespaces; 1209 1209 } 1210 1210 1211 1211 /** 1212 1212 * Sets the GPX (XML) namespaces 1213 * @param GPXNamespaces the GPXNamespaces to set1214 */ 1215 public void setGPXNamespaces(List<XMLNamespace> GPXNamespaces) {1216 this. GPXNamespaces = GPXNamespaces;1213 * @param gpxNamespaces the GPXNamespaces to set 1214 */ 1215 public void setGPXNamespaces(List<XMLNamespace> gpxNamespaces) { 1216 this.gpxNamespaces = gpxNamespaces; 1217 1217 } 1218 1218 -
trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java
r15496 r15497 195 195 196 196 garmin.addActionListener(l -> { 197 if (garmin.isSelected() && 198 !ConditionalOptionPaneUtil.showConfirmationDialog( 199 "gpx_color_garmin", 200 ed, 201 new JLabel(tr("<html>Garmin track extensions only support 16 colors.<br>If you continue, the closest supported track color will be used.</html>")), 202 tr("Information"), 203 JOptionPane.OK_CANCEL_OPTION, 204 JOptionPane.INFORMATION_MESSAGE, 205 JOptionPane.OK_OPTION)) { 197 if (garmin.isSelected() && !ConditionalOptionPaneUtil.showConfirmationDialog( 198 "gpx_color_garmin", 199 ed, 200 new JLabel("<html>" + tr("Garmin track extensions only support 16 colors.") + "<br>" 201 + tr("If you continue, the closest supported track color will be used.") 202 + "</html>"), 203 tr("Information"), 204 JOptionPane.OK_CANCEL_OPTION, 205 JOptionPane.INFORMATION_MESSAGE, 206 JOptionPane.OK_OPTION)) { 206 207 garmin.setSelected(false); 207 208 } -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r15496 r15497 306 306 if (Logging.isDebugEnabled() && !data.getLayerPrefs().isEmpty()) { 307 307 info.append("<br><br>") 308 .append(String.join("<br>", data.getLayerPrefs().entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.toList()))); 308 .append(String.join("<br>", data.getLayerPrefs().entrySet().stream() 309 .map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.toList()))); 309 310 } 310 311 -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertFromGpxLayerAction.java
r15496 r15497 149 149 pre = "other"; 150 150 } 151 String segpre = seg ? "segment:" : ""; //needs to be distinguished since both track and segment extensions are applied to the resulting way 151 // needs to be distinguished since both track and segment extensions are applied to the resulting way 152 String segpre = seg ? "segment:" : ""; 152 153 String key = ext.getFlatKey(); 153 154 String fullkey = GpxConstants.GPX_PREFIX + extpre + pre + ":" + segpre + key; -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/CustomizeDrawingAction.java
r15496 r15497 76 76 @Override 77 77 public void actionPerformed(ActionEvent e) { 78 GPXSettingsPanel panel = new GPXSettingsPanel(layers.stream().filter(l -> l instanceof GpxLayer).map(l -> (GpxLayer) l).collect(Collectors.toList())); 78 GPXSettingsPanel panel = new GPXSettingsPanel( 79 layers.stream().filter(l -> l instanceof GpxLayer).map(l -> (GpxLayer) l).collect(Collectors.toList())); 79 80 JScrollPane scrollpane = GuiHelper.embedInVerticalScrollPane(panel); 80 81 scrollpane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/ButtonMarker.java
r13475 r15497 65 65 66 66 String labelText = getText(); 67 if ( labelText != null&& Config.getPref().getBoolean("marker.buttonlabels", true)) {67 if (!labelText.isEmpty() && Config.getPref().getBoolean("marker.buttonlabels", true)) { 68 68 g.drawString(labelText, screen.x+4, screen.y+2); 69 69 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
r15496 r15497 279 279 280 280 String labelText = getText(); 281 if ( (labelText != null) && showTextOrIcon) {281 if (!labelText.isEmpty() && showTextOrIcon) { 282 282 g.drawString(labelText, screen.x+4, screen.y+2); 283 283 } … … 321 321 private String getDefaultTextTemplate() { 322 322 if (cachedDefaultTemplate == null) { 323 cachedDefaultTemplate = GPXSettingsPanel.getLayerPref(null, 323 cachedDefaultTemplate = GPXSettingsPanel.getLayerPref(null, getTextTemplateKey()); 324 324 } 325 325 return cachedDefaultTemplate; -
trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java
r15496 r15497 104 104 private final boolean hasNonLocalFile; // flag to display AllLines checkbox 105 105 106 private final staticMap<String, Object> DEFAULT_PREFS = getDefaultPrefs();106 private static final Map<String, Object> DEFAULT_PREFS = getDefaultPrefs(); 107 107 108 108 private static Map<String, Object> getDefaultPrefs() { … … 263 263 */ 264 264 public static void putLayerPrefLocal(GpxData data, String key, String value) { 265 if (value == null || value.trim().isEmpty() || (getLayerPref(null, key).equals(value) && DEFAULT_PREFS.get(key) != null && DEFAULT_PREFS.get(key).toString().equals(value))) { 265 if (value == null || value.trim().isEmpty() || 266 (getLayerPref(null, key).equals(value) && DEFAULT_PREFS.get(key) != null && DEFAULT_PREFS.get(key).toString().equals(value))) { 266 267 data.getLayerPrefs().remove(key); 267 268 } else { -
trunk/src/org/openstreetmap/josm/gui/util/StayOpenPopupMenu.java
r15492 r15497 53 53 if (PlatformManager.isPlatformOsx()) { 54 54 try { 55 Class<?> AppContextClass = Class.forName("sun.awt.AppContext");56 Field tableField = AppContextClass.getDeclaredField("table");55 Class<?> appContextClass = Class.forName("sun.awt.AppContext"); 56 Field tableField = appContextClass.getDeclaredField("table"); 57 57 ReflectionUtils.setObjectsAccessible(tableField); 58 58 Object mouseGrabber = null; 59 59 for (Entry<?, ?> e : ((Map<?, ?>) 60 tableField.get( AppContextClass.getMethod("getAppContext").invoke(AppContextClass))).entrySet()) {60 tableField.get(appContextClass.getMethod("getAppContext").invoke(appContextClass))).entrySet()) { 61 61 if (MOUSE_GRABBER_KEY.equals(Objects.toString(e.getKey()))) { 62 62 mouseGrabber = e.getValue(); -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r15496 r15497 264 264 currentState = State.EXT; 265 265 break; 266 default: // Do nothing 266 267 } 267 268 break; -
trunk/src/org/openstreetmap/josm/io/GpxWriter.java
r15496 r15497 128 128 out.println("<gpx version=\"1.1\" creator=\"JOSM GPX export\" xmlns=\"http://www.topografix.com/GPX/1/1\""); 129 129 130 String schemaLocations = "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd";130 StringBuilder schemaLocations = new StringBuilder("http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"); 131 131 132 132 for (XMLNamespace n : namespaces) { … … 134 134 out.println(String.format(" xmlns:%s=\"%s\"", n.getPrefix(), n.getURI())); 135 135 if (n.getLocation() != null) { 136 schemaLocations += " " + n.getURI() + " " + n.getLocation();136 schemaLocations.append(' ').append(n.getURI()).append(' ').append(n.getLocation()); 137 137 } 138 138 } … … 394 394 // but otherwise the file is invalid and can't even be parsed by SAX anymore 395 395 String k = (e.getPrefix().isEmpty() ? "" : e.getPrefix() + ":") + e.getKey(); 396 String attr = String.join(" ", e.getAttributes().entrySet().stream().map(a -> encode(a.getKey()) + "=\"" + encode(a.getValue().toString()) + "\"").sorted().collect(Collectors.toList())); 396 String attr = String.join(" ", e.getAttributes().entrySet().stream() 397 .map(a -> encode(a.getKey()) + "=\"" + encode(a.getValue().toString()) + "\"").sorted().collect(Collectors.toList())); 397 398 if (e.getValue() == null && e.getExtensions().isEmpty()) { 398 399 inline(k, attr);
Note:
See TracChangeset
for help on using the changeset viewer.