Exemple #1
0
    public void dropDownLocationChanged()
    {
        switch (dropdown.value)
        {
        case 0:
            mapOptions.SetCenterLatitudeLongitude(miami);
            mapOptions.UpdateMap();
            break;

        case 1:
            mapOptions.SetCenterLatitudeLongitude(newYork);
            mapOptions.UpdateMap();
            break;

        case 2:
            mapOptions.SetCenterLatitudeLongitude(chicago);
            mapOptions.UpdateMap();
            break;

        case 3:
            mapOptions.SetCenterLatitudeLongitude(paris);
            mapOptions.UpdateMap();
            break;
        }
        ocean.GetComponent <water_updates>().setHeight(0);
        map.transform.position = new Vector3(0, 0, 0);
    }
Exemple #2
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);
    }
    // Start is called before the first frame update
    public void Start()
    {
        try
        {
            if (_abstractMap == null)
            {
                _abstractMap = FindObjectOfType <AbstractMap>();
            }

            expedition = Newtonsoft.Json.JsonConvert.DeserializeObject <Expedition>(jsonFile.text);
            expedition.guide.OrderByDescending(g => DateTime.Parse(g.time));
            _abstractMap.SetCenterLatitudeLongitude(Conversions.StringToLatLon($"{expedition.guide.FirstOrDefault().lat},{expedition.guide.FirstOrDefault().lon}"));


            foreach (var participant in expedition.participants)
            {
                participant.OrderByDescending(p => DateTime.Parse(p.time));
            }

            // Get the location provider
            if (locationProviderFactory != null)
            {
                locationProvider = locationProviderFactory.DefaultLocationProvider;
            }
            myGameObject.transform.localScale = new Vector3(2f, 2f, 2f);
        }
        catch (Exception)
        {
        }
    }
Exemple #4
0
    // Start is called before the first frame update
    IEnumerator getLocation()
    {
        if (!Input.location.isEnabledByUser)
        {
            Input.location.Stop();
            yield break;
        }
        Input.location.Start();
        int maxWait = 120;

        while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
        {
            yield return(new WaitForSeconds(1));

            maxWait--;
        }
        if (maxWait < 1)
        {
            Input.location.Stop();
            yield break;
        }
        if (Input.location.status == LocationServiceStatus.Failed)
        {
            Input.location.Stop();
            yield break;
        }
        else
        {
            map.SetCenterLatitudeLongitude(new Mapbox.Utils.Vector2d(Input.location.lastData.latitude, Input.location.lastData.longitude));
        }
        Input.location.Stop();
    }
Exemple #5
0
    // Start is called before the first frame update
    private void Start()
    {
        if (_meshModifiers == null)
        {
            _meshModifiers = new MeshModifier[] { new LineMeshModifier() };
        }

        if (_gameObj == null)
        {
            _gameObj = GetComponent <GameObject>();
        }

        if (_abstractMap == null)
        {
            _abstractMap = FindObjectOfType <AbstractMap>();
        }

        try
        {
            _expedition = Newtonsoft.Json.JsonConvert.DeserializeObject <Expedition>(_jsonFile.text);
            _abstractMap.SetCenterLatitudeLongitude(Conversions.StringToLatLon($"{_expedition.guide.FirstOrDefault().lat},{_expedition.guide.FirstOrDefault().lon}"));
        }
        catch (Exception)
        {
        }

        MeshData meshData = CreateMeshData();

        _gameObj = CreateGameObject(meshData);
    }
    // Start is called before the first frame update
    void Start()
    {
        map = Object.FindObjectOfType <AbstractMap>();
        map.SetCenterLatitudeLongitude(new Vector2d(60.670680f, 5.595375f));
        map.SetZoom(14);

        tiles = new HashSet <UnityTile>();
    }
Exemple #7
0
    /* ---------- GetData ----------
     * GPSのデータを取得するコルーチン
     */
    IEnumerator GetData()
    {
        Debug.Log("GPS情報参照開始");

        //--- 端末のGPS機能が使えないとき ---
        if (!Input.location.isEnabledByUser)
        {
            Debug.Log("GPS is cannot use.");
            latitude.text  = "GPSをONにしてね";
            longitude.text = "GPSをONにしてね";

            yield break;
        }


        Input.location.Start();
        int maxWait = 3;

        while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
        {
            yield return(new WaitForSeconds(1));

            maxWait--;
        }
        if (maxWait < 1)
        {
            Debug.Log("Timed out");
            yield break;
        }
        if (Input.location.status == LocationServiceStatus.Failed)
        {
            Debug.Log("Unable to determine device location");
            latitude.text  = "GPS情報を取得できません";
            longitude.text = "GPS情報を取得できません";

            yield break;
        }
        else
        {
            latitude.text  = "緯度 : " + Input.location.lastData.latitude;
            longitude.text = "経度 : " + Input.location.lastData.longitude;

            //--- 地図の中心に緯度経度を指定 ---

            Vector2d pos = new Vector2d(Input.location.lastData.latitude, Input.location.lastData.longitude);
            //abstractMap.CenterLatitudeLongitude = pos;
            abstractMap.SetCenterLatitudeLongitude(pos);

            Debug.Log("Location: " +
                      Input.location.lastData.latitude + " " +
                      Input.location.lastData.longitude + " " +
                      Input.location.lastData.altitude + " " +
                      Input.location.lastData.horizontalAccuracy + " " +
                      Input.location.lastData.timestamp);
        }
        Input.location.Stop();
    }
Exemple #8
0
    private void SetGPS()
    {
        location = new Location();

        //returned a vector2d as location which is set to UHCL coordinates
        location.locationGPS = new Vector2d(29.5779, -95.1040);
        //populate location on the map
        mapInstance.SetCenterLatitudeLongitude(location.locationGPS);
    }
Exemple #9
0
 public void SetMapCenter()
 {
     Debug.Log("coorded : " + coorded_spot);
     if (seted)
     {
         Debug.Log("now LL : " + _map.CenterLatitudeLongitude);
         //_map.CenterLatitudeLongitude = coorded_spot;
         _map.SetCenterLatitudeLongitude(coorded_spot);
         _map.UpdateMap(_map.CenterLatitudeLongitude, _map.Zoom);
     }
 }
 public void search()
 {
     //Read input of coordinates and update the map with the new coordinates.
     latt = double.Parse(lat.GetComponent <Text>().text);
     lonn = double.Parse(lon.GetComponent <Text>().text);
     mapOptions.SetCenterLatitudeLongitude(new Mapbox.Utils.Vector2d(latt, lonn));
     mapOptions.UpdateMap();
     //Reset dependent fields
     ocean.GetComponent <water_updates>().setHeight(0);
     slider.value = 0;
     citySimMap.transform.position = new Vector3(0, 0, 0);
     //Log change to console
     print("Setting the coordinates to " + latt + ", " + lonn);
 }
Exemple #11
0
        void HandleMouseAndKeyBoard()
        {
            if (Input.GetMouseButton(0) && !EventSystem.current.IsPointerOverGameObject())
            {
                var mousePosition = Input.mousePosition;
                mousePosition.z = _referenceCamera.transform.localPosition.y;
                _delta          = _referenceCamera.ScreenToWorldPoint(mousePosition) - _referenceCamera.transform.localPosition;
                _delta.y        = 0f;
                if (_shouldDrag == false)
                {
                    _shouldDrag = true;
                    _origin     = _referenceCamera.ScreenToWorldPoint(mousePosition);
                }
            }
            else
            {
                _shouldDrag = false;
            }

            if (_shouldDrag == true)
            {
                var offset = _origin - _delta;
                offset.y = transform.localPosition.y;
                transform.localPosition = offset;

                //center map to current view
                _map.SetCenterLatitudeLongitude(_map.WorldToGeoPosition(transform.position));
            }
            else
            {
                if (EventSystem.current.IsPointerOverGameObject())
                {
                    return;
                }

                var x = Input.GetAxis("Horizontal");
                var z = Input.GetAxis("Vertical");
                var y = Input.GetAxis("Mouse ScrollWheel") * _zoomSpeed;
                if (!(Mathf.Approximately(x, 0) || Mathf.Approximately(y, 0) || Mathf.Approximately(z, 0)))
                {
                    transform.localPosition += transform.forward * y + (_originalRotation * new Vector3(x * _panSpeed, 0, z * _panSpeed));
                    _map.UpdateMap();
                }
            }
        }
 /// <summary>
 /// Updates the panel with new data
 /// </summary>
 /// <param name="dataModel"></param>
 public void UpdatePanel(Assets.Scripts.DataModel dataValue)
 {
     if (dataValue == null)
     {
         lastConnected = false;
         return;
     }
     if (!lastConnected)
     {
         Debug.Log("Load waypoints");
         LoadWaypoints(dataValue);
     }
     if (autoFollow)
     {
         map.SetCenterLatitudeLongitude(new Vector2d(dataValue.gps.latitude, dataValue.gps.longitude));
         map.UpdateMap();
     }
     lastConnected = true;
 }
Exemple #13
0
    // マッチングが成功した時に呼ばれるコールバック
    public override void OnJoinedRoom()
    {
        Debug.Log("ルームに入りました。");
        Debug.Log("playerCount:" + playerCount);
        AppUtil.me = PhotonNetwork.LocalPlayer;
        GameObject mapObj;

        makeThisStatic.Instance.TryGetValue("Map", out mapObj);
        playerList = PhotonNetwork.CurrentRoom.Players;
        AbstractMap map = mapObj.GetComponent <AbstractMap>();

        if (PhotonNetwork.IsMasterClient)
        {
            string[] lat = new string[] { map.CenterLatitudeLongitude.x.ToString(), map.CenterLatitudeLongitude.y.ToString() };
            PhotonNetwork.CurrentRoom.SetPropertiesListedInLobby(lat);
        }
        else
        {
            string[] currentlat = PhotonNetwork.CurrentRoom.PropertiesListedInLobby;
            map.SetCenterLatitudeLongitude(new Mapbox.Utils.Vector2d(float.Parse(currentlat[0]), float.Parse(currentlat[1])));
        }
    }
Exemple #14
0
 public void UpdateMap(Mapbox.Utils.Vector2d latitudeLongitude)
 {
     mapVariable.SetCenterLatitudeLongitude(latitudeLongitude);
     mapVariable.UpdateMap();
 }
Exemple #15
0
 public void SetMapLatLon(Vector2d center)
 {
     _map.SetCenterLatitudeLongitude(center);
 }
Exemple #16
0
 public void CenterMap(string Lat, string Lon)
 {
     _map.SetCenterLatitudeLongitude(new Mapbox.Utils.Vector2d(double.Parse(Lat), double.Parse(Lon)));
 }
Exemple #17
0
 public void CenterMapOnLocation()
 {
     _map.SetCenterLatitudeLongitude(GetLocation());
     _map.UpdateMap();
 }