return coordsRet;
}
public RouteInfo getRoute(RouteStop[] rs, RouteOptions ro, int idLicenca) throws Exception {
iniDate = System.currentTimeMillis();
RouteProximityInfo rpi = new RouteProximityInfo();
RouteInfo ri = new RouteInfo();
try {
Validation("getRoute", idLicenca, rs, ro);
RouteProximityOptions routeOptions = new RouteProximityOptions();
routeOptions.setLanguage(ro.getLanguage());
routeOptions.setRouteDetails(new RouteDetails());
routeOptions.getRouteDetails().setDescriptionType(ro.getRouteDetails().getDescriptionType());
routeOptions.getRouteDetails().setOptimizeRoute(ro.getRouteDetails().isOptimizeRoute());
routeOptions.getRouteDetails().setPoiRoute(ro.getRouteDetails().getPoiRoute());
routeOptions.getRouteDetails().setRouteType(ro.getRouteDetails().getRouteType());
if (ro.getRouteLine() != null) {
routeOptions.setRouteLine(new RouteLine[ro.getRouteLine().length]);
for (int x = 0; x < ro.getRouteLine().length; x++) {
routeOptions.getRouteLine()[x] = new RouteLine();
routeOptions.getRouteLine()[x].setRGB(ro.getRouteLine()[x].getRGB());
routeOptions.getRouteLine()[x].setTransparency(ro.getRouteLine()[x].getTransparency());
routeOptions.getRouteLine()[x].setWidth(ro.getRouteLine()[x].getWidth());
}
}
routeOptions.setVehicle(new Vehicle());
routeOptions.getVehicle().setAverageConsumption(ro.getVehicle().getAverageConsumption());
routeOptions.getVehicle().setAverageSpeed(ro.getVehicle().getAverageSpeed());
routeOptions.getVehicle().setFuelPrice(ro.getVehicle().getFuelPrice());
routeOptions.getVehicle().setTankCapacity(ro.getVehicle().getTankCapacity());
routeOptions.getVehicle().setTollFeeCat(ro.getVehicle().getTollFeeCat());
CommonRoute r = new CommonRoute(_maquina, _server, _port, _output, _dns, _dataSource, _dataSourceMapa);
rpi = r.getRoute(idLicenca, rs, routeOptions, CommonRoute._getRoute);
ri.setMapInfo(new MapInfo());
ri.getMapInfo().setExtent(new Extent());
ri.getMapInfo().getExtent().setXMax(rpi.getMapInfo().getExtent().getXMax());
ri.getMapInfo().getExtent().setXMin(rpi.getMapInfo().getExtent().getXMin());
ri.getMapInfo().getExtent().setYMax(rpi.getMapInfo().getExtent().getYMax());
ri.getMapInfo().getExtent().setYMin(rpi.getMapInfo().getExtent().getYMin());
ri.getMapInfo().setUrl(rpi.getMapInfo().getUrl());
ri.setRoadType(new RoadType());
ri.setRoadType(rpi.getRoadType());
ri.setRouteId(rpi.getRouteId());
if (rpi.getRouteSummary() != null) {
ri.setRouteSummary(new RouteSummary[rpi.getRouteSummary().length]);
for (int x = 0; x < rpi.getRouteSummary().length; x++) {
ri.getRouteSummary()[x] = new RouteSummary();
ri.getRouteSummary()[x].setDescription(rpi.getRouteSummary()[x].getDescription());
ri.getRouteSummary()[x].setDistance(rpi.getRouteSummary()[x].getDistance());
ri.getRouteSummary()[x].setPoint(new Point());
ri.getRouteSummary()[x].setPoint(rpi.getRouteSummary()[x].getPoint());
}
}
ri.setRouteTotals(new RouteTotals());
ri.setRouteTotals(rpi.getRouteTotals());
double totalTime = 0;
if (rpi.getSegDescription() != null) {
ri.setSegDescription(new SegmentDescription[rpi.getSegDescription().length]);
for (int x = 0; x < rpi.getSegDescription().length; x++) {
ri.getSegDescription()[x] = new SegmentDescription();
ri.getSegDescription()[x].setCity(new City());
ri.getSegDescription()[x].getCity().setName(rpi.getSegDescription()[x].getCity().getName());
ri.getSegDescription()[x].getCity().setState(rpi.getSegDescription()[x].getCity().getState());
ri.getSegDescription()[x].setCommand(rpi.getSegDescription()[x].getCommand());
ri.getSegDescription()[x].setCumulativeDistance(rpi.getSegDescription()[x].getCumulativeDistance());
ri.getSegDescription()[x].setDescription(rpi.getSegDescription()[x].getDescription());
ri.getSegDescription()[x].setDistance(rpi.getSegDescription()[x].getDistance());
ri.getSegDescription()[x].setPoint(new Point());
ri.getSegDescription()[x].getPoint().setX(rpi.getSegDescription()[x].getPoint().getX());
ri.getSegDescription()[x].getPoint().setY(rpi.getSegDescription()[x].getPoint().getY());
ri.getSegDescription()[x].setPoiRoute(rpi.getSegDescription()[x].getPoiRoute());
ri.getSegDescription()[x].setTime(rpi.getSegDescription()[x].getTime());
if (!rpi.getSegDescription()[x].getTime().equals(""))
totalTime += Double.parseDouble(rpi.getSegDescription()[x].getTime().substring(0,rpi.getSegDescription()[x].getTime().indexOf(' ')));
// String teste="";
// if (!ri.getSegDescription()[x].getFullCoords().equals(""))
// teste = convertFromDecarta(7, ri.getSegDescription()[x].getFullCoords());
int z = 0;
if (rpi.getSegDescription()[x].getPoiRouteDetails() != null) {
ri.getSegDescription()[x].setPoiRouteDetails(new POIDetails[rpi.getSegDescription()[x].getPoiRouteDetails().length]);
for (z = 0; z < rpi.getSegDescription()[x].getPoiRouteDetails().length; z++) {
ri.getSegDescription()[x].getPoiRouteDetails()[z] = new POIDetails();
ri.getSegDescription()[x].getPoiRouteDetails()[z].setAddressInfo(rpi.getSegDescription()[x].getPoiRouteDetails()[z]
.getAddressInfo());
ri.getSegDescription()[x].getPoiRouteDetails()[z].setClientID(rpi.getSegDescription()[x].getPoiRouteDetails()[z]
.getClientID());
ri.getSegDescription()[x].getPoiRouteDetails()[z].setName(rpi.getSegDescription()[x].getPoiRouteDetails()[z].getName());
ri.getSegDescription()[x].getPoiRouteDetails()[z].setPoint(new Point());
ri.getSegDescription()[x].getPoiRouteDetails()[z].getPoint().setX(
rpi.getSegDescription()[x].getPoiRouteDetails()[z].getPoint().getX());
ri.getSegDescription()[x].getPoiRouteDetails()[z].getPoint().setY(
rpi.getSegDescription()[x].getPoiRouteDetails()[z].getPoint().getY());
ri.getSegDescription()[x].getPoiRouteDetails()[z].setSource(rpi.getSegDescription()[x].getPoiRouteDetails()[z]
.getSource());
}
}
ri.getSegDescription()[x].setRoadType(rpi.getSegDescription()[x].getRoadType());
ri.getSegDescription()[x].setTollFee(rpi.getSegDescription()[x].getTollFee());
if (!Functions.IsNullOrEmpty(rpi.getSegDescription()[x].getTollFeeDetails().getAddress())) {
ri.getSegDescription()[x].setTollFeeDetails(new TollFeeDetails());
ri.getSegDescription()[x].getTollFeeDetails().setAddress(rpi.getSegDescription()[x].getTollFeeDetails().getAddress());
ri.getSegDescription()[x].getTollFeeDetails().setConcession(rpi.getSegDescription()[x].getTollFeeDetails().getConcession());
ri.getSegDescription()[x].getTollFeeDetails().setDirection(rpi.getSegDescription()[x].getTollFeeDetails().getDirection());
ri.getSegDescription()[x].getTollFeeDetails().setName(rpi.getSegDescription()[x].getTollFeeDetails().getName());
ri.getSegDescription()[x].getTollFeeDetails().setPhone(rpi.getSegDescription()[x].getTollFeeDetails().getPhone());
ri.getSegDescription()[x].getTollFeeDetails().setPrice(rpi.getSegDescription()[x].getTollFeeDetails().getPrice());
ri.getSegDescription()[x].getTollFeeDetails().setPricePerAxle(
rpi.getSegDescription()[x].getTollFeeDetails().getPricePerAxle());
ri.getSegDescription()[x].getTollFeeDetails().setState(rpi.getSegDescription()[x].getTollFeeDetails().getState());
}
}
}
ri.getRouteTotals().setTotalTime(CommonRoute.getTotalTime(totalTime));
Functions.gravarLogUnique(idLicenca, CommonRoute._getRoute, rs.length, iniDate, 0);