Esempio n. 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);
        }
Esempio n. 2
0
        public override TileData getTile(int baseZoomIndex, int tileCoordinateX, int tileCoordinateY)
        {
            HDTileData hdt = getTileImpl(baseZoomIndex, tileCoordinateX, tileCoordinateY);

            if (hdt == null)
            {
                return(null);
            }

            return(fromHDTileData(hdt));
        }
Esempio n. 3
0
        protected internal override HDTileData getTileImpl(int zoom, int tileX, int tileY)
        {
            int tileCoordinateXIndex = tileX - this.tileGridLayouts[zoom].UpperLeft.X;
            int tileCoordinateYIndex = tileY - this.tileGridLayouts[zoom].UpperLeft.Y;

            // check for valid range
            if (tileCoordinateXIndex < 0 || tileCoordinateYIndex < 0 || this.tileData[zoom].Length <= tileCoordinateXIndex || this.tileData[zoom][tileCoordinateXIndex].Length <= tileCoordinateYIndex)
            {
                return(null);
            }

            HDTileData td = this.tileData[zoom][tileCoordinateXIndex][tileCoordinateYIndex];

            if (td == null)
            {
                td = new HDTileData();
                this.tileData[zoom][tileCoordinateXIndex][tileCoordinateYIndex] = td;
            }

            return(td);
        }