X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FTrack.java;h=9c65437b60abc86df5bd803c3f045d946e89a2f5;hp=f6ad709b05e3bde338749607e3526426e85b3a9a;hb=ca9bdb3916f9c39adbbf95d06ac95c21dafbb4e6;hpb=63f178fd6c6b30b99a01f2a2d700963ea2dfef8b diff --git a/tim/prune/data/Track.java b/tim/prune/data/Track.java index f6ad709..9c65437 100644 --- a/tim/prune/data/Track.java +++ b/tim/prune/data/Track.java @@ -13,8 +13,6 @@ import tim.prune.edit.FieldEditList; */ public class Track { - // Broker object - UpdateMessageBroker _broker = null; // Data points private DataPoint[] _dataPoints = null; // Scaled x, y values @@ -33,11 +31,9 @@ public class Track /** * Constructor for empty track - * @param inBroker message broker object */ - public Track(UpdateMessageBroker inBroker) + public Track() { - _broker = inBroker; // create field list _masterFieldList = new FieldList(null); // make empty DataPoint array @@ -79,6 +75,11 @@ public class Track } } _numPoints = pointIndex; + // Set first track point to be start of segment + DataPoint firstTrackPoint = getNextTrackPoint(0); + if (firstTrackPoint != null) { + firstTrackPoint.setSegmentStart(true); + } // needs to be scaled _scaled = false; } @@ -89,7 +90,7 @@ public class Track /** * Combine this Track with new data - * @param inOtherTrack + * @param inOtherTrack other track to combine */ public void combine(Track inOtherTrack) { @@ -106,7 +107,7 @@ public class Track // needs to be scaled again _scaled = false; // inform listeners - _broker.informSubscribers(); + UpdateMessageBroker.informSubscribers(); } @@ -121,7 +122,7 @@ public class Track _numPoints = inNewSize; // needs to be scaled again _scaled = false; - _broker.informSubscribers(); + UpdateMessageBroker.informSubscribers(); } } @@ -146,14 +147,17 @@ public class Track if (yscale > wholeScale) wholeScale = yscale; double minDist = wholeScale / inResolution; + // Keep track of segment start flags of the deleted points + boolean setSegment = false; // Copy selected points DataPoint[] newPointArray = new DataPoint[_numPoints]; int[] pointIndices = new int[_numPoints]; for (int i=0; i<_numPoints; i++) { + DataPoint point = _dataPoints[i]; boolean keepPoint = true; // Don't delete waypoints or photo points - if (!_dataPoints[i].isWaypoint() && _dataPoints[i].getPhoto() == null) + if (!point.isWaypoint() && point.getPhoto() == null) { // go through newPointArray to check for range for (int j=0; j