Exemplo n.º 1
0
    void OnLocationUpdated(Mapbox.Unity.Location.Location location)
    {
        _locationProvider.OnLocationUpdated -= OnLocationUpdated;

        if (PhotonNetwork.IsMasterClient)
        {
            Hashtable roomSettings = PhotonNetwork.CurrentRoom.CustomProperties;

            _map.Initialize(location.LatitudeLongitude, _map.AbsoluteZoom);

            //Hashtable newRoomSettings = new Hashtable();
            roomSettings.Add("mapLat", location.LatitudeLongitude.x);
            roomSettings.Add("mapLong", location.LatitudeLongitude.y);

            PhotonNetwork.CurrentRoom.SetCustomProperties(roomSettings);
        }
        else
        {
            // Hashtable roomSettings = PhotonNetwork.CurrentRoom.CustomProperties;

            // Vector2d latLong = new Vector2d(
            //     (double) roomSettings["mapLat"],
            //     (double) roomSettings["mapLong"]
            // );
            // _map.Initialize(latLong, _map.AbsoluteZoom);
        }
    }
Exemplo n.º 2
0
 void ForwardGeocoder_OnGeocoderResponse(ForwardGeocodeResponse response)
 {
     _camera.transform.position = _cameraStartPos;
     if (null != response.Features && response.Features.Count > 0)
     {
         _map.Initialize(response.Features[0].Center, (int)_zoomSlider.value);
     }
 }
Exemplo n.º 3
0
    public void UpdateMap(float lat, float lon)
    {
        _map.Initialize(new Mapbox.Utils.Vector2d((double)lat, (double)lon), 14);

        //xDungeons = DungeonHandler.GetDungeons();
        lDungeons = DungeonHandler.GetDungeonsList();

        spawnDungeons();
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        GameObject go = GameObject.Find("Map");

        stravaSpheres  = (StravaSpheres)go.GetComponent(typeof(StravaSpheres));
        targetRotation = transform.rotation;
        AddListOfMaps();
        _map.Initialize(mapCoordinates [currentMapIndex], mapZoomLevels [currentMapIndex]);
    }
Exemplo n.º 5
0
 // Update is called once per frame
 void Update()
 {
     CheckCountdown -= Time.deltaTime;
     if (CheckCountdown <= 0)
     {
         CheckCountdown = RefreshInSeconds;
         InsertManagerPOI(); // insert once only manager points if exist
         InputPOIToMap();
         if (map.gameObject.activeSelf == false)
         {
             LogManager.Instance.AddLog("Map is Activated! Should display POIs!");
             map.gameObject.SetActive(true);
             NewPointsAdded = 0;
         }
         else
         {
             if (NewPointsAdded >= 2)
             {
                 Vector2d vv = new Vector2d(GPSData.Instance.Latitude, GPSData.Instance.Longitude);
                 // map.UpdateMap(vv, map.Zoom);
                 LogManager.Instance.AddLog("New Points Added. Called Map Initialize! Should display POIs!");
                 map.Initialize(vv, map.AbsoluteZoom);
                 NewPointsAdded = 0;
             }
         }
     }
 }
    public void ChangeStyleInruntime(string type)
    {
        GlobalVar.Instance.zoom = _mapController.AbsoluteZoom;
        // _mapController._mapVisualizer.DisposeAllTiles();
        switch (type)
        {
        case "statelite":

            ((MapImageFactory)_mapController.MapVisualizer.Factories[1]).MapId =
                "mapbox://styles/veyvin/cj9ds1com7agm2rs1n1wkqool";
            //_mapController.SetZoom(); = 14;

            break;

        case "outdoor":
            ((MapImageFactory)_mapController.MapVisualizer.Factories[1]).MapId =
                "mapbox://styles/veyvin/cj3l76yyb00032rqo9dvckmte";

            break;
        }
        //要改
        Camera.main.transform.position = camera.transform.position + new Vector3(0, 0.00001f, 0);
        _mapController.Initialize(_mapController.CenterLatitudeLongitude, _mapController.AbsoluteZoom);

        //_mapController._mapVisualizer.LoadAllTiles();
    }
Exemplo n.º 7
0
    void Start()
    {
        retrievePlayerPrefsData();
        _map.Initialize(riderLocation, 8);
        _spawnedObjects = new List <GameObject>();
        var riderLogo = Instantiate(_riderPrefab);

        riderLogo.transform.localPosition = _map.GeoToWorldPosition(riderLocation, true);
        riderLogo.transform.localScale    = new Vector3(_spawnScale, _spawnScale, _spawnScale);
        _spawnedObjects.Add(riderLogo);
        for (int i = 0; i < _locations.Length; i++)
        {
            //var locationString = _locationStrings[i];
            //_locations[i] = Conversions.StringToLatLon(locationString);
            Debug.Log(_locations[i]);
            var instance = Instantiate(_markerPrefab);
            instance.transform.localPosition = _map.GeoToWorldPosition(_locations[i], true);
            instance.transform.localScale    = new Vector3(_spawnScale, _spawnScale, _spawnScale);
            if (instance.transform.Find("Canvas").transform.Find("Button").GetComponent <ButtonController>() != null)
            {
                instance.transform.Find("Canvas").transform.Find("Button").GetComponent <ButtonController>().location.Set(_locations[i].x, _locations[i].y);
                // Debug.Log("Locations.x:");
                // Debug.Log(_locations[i].x);
            }
            else
            {
                Debug.Log("Can't find 'Button Controller'");
            }
            _spawnedObjects.Add(instance);
        }
    }
    public void InitializeMap()
    {
        //XRSessionManager.GetSession().ForceLocationUpdate();

        Vector3 mapPos = Map.transform.position;

        mapPos.y = XRSessionManager.GetSession().GetXRCameraPosition().y;
        Map.transform.position = mapPos;

        var      gpsPos      = XRSessionManager.GetSession().LocalPositionToGps(mapPos);
        Vector2d mapboxCoord = new Vector2d(gpsPos.Latitude, gpsPos.Longitude);

        Map.Initialize(mapboxCoord, 15);
        Map.transform.position += Vector3.down * 0.3f;


        //XRSessionManager.GetSession().ForceLocationUpdate();

        //Vector3 playerPos = XRSessionManager.GetSession().GetXRCameraPosition();
        //Map.transform.position = playerPos + (Vector3.down * 0.1f);

        //var gpsPos = XRSessionManager.GetSession ().GpsProvider.GetGPSPosition ();

        //Vector2d gpsLatLongPos = new Vector2d (gpsPos.Latitude, gpsPos.Longitude);
        //Map.Initialize (gpsLatLongPos, 15);


        MiniMapCam.gameObject.SetActive(true);
        _initialized = true;
    }
Exemplo n.º 9
0
        ///
        /// This is the initialisation script.
        ///
        /// It loads the Project file, reads it for the layers and calls Draw to render each layer
        /// </summary>
        async void Start()
        {
            // Fetch Project definition - return if the file cannot be read - this will lead to an empty world
            geoJsonReader = new GeoJsonReader();
            await geoJsonReader.Load(inputfile);

            if (geoJsonReader.payload is null)
            {
                return;
            }
            appState.project = geoJsonReader.GetProject();

            //initialize space
            Vector2d    origin = appState.project.Origin.Coordinates.Vector2d();
            GameObject  Map    = gameObject;
            AbstractMap _map   = Map.GetComponent <AbstractMap>();

            _map.UseWorldScale();
            _map.Initialize(origin, appState.project.MapScale);


            //set globals
            appState.abstractMap = _map;
            appState.map         = Map;
            appState.ZoomChange(appState.project.Scale);
            appState.mainCamera              = MainCamera;
            appState.trackingSpace           = TrackingSpace;
            TrackingSpace.transform.position = appState.project.Camera.Coordinates.Vector3();

            await Init(null);

            Draw();
        }
Exemplo n.º 10
0
    public override void StartCtrl()
    {
        base.StartCtrl();
        BuildData();
        SetView();
        OpenView();

        mapCtrlData.BuildUserStronghold();
        mapCtrlData.BuildConsmuable();


        if (AndaDataManager.Instance.mainData.businessStrongholdAttributes == null)
        {
            Vector2d v2d = Conversions.StringToLatLon(map.Options.locationOptions.latitudeLongitude);
            mapCtrlData.SetCurrentMapCenterpose(new List <double> {
                v2d[0], v2d[1]
            });
        }
        map.Initialize(mapCtrlData.curMapCenterV2d, 15);

        List <double> tt = new List <double> {
            mapCtrlData.curMapCenterPose [0], mapCtrlData.curMapCenterPose [1]
        };

        //X = 121,  Y  = 28
        CallServerGetLocationStronghold(tt);

        mapCtrlData.getMapView.CallbackSearchLatLon = SeartPOI;

        //  mapCtrlData.getMapView.forwardGeocodeUser.OnGeocoderResponse += ForwardGeocoder_OnGeocoderResponse;
    }
Exemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     //add layers before initializing the map
     map.SpawnPrefabByCategory(prefab, LocationPrefabCategories.ArtsAndEntertainment, 10, HandlePrefabSpawned, true, "SpawnFromScriptLayer");
     map.Initialize(new Vector2d(37.784179, -122.401583), 16);
     Debug.Log("POT Placement");
 }
Exemplo n.º 12
0
 public void ChangeZoomInruntime()
 {
     // _mapController._mapVisualizer.DisposeAllTiles();
     _mapController.Initialize(_mapController.CenterLatitudeLongitude, 8);
     //_mapController.Zoom = 8;
     //_mapController.Start();
     //_mapController._mapVisualizer.LoadAllTiles();
 }
Exemplo n.º 13
0
 private static void CreateCity(AbstractMap m)
 {
     if (m.MapVisualizer != null)
     {
         m.ResetMap();
     }
     m.MapVisualizer = ScriptableObject.CreateInstance <MapVisualizer>();
     m.Initialize(new Mapbox.Utils.Vector2d(40.764170691358686f, -73.97670925665614f), 16);
 }
    public void InitializeMap()
    {
        transform.position  = XRSessionManager.GetSession().GetXRCameraPosition();
        transform.rotation  = Quaternion.identity;
        transform.position += Vector3.down * 100;

        var      gpsPos        = XRSessionManager.GetSession().GetLocationCorrection();
        Vector2d gpsLatLongPos = new Vector2d(gpsPos.Latitude, gpsPos.Longitude);

        Map.Initialize(gpsLatLongPos, 15);
    }
Exemplo n.º 15
0
    // Start is called before the first frame update
    void Start()
    {
        AbstractMap map = FindObjectOfType <AbstractMap>();

        if (map != null)
        {
            int      index    = Random.Range(0, locations.Length);
            Vector2d location = locations[index];
            map.Initialize(location, zoom);
        }
    }
Exemplo n.º 16
0
    void Start()
    {
#if UNITY_EDITOR
        StartLatLong = LocationProviderFactory.Instance.EditorLocationProvider.CurrentLocation.LatitudeLongitude;
#endif
#if !UNITY_EDITOR
        StartLatLong = LocationProviderFactory.Instance.DeviceLocationProvider.CurrentLocation.LatitudeLongitude;
#endif
        _map.Initialize(StartLatLong, (int)Zoom);
        _map.SetCenterLatitudeLongitude(StartLatLong);
        lpf = LocationProviderFactory.Instance;
        _map.UpdateMap(StartLatLong);
    }
    public void InitializeMap()
    {
        Vector3 mapPos = XRSessionManager.GetSession().GetXRCameraPosition();

        MapboxMap.transform.position = mapPos;

        var      gpsPos      = XRSessionManager.GetSession().LocalPositionToGps(mapPos);
        Vector2d mapboxCoord = new Vector2d(gpsPos.Latitude, gpsPos.Longitude);

        MapboxMap.Initialize(mapboxCoord, 16);
        MapboxMap.transform.position += Vector3.down * 0.3f;

        MiniMapCam.SetActive(true);
        MapMode = MapMode.Mini;
    }
Exemplo n.º 18
0
    // Use this for initialization
    void Start()
    {
        // Create New proposal
        if (Scenes.IsNewProposal() && _map != null)
        {
            Debug.Log("Creating new proposal");
            String initialCoordinates = Scenes.GetSelectedProject().Coordinates;
            if (initialCoordinates != null)
            {
                _map.Initialize(Conversions.StringToLatLon(initialCoordinates), (int)_map.Zoom);
            }

            var visualizer = _map.MapVisualizer;
            visualizer.OnMapVisualizerStateChanged += (s) =>
            {
                if (this == null)
                {
                    return;
                }
                if (s == ModuleState.Finished)
                {
                    InitBuildings();
                    InteractionsCanvasController.instance.OnClickSave();
                    Scenes.SetIsNewProposal(false);
                }
            };
        }
        //Load existing proposal
        else if (_map != null)
        {
            //for test
            var visualizer = _map.MapVisualizer;
            visualizer.OnMapVisualizerStateChanged += (s) =>
            {
                if (this == null)
                {
                    return;
                }
                if (s == ModuleState.Finished)
                {
                    InitBuildings();
                }
            };
            //Destroy(_map.gameObject);
            //MapLoader.LoadMap(Scenes.GetSelectedProposal().File);
        }
    }
Exemplo n.º 19
0
    public void InitializeMap()
    {
        // TODO: Adjust this? Take a variable from the outside?
        Vector3 mapPos;

        mapPos = XRSessionManager.GetSession().GetXRCameraPosition();
        Map.transform.position = mapPos;

        var      gpsPos      = XRSessionManager.GetSession().LocalPositionToGps(mapPos);
        Vector2d mapboxCoord = new Vector2d(gpsPos.Latitude, gpsPos.Longitude);

        Map.Initialize(mapboxCoord, 16);
        Map.transform.position += Vector3.down * 0.3f;

        MiniMap.SetActive(true);
        MiniMapCam.GetComponent <MiniMapCam>().Initialize(/*_miniMapCamHeight,*/ 100, _miniMapCamDistBehindUser);
        MapSettings.Mode = MapMode.Mini;
    }
Exemplo n.º 20
0
    // Start is called before the first frame update
    void Start()
    {
        cf     = ConfigFile.GetInstance();
        mapapi = gameObject.GetComponent <AbstractMap>();

        double latitude  = cf.GetDoubleValue("Latitude");
        double longitude = cf.GetDoubleValue("Longitude");

        zoom = cf.GetIntValue("Zoom");
        float height = cf.GetFloatValue("Height");
        float ypos   = cf.GetFloatValue("PositionY");

        mapapi.Terrain.SetExaggerationFactor(height);
        mapapi.Initialize(new Mapbox.Utils.Vector2d(latitude, longitude), zoom);
        Vector3 pos = transform.position;

        transform.position = new Vector3(pos.x, ypos, pos.z);
    }
Exemplo n.º 21
0
    // Use this for initialization
    void Start()
    {
        _locations       = Transitions.locations;
        _locationStrings = Transitions.locationStrings;

        _spawnedObjects = new List <GameObject>();
        for (int i = 0; i < _locations.Length; i++)
        {
            GameObject instance = Instantiate(_markerPrefab);
            instance.name = _locationStrings[i];
            instance.transform.SetParent(_map.transform);

            _spawnedObjects.Add(instance);
        }

        _playerInstance = Instantiate(_playerPrefab);
        _playerInstance.transform.SetParent(_map.transform);

        _map.Initialize(CalculateCentroid(_locations), 16);
        _map.gameObject.SetActive(false);
    }
Exemplo n.º 22
0
    void Update()
    {
        if (map != null)
        {
            ButtonHandler.GetComponent <Actions>().Scale(wl.scale);
            map.Initialize(wl.latLong, (int)wl.zoom);
            ButtonHandler.CurrZoom = wl.zoom;

            ButtonHandler.CurrScale = wl.scale;
            GameObject.FindGameObjectWithTag("GameController").GetComponent <CornerFinder>().newMap();
            GameObject.Destroy(gameObject);
        }
        else
        {
            try
            {
                map = GameObject.FindGameObjectWithTag("Map").GetComponent <AbstractMap>();
            }
            catch (System.Exception)
            {
            }
        }
    }
Exemplo n.º 23
0
 void Start()
 {
     _map.Initialize(_lonLatOrigin, _zoom);
     _current = _lonLatOrigin;
     GUIField.Subscribe(this, 0, _onGui);
 }
Exemplo n.º 24
0
    private void OnGUI()
    {
        if (_citySimulatorMap == null)
        {
            _citySimulatorMap = GameObject.Find("Manhattan");
        }
        if (_abstractMap == null)
        {
            _abstractMap = _citySimulatorMap?.GetComponent <CustomMap>();
        }

        minHeight = EditorGUILayout.FloatField("Minimum Building Height:", minHeight);
        maxHeight = EditorGUILayout.FloatField("Maximum Building Height:", maxHeight);

        if (GUILayout.Button("Edit Mode Build"))
        {
            //if (abstractMap.MapVisualizer != null) { abstractMap.ResetMap(); }
            if (_abstractMap != null)
            {
                _abstractMap.MapVisualizer = CreateInstance <MapVisualizer>();
                _abstractMap.Initialize(new Mapbox.Utils.Vector2d(40.764170691358686f, -73.97670925665614f), 16);
            }
            //abstractMap.Initialize(new Mapbox.Utils.Vector2d(-29.3151, 27.4869), 16);
        }

        if (GUILayout.Button("1. Setup Objects") && _citySimulatorMap != null)
        {
            RenameRoads(_citySimulatorMap.transform);
            OptimizeRenderer(_citySimulatorMap.transform);
            foreach (Transform tile in _citySimulatorMap.transform)
            {
                SortChildrenByName(tile);
            }

            GroupAllByBlocks(_citySimulatorMap.transform);
            SplitAllBlocks(_citySimulatorMap.transform);
            SortHeirarchy(_citySimulatorMap.transform);
            DestroyImmediate(_citySimulatorMap.GetComponent <RangeTileProvider>());
        }

        if (GUILayout.Button("1.5. Combine") && _citySimulatorMap != null)
        {
            Transform road = null;
            foreach (Transform tile in _citySimulatorMap.transform)
            {
                for (var i = 0; i < tile.childCount; i++)
                {
                    var current = tile.GetChild(i);
                    if (current.name.Substring(0, 4) == "Road")
                    {
                        road = current;
                        continue;
                    }
                    CombineParentAndChildrenMeshes(current, !EditorApplication.isPlaying);
                }
                if (road != null && EditorApplication.isPlaying)
                {
                    Destroy(road.gameObject);
                }
                else if (road != null && !EditorApplication.isPlaying)
                {
                    DestroyImmediate(road.gameObject);
                }
            }
        }

        if (GUILayout.Button("2. Box buildings") && _citySimulatorMap != null)
        {
            var material = Resources.Load("Materials/WhiteLOD") as Material;

            foreach (Transform tile in _citySimulatorMap.transform)
            {
                foreach (Transform building in tile)
                {
                    if (building.childCount > 0)
                    {
                        continue;
                    }

                    new BoundingBox(building).Build(material, IsTall(building) ? Building.Tall : Building.Short);
                    //DestroyImmediate(building.GetComponent<MeshCollider>());
                }
            }
        }

        if (GUILayout.Button("3. Combine Mesh in Tiles") && _citySimulatorMap != null)
        {
            foreach (Transform tile in _citySimulatorMap.transform)
            {
                GroupByTile(tile);
            }
        }

        if (GUILayout.Button("Test Starpath"))
        {
            Obstacle.Accessor.Clear();
            TestStar();
        }

        if (GUILayout.Button("Test SmartStarpath"))
        {
            Obstacle.Accessor.Clear();
            TestSmartStar();
        }

        if (GUILayout.Button("HEIGHT!"))
        {
            GenerateHeightBitMapTEST(8);
        }
    }
Exemplo n.º 25
0
 void setCoordinates(string latLon)
 {
     map.Initialize(JsonUtility.FromJson <Mapbox.Utils.Vector2d>(latLon), 15);
 }
Exemplo n.º 26
0
    void Start()
    {
        Mercator mProj = new Mercator();

        // obtaining the  maximum and minimum latitiude and longitude from the graph

        if (_viz == null)
        {
            _viz         = this.gameObject.GetComponent <Visualisation>();
            mySourceData = (CSVDataSource)_viz.dataSource;
        }
        string x_data_dim = _viz.xDimension.Attribute;
        string z_data_dim = _viz.zDimension.Attribute;


        float maxlongitute = float.Parse(_viz.dataSource.getOriginalValue(mySourceData[x_data_dim].Data.Max(), x_data_dim) + "");
        float maxlatitude  = float.Parse(_viz.dataSource.getOriginalValue(mySourceData[z_data_dim].Data.Max(), z_data_dim) + "");
        float minlongitute = float.Parse(_viz.dataSource.getOriginalValue(mySourceData[x_data_dim].Data.Min(), x_data_dim) + "");
        float minlatitude  = float.Parse(_viz.dataSource.getOriginalValue(mySourceData[z_data_dim].Data.Min(), z_data_dim) + "");


        //GeoCoordinate
        float[] topLeft     = mProj.latLonToMeters(minlatitude, minlongitute);
        float[] topright    = mProj.latLonToMeters(minlatitude, maxlongitute);
        float[] bottomLeft  = mProj.latLonToMeters(maxlatitude, minlongitute);
        float[] bottomRight = mProj.latLonToMeters(maxlatitude, maxlongitute);


        Vector2d centerMap = new Vector2d(minlatitude + (maxlatitude - minlatitude) / 2.0, minlongitute + (maxlongitute - minlongitute) / 2.0);

        float leftRightDistance = this.distance(topLeft[0], topLeft[1], topright[0], topright[1]);
        float topBottomDistance = this.distance(topLeft[0], topLeft[1], bottomLeft[0], bottomLeft[1]);

        float maxdist = Mathf.Max(leftRightDistance, topBottomDistance);

        float pixelDist = 3 * 256;

        int lastgoodZoom = 0;

        for (int i = 0; i < 17; i++)
        {
            float realSize = 256 * (maxdist / 40000000) * Mathf.Pow(2, i);
            if (realSize < pixelDist)
            {
                lastgoodZoom = i;
            }
        }
        Debug.Log("Appropriate Zoom level: " + lastgoodZoom);
        //_map.ResetMap();

        GameObject mapGo = new GameObject("Map_GO");

        mapGo.transform.parent     = this.transform;
        mapGo.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
        _map = mapGo.AddComponent <AbstractMap>();

        _map.Initialize(centerMap, lastgoodZoom);

        // calculating the coordinates for the x-axis end point, z-axis end point  and the center
        xExtremeAxis = maxlatitude + "," + minlongitute;
        zExtremeAxis = minlatitude + "," + maxlongitute;
        center       = minlatitude + "," + minlongitute;

        Debug.Log("ExtremeValue: " + center + " - " + xExtremeAxis + " - " + zExtremeAxis);

        // coverting the coordinates into geolocation
        Vector3 xExtremeAxisGeo = _map.GeoToWorldPosition(Conversions.StringToLatLon(xExtremeAxis), true);
        Vector3 zExtremeAxisGeo = _map.GeoToWorldPosition(Conversions.StringToLatLon(zExtremeAxis), true);
        Vector3 centerGeo       = _map.GeoToWorldPosition(Conversions.StringToLatLon(center), true);

        // Assigning the position to the visulization by making center of the visulization fixed

        Vector3 mapPos = _map.transform.position;

        _viz.transform.position = centerGeo;
        _map.transform.position = mapPos;
        // calculating the length of x and z axis for width and depth of the graph respectively
        var width = (centerGeo - zExtremeAxisGeo).magnitude;
        var Depth = (centerGeo - xExtremeAxisGeo).magnitude;

        _viz.width = width;
        _viz.depth = Depth;
        //_map.
        //  height of the graph
        // when z-axis is not defined
        if (_viz.zDimension.Attribute == "Undefined")
        {
            _viz.height = _map.Options.locationOptions.zoom / 5;
        }
        else // when z-axis is defined
        {
            _viz.height = _viz.zDimension.maxScale;
        }


        _viz.gameObject.GetComponent <ScatterplotVisualisation>().UpdateVisualisationAxes(AbstractVisualisation.PropertyType.Scaling);

        // function for map update
        _map.OnUpdated += delegate
        {
            UpdateMap();
        };
    }
Exemplo n.º 27
0
    public void SwitchPark(string park)
    {
        map.Initialize((Vector2d)locations.parks[park], 16);
//        Debug.Log("map changed to" + "   " + map.Options.locationOptions.latitudeLongitude.ToString());
    }
Exemplo n.º 28
0
 public static void BuildCity(AbstractMap map)
 {
     map.Initialize(new Mapbox.Utils.Vector2d(Constants.OriginCoordinates[0], Constants.OriginCoordinates[1]), Constants.mapboxZoom);
 }
Exemplo n.º 29
0
        void Reload(int value)
        {
//			_camera.transform.position = _cameraStartPos;

            string cityString = "";

            switch (value)              // Depends on dropdown options order
            {
            case 0:
                cityString = "Saint Paul";
                break;

            case 1:
                cityString = "Minneapolis";
                break;

            case 2:
                cityString = "Seattle";
                break;
            }

            MapLocation mapLocation = MapLocationManager.Instance._mapLocationDict[cityString];

            UIDataManager.Instance.cityString = mapLocation._cityString;

            // Update Min Max Text
            float maxHeight = mapLocation._housingValueMinMaxDict["max"][UIDataManager.Instance.MonthKeys[UIDataManager.Instance.TimeIndex]];
            float minHeight = mapLocation._housingValueMinMaxDict["min"][UIDataManager.Instance.MonthKeys[UIDataManager.Instance.TimeIndex]];

            _heightMinMaxText.text = "Min: " + String.Format("{0:0}", minHeight) + " Max: " + String.Format("{0:0}", maxHeight);


            string timeString = UIDataManager.Instance.MonthKeys[UIDataManager.Instance.TimeIndex];
            string sideColorDataKey;

            if ((float.Parse(timeString.Substring(0, 4))) > 2005)
            {
                sideColorDataKey = "2010-minorityPercent";
            }
            else
            {
                sideColorDataKey = "2000-minorityPercent";
            }

            float maxColor = mapLocation._minorityPercentMinMaxDict["max"][sideColorDataKey];
            float minColor = mapLocation._minorityPercentMinMaxDict["min"][sideColorDataKey];

            _colorMinMaxText.text = "Min: " + String.Format("{0:0.00}", minColor) + " Max: " + String.Format("{0:0.00}", maxColor);


            _map.UnityTileSize = mapLocation._tileSize;
            RangeTileProvider tileProvider = _map.TileProvider as RangeTileProvider;

            if (tileProvider != null)
            {
                tileProvider.West  = mapLocation._westTiles;
                tileProvider.North = mapLocation._northTiles;
                tileProvider.East  = mapLocation._eastTiles;
                tileProvider.South = mapLocation._southTiles;
                _map.TileProvider  = tileProvider;
            }
            string[] latLonSplit      = mapLocation._latLongString.Split(',');
            Vector2d mapCenterLatLong = new Vector2d(double.Parse(latLonSplit[0]), double.Parse(latLonSplit[1]));

            DynamicFeatureManager.Instance.featureDictionary = new Dictionary <GameObject, VectorFeatureUnity>();
            _map.Initialize(mapCenterLatLong, mapLocation._zoom);
        }
Exemplo n.º 30
0
 void Reload(float value)
 {
     _camera.transform.position = _cameraStartPos;
     _map.Initialize(_map.CenterLatitudeLongitude, (int)value);
 }