Exemple #1
0
    public void Reset()
    {
        Vector2d devicelatlong;


#if UNITY_EDITOR
        devicelatlong = LocationProviderFactory.Instance.EditorLocationProvider.CurrentLocation.LatitudeLongitude;
#endif
#if !UNITY_EDITOR
        devicelatlong = LocationProviderFactory.Instance.DeviceLocationProvider.CurrentLocation.LatitudeLongitude;
#endif


        if (Input.location.isEnabledByUser)
        {
            devicelatlong = LocationProviderFactory.Instance.DefaultLocationProvider.CurrentLocation.LatitudeLongitude;
            _map.SetCenterLatitudeLongitude(devicelatlong);
            _map.SetZoom(Zoom);
            _map.UpdateMap();
        }
        else if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor)
        {
            devicelatlong = LocationProviderFactory.Instance.DefaultLocationProvider.CurrentLocation.LatitudeLongitude;
            _map.SetCenterLatitudeLongitude(devicelatlong);
            _map.SetZoom(Zoom);
            _map.UpdateMap();
        }
    }
Exemple #2
0
 void zoomin()
 {
     if (SteamVR_Actions._default.ZoomingLevelUp.GetStateDown(SteamVR_Input_Sources.RightHand))
     { //Both controller
         Debug.Log("right pad north pressed");
         map.SetZoom(map.Zoom + zoomingskip);
         map.UpdateMap(map.Zoom);
     }
 }
 void zoomin()
 {
     if (SteamVR_Actions._default.ZoomingLevelUp.GetStateDown(SteamVR_Input_Sources.RightHand))
     { //Right controller
         //Debug.Log("right pad north pressed");
         map.SetZoom(map.Zoom + zoomingskip);
         map.UpdateMap(map.Zoom);
         lineGen.needUpdate = true;
         updateText("Zoom in");
     }
 }
Exemple #4
0
    public void Zoom(bool ZoomIn)
    {
        if (map == null)
        {
            findMap();
        }
        if (Handler == null)
        {
            findHandler();
        }
        float zoomAmount = Handler.zoomAmount;
        float currZoom   = Handler.CurrZoom;

        if (ZoomIn)
        {
            currZoom = Mathf.Min(20, Mathf.Max(0, currZoom + zoomAmount));
        }
        else
        {
            currZoom = Mathf.Min(20, Mathf.Max(0, currZoom - zoomAmount));
        }
        Handler.CurrZoom = currZoom;
        map.SetZoom(currZoom);
        map.UpdateMap();
    }
Exemple #5
0
 // Use this for initialization
 void Start()
 {
     markers = new List <Marker>();
     map.SetZoom(initZoom);
     //对地图做任何事件操作都会更新POI
     map.OnUpdated += OnUpdatedMarkerts;
 }
    private void SetZoomToFitBounds(Vector2dBounds targetBounds, Vector2dBounds screenBounds)
    {
        // 得到东西差值作为精度差值
        var targetLonDelta = targetBounds.East - targetBounds.West;
        //得到南北差值作为纬度差值
        var targetLatDelta = targetBounds.North - targetBounds.South;

        var screenLonDelta = screenBounds.East - screenBounds.West;
        var screenLatDelta = screenBounds.North - screenBounds.South;

        // 维度缩放值
        var zoomLatMultiplier = screenLatDelta / targetLatDelta;
        var zoomLonMultiplier = screenLonDelta / targetLonDelta;

        var latZoom = Math.Log(zoomLatMultiplier, 2);
        var lonZoom = Math.Log(zoomLonMultiplier, 2);

        var zoom = (float)(_mapManager.Zoom + Math.Min(latZoom, lonZoom));

        _mapManager.SetZoom(zoom);
        _mapManager.UpdateMap();

        Debug.Log(_mapManager.UnityTileSize);
        _mapManager.UseCustomScale(3.3f);
        Debug.Log(_mapManager.UnityTileSize);
    }
    // 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>();
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey("left shift") || Input.GetKey("right shift")) // Если нажата кнопка Shift
        {
            if (Input.GetKeyDown("1"))                                 // Переход к новым координатам
            {
                print("UnityTileSize = " + _AbsMap.UnityTileSize);
                print("WorldRelativeScale = " + _AbsMap.WorldRelativeScale);
                print("Zoom = " + _AbsMap.Zoom);
                print("CenterLatitudeLongitude = " + _AbsMap.CenterLatitudeLongitude);
                print("CenterMercator = " + _AbsMap.CenterMercator);
                print("");

                _AbsMap.SetZoom(_AbsMap.Zoom + 0.1f);
                _AbsMap.UpdateMap();

                Vector2d myNewCoord = new Vector2d(47.26666667f, 11.35f); // Иннсбрук
                _AbsMap.UpdateMap(myNewCoord, 12f);
            }
            if (Input.GetKeyDown("2")) // Переход от плоской карты к объемной
            {
                print(_AbsMap.Terrain.ElevationType);
                if (_AbsMap.Terrain.ElevationType != ElevationLayerType.TerrainWithElevation)
                {
                    _AbsMap.Terrain.SetElevationType(ElevationLayerType.TerrainWithElevation);
                }
                else
                {
                    _AbsMap.Terrain.SetElevationType(ElevationLayerType.FlatTerrain);
                }
                print(_AbsMap.Terrain.ElevationType);
            }
        }

        // Тестовое ссобщение
        if (Input.GetKeyDown("9"))
        {
            _WorldMessage.myFuncShowMessage("Нажата клавиша 9", 3.0f);
            Vector3 myGeoPos = WorldToGeoPosition(Vector3.zero);
        }
    }
Exemple #9
0
 public void SliderChanged()
 {
     _map.SetZoom(slider.value);
     _map.UpdateMap(_map.CenterLatitudeLongitude, _map.Zoom);
 }
Exemple #10
0
 public void UpdateMap(float currentZoom)
 {
     currentZoom = Mathf.Clamp(currentZoom, Phase1.instance.getMinZoom(), Phase1.instance.getMaxZoom());
     mapVariable.SetZoom(currentZoom);
     mapVariable.UpdateMap();
 }