Package com.lbslocal.cc.objects.v3.route

Examples of com.lbslocal.cc.objects.v3.route.RouteTotals


                if (ro.getRouteDetails().getRouteType() == 12) {
                  String response = tcpDecarta.Send("PNB0|%" + part[z] + "%RAD=M2|%M=1000%LL%S2%S1%DS=telefonica_rotas||");
                  String[] partMasterPOI = response.split(Pattern.quote("|"));

                  for (int w = 0; w < partMasterPOI.length; w++) {
                    POIDetails poi = new POIDetails();

                    if (partMasterPOI[w].indexOf("S1") >= 0) {
                      try {
                        String[] p = partMasterPOI[w].replace("%", "").replace("S2", "").replace("S1", "").replace("LL", "")
                            .split(Pattern.quote("="));
                        int ind = p[1].lastIndexOf("\\");
                        poi.setClientID(p[2].substring(0, p[2].indexOf("\\")) + "|" + p[1].substring(ind).replace("\\", ""));
                        poi.getPoint().setX(Double.parseDouble(p[3].split(Pattern.quote(","))[1]));
                        poi.getPoint().setY(Double.parseDouble(p[3].split(Pattern.quote(","))[0]));

                        poiList.add(poi);
                        segAux.seg.setPoiRoute("S");
                        segAux.seg.setPoiRouteDetails((POIDetails[]) poiList.toArray());
                      } catch (Exception ex) {
                      }
                    }
                  }
                } else {
                  if (ro.getRouteDetails().getRouteType() == 13) {
                    String response = tcpDecarta.Send("PNB0|%" + part[z] + "%RAD=M2|%M=1000%LL%S2%S1%DS=telefonica_pf||");
                    String[] partMasterPOI = response.split(Pattern.quote("|"));

                    for (int w = 0; w < partMasterPOI.length; w++) {
                      POIDetails poi = new POIDetails();

                      if (partMasterPOI[w].indexOf("S1") >= 0) {
                        try {
                          String[] p = partMasterPOI[w].replace("%", "").replace("S2", "").replace("S1", "")
                              .replace("LL", "").split(Pattern.quote("="));
                          int ind = p[1].lastIndexOf("\\");
                          poi.setClientID(p[2].substring(0, p[2].indexOf("\\")) + "|"
                              + p[1].substring(ind).replace("\\", ""));
                          poi.getPoint().setX(Double.parseDouble(p[3].split(Pattern.quote(","))[1]));
                          poi.getPoint().setY(Double.parseDouble(p[3].split(Pattern.quote(","))[0]));

                          poiList.add(poi);
                          segAux.seg.setPoiRoute("S");
                          segAux.seg.setPoiRouteDetails((POIDetails[]) poiList.toArray());
                        } catch (Exception ex) {
                        }
                      }
                    }
                  } else {
                    String response = tcpDecarta.Send("PNB0|%" + part[z] + "%RAD=m" + ro.getRadius() + "|%M=1000%LL%S2%S1%DS="
                        + clientDataSource + "||");
                    String[] partMasterPOI = response.split(Pattern.quote("|"));

                    for (int w = 0; w < partMasterPOI.length; w++) {
                      POIDetails poi = new POIDetails();

                      if (partMasterPOI[w].indexOf("S1") >= 0) {
                        try {
                          String[] p = partMasterPOI[w].replace("%", "").replace("S2", "").replace("S1", "")
                              .replace("LL", "").split(Pattern.quote("="));
                          int ind = p[1].lastIndexOf("\\");

                          try {
                            poi.setClientID(p[2].substring(0, p[2].indexOf("\\")) + "|"
                                + p[1].substring(ind).replace("\\", ""));
                          } catch (Exception ex) {
                            poi.setClientID(p[2]);
                            try {
                              poi.setSource(p[1].substring(ind + 1));
                            } catch (Exception ex1) {
                            }
                            ;
                          }

                          poi.getPoint().setX(Double.parseDouble(p[3].split(Pattern.quote(","))[1]));
                          poi.getPoint().setY(Double.parseDouble(p[3].split(Pattern.quote(","))[0]));

                          poiList.add(poi);
                          segAux.seg.setPoiRoute("S");
                          segAux.seg.setPoiRouteDetails((POIDetails[]) poiList.toArray());
                        } catch (Exception ex) {
                        }
                      }
                    }
                  }
                }
              }
            }
          }

          if (Functions.IsNullOrEmpty(segAux.seg.getCommand())) {
            if (rs.length > 2) {
              if (paradas < rs.length - 1) {
                if (ro.getRouteDetails().isOptimizeRoute()) {
                  if (rs.length >= 10) {
                    segAux.seg.setCommand(comandoContinue);

                    SegAux seg = new SegAux();
                    seg.seg = segAux.seg;
                    seg.seg.setDescription(rs[paradas].getDescription());
                    seg.seg.setCommand("Parada " + paradas);
                    seg.seg.setDistance(0);
                    seg.seg.getPoint().setX(rs[paradas].getPoint().getX());
                    seg.seg.getPoint().setY(rs[paradas].getPoint().getY());
                    seg.vr = "";
                    seg.vrPosition = 0;

                    paradas++;
                    segmentList.add(segAux);
                    segmentList.add(seg);
                  } else {
                    segAux.seg.setCommand(comandoContinue);

                    SegAux seg = new SegAux();
                    seg.seg.setCommand(comandoContinue);

                    for (int z = 0; z < rStopSelect.length; z++) {
                      if (String.format("0.00000", rStopSelect[z].getPoint().getX()).equals(
                          String.format("0.00000", segAux.seg.getPoint().getX()))
                          && String.format("0.00000", segAux.seg.getPoint().getY()).equals(
                              String.format("0.00000", rStopSelect[z].getPoint().getY()))) {
                        seg.seg = segAux.seg;
                        seg.seg.setDescription(rStopSelect[z].getDescription());
                        seg.seg.setCommand("Parada " + paradas);
                        seg.seg.setDistance(0);
                        seg.seg.getPoint().setX(rStopSelect[z].getPoint().getX());
                        seg.seg.getPoint().setY(rStopSelect[z].getPoint().getY());
                        seg.vr = "";
                        seg.vrPosition = 0;
                        rStopSelect = removeRouteStop(rStopSelect, z);
                        break;
                      }
                    }

                    if (seg.seg.getCommand().toLowerCase().indexOf("parada") < 0) {
                      List<RouteSummary> rsList = new ArrayList<RouteSummary>();

                      for (int z = 0; z < rStopSelect.length; z++) {
                        RouteSummary r = new RouteSummary();
                        r.setDistance(Math.sqrt(Math
                            .pow((rStopSelect[z].getPoint().getX() - segAux.seg.getPoint().getX()), 2)
                            + Math.pow((rStopSelect[z].getPoint().getY() - segAux.seg.getPoint().getY()), 2)));
                        r.setDescription(String.valueOf(z));

                        rsList.add(r);
                      }

                      Collections.sort(rsList, COMPARATOR);

                      /*
                       * rsList.Sort(delegate(RouteSummary
                       * p1, RouteSummary p2) { return
                       * (Double
                       * .parseDouble(p1.distance).
                       * CompareTo (
                       * Double.parseDouble(p2.distance)))
                       * ; });
                       */

                      seg.seg = segAux.seg;
                      seg.seg.setDescription(rStopSelect[Integer.parseInt(rsList.get(0).getDescription())].getDescription());
                      seg.seg.setCommand("Parada " + paradas);
                      seg.seg.setDistance(0);
                      seg.seg.getPoint().setX(rStopSelect[Integer.parseInt(rsList.get(0).getDescription())].getPoint().getX());
                      seg.seg.getPoint().setY(rStopSelect[Integer.parseInt(rsList.get(0).getDescription())].getPoint().getY());
                      seg.vr = "";
                      seg.vrPosition = 0;
                      rStopSelect = removeRouteStop(rStopSelect, Integer.parseInt(rsList.get(0).getDescription()));
                    }

                    paradas++;
                    segmentList.add(segAux);
                    segmentList.add(seg);
                  }
                } else {
                  segAux.seg.setCommand(comandoContinue);

                  SegAux seg = new SegAux();
                  seg.seg = segAux.seg;
                  seg.seg.setDescription(rs[paradas].getDescription());
                  seg.seg.setCommand("Parada " + paradas);
                  seg.seg.setDistance(0);
                  seg.seg.getPoint().setX(rs[paradas].getPoint().getX());
                  seg.seg.getPoint().setY(rs[paradas].getPoint().getY());
                  seg.vr = "";
                  seg.vrPosition = 0;

                  paradas++;

                  segmentList.add(segAux);
                  segmentList.add(seg);
                }
              } else {
                segAux.seg.setCommand(comandoContinue);

                if (Functions.IsNullOrEmpty(segAux.seg.getCity().getName()) && segmentList.size() > 0)
                  segAux.seg.setCity(segmentList.get(segmentList.size() - 1).seg.getCity());

                segmentList.add(segAux);
              }
            } else {
              segAux.seg.setCommand(comandoContinue);

              if (Functions.IsNullOrEmpty(segAux.seg.getCity().getName()) && segmentList.size() > 0)
                segAux.seg.setCity(segmentList.get(segmentList.size() - 1).seg.getCity());

              segmentList.add(segAux);
            }
          } else {
            if (Functions.IsNullOrEmpty(segAux.seg.getCity().getName()) && segmentList.size() > 0)
              segAux.seg.setCity(segmentList.get(segmentList.size() - 1).seg.getCity());

            segmentList.add(segAux);
          }
        }
      }

      SegAux segFim = new SegAux();
      segFim.seg = new SegmentDescription();
      segFim.seg.setDistance(0);
      segFim.seg.setCity(new City());
      segFim.seg.getCity().setName("");
      segFim.seg.getCity().setState("");
      segFim.seg.setCumulativeDistance(segmentList.get(segmentList.size() - 1).seg.getCumulativeDistance());
      segFim.segPosition = segmentList.size() + 1;
      segFim.seg.setCommand(comandoFimDaRota);
      segFim.seg.setDescription(rs[rs.length - 1].getDescription());
      segFim.seg.setPoint(new Point());
      segFim.seg.getPoint().setX(Functions.formatDouble(rs[rs.length - 1].getPoint().getX(), "0.00000"));
      segFim.seg.getPoint().setY(Functions.formatDouble(rs[rs.length - 1].getPoint().getY(), "0.00000"));
      segmentList.add(segFim);

      ret = new SegmentDescription[segmentList.size()];

      for (int cont = 0; cont < segmentList.size(); cont++)
        ret[cont] = segmentList.get(cont).seg;

      cumulativeDistance = 0;
      for (int x = 0; x < ret.length; x++) {
        cumulativeDistance += ret[x].getDistance();
        ret[x].setCumulativeDistance(cumulativeDistance);
      }

      ret = setToolFeeDB(ret, pedagioList, tollFeeCat);

      if (ro.getRouteDetails().getPoiRoute() != null)
        ret = setPoiRouteDB(ret, ro.getRouteDetails().getPoiRoute());

      List<SegmentDescription> segList = new ArrayList<SegmentDescription>();
      segList.add(ret[0]);
      // Verificar aqui
      if (ro.getRouteDetails().getDescriptionType() == 1) {
        double totalTime = 0;
       
//        totalTime = 0;
//        for (int x = 0; x < ret.length; x++) {
//            if (!ret[x].getTime().equals(""))
//              totalTime += Double.parseDouble(ret[x].getTime().substring(0,ret[x].getTime().indexOf(' ')));
//        }
       
        for (int x = 0; x < ret.length; x++) {
          if (    ret[x].getDescription().toUpperCase().indexOf("ROD.") >= 0 ||
              ret[x].getDescription().toUpperCase().indexOf("ESTR.") >= 0
              || !Functions.IsNullOrEmpty(ret[x].getTollFee()) || ret[x].getCommand().toLowerCase().contains("parada")
              || ret[x].getCommand().toLowerCase().contains("fim da")) {
            SegmentDescription seg = new SegmentDescription();
            if (!ret[x].getTime().equals(""))
              totalTime += Double.parseDouble(ret[x].getTime().substring(0,ret[x].getTime().indexOf(' ')));
            seg = ret[x];
            seg.setTime(totalTime + " sec");
            segList.add(seg);
            totalTime = 0;
          }else
            if (!ret[x].getTime().equals(""))
              totalTime += Double.parseDouble(ret[x].getTime().substring(0,ret[x].getTime().indexOf(' ')));

        }

        segList.add(ret[ret.length - 1]);

        ret = new SegmentDescription[segList.size()];
        ret = segList.toArray(new SegmentDescription[0]);

        for (int x = 1; x < ret.length - 2; x++) {
          if (!(ret[x].getCommand().toLowerCase().indexOf("parada") >= 0))
            ret[x].setCommand("Continue");

          if ((ret[x].getCommand().toLowerCase().indexOf("parada") >= 0))
            ret[x].setRoadType(ret[x - 1].getRoadType());
        }

        int qtdSeg = ret.length;
        SegmentDescription[] retAux = new SegmentDescription[qtdSeg];
        retAux = ret;

//        totalTime = 0;
//        for (int x = 0; x < ret.length; x++) {
//            if (!ret[x].getTime().equals(""))
//              totalTime += Double.parseDouble(ret[x].getTime().substring(0,ret[x].getTime().indexOf(' ')));
//        }
       
        Object[] obj = removeDuplicates(12, qtdSeg, retAux, ret, ro);

        ret = new SegmentDescription[0];
        ret = (SegmentDescription[]) obj[1];
//        totalTime = 0;
//        for (int x = 0; x < ret.length; x++) {
//            if (!ret[x].getTime().equals(""))
//              totalTime += Double.parseDouble(ret[x].getTime().substring(0,ret[x].getTime().indexOf(' ')));
//        }
       
        qtdSeg = (Integer) obj[0] + 1;
        ret = new SegmentDescription[0];
        ret = (SegmentDescription[]) obj[1];

        retAux = new SegmentDescription[qtdSeg];

        // String lastCity = "";

        for (int x = 0; x < qtdSeg; x++) {
          retAux[x] = new SegmentDescription();
          retAux[x].setCity(new City());

          if (x == 0) {
            // if (!Functions.IsNullOrEmpty(ret[x +
            // 1].getCity().getName()))
            // lastCity = ret[x + 1].getCity().getName();

            retAux[x].getCity().setName(ret[x + 1].getCity().getName());
            retAux[x].getCity().setState(ret[x + 1].getCity().getState());
          }

          retAux[x].getCity().setName(ret[x].getCity().getName());
          retAux[x].getCity().setState(ret[x].getCity().getState());

          retAux[x].setCommand(ret[x].getCommand());
          retAux[x].setCumulativeDistance(ret[x].getCumulativeDistance());

          retAux[x].setTime(ret[x].getTime());
         
          if (ret[x].getDescription().indexOf("passando") > 0)
            retAux[x].setDescription(ret[x].getDescription().substring(0, ret[x].getDescription().indexOf("passando") - 1));
          else
            retAux[x].setDescription(ret[x].getDescription());

          retAux[x].setDistance(ret[x].getDistance());

          retAux[x].setPoint(new Point());
          retAux[x].getPoint().setX(ret[x].getPoint().getX());
          retAux[x].getPoint().setY(ret[x].getPoint().getY());
          retAux[x].setRoadType(ret[x].getRoadType());

          retAux[x].setTollFee(ret[x].getTollFee());
          retAux[x].setTollFeeDetails(new TollFeeDetails());
          retAux[x].getTollFeeDetails().setAddress(ret[x].getTollFeeDetails().getAddress());
          retAux[x].getTollFeeDetails().setConcession(ret[x].getTollFeeDetails().getConcession());
          retAux[x].getTollFeeDetails().setDirection(ret[x].getTollFeeDetails().getDirection());
          retAux[x].getTollFeeDetails().setName(ret[x].getTollFeeDetails().getName());
          retAux[x].getTollFeeDetails().setPhone(ret[x].getTollFeeDetails().getPhone());
          retAux[x].getTollFeeDetails().setPrice(ret[x].getTollFeeDetails().getPrice());
          retAux[x].getTollFeeDetails().setPricePerAxle(ret[x].getTollFeeDetails().getPricePerAxle());
          retAux[x].getTollFeeDetails().setState(ret[x].getTollFeeDetails().getState());

          retAux[x].setPoiRoute(ret[x].getPoiRoute());

          if (ret[x].getPoiRouteDetails() != null) {
            retAux[x].setPoiRouteDetails(new POIDetails[ret[x].getPoiRouteDetails().length]);

            for (int z = 0; z < ret[x].getPoiRouteDetails().length; z++) {
              retAux[x].getPoiRouteDetails()[z] = new POIDetails();
              retAux[x].getPoiRouteDetails()[z].setAddressInfo(ret[x].getPoiRouteDetails()[z].getAddressInfo());

              retAux[x].getPoiRouteDetails()[z].setClientID(ret[x].getPoiRouteDetails()[z].getClientID());
              retAux[x].getPoiRouteDetails()[z].setName(ret[x].getPoiRouteDetails()[z].getName());
              retAux[x].getPoiRouteDetails()[z].setPoint(new Point());
              retAux[x].getPoiRouteDetails()[z].getPoint().setX(ret[x].getPoiRouteDetails()[z].getPoint().getX());
              retAux[x].getPoiRouteDetails()[z].getPoint().setY(ret[x].getPoiRouteDetails()[z].getPoint().getY());
              retAux[x].getPoiRouteDetails()[z].setSource(ret[x].getPoiRouteDetails()[z].getSource());
            }
          }
        }

        ret = new SegmentDescription[qtdSeg];
        ret = retAux;

        ret[0].setRoadType("O");
        ret[ret.length - 1].setRoadType("D");
      }

      if (ro.getRouteDetails().getDescriptionType() == 2) {

      }

      if (ro.getRouteDetails().getDescriptionType() == 10) {
        for (int x = 0; x < ret.length; x++) {
          ret[x].setDescription(ret[x].getDescription().replace(" Pista Lateral", "").replace(" - Pista Lateral", "")
              .replace("Ac. P/ ", "").replace("Rod ", "Rod. ").replace(" -", ""));
        }

        SegmentDescription[] _segmentDescriptionAux = ret;
        SegmentDescription[] _segmentDescription = ret;
        int qtdSeg = ret.length;

        Object[] obj = removeDuplicates(1, qtdSeg, _segmentDescriptionAux, _segmentDescription, ro);

        qtdSeg = (Integer) obj[0] + 1;
        _segmentDescription = new SegmentDescription[0];
        _segmentDescription = (SegmentDescription[]) obj[1];

        _segmentDescriptionAux = new SegmentDescription[qtdSeg];

        for (int x = 0; x < qtdSeg; x++) {
          _segmentDescriptionAux[x] = new SegmentDescription();
          _segmentDescriptionAux[x].setCity(new City());
          _segmentDescriptionAux[x].getCity().setName(_segmentDescription[x].getCity().getName());
          _segmentDescriptionAux[x].getCity().setState(_segmentDescription[x].getCity().getState());

          _segmentDescriptionAux[x].setCommand(_segmentDescription[x].getCommand());
          _segmentDescriptionAux[x].setCumulativeDistance(_segmentDescription[x].getCumulativeDistance());
          _segmentDescriptionAux[x].setDescription(_segmentDescription[x].getDescription());
          _segmentDescriptionAux[x].setDistance(_segmentDescription[x].getDistance());

          _segmentDescriptionAux[x].setPoint(new Point());
          _segmentDescriptionAux[x].getPoint().setX(_segmentDescription[x].getPoint().getX());
          _segmentDescriptionAux[x].getPoint().setY(_segmentDescription[x].getPoint().getY());
          _segmentDescriptionAux[x].setRoadType(_segmentDescription[x].getRoadType());

          _segmentDescriptionAux[x].setTollFee(_segmentDescription[x].getTollFee());
          _segmentDescriptionAux[x].setTollFeeDetails(new TollFeeDetails());
          _segmentDescriptionAux[x].getTollFeeDetails().setAddress(_segmentDescription[x].getTollFeeDetails().getAddress());
          _segmentDescriptionAux[x].getTollFeeDetails().setConcession(_segmentDescription[x].getTollFeeDetails().getConcession());
          _segmentDescriptionAux[x].getTollFeeDetails().setDirection(_segmentDescription[x].getTollFeeDetails().getDirection());
          _segmentDescriptionAux[x].getTollFeeDetails().setName(_segmentDescription[x].getTollFeeDetails().getName());
          _segmentDescriptionAux[x].getTollFeeDetails().setPhone(_segmentDescription[x].getTollFeeDetails().getPhone());
          _segmentDescriptionAux[x].getTollFeeDetails().setPrice(_segmentDescription[x].getTollFeeDetails().getPrice());
          _segmentDescriptionAux[x].getTollFeeDetails().setPricePerAxle(_segmentDescription[x].getTollFeeDetails().getPricePerAxle());
          _segmentDescriptionAux[x].getTollFeeDetails().setState(_segmentDescription[x].getTollFeeDetails().getState());

          _segmentDescriptionAux[x].setPoiRoute(_segmentDescription[x].getPoiRoute());

          if (_segmentDescription[x].getPoiRouteDetails() != null) {
            _segmentDescriptionAux[x].setPoiRouteDetails(new POIDetails[_segmentDescription[x].getPoiRouteDetails().length]);

            for (int z = 0; z < _segmentDescription[x].getPoiRouteDetails().length; z++) {
              _segmentDescriptionAux[x].getPoiRouteDetails()[z] = new POIDetails();
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setAddressInfo(_segmentDescription[x].getPoiRouteDetails()[z]
                  .getAddressInfo());

              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setClientID(_segmentDescription[x].getPoiRouteDetails()[z]
                  .getClientID());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setName(_segmentDescription[x].getPoiRouteDetails()[z].getName());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setPoint(new Point());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].getPoint().setX(
                  _segmentDescription[x].getPoiRouteDetails()[z].getPoint().getX());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].getPoint().setY(
                  _segmentDescription[x].getPoiRouteDetails()[z].getPoint().getY());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setSource(_segmentDescription[x].getPoiRouteDetails()[z].getSource());
            }
          }
        }

        _segmentDescription = new SegmentDescription[qtdSeg];
        _segmentDescription = _segmentDescriptionAux;

        Object[] obj1 = removeDuplicates(4, qtdSeg, _segmentDescriptionAux, _segmentDescription, ro);

        qtdSeg = (Integer) obj1[0] + 1;
        _segmentDescription = new SegmentDescription[0];
        _segmentDescription = (SegmentDescription[]) obj1[1];

        _segmentDescriptionAux = new SegmentDescription[qtdSeg];

        for (int x = 0; x < qtdSeg; x++) {
          _segmentDescriptionAux[x] = new SegmentDescription();
          _segmentDescriptionAux[x].setCity(new City());

          if (_segmentDescription[x].getCity().getName().contains("_"))
            _segmentDescriptionAux[x].getCity().setName(
                _segmentDescription[x].getCity().getName().substring(0, _segmentDescription[x].getCity().getName().length() - 1));
          else
            _segmentDescriptionAux[x].getCity().setName(_segmentDescription[x].getCity().getName());

          _segmentDescriptionAux[x].getCity().setState(_segmentDescription[x].getCity().getState());

          _segmentDescriptionAux[x].setCommand(_segmentDescription[x].getCommand());
          _segmentDescriptionAux[x].setCumulativeDistance(_segmentDescription[x].getCumulativeDistance());
          _segmentDescriptionAux[x].setDescription(_segmentDescription[x].getDescription());
          _segmentDescriptionAux[x].setDistance(_segmentDescription[x].getDistance());

          _segmentDescriptionAux[x].setPoint(new Point());
          _segmentDescriptionAux[x].getPoint().setX(_segmentDescription[x].getPoint().getX());
          _segmentDescriptionAux[x].getPoint().setY(_segmentDescription[x].getPoint().getY());
          _segmentDescriptionAux[x].setRoadType(_segmentDescription[x].getRoadType());

          _segmentDescriptionAux[x].setTollFee(_segmentDescription[x].getTollFee());
          _segmentDescriptionAux[x].setTollFeeDetails(new TollFeeDetails());
          _segmentDescriptionAux[x].getTollFeeDetails().setAddress(_segmentDescription[x].getTollFeeDetails().getAddress());
          _segmentDescriptionAux[x].getTollFeeDetails().setConcession(_segmentDescription[x].getTollFeeDetails().getConcession());
          _segmentDescriptionAux[x].getTollFeeDetails().setDirection(_segmentDescription[x].getTollFeeDetails().getDirection());
          _segmentDescriptionAux[x].getTollFeeDetails().setName(_segmentDescription[x].getTollFeeDetails().getName());
          _segmentDescriptionAux[x].getTollFeeDetails().setPhone(_segmentDescription[x].getTollFeeDetails().getPhone());
          _segmentDescriptionAux[x].getTollFeeDetails().setPrice(_segmentDescription[x].getTollFeeDetails().getPrice());
          _segmentDescriptionAux[x].getTollFeeDetails().setPricePerAxle(_segmentDescription[x].getTollFeeDetails().getPricePerAxle());
          _segmentDescriptionAux[x].getTollFeeDetails().setState(_segmentDescription[x].getTollFeeDetails().getState());

          _segmentDescriptionAux[x].setPoiRoute(_segmentDescription[x].getPoiRoute());

          if (_segmentDescription[x].getPoiRouteDetails() != null) {
            _segmentDescriptionAux[x].setPoiRouteDetails(new POIDetails[_segmentDescription[x].getPoiRouteDetails().length]);

            for (int z = 0; z < _segmentDescription[x].getPoiRouteDetails().length; z++) {
              _segmentDescriptionAux[x].getPoiRouteDetails()[z] = new POIDetails();
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setAddressInfo(_segmentDescription[x].getPoiRouteDetails()[z]
                  .getAddressInfo());

              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setClientID(_segmentDescription[x].getPoiRouteDetails()[z]
                  .getClientID());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setName(_segmentDescription[x].getPoiRouteDetails()[z].getName());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setPoint(new Point());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].getPoint().setX(
                  _segmentDescription[x].getPoiRouteDetails()[z].getPoint().getX());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].getPoint().setY(
                  _segmentDescription[x].getPoiRouteDetails()[z].getPoint().getY());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setSource(_segmentDescription[x].getPoiRouteDetails()[z].getSource());
            }
          }
        }

        ret = null;
        ret = _segmentDescriptionAux;

        segList = new ArrayList<SegmentDescription>();
        SegmentDescription seg = new SegmentDescription();
        String rodoviaAnterior = "";
        double distanciaRodovia = 0;
        int posicaoRodovia = 0;

        for (int x = 0; x < ret.length; x++) {
          if ((!ret[x].getDescription().toLowerCase().contains("rod.") && !ret[x].getDescription().toLowerCase().contains("rod ") && !ret[x]
              .getDescription().toLowerCase().contains("estr."))) {
            if (ret[x].getCommand().toLowerCase().contains("início") || ret[x].getCommand().toLowerCase().contains("fim")
                || ret[x].getDescription().toLowerCase().contains("retorno") || ret[x].getCommand().toLowerCase().contains("parada")) {
              seg = ret[x];
              segList.add(seg);
              seg = new SegmentDescription();
            } else {
              if (!Functions.IsNullOrEmpty(ret[x].getTollFee())) {
                seg = ret[x];
                segList.add(seg);
                seg = new SegmentDescription();
              } else {
                // seg = ret[x];
                seg.setDescription("Perímetro Urbano");
                seg.setCumulativeDistance(ret[x].getCumulativeDistance());
                seg.setDistance(seg.getDistance() + ret[x].getDistance());
                seg.setCity(ret[x].getCity());
                seg.setCommand("Continue");
                seg.setPoint(ret[x].getPoint());
                seg.setRoadType("P");

                if (!Functions.IsNullOrEmpty(seg.getPoiRoute()))
                  seg.setPoiRoute(ret[x].getPoiRoute());

                if (ret[x].getPoiRouteDetails() != null) {
                  if (seg.getPoiRouteDetails() == null) {
                    seg.setPoiRouteDetails(new POIDetails[ret[x].getPoiRouteDetails().length]);

                    for (int z = 0; z < ret[x].getPoiRouteDetails().length; z++) {
                      seg.getPoiRouteDetails()[z] = new POIDetails();
                      seg.getPoiRouteDetails()[z].setAddressInfo(ret[x].getPoiRouteDetails()[z].getAddressInfo());

                      seg.getPoiRouteDetails()[z].setClientID(ret[x].getPoiRouteDetails()[z].getClientID());
                      seg.getPoiRouteDetails()[z].setName(ret[x].getPoiRouteDetails()[z].getName());
                      seg.getPoiRouteDetails()[z].setPoint(new Point());
                      seg.getPoiRouteDetails()[z].getPoint().setX(ret[x].getPoiRouteDetails()[z].getPoint().getX());
                      seg.getPoiRouteDetails()[z].getPoint().setY(ret[x].getPoiRouteDetails()[z].getPoint().getY());
                      seg.getPoiRouteDetails()[z].setSource(ret[x].getPoiRouteDetails()[z].getSource());
                    }
                  } else {

                  }
                }

                if (x + 1 < ret.length) {
                  if (ret[x + 1].getDescription().toLowerCase().contains("rod.")
                      || ret[x + 1].getDescription().toLowerCase().contains("estr.")
                      || !Functions.IsNullOrEmpty(ret[x + 1].getTollFee())
                      || ret[x + 1].getCommand().toLowerCase().contains("parada")
                      || ret[x + 1].getCommand().toLowerCase().contains("início")
                      || ret[x + 1].getDescription().toLowerCase().contains("retorno")
                      || ret[x + 1].getCommand().toLowerCase().contains("fim")) {
                    segList.add(seg);
                    seg = new SegmentDescription();
                  }
                }
              }
            }
          } else {
            if (!Functions.IsNullOrEmpty(ret[x].getTollFee())) {
              seg = ret[x];
              segList.add(seg);
              seg = new SegmentDescription();

              distanciaRodovia += ret[x].getDistance();
            } else {
              if (Functions.IsNullOrEmpty(rodoviaAnterior)) {
                rodoviaAnterior = ret[x].getDescription().replace(" Pista Lateral", "").replace(" - Pista Lateral", "")
                    .replace("Ac. P/ ", "");

                // seg = ret[x];
                seg.setCity(new City());
                seg.setDescription("#Siga pela " + rodoviaAnterior);
                seg.setCumulativeDistance(0);
                seg.setCommand("");
                seg.setPoint(ret[x].getPoint());
                seg.setDistance(ret[x].getDistance());

                distanciaRodovia = ret[x].getDistance();

                segList.add(seg);
                seg = new SegmentDescription();
                posicaoRodovia = segList.size() - 1;

                segList.add(ret[x]);
              } else {
                if ((rodoviaAnterior.equals(ret[x].getDescription()) || rodoviaAnterior.contains(ret[x].getDescription()) || ret[x]
                    .getDescription().contains(rodoviaAnterior))) {
                  distanciaRodovia += ret[x].getDistance();
                  segList.add(ret[x]);

                  if (x + 1 < ret.length) {
                    if ((!ret[x + 1].getDescription().toLowerCase().contains("rod ")
                        && !ret[x + 1].getDescription().toLowerCase().contains("rod.") && !ret[x + 1].getDescription()
                        .toLowerCase().contains("estr."))) {
                      // segList.Add(seg);
                      SegmentDescription[] segAux = new SegmentDescription[segList.size()];

                      for (int c = 0; c < segList.size(); c++)
                        segAux[c] = (SegmentDescription) segList.get(c);

                      segAux[posicaoRodovia].setDistance(distanciaRodovia);
                      segList.clear();

                      for (int w = 0; w < segAux.length; w++)
                        segList.add(segAux[w]);

                      rodoviaAnterior = "";
                      distanciaRodovia = 0;
                    }
                  }
                } else {
                  SegmentDescription[] segAux = new SegmentDescription[segList.size()];

                  for (int c = 0; c < segList.size(); c++)
                    segAux[c] = (SegmentDescription) segList.get(c);

                  segAux[posicaoRodovia].setDistance(distanciaRodovia);
                  segList.clear();

                  for (int w = 0; w < segAux.length; w++)
                    segList.add(segAux[w]);

                  rodoviaAnterior = ret[x].getDescription().replace(" Pista Lateral", "").replace(" - Pista Lateral", "")
                      .replace("Ac. P/ ", "");

                  // seg = ret[x];
                  seg.setCity(new City());
                  seg.setDescription("#Siga pela " + rodoviaAnterior);
                  seg.setCumulativeDistance(0);
                  seg.setCommand("");
                  seg.setPoint(ret[x].getPoint());
                  seg.setDistance(ret[x].getDistance());

                  distanciaRodovia = ret[x].getDistance();

                  segList.add(seg);
                  seg = new SegmentDescription();
                  posicaoRodovia = segList.size() - 1;

                  segList.add(ret[x]);
                }
              }
            }
          }
        }

        ret = null;
        ret = new SegmentDescription[segList.size()];

        for (int c = 0; c < segList.size(); c++)
          ret[c] = (SegmentDescription) segList.get(c);
      }

      if (ro.getRouteDetails().getDescriptionType() == 3) {
        SegmentDescription[] _segmentDescriptionAux = ret;
        SegmentDescription[] _segmentDescription = ret;
        int qtdSeg = ret.length;

        Object[] obj1 = removeDuplicates(1, qtdSeg, _segmentDescriptionAux, _segmentDescription, ro);

        qtdSeg = (Integer) obj1[0] + 1;
        _segmentDescription = new SegmentDescription[0];
        _segmentDescription = (SegmentDescription[]) obj1[1];

        _segmentDescriptionAux = new SegmentDescription[qtdSeg];

        for (int x = 0; x < qtdSeg; x++) {
          _segmentDescriptionAux[x] = new SegmentDescription();
          _segmentDescriptionAux[x].setCity(new City());
          _segmentDescriptionAux[x].getCity().setName(_segmentDescription[x].getCity().getName());
          _segmentDescriptionAux[x].getCity().setState(_segmentDescription[x].getCity().getState());

          _segmentDescriptionAux[x].setCommand(_segmentDescription[x].getCommand());
          _segmentDescriptionAux[x].setCumulativeDistance(_segmentDescription[x].getCumulativeDistance());
          _segmentDescriptionAux[x].setDescription(_segmentDescription[x].getDescription());
          _segmentDescriptionAux[x].setDistance(_segmentDescription[x].getDistance());

          _segmentDescriptionAux[x].setPoint(new Point());
          _segmentDescriptionAux[x].getPoint().setX(_segmentDescription[x].getPoint().getX());
          _segmentDescriptionAux[x].getPoint().setY(_segmentDescription[x].getPoint().getY());
          _segmentDescriptionAux[x].setRoadType(_segmentDescription[x].getRoadType());

          _segmentDescriptionAux[x].setTollFee(_segmentDescription[x].getTollFee());
          _segmentDescriptionAux[x].setTollFeeDetails(new TollFeeDetails());
          _segmentDescriptionAux[x].getTollFeeDetails().setAddress(_segmentDescription[x].getTollFeeDetails().getAddress());
          _segmentDescriptionAux[x].getTollFeeDetails().setConcession(_segmentDescription[x].getTollFeeDetails().getConcession());
          _segmentDescriptionAux[x].getTollFeeDetails().setDirection(_segmentDescription[x].getTollFeeDetails().getDirection());
          _segmentDescriptionAux[x].getTollFeeDetails().setName(_segmentDescription[x].getTollFeeDetails().getName());
          _segmentDescriptionAux[x].getTollFeeDetails().setPhone(_segmentDescription[x].getTollFeeDetails().getPhone());
          _segmentDescriptionAux[x].getTollFeeDetails().setPrice(_segmentDescription[x].getTollFeeDetails().getPrice());
          _segmentDescriptionAux[x].getTollFeeDetails().setPricePerAxle(_segmentDescription[x].getTollFeeDetails().getPricePerAxle());
          _segmentDescriptionAux[x].getTollFeeDetails().setState(_segmentDescription[x].getTollFeeDetails().getState());

          _segmentDescriptionAux[x].setPoiRoute(_segmentDescription[x].getPoiRoute());

          if (_segmentDescription[x].getPoiRouteDetails() != null) {
            _segmentDescriptionAux[x].setPoiRouteDetails(new POIDetails[_segmentDescription[x].getPoiRouteDetails().length]);

            for (int z = 0; z < _segmentDescription[x].getPoiRouteDetails().length; z++) {
              _segmentDescriptionAux[x].getPoiRouteDetails()[z] = new POIDetails();
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setAddressInfo(_segmentDescription[x].getPoiRouteDetails()[z]
                  .getAddressInfo());

              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setClientID(_segmentDescription[x].getPoiRouteDetails()[z]
                  .getClientID());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setName(_segmentDescription[x].getPoiRouteDetails()[z].getName());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setPoint(new Point());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].getPoint().setX(
                  _segmentDescription[x].getPoiRouteDetails()[z].getPoint().getX());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].getPoint().setY(
                  _segmentDescription[x].getPoiRouteDetails()[z].getPoint().getY());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setSource(_segmentDescription[x].getPoiRouteDetails()[z].getSource());
            }
          }
        }

        _segmentDescription = new SegmentDescription[qtdSeg];
        _segmentDescription = _segmentDescriptionAux;

        Object[] obj11 = removeDuplicates(4, qtdSeg, _segmentDescriptionAux, _segmentDescription, ro);

        qtdSeg = (Integer) obj11[0] + 1;
        _segmentDescription = new SegmentDescription[0];
        _segmentDescription = (SegmentDescription[]) obj11[1];

        _segmentDescriptionAux = new SegmentDescription[qtdSeg];

        for (int x = 0; x < qtdSeg; x++) {
          _segmentDescriptionAux[x] = new SegmentDescription();
          _segmentDescriptionAux[x].setCity(new City());

          if (_segmentDescription[x].getCity().getName().contains("_"))
            _segmentDescriptionAux[x].getCity().setName(
                _segmentDescription[x].getCity().getName().substring(0, _segmentDescription[x].getCity().getName().length() - 1));
          else
            _segmentDescriptionAux[x].getCity().setName(_segmentDescription[x].getCity().getName());

          _segmentDescriptionAux[x].getCity().setState(_segmentDescription[x].getCity().getState());

          _segmentDescriptionAux[x].setCommand(_segmentDescription[x].getCommand());
          _segmentDescriptionAux[x].setCumulativeDistance(_segmentDescription[x].getCumulativeDistance());
          _segmentDescriptionAux[x].setDescription(_segmentDescription[x].getDescription());
          _segmentDescriptionAux[x].setDistance(_segmentDescription[x].getDistance());

          _segmentDescriptionAux[x].setPoint(new Point());
          _segmentDescriptionAux[x].getPoint().setX(_segmentDescription[x].getPoint().getX());
          _segmentDescriptionAux[x].getPoint().setY(_segmentDescription[x].getPoint().getY());
          _segmentDescriptionAux[x].setRoadType(_segmentDescription[x].getRoadType());

          _segmentDescriptionAux[x].setTollFee(_segmentDescription[x].getTollFee());
          _segmentDescriptionAux[x].setTollFeeDetails(new TollFeeDetails());
          _segmentDescriptionAux[x].getTollFeeDetails().setAddress(_segmentDescription[x].getTollFeeDetails().getAddress());
          _segmentDescriptionAux[x].getTollFeeDetails().setConcession(_segmentDescription[x].getTollFeeDetails().getConcession());
          _segmentDescriptionAux[x].getTollFeeDetails().setDirection(_segmentDescription[x].getTollFeeDetails().getDirection());
          _segmentDescriptionAux[x].getTollFeeDetails().setName(_segmentDescription[x].getTollFeeDetails().getName());
          _segmentDescriptionAux[x].getTollFeeDetails().setPhone(_segmentDescription[x].getTollFeeDetails().getPhone());
          _segmentDescriptionAux[x].getTollFeeDetails().setPrice(_segmentDescription[x].getTollFeeDetails().getPrice());
          _segmentDescriptionAux[x].getTollFeeDetails().setPricePerAxle(_segmentDescription[x].getTollFeeDetails().getPricePerAxle());
          _segmentDescriptionAux[x].getTollFeeDetails().setState(_segmentDescription[x].getTollFeeDetails().getState());

          _segmentDescriptionAux[x].setPoiRoute(_segmentDescription[x].getPoiRoute());

          if (_segmentDescription[x].getPoiRouteDetails() != null) {
            _segmentDescriptionAux[x].setPoiRouteDetails(new POIDetails[_segmentDescription[x].getPoiRouteDetails().length]);

            for (int z = 0; z < _segmentDescription[x].getPoiRouteDetails().length; z++) {
              _segmentDescriptionAux[x].getPoiRouteDetails()[z] = new POIDetails();
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setAddressInfo(_segmentDescription[x].getPoiRouteDetails()[z]
                  .getAddressInfo());

              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setClientID(_segmentDescription[x].getPoiRouteDetails()[z]
                  .getClientID());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setName(_segmentDescription[x].getPoiRouteDetails()[z].getName());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setPoint(new Point());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].getPoint().setX(
                  _segmentDescription[x].getPoiRouteDetails()[z].getPoint().getX());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].getPoint().setY(
                  _segmentDescription[x].getPoiRouteDetails()[z].getPoint().getY());
              _segmentDescriptionAux[x].getPoiRouteDetails()[z].setSource(_segmentDescription[x].getPoiRouteDetails()[z].getSource());
            }
          }
        }

        ret = null;
        ret = _segmentDescriptionAux;
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    if (!Functions.IsNullOrEmpty(ro.getDataSource())) {
      if (ro.getDataSource().toUpperCase().equals("BR")) {
        for (int x = 1; x < ret.length - 1; x++) {
          if (!(ret[x].getCommand().toLowerCase().indexOf("parada") >= 0))
            ret[x].setCommand("Continue");

          if ((ret[x].getCommand().toLowerCase().indexOf("parada") >= 0))
            ret[x].setRoadType(ret[x - 1].getRoadType());
        }

        int qtdSeg = ret.length;
        SegmentDescription[] retAux = new SegmentDescription[qtdSeg];
        retAux = ret;

        Object[] obj11 = removeDuplicates(10, qtdSeg, retAux, ret, ro);

        qtdSeg = (Integer) obj11[0] + 1;
        ret = new SegmentDescription[0];
        ret = (SegmentDescription[]) obj11[1];

        retAux = new SegmentDescription[qtdSeg];

        String lastCity = "";

        for (int x = 0; x < qtdSeg; x++) {
          retAux[x] = new SegmentDescription();
          retAux[x].setCity(new City());

          if (x == 0) {
            if (!Functions.IsNullOrEmpty(ret[x + 1].getCity().getName()))
              lastCity = ret[x + 1].getCity().getName();

            // retAux[x].city.name = ret[x + 1].city.name;
            // retAux[x].city.state = ret[x + 1].city.state;
          }

          if (x > 0) {
            if ((ret[x].getCity().getName().toLowerCase().equals(lastCity.toLowerCase()))) {
              retAux[x].getCity().setName("");
              retAux[x].getCity().setState(ret[x].getCity().getState());
            } else {
              if (!Functions.IsNullOrEmpty(ret[x].getCity().getName()))
                lastCity = ret[x].getCity().getName();

              retAux[x].getCity().setName(ret[x].getCity().getName());
              retAux[x].getCity().setState(ret[x].getCity().getState());
            }
          }

          retAux[x].setCommand(ret[x].getCommand());
          retAux[x].setCumulativeDistance(ret[x].getCumulativeDistance());

          if (ret[x].getDescription().indexOf("passando") > 0)
            retAux[x].setDescription(ret[x].getDescription().substring(0, ret[x].getDescription().indexOf("passando") - 1));
          else
            retAux[x].setDescription(ret[x].getDescription());

          retAux[x].setDistance(ret[x].getDistance());

          retAux[x].setPoint(new Point());
          retAux[x].getPoint().setX(ret[x].getPoint().getX());
          retAux[x].getPoint().setY(ret[x].getPoint().getY());
          retAux[x].setRoadType(ret[x].getRoadType());

          retAux[x].setTollFee(ret[x].getTollFee());
          retAux[x].setTollFeeDetails(new TollFeeDetails());
          retAux[x].getTollFeeDetails().setAddress(ret[x].getTollFeeDetails().getAddress());
          retAux[x].getTollFeeDetails().setConcession(ret[x].getTollFeeDetails().getConcession());
          retAux[x].getTollFeeDetails().setDirection(ret[x].getTollFeeDetails().getDirection());
          retAux[x].getTollFeeDetails().setName(ret[x].getTollFeeDetails().getName());
          retAux[x].getTollFeeDetails().setPhone(ret[x].getTollFeeDetails().getPhone());
          retAux[x].getTollFeeDetails().setPrice(ret[x].getTollFeeDetails().getPrice());
          retAux[x].getTollFeeDetails().setPricePerAxle(ret[x].getTollFeeDetails().getPricePerAxle());
          retAux[x].getTollFeeDetails().setState(ret[x].getTollFeeDetails().getState());

          retAux[x].setPoiRoute(ret[x].getPoiRoute());

          if (ret[x].getPoiRouteDetails() != null) {
            retAux[x].setPoiRouteDetails(new POIDetails[ret[x].getPoiRouteDetails().length]);

            for (int z = 0; z < ret[x].getPoiRouteDetails().length; z++) {
              retAux[x].getPoiRouteDetails()[z] = new POIDetails();
              retAux[x].getPoiRouteDetails()[z].setAddressInfo(ret[x].getPoiRouteDetails()[z].getAddressInfo());

              retAux[x].getPoiRouteDetails()[z].setClientID(ret[x].getPoiRouteDetails()[z].getClientID());
              retAux[x].getPoiRouteDetails()[z].setName(ret[x].getPoiRouteDetails()[z].getName());
              retAux[x].getPoiRouteDetails()[z].setPoint(new Point());
View Full Code Here


              try {
                Statement st = con.createStatement();
                ResultSet rr = st.executeQuery(sql.toUpperCase());

                while (rr.next()) {
                  POIDetails pd = new POIDetails();
                  pd.setClientID(rr.getString(1));
                  pd.setName(rr.getString(2));
                  pd.setAddressInfo(rr.getString(3));
                  pd.getPoint().setX(rr.getDouble(4));
                  pd.getPoint().setY(rr.getDouble(5));
                  pd.setSource(poiSource);

                  poiDetailsList.add(pd);
                }

                rr.close();
View Full Code Here

        String[] partMasterPOI = response.split(Pattern.quote("|"));

        if (!response.contains("No records found")) {
          for (int w = 0; w < partMasterPOI.length; w++) {
            if (partMasterPOI[w].indexOf("POI_") >= 0) {
              POIDetails poi = new POIDetails();
              poi.setClientID(partMasterPOI[w].substring(partMasterPOI[w].indexOf("POI_") + 4, (partMasterPOI[w].indexOf("POI_") + 4)
                  + partMasterPOI[w].substring(partMasterPOI[w].indexOf("POI_") + 4).indexOf('%')));

              if (Functions.isNumeric(poi.getClientID().substring(0, poi.getClientID().indexOf(':')))) {
                poiList.add(poi);
                segAux.seg.setPoiRoute("S");
                segAux.seg.setPoiRouteDetails(poiList.toArray(new POIDetails[0]));
              }
            }
View Full Code Here

          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());
View Full Code Here

          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());
View Full Code Here

    return segRet;
  }

  RoadType getRoadType(SegmentDescription[] segmentDescription) {
    RoadType roadType = new RoadType();
    double distance = 0;

    for (int x = 0; x < segmentDescription.length; x++) {
      distance = segmentDescription[x].getDistance();

      String roadTypeString = segmentDescription[x].getRoadType();

      if (!Functions.IsNullOrEmpty(roadTypeString)) {
        if (roadTypeString.contains("-"))
          roadTypeString = roadTypeString.split(Pattern.quote("-"))[0];
      }

      if (roadTypeString.equals("PD")) {
        roadType.setTwoLaneHighway(roadType.getTwoLaneHighway() + distance);
        distance = 0;
      }

      if (roadTypeString.equals("ED")) {
        roadType.setSecondLaneUnderConstruction(roadType.getSecondLaneUnderConstruction() + distance);
        distance = 0;
      }

      if (roadTypeString.equals("P")) {
        roadType.setOneLaneRoadway(roadType.getOneLaneRoadway() + distance);
        distance = 0;
      }

      if (roadTypeString.equals("EP")) {
        roadType.setPavingWorkInProgress(roadType.getPavingWorkInProgress() + distance);
        distance = 0;
      }

      if (roadTypeString.equals("T")) {
        roadType.setDirtRoad(roadType.getDirtRoad() + distance);
        distance = 0;
      }

      if (roadTypeString.equals("CP")) {
        roadType.setRoadwayInPoorConditions(roadType.getRoadwayInPoorConditions() + distance);
        distance = 0;
      }

      if (roadTypeString.equals("BA")) {
        roadType.setFerry(roadType.getFerry() + distance);
        distance = 0;
      }

      if (distance != 0) {
        roadType.setOneLaneRoadway(roadType.getOneLaneRoadway() + distance);
        distance = 0;
      }
    }

    return roadType;
View Full Code Here

        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";
View Full Code Here

      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]);
View Full Code Here

      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) {
View Full Code Here

        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";
View Full Code Here

TOP

Related Classes of com.lbslocal.cc.objects.v3.route.RouteTotals

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.