@Override public TDNode getNode(long id) { if (this.nodeIndexReader == null) { throw new IllegalStateException("node store not accessible, call complete() first"); } try { return TDNode.fromNode(this.nodeIndexReader.get(id), this.preferredLanguages); } catch (NoSuchIndexElementException e) { LOGGER.finer("node cannot be found in index: " + id); return null; } }
@Override public TDWay getWay(long id) { if (this.wayIndexReader == null) { throw new IllegalStateException("way store not accessible, call complete() first"); } try { return TDWay.fromWay(this.wayIndexReader.get(id), this, this.preferredLanguages); } catch (NoSuchIndexElementException e) { LOGGER.finer("way cannot be found in index: " + id); return null; } }
private List<TDWay> getInnerWaysOfMultipolygon(long[] innerWayIDs) { if (innerWayIDs == null) { return Collections.emptyList(); } List<TDWay> res = new ArrayList<>(); for (long id : innerWayIDs) { TDWay current = null; try { current = TDWay.fromWay(this.wayIndexReader.get(id), this, this.preferredLanguages); } catch (NoSuchIndexElementException e) { current = this.virtualWays.get(id); if (current == null) { LOGGER.fine("multipolygon with outer way id " + id + " references non-existing inner way " + id); continue; } } res.add(current); } return res; } }
@Override public Set<TDWay> getCoastLines(TileCoordinate tc) { if (tc.getZoomlevel() <= TileInfo.TILE_INFO_ZOOMLEVEL) { return Collections.emptySet(); } TileCoordinate correspondingOceanTile = tc.translateToZoomLevel(TileInfo.TILE_INFO_ZOOMLEVEL).get(0); if (this.wayIndexReader == null) { throw new IllegalStateException("way store not accessible, call complete() first"); } TLongHashSet coastlines = this.tilesToCoastlines.get(correspondingOceanTile); if (coastlines == null) { return Collections.emptySet(); } TLongIterator it = coastlines.iterator(); HashSet<TDWay> coastlinesAsTDWay = new HashSet<>(coastlines.size()); while (it.hasNext()) { long id = it.next(); TDWay tdWay = null; try { tdWay = TDWay.fromWay(this.wayIndexReader.get(id), this, this.preferredLanguages); } catch (NoSuchIndexElementException e) { LOGGER.finer("coastline way non-existing" + id); } if (tdWay != null) { coastlinesAsTDWay.add(tdWay); } } return coastlinesAsTDWay; }
TLongIterator it = hdt.getPois().iterator(); while (it.hasNext()) { td.addPOI(TDNode.fromNode(this.nodeIndexReader.get(it.next()), this.preferredLanguages)); long id = it.next(); try { way = TDWay.fromWay(this.wayIndexReader.get(id), this, this.preferredLanguages); td.addWay(way); } catch (NoSuchIndexElementException e) {
/** * {@inheritDoc} */ @Override public NodeLocation getNodeLocation(long nodeId) { if (nodeLocationsReader == null) { nodeLocations.complete(); nodeLocationsReader = nodeLocations.createReader(); } try { return nodeLocationsReader.get(nodeId).getNodeLocation(); } catch (NoSuchIndexElementException e) { return new NodeLocation(); } }
/** * {@inheritDoc} */ @Override public NodeLocation getNodeLocation(long nodeId) { if (nodeLocationsReader == null) { nodeLocations.complete(); nodeLocationsReader = nodeLocations.createReader(); } try { return nodeLocationsReader.get(nodeId).getNodeLocation(); } catch (NoSuchIndexElementException e) { return new NodeLocation(); } }