Changeset 30574 in osm for applications


Ignore:
Timestamp:
2014-08-07T02:42:46+02:00 (10 years ago)
Author:
donvip
Message:

[josm_opendata] MIF: add new test cases and fix another bug

Location:
applications/editors/josm/plugins/opendata
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifReader.java

    r30573 r30574  
    358358    }
    359359   
     360    private void startPolyLine() throws IOException {
     361        polyline = new Way();
     362        ds.addPrimitive(polyline);
     363        readAttributes(polyline);
     364        state = State.READING_POINTS;
     365    }
     366   
    360367    private void parsePLine(String[] words) throws IOException {
    361         if (words.length > 2) {
     368        if (words.length <= 1 || "MULTIPLE".equalsIgnoreCase(words[1])) {
    362369            // TODO: pline with multiple sections
    363             polyline = new Way();
    364             ds.addPrimitive(polyline);
    365             readAttributes(polyline);
    366             numpts = Integer.parseInt(words[1]); // Not described in PDF but found in real files: PLINE XX, with XX = numpoints
    367             state = State.READING_POINTS;
    368         } else {
    369370            numpts = -1;
    370371            state = State.START_POLYLINE;
     372        } else {
     373            numpts = Integer.parseInt(words[1]); // Not described in PDF but found in real files: PLINE XX, with XX = numpoints
     374            startPolyLine();
    371375        }
    372376    }
     
    458462            } else if (state == State.START_POLYLINE) {
    459463                numpts = Integer.parseInt(words[0]);
    460                 polyline = new Way();
    461                 ds.addPrimitive(polyline);
    462                 readAttributes(polyline);
    463                 state = State.READING_POINTS;
     464                startPolyLine();
    464465               
    465466            } else if (state == State.READING_POINTS && numpts > 0) {
Note: See TracChangeset for help on using the changeset viewer.