예제 #1
0
  private void updateIncidences(final LatLon topleft, final LatLon bottomright) {
    MarkerLayer layer = null;
    // tomar las capas vehiculo y persona
    for (Layer l : getAllLayers()) {
      if (l.name.equals(Internacionalization.getString("Incidences.incidences"))) {
        layer = (MarkerLayer) l;
        break;
      }
    }
    if (layer == null) return;

    List<Incidencia> allres = IncidenciaConsultas.getOpened();
    Collection<Marker> nuevoData = new LinkedList<Marker>();

    for (Incidencia i : allres) {
      try {
        if (i.getGeometria() != null) {
          final com.vividsolutions.jts.geom.Point centroid = i.getGeometria().getCentroid();
          if (centroid != null) {
            LatLon latlon = new LatLon(centroid.getCoordinate().y, centroid.getCoordinate().x);
            WayPoint w = new WayPoint(latlon);
            w.attr.put("name", i.getTitulo() + " (" + i.getPrioridad() + ")");
            w.attr.put(
                "symbol",
                LogicConstants.get("DIRECTORIO_ICONOS_INCIDENCIAS", "incidencia/")
                    + "incidencia_"
                    + i.getEstado().toString()
                    + "_"
                    + i.getCategoria().toString()
                    + "_"
                    + i.getPrioridad().toString());
            w.attr.put(
                "color",
                LogicConstants.get("COLOR_ESTADO_INC_" + i.getEstado().getId(), "#000000"));

            CustomMarker<Long, Incidencia> marker =
                new CustomMarker<Long, Incidencia>(w, layer, i.getId(), Type.INCIDENCE);
            marker.setObject(i);
            nuevoData.add(marker);
          }
        }
      } catch (Throwable t) {
        log.error("Error al intentar pintar una incidencia", t);
      }
    }

    layer.data = nuevoData;
  }
예제 #2
0
  private void updateResources(final LatLon topleft, final LatLon bottomright) {
    MarkerLayer people = null, vehicles = null;
    // tomar las capas vehiculo y persona
    for (Layer l : getAllLayers()) {
      if (l.name.equalsIgnoreCase(Internacionalization.getString("Resources.resources.people"))) {
        people = (MarkerLayer) l;
      }
      if (l.name.equalsIgnoreCase(Internacionalization.getString("Resources.resources.vehicles"))) {
        vehicles = (MarkerLayer) l;
      }
      if (people != null && vehicles != null) {
        break;
      }
    }

    if (getParent() instanceof MapViewer) { // actualizar los recursos
      // disponibles
      ((MapViewer) getParent()).updateControls();
    }

    List<Recurso> allres = RecursoConsultas.getAll(Authentication.getUsuario());

    boolean peopleShowing = people != null && people.visible;
    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() + ")";

      w.attr.put("name", name);
      w.attr.put(
          "symbol",
          LogicConstants.get("DIRECTORIO_ICONOS_FLOTAS") + "/" + r.getFlotas().getJuegoIconos());
      // w.attr.put("color", LogicConstants.get("COLOR_ESTADO_REC_"
      // + r.getEstadoEurocop().getId(), "#000000"));
      if (peopleShowing && r.getTipo().equalsIgnoreCase(Recurso.PERSONA)) {
        CustomMarker<String, Recurso> marker =
            new CustomMarker<String, Recurso>(w, people, r.getIdentificador(), Type.RESOURCE);
        marker.setObject(r);
        peop.add(marker);
      } else if (vehiclesShowing && r.getTipo().equalsIgnoreCase(Recurso.VEHICULO)) {

        CustomMarker<String, Recurso> marker =
            new CustomMarker<String, Recurso>(w, vehicles, r.getIdentificador(), Type.RESOURCE);
        marker.setObject(r);
        veh.add(marker);
      }
    }
    if (people != null) {
      people.data = peop;
    }
    if (vehicles != null) {
      vehicles.data = veh;
    }
  }