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;
super(inApp);
}
+ /** @return name key */
+ public String getNameKey() {
+ return "menu.track.markrectangle";
+ }
+
/**
* Set the coordinates of the rectangle
* @param inLon1 first longitude value
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++;
// 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";
- }
}