use of de.topobyte.osm4j.core.model.impl.Way in project osm4j-geometry by topobyte.
the class RegionBuilder method convert.
private void convert(Collection<ChainOfNodes> rings, Collection<ChainOfNodes> nonRings, OsmEntityProvider resolver, Collection<Coordinate> coordinates, Collection<LineString> lineStrings, Collection<LinearRing> linearRings) throws EntityNotFoundException {
for (ChainOfNodes ring : rings) {
Way way = new Way(-1, ring.getNodes());
WayBuilderResult result = wayBuilder.build(way, resolver);
add(result, coordinates, lineStrings, linearRings);
}
for (ChainOfNodes ring : nonRings) {
Way way = new Way(-1, ring.getNodes());
WayBuilderResult result = wayBuilder.build(way, resolver);
add(result, coordinates, lineStrings, linearRings);
}
}
use of de.topobyte.osm4j.core.model.impl.Way in project osm4j-core by topobyte.
the class ImplUtil method clone.
public static Way clone(OsmWay way) {
List<? extends OsmTag> tags = cloneTags(way);
OsmMetadata metadata = cloneMetadata(way);
TLongList nodes = new TLongArrayList(way.getNumberOfNodes());
for (int i = 0; i < way.getNumberOfNodes(); i++) {
nodes.add(way.getNodeId(i));
}
return new Way(way.getId(), nodes, tags, metadata);
}
use of de.topobyte.osm4j.core.model.impl.Way in project osm4j-geometry by topobyte.
the class RelationUtil method closeUnclosedRingWithStraightLine.
public static void closeUnclosedRingWithStraightLine(Collection<ChainOfWays> rings) {
for (ChainOfWays ring : rings) {
if (!ring.isClosed()) {
logger.debug("unclosed ring with " + ring.getSegments().size() + " segments");
List<WaySegment> segments = ring.getSegments();
WaySegment rs1 = segments.get(0);
WaySegment rs2 = segments.get(segments.size() - 1);
long n1 = rs1.getNodeId(0);
long n2 = rs2.getNodeId(rs2.getNumberOfNodes() - 1);
TLongArrayList ids = new TLongArrayList();
ids.add(n1);
ids.add(n2);
OsmWay filler = new Way(0L, ids);
ring.addWay(filler);
}
}
}
Aggregations