Follow

Creating itinerary example

Introduction

Corresponding sample shows how to create itinerary file with start point, via point and finish point. Every coordinate needs to be multiplied by 100 000 to pass it to Sygic functions. API functions used in this sample are AddItinerary and SetRoute to load the itinerary and to start navigation with it.

C#

        NavigateToItinerary("Itinerary1");

        void NavigateToItinerary(string strName)
        {
            SError err;
            int flags = 0;
            bool bShowApplication = true;
            int maxTime = 0;

            SStopOffPoint[] points = new SStopOffPoint[3]; //an array of SStopOffPoint

            points[0] = new SStopOffPoint();        //initialization
            points[0].Location.lX = 1341555;        //GPS position, x-coordinate multiplied by 100 000
            points[0].Location.lY = 5252462;        //GPS position, y-coordinate multiplied by 100 000
            points[0].nPointType = 3;               //type 3 = start
            points[0].SetCaption("Starting point"); //caption

            points[1] = new SStopOffPoint();
            points[1].Location.lX = 1340753;
            points[1].Location.lY = 5252390;
            points[1].nPointType = 2;               // type 2 = finish point
            points[1].SetCaption("Finish point");

            points[2] = new SStopOffPoint();
            points[2].Location.lX = 1340780;
            points[2].Location.lY = 5251871;
            points[2].nPointType = 1;                //type = 1 for visible waypoint, 4 for invisible waypoint
            points[2].SetCaption("Via Point");

            int ret = CApplicationAPI.AddItinerary(out err, points, strName, maxTime); //API function for adding itinerary
            if (ret == 1)
                Debug.WriteLine("Itinerary created successfully.");

            ret = CApplicationAPI.SetRoute(out err, strName, flags, bShowApplication, maxTime);
            if (ret == 1)
                Debug.WriteLine("Routing finished successfully.");
        }

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments