Example #1
0
        private RAMTileData fromHDTileData(HDTileData hdt)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final RAMTileData td = new RAMTileData();
            RAMTileData   td = new RAMTileData();
            TLongIterator it = hdt.Pois.GetEnumerator();

            while (it.hasNext())
            {
                td.addPOI(TDNode.fromNode(this.nodeIndexReader.get(it.next()), this.preferredLanguages));
            }

            it = hdt.Ways.GetEnumerator();
            while (it.hasNext())
            {
                TDWay way = null;
                long  id  = it.next();
                try
                {
                    way = TDWay.fromWay(this.wayIndexReader.get(id), this, this.preferredLanguages);
                    td.addWay(way);
                }
                catch (NoSuchIndexElementException)
                {
                    // is it a virtual way?
                    way = this.virtualWays.get(id);
                    if (way != null)
                    {
                        td.addWay(way);
                    }
                    else
                    {
                        LOGGER.finer("referenced way non-existing" + id);
                    }
                }

                if (way != null)
                {
                    if (this.outerToInnerMapping.contains(way.Id))
                    {
                        way.Shape = TDWay.MULTI_POLYGON;
                    }

                    IList <TDRelation> associatedRelations = this.additionalRelationTags.get(id);
                    if (associatedRelations != null)
                    {
                        foreach (TDRelation tileDataRelation in associatedRelations)
                        {
                            way.mergeRelationInformation(tileDataRelation);
                        }
                    }
                }
            }

            return(td);
        }
Example #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);
        }