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); } }
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); } } }