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

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


  }

  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

    try {
      /*
       * chama webMethod getXY para saber a coordenada do endere�o
       * informado
       */
      Point point = getXY(address, idLicenca);

      if (point.getX() != 0 && point.getY() != 0) {
        /*
         * se as coordenadas do endere�o s�o diferentes de zero, cria
         * mapa com o raio informado
         */
        CommonMap commonMap;
View Full Code Here

            for (int i = 0; i < splitLines.length; i++) {
        if (splitLines[i].startsWith("%G1=")){
         
          Address address = new Address();
          splitField = splitLines[i].split("%");
          Point point = new Point();
          for (int j = 0; j < splitField.length; j++) {
            if (splitField[j].startsWith("G5")){
              address.setDistrict(splitField[j].substring(3));
            }
            if (splitField[j].startsWith("SN")){
              address.setStreet(splitField[j].substring(4));
            }
            if (splitField[j].startsWith("XSN")){
              address.setStreet(address.getStreet() + " com " + splitField[j].substring(5));
            }
            if (splitField[j].startsWith("XLL=")){
              xll = splitField[j].substring(4);
              point.setY(Double.parseDouble(xll.split(",")[0]));
              point.setX(Double.parseDouble(xll.split(",")[1]));
            }
          }
          address.setCity(city);
         
          listIL.add(new IntersectionLocation(address, point));
View Full Code Here

  }

  public AddressLocation() {
        address = new Address();
        address.setCity(new City());
        point = new Point();
        carAccess = true;
        zipL = "";
        zipR = "";
  }
View Full Code Here

  public POIDetails() {
    this.clientID = "";
    this.name = "";
    this.addressInfo = "";
    this.source = "";
    this.point = new Point();
  }
View Full Code Here

    CAddressFinderAPI cAf = new CAddressFinderAPI(cm.getAppSettings("MAQUINA"), cm.getAppSettings("SERVER"), 11188, cm.getAppSettings("OUTPUT"),
        cm.getAppSettings("DNS"), cm.getAppSettings("M_BASEDECARTA_MAPA"), cm.getAppSettings("M_BASEDECARTA_REVGEO"));

    CommonRest cr = new CommonRest();

    Point point = new Point(Double.parseDouble(request.getParameter("lng")), Double.parseDouble(request.getParameter("lat")));
    Double tolerance = 50D;
    AddressLocation al = new AddressLocation();

    try {
      al = cAf.getAddress(point, tolerance, Integer.parseInt(cm.getAppSettings("ID")));
    } catch (Exception e) {
      e.printStackTrace();
    }

    ObjectsHelper[] dependencyObjects = new ObjectsHelper[3];

    dependencyObjects[0] = cr.new ObjectsHelper();
    dependencyObjects[0].object = new Address();
    dependencyObjects[0].alias = "address";

    dependencyObjects[1] = cr.new ObjectsHelper();
    dependencyObjects[1].object = new Point();
    dependencyObjects[1].alias = "point";

    dependencyObjects[2] = cr.new ObjectsHelper();
    dependencyObjects[2].object = new AddressLocation();
    dependencyObjects[2].alias = "AddressLocation";
View Full Code Here

TOP

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

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.