java - Create a itenerary for Sygic with PhoneGap (iOS) -
researching earlier posts know trying create predefined route sygic via it's custom url scheme. basics work. added command in basic phonegap:
<a href="com.sygic.aura://coordinate|5.6784149|52.8759607|drive"> this opens app , starts route calculation. yeah!! step 1 completed ;)
now want add via point. sygic site gives me 2 options, how implement these inside phonegap? appreciated
1: 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 100 000 points[0].location.ly = 5252462; //gps position, y-coordinate multiplied 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 visible waypoint, 4 invisible waypoint points[2].setcaption("via point"); int ret = capplicationapi.additinerary(out err, points, strname, maxtime); //api function 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."); } or 2: java
import com.sygic.sdk.remoteapi.api; import com.sygic.sdk.remoteapi.apiitinerary; import com.sygic.sdk.remoteapi.exception.generalexception; import com.sygic.sdk.remoteapi.model.stopoffpoint; ... try { string stritineraryname = "itinerary1"; //itinerary name int maxtime = 0; int flags = 0; arraylist<stopoffpoint> pointarr = new arraylist<stopoffpoint>(); pointarr.add(new stopoffpoint(false, false, stopoffpoint.pointtype.start, 1710726, 4814623, -1, 0, "", "ba", "")); pointarr.add(new stopoffpoint(false, false, stopoffpoint.pointtype.viapoint, 1739716, 4821671, -1, 0, "", "senec", "")); pointarr.add(new stopoffpoint(false, false, stopoffpoint.pointtype.finish, 1759511, 4837351, -1, 0, "", "trnava", "")); apiitinerary.additinerary(pointarr, stritineraryname, maxtime); apiitinerary.setroute(stritineraryname, flags, maxtime); } catch (generalexception e) { log.e("itinerary", "error code:"+ e.getcode()); }
Comments
Post a Comment