示例#1
0
        public override void addWay(Way way)
        {
            TDWay tdWay = TDWay.fromWay(way, this, this.preferredLanguages);

            if (tdWay == null)
            {
                return;
            }
            this.ways.put(tdWay.Id, tdWay);
            this.maxWayID = Math.Max(this.maxWayID, way.Id);

            if (tdWay.Coastline)
            {
                // find matching tiles on zoom level 12
                ISet <TileCoordinate> coastLineTiles = GeoUtils.mapWayToTiles(tdWay, TileInfo.TILE_INFO_ZOOMLEVEL, 0);
                foreach (TileCoordinate tileCoordinate in coastLineTiles)
                {
                    TLongHashSet coastlines = this.tilesToCoastlines.get(tileCoordinate);
                    if (coastlines == null)
                    {
                        coastlines = new TLongHashSet();
                        this.tilesToCoastlines.put(tileCoordinate, coastlines);
                    }
                    coastlines.add(tdWay.Id);
                }
            }
        }
示例#2
0
        public override ISet <TDWay> getCoastLines(TileCoordinate tc)
        {
            if (tc.Zoomlevel <= TileInfo.TILE_INFO_ZOOMLEVEL)
            {
                return(Collections.emptySet());
            }
            TileCoordinate correspondingOceanTile = tc.translateToZoomLevel(TileInfo.TILE_INFO_ZOOMLEVEL).get(0);

            if (this.wayIndexReader == null)
            {
                throw new System.InvalidOperationException("way store not accessible, call complete() first");
            }

            TLongHashSet coastlines = this.tilesToCoastlines.get(correspondingOceanTile);

            if (coastlines == null)
            {
                return(Collections.emptySet());
            }

            TLongIterator   it = coastlines.GetEnumerator();
            HashSet <TDWay> coastlinesAsTDWay = new HashSet <TDWay>(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)
                {
                    LOGGER.finer("coastline way non-existing" + id);
                }
                if (tdWay != null)
                {
                    coastlinesAsTDWay.Add(tdWay);
                }
            }
            return(coastlinesAsTDWay);
        }
示例#3
0
        public override ISet <TDWay> getCoastLines(TileCoordinate tc)
        {
            if (tc.Zoomlevel <= TileInfo.TILE_INFO_ZOOMLEVEL)
            {
                return(Collections.emptySet());
            }
            TileCoordinate correspondingOceanTile = tc.translateToZoomLevel(TileInfo.TILE_INFO_ZOOMLEVEL).get(0);
            TLongHashSet   coastlines             = this.tilesToCoastlines.get(correspondingOceanTile);

            if (coastlines == null)
            {
                return(Collections.emptySet());
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Set<org.mapsforge.map.writer.model.TDWay> res = new java.util.HashSet<>();
            ISet <TDWay> res = new HashSet <TDWay>();

            coastlines.forEach(new TLongProcedureAnonymousInnerClassHelper(this, res));
            return(res);
        }