RouteInfo ri = new RouteInfo();
ObjectsHelper[] routeStopDependencyObjects = new ObjectsHelper[3];
routeStopDependencyObjects[0] = cr.new ObjectsHelper();
routeStopDependencyObjects[0].object = new Point();
routeStopDependencyObjects[0].alias = "point";
routeStopDependencyObjects[1] = cr.new ObjectsHelper();
routeStopDependencyObjects[1].object = new RouteStop();
routeStopDependencyObjects[1].alias = "RouteStop";
routeStopDependencyObjects[2] = cr.new ObjectsHelper();
routeStopDependencyObjects[2].object = new RouteStop[0];
routeStopDependencyObjects[2].alias = "rs";
ObjectsHelper[] routeOptionsDependencyObjects = new ObjectsHelper[7];
routeOptionsDependencyObjects[0] = cr.new ObjectsHelper();
routeOptionsDependencyObjects[0].object = new RouteDetails();
routeOptionsDependencyObjects[0].alias = "routeDetails";
routeOptionsDependencyObjects[1] = cr.new ObjectsHelper();
routeOptionsDependencyObjects[1].object = new Vehicle();
routeOptionsDependencyObjects[1].alias = "vehicle";
routeOptionsDependencyObjects[2] = cr.new ObjectsHelper();
routeOptionsDependencyObjects[2].object = new RouteLine[0];
routeOptionsDependencyObjects[2].alias = "routeLine";
routeOptionsDependencyObjects[3] = cr.new ObjectsHelper();
routeOptionsDependencyObjects[3].object = new RouteLine();
routeOptionsDependencyObjects[3].alias = "RouteLine";
routeOptionsDependencyObjects[4] = cr.new ObjectsHelper();
routeOptionsDependencyObjects[4].object = new Point[0];
routeOptionsDependencyObjects[4].alias = "barrierPoints";
routeOptionsDependencyObjects[5] = cr.new ObjectsHelper();
routeOptionsDependencyObjects[5].object = new String[0];
routeOptionsDependencyObjects[5].alias = "barriersList";
routeOptionsDependencyObjects[6] = cr.new ObjectsHelper();
routeOptionsDependencyObjects[6].object = new String[0];
routeOptionsDependencyObjects[6].alias = "poiRoute";
RouteStop[] rs = (RouteStop[]) cr.getObjectFromXML(ph.XMLFile, "rs", RouteStop.class, routeStopDependencyObjects);
RouteOptions ro = (RouteOptions) cr.getObjectFromXML(ph.XMLFile, "ro", RouteOptions.class, routeOptionsDependencyObjects);
try
{
ri = cRoute.getRoute(rs, ro, id_licenca);
if (fullCoords.equals("true")){
ri.setCoords(cRoute.getRouteFullCoords(ri.getRouteId()));
}
}
catch (Exception e)
{
e.printStackTrace();
}
response.setContentType("text/xml");
response.setCharacterEncoding("UTF-8");
ObjectsHelper[] dependencyObjects = new ObjectsHelper[6];
dependencyObjects[0] = cr.new ObjectsHelper();
dependencyObjects[0].object = new MapInfo();
dependencyObjects[0].alias = "MapInfo";
dependencyObjects[1] = cr.new ObjectsHelper();
dependencyObjects[1].object = new SegmentDescription();
dependencyObjects[1].alias = "SegmentDescription";
dependencyObjects[2] = cr.new ObjectsHelper();
dependencyObjects[2].object = new RouteTotals();
dependencyObjects[2].alias = "routeTotals";
dependencyObjects[3] = cr.new ObjectsHelper();
dependencyObjects[3].object = new RouteSummary();
dependencyObjects[3].alias = "routeSummary";
dependencyObjects[4] = cr.new ObjectsHelper();
dependencyObjects[4].object = new RoadType();
dependencyObjects[4].alias = "roadType";
dependencyObjects[5] = cr.new ObjectsHelper();
dependencyObjects[5].object = new RouteInfo();
dependencyObjects[5].alias = "RouteInfo";
response.getWriter().write("<?xml version='1.0' encoding='UTF-8'?>\n" + cr.getXMLFromObject(ri, dependencyObjects) + "");
}
if (ph.fields[0].equals("setRouteFence"))
{
String routeId = cr.getFieldFromXML(ph.XMLFile, "routeId");
double meters = Double.parseDouble(cr.getFieldFromXML(ph.XMLFile, "meters"));
boolean generate = true;
try
{
generate = cRoute.setRouteFence(routeId, meters, id_licenca);
}
catch (Exception e)
{
generate = false;
e.printStackTrace();
}
response.getWriter().write("<?xml version='1.0' encoding='UTF-8'?>\n<setRouteFence><FenceGenerate>" + generate + "</FenceGenerate></setRouteFence>");
}
if (ph.fields[0].equals("checkFence"))
{
boolean dentro = false;
String routeId = cr.getFieldFromXML(ph.XMLFile, "routeId");
Point point = (Point) cr.getObjectFromXML(ph.XMLFile, "point", Point.class, null);
try
{
dentro = cRoute.checkFence(routeId, point, id_licenca);
}
catch (Exception e)