Changeset 28033 in osm for applications/editors/josm/plugins/opendata/src/org/openstreetmap
- Timestamp:
- 2012-03-10T17:03:47+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/OdConstants.java
r28022 r28033 123 123 * Coordinates fields 124 124 */ 125 public static final String X_STRING = "X|LON|LONGI|LONGITUDE"; 126 public static final String Y_STRING = "Y|LAT|LATI|LATITUDE"; 125 public static final String X_STRING = "X|LON|LONGI|LONGITUDE|EASTING"; 126 public static final String Y_STRING = "Y|LAT|LATI|LATITUDE|NORTHING"; 127 127 128 128 // The list of all ProjectionPatterns (filled at each constrcutor call) -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/CsvReader.java
r28000 r28033 34 34 private BufferedReader reader; 35 35 private String line; 36 36 37 37 public CsvReader(AbstractDataSetHandler handler) { 38 this(handler, ";"); 39 } 40 41 public CsvReader(AbstractDataSetHandler handler, String defaultSep) { 38 42 super(handler); 39 43 this.charset = handler != null && handler.getCsvCharset() != null ? handler.getCsvCharset() : Charset.forName(UTF8); 40 this.sep = handler != null && handler.getCsvSeparator() != null ? handler.getCsvSeparator() : ";";44 this.sep = handler != null && handler.getCsvSeparator() != null ? handler.getCsvSeparator() : defaultSep; 41 45 } 42 46 43 47 public static DataSet parseDataSet(InputStream in, AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException { 44 return new CsvReader(handler).parse(in, instance); 48 CsvReader csvReader = new CsvReader(handler); 49 try { 50 return csvReader.parse(in, instance); 51 } catch (IllegalArgumentException e) { 52 if (handler == null) { 53 // If default sep has been used, try comma 54 System.out.println(e.getMessage()); 55 CsvReader newReader = new CsvReader(handler, ","); 56 newReader.initResources(in, instance); 57 newReader.line = csvReader.line; 58 return newReader.doParse(newReader.splitLine(), instance); 59 } else { 60 throw e; 61 } 62 } 45 63 } 46 64 … … 55 73 protected String[] readLine(ProgressMonitor progressMonitor) throws IOException { 56 74 line = reader.readLine(); 75 return splitLine(); 76 } 77 78 private final String[] splitLine() { 57 79 if (line != null) { 58 80 return OdUtils.stripQuotes(line.split(sep), sep);
Note:
See TracChangeset
for help on using the changeset viewer.