X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FTrack.java;h=9c65437b60abc86df5bd803c3f045d946e89a2f5;hb=ca9bdb3916f9c39adbbf95d06ac95c21dafbb4e6;hp=1188a7c5a83d6edef42a2d8f66c1b7bf59f608df;hpb=da0b1f449260a0b4a94318006382a9039726ef3e;p=GpsPrune.git diff --git a/tim/prune/data/Track.java b/tim/prune/data/Track.java index 1188a7c..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