More track data.
[utils] / trunk / gps / src / main / java / org / wamblee / gpx / TrackStatistics.java
index 42c2039e3fad8411b95db686f0ef07c2234131eb..455ca985c0b5c245fe6a9bd40d5986a99a3eaf6e 100644 (file)
@@ -1,5 +1,6 @@
 package org.wamblee.gpx;
 
+import java.awt.Color;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -16,17 +17,17 @@ import org.jfree.data.xy.XYSeriesCollection;
 import org.wamblee.general.Pair;
 import org.wamblee.gps.geometry.Point;
 import org.wamblee.gps.geometry.ReferenceCoordinateSystem;
-import org.wamblee.gps.track.Track;
+import org.wamblee.gps.track.TrackSegment;
 
 public class TrackStatistics implements Serializable {
     
-    private Track _track; 
+    private TrackSegment _track; 
     
-    public TrackStatistics(Track aTrack) {
+    public TrackStatistics(TrackSegment aTrack) {
         _track = aTrack; 
     }
     
-    public void writeHeightProfileJpg(OutputStream aStream, int aWidth, int aHeight) throws IOException {
+    public void writeHeightProfilePng(OutputStream aStream, int aWidth, int aHeight) throws IOException {
         List<Pair<Double,Double>> data = computeElevationProfile();
         XYSeriesCollection dataset = createDataset(data, "height");
         JFreeChart chart = ChartFactory.createXYLineChart(
@@ -38,7 +39,8 @@ public class TrackStatistics implements Serializable {
                 true,
                 true,
                 false);
-        ChartUtilities.writeChartAsJPEG(aStream, chart, aWidth, aHeight);
+        chart.setBackgroundPaint(Color.WHITE);
+        ChartUtilities.writeChartAsPNG(aStream, chart, aWidth, aHeight);
     }
     
     private static XYSeriesCollection createDataset(List<Pair<Double, Double>> aHeightProfile, String aName) {