X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2Fcompress%2FMarkPointsInRectangleFunction.java;h=2ea0f8ca64c495486cec33d3a94d82598f5f2b5d;hb=1a735a99408fd3b0c5ac4fe7b2fdbdbb23d38f40;hp=73c867f8c5b786944a2ee7c652a43be5ee4048b1;hpb=4d5796d02a15808311c09448d79e6e7d1de9d636;p=GpsPrune.git diff --git a/tim/prune/function/compress/MarkPointsInRectangleFunction.java b/tim/prune/function/compress/MarkPointsInRectangleFunction.java index 73c867f..2ea0f8c 100644 --- a/tim/prune/function/compress/MarkPointsInRectangleFunction.java +++ b/tim/prune/function/compress/MarkPointsInRectangleFunction.java @@ -1,17 +1,13 @@ package tim.prune.function.compress; -import javax.swing.JOptionPane; - import tim.prune.App; -import tim.prune.GenericFunction; -import tim.prune.I18nManager; import tim.prune.UpdateMessageBroker; import tim.prune.data.DataPoint; /** * Function to mark all the points in the selected rectangle */ -public class MarkPointsInRectangleFunction extends GenericFunction +public class MarkPointsInRectangleFunction extends MarkAndDeleteFunction { /** Minimum and maximum latitude values of rectangle */ private double _minLat = 0.0, _maxLat = 0.0; @@ -28,6 +24,11 @@ public class MarkPointsInRectangleFunction extends GenericFunction super(inApp); } + /** @return name key */ + public String getNameKey() { + return "menu.track.markrectangle"; + } + /** * Set the coordinates of the rectangle * @param inLon1 first longitude value @@ -79,7 +80,7 @@ public class MarkPointsInRectangleFunction extends GenericFunction final double pointLat = point.getLatitude().getDouble(); final boolean insideRect = (pointLon >= _minLon && pointLon <= _maxLon && pointLat >= _minLat && pointLat <= _maxLat); - // If so, then mark it + // Mark it accordingly (also resetting points outside the rect to false) point.setMarkedForDeletion(insideRect); if (insideRect) { numMarked++; @@ -89,15 +90,9 @@ public class MarkPointsInRectangleFunction extends GenericFunction // Inform subscribers to update display UpdateMessageBroker.informSubscribers(); // Confirm message showing how many marked - if (numMarked > 0) { - JOptionPane.showMessageDialog(_parentFrame, I18nManager.getText("dialog.compress.confirm1") - + " " + numMarked + " " + I18nManager.getText("dialog.compress.confirm2"), - I18nManager.getText(getNameKey()), JOptionPane.INFORMATION_MESSAGE); + if (numMarked > 0) + { + optionallyDeleteMarkedPoints(numMarked); } } - - /** @return name key */ - public String getNameKey() { - return "menu.track.markrectangle"; - } }