Changeset 30326 in osm for applications/editors/josm/plugins/opendata/src/org/openstreetmap
- Timestamp:
- 2014-03-17T11:28:36+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java
r28982 r30326 128 128 } 129 129 130 protected Node createOrGetEmptyNode(Point p) throws MismatchedDimensionException, TransformException { 131 Point p2 = (Point) JTS.transform(p, transform); 132 LatLon key = new LatLon(p2.getY(), p2.getX()); 133 Node n = getNode(p2, key); 134 if(n != null && n.hasKeys()) { 135 n = null; 136 } 137 if (n == null) { 138 n = new Node(key); 139 if (handler == null || handler.useNodeMap()) { 140 nodes.put(key, n); 141 } 142 ds.addPrimitive(n); 143 } else if (n.getDataSet() == null) { 144 // handler may have removed the node from DataSet (see Paris public light handler for example) 145 ds.addPrimitive(n); 146 } 147 return n; 148 } 149 130 150 protected <T extends OsmPrimitive> T addOsmPrimitive(T p) { 131 151 ds.addPrimitive(p); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java
r29497 r30326 34 34 import org.geotools.feature.FeatureCollection; 35 35 import org.geotools.feature.FeatureIterator; 36 import org.geotools.geometry.jts.JTS; 36 37 import org.opengis.feature.Feature; 37 38 import org.opengis.feature.GeometryAttribute; … … 120 121 121 122 if (geometry.getValue() instanceof Point) { 122 primitive = createOrGet Node((Point) geometry.getValue());123 primitive = createOrGetEmptyNode((Point) geometry.getValue()); 123 124 124 125 } else if (geometry.getValue() instanceof GeometryCollection) { // Deals with both MultiLineString and MultiPolygon … … 216 217 } 217 218 } catch (UserCancelException e) { 219 e.printStackTrace(); 218 220 return ds; 219 221 } … … 223 225 } 224 226 } 227 } catch (Throwable e) { 228 e.printStackTrace(); 225 229 } finally { 226 230 iterator.close(); … … 232 236 } 233 237 } catch (IOException e) { 238 e.printStackTrace(); 234 239 throw e; 235 240 } catch (Throwable t) { 241 t.printStackTrace(); 236 242 throw new IOException(t); 237 243 } … … 240 246 241 247 private static final void readNonGeometricAttributes(Feature feature, OsmPrimitive primitive) { 248 try { 242 249 for (Property prop : feature.getProperties()) { 243 250 if (!(prop instanceof GeometryAttribute)) { … … 248 255 String sValue = value.toString(); 249 256 if (!sName.isEmpty() && !sValue.isEmpty()) { 250 primitive.put(sName, sValue); 251 } 252 } 253 } 254 } 257 primitive.put(sName, sValue); 258 } 259 } 260 } 261 } 262 } catch (Exception e) { 263 e.printStackTrace(); 264 } 255 265 } 256 266
Note:
See TracChangeset
for help on using the changeset viewer.