private void SetTileProvider() { if (_options.extentOptions.extentType != MapExtentType.Custom) { ITileProviderOptions tileProviderOptions = _options.extentOptions.GetTileProviderOptions(); // Setup tileprovider based on type. switch (_options.extentOptions.extentType) { case MapExtentType.CameraBounds: TileProvider = gameObject.AddComponent <QuadTreeTileProvider>(); break; case MapExtentType.RangeAroundCenter: TileProvider = gameObject.AddComponent <RangeTileProvider>(); break; case MapExtentType.RangeAroundTransform: TileProvider = gameObject.AddComponent <RangeAroundTransformTileProvider>(); break; default: break; } TileProvider.SetOptions(tileProviderOptions); } else { TileProvider = _tileProvider; } }
/// <summary> /// Sets up map. /// This method uses the mapOptions and layer properties to setup the map to be rendered. /// Override <c>SetUpMap</c> to write custom behavior to map setup. /// </summary> protected virtual void SetUpMap() { switch (_options.placementOptions.placementType) { case MapPlacementType.AtTileCenter: _options.placementOptions.placementStrategy = new MapPlacementAtTileCenterStrategy(); break; case MapPlacementType.AtLocationCenter: _options.placementOptions.placementStrategy = new MapPlacementAtLocationCenterStrategy(); break; default: _options.placementOptions.placementStrategy = new MapPlacementAtTileCenterStrategy(); break; } switch (_options.scalingOptions.scalingType) { case MapScalingType.WorldScale: _options.scalingOptions.scalingStrategy = new MapScalingAtWorldScaleStrategy(); break; case MapScalingType.Custom: _options.scalingOptions.scalingStrategy = new MapScalingAtUnityScaleStrategy(); break; default: break; } if (_options.extentOptions.extentType != MapExtentType.Custom) { ITileProviderOptions tileProviderOptions = _options.extentOptions.GetTileProviderOptions(); // Setup tileprovider based on type. switch (_options.extentOptions.extentType) { case MapExtentType.CameraBounds: TileProvider = gameObject.AddComponent <QuadTreeTileProvider>(); break; case MapExtentType.RangeAroundCenter: TileProvider = gameObject.AddComponent <RangeTileProvider>(); break; case MapExtentType.RangeAroundTransform: TileProvider = gameObject.AddComponent <RangeAroundTransformTileProvider>(); break; default: break; } TileProvider.SetOptions(tileProviderOptions); } else { TileProvider = _tileProvider; } if (_imagery == null) { _imagery = new ImageryLayer(); } _imagery.Initialize(); if (_terrain == null) { _terrain = new TerrainLayer(); } _terrain.Initialize(); if (_vectorData == null) { _vectorData = new VectorLayer(); } _vectorData.Initialize(); if (Options.loadingTexture != null) { _mapVisualizer.SetLoadingTexture(Options.loadingTexture); } if (Options.tileMaterial != null) { _mapVisualizer.SetTileMaterial(Options.tileMaterial); } _mapVisualizer.Factories = new List <AbstractTileFactory>(); _mapVisualizer.Factories.Add(_terrain.Factory); _mapVisualizer.Factories.Add(_imagery.Factory); _mapVisualizer.Factories.Add(_vectorData.Factory); InitializeMap(_options); }
private void SetTileProvider() { if (_options.extentOptions.extentType != MapExtentType.Custom) { ITileProviderOptions tileProviderOptions = _options.extentOptions.GetTileProviderOptions(); string tileProviderName = "TileProvider"; // Setup tileprovider based on type. switch (_options.extentOptions.extentType) { case MapExtentType.CameraBounds: { if (TileProvider != null) { if (!(TileProvider is QuadTreeTileProvider)) { TileProvider.gameObject.Destroy(); var go = new GameObject(tileProviderName); go.transform.parent = transform; TileProvider = go.AddComponent <QuadTreeTileProvider>(); } } else { var go = new GameObject(tileProviderName); go.transform.parent = transform; TileProvider = go.AddComponent <QuadTreeTileProvider>(); } break; } case MapExtentType.RangeAroundCenter: { if (TileProvider != null) { TileProvider.gameObject.Destroy(); var go = new GameObject(tileProviderName); go.transform.parent = transform; TileProvider = go.AddComponent <RangeTileProvider>(); } else { var go = new GameObject(tileProviderName); go.transform.parent = transform; TileProvider = go.AddComponent <RangeTileProvider>(); } break; } case MapExtentType.RangeAroundTransform: { if (TileProvider != null) { if (!(TileProvider is RangeAroundTransformTileProvider)) { TileProvider.gameObject.Destroy(); var go = new GameObject(tileProviderName); go.transform.parent = transform; TileProvider = go.AddComponent <RangeAroundTransformTileProvider>(); } } else { var go = new GameObject(tileProviderName); go.transform.parent = transform; TileProvider = go.AddComponent <RangeAroundTransformTileProvider>(); } break; } default: break; } TileProvider.SetOptions(tileProviderOptions); } else { TileProvider = _tileProvider; } }
private void SetTileProvider() { //TileProvider = GetComponent<AbstractTileProvider>(); if (_options.extentOptions.extentType != MapExtentType.Custom) { ITileProviderOptions tileProviderOptions = _options.extentOptions.GetTileProviderOptions(); // Setup tileprovider based on type. switch (_options.extentOptions.extentType) { case MapExtentType.CameraBounds: { if (TileProvider != null) { if (!(TileProvider is QuadTreeTileProvider)) { TileProvider = new QuadTreeTileProvider(); } } else { TileProvider = new QuadTreeTileProvider(); } break; } case MapExtentType.RangeAroundCenter: { if (TileProvider != null) { if (!(TileProvider is RangeTileProvider)) { TileProvider = new RangeTileProvider(); } } else { TileProvider = new RangeTileProvider(); } break; } case MapExtentType.RangeAroundTransform: { if (TileProvider != null) { if (!(TileProvider is RangeAroundTransformTileProvider)) { TileProvider = new RangeAroundTransformTileProvider(); } } else { TileProvider = new RangeAroundTransformTileProvider(); } break; } default: break; } TileProvider.SetOptions(tileProviderOptions); } else { TileProvider = _tileProvider; } }