Changeset 5684 in josm for trunk


Ignore:
Timestamp:
2013-01-28T14:06:52+01:00 (7 years ago)
Author:
bastiK
Message:

add session support for marker layers (see #4029)

The data is exported to a separate GPX file that contains one waypoint for each marker.
This is not very elegant, because most of the time, all the info is already contained in the original GPX File.
However, when dealing with audio markers, they can be synchronized, or additional markers are added
at certain playback positions. This info must be retained.
Another complication is, that two or more MarkerLayers can be merged to one.

All these problems are avoided by explicitly exporting the markers to a separate file (as done in this commit).

Location:
trunk/src/org/openstreetmap/josm
Files:
2 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java

    r5505 r5684  
    1414import java.util.Arrays;
    1515import java.util.Collection;
    16 import java.util.Collections;
    1716import java.util.HashMap;
    1817import java.util.HashSet;
     
    6463        SessionSaveAsDialog dlg = new SessionSaveAsDialog();
    6564        dlg.showDialog();
    66         if (dlg.getValue() != 2) return;
     65        if (dlg.getValue() != 1) return;
    6766
    6867        zipRequired = false;
     
    138137
    139138        public SessionSaveAsDialog() {
    140             super(Main.parent, tr("Save Session"), new String[] {tr("Cancel"), tr("Save As")});
     139            super(Main.parent, tr("Save Session"), new String[] {tr("Save As"), tr("Cancel")});
    141140            initialize();
    142             setButtonIcons(new String[] {"cancel", "save_as"});
    143             setDefaultButton(2);
     141            setButtonIcons(new String[] {"save_as", "cancel"});
     142            setDefaultButton(1);
    144143            setRememberWindowGeometry(getClass().getName() + ".geometry",
    145144                    WindowGeometry.centerInWindow(Main.parent, new Dimension(350, 450)));
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxConstants.java

    r5681 r5684  
    2828    public static List<String> WPT_KEYS = Arrays.asList("ele", "time", "magvar", "geoidheight",
    2929            "name", "cmt", "desc", "src", META_LINKS, "sym", "number", "type",
    30             "fix", "sat", "hdop", "vdop", "pdop", "ageofdgpsdata", "dgpsid");
     30            "fix", "sat", "hdop", "vdop", "pdop", "ageofdgpsdata", "dgpsid", META_EXTENSIONS);
    3131
    3232}
  • trunk/src/org/openstreetmap/josm/data/gpx/IWithAttributes.java

    r5681 r5684  
    55
    66/**
    7  * Object with attributes.
     7 * Object with attributes (in the context of GPX data).
    88 */
    99public interface IWithAttributes {
     10
     11    /**
     12     * Returns the Object value to which the specified key is mapped,
     13     * or {@code null} if this map contains no mapping for the key.
     14     *
     15     * @param key the key whose associated value is to be returned
     16     * @return the value
     17     */
     18    Object get(String key);
    1019
    1120    /**
     
    1827     */
    1928    String getString(String key);
    20    
     29
    2130    /**
    22      * Returns the Collection value to which the specified key is mapped, 
     31     * Returns the Collection value to which the specified key is mapped,
    2332     * or {@code null} if this map contains no Collection mapping for the key.
    24      * 
     33     *
    2534     * @param key the key whose associated value is to be returned
    26      * @return the Collection value to which the specified key is mapped, 
     35     * @return the Collection value to which the specified key is mapped,
    2736     *         or {@code null} if this map contains no Collection mapping for the key
    2837     * @since 5502
    2938     */
    30     Collection<?> getCollection(String key);
     39    Collection getCollection(String key);
     40
     41    /**
     42     * Put a key / value pair as a new attribute.
     43     *
     44     * Overrides key / value pair with the same key (if present).
     45     *
     46     * @param key the key
     47     * @param value the value
     48     */
     49    void put(String key, Object value);
     50
     51    /**
     52     * Add a key / value pair that is not part of the GPX schema as an extension.
     53     *
     54     * @param key the key
     55     * @param value the value
     56     */
     57    void addExtension(String key, String value);
     58
    3159}
  • trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java

    r5681 r5684  
    2020     */
    2121    public Map<String, Object> attr = new HashMap<String, Object>(0);
     22
     23    /**
     24     * Returns the Object value to which the specified key is mapped,
     25     * or {@code null} if this map contains no mapping for the key.
     26     *
     27     * @param key the key whose associated value is to be returned
     28     * @return the value
     29     */
     30    @Override
     31    public Object get(String key) {
     32        return attr.get(key);
     33    }
    2234
    2335    /**
     
    4557     */
    4658    @Override
    47     public Collection<?> getCollection(String key) {
     59    public Collection getCollection(String key) {
    4860        Object value = attr.get(key);
    49         return (value instanceof Collection<?>) ? (Collection<?>)value : null;
     61        return (value instanceof Collection) ? (Collection)value : null;
     62    }
     63
     64    /**
     65     * Put a key / value pair as a new attribute.
     66     *
     67     * Overrides key / value pair with the same key (if present).
     68     *
     69     * @param key the key
     70     * @param value the value
     71     */
     72    @Override
     73    public void put(String key, Object value) {
     74        attr.put(key, value);
     75    }
     76
     77    /**
     78     * Add a key / value pair that is not part of the GPX schema as an extension.
     79     *
     80     * @param key the key
     81     * @param value the value
     82     */
     83    @Override
     84    public void addExtension(String key, String value) {
     85        if (!attr.containsKey(META_EXTENSIONS)) {
     86            attr.put(META_EXTENSIONS, new Extensions());
     87        }
     88        Extensions ext = (Extensions) attr.get(META_EXTENSIONS);
     89        ext.put(key, value);
    5090    }
    5191}
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarker.java

    r4282 r5684  
    44import java.awt.event.ActionEvent;
    55import java.net.URL;
     6import java.util.Collections;
    67
    78import org.openstreetmap.josm.Main;
    89import org.openstreetmap.josm.data.coor.LatLon;
     10import org.openstreetmap.josm.data.gpx.GpxConstants;
     11import org.openstreetmap.josm.data.gpx.GpxLink;
     12import org.openstreetmap.josm.data.gpx.WayPoint;
    913import org.openstreetmap.josm.tools.AudioPlayer;
    1014import org.openstreetmap.josm.tools.template_engine.TemplateEngineDataProvider;
     
    7781        return TemplateEntryProperty.forAudioMarker(parentLayer.getName());
    7882    }
     83
     84    @Override
     85    public WayPoint convertToWayPoint() {
     86        WayPoint wpt = super.convertToWayPoint();
     87        GpxLink link = new GpxLink(audioUrl.toString());
     88        link.type = "audio";
     89        wpt.attr.put(GpxConstants.META_LINKS, Collections.singleton(link));
     90        wpt.addExtension("offset", Double.toString(offset));
     91        wpt.addExtension("sync-offset", Double.toString(syncOffset));
     92        return wpt;
     93    }
    7994}
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarker.java

    r4282 r5684  
    88import java.awt.event.ActionListener;
    99import java.net.URL;
     10import java.util.Collections;
    1011
    1112import javax.swing.Icon;
     
    2122import org.openstreetmap.josm.Main;
    2223import org.openstreetmap.josm.data.coor.LatLon;
     24import org.openstreetmap.josm.data.gpx.GpxConstants;
     25import org.openstreetmap.josm.data.gpx.GpxLink;
     26import org.openstreetmap.josm.data.gpx.WayPoint;
    2327import org.openstreetmap.josm.tools.ImageProvider;
    2428
     
    8387    }
    8488
     89    @Override
     90    public WayPoint convertToWayPoint() {
     91        WayPoint wpt = super.convertToWayPoint();
     92        GpxLink link = new GpxLink(imageUrl.toString());
     93        link.type = "image";
     94        wpt.attr.put(GpxConstants.META_LINKS, Collections.singleton(link));
     95        return wpt;
     96    }
     97
    8598}
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java

    r5681 r5684  
    88import java.net.MalformedURLException;
    99import java.net.URL;
     10import java.text.DateFormat;
     11import java.text.SimpleDateFormat;
    1012import java.util.ArrayList;
    1113import java.util.Collection;
     14import java.util.Date;
    1215import java.util.HashMap;
    1316import java.util.LinkedList;
    1417import java.util.List;
    1518import java.util.Map;
     19import java.util.TimeZone;
    1620
    1721import javax.swing.Icon;
     
    2327import org.openstreetmap.josm.data.coor.EastNorth;
    2428import org.openstreetmap.josm.data.coor.LatLon;
     29import org.openstreetmap.josm.data.gpx.Extensions;
    2530import org.openstreetmap.josm.data.gpx.GpxConstants;
    2631import org.openstreetmap.josm.data.gpx.GpxLink;
     
    181186        Marker.markerProducers.add(new MarkerProducers() {
    182187            @SuppressWarnings("unchecked")
     188            @Override
    183189            public Marker createMarker(WayPoint wpt, File relativePath, MarkerLayer parentLayer, double time, double offset) {
    184190                String uri = null;
     
    217223                }
    218224                else if (url.toString().endsWith(".wav")) {
    219                     return new AudioMarker(wpt.getCoor(), wpt, url, parentLayer, time, offset);
     225                    AudioMarker audioMarker = new AudioMarker(wpt.getCoor(), wpt, url, parentLayer, time, offset);
     226                    Extensions exts = (Extensions) wpt.get(GpxConstants.META_EXTENSIONS);
     227                    if (exts != null && exts.containsKey("offset")) {
     228                        try {
     229                            double syncOffset = Double.parseDouble(exts.get("sync-offset"));
     230                            audioMarker.syncOffset = syncOffset;
     231                        } catch (NumberFormatException nfe) {}
     232                    }
     233                    return audioMarker;
    220234                } else if (url.toString().endsWith(".png") || url.toString().endsWith(".jpg") || url.toString().endsWith(".jpeg") || url.toString().endsWith(".gif")) {
    221235                    return new ImageMarker(wpt.getCoor(), url, parentLayer, time, offset);
     
    234248     * @param relativePath An path to use for constructing relative URLs or
    235249     *        <code>null</code> for no relative URLs
     250     * @param parentLayer the <code>MarkerLayer</code> that will contain the created <code>Marker</code>
     251     * @param time time of the marker in seconds since epoch
    236252     * @param offset double in seconds as the time offset of this marker from
    237253     *        the GPX file from which it was derived (if any).
     
    247263    }
    248264
     265    private static final DateFormat timeFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
     266    static {
     267         TimeZone tz = TimeZone.getTimeZone("UTC");
     268         timeFormatter.setTimeZone(tz);
     269    }
     270
    249271    public static final String MARKER_OFFSET = "waypointOffset";
    250272    public static final String MARKER_FORMATTED_OFFSET = "formattedWaypointOffset";
     
    254276    public static final String LABEL_PATTERN_DESC = "{desc}";
    255277
    256 
    257278    private final TemplateEngineDataProvider dataProvider;
    258279    private final String text;
     
    260281    public final Icon symbol;
    261282    public final MarkerLayer parentLayer;
    262     public double time; /* absolute time of marker since epoch */
     283    public double time; /* absolute time of marker in seconds since epoch */
    263284    public double offset; /* time offset in seconds from the gpx point from which it was derived,
    264285                             may be adjusted later to sync with other data, so not final */
     
    296317    }
    297318
     319    /**
     320     * Convert Marker to WayPoint so it can be exported to a GPX file.
     321     *
     322     * Override in subclasses to add all necessary attributes.
     323     *
     324     * @return the corresponding WayPoint with all relevant attributes
     325     */
     326    public WayPoint convertToWayPoint() {
     327        WayPoint wpt = new WayPoint(getCoor());
     328        wpt.put("time", timeFormatter.format(new Date(Math.round(time * 1000))));
     329        if (text != null) {
     330            wpt.addExtension("text", text);
     331        } else if (dataProvider != null) {
     332            for (String key : dataProvider.getTemplateKeys()) {
     333                Object value = dataProvider.getTemplateValue(key, false);
     334                if (value != null && GpxConstants.WPT_KEYS.contains(key)) {
     335                    wpt.put(key, value);
     336                }
     337            }
     338        }
     339        return wpt;
     340    }
     341
    298342    public final void setCoor(LatLon coor) {
    299343        if(this.coor == null) {
     
    343387     * @param mv map view
    344388     * @param mousePressed true if the left mouse button is pressed
     389     * @param showTextOrIcon true if text and icon shall be drawn
    345390     */
    346391    public void paint(Graphics g, MapView mv, boolean mousePressed, boolean showTextOrIcon) {
     
    398443    }
    399444
    400     private String formatOffset () {
     445    private String formatOffset() {
    401446        int wholeSeconds = (int)(offset + 0.5);
    402447        if (wholeSeconds < 60)
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r5681 r5684  
    3232import org.openstreetmap.josm.data.Bounds;
    3333import org.openstreetmap.josm.data.coor.LatLon;
     34import org.openstreetmap.josm.data.gpx.Extensions;
    3435import org.openstreetmap.josm.data.gpx.GpxConstants;
    3536import org.openstreetmap.josm.data.gpx.GpxData;
     
    108109                }
    109110            }
    110             Marker m = Marker.createMarker(wpt, indata.storageFile, this, time, time - firstTime);
     111            Double offset = null;
     112            // If we have an explicit offset, take it.
     113            // Otherwise, for a group of markers with the same Link-URI (e.g. an
     114            // audio file) calculate the offset relative to the first marker of
     115            // that group. This way the user can jump to the corresponding
     116            // playback positions in a long audio track.
     117            Extensions exts = (Extensions) wpt.get(GpxConstants.META_EXTENSIONS);
     118            if (exts != null && exts.containsKey("offset")) {
     119                try {
     120                    offset = Double.parseDouble(exts.get("offset"));
     121                } catch (NumberFormatException nfe) {}
     122            }
     123            if (offset == null) {
     124                offset = time - firstTime;
     125            }
     126            Marker m = Marker.createMarker(wpt, indata.storageFile, this, time, offset);
    111127            if (m != null) {
    112128                data.add(m);
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerProducers.java

    r1169 r5684  
    2424     * @return A Marker object, or <code>null</code>.
    2525     */
    26     public Marker createMarker(WayPoint wp, File relativePath, MarkerLayer parentLayer, double time, double offset);
     26    Marker createMarker(WayPoint wp, File relativePath, MarkerLayer parentLayer, double time, double offset);
    2727}
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/WebMarker.java

    r4282 r5684  
    66import java.awt.event.ActionEvent;
    77import java.net.URL;
     8import java.util.Collections;
    89
    910import javax.swing.JOptionPane;
     
    1112import org.openstreetmap.josm.Main;
    1213import org.openstreetmap.josm.data.coor.LatLon;
     14import org.openstreetmap.josm.data.gpx.GpxConstants;
     15import org.openstreetmap.josm.data.gpx.GpxLink;
     16import org.openstreetmap.josm.data.gpx.WayPoint;
    1317import org.openstreetmap.josm.tools.OpenBrowser;
    1418
     
    3842        }
    3943    }
     44
     45    @Override
     46    public WayPoint convertToWayPoint() {
     47        WayPoint wpt = super.convertToWayPoint();
     48        GpxLink link = new GpxLink(webUrl.toString());
     49        link.type = "web";
     50        wpt.attr.put(GpxConstants.META_LINKS, Collections.singleton(link));
     51        return wpt;
     52    }
    4053}
  • trunk/src/org/openstreetmap/josm/io/GpxReader.java

    r5681 r5684  
    340340                    currentState = states.pop();
    341341                    convertUrlToLink(currentWayPoint.attr);
     342                    if (currentExtensions != null && !currentExtensions.isEmpty()) {
     343                        currentWayPoint.attr.put(META_EXTENSIONS, currentExtensions);
     344                    }
    342345                    data.waypoints.add(currentWayPoint);
    343346                }
  • trunk/src/org/openstreetmap/josm/io/GpxWriter.java

    r5681 r5684  
    1111import java.util.Collection;
    1212import java.util.Map;
     13import java.util.Map.Entry;
    1314
    1415import org.openstreetmap.josm.data.Bounds;
    1516import org.openstreetmap.josm.data.coor.LatLon;
     17import org.openstreetmap.josm.data.gpx.Extensions;
    1618import org.openstreetmap.josm.data.gpx.GpxConstants;
    1719import org.openstreetmap.josm.data.gpx.GpxData;
     
    2022import org.openstreetmap.josm.data.gpx.GpxTrack;
    2123import org.openstreetmap.josm.data.gpx.GpxTrackSegment;
     24import org.openstreetmap.josm.data.gpx.IWithAttributes;
    2225import org.openstreetmap.josm.data.gpx.WayPoint;
    2326
     
    4245    private GpxData data;
    4346    private String indent = "";
     47    public String creator = "JOSM GPX export";
    4448
    4549    private final static int WAY_POINT = 0;
     
    4953    public void write(GpxData data) {
    5054        this.data = data;
     55        // We write JOSM specific meta information into gpx 'extensions' elements.
     56        // In particular it is noted whether the gpx data is from the OSM server
     57        // (so the rendering of clouds of anonymous TrackPoints can be improved)
     58        // and some extra synchronization info for export of AudioMarkers.
     59        // It is checked in advance, if any extensions are used, so we know whether
     60        // a namespace declaration is necessary.
     61        boolean hasExtensions = data.fromServer;
     62        if (!hasExtensions) {
     63            for (WayPoint wpt : data.waypoints) {
     64                Extensions extensions = (Extensions) wpt.get(META_EXTENSIONS);
     65                if (extensions != null && !extensions.isEmpty()) {
     66                    hasExtensions = true;
     67                    break;
     68                }
     69            }
     70        }
     71       
    5172        out.println("<?xml version='1.0' encoding='UTF-8'?>");
    5273        out.println("<gpx version=\"1.1\" creator=\"JOSM GPX export\" xmlns=\"http://www.topografix.com/GPX/1/1\"\n" +
    53                 (data.fromServer ? String.format("    xmlns:josm=\"%s\"\n", JOSM_EXTENSIONS_NAMESPACE_URI) : "") +
     74                (hasExtensions ? String.format("    xmlns:josm=\"%s\"\n", JOSM_EXTENSIONS_NAMESPACE_URI) : "") +
    5475                "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" +
    5576                "    xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">");
     
    6384    }
    6485
    65     @SuppressWarnings("unchecked")
    66     private void writeAttr(Map<String, Object> attr) {
     86    private void writeAttr(IWithAttributes obj) {
    6787        for (String key : WPT_KEYS) {
    68             Object value = attr.get(key);
    69             if (value != null) {
    70                 if (key.equals(META_LINKS)) {
    71                     for (GpxLink link : (Collection<GpxLink>) value) {
     88            if (key.equals(META_LINKS)) {
     89                @SuppressWarnings("unchecked")
     90                Collection<GpxLink> lValue = obj.getCollection(key);
     91                if (lValue != null) {
     92                    for (GpxLink link : lValue) {
    7293                        gpxLink(link);
    7394                    }
    74                 } else {
    75                     simpleTag(key, value.toString());
     95                }
     96            } else if (key.equals(META_EXTENSIONS)) {
     97                Extensions extensions = (Extensions) obj.get(key);
     98                if (extensions != null) {
     99                    gpxExtensions(extensions);
     100                }
     101            } else {
     102                String value = obj.getString(key);
     103                if (value != null) {
     104                    simpleTag(key, value);
    76105                }
    77106            }
     
    157186        for (GpxRoute rte : data.routes) {
    158187            openln("rte");
    159             writeAttr(rte.attr);
     188            writeAttr(rte);
    160189            for (WayPoint pnt : rte.routePoints) {
    161190                wayPoint(pnt, ROUTE_POINT);
     
    168197        for (GpxTrack trk : data.tracks) {
    169198            openln("trk");
    170             writeAttr(trk.getAttributes());
     199            writeAttr(trk);
    171200            for (GpxTrackSegment seg : trk.getSegments()) {
    172201                openln("trkseg");
     
    259288            } else {
    260289                openAtt(type, coordAttr);
    261                 writeAttr(pnt.attr);
     290                writeAttr(pnt);
    262291                closeln(type);
    263292            }
    264293        }
    265294    }
     295
     296    private void gpxExtensions(Extensions extensions) {
     297        if (extensions != null && !extensions.isEmpty()) {
     298            openln("extensions");
     299            for (Entry<String, String> e : extensions.entrySet()) {
     300                simpleTag("josm:" + e.getKey(), e.getValue());
     301            }
     302            closeln("extensions");
     303        }
     304    }
    266305}
  • trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionImporter.java

    r5505 r5684  
    88import java.util.ArrayList;
    99import java.util.Date;
    10 import java.util.HashMap;
    1110import java.util.List;
    12 import java.util.Map;
    1311
    14 import org.openstreetmap.josm.data.Preferences;
    1512import org.openstreetmap.josm.data.coor.LatLon;
    16 import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1713import org.openstreetmap.josm.gui.layer.GpxLayer;
    18 import org.openstreetmap.josm.gui.layer.ImageryLayer;
    1914import org.openstreetmap.josm.gui.layer.Layer;
    2015import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer;
     
    9590    }
    9691
    97 
    98 
    9992}
  • trunk/src/org/openstreetmap/josm/io/session/GpxTracksSessionImporter.java

    r5501 r5684  
    1313import javax.xml.xpath.XPathFactory;
    1414
     15import org.w3c.dom.Element;
     16
    1517import org.openstreetmap.josm.gui.layer.Layer;
    1618import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1719import org.openstreetmap.josm.io.GpxImporter;
    1820import org.openstreetmap.josm.io.IllegalDataException;
    19 import org.w3c.dom.Element;
    2021
    2122public class GpxTracksSessionImporter implements SessionLayerImporter {
     
    3637            }
    3738
    38             GpxImporter importer = new GpxImporter();
    3939            InputStream in = support.getInputStream(fileStr);
    40             GpxImporter.GpxImporterData importData = importer.loadLayers(in, support.getFile(fileStr), support.getLayerName(), null, progressMonitor);
     40            GpxImporter.GpxImporterData importData = GpxImporter.loadLayers(in, support.getFile(fileStr), support.getLayerName(), null, progressMonitor);
    4141
    4242            support.addPostLayersTask(importData.getPostLayerTask());
  • trunk/src/org/openstreetmap/josm/io/session/ImagerySessionExporter.java

    r5391 r5684  
    3030
    3131    private ImageryLayer layer;
    32 
     32    private JCheckBox export;
     33   
    3334    public ImagerySessionExporter(ImageryLayer layer) {
    3435        this.layer = layer;
     
    4243        this((ImageryLayer) layer);
    4344    }
    44 
    45     private JCheckBox export;
    4645
    4746    @Override
  • trunk/src/org/openstreetmap/josm/io/session/ImagerySessionImporter.java

    r5391 r5684  
    88import java.util.Map;
    99
     10import org.w3c.dom.Element;
     11import org.w3c.dom.Node;
     12import org.w3c.dom.NodeList;
     13
    1014import org.openstreetmap.josm.data.Preferences;
    1115import org.openstreetmap.josm.data.imagery.ImageryInfo;
     
    1620import org.openstreetmap.josm.io.IllegalDataException;
    1721import org.openstreetmap.josm.io.session.SessionReader.ImportSupport;
    18 import org.w3c.dom.Element;
    19 import org.w3c.dom.Node;
    20 import org.w3c.dom.NodeList;
    2122
    2223/**
  • trunk/src/org/openstreetmap/josm/io/session/OsmDataSessionExporter.java

    r5501 r5684  
    3535import javax.swing.SwingConstants;
    3636
     37import org.w3c.dom.Element;
     38
    3739import org.openstreetmap.josm.actions.SaveAction;
    3840import org.openstreetmap.josm.gui.layer.Layer;
     
    4446import org.openstreetmap.josm.tools.GBC;
    4547import org.openstreetmap.josm.tools.ImageProvider;
    46 import org.w3c.dom.Element;
    4748
    4849public class OsmDataSessionExporter implements SessionLayerExporter {
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r5670 r5684  
    6363        registerSessionLayerImporter("tracks", GpxTracksSessionImporter.class);
    6464        registerSessionLayerImporter("geoimage", GeoImageSessionImporter.class);
     65        registerSessionLayerImporter("markers", MarkerSessionImporter.class);
    6566    }
    6667
     
    305306                if (scaleEl != null && scaleEl.hasAttribute("meter-per-pixel")) {
    306307                    try {
    307                         Double meterPerPixel = Double.parseDouble(scaleEl.getAttribute("meter-per-pixel"));
     308                        double meterPerPixel = Double.parseDouble(scaleEl.getAttribute("meter-per-pixel"));
    308309                        Projection proj = Main.getProjection();
    309310                        // Get a "typical" distance in east/north units that
  • trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java

    r5670 r5684  
    2828import javax.xml.transform.stream.StreamResult;
    2929
     30import org.w3c.dom.Document;
     31import org.w3c.dom.Element;
     32import org.w3c.dom.Text;
     33
    3034import org.openstreetmap.josm.Main;
    3135import org.openstreetmap.josm.data.coor.EastNorth;
     
    3842import org.openstreetmap.josm.gui.layer.WMSLayer;
    3943import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer;
     44import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    4045import org.openstreetmap.josm.tools.MultiMap;
    4146import org.openstreetmap.josm.tools.Utils;
    42 import org.w3c.dom.Document;
    43 import org.w3c.dom.Element;
    44 import org.w3c.dom.Text;
    4547
    4648public class SessionWriter {
     
    5456        registerSessionLayerExporter(GpxLayer.class , GpxTracksSessionExporter.class);
    5557        registerSessionLayerExporter(GeoImageLayer.class , GeoImageSessionExporter.class);
     58        registerSessionLayerExporter(MarkerLayer.class, MarkerSessionExporter.class);
    5659    }
    5760
Note: See TracChangeset for help on using the changeset viewer.