X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=gps%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fgpx%2FGpxPlotter.java;h=ad7b187e4826372d9195477aeb5b3aedb12c110d;hb=2207a1e695ce23e79678c232cff2ceb84ebaa801;hp=f239cabf4a3b7aadc01807f000f0ea0caf45b3dd;hpb=4a27bb58a18d180cfd21ba0d59c35d775dec064c;p=utils diff --git a/gps/src/main/java/org/wamblee/gpx/GpxPlotter.java b/gps/src/main/java/org/wamblee/gpx/GpxPlotter.java index f239cabf..ad7b187e 100644 --- a/gps/src/main/java/org/wamblee/gpx/GpxPlotter.java +++ b/gps/src/main/java/org/wamblee/gpx/GpxPlotter.java @@ -40,19 +40,24 @@ import org.wamblee.general.Pair; import org.wamblee.gps.geometry.Plane; import org.wamblee.gps.geometry.Point; import org.wamblee.gps.geometry.ReferenceCoordinateSystem; -import org.wamblee.gps.track.Track; +import org.wamblee.gps.track.TrackSegment; import org.wamblee.utils.JpegUtils; /** * Parses a GPX file and prints out a data file with each trackpoints distance from the start of the * track and its elevation, separated 0by a space. + * + * @author Erik Brakkee */ public class GpxPlotter { public static void main(String[] aArgs) throws Exception { File file = new File(aArgs[0]); GpxParser parser = new GpxParser(); - Track track = parser.parse(new FileInputStream(file)); + TrackSegment track = parser.parse(file.getName(), new FileInputStream(file)); + + TrackStatistics profile = new TrackStatistics(track); + profile.writeHeightProfilePng(new FileOutputStream("x.png"), 600, 300); List> elevationProfile = computeElevationProfile(track); printTrack(elevationProfile); @@ -63,7 +68,7 @@ public class GpxPlotter { plotTrack(trackLatLon); } - private static List> computeElevationProfile(Track aTrack) { + private static List> computeElevationProfile(TrackSegment aTrack) { List> results = new ArrayList>(); double distance = 0.0; for (int i = 0; i < aTrack.size(); i++) { @@ -77,7 +82,7 @@ public class GpxPlotter { return results; } - private static List> computeTrackXY(Track aTrack) { + private static List> computeTrackXY(TrackSegment aTrack) { Point reference = aTrack.getPoint(0); Plane plane = new Plane(reference, reference); // assume the earth is spherical. List> results = new ArrayList>(); @@ -90,7 +95,7 @@ public class GpxPlotter { return results; } - private static List> computeTrackLatLon(Track aTrack) { + private static List> computeTrackLatLon(TrackSegment aTrack) { List> results = new ArrayList>(); for (int i = 0; i < aTrack.size(); i++) { Point point = aTrack.getPoint(i);