Exemple #1
0
 // Use this for initialization
 void Start()
 {
     if (this.tile == null)
     {
         this.tile = OSMTile.GetOSMTile(TileManager.OriginLongitude, TileManager.OriginLatitude, 13);
     }
 }
Exemple #2
0
    public static OSMTile[,] GetSubTiles(int xIndex, int yIndex, int zoomLevel)
    {
        OSMTile[,] subTiles       = new OSMTile[2, 2];
        Vector2[,] subTileIndices = GetSubtileIndices(xIndex, yIndex, zoomLevel);

        subTiles[0, 0] = GetOSMTile((int)subTileIndices[0, 0].x, (int)subTileIndices[0, 0].y, zoomLevel + 1);
        subTiles[0, 1] = GetOSMTile((int)subTileIndices[0, 1].x, (int)subTileIndices[0, 1].y, zoomLevel + 1);
        subTiles[1, 0] = GetOSMTile((int)subTileIndices[1, 0].x, (int)subTileIndices[1, 0].y, zoomLevel + 1);
        subTiles[1, 1] = GetOSMTile((int)subTileIndices[1, 1].x, (int)subTileIndices[1, 1].y, zoomLevel + 1);

        return(subTiles);
    }
        public MapTile CreateTitle()
        {
            MapTile tile     = null;
            var     workInfo = this;

            if (workInfo.mapType == MapType.Google || workInfo.mapType == MapType.GoogleImage)
            {
                tile = new GoogleMapTile(mapType);
            }
            else if (workInfo.mapType == MapType.Tiandi)
            {
                tile = new TiandiMapTile();
            }
            else if (workInfo.mapType == MapType.TiandiImage)
            {
                tile = new TiandiTile("img_c");
            }
            else if (workInfo.mapType == MapType.Gaode || workInfo.mapType == MapType.GaodeImage)
            {
                tile = new GaoDeMapTile();
            }
            else if (workInfo.mapType == MapType.Baidu)
            {
                tile = new BaiduMapTile();
            }
            else if (workInfo.mapType == MapType.BaiduImageTile)
            {
                tile = new BaiduImageTile();
            }
            else if (workInfo.mapType == MapType.OpenStreetMap)
            {
                tile = new OSMTile();
            }
            else if (workInfo.mapType == MapType.QQMap)
            {
                tile = new QQMapTile();
            }
            else if (workInfo.mapType == MapType.PGIS)
            {
                tile = new EZMapTile();
            }
            return(tile);
        }
Exemple #4
0
    public static GameObject GetOSMTileGameObject(OSMTile tile)
    {
        GameObject tilesParent = GameObject.Find("OSMTiles");

        if (tilesParent == null)
        {
            tilesParent = new GameObject("OSMTiles");
        }

        Vector2 coords = new Vector2(tile.X, tile.Y);

        if (!OSMTileProvider.tileBehaviours.ContainsKey(tile.ZoomLevel))
        {
            OSMTileProvider.tileBehaviours.Add(tile.ZoomLevel, new Dictionary <Vector2, OSMTileBehaviour>());
        }

        GameObject zoomLevelParent;

        if (!tilesParent.HasChildNamed(tile.ZoomLevel.ToString(), out zoomLevelParent))
        {
            zoomLevelParent = tilesParent.CreateChild(tile.ZoomLevel.ToString());
        }


        if (!OSMTileProvider.tileBehaviours[tile.ZoomLevel].ContainsKey(coords))
        {
            GameObject       tileGO           = zoomLevelParent.CreateRenderableChild("osmTile_" + tile.ZoomLevel + "_" + tile.X + "_" + tile.Y);
            OSMTileBehaviour osmTileBehaviour = tileGO.AddComponent <OSMTileBehaviour>();
            osmTileBehaviour.tile = GetOSMTile(tile.X, tile.Y, tile.ZoomLevel);

            OSMTileProvider.tileBehaviours[tile.ZoomLevel].Add(coords, osmTileBehaviour);
            osmTileBehaviour.Initialize();
        }

        return(OSMTileProvider.tileBehaviours[tile.ZoomLevel][coords].gameObject);
    }
Exemple #5
0
 public static GameObject GetOSMTileGameObject(int xIndex, int yIndex, int zoomLevel)
 {
     return(GetOSMTileGameObject(OSMTile.GetOSMTile(xIndex, yIndex, zoomLevel)));
 }
Exemple #6
0
    public static OSMTile GetSupertile(OSMTile subTile)
    {
        Vector3 superTile = GetSupertileIndex(subTile);

        return(GetOSMTile((int)superTile.x, (int)superTile.y, (int)superTile.z));
    }
Exemple #7
0
 public static Vector3 GetSupertileIndex(OSMTile subTile)
 {
     return(new Vector3(Mathf.FloorToInt(subTile.X / 2f), Mathf.FloorToInt(subTile.Y / 2f), subTile.ZoomLevel - 1));
 }
Exemple #8
0
 public static List <OSMTile> GetSubTilesAsList(OSMTile superTile)
 {
     return(GetSubTilesAsList(superTile.X, superTile.Y, superTile.ZoomLevel));
 }
Exemple #9
0
 public static OSMTile[,] GetSubTiles(OSMTile superTile)
 {
     return(GetSubTiles(superTile.X, superTile.Y, superTile.ZoomLevel));
 }
Exemple #10
0
 public static Vector2[,] GetSubtileIndices(OSMTile superTile)
 {
     return(GetSubtileIndices(superTile.X, superTile.Y, superTile.ZoomLevel));
 }
Exemple #11
0
 public static OSMTile GetOSMTile(int xIndex, int yIndex, int zoomLevel)
 {
     return(OSMTile.GetOSMTile(xIndex, yIndex, zoomLevel));
 }