Package com.lbslocal.cc.objects.v0.common

Examples of com.lbslocal.cc.objects.v0.common.MapInfo


      if (((co[z + 1]).toString().replace("|", "").length() < (precision + 2))) {
        DecimalFormat df = new DecimalFormat(format.replace("0", "#"));
        df.setMinimumFractionDigits(precision);

        Point pt = new Point();
        pt.setY(Double.parseDouble(df.format(
            (Integer.parseInt(df.format(ptList.get(y).getY()).replace(",", "").replace(".", "")) + Integer.parseInt(co[z]))
                * Math.pow(10, -precision)).replace(",", ".")));
        pt.setX(Double.parseDouble(df.format(
            (Integer.parseInt(df.format(ptList.get(y).getX()).replace(",", "").replace(".", "")) + Integer.parseInt(co[z + 1]))
                * Math.pow(10, -precision)).replace(",", ".")));

        ptList.add(pt);

        y++;
      } else {
        DecimalFormat df = new DecimalFormat(format.replace("0", "#"));
        df.setMinimumFractionDigits(precision);

        Point pt = new Point();
        pt.setY(Double.parseDouble(df.format(Integer.parseInt(co[z]) * Math.pow(10, -precision)).replace(",", ".")));
        pt.setX(Double.parseDouble(df.format(Integer.parseInt(co[z + 1]) * Math.pow(10, -precision)).replace(",", ".")));

        ptList.add(pt);
      }

      z++;
View Full Code Here


      if (((co[z + 1]).toString().replace("|", "").length() < (precision + 2))) {
        DecimalFormat df = new DecimalFormat(format.replace("0", "#"));
        df.setMinimumFractionDigits(precision);

        Point pt = new Point();
        pt.setY(Double.parseDouble(df.format(
            (Integer.parseInt(df.format(ptList.get(y).getY()).replace(",", "").replace(".", "")) + Integer.parseInt(co[z]))
                * Math.pow(10, -precision)).replace(",", ".")));
        pt.setX(Double.parseDouble(df.format(
            (Integer.parseInt(df.format(ptList.get(y).getX()).replace(",", "").replace(".", "")) + Integer.parseInt(co[z + 1]))
                * Math.pow(10, -precision)).replace(",", ".")));

        ptList.add(pt);

        y++;
      } else {
        DecimalFormat df = new DecimalFormat(format.replace("0", "#"));
        df.setMinimumFractionDigits(precision);

        Point pt = new Point();
        pt.setY(Double.parseDouble(df.format(Integer.parseInt(co[z]) * Math.pow(10, -precision)).replace(",", ".")));
        pt.setX(Double.parseDouble(df.format(Integer.parseInt(co[z + 1]) * Math.pow(10, -precision)).replace(",", ".")));

        ptList.add(pt);
      }

      z++;
View Full Code Here

 
  public RouteSummary()
  {
    this.description = "";
    this.distance = 0;
    this.point = new Point();
  }
View Full Code Here

                dl[iCount].getDistrict().setCity(new City());
                dl[iCount].getDistrict().getCity().setName(rs1.getString("CIDADE"));
                dl[iCount].getDistrict().getCity().setState(rs1.getString("UF"));

                dl[iCount].setPoint(new Point());
                dl[iCount].getPoint().setX(Double.parseDouble(rs1.getString("X")));
                dl[iCount].getPoint().setY(Double.parseDouble(rs1.getString("Y")));

                dl[iCount].getDistrict().setZone(rs1.getString("REGIAO"));
View Full Code Here

              location[iCount] = new CityLocation();
              location[iCount].setCity(new City());
              location[iCount].getCity().setName(rs1.getString("MUNICY"));
              location[iCount].getCity().setState(rs1.getString("UF"));
              // definir point
              location[iCount].setPoint(new Point());
              location[iCount].getPoint().setX(Double.parseDouble(rs1.getString("X")));
              location[iCount].getPoint().setY(Double.parseDouble(rs1.getString("Y")));
              // definir carAccess
              location[iCount].setCarAccess(true);
              // atribuir CEP
View Full Code Here

  }

  public Point getRoadXY(Road road, int idLicenca) throws Exception {
    int iCount = 0, roadNumber = 0;

    Point pt = new Point();
    Pagination pg;

    boolean hasState = (road.getCity().getState() != null && road.getCity().getState().compareTo("") != 0);

    if (!hasState) {
      throw (new Exception("O estado deve ser informado."));
    }

    if (Functions.IsNullOrEmpty(road.getCity().getCountry()))
      road.getCity().setCountry("Brasil");

    try {
      // transformar valores null em "" para n�o dar null pointer
      // exception
      if (road.getName() == null)
        road.setName("");
      if (road.getRoadNumber() == null)
        road.setRoadNumber("");
      if (road.getCity().getName() == null)
        road.getCity().setName("");
      if (road.getCity().getState() == null)
        road.getCity().setState("");
      if (road.getZip() == null)
        road.setZip("");

      // validando n�mero
      if (!road.getRoadNumber().equals("")) {
        if (Functions.isNumeric(road.getRoadNumber().replace(".", "").replace(",", "").replace("-", "").replace("e", "")))
          roadNumber = Integer.parseInt(road.getRoadNumber());
      }
      if (roadNumber == 0)
        road.setRoadNumber("");
      else
        road.setRoadNumber(String.valueOf(roadNumber));

      // se o valor de endere�o, cidade e estado for em branco erro
      // se cepe o cep forem em brancos da a mensagem de erro
      if (road.getZip() == "")
        if ((road.getName() == "") && ((road.getCity().getName() == "") || (road.getCity().getState() == "")))
          throw (new Exception(
              "Os atributos address.street, city.name e city.state devem ser informados quando o atributo address.zip nao e informado."));

      if (road.getZip().length() == 8)
        road.setZip(road.getZip().substring(0, 5) + "-" + road.getZip().substring(5, 8));

      Connection con = dataBase.getConnection(Functions.getDataBase(idLicenca, "Brasil").getSource());

      CallableStatement cst = con.prepareCall("{call cp_WS_KM(?,?,?,?,?)}");
      cst.setString(1, road.getRoadNumber());
      cst.setString(2, road.getName());
      cst.setString(3, road.getCity().getName());
      cst.setString(4, road.getCity().getState());
      cst.setString(5, road.getZip());

      cst.execute();

      ResultSet rs1 = cst.getResultSet();

      CachedRowSetImpl crs = new CachedRowSetImpl();
      crs.populate(rs1);

      int TotalRecords = crs.size();

      if (TotalRecords > 0) {
        try {
          pg = Functions.definePage(TotalRecords, 1, 0);
          // RoadLocation[] rl;

          if (pg.getRecordsInitial() <= TotalRecords) {
            // rl = new RoadLocation[(pg.getRecordsFinal() -
            // pg.getRecordsInitial()) + 1];

            for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
              if (rs1.absolute(intI)) {
                pt.setX(Double.parseDouble(rs1.getString("X")));
                pt.setY(Double.parseDouble(rs1.getString("Y")));

                iCount++;
              }
            }
          }
View Full Code Here

    try {
      String[] part = response.split("%");

      for (int x = 0; x < part.length; x++) {
        if (part[x].indexOf("LL=") >= 0) {
          Point point1 = new Point();

          point1.setY(Double.parseDouble(part[x].replace("LL=", "").replace("||", "").split(",")[0].replace(",", ".")));
          point1.setX(Double.parseDouble(part[x].replace("LL=", "").replace("||", "").split(",")[1].replace(",", ".")));
          al.setPoint(point1);
        }

        if (part[x].indexOf("S2=") >= 0) {
          if (al.getAddress().getStreet().isEmpty()) {
View Full Code Here

              poil[iCount] = new POILocation();
              poil[iCount].setName(rs1.getString("NOME"));
              poil[iCount].setDistrict(rs1.getString("BAIRRO"));
              poil[iCount].setCarAccess(rs1.getBoolean("ROTAPE"));

              poil[iCount].setPoint(new Point());
              poil[iCount].getPoint().setX(Double.parseDouble(rs1.getString("X")));
              poil[iCount].getPoint().setY(Double.parseDouble(rs1.getString("Y")));

              poil[iCount].setCity(new City());
              poil[iCount].setCity(city);
View Full Code Here

            al[0].getAddress().getCity().setName(crs.getString("Cidade"));
            al[0].getAddress().getCity().setState(crs.getString("EStado"));
            al[0].setZipL(crs.getString("CEP"));
            al[0].setZipR(crs.getString("CEP"));

            Point point = new Point();
            point.setX(crs.getDouble("X"));
            point.setY(crs.getDouble("Y"));
            al[0].setPoint(point);

            ai.setRecordCount(1);
            ai.setAddressLocation(al);
          } else {
View Full Code Here

      return ai;
    }
  }

  public Point getXY(Address address, int idLicenca) throws Exception {
    Point point = new Point();
    /* transformar valores null em "" para n�o dar null pointer exception */
    if (address.getStreet() == null)
      address.setStreet("");
    if (address.getHouseNumber() == null)
      address.setHouseNumber("");
    else
      address.setHouseNumber(address.getHouseNumber().trim());
    if (address.getZip() == null)
      address.setZip("");
    if (address.getDistrict() == null)
      address.setDistrict("");
    if (address.getCity().getName() == null)
      address.getCity().setName("");
    if (address.getCity().getState() == null)
      address.getCity().setState("");

    // se o valor de endere�o, cidade e estado for em branco erro
    // se cepe o cep forem em brancos da a mensagem de erro
    if (address.getZip() == "")
      if ((address.getCity().getName() == "") || (address.getCity().getState() == ""))
        throw (new Exception(
            "Os atributos address.street, city.name e city.state devem ser informados quando o atributo address.zip nao e informado."));

    try {
      AddressOptions ao = new AddressOptions();
      ao.setUsePhonetic(true);
      ao.setSearchType(2);
      ao.setResultRange(new ResultRange());
      ao.getResultRange().setPageIndex(1);
      ao.getResultRange().setRecordsPerPage(1);

      AddressInfo ai = new AddressInfo();
      ai = findAddress(address, ao, idLicenca);
      if (ai.getRecordCount() > 0) {
        for (int x = 0; x < ai.getRecordCount(); x++) {
          if (ai.getAddressLocation()[x].getPoint().getX() != 0.0) {
            point = ai.getAddressLocation()[x].getPoint();
            x = ai.getRecordCount();
          }
        }

        // se a coordenada retornada for zerada
        if (point.getX() == 0 || point.getY() == 0) {
          throw (new Exception("N�o foi possivel encontrar um endere�o."));
        }
      } else {
        throw (new Exception("N�o foi possivel encontrar um endere�o."));
      }
View Full Code Here

TOP

Related Classes of com.lbslocal.cc.objects.v0.common.MapInfo

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.