Ignore:
Timestamp:
2008-02-15T19:29:28+01:00 (16 years ago)
Author:
framm
Message:
  • use waypoint's "desc" attribute in lieu of "name" if "name" is not present
  • add extra marker for trackpoints that have "name" or "desc" set

patch by David Earl <david@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java

    r444 r541  
    1 // License: GPL. Copyright 2007 by Immanuel Scholz and others
     1// License: GPL. Copyright 2008 by Immanuel Scholz and others
    22package org.openstreetmap.josm.gui.layer.markerlayer;
    33
     
    8787
    8888                                // Try a relative file:// url, if the link is not in an URL-compatible form
    89                                 if (relativePath != null && uri != null && !isWellFormedAddress(uri))
    90                                         uri = new File(relativePath, uri).toURI().toString();
     89                if (relativePath != null && uri != null && !isWellFormedAddress(uri))
     90                    uri = new File(relativePath, uri).toURI().toString();
    9191
    92                                 if (uri == null)
    93                                         return new Marker(wpt.latlon, wpt.getString("name"), wpt.getString("symbol"));
    94                                 if (uri.endsWith(".wav"))
    95                                         return AudioMarker.create(wpt.latlon, uri);
    96                                 else if (uri.endsWith(".png") || uri.endsWith(".jpg") || uri.endsWith(".jpeg") || uri.endsWith(".gif"))
     92                if (uri == null) {
     93                    String name_desc = "";
     94                    if (wpt.attr.containsKey("name")) {
     95                        name_desc = wpt.getString("name");
     96                    } else if (wpt.attr.containsKey("desc")) {
     97                        name_desc = wpt.getString("desc");
     98                    }
     99                    return new Marker(wpt.latlon, name_desc, wpt.getString("symbol"));
     100                }
     101
     102                if (uri.endsWith(".wav"))
     103                    return AudioMarker.create(wpt.latlon, uri);
     104                else if (uri.endsWith(".png") || uri.endsWith(".jpg") || uri.endsWith(".jpeg") || uri.endsWith(".gif"))
    97105                                        return ImageMarker.create(wpt.latlon, uri);
    98106                                else
Note: See TracChangeset for help on using the changeset viewer.