public static List <int> DetectWrongWaypoints(string inPath) //inPath = name of itinerary (i.e. "default")
        {
            SStopOffPoint[] wp;
            List <int>      ids = new List <int>();

            CApplicationAPI.GetItineraryList(out _mySError, inPath, out wp, 0);

            if (wp != null)
            {
                for (int i = 0; i < wp.Length - 1; i++)
                {
                    SStopOffPoint[] tmpWp = new SStopOffPoint[2];
                    tmpWp[0]            = wp[i];
                    tmpWp[0].nPointType = 3;

                    tmpWp[1]            = wp[i + 1];
                    tmpWp[1].nPointType = 2;

                    CApplicationAPI.AddItinerary(out _mySError, tmpWp, inPath + "-" + i.ToString(), 0);
                    int result = CApplicationAPI.SetRoute(out _mySError, inPath + "-" + i.ToString(), 0, true, 0);
                    if (result != 1)
                    {
                        ids.Add(i + 1);
                    }
                }
            }
            return(ids);
        }
        public static void ItineraryGenerator(int inNumberOfItineraries, int inNumberOfWaypointsInItinerary, string inPrefix, int inXmin, int inXmax, int inYmin, int inYmax)
        {
            Random r = new Random();

            for (int j = 0; j < inNumberOfItineraries; j++)
            {
                SStopOffPoint[] wp = new SStopOffPoint[inNumberOfWaypointsInItinerary];
                for (int i = 0; i < inNumberOfWaypointsInItinerary; i++)
                {
                    wp[i]    = new SStopOffPoint();
                    wp[i].Id = (uint)i;
                    wp[i].SetCaption(i.ToString());
                    wp[i].nPointType = 1;
                    if (i == 0)
                    {
                        wp[i].nPointType = 3;
                    }
                    if (i == (inNumberOfWaypointsInItinerary - 1))
                    {
                        wp[i].nPointType = 2;
                    }
                    wp[i].Location.lX = inXmin + (int)r.Next(inXmax - inXmin);
                    wp[i].Location.lY = inYmin + (int)r.Next(inYmax - inYmin);
                }

                DriveHandler.AddItinerary(inPrefix + j.ToString(), wp);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds one item/stop to itinerary
 /// </summary>
 /// <param name="itineraryName_in">selects the choosen itinerary</param>
 /// <param name="SStopOffPoint_inout">one stop point</param>
 /// <param name="index_in">index where the new item should be put. if the index value is out of range, item is automatically added as the last one</param>
 public static void AddEntryToItinerary(string itineraryName_in, ref SStopOffPoint SStopOffPoint_inout, int index_in)
 {
     if (CApplicationAPI.AddEntryToItinerary(out mySerror, itineraryName_in, ref SStopOffPoint_inout, index_in, myTimeout) == 1)
     {
         NotifyMainWindow("New entries added to itinerary \"{0}\" successfully", itineraryName_in);
     }
     else
     {
         CheckSerror();
     }
 }
        public static void AddEntryToItinerary(string inStrItineraryName, int inLX, int inLY, int inNPointType, string inCaption, int inNIndex, uint inId)
        {
            SStopOffPoint point = new SStopOffPoint();

            point.Location.lX = inLX;
            point.Location.lY = inLY;
            point.nPointType  = inNPointType;
            point.SetCaption(inCaption);
            point.Id = inId;

            int ret = CApplicationAPI.AddEntryToItinerary(out _mySError, inStrItineraryName, ref point, inNIndex, 0);

            O("AddEntryToItinerary returns: " + ret.ToString());
        }
        public static void AddItineraryTest()
        {
            SStopOffPoint[] points = new SStopOffPoint[3];
            points[0] = new SStopOffPoint();
            points[1] = new SStopOffPoint();
            points[2] = new SStopOffPoint();

            points[0].SetCaption("1. waypoint: start");
            points[0].nPointType = 3; //3=start point
            points[1].SetCaption("2. waypoint: via point");
            points[1].nPointType = 1; //1=waypoint
            points[2].SetCaption("3. waypoint: finish");
            points[2].nPointType = 2; //2=finish pint
            int ret = CApplicationAPI.AddItinerary(out _mySError, points, "testing", 0);

            O("AddItinerary returns: " + ret.ToString());
        }
        public static void DevideItinerary(string inPath)
        {
            SStopOffPoint[] wp;
            CApplicationAPI.GetItineraryList(out _mySError, inPath, out wp, 0);

            if (wp != null)
            {
                for (int i = 0; i < wp.Length - 1; i++)
                {
                    SStopOffPoint[] tmpWp = new SStopOffPoint[2];
                    tmpWp[0]            = wp[i];
                    tmpWp[0].nPointType = 3;

                    tmpWp[1]            = wp[i + 1];
                    tmpWp[1].nPointType = 2;
                    O("Itinerary name: " + inPath + i.ToString() + ", " + tmpWp[1].GetAddress());
                    DriveHandler.AddItinerary(inPath + i.ToString(), tmpWp);
                }
            }
        }
        public static void AddItinerary(string inStrName)
        {
            SStopOffPoint[] points = new SStopOffPoint[2];

            points[0]             = new SStopOffPoint();
            points[0].Location.lX = 1712574;
            points[0].Location.lY = 4815034;
            points[0].nPointType  = 3;
            points[0].SetCaption("Starting point");

            points[1]             = new SStopOffPoint();
            points[1].Location.lX = 1714375;
            points[1].Location.lY = 4814980;
            points[1].nPointType  = 2;
            points[1].SetCaption("Finish point");

            int ret = CApplicationAPI.AddItinerary(out _mySError, points, inStrName, 0);

            O("AddItinerary returns: " + ret.ToString());
            if (ret == 1)
            {
                O("The itinerary containing two waypoints has been added into the navigation sucessfully.");
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Calls the GetItineraryList method which gives us an SStioOffPoint array
 /// </summary>
 /// <param name="itineraryName_in">the itinerary name user is interested in</param>
 /// <param name="SStoppofpoints_out">the waypoint array</param>
 public static void GetItineraryList(string itineraryName_in, out SStopOffPoint[] SStoppofpoints_out)
 {
     if (CApplicationAPI.GetItineraryList(out mySerror, itineraryName_in, out SStoppofpoints_out, myTimeout) == 1)
     {
         NotifyMainWindow("Got list of stops for itinerary \"{0}\"", itineraryName_in);
     }
     CheckSerror();
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Adds new itinerary
 /// </summary>
 /// <param name="Stoppoints_in">all stop points from start to destination via waypoints</param>
 /// <param name="itineraryName_in">the itinerary's name</param>
 public static void AddItinerary(SStopOffPoint[] Stoppoints_in, string itineraryName_in)
 {
     if (CApplicationAPI.AddItinerary(out mySerror, Stoppoints_in, itineraryName_in, myTimeout) == 1)
     {
         NotifyMainWindow("Itinerary \"{0}\" was created successfully", itineraryName_in);
     }
     CheckSerror();
 }