Esempio n. 1
0
        private void OnFindDirectionComplete(string response)
        {
            // Get the route steps.
            List <OnlineMapsDirectionStep> steps = OnlineMapsDirectionStep.TryParse(response);

            if (steps != null)
            {
                // Showing the console instructions for each step.
                foreach (OnlineMapsDirectionStep step in steps)
                {
                    Debug.Log(step.stringInstructions);
                }

                // Get all the points of the route.
                List <Vector2> points = OnlineMapsDirectionStep.GetPoints(steps);

                // Create a line, on the basis of points of the route.
                OnlineMapsDrawingLine route = new OnlineMapsDrawingLine(points, Color.green);

                // Draw the line route on the map.
                OnlineMaps.instance.AddDrawingElement(route);
            }
            else
            {
                Debug.Log("Find direction failed");
            }
        }
        private void OnComplete(string response)
        {
            Debug.Log("OnComplete");
            List <OnlineMapsDirectionStep> steps = OnlineMapsDirectionStep.TryParse(response);

            if (steps == null)
            {
                Debug.Log("Something wrong");
                Debug.Log(response);
                return;
            }

            // Create a new marker in first point.
            marker = OnlineMaps.instance.AddMarker(steps[0].start, "Car");

            // Gets points of route.
            points = OnlineMapsDirectionStep.GetPoints(steps);

            // Draw the route.
            OnlineMapsDrawingLine route = new OnlineMapsDrawingLine(points, Color.red, 3);

            OnlineMaps.instance.AddDrawingElement(route);

            pointIndex = 0;
        }
Esempio n. 3
0
        private void OnComplete(string response)
        {
            OnlineMaps.instance.RemoveMarkerAt(0);
            OnlineMaps.instance.RemoveAllDrawingElements();

            OnlineMapsFindDirection.Find(fromPlace, toPlace).OnComplete -= OnComplete;

            List <OnlineMapsDirectionStep> steps = OnlineMapsDirectionStep.TryParse(response);

            if (steps == null)
            {
                Debug.Log("Something wrong");
                Debug.Log(response);
                return;
            }

            // Create a new marker in first point.
            marker = OnlineMaps.instance.AddMarker(steps[0].start, "XAD");

            // Gets points of route.
            points = OnlineMapsDirectionStep.GetPoints(steps);

            // Draw the route.
            OnlineMapsDrawingLine route = new OnlineMapsDrawingLine(points, Color.red, 1);

            OnlineMaps.instance.AddDrawingElement(route);

            OnlineMaps.instance.position = marker.position;
            OnlineMaps.instance.Redraw();

            pointIndex = 0;
        }
Esempio n. 4
0
        /// <summary>
        /// This method is called when a response is received.
        /// </summary>
        /// <param name="response">Response string</param>
        private void OnRequestComplete(string response)
        {
            Debug.Log(response);

            // Get the route steps.
            List <OnlineMapsDirectionStep> steps = OnlineMapsDirectionStep.TryParseORS(response);

            // Get the route points.
            List <Vector2> points = OnlineMapsDirectionStep.GetPoints(steps);

            // Draw the route.
            OnlineMaps.instance.AddDrawingElement(new OnlineMapsDrawingLine(points, Color.red));

            // Set the map position to the first point of route.
            OnlineMaps.instance.position = points[0];
        }
Esempio n. 5
0
    private void OnFindDirectionGoogleComplete(string response)
    {
        // Get the route steps.
        List <OnlineMapsDirectionStep> steps = OnlineMapsDirectionStep.TryParse(response);

        if (steps != null)
        {
            directionsObj.InitRoute(steps);
            // Get all the points of the route.
            List <Vector2> points = OnlineMapsDirectionStep.GetPoints(steps);
            // Create a line, on the basis of points of the route.
            OnlineMapsDrawingLine route = new OnlineMapsDrawingLine(points, Color.green);
            // Draw the line route on the map.
            OnlineMaps.instance.AddDrawingElement(route);
        }
        else
        {
            Debug.Log("Find direction failed");
        }
        PopupManager.Instance.HideLoading();
    }