@Test public void testProcessingMessagePosicion() throws MessageProcessingException { final Double y = new Double(42.349167); final Double x = new Double(3.684722); MessageProcessor mp = new MessageProcessor(); Inbox entrada = new Inbox(); entrada.setDatagramaTetra("|16|" + y + ",N|" + x + ",W|1|"); entrada.setMarcaTemporal(Calendar.getInstance().getTime()); entrada.setOrigen("08000002"); entrada.setProcesado(false); 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()); }
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; } }