Skip to content

Commit

Permalink
tcxplugin moved into dataimport - patch by dmuecke
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.openstreetmap.org/applications/editors/josm/plugins@16382 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
  • Loading branch information
stoecker committed Jul 8, 2009
1 parent dd67213 commit ef618a2
Show file tree
Hide file tree
Showing 83 changed files with 74 additions and 222 deletions.
2 changes: 0 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<ant antfile="build.xml" target="dist" dir="surveyor"/>
<ant antfile="build.xml" target="dist" dir="tagging-preset-tester"/>
<ant antfile="build.xml" target="dist" dir="tageditor"/>
<ant antfile="build.xml" target="dist" dir="tcxplugin"/>
<ant antfile="build.xml" target="dist" dir="terracer"/>
<ant antfile="build.xml" target="dist" dir="usertools"/>
<ant antfile="build.xml" target="dist" dir="utilsplugin"/>
Expand Down Expand Up @@ -73,7 +72,6 @@
<ant antfile="build.xml" target="clean" dir="surveyor"/>
<ant antfile="build.xml" target="clean" dir="tagging-preset-tester"/>
<ant antfile="build.xml" target="clean" dir="tageditor"/>
<ant antfile="build.xml" target="clean" dir="tcxplugin"/>
<ant antfile="build.xml" target="clean" dir="terracer"/>
<ant antfile="build.xml" target="clean" dir="usertools"/>
<ant antfile="build.xml" target="clean" dir="utilsplugin"/>
Expand Down
4 changes: 4 additions & 0 deletions dataimport/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="lib" path="lib/jsr173-1.0_api.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jaxb-impl.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jaxb-api.jar"/>
<classpathentry exported="true" kind="lib" path="lib/activation.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
<classpathentry kind="output" path="bin"/>
</classpath>
7 changes: 4 additions & 3 deletions dataimport/README
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
README
README
======

This plugin adds additional file formats into file open dialog.

Following file formats are support:
Following file formats get support:

- TangoGPS
- TangoGPS
- Garmin Trainings Center TCX
16 changes: 14 additions & 2 deletions dataimport/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,15 @@
-->
<target name="compile" depends="init">
<echo message="compiling sources for ${plugin.jar} ... "/>
<javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
<javac srcdir="src" debug="true" destdir="${plugin.build.dir}">
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<pathelement location="${josm}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
</target>

Expand All @@ -78,7 +84,13 @@
**
************************************************
-->
<manifest>
<zipfileset src="lib/jsr173-1.0_api.jar" includes="**/*.class"/>
<zipfileset src="lib/jaxb-api.jar" includes="**/*.class"/>
<zipfileset src="lib/jaxb-api.jar" includes="**/*.properties"/>

<zipfileset src="lib/jaxb-impl.jar" includes="**/*.class"/>

<manifest>
<attribute name="Author" value="Dieter Muecke"/>
<attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.DataImport"/>
<attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.io;

import static org.openstreetmap.josm.tools.I18n.tr;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;

Expand All @@ -11,10 +14,14 @@
import javax.xml.bind.Unmarshaller;
import javax.xml.datatype.XMLGregorianCalendar;

import org.openstreetmap.josm.Main;
import org.openstreetmap.josm.actions.ExtensionFileFilter;
import org.openstreetmap.josm.data.coor.LatLon;
import org.openstreetmap.josm.data.gpx.GpxData;
import org.openstreetmap.josm.data.gpx.GpxTrack;
import org.openstreetmap.josm.data.gpx.WayPoint;
import org.openstreetmap.josm.gui.layer.GpxLayer;
import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
import org.openstreetmap.josm.io.tcx.ActivityLapT;
import org.openstreetmap.josm.io.tcx.ActivityT;
import org.openstreetmap.josm.io.tcx.CourseT;
Expand All @@ -23,6 +30,7 @@
import org.openstreetmap.josm.io.tcx.TrackpointT;
import org.openstreetmap.josm.io.tcx.TrainingCenterDatabaseT;


/**
* TCX Reader. This class is based on code genarated by the Java Architecture
* for XML Binding (JAXB). For this class to work you will need the API und IMPL
Expand All @@ -42,29 +50,48 @@
* Note: if you get an exception that JAXB 2.1 is not supported on your system, you will have to add the jaxb-api.jar
* to the endorsed directory (create it if necessary) of your JRE. Usually it is something like this:
* \<program files>\Java\jre<java version>\lib\endorsed
*
*
* @author adrian <[email protected]>
*
*
*/
public class TcxReader {
public class Tcx extends FileImporter {

private File tcxFile;
//private File tcxFile;

private GpxData gpxData;


public Tcx() {
super(new ExtensionFileFilter("tcx", "tcx",tr("TCX Files (*.tcx)")));
}

/**
* @param tcxFile
*/
public TcxReader(File tcxFile) {
super();
this.tcxFile = tcxFile;
parseFile();
@Override
public void importData(File tcxFile) throws IOException {
//this.tcxFile = tcxFile;
parseFile(tcxFile);

GpxData gpxData = getGpxData();
gpxData.storageFile = tcxFile;
GpxLayer gpxLayer = new GpxLayer(gpxData, tcxFile.getName());
Main.main.addLayer(gpxLayer);
if (Main.pref.getBoolean("marker.makeautomarkers", true))
{
MarkerLayer ml = new MarkerLayer(gpxData, tr("Markers from {0}", tcxFile.getName()), tcxFile, gpxLayer);
if (ml.data.size() > 0)
{
Main.main.addLayer(ml);
}
}

}

/**
*
*
*/
@SuppressWarnings("unchecked") private void parseFile() {
@SuppressWarnings("unchecked") private void parseFile(File tcxFile) {
try {
JAXBContext jc = JAXBContext
.newInstance(TrainingCenterDatabaseT.class);
Expand Down Expand Up @@ -95,10 +122,9 @@ private static WayPoint convertPoint(TrackpointT tp) {

PositionT p = tp.getPosition();

if (p == null) {
if (p == null)
// If the TrackPointT lacks a position, return null.
return null;
}

WayPoint waypt = new WayPoint(new LatLon(p.getLatitudeDegrees(),
p.getLongitudeDegrees()));
Expand Down Expand Up @@ -188,7 +214,7 @@ private void parseDataFromCourses(TrainingCenterDatabaseT tcd) {
}
}

public GpxData getGpxData() {
private GpxData getGpxData() {
return gpxData;
}
}
20 changes: 13 additions & 7 deletions dataimport/src/org/openstreetmap/josm/plugins/DataImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@
*/
package org.openstreetmap.josm.plugins;

import java.io.IOException;

import org.openstreetmap.josm.actions.ExtensionFileFilter;
import org.openstreetmap.josm.io.TangoGPS;
import org.openstreetmap.josm.io.Tcx;

public class DataImport extends Plugin {

/**
* Add new File import filter into open dialog
*/
public DataImport() {
super();
ExtensionFileFilter.importers.add(new TangoGPS());
}
/**
* Add new File import filter into open dialog
*/
public DataImport() throws IOException{
super();

ExtensionFileFilter.importers.add(new TangoGPS());
ExtensionFileFilter.importers.add(new Tcx());
}


}
9 changes: 0 additions & 9 deletions tcxplugin/.classpath

This file was deleted.

17 changes: 0 additions & 17 deletions tcxplugin/.project

This file was deleted.

65 changes: 0 additions & 65 deletions tcxplugin/build.xml

This file was deleted.

Binary file removed tcxplugin/images/tcxicon.png
Binary file not shown.
Loading

0 comments on commit ef618a2

Please sign in to comment.