Examples of HistoricoGPS


Examples of es.emergya.bbdd.bean.HistoricoGPS

          if (selectedItem == null) {
            return null;
          }
          if (selectedItem instanceof Recurso) {
            Recurso r = (Recurso) selectedItem;
            HistoricoGPS h = null;
            if (r.getId() != null) {
              h = HistoricoGPSConsultas.lastGPSForRecurso(r);
            } else
              try {
                h = r.getHistoricoGps();
              } catch (Throwable t) {
                h = null;
              }
            if (h == null) {
              return null;
            }
            view.zoomTo(Main.proj.latlon2eastNorth(new LatLon(h
                .getPosY(), h.getPosX())), view.getScale());
          } else if (selectedItem instanceof String) {
            String r = (String) selectedItem;
            HistoricoGPS h = HistoricoGPSConsultas
                .lastGPSForRecurso(r);
            if (h == null) {
              return null;
            }
            view.zoomTo(Main.proj.latlon2eastNorth(new LatLon(h
                .getPosY(), h.getPosX())), view.getScale());
          } else if (selectedItem instanceof GpxLayer) {
            MyGpxLayer r = (MyGpxLayer) selectedItem;
            if (r == null || r.getLatLon() == null) {
              return null;
            }
View Full Code Here

Examples of es.emergya.bbdd.bean.HistoricoGPS

    boolean vehiclesShowing = vehicles != null && vehicles.visible;

    Collection<Marker> peop = new LinkedList<Marker>();
    Collection<Marker> veh = new LinkedList<Marker>();
    for (Recurso r : allres) {
      HistoricoGPS h = r.getHistoricoGps();
      if (h == null) {
        continue;
      }
      WayPoint w = new WayPoint(new LatLon(h.getPosY(), h.getPosX()));
      String name = r.getNombre();

      if (r.getPatrullas() != null)
        name += " (" + r.getPatrullas().getNombre() + ")";
View Full Code Here

Examples of es.emergya.bbdd.bean.HistoricoGPS

              // y
              // hora
              // de
              // hoy
              if (recurso != null) {
                HistoricoGPS ultimaPosicionRecurso = HistoricoGPSConsultas
                    .lastGPSForRecurso(recurso);
                // Si hay última posición y es visible
                if (ultimaPosicionRecurso != null
                    && !ultimaPosicionRecurso
                        .getMarcaTemporal()
                        .before(new Date(
                            System.currentTimeMillis()
                                - LogicConstants
                                    .getInt("AVL_TIMEOUT")
                                * 6000))) {
                  point = new LatLon(
                      ultimaPosicionRecurso.getPosY(),
                      ultimaPosicionRecurso.getPosX());
                  printCoordinates(point);
                }
              }

              log.info("Buscamos los más cercanos a " + point);
              Recurso[] rs = RecursoConsultas.getNearest(
                  point.getX(), point.getY(), num,
                  Authentication.getUsuario());
              log.info("Tenemos los más cercanos a " + point
                  + ", que son " + rs.length);
              Vector<Vector<Object>> rows = new Vector<Vector<Object>>();
              int k = 0;
              for (Integer i = 0; i < rs.length && k < num - 1; i++) {
                k++;
                if (!isVisible(rs[i])
                    || (recurso != null && recurso.getId()
                        .equals(rs[i].getId()))) {
                  log.info("No se muestra " + rs[i]);
                  k--;
                  continue;

                }
                HistoricoGPS h = rs[i].getHistoricoGps();

                LatLon ll = new LatLon(h.getPosY(), h.getPosX());
                Integer dist = (int) ll
                    .greatCircleDistance(point);

                Vector<Object> row = new Vector<Object>();
                row.add(i);
View Full Code Here

Examples of es.emergya.bbdd.bean.HistoricoGPS

      return null;
    }
  }

  public Date lastGPSDateForRecurso(Recurso r) {
    final HistoricoGPS lastGPSForRecurso = lastGPSForRecurso(r);
    if (lastGPSForRecurso != null)
      return lastGPSForRecurso.getMarcaTemporal();
    else
      return null;
  }
View Full Code Here

Examples of es.emergya.bbdd.bean.HistoricoGPS

    return lastGPSForRecurso(r.getIdentificador());
  }

  @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true, rollbackFor = Throwable.class)
  public HistoricoGPS lastGPSForRecurso(String r) {
    HistoricoGPS res = null;
    if (r == null)
      return res;

    Session currentSession = getSession();
    currentSession.flush();
View Full Code Here

Examples of es.emergya.bbdd.bean.HistoricoGPS

    return res;
  }

  @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true, rollbackFor = Throwable.class)
  public Calendar firstGPSForRecurso(String r) {
    HistoricoGPS res = null;
    if (r == null)
      return null;

    Session currentSession = getSession();
    currentSession.flush();
    res = (HistoricoGPS) getSession().createCriteria(HistoricoGPS.class)
        .add(Restrictions.eq("recurso", r))
        .addOrder(Order.asc("marcaTemporal")).setMaxResults(1)
        .uniqueResult();

    if (res == null || res.getMarcaTemporal() == null)
      return null;

    Calendar resultado = Calendar.getInstance();
    resultado.setTime(res.getMarcaTemporal());

    return resultado;
  }
View Full Code Here

Examples of es.emergya.bbdd.bean.HistoricoGPS

  public HistoricoGPS saveOrUpdate(HistoricoGPS hgps) {

    Session currentSession = getSession();
    currentSession.clear();

    HistoricoGPS entity = null;

    if (hgps.getId() == null
        || (hgps.getId() != null && this.get(hgps.getId()) == null))
      entity = hgps;
    else
View Full Code Here

Examples of es.emergya.bbdd.bean.HistoricoGPS

    for (String idRecurso : idRecursos) {
      Criteria crit = getSession().createCriteria(HistoricoGPS.class)
          .add(Restrictions.eq("recurso", idRecurso))
          .addOrder(Order.desc("marcaTemporal")).setMaxResults(1);

      HistoricoGPS hist = (HistoricoGPS) crit.uniqueResult();
      Posicion p = new Posicion();
      if (hist != null) {
        p.setX(hist.getPosX());
        p.setY(hist.getPosY());
        p.setIdentificador(idRecurso);
        Calendar marcaTemporal = Calendar.getInstance();
        marcaTemporal
            .setTimeInMillis(hist.getMarcaTemporal().getTime());

        p.setMarcaTemporal(marcaTemporal);
        resultado.add(p);
      }
View Full Code Here

Examples of es.emergya.bbdd.bean.HistoricoGPS

    cargarGpx(file, "ultimas_posiciones");
    for (Posicion p : posiciones) {
      Recurso r = new Recurso();
      r.setId(null);
      r.setNombre(p.getIdentificador());
      HistoricoGPS gps = new HistoricoGPS();
      gps.setPosX(p.getX());
      gps.setPosY(p.getY());
      gps.setRecurso(r.toString());
      r.setHistoricoGps(gps);
      addRecurso(r);
    }
    if (this.visorHistorico != null) {
      visorHistorico.updateControls();
View Full Code Here

Examples of es.emergya.bbdd.bean.HistoricoGPS

    mp.processingMessage(entrada);

    final Recurso getbyDispositivo = RecursoConsultas
        .getbyDispositivo("08000002");
    if (getbyDispositivo != null) {
      HistoricoGPS historico = getbyDispositivo.getHistoricoGps();

      assertEquals(historico.getGeom().getSRID(), 4326);
      assertEquals((Double) (-x), (Double) historico.getPosX());
      assertEquals(y, (Double) historico.getPosY());
    }
    assertTrue(entrada.isProcesado());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.