Changeset 16382 in osm for applications/editors/josm


Ignore:
Timestamp:
2009-07-08T16:30:54+02:00 (16 years ago)
Author:
stoecker
Message:

tcxplugin moved into dataimport - patch by dmuecke

Location:
applications/editors/josm/plugins
Files:
1 deleted
5 edited
5 copied

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/build.xml

    r16177 r16382  
    3333        <ant antfile="build.xml" target="dist" dir="tagging-preset-tester"/>
    3434        <ant antfile="build.xml" target="dist" dir="tageditor"/>
    35         <ant antfile="build.xml" target="dist" dir="tcxplugin"/>
    3635        <ant antfile="build.xml" target="dist" dir="terracer"/>
    3736        <ant antfile="build.xml" target="dist" dir="usertools"/>
     
    7473        <ant antfile="build.xml" target="clean" dir="tagging-preset-tester"/>
    7574        <ant antfile="build.xml" target="clean" dir="tageditor"/>
    76         <ant antfile="build.xml" target="clean" dir="tcxplugin"/>
    7775        <ant antfile="build.xml" target="clean" dir="terracer"/>
    7876        <ant antfile="build.xml" target="clean" dir="usertools"/>
  • applications/editors/josm/plugins/dataimport/.classpath

    r16176 r16382  
    33        <classpathentry kind="src" path="src"/>
    44        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
     5        <classpathentry exported="true" kind="lib" path="lib/jsr173-1.0_api.jar"/>
     6        <classpathentry exported="true" kind="lib" path="lib/jaxb-impl.jar"/>
     7        <classpathentry exported="true" kind="lib" path="lib/jaxb-api.jar"/>
     8        <classpathentry exported="true" kind="lib" path="lib/activation.jar"/>
    59        <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
    610        <classpathentry kind="output" path="bin"/>
  • applications/editors/josm/plugins/dataimport/README

    r16176 r16382  
    1 README 
     1README
    22======
    33
    44This plugin adds additional file formats into file open dialog.
    55
    6 Following file formats are support:
     6Following file formats get support:
    77
    88- TangoGPS
     9- Garmin Trainings Center TCX
  • applications/editors/josm/plugins/dataimport/build.xml

    r16176 r16382  
    5151    <target name="compile" depends="init">
    5252        <echo message="compiling sources for  ${plugin.jar} ... "/>
    53         <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
     53        <javac srcdir="src" debug="true" destdir="${plugin.build.dir}">
    5454            <compilerarg value="-Xlint:deprecation"/>
    5555            <compilerarg value="-Xlint:unchecked"/>
     56            <classpath>
     57                <pathelement location="${josm}"/>
     58                <fileset dir="lib">
     59                    <include name="**/*.jar"/>
     60                </fileset>
     61            </classpath>
    5662        </javac>
    5763    </target>
     
    7985        ************************************************
    8086    -->
    81             <manifest>
     87          <zipfileset src="lib/jsr173-1.0_api.jar" includes="**/*.class"/>
     88          <zipfileset src="lib/jaxb-api.jar" includes="**/*.class"/>
     89          <zipfileset src="lib/jaxb-api.jar" includes="**/*.properties"/>
     90
     91          <zipfileset src="lib/jaxb-impl.jar" includes="**/*.class"/>
     92
     93          <manifest>
    8294                <attribute name="Author" value="Dieter Muecke"/>
    8395                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.DataImport"/>
  • applications/editors/josm/plugins/dataimport/src/org/openstreetmap/josm/io/Tcx.java

    r16362 r16382  
    22package org.openstreetmap.josm.io;
    33
     4import static org.openstreetmap.josm.tools.I18n.tr;
     5
    46import java.io.File;
     7import java.io.IOException;
    58import java.util.ArrayList;
    69import java.util.Collection;
     
    1215import javax.xml.datatype.XMLGregorianCalendar;
    1316
     17import org.openstreetmap.josm.Main;
     18import org.openstreetmap.josm.actions.ExtensionFileFilter;
    1419import org.openstreetmap.josm.data.coor.LatLon;
    1520import org.openstreetmap.josm.data.gpx.GpxData;
    1621import org.openstreetmap.josm.data.gpx.GpxTrack;
    1722import org.openstreetmap.josm.data.gpx.WayPoint;
     23import org.openstreetmap.josm.gui.layer.GpxLayer;
     24import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    1825import org.openstreetmap.josm.io.tcx.ActivityLapT;
    1926import org.openstreetmap.josm.io.tcx.ActivityT;
     
    2330import org.openstreetmap.josm.io.tcx.TrackpointT;
    2431import org.openstreetmap.josm.io.tcx.TrainingCenterDatabaseT;
     32
    2533
    2634/**
     
    4351 * to the endorsed directory (create it if necessary) of your JRE. Usually it is something like this:
    4452 * \<program files>\Java\jre<java version>\lib\endorsed
    45  * 
     53 *
    4654 * @author adrian <as@nitegate.de>
    47  * 
     55 *
    4856 */
    49 public class TcxReader {
    50 
    51     private File tcxFile;
     57public class Tcx extends FileImporter {
     58
     59    //private File tcxFile;
    5260
    5361    private GpxData gpxData;
    5462
     63
     64    public Tcx() {
     65        super(new ExtensionFileFilter("tcx", "tcx",tr("TCX Files (*.tcx)")));
     66    }
     67
    5568    /**
    5669     * @param tcxFile
    5770     */
    58     public TcxReader(File tcxFile) {
    59         super();
    60         this.tcxFile = tcxFile;
    61         parseFile();
    62     }
    63 
    64     /**
    65      *
    66      */
    67     @SuppressWarnings("unchecked") private void parseFile() {
     71    @Override
     72    public void importData(File tcxFile) throws IOException {
     73        //this.tcxFile = tcxFile;
     74        parseFile(tcxFile);
     75
     76        GpxData gpxData = getGpxData();
     77        gpxData.storageFile = tcxFile;
     78        GpxLayer gpxLayer = new GpxLayer(gpxData, tcxFile.getName());
     79        Main.main.addLayer(gpxLayer);
     80        if (Main.pref.getBoolean("marker.makeautomarkers", true))
     81        {
     82            MarkerLayer ml = new MarkerLayer(gpxData, tr("Markers from {0}", tcxFile.getName()), tcxFile, gpxLayer);
     83            if (ml.data.size() > 0)
     84            {
     85                Main.main.addLayer(ml);
     86            }
     87        }
     88
     89    }
     90
     91    /**
     92     *
     93     */
     94    @SuppressWarnings("unchecked") private void parseFile(File tcxFile) {
    6895        try {
    6996            JAXBContext jc = JAXBContext
     
    96123        PositionT p = tp.getPosition();
    97124
    98         if (p == null) {
     125        if (p == null)
    99126            // If the TrackPointT lacks a position, return null.
    100127            return null;
    101         }
    102128
    103129        WayPoint waypt = new WayPoint(new LatLon(p.getLatitudeDegrees(),
     
    189215    }
    190216
    191     public GpxData getGpxData() {
     217    private GpxData getGpxData() {
    192218        return gpxData;
    193219    }
  • applications/editors/josm/plugins/dataimport/src/org/openstreetmap/josm/plugins/DataImport.java

    r16176 r16382  
    44package org.openstreetmap.josm.plugins;
    55
     6import java.io.IOException;
     7
    68import org.openstreetmap.josm.actions.ExtensionFileFilter;
    79import org.openstreetmap.josm.io.TangoGPS;
     10import org.openstreetmap.josm.io.Tcx;
    811
    912public class DataImport extends Plugin {
    1013
    11         /**
    12          * Add new File import filter into open dialog
    13          */
    14         public DataImport() {
    15                 super();
    16                 ExtensionFileFilter.importers.add(new TangoGPS());
    17         }
     14    /**
     15     * Add new File import filter into open dialog
     16     */
     17    public DataImport() throws IOException{
     18        super();
     19
     20        ExtensionFileFilter.importers.add(new TangoGPS());
     21        ExtensionFileFilter.importers.add(new Tcx());
     22    }
     23
    1824
    1925}
Note: See TracChangeset for help on using the changeset viewer.