forked from JOSM/josm-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tcxplugin moved into dataimport - patch by dmuecke
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
Showing
83 changed files
with
74 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
|
@@ -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; | ||
|
@@ -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 | ||
|
@@ -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); | ||
|
@@ -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())); | ||
|
@@ -188,7 +214,7 @@ private void parseDataFromCourses(TrainingCenterDatabaseT tcd) { | |
} | ||
} | ||
|
||
public GpxData getGpxData() { | ||
private GpxData getGpxData() { | ||
return gpxData; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.