Changeset 30737 in osm for applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogLayer.java
- Timestamp:
- 2014-10-18T23:07:52+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/NanoLog/src/nanolog/NanoLogLayer.java
r30701 r30737 1 1 package nanolog; 2 2 3 import java.awt.*; 4 import java.awt.event.*; 5 import java.io.*; 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 5 import java.awt.Color; 6 import java.awt.Graphics2D; 7 import java.awt.Point; 8 import java.awt.event.ActionEvent; 9 import java.awt.event.MouseAdapter; 10 import java.awt.event.MouseEvent; 11 import java.io.BufferedReader; 12 import java.io.File; 13 import java.io.FileInputStream; 14 import java.io.IOException; 15 import java.io.InputStreamReader; 6 16 import java.text.ParseException; 7 17 import java.text.SimpleDateFormat; 8 import java.util.*; 18 import java.util.ArrayList; 19 import java.util.Collections; 20 import java.util.Date; 21 import java.util.HashSet; 9 22 import java.util.List; 10 import java.util.regex.*; 11 import javax.swing.*; 23 import java.util.Set; 24 import java.util.regex.Matcher; 25 import java.util.regex.Pattern; 26 27 import javax.swing.Action; 28 import javax.swing.Icon; 29 import javax.swing.JOptionPane; 30 12 31 import org.openstreetmap.josm.Main; 13 import org.openstreetmap.josm.actions.*; 32 import org.openstreetmap.josm.actions.JosmAction; 33 import org.openstreetmap.josm.actions.RenameLayerAction; 14 34 import org.openstreetmap.josm.data.Bounds; 15 35 import org.openstreetmap.josm.data.coor.EastNorth; … … 18 38 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 19 39 import org.openstreetmap.josm.gui.MapView; 20 import org.openstreetmap.josm.gui.dialogs.*; 21 import org.openstreetmap.josm.gui.layer.*; 22 import static org.openstreetmap.josm.tools.I18n.tr; 40 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 41 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; 42 import org.openstreetmap.josm.gui.layer.GpxLayer; 43 import org.openstreetmap.josm.gui.layer.JumpToMarkerActions; 44 import org.openstreetmap.josm.gui.layer.Layer; 23 45 import org.openstreetmap.josm.tools.ImageProvider; 24 46 … … 32 54 private List<NanoLogEntry> log; 33 55 private int selectedEntry; 34 private final Set<NanoLogLayerListener> listeners = new HashSet< NanoLogLayerListener>();56 private final Set<NanoLogLayerListener> listeners = new HashSet<>(); 35 57 private NLLMouseAdapter mouseListener; 36 58 37 59 public NanoLogLayer( List<NanoLogEntry> entries ) { 38 60 super(tr("NanoLog")); 39 log = new ArrayList< NanoLogEntry>(entries);61 log = new ArrayList<>(entries); 40 62 selectedEntry = -1; 41 63 mouseListener = new NLLMouseAdapter(); … … 50 72 super.destroy(); 51 73 } 52 74 53 75 public NanoLogLayer( File file ) throws IOException { 54 76 this(readNanoLog(file)); … … 76 98 return Collections.unmodifiableList(log); 77 99 } 78 100 79 101 public static List<NanoLogEntry> readNanoLog( File file ) throws IOException { 80 102 final Pattern NANOLOG_LINE = Pattern.compile("(.+?)\\t(.+?)(?:\\s*\\{\\{(-?\\d+\\.\\d+),\\s*(-?\\d+\\.\\d+)(?:,\\s*(\\d+))?\\}\\})?"); 81 103 final SimpleDateFormat fmt = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SS"); 82 List<NanoLogEntry> result = new ArrayList< NanoLogEntry>();104 List<NanoLogEntry> result = new ArrayList<>(); 83 105 BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF8")); 84 106 while( r.ready() ) { … … 301 323 Main.map.mapView.repaint(); 302 324 } 303 325 304 326 private class CorrelateEntries extends JosmAction { 305 327 private boolean toZero; … … 328 350 } 329 351 } 330 352 331 353 private class SaveLayer extends JosmAction { 332 354
Note:
See TracChangeset
for help on using the changeset viewer.