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

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


    public static int _findRadiusFromAddress = 48;
    public static int _findRadiusFromXY = 49;
 
  public ProximityInfo findFromExtent(Extent ext, ProximityOptions po, int idLicenca) throws Exception
  {
    ProximityInfo pi = new ProximityInfo();
   
    try
    {
      String[] tb;
      String[] whereClause;
     
      tb = po.getPoiDataSource().split(Pattern.quote("|"));
     
      if (Functions.IsNullOrEmpty(po.getWhereClause()))
        po.setWhereClause("");
     
      whereClause = po.getWhereClause().split(Pattern.quote("|"));
     
      // verifica se o n�mero de tabelas � igual ao n�mero de clausulas
      // where
      if ((tb.length != whereClause.length) || (po.getFieldList().length() == 0))
        throw (new Exception("Numero de poiDataSource e diferente do numero de whereClause ou fieldList e esta em branco."));
     
      Boolean validos = validarPoiDataSource(tb, po.getFieldList(), po.getWhereClause(), idLicenca);
     
      if (!validos)
        throw (new Exception("poiDatasource ou fieldList invalidos."));
     
      int i = 0;
      String strSelect = "";
      String fields = po.getFieldList();
      String orderBy = "";
     
      fields = fields.replace("|", ",");
     
      Point point = new Point();
     
      point.setX(ext.getXMin() + (ext.getXMax() - ext.getXMin()) / 2);
      point.setY(ext.getYMin() + (ext.getYMax() - ext.getYMin()) / 2);
     
      if (fields.split(Pattern.quote(",")).length > 0)
        orderBy = " , " + fields.split(Pattern.quote(","))[0];
     
      if (whereClause[0] != "")
        whereClause[0] = "and " + whereClause[0];
     
      strSelect = "select count(1) as total from dados_clientes." + tb[i] + " where x<>0 and ((x>=" + ext.getXMin() + " and x<=" + ext.getXMax() + ") and (y>=" + ext.getYMin() + " and y<="
          + ext.getYMax() + "))" + whereClause[0];
     
      Connection con = dataBase.getConnection("DADOS_WEBSERVICES");
     
      Statement st = con.createStatement();
      ResultSet rr = st.executeQuery(strSelect.toUpperCase());
     
      rr.next();
      int nrReg = rr.getInt("total");
     
      rr.close();
      st.close();
      con.close();
     
      if (po.getResultRange().getRecordsPerPage() > 50)
        po.getResultRange().setRecordsPerPage(50);
     
      if (po.getResultRange().getRecordsPerPage() < 1)
        po.getResultRange().setRecordsPerPage(5);
     
      Pagination pg = Functions.definePage(nrReg, po.getResultRange().getRecordsPerPage(), po.getResultRange().getPageIndex());
     
      strSelect = "select tabela, x, y, 102960 *  SQRT(POWER(x - " + point.getX() + ",2) + POWER(y - " + point.getY() + ",2)) as distancia, " + fields + " from dados_clientes." + tb[i]
          + " where x<>0 and ((x>=" + ext.getXMin() + " and x<=" + ext.getXMax() + ") and (y>=" + ext.getYMin() + " and y<=" + ext.getYMax() + "))" + whereClause[0] + " order by distancia "
          + orderBy + " LIMIT " + (pg.getRecordsInitial() - 1) + "," + (pg.getRecordsFinal());
     
      con = dataBase.getConnection("DADOS_WEBSERVICES");
     
      st = con.createStatement();
      rr = st.executeQuery(strSelect.toUpperCase());
     
      int columnCount = rr.getMetaData().getColumnCount();
      String[][] resultSet = new String[Math.abs((pg.getRecordsInitial() - 1) - pg.getRecordsFinal())][columnCount];
     
      while (rr.next())
      {
        int w = rr.getRow();
       
        for (int j = 1; j < columnCount + 1; j++)
        {
          if (j == 4)
            resultSet[w - 1][j - 1] = String.valueOf(rr.getObject(j)).substring(0, String.valueOf(rr.getObject(j)).indexOf("."));
          else
            resultSet[w - 1][j - 1] = String.valueOf(rr.getObject(j));
        }
      }
     
      pi.setResultSet(resultSet);
      pi.setRecordCount(nrReg);
     
      if (po.getResultRange().getRecordsPerPage() != 0)
      {
        pi.setPageCount(nrReg / po.getResultRange().getRecordsPerPage());
       
        if (pi.getRecordCount() % po.getResultRange().getRecordsPerPage() > 0)
          pi.setPageCount(pi.getPageCount() + 1);
      }
      else
        pi.setPageCount(1);
     
      rr.close();
     
      st.close();
      con.close();
View Full Code Here


    return pi;
  }
 
  public ProximityInfo findClosestFromXY(Point point, ProximityOptions po, int idLicenca) throws Exception
  {
    ProximityInfo pi = new ProximityInfo();
   
    try
    {
      String[] tb;
      String[] whereClause;
     
      tb = po.getPoiDataSource().split(Pattern.quote("|"));
     
      if (Functions.IsNullOrEmpty(po.getWhereClause()))
        po.setWhereClause("");
     
      whereClause = po.getWhereClause().split(Pattern.quote("|"));
     
      // verifica se o n�mero de tabelas � igual ao n�mero de clausulas
      // where
      if ((tb.length != whereClause.length) || (po.getFieldList().length() == 0))
        throw (new Exception("Numero de poiDataSource e diferente do numero de whereClause ou fieldList e esta em branco."));
     
      Boolean validos = validarPoiDataSource(tb, po.getFieldList(), po.getWhereClause(), idLicenca);
     
      if (!validos)
        throw (new Exception("poiDatasource ou fieldList invalidos."));
     
      int i = 0;
      String strSelect = "";
      String fields = po.getFieldList();
      String orderBy = "";
     
      fields = fields.replace("|", ",");
     
      if (fields.split(Pattern.quote(",")).length > 0)
        orderBy = " , " + fields.split(Pattern.quote(","))[0];
     
      if (whereClause[0] != "")
        whereClause[0] = "and " + whereClause[0];
     
      strSelect = "select count(1) as total from dados_clientes." + tb[i] + " where x<>0 " + whereClause[0];
     
      Connection con = dataBase.getConnection("DADOS_WEBSERVICES");
     
      Statement st = con.createStatement();
      ResultSet rr = st.executeQuery(strSelect.toUpperCase());
     
      rr.next();
      int nrReg = rr.getInt("total");
     
      rr.close();
      st.close();
      con.close();
     
      if (po.getResultRange().getRecordsPerPage() > 50)
        po.getResultRange().setRecordsPerPage(50);
     
      if (po.getResultRange().getRecordsPerPage() < 1)
        po.getResultRange().setRecordsPerPage(5);
     
      Pagination pg = Functions.definePage(nrReg, po.getResultRange().getRecordsPerPage(), po.getResultRange().getPageIndex());
     
      strSelect = "select tabela, x, y, 102960 *  SQRT(POWER(x - " + point.getX() + ",2) + POWER(y - " + point.getY() + ",2)) as distancia, " + fields + " from dados_clientes." + tb[i]
          + " where x<>0 " + whereClause[0] + " order by distancia " + orderBy + " LIMIT " + (pg.getRecordsInitial() - 1) + "," + (pg.getRecordsFinal());
     
      con = dataBase.getConnection("DADOS_WEBSERVICES");
     
      st = con.createStatement();
      rr = st.executeQuery(strSelect.toUpperCase());
     
      int columnCount = rr.getMetaData().getColumnCount();
      String[][] resultSet = new String[Math.abs((pg.getRecordsInitial() - 1) - pg.getRecordsFinal())][columnCount];
     
      while (rr.next())
      {
        int w = rr.getRow();
       
        for (int j = 1; j < columnCount + 1; j++)
        {
          if (j == 4)
            resultSet[w - 1][j - 1] = String.valueOf(rr.getObject(j)).substring(0, String.valueOf(rr.getObject(j)).indexOf("."));
          else
            resultSet[w - 1][j - 1] = String.valueOf(rr.getObject(j));
        }
      }
     
      pi.setResultSet(resultSet);
      pi.setRecordCount(nrReg);
     
      if (po.getResultRange().getRecordsPerPage() != 0)
      {
        pi.setPageCount(nrReg / po.getResultRange().getRecordsPerPage());
       
        if (pi.getRecordCount() % po.getResultRange().getRecordsPerPage() > 0)
          pi.setPageCount(pi.getPageCount() + 1);
      }
      else
        pi.setPageCount(1);
     
      rr.close();
     
      st.close();
      con.close();
View Full Code Here

    return pi;
  }
 
  public ProximityInfo findRadiusFromXY(Point point, int radius, ProximityOptions po, int idLicenca) throws Exception
  {
    ProximityInfo pi = new ProximityInfo();
   
    try
    {
      String[] tb;
      String[] whereClause;
     
      tb = po.getPoiDataSource().split(Pattern.quote("|"));
     
      if (Functions.IsNullOrEmpty(po.getWhereClause()))
        po.setWhereClause("");
     
      whereClause = po.getWhereClause().split(Pattern.quote("|"));
     
      // verifica se o n�mero de tabelas � igual ao n�mero de clausulas
      // where
      if ((tb.length != whereClause.length) || (po.getFieldList().length() == 0))
        throw (new Exception("Numero de poiDataSource e diferente do numero de whereClause ou fieldList e esta em branco."));
     
      Boolean validos = validarPoiDataSource(tb, po.getFieldList(), po.getWhereClause(), idLicenca);
     
      if (!validos)
        throw (new Exception("poiDatasource ou fieldList invalidos."));
     
      int i = 0;
      String strSelect = "";
      String fields = po.getFieldList();
      String orderBy = "";
     
      fields = fields.replace("|", ",");
     
      Extent ext = new Extent();
     
      double raio = radius * 9.7125097125097125097125097125097e-6;
     
      ext.setXMin(point.getX() - raio);
      ext.setXMax(point.getX() + raio);
      ext.setYMin(point.getY() + raio);
      ext.setYMax(point.getY() - raio);
     
      if (fields.split(Pattern.quote(",")).length > 0)
        orderBy = " , " + fields.split(Pattern.quote(","))[0];
     
      if (whereClause[0] != "")
        whereClause[0] = "and " + whereClause[0];
     
      strSelect = "select count(1) as total from dados_clientes." + tb[i] + " where x<>0 and ((x>=" + ext.getXMin() + " and x<=" + ext.getXMax() + ") and (y>=" + ext.getYMin() + " and y<="
          + ext.getYMax() + "))" + whereClause[0];
     
      Connection con = dataBase.getConnection("DADOS_WEBSERVICES");
     
      Statement st = con.createStatement();
      ResultSet rr = st.executeQuery(strSelect.toUpperCase());
     
      rr.next();
      int nrReg = rr.getInt("total");
     
      rr.close();
      st.close();
      con.close();
     
      if (po.getResultRange().getRecordsPerPage() > 50)
        po.getResultRange().setRecordsPerPage(50);
     
      if (po.getResultRange().getRecordsPerPage() < 1)
        po.getResultRange().setRecordsPerPage(5);
     
      Pagination pg = Functions.definePage(nrReg, po.getResultRange().getRecordsPerPage(), po.getResultRange().getPageIndex());
     
      strSelect = "select tabela, x, y, 102960 *  SQRT(POWER(x - " + point.getX() + ",2) + POWER(y - " + point.getY() + ",2)) as distancia, " + fields + " from dados_clientes." + tb[i]
          + " where x<>0 and ((x>=" + ext.getXMin() + " and x<=" + ext.getXMax() + ") and (y>=" + ext.getYMin() + " and y<=" + ext.getYMax() + "))" + whereClause[0] + " order by distancia "
          + orderBy + " LIMIT " + (pg.getRecordsInitial() - 1) + "," + (pg.getRecordsFinal());
     
      con = dataBase.getConnection("DADOS_WEBSERVICES");
     
      st = con.createStatement();
      rr = st.executeQuery(strSelect.toUpperCase());
     
      int columnCount = rr.getMetaData().getColumnCount();
      String[][] resultSet = new String[Math.abs((pg.getRecordsInitial() - 1) - pg.getRecordsFinal())][columnCount];
     
      while (rr.next())
      {
        int w = rr.getRow();
       
        for (int j = 1; j < columnCount + 1; j++)
        {
          if (j == 4)
            resultSet[w - 1][j - 1] = String.valueOf(rr.getObject(j)).substring(0, String.valueOf(rr.getObject(j)).indexOf("."));
          else
            resultSet[w - 1][j - 1] = String.valueOf(rr.getObject(j));
        }
      }
     
      pi.setResultSet(resultSet);
      pi.setRecordCount(nrReg);
     
      if (po.getResultRange().getRecordsPerPage() != 0)
      {
        pi.setPageCount(nrReg / po.getResultRange().getRecordsPerPage());
       
        if (pi.getRecordCount() % po.getResultRange().getRecordsPerPage() > 0)
          pi.setPageCount(pi.getPageCount() + 1);
      }
      else
        pi.setPageCount(1);
     
      rr.close();
     
      st.close();
      con.close();
View Full Code Here

  }

  public ProximityInfo findClosestFromAddress(Address ad, ProximityOptions po, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    ProximityInfo pi = new ProximityInfo();

    try {
      Point point = new Point();

      if (Functions.IsNullOrEmpty(ad.getStreet()) && Functions.IsNullOrEmpty(ad.getHouseNumber()) && Functions.IsNullOrEmpty(ad.getZip())
View Full Code Here

  }

  public ProximityInfo findRadiusFromAddress(Address ad, int radius, ProximityOptions po, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    ProximityInfo pi = new ProximityInfo();

    try {
      Point point = new Point();

      if (Functions.IsNullOrEmpty(ad.getStreet()) && Functions.IsNullOrEmpty(ad.getHouseNumber()) && Functions.IsNullOrEmpty(ad.getZip())
View Full Code Here

  }

  public ProximityInfo findRadiusFromXY(Point point, int radius, ProximityOptions po, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    ProximityInfo pi = new ProximityInfo();

    try {
      pi = px.findRadiusFromXY(point, radius, po, idLicenca);

      /*** Gravar acesso no log ***/
 
View Full Code Here

  }

  public ProximityInfo findFromExtent(Extent ext, ProximityOptions po, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    ProximityInfo pi = new ProximityInfo();

    try {
      pi = px.findFromExtent(ext, po, idLicenca);

      /*** Gravar acesso no log ***/
 
View Full Code Here

  }

  public ProximityInfo findClosestFromXY(Point point, ProximityOptions po, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    ProximityInfo pi = new ProximityInfo();

    try {
      pi = px.findClosestFromXY(point, po, idLicenca);

      /*** Gravar acesso no log ***/
 
View Full Code Here

  static final int findFromExtent = 4;
 
  public static String runService(Proxy proxy, TokenValidated tk) throws Exception {
    String respostaWs = "";
        Object[] o;
        ProximityInfo pInfo;
       
        ConfigurationManager cm = ConfigurationManager.getInstance();
       
        CProximity cProximity = new CProximity(cm.getAppSettings("Maquina"), "");
View Full Code Here

      for (int w = 0; w < partMasterPOI.length; w++) {
        if (partMasterPOI[w].indexOf("POI_") >= 0) {
          if (!partMasterPOI[w].contains("POI_P:")) {
            if (ro.getRouteDetails().getPoiRoute() != null) {
              for (int i = 0; i < poiRouteIDs.length; i++) {
                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 (poi.getClientID().substring(0, poi.getClientID().indexOf(':')) == String.valueOf(poiRouteIDs[i])) {
                  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

TOP

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

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.