Changeset 36074 in osm
- Timestamp:
- 2023-04-20T14:35:13+02:00 (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeotoolsConverter.java
r36071 r36074 175 175 176 176 Object geomObject = geometry.getValue(); 177 if (geomObject instanceof Point) { // TODO: Support LineString and Polygon.177 if (geomObject instanceof Point) { 178 178 // Sure you could have a Set of 1 object and join these 2 branches of 179 179 // code, but I feel there would be a performance hit. 180 180 OsmPrimitive primitive = reader.createOrGetEmptyNode((Point) geomObject); 181 readNonGeometricAttributes(feature, primitive); 182 } else if (geomObject instanceof LineString) { 183 OsmPrimitive primitive = reader.createOrGetWay((LineString) geomObject); 184 readNonGeometricAttributes(feature, primitive); 185 } else if (geomObject instanceof Polygon) { 186 Polygon polygon = (Polygon) geomObject; 187 Way outer = reader.createOrGetWay(polygon.getExteriorRing()); 188 Way[] inner = new Way[polygon.getNumInteriorRing()]; 189 for (int i = 0; i < inner.length; i++) { 190 inner[i] = reader.createOrGetWay(polygon.getInteriorRingN(i)); 191 } 192 final OsmPrimitive primitive; 193 if (inner.length == 0) { 194 primitive = outer; 195 } else { 196 Relation relation = reader.createMultipolygon(); 197 GeographicReader.addWayToMp(relation, "outer", outer); 198 for (Way iWay : inner) { 199 GeographicReader.addWayToMp(relation, "inner", iWay); 200 } 201 primitive = relation; 202 } 181 203 readNonGeometricAttributes(feature, primitive); 182 204 } else if (geomObject instanceof GeometryCollection) { // Deals with both MultiLineString and MultiPolygon … … 221 243 Way w = reader.createOrGetWay(p.getExteriorRing()); 222 244 if (r != null) { 223 reader.addWayToMp(r, "outer", w);245 GeographicReader.addWayToMp(r, "outer", w); 224 246 for (int j = 0; j < p.getNumInteriorRing(); j++) { 225 reader.addWayToMp(r, "inner", reader.createOrGetWay(p.getInteriorRingN(j)));247 GeographicReader.addWayToMp(r, "inner", reader.createOrGetWay(p.getInteriorRingN(j))); 226 248 } 227 249 }
Note:
See TracChangeset
for help on using the changeset viewer.