/// <summary> /// Initializes the map using the mapOptions. /// </summary> /// <param name="options">Options.</param> protected virtual void InitializeMap(MapOptions options) { Options = options; _worldHeightFixed = false; _fileSource = MapboxAccess.Instance; _centerLatitudeLongitude = Conversions.StringToLatLon(options.locationOptions.latitudeLongitude); _initialZoom = (int)options.locationOptions.zoom; options.scalingOptions.scalingStrategy.SetUpScaling(this); options.placementOptions.placementStrategy.SetUpPlacement(this); //Set up events for changes. _imagery.UpdateLayer += OnImageOrTerrainUpdateLayer; _terrain.UpdateLayer += OnImageOrTerrainUpdateLayer; _vectorData.SubLayerRemoved += OnVectorDataSubLayerRemoved; _vectorData.SubLayerAdded += OnVectorDataSubLayerAdded; _vectorData.UpdateLayer += OnVectorDataUpdateLayer; _options.locationOptions.PropertyHasChanged += (object sender, System.EventArgs eventArgs) => { //take care of redraw map business... UpdateMap(); }; _options.extentOptions.PropertyHasChanged += (object sender, System.EventArgs eventArgs) => { //take care of redraw map business... OnTileProviderChanged(); }; _options.extentOptions.defaultExtents.PropertyHasChanged += (object sender, System.EventArgs eventArgs) => { //take care of redraw map business... _tileProvider.UpdateTileExtent(); }; _options.placementOptions.PropertyHasChanged += (object sender, System.EventArgs eventArgs) => { //take care of redraw map business... SetPlacementStrategy(); UpdateMap(); }; _options.scalingOptions.PropertyHasChanged += (object sender, System.EventArgs eventArgs) => { //take care of redraw map business... SetScalingStrategy(); UpdateMap(); }; _mapVisualizer.Initialize(this, _fileSource); _tileProvider.Initialize(this); SendInitialized(); _tileProvider.UpdateTileExtent(); this.isReady = true; }
/// <summary> /// Initialize the map using the specified latLon and zoom. /// Map will automatically get initialized in the <c>Start</c> method. /// Use this method to explicitly initialize the map and disable intialize on <c>Start</c> /// </summary> /// <returns>The initialize.</returns> /// <param name="latLon">Lat lon.</param> /// <param name="zoom">Zoom.</param> public virtual void Initialize(Vector2d latLon, int zoom) { _initializeOnStart = false; if (_options == null) { _options = new MapOptions(); } _options.locationOptions.latitudeLongitude = String.Format(CultureInfo.InvariantCulture, "{0},{1}", latLon.x, latLon.y); _options.locationOptions.zoom = zoom; SetUpMap(); }
/// <summary> /// Initialize the map using the specified latLon and zoom. /// Map will automatically get initialized in the <c>Start</c> method. /// Use this method to explicitly initialize the map and disable intialize on <c>Start</c> /// </summary> /// <returns>The initialize.</returns> /// <param name="latLon">Lat lon.</param> /// <param name="zoom">Zoom.</param> public virtual void Initialize(Vector2d latLon, int zoom) { _initializeOnStart = false; if (_options == null) { _options = new MapOptions(); } _options.locationOptions.latitudeLongitude = String.Format("{0},{1}", 28.003078, -80.655452); _options.locationOptions.zoom = zoom; SetUpMap(); }
/// <summary> /// Initializes the map using the mapOptions. /// </summary> /// <param name="options">Options.</param> protected virtual void InitializeMap(MapOptions options) { Options = options; _worldHeightFixed = false; _fileSource = MapboxAccess.Instance; _centerLatitudeLongitude = Conversions.StringToLatLon(options.locationOptions.latitudeLongitude); _initialZoom = (int)options.locationOptions.zoom; options.scalingOptions.scalingStrategy.SetUpScaling(this); options.placementOptions.placementStrategy.SetUpPlacement(this); _mapVisualizer.Initialize(this, _fileSource); _tileProvider.Initialize(this); SendInitialized(); }
/// <summary> /// Initializes the map using the mapOptions. /// </summary> /// <param name="options">Options.</param> protected virtual void InitializeMap(MapOptions options) { Options = options; _worldHeightFixed = false; _fileSource = MapboxAccess.Instance; _centerLatitudeLongitude = Conversions.StringToLatLon(options.locationOptions.latitudeLongitude); _initialZoom = (int)options.locationOptions.zoom; options.scalingOptions.scalingStrategy.SetUpScaling(this); options.placementOptions.placementStrategy.SetUpPlacement(this); //Set up events for changes. _imagery.UpdateLayer += OnImageOrTerrainUpdateLayer; _terrain.UpdateLayer += OnImageOrTerrainUpdateLayer; _vectorData.SubLayerRemoved += OnVectorDataSubLayerRemoved; _vectorData.SubLayerAdded += OnVectorDataSubLayerAdded; _vectorData.UpdateLayer += OnVectorDataUpdateLayer; _options.locationOptions.PropertyHasChanged += (object sender, System.EventArgs eventArgs) => { UpdateMap(); }; _options.extentOptions.PropertyHasChanged += (object sender, System.EventArgs eventArgs) => { OnTileProviderChanged(); }; _options.extentOptions.defaultExtents.PropertyHasChanged += (object sender, System.EventArgs eventArgs) => { if (Application.isEditor && !Application.isPlaying && IsEditorPreviewEnabled == false) { Debug.Log("defaultExtents"); return; } if (TileProvider != null) { TileProvider.UpdateTileExtent(); } }; _options.placementOptions.PropertyHasChanged += (object sender, System.EventArgs eventArgs) => { SetPlacementStrategy(); UpdateMap(); }; _options.scalingOptions.PropertyHasChanged += (object sender, System.EventArgs eventArgs) => { SetScalingStrategy(); UpdateMap(); }; _mapVisualizer.Initialize(this, _fileSource); TileProvider.Initialize(this); SendInitialized(); TileProvider.UpdateTileExtent(); }
/// <summary> /// Initializes the map using the mapOptions. /// </summary> /// <param name="options">Options.</param> protected virtual void InitializeMap(MapOptions options) { Options = options; _worldHeightFixed = false; _fileSource = MapboxAccess.Instance; _centerLatitudeLongitude = Conversions.StringToLatLon(options.locationOptions.latitudeLongitude); _initialZoom = (int)options.locationOptions.zoom; options.scalingOptions.scalingStrategy.SetUpScaling(this); options.placementOptions.placementStrategy.SetUpPlacement(this); _imagery.UpdateLayer += (object sender, System.EventArgs eventArgs) => { LayerUpdateArgs layerUpdateArgs = eventArgs as LayerUpdateArgs; if (layerUpdateArgs != null) { Debug.Log("<color=red>Image</color>"); _mapVisualizer.ReregisterTilesTo(layerUpdateArgs.factory); if (layerUpdateArgs.effectsVectorLayer) { _mapVisualizer.UnregisterTilesFrom(VectorData.Factory); VectorData.UpdateFactorySettings(); _mapVisualizer.ReregisterTilesTo(VectorData.Factory); } OnMapRedrawn(); } }; _terrain.UpdateLayer += (object sender, System.EventArgs eventArgs) => { LayerUpdateArgs layerUpdateArgs = eventArgs as LayerUpdateArgs; if (layerUpdateArgs != null) { Debug.Log("<color=green>Terrain</color>"); _mapVisualizer.ReregisterTilesTo(layerUpdateArgs.factory); if (layerUpdateArgs.effectsVectorLayer) { _mapVisualizer.UnregisterTilesFrom(VectorData.Factory); VectorData.UpdateFactorySettings(); _mapVisualizer.ReregisterTilesTo(VectorData.Factory); } OnMapRedrawn(); } }; _vectorData.UpdateLayer += (object sender, System.EventArgs eventArgs) => { LayerUpdateArgs layerUpdateArgs = eventArgs as LayerUpdateArgs; if (layerUpdateArgs != null) { Debug.Log("_vectorData.UpdateLayer"); _mapVisualizer.UnregisterTilesFrom(layerUpdateArgs.factory); VectorData.UpdateFactorySettings(); _mapVisualizer.ReregisterTilesTo(VectorData.Factory); OnMapRedrawn(); } }; _mapVisualizer.Initialize(this, _fileSource); _tileProvider.Initialize(this); SendInitialized(); _tileProvider.UpdateTileExtent(); }