- Timestamp:
- 2006-07-08T00:08:24+02:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/actions/UploadAction.java
r104 r106 44 44 return; 45 45 } 46 46 47 47 if (!Main.map.conflictDialog.conflicts.isEmpty()) { 48 48 JOptionPane.showMessageDialog(Main.parent,tr("There are unresolved conflicts. You have to resolve these first.")); … … 56 56 final Collection<OsmPrimitive> delete = new LinkedList<OsmPrimitive>(); 57 57 for (OsmPrimitive osm : Main.ds.allPrimitives()) { 58 if (osm.get("josm/ignore") != null) 59 continue; 58 60 if (osm.id == 0 && !osm.deleted) 59 61 add.add(osm); -
src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r104 r106 79 79 deleteWithReferences(Main.ds.getSelected()); 80 80 else 81 delete(Main.ds.getSelected(), false );81 delete(Main.ds.getSelected(), false, false); 82 82 Main.map.repaint(); 83 83 } … … 98 98 deleteWithReferences(Collections.singleton(sel)); 99 99 else 100 delete(Collections.singleton(sel), true );100 delete(Collections.singleton(sel), true, true); 101 101 102 102 Main.map.mapView.repaint(); … … 139 139 * @param msgBox Whether a message box for errors should be shown 140 140 */ 141 private void delete(Collection<OsmPrimitive> selection, boolean msgBox ) {141 private void delete(Collection<OsmPrimitive> selection, boolean msgBox, boolean joinIfPossible) { 142 142 Collection<OsmPrimitive> del = new HashSet<OsmPrimitive>(); 143 143 for (OsmPrimitive osm : selection) { … … 145 145 osm.visit(v); 146 146 if (!selection.containsAll(v.data)) { 147 if (osm instanceof Node ) {147 if (osm instanceof Node && joinIfPossible) { 148 148 String reason = deleteNodeAndJoinSegment((Node)osm); 149 149 if (reason != null && msgBox) { -
src/org/openstreetmap/josm/command/ChangePropertyCommand.java
r104 r106 64 64 65 65 @Override public MutableTreeNode description() { 66 String text = value == null ? tr( "Remove '{0}' for",key) : tr("Set {0}={1} for",key,value);66 String text = value == null ? tr( "Remove \"{0}\" for", key) : tr("Set {0}={1} for",key,value); 67 67 if (objects.size() == 1) { 68 68 NameVisitor v = new NameVisitor(); 69 69 objects.iterator().next().visit(v); 70 text += v.className+" "+v.name;70 text += " "+v.className+" "+v.name; 71 71 } else 72 text += trn("{0} object","{0} objects",objects.size(),objects.size());72 text += objects.size()+trn("object","objects",objects.size()); 73 73 DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel(text, ImageProvider.get("data", "key"), JLabel.HORIZONTAL)); 74 74 if (objects.size() == 1) -
src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java
r104 r106 26 26 import java.util.Date; 27 27 import java.util.LinkedList; 28 import java.util.regex.Matcher;29 import java.util.regex.Pattern;30 28 31 29 import javax.swing.BorderFactory; … … 93 91 // check the gps layer for time loops (and process it on the way) 94 92 Date last = null; 95 Pattern reg = Pattern.compile("(\\d\\d/\\d\\d/\\d{4}).(\\d\\d:\\d\\d:\\d\\d)"); 96 try { 97 for (Collection<GpsPoint> c : gpsLayer.data) { 98 for (GpsPoint p : c) { 99 if (p.time == null) 100 throw new IOException(tr("No time for point {0},{1}",p.latlon.lat(),p.latlon.lon())); 101 Matcher m = reg.matcher(p.time); 102 if (!m.matches()) 103 throw new IOException(tr("Cannot read time from point {0},{1}",p.latlon.lat(),p.latlon.lon())); 104 Date d = DateParser.parse(m.group(1)+" "+m.group(2)); 105 gps.add(new TimedPoint(d, p.eastNorth)); 106 if (last != null && last.after(d)) 107 throw new IOException(tr("Time loop in gps data.")); 108 last = d; 109 } 93 for (Collection<GpsPoint> c : gpsLayer.data) { 94 for (GpsPoint p : c) { 95 if (p.time == null) 96 throw new IOException(tr("No time for point {0},{1}",p.latlon.lat(),p.latlon.lon())); 97 Date d = null; 98 try { 99 d = DateParser.parse(p.time); 100 } catch (ParseException e) { 101 throw new IOException(tr("Cannot read time \"{0}\" from point {1} x {2}",p.time,p.latlon.lat(),p.latlon.lon())); 102 } 103 gps.add(new TimedPoint(d, p.eastNorth)); 104 if (last != null && last.after(d)) 105 throw new IOException(tr("Time loop in gps data.")); 106 last = d; 110 107 } 111 } catch (ParseException e) {112 e.printStackTrace();113 throw new IOException(tr("Incorrect date information"));114 108 } 115 109 -
src/org/openstreetmap/josm/io/OsmReader.java
r104 r106 186 186 for (long id : e.getValue()) { 187 187 Segment s = segments.get(id); 188 if (s == null) 188 if (s == null) { 189 189 s = new Segment(id); // incomplete line segment 190 adder.visit(s); 191 } 190 192 w.segments.add(s); 191 193 } -
src/org/openstreetmap/josm/io/RawGpsReader.java
r104 r106 8 8 import java.util.Collection; 9 9 import java.util.LinkedList; 10 import java.util.Stack; 10 11 11 12 import org.openstreetmap.josm.data.coor.LatLon; … … 31 32 public Collection<Collection<GpsPoint>> data = new LinkedList<Collection<GpsPoint>>(); 32 33 private LatLon currentLatLon; 33 private String currentTime; 34 private String currentTime = null; 35 private Stack<String> tags = new Stack<String>(); 34 36 35 37 @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { … … 47 49 throw new SAXException(e); 48 50 } 49 } else if (qName.equals("time")) {50 currentTime = "";51 51 } 52 tags.push(qName); 52 53 } 53 54 54 55 @Override public void characters(char[] ch, int start, int length) { 55 if (currentTime != null && currentTime.equals("")) 56 currentTime = new String(ch, start, length); 56 if (tags.peek().equals("time")) { 57 String time = tags.pop(); 58 if (tags.empty() || (!tags.peek().equals("wpt") && !tags.peek().equals("trkpt"))) { 59 tags.push(time); 60 return; 61 } 62 String ct = new String(ch, start, length); 63 currentTime += ct; 64 tags.push(time); 65 } 57 66 } 58 67 … … 62 71 } else if (qName.equals("trkseg") || qName.equals("trk") || qName.equals("gpx")) 63 72 newTrack(); 73 74 if (!qName.equals("time")) 75 currentTime = ""; 76 tags.pop(); 64 77 } 65 78 -
src/org/openstreetmap/josm/test/MergeVisitorTest.java
r102 r106 170 170 Segment s2 = new Segment(s1); 171 171 s1.incomplete = true; 172 s2.timestamp = new Date(); 172 173 v.visit(s2); 173 174 assertTrue(s1.realEqual(s2)); 175 } 176 /** 177 * Incomplete segments should extend existing ways. 178 */ 179 public void testImportIncompleteExtendWays() throws Exception { 180 Segment s1 = DataSetTestCaseHelper.createSegment(ds, dsNode, dsNode); 181 Way w = DataSetTestCaseHelper.createWay(ds, new Segment[]{s1}); 182 s1.id = 1; 183 Segment s2 = new Segment(s1); 184 s1.incomplete = true; 185 v.visit(s2); 186 v.fixReferences(); 187 assertEquals(1, w.segments.size()); 188 assertEquals(s2, w.segments.get(0)); 189 assertFalse(s2.incomplete); 174 190 } 175 191 -
src/org/openstreetmap/josm/tools/DateParser.java
r105 r106 15 15 16 16 private static final String[] formats = { 17 "yyyy-MM-dd'T'HH:mm:ss'Z'", 17 18 "yyyy-MM-dd'T'HH:mm:ssZ", 18 19 "yyyy-MM-dd'T'HH:mm:ss.SSSZ", 20 "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", 19 21 "yyyy-MM-dd HH:mm:ss", 20 22 "MM/dd/yyyy HH:mm:ss", 21 23 "MM/dd/yyyy'T'HH:mm:ss.SSSZ", 24 "MM/dd/yyyy'T'HH:mm:ss.SSS'Z'", 22 25 "MM/dd/yyyy'T'HH:mm:ss.SSS", 23 26 "MM/dd/yyyy'T'HH:mm:ssZ",
Note:
See TracChangeset
for help on using the changeset viewer.