Search in sources :

Example 1 with MarkerIcon

use of de.symeda.sormas.ui.map.MarkerIcon in project SORMAS-Project by hzi-braunschweig.

the class DashboardMapComponent method showCaseMarkers.

private void showCaseMarkers(List<MapCaseDto> cases) {
    clearCaseMarkers();
    fillCaseLists(cases);
    List<LeafletMarker> caseMarkers = new ArrayList<LeafletMarker>();
    for (FacilityReferenceDto facilityReference : casesByFacility.keySet()) {
        List<MapCaseDto> casesList = casesByFacility.get(facilityReference);
        // colorize the icon by the "strongest" classification type (order as in enum)
        // and set its size depending
        // on the number of cases
        int numberOfCases = casesList.size();
        Set<CaseClassification> classificationSet = new HashSet<>();
        for (MapCaseDto caze : casesList) {
            classificationSet.add(caze.getCaseClassification());
        }
        MarkerIcon icon;
        if (classificationSet.contains(CaseClassification.CONFIRMED)) {
            icon = MarkerIcon.FACILITY_CONFIRMED;
        } else if (classificationSet.contains(CaseClassification.PROBABLE)) {
            icon = MarkerIcon.FACILITY_PROBABLE;
        } else if (classificationSet.contains(CaseClassification.SUSPECT)) {
            icon = MarkerIcon.FACILITY_SUSPECT;
        } else {
            icon = MarkerIcon.FACILITY_UNCLASSIFIED;
        }
        // create and place the marker
        markerCaseFacilities.add(facilityReference);
        MapCaseDto firstCase = casesList.get(0);
        LeafletMarker leafletMarker = new LeafletMarker();
        leafletMarker.setLatLon(firstCase.getHealthFacilityLat(), firstCase.getHealthFacilityLon());
        leafletMarker.setIcon(icon);
        leafletMarker.setMarkerCount(numberOfCases);
        caseMarkers.add(leafletMarker);
    }
    for (MapCaseDto caze : mapCaseDtos) {
        LeafletMarker marker = new LeafletMarker();
        CaseClassification caseClassification = caze.getCaseClassification();
        if (caseClassification == CaseClassification.CONFIRMED || caseClassification == CaseClassification.CONFIRMED_NO_SYMPTOMS || caseClassification == CaseClassification.CONFIRMED_UNKNOWN_SYMPTOMS) {
            marker.setIcon(MarkerIcon.CASE_CONFIRMED);
        } else if (caseClassification == CaseClassification.PROBABLE) {
            marker.setIcon(MarkerIcon.CASE_PROBABLE);
        } else if (caseClassification == CaseClassification.SUSPECT) {
            marker.setIcon(MarkerIcon.CASE_SUSPECT);
        } else {
            marker.setIcon(MarkerIcon.CASE_UNCLASSIFIED);
        }
        if (caze.getAddressLat() != null && caze.getAddressLon() != null) {
            marker.setLatLon(caze.getAddressLat(), caze.getAddressLon());
        } else {
            marker.setLatLon(caze.getReportLat(), caze.getReportLon());
        }
        caseMarkers.add(marker);
    }
    map.addMarkerGroup("cases", caseMarkers);
}
Also used : MapCaseDto(de.symeda.sormas.api.caze.MapCaseDto) FacilityReferenceDto(de.symeda.sormas.api.infrastructure.facility.FacilityReferenceDto) CaseClassification(de.symeda.sormas.api.caze.CaseClassification) LeafletMarker(de.symeda.sormas.ui.map.LeafletMarker) ArrayList(java.util.ArrayList) MarkerIcon(de.symeda.sormas.ui.map.MarkerIcon) HashSet(java.util.HashSet)

Example 2 with MarkerIcon

use of de.symeda.sormas.ui.map.MarkerIcon in project SORMAS-Project by hzi-braunschweig.

the class DashboardMapComponent method showEventMarkers.

private void showEventMarkers(List<DashboardEventDto> events) {
    clearEventMarkers();
    List<LeafletMarker> eventMarkers = new ArrayList<LeafletMarker>();
    for (DashboardEventDto event : events) {
        MarkerIcon icon;
        switch(event.getEventStatus()) {
            case EVENT:
                icon = MarkerIcon.EVENT_OUTBREAK;
                break;
            case SIGNAL:
                icon = MarkerIcon.EVENT_RUMOR;
                break;
            default:
                continue;
        }
        // Because events are pulled from the dashboardDataProvider, we do not need to add additional filters for event dates here
        LeafletMarker marker = new LeafletMarker();
        if (event.getLocationLat() != null && event.getLocationLon() != null) {
            marker.setLatLon(event.getLocationLat(), event.getLocationLon());
        } else if (event.getReportLat() != null && event.getReportLon() != null) {
            marker.setLatLon(event.getReportLat(), event.getReportLon());
        } else if (event.getDistrict() != null) {
            GeoLatLon districtCenter = FacadeProvider.getGeoShapeProvider().getCenterOfDistrict(event.getDistrict());
            if (districtCenter != null) {
                marker.setLatLon(districtCenter.getLat(), districtCenter.getLon());
            } else {
                GeoLatLon countryCenter = FacadeProvider.getConfigFacade().getCountryCenter();
                marker.setLatLon(countryCenter.getLat(), countryCenter.getLon());
            }
        } else {
            continue;
        }
        marker.setIcon(icon);
        markerEvents.add(event);
        eventMarkers.add(marker);
    }
    map.addMarkerGroup(EVENTS_GROUP_ID, eventMarkers);
}
Also used : LeafletMarker(de.symeda.sormas.ui.map.LeafletMarker) ArrayList(java.util.ArrayList) DashboardEventDto(de.symeda.sormas.api.dashboard.DashboardEventDto) MarkerIcon(de.symeda.sormas.ui.map.MarkerIcon) GeoLatLon(de.symeda.sormas.api.geo.GeoLatLon)

Example 3 with MarkerIcon

use of de.symeda.sormas.ui.map.MarkerIcon in project SORMAS-Project by hzi-braunschweig.

the class DashboardMapComponent method showContactMarkers.

private void showContactMarkers(List<MapContactDto> contacts) {
    clearContactMarkers();
    List<LeafletMarker> contactMarkers = new ArrayList<LeafletMarker>();
    for (MapContactDto contact : contacts) {
        // Don't show a marker for contacts that don't have geo coordinates
        if (contact.getAddressLat() == null || contact.getAddressLon() == null) {
            if (contact.getReportLat() == null || contact.getReportLon() == null) {
                continue;
            }
        }
        // Don't show a marker for contacts that are filtered out
        if (!showUnconfirmedContacts && contact.getContactClassification() == ContactClassification.UNCONFIRMED) {
            continue;
        }
        if (!showConfirmedContacts && contact.getContactClassification() != ContactClassification.UNCONFIRMED) {
            continue;
        }
        MarkerIcon icon;
        // }
        switch(contact.getContactClassification()) {
            case CONFIRMED:
                icon = MarkerIcon.CONTACT_LONG_OVERDUE;
                break;
            case UNCONFIRMED:
                icon = MarkerIcon.CONTACT_OVERDUE;
                break;
            case NO_CONTACT:
                icon = MarkerIcon.CONTACT_OK;
                break;
            default:
                icon = MarkerIcon.CONTACT_OK;
                break;
        }
        LeafletMarker marker = new LeafletMarker();
        marker.setIcon(icon);
        if (contact.getAddressLat() != null && contact.getAddressLon() != null) {
            marker.setLatLon(contact.getAddressLat(), contact.getAddressLon());
        } else {
            marker.setLatLon(contact.getReportLat(), contact.getReportLon());
        }
        markerContacts.add(contact);
        contactMarkers.add(marker);
    }
    map.addMarkerGroup(CONTACTS_GROUP_ID, contactMarkers);
}
Also used : MapContactDto(de.symeda.sormas.api.contact.MapContactDto) LeafletMarker(de.symeda.sormas.ui.map.LeafletMarker) ArrayList(java.util.ArrayList) MarkerIcon(de.symeda.sormas.ui.map.MarkerIcon)

Aggregations

LeafletMarker (de.symeda.sormas.ui.map.LeafletMarker)3 MarkerIcon (de.symeda.sormas.ui.map.MarkerIcon)3 ArrayList (java.util.ArrayList)3 CaseClassification (de.symeda.sormas.api.caze.CaseClassification)1 MapCaseDto (de.symeda.sormas.api.caze.MapCaseDto)1 MapContactDto (de.symeda.sormas.api.contact.MapContactDto)1 DashboardEventDto (de.symeda.sormas.api.dashboard.DashboardEventDto)1 GeoLatLon (de.symeda.sormas.api.geo.GeoLatLon)1 FacilityReferenceDto (de.symeda.sormas.api.infrastructure.facility.FacilityReferenceDto)1 HashSet (java.util.HashSet)1