protected internal virtual void addPOI(TDNode poi) { if (!poi.POI) { return; } sbyte minZoomLevel = poi.ZoomAppear; for (int i = 0; i < this.zoomIntervalConfiguration.NumberOfZoomIntervals; i++) { // is POI seen in a zoom interval? if (minZoomLevel <= this.zoomIntervalConfiguration.getMaxZoom(i)) { long tileCoordinateX = MercatorProjection.longitudeToTileX(LatLongUtils.microdegreesToDegrees(poi.Longitude), this.zoomIntervalConfiguration.getBaseZoom(i)); long tileCoordinateY = MercatorProjection.latitudeToTileY(LatLongUtils.microdegreesToDegrees(poi.Latitude), this.zoomIntervalConfiguration.getBaseZoom(i)); TileData tileData = getTileImpl(i, (int)tileCoordinateX, (int)tileCoordinateY); if (tileData != null) { tileData.addPOI(poi); countPoiTags(poi); } } } }
public BaseTileBasedDataProcessor(MapWriterConfiguration configuration) : base() { this.boundingbox = configuration.BboxConfiguration; this.zoomIntervalConfiguration = configuration.ZoomIntervalConfiguration; this.tileGridLayouts = new TileGridLayout[this.zoomIntervalConfiguration.NumberOfZoomIntervals]; this.bboxEnlargement = configuration.BboxEnlargement; this.preferredLanguages = configuration.PreferredLanguages; this.skipInvalidRelations = configuration.SkipInvalidRelations; this.outerToInnerMapping = new TLongObjectHashMap <>(); this.innerWaysWithoutAdditionalTags = new TLongHashSet(); this.tilesToCoastlines = new Dictionary <>(); this.countWays = new float[this.zoomIntervalConfiguration.NumberOfZoomIntervals]; this.countWayTileFactor = new float[this.zoomIntervalConfiguration.NumberOfZoomIntervals]; this.histogramPoiTags = new TShortIntHashMap(); this.histogramWayTags = new TShortIntHashMap(); // compute horizontal and vertical tile coordinate offsets for all // base zoom levels for (int i = 0; i < this.zoomIntervalConfiguration.NumberOfZoomIntervals; i++) { TileCoordinate upperLeft = new TileCoordinate((int)MercatorProjection.longitudeToTileX(this.boundingbox.minLongitude, this.zoomIntervalConfiguration.getBaseZoom(i)), (int)MercatorProjection.latitudeToTileY(this.boundingbox.maxLatitude, this.zoomIntervalConfiguration.getBaseZoom(i)), this.zoomIntervalConfiguration.getBaseZoom(i)); this.tileGridLayouts[i] = new TileGridLayout(upperLeft, computeNumberOfHorizontalTiles(i), computeNumberOfVerticalTiles(i)); } }
private int computeNumberOfHorizontalTiles(int zoomIntervalIndex) { long tileCoordinateLeft = MercatorProjection.longitudeToTileX(this.boundingbox.minLongitude, this.zoomIntervalConfiguration.getBaseZoom(zoomIntervalIndex)); long tileCoordinateRight = MercatorProjection.longitudeToTileX(this.boundingbox.maxLongitude, this.zoomIntervalConfiguration.getBaseZoom(zoomIntervalIndex)); Debug.Assert(tileCoordinateLeft <= tileCoordinateRight); Debug.Assert(tileCoordinateLeft - tileCoordinateRight + 1 < int.MaxValue); LOGGER.finer("basezoom: " + this.zoomIntervalConfiguration.getBaseZoom(zoomIntervalIndex) + "\t+n_horizontal: " + (tileCoordinateRight - tileCoordinateLeft + 1)); return((int)(tileCoordinateRight - tileCoordinateLeft + 1)); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private static org.mapsforge.map.writer.model.TileCoordinate[] getWayBoundingBox(final org.mapsforge.map.writer.model.TDWay way, byte zoomlevel, int enlargementInMeter) private static TileCoordinate[] getWayBoundingBox(TDWay way, sbyte zoomlevel, int enlargementInMeter) { double maxx = double.NegativeInfinity, maxy = double.NegativeInfinity, minx = double.PositiveInfinity, miny = double.PositiveInfinity; foreach (TDNode coordinate in way.WayNodes) { maxy = Math.Max(maxy, LatLongUtils.microdegreesToDegrees(coordinate.Latitude)); miny = Math.Min(miny, LatLongUtils.microdegreesToDegrees(coordinate.Latitude)); maxx = Math.Max(maxx, LatLongUtils.microdegreesToDegrees(coordinate.Longitude)); minx = Math.Min(minx, LatLongUtils.microdegreesToDegrees(coordinate.Longitude)); } double[] epsilonsTopLeft = computeTileEnlargement(maxy, enlargementInMeter); double[] epsilonsBottomRight = computeTileEnlargement(miny, enlargementInMeter); TileCoordinate[] bbox = new TileCoordinate[2]; bbox[0] = new TileCoordinate((int)MercatorProjection.longitudeToTileX(minx - epsilonsTopLeft[1], zoomlevel), (int)MercatorProjection.latitudeToTileY(maxy + epsilonsTopLeft[0], zoomlevel), zoomlevel); bbox[1] = new TileCoordinate((int)MercatorProjection.longitudeToTileX(maxx + epsilonsBottomRight[1], zoomlevel), (int)MercatorProjection.latitudeToTileY(miny - epsilonsBottomRight[0], zoomlevel), zoomlevel); return(bbox); }