public void updateLocation(Location location, bool isInitialLocation, bool isHeadingUpdated, bool isLatLngUpdated)
    {
        currentLoc = location;
        if (isInitialLocation == true)
        {
            Debug.Log("Initial location set: " + location.LatitudeLongitude.ToString() + " with heading: " + location.Heading);
            setMapOrientation(location.Heading);
            StartCoroutine(getTrailsForLocation(location, 50));
            StartCoroutine(annotationHandler.SetupMap());
        }
        if (isHeadingUpdated)
        {
//			playerLocation.transform.Rotate(Vector3.up, location.Heading);
        }
        if (isLatLngUpdated)
        {
            if (map == null)
            {
                map = (Mapbox.Unity.Map.AbstractMap)mapObject.GetComponent((typeof(Mapbox.Unity.Map.AbstractMap)));
            }
            Vector3 destinationVec = map.GeoToWorldPosition(location.LatitudeLongitude);
            float   height         = directionHandler.getHeightForPosition(location.LatitudeLongitude);
            Debug.Log("height at new position: " + height);
            nextPlayerPosition = new Vector3(destinationVec.x, playerObject.transform.localPosition.y, destinationVec.z);
        }
    }
    public void initiliazeMap(Vector2 latLong, int zoomFactor)
    {
        //convert Vector2 to proper format
        Mapbox.Utils.Vector2d MBLatLong = new Mapbox.Utils.Vector2d((double)latLong.x, (double)latLong.y);
        Debug.Log(MBLatLong);

        //initialize map at location
        basicMap = (Mapbox.Unity.Map.AbstractMap)GetComponent(typeof(Mapbox.Unity.Map.AbstractMap));
        basicMap.Initialize(MBLatLong, zoomFactor);
    }
    void Start()
    {
        //object that updates camera position based on player position

        StartCoroutine(setPositionOnVuforiaEnabled());

        //get reference to WWWHandler and get server data and parse it
        if (wwwHandler != null)
        {
            wwwScript = (WWWHandler)wwwHandler.gameObject.GetComponent(typeof(WWWHandler));
        }

        //get reference to map handler script
        if (mapObject != null)
        {
            map = (Mapbox.Unity.Map.AbstractMap)mapObject.GetComponent((typeof(Mapbox.Unity.Map.AbstractMap)));
        }

        if (directionsObject != null)
        {
            directionHandler = (DirectionsHandler)directionsObject.GetComponent(typeof(DirectionsHandler));
        }

        if (annotationObject != null)
        {
            annotationHandler = (AnnotationHandler)annotationObject.GetComponent(typeof(AnnotationHandler));
        }

        if (uiObject != null)
        {
            uiHandler = (UIManager)uiObject.GetComponent(typeof(UIManager));
        }

        if (playerObject == null)
        {
            playerObject = GameObject.FindGameObjectWithTag("Player");
        }

        if (playerLocation == null)
        {
            playerLocation = GameObject.FindGameObjectWithTag("playerLocation");
        }

        if (cameraPosition == null)
        {
            cameraPosition = GameObject.FindGameObjectWithTag("cameraPosition");
        }
        StartCoroutine(directionHandler.waitForMapLoad());
        nextPlayerPosition = playerObject.transform.localPosition;
    }
Ejemplo n.º 4
0
 public void SetUpPlacement(AbstractMap map)
 {
     map.SetCenterMercator(Conversions.LatLonToMeters(map.CenterLatitudeLongitude));
 }
Ejemplo n.º 5
0
        public void SetUpPlacement(AbstractMap map)
        {
            var referenceTileRect = Conversions.TileBounds(TileCover.CoordinateToTileId(map.CenterLatitudeLongitude, map.AbsoluteZoom));

            map.SetCenterMercator(referenceTileRect.Center);
        }
Ejemplo n.º 6
0
        public void SetUpScaling(AbstractMap map)
        {
            var referenceTileRect = Conversions.TileBounds(TileCover.CoordinateToTileId(map.CenterLatitudeLongitude, map.AbsoluteZoom));

            map.SetWorldRelativeScale((float)(map.Options.scalingOptions.unityTileSize / referenceTileRect.Size.x));
        }
Ejemplo n.º 7
0
        public void SetUpScaling(AbstractMap map)
        {
            var scaleFactor = Mathf.Pow(2, (map.AbsoluteZoom - map.InitialZoom));

            map.SetWorldRelativeScale(scaleFactor * Mathf.Cos(Mathf.Deg2Rad * (float)map.CenterLatitudeLongitude.x));
        }
Ejemplo n.º 8
0
 public void SetUpScaling(AbstractMap map)
 {
     map.SetWorldRelativeScale(Mathf.Cos(Mathf.Deg2Rad * (float)map.CenterLatitudeLongitude.x));
 }