Ignore:
Timestamp:
2006-03-14T17:41:14+01:00 (18 years ago)
Author:
imi
Message:
  • fixed load of action attribute (preserve changes)
  • fixed exception when merging ways with different number of segments
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/io/OsmReader.java

    r59 r60  
    8080                                n.coor = new GeoPoint(getDouble(atts, "lat"), getDouble(atts, "lon"));
    8181                                current = n;
     82                                readCommon(atts);
    8283                                current.id = getLong(atts, "id");
    8384                                nodes.put(n.id, n);
     
    8687                                                nodes.get(getLong(atts, "from")),
    8788                                                nodes.get(getLong(atts, "to")));
    88                                 current.id = getLong(atts, "id");
     89                                readCommon(atts);
    8990                                lineSegments.put(current.id, (LineSegment)current);
    9091                        } else if (qName.equals("way")) {
    9192                                current = new Track();
    92                                 current.id = getLong(atts, "id");
     93                                readCommon(atts);
    9394                        } else if (qName.equals("seg")) {
    9495                                if (current instanceof Track)
     
    102103                        throw new SAXException("NullPointerException. Possible some missing tags.", x);
    103104                }
     105        }
     106
     107        /**
     108         * Read out the common attributes from atts and put them into this.current.
     109         */
     110        private void readCommon(Attributes atts) {
     111                current.id = getLong(atts, "id");
     112                String action = atts.getValue("action");
     113                if ("delete".equals(action))
     114                        current.setDeleted(true);
     115                else if ("modify".equals(action)) {
     116                        current.modified = true;
     117                        current.modifiedProperties = true;
     118                } else if ("modify/object".equals(action))
     119                        current.modified = true;
     120                else if ("modify/property".equals(action))
     121                        current.modifiedProperties = true;
    104122        }
    105123
Note: See TracChangeset for help on using the changeset viewer.