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

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


    return ext;
  }

  public MapInfo renderMap(String routeId, String routeResponse, Extent extent, MapOptions mo, int idLicenca, int methodID) throws Exception {
    try {
      return getMap(routeId, routeResponse, new Point[0], extent, mo, new Point(), idLicenca, methodID, "png");
    } catch (Exception ex) {
      throw (ex);
    }
  }
View Full Code Here


        if (parts[x].indexOf("VR=") >= 0) {
          String[] co = parts[x].toString().replace("|", "").replace("\0", "").split(",");

          for (int z = 1; z < co.length; z++) {
            if ((co[z + 1].toString().replace("|", "").length() < 8)) {
              Point pt = new Point();
              pt.setY(ptList.get(y).getY() + Integer.parseInt(co[z]) * Math.pow(10, -5));
              pt.setX(ptList.get(y).getX() + Integer.parseInt(co[z + 1]) * Math.pow(10, -5));

              ptList.add(pt);

              y++;
            } else {
              Point pt = new Point();
              pt.setY(Integer.parseInt(co[z]) * Math.pow(10, -5));
              pt.setX(Integer.parseInt(co[z + 1]) * Math.pow(10, -5));

              ptList.add(pt);
            }

            z++;
View Full Code Here

 

  private MapInfo renderMap(String routeId, String routeResponse, Extent extent, MapOptions mo, int idLicenca, int methodID, String mapType) throws Exception {
    try {
      return getMap(routeId, routeResponse, new Point[0], extent, mo, new Point(), idLicenca, methodID, mapType);
    } catch (Exception ex) {
      throw (ex);
    }
  }
View Full Code Here

  public MapInfo getZoomFullExtent(String routeId, MapOptions mo, int idLicenca, int methodID) throws Exception {
    MapInfo mi = new MapInfo();

    try {
      Point point = new Point(-62.9569009522848, -21.3320991286825);

      Extent ext = Functions.CalcRadius(3800045, point);

      mi = renderMap(routeId, "", ext, mo, idLicenca, methodID);
    } catch (Exception ex) {
View Full Code Here

    return tabelaRuas;
  }

  public static Point getGeocodeSQL(int lf, int lt, int rf, int rt, String numero, String coords) {
    LinePoint[] line;
    Point pOrigem, pFim, pFinal = null;
    String format = "0.00000";

    Encrypt ce = new Encrypt();
    if ((!(coords.indexOf(" ") > 0)) && (!(coords.indexOf(",") > 0)) && (!(coords.indexOf(";") > 0)))
      coords = ce.Decode(coords);

    // -2551100,-4924916,-118,59,42,103,-20,10,-115,58
    if (!(coords.indexOf(';') > 0)) {
      format = "0.0000000";
      coords = convertFromDecarta(7, coords);
    }

    boolean blnPar, blnInverse, blnLeftPar = true;
    int L_F_ADD, L_T_ADD, R_F_ADD, R_T_ADD, houseNumber = 0, to, from, intAux;
    int i, z = 0;

    double totalLenght = 0, percentLine = 0, angle;

    if (!numero.equals(""))
      houseNumber = Integer.parseInt(numero); // Atribui valor ao inteiro
    if (houseNumber % 2 == 0)
      blnPar = true;
    else
      blnPar = false; // Buscar por Par ou �mpar

    L_F_ADD = lf;
    L_T_ADD = lt;
    R_F_ADD = rf;
    R_T_ADD = rt;

    to = L_T_ADD;
    from = L_F_ADD;

    if (coords.lastIndexOf(';') == coords.length())
      coords = coords.substring(0, coords.length() - 1);

    if (coords.substring(coords.length() - 1).equals(";"))
      coords = coords.substring(0, coords.length() - 1);

    // Qual lado � par - Left � default
    if (L_F_ADD != 0) {
      if (L_F_ADD % 2 != 0)
        blnLeftPar = false;
    }
    if (R_F_ADD != 0) {
      if (R_F_ADD % 2 == 0)
        blnLeftPar = false;
    }

    // Atribu to / from caso necessario - to e from default left
    if (blnPar) {
      if (!blnLeftPar) {
        to = R_T_ADD;
        from = R_F_ADD;
      }
    } else {
      if (blnLeftPar) {
        to = R_T_ADD;
        from = R_F_ADD;
      }
    }

    // verifica leitura inversa
    if (from > to) {
      intAux = from;
      from = to;
      to = intAux;
      blnInverse = true;
    } else
      blnInverse = false;

    line = new LinePoint[coords.split(";").length];

    // l� inversamente caso necess�rio
    if (!blnInverse) {
      for (i = 0; i < line.length; i++) {
        line[i] = new LinePoint();
        line[i].setPoint(new Point());
        line[i].getPoint().setX(Double.parseDouble(coords.split(";")[i].split(" ")[0].toString()));
        line[i].getPoint().setY(Double.parseDouble(coords.split(";")[i].split(" ")[1].toString()));
      }
    } else {
      for (i = line.length - 1; i > -1; i--) {
        line[z] = new LinePoint();
        line[z].setPoint(new Point());
        line[z].getPoint().setX(Double.parseDouble(coords.split(";")[i].split(" ")[0].toString()));
        line[z].getPoint().setY(Double.parseDouble(coords.split(";")[i].split(" ")[1].toString()));
        z++;
      }
    }

    // Tamanho Total / Parcial
    for (i = 0; i < line.length; i++) {
      if (i + 1 < line.length) {
        line[i].setLength(Math.sqrt(Math.pow((line[i].getPoint().getX() - line[i + 1].getPoint().getX()), 2)
            + Math.pow((line[i].getPoint().getY() - line[i + 1].getPoint().getY()), 2)));
        totalLenght += line[i].getLength();
      }
    }

    // Numero na linha
    if (to - from != 0)
      percentLine = ((houseNumber - from) * totalLenght) / (to - from);

    // Escolhe o segmento
    for (i = 0; i < line.length - 1; i++) {
      if (line[i].getLength() >= percentLine)
        break;
      else
        percentLine -= line[i].getLength();
    }

    // Caso de perda de precis�o
    if (i == line.length - 1) {
      i--;
      percentLine += line[i].getLength();
    }

    pFinal = new Point();
    pFinal.setX(0);
    pFinal.setY(0);

    pOrigem = line[i].getPoint();
    pFim = line[i + 1].getPoint();

    if ((pOrigem.getX() - pFim.getX()) == 0 || (pOrigem.getY() - pFim.getY()) == 0)
      angle = 0;
    else {
      angle = Math.abs(Math.atan((pOrigem.getY() - pFim.getY()) / (pOrigem.getX() - pFim.getX())));
    }

    // 1 Quadrante
    if (pOrigem.getX() < pFim.getX() && pOrigem.getY() < pFim.getY()) {
      pFinal.setX(pOrigem.getX() + percentLine * Math.cos(angle));
      pFinal.setY(pOrigem.getY() + percentLine * Math.sin(angle));
    }

    // 2 Quadrante
    if (pOrigem.getX() > pFim.getX() && pOrigem.getY() < pFim.getY()) {
      pFinal.setX(pOrigem.getX() - percentLine * Math.cos(angle));
      pFinal.setY(pOrigem.getY() + percentLine * Math.sin(angle));
    }

    // 3 Quadrante
    if (pOrigem.getX() > pFim.getX() && pOrigem.getY() > pFim.getY()) {
      pFinal.setX(pOrigem.getX() - percentLine * Math.cos(angle));
      pFinal.setY(pOrigem.getY() - percentLine * Math.sin(angle));
    }

    // 4 Quadrante
    if (pOrigem.getX() < pFim.getX() && pOrigem.getY() > pFim.getY()) {
      pFinal.setX(pOrigem.getX() + percentLine * Math.cos(angle));
      pFinal.setY(pOrigem.getY() - percentLine * Math.sin(angle));
    }

    if (pFinal.getX() == 0 || pFinal.getY() == 0) {
      // 0 ou 360 graus
      if (pOrigem.getX() < pFim.getX() && pOrigem.getY() == pFim.getY()) {
        pFinal.setX(pOrigem.getX() + percentLine);
        pFinal.setY(pOrigem.getY());
      }

      // 90 graus
      if (pOrigem.getX() == pFim.getX() && pOrigem.getY() < pFim.getY()) {
        pFinal.setX(pOrigem.getX());
        pFinal.setY(pOrigem.getY() + percentLine);
      }

      // 180 graus
      if (pOrigem.getX() > pFim.getX() && pOrigem.getY() == pFim.getY()) {
        pFinal.setX(pOrigem.getX() - percentLine);
        pFinal.setY(pOrigem.getY());
      }

      // 270 graus
      if (pOrigem.getX() == pFim.getX() && pOrigem.getY() > pFim.getY()) {
        pFinal.setX(pOrigem.getX());
        pFinal.setY(pOrigem.getY() - percentLine);
      }
    }

    if (pFinal.getX() == 0 && pOrigem.getX() != 0) {
      pFinal = pOrigem;
    }

    if (pFinal.getX() == 0 && pFim.getX() != 0) {
      pFinal = pFim;
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

      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

TOP

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

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.