Ticket #7847: 7847v2.patch

File 7847v2.patch, 2.3 KB (added by simon04, 11 months ago)
  • src/org/openstreetmap/josm/data/osm/Node.java

    diff --git a/src/org/openstreetmap/josm/data/osm/Node.java b/src/org/openstreetmap/josm/data/osm/Node.java
    index cefa750..2da03cd 100644
    a b public final class Node extends OsmPrimitive implements INode { 
    177177    @Override 
    178178    void setDataset(DataSet dataSet) { 
    179179        super.setDataset(dataSet); 
    180         if (!isIncomplete() && (getCoor() == null || getEastNorth() == null)) 
     180        if (!isIncomplete() && isVisible() && (getCoor() == null || getEastNorth() == null)) 
    181181            throw new DataIntegrityProblemException("Complete node with null coordinates: " + toString() + get3892DebugInfo()); 
    182182    } 
    183183 
  • src/org/openstreetmap/josm/io/OsmReader.java

    diff --git a/src/org/openstreetmap/josm/io/OsmReader.java b/src/org/openstreetmap/josm/io/OsmReader.java
    index 16ba365..24977c6 100644
    a b public class OsmReader extends AbstractReader { 
    177177 
    178178    protected Node parseNode() throws XMLStreamException { 
    179179        NodeData nd = new NodeData(); 
    180         nd.setCoor(new LatLon(Double.parseDouble(parser.getAttributeValue(null, "lat")), Double.parseDouble(parser.getAttributeValue(null, "lon")))); 
     180        String lat = parser.getAttributeValue(null, "lat"); 
     181        String lon = parser.getAttributeValue(null, "lon"); 
     182        if (lat != null && lon != null) { 
     183            nd.setCoor(new LatLon(Double.parseDouble(lat), Double.parseDouble(lon))); 
     184        } 
    181185        readCommon(nd); 
    182186        Node n = new Node(nd.getId(), nd.getVersion()); 
    183187        n.setVisible(nd.isVisible()); 
  • src/org/openstreetmap/josm/io/OsmWriter.java

    diff --git a/src/org/openstreetmap/josm/io/OsmWriter.java b/src/org/openstreetmap/josm/io/OsmWriter.java
    index b2fecde..0f9b097 100644
    a b public class OsmWriter extends XmlWriter implements PrimitiveVisitor { 
    135135    public void visit(INode n) { 
    136136        if (n.isIncomplete()) return; 
    137137        addCommon(n, "node"); 
    138         out.print(" lat='"+n.getCoor().lat()+"' lon='"+n.getCoor().lon()+"'"); 
     138        if (n.getCoor() != null) { 
     139            out.print(" lat='"+n.getCoor().lat()+"' lon='"+n.getCoor().lon()+"'"); 
     140        } 
    139141        if (!withBody) { 
    140142            out.println("/>"); 
    141143        } else {