Пример #1
0
    private OSMTile(int x, int y, int zoomLevel)
    {
        this.zoomLevel = zoomLevel;

        this.x = x;
        this.y = y;

        this.longitude = OSMTileProvider.Tile2Longitude(x, zoomLevel);
        this.latitude  = OSMTileProvider.Tile2Latitude(y, zoomLevel);

        this.image     = OSMTileProvider.DownloadTileTexture(x, y, zoomLevel);
        this.mapBounds = OSMTileProvider.Tile2MapBounds(x, y, zoomLevel);

        query             = new OverpassQuery();
        query.BoundingBox = OSMTileProvider.Tile2OSMBoundingBox(x, y, zoomLevel);
    }
Пример #2
0
    private void DrawOSMMap(Rect mapRect)
    {
        // Handle Interaction Mouse-Actions
        Move();
        Zoom();
        SetYouAreHere();

        // Draw Map
        for (int x = left % TileSizePixels; x < left + mapRect.width + TileSizePixels; x += TileSizePixels)
        {
            for (int y = top % TileSizePixels; y < top + mapRect.height + TileSizePixels; y += TileSizePixels)
            {
                Rect      tileRect    = new Rect(x, y, TileSizePixels, TileSizePixels);
                Vector2   tileIndex   = CalculateGridIndex(GUIToCoordinateSystemPosition(tileRect.center));
                Texture2D tileTexture = OSMTileProvider.DownloadTileTexture((int)tileIndex.x, (int)tileIndex.y, ZoomLevel);

                GUI.DrawTexture(tileRect, tileTexture, ScaleMode.ScaleToFit);
                //GUI.Label(tileRect, "TileIndex: " + tileIndex.ToString());
            }
        }

        // Draw TileManager-Selection/Boundings-Settings
        DrawSelection();
        DrawYouAreHere();

        #region Debug-Draw-Methods
        //if (drawGrid)
        //    DrawGrid(mapRect);
        //if (drawOrigin)
        //    DrawOrigin(mapRect);
        //if (drawMouse)
        //    DrawMouse(mapRect);
        #endregion // Debug-Draw-Methods

        // Draw Location Search-Bar
        DrawSearchBar();
        DrawSearchResults();

        CustomGUIUtils.DrawOuterFrame(mapRect, 2, XKCDColors.Black);
    }