X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2Fcompress%2FWackyPointAlgorithm.java;fp=tim%2Fprune%2Ffunction%2Fcompress%2FWackyPointAlgorithm.java;h=0000000000000000000000000000000000000000;hb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;hp=66a4a486e58b44e3df6e24d9d9a9992cb6104394;hpb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465;p=GpsPrune.git diff --git a/tim/prune/function/compress/WackyPointAlgorithm.java b/tim/prune/function/compress/WackyPointAlgorithm.java deleted file mode 100644 index 66a4a48..0000000 --- a/tim/prune/function/compress/WackyPointAlgorithm.java +++ /dev/null @@ -1,86 +0,0 @@ -package tim.prune.function.compress; - -import java.awt.Component; -import java.awt.event.ActionListener; - -import tim.prune.data.DataPoint; -import tim.prune.data.Track; - -/** - * Algorithm for detecting wacky points to compress - */ -public class WackyPointAlgorithm extends SingleParameterAlgorithm -{ - /** - * Constructor - * @param inTrack track object - * @param inDetails track details object - * @param inListener listener to attach to activation control - */ - public WackyPointAlgorithm(Track inTrack, TrackDetails inDetails, ActionListener inListener) - { - super(inTrack, inDetails, inListener); - } - - /** - * Perform the compression and work out which points should be deleted - * @param inFlags deletion flags from previous algorithms - * @return number of points deleted - */ - protected int compress(boolean[] inFlags) - { - double param = getParameter(); - if (param <= 0.0) return 0; - int numPoints = _track.getNumPoints(); - int numDeleted = 0; - double threshold = param * _trackDetails.getMeanRadians(); - DataPoint currPoint = null, prevPoint = null; - // Loop over all points looking for points far away from neighbours - for (int i=0; i threshold) - { - // Now need to find next track point, and measure distances - DataPoint nextPoint = _track.getNextTrackPoint(i+1); - if (nextPoint != null && DataPoint.calculateRadiansBetween(currPoint, nextPoint) > threshold - && DataPoint.calculateRadiansBetween(prevPoint, nextPoint) < threshold) - { - // Found a point to delete (hope that next point hasn't been deleted already) - inFlags[i] = true; - numDeleted++; - } - } - } - // Remember last (not-deleted) track point - if (!currPoint.isWaypoint()) {prevPoint = currPoint;} - } - } - return numDeleted; - } - - /** - * @return specific gui components for dialog - */ - protected Component getSpecificGuiComponents() - { - return getSpecificGuiComponents("dialog.compress.wackypoints.paramdesc", "2"); - } - - /** - * @return title key for box - */ - protected String getTitleTextKey() - { - return "dialog.compress.wackypoints.title"; - } - -}