diff --git a/opensrp-eusm/src/main/assets/reveal-streets-satellite.json b/opensrp-eusm/src/main/assets/reveal-streets-satellite.json index 3fb5f34..fa7e7af 100644 --- a/opensrp-eusm/src/main/assets/reveal-streets-satellite.json +++ b/opensrp-eusm/src/main/assets/reveal-streets-satellite.json @@ -63,13 +63,9 @@ "zoom" ], 7.0, - 17, + 13, 13.0, - 30, - 15.0, - 35, - 17.79, - 45 + 15 ], "circle-color": [ "match", @@ -111,13 +107,9 @@ "zoom" ], 7.0, - 17, + 13, 13.0, - 30, - 15.0, - 35, - 17.79, - 45 + 15 ], "circle-stroke-width": 2, "circle-stroke-color": "hsl(0, 0%, 0%)" diff --git a/opensrp-eusm/src/main/java/org/smartregister/eusm/config/AppTaskingLibraryConfiguration.java b/opensrp-eusm/src/main/java/org/smartregister/eusm/config/AppTaskingLibraryConfiguration.java index 1c64a3b..21f6e29 100644 --- a/opensrp-eusm/src/main/java/org/smartregister/eusm/config/AppTaskingLibraryConfiguration.java +++ b/opensrp-eusm/src/main/java/org/smartregister/eusm/config/AppTaskingLibraryConfiguration.java @@ -452,7 +452,7 @@ public void run() { eusmCardDetail.setStructureId(AppUtils.getStringFromJsonElement(jsonObject, AppConstants.CardDetailKeys.STRUCTURE_ID)); eusmCardDetail.setTaskStatus(AppUtils.getStringFromJsonElement(jsonObject, AppConstants.CardDetailKeys.TASK_STATUS)); eusmCardDetail.setStructureName(AppUtils.getStringFromJsonElement(jsonObject, AppConstants.CardDetailKeys.NAME)); - eusmCardDetail.setStructureType(AppUtils.getStringFromJsonElement(jsonObject, AppConstants.CardDetailKeys.TYPE)); + eusmCardDetail.setStructureType(AppUtils.getStringFromJsonElement(jsonObject, AppConstants.CardDetailKeys.TYPE_TEXT)); eusmCardDetail.setCommuneId(AppUtils.getStringFromJsonElement(jsonObject, AppConstants.CardDetailKeys.COMMUNE_ID)); getAppExecutors().mainThread().execute(new Runnable() { @Override diff --git a/opensrp-eusm/src/main/java/org/smartregister/eusm/config/ServicePointType.java b/opensrp-eusm/src/main/java/org/smartregister/eusm/config/ServicePointType.java index 23afcb7..72430c9 100644 --- a/opensrp-eusm/src/main/java/org/smartregister/eusm/config/ServicePointType.java +++ b/opensrp-eusm/src/main/java/org/smartregister/eusm/config/ServicePointType.java @@ -5,8 +5,8 @@ import org.smartregister.eusm.R; public enum ServicePointType { - CSB1("cbs1", R.drawable.ic_health_sp, "cbs1"), - CSB2("cbs2", R.drawable.ic_health_sp, "cbs2"), + CSB1("csb1", R.drawable.ic_health_sp, "csb1"), + CSB2("csb2", R.drawable.ic_health_sp, "csb2"), CHRD1("chrd1", R.drawable.ic_hospital_sp, "chrd1"), CHRD2("chrd2", R.drawable.ic_hospital_sp, "chrd2"), CHRR("chrr", R.drawable.ic_hospital_sp, "chrr"), diff --git a/opensrp-eusm/src/main/java/org/smartregister/eusm/helper/EusmTaskingMapHelper.java b/opensrp-eusm/src/main/java/org/smartregister/eusm/helper/EusmTaskingMapHelper.java index 404d440..f3e60e8 100644 --- a/opensrp-eusm/src/main/java/org/smartregister/eusm/helper/EusmTaskingMapHelper.java +++ b/opensrp-eusm/src/main/java/org/smartregister/eusm/helper/EusmTaskingMapHelper.java @@ -38,9 +38,7 @@ public class EusmTaskingMapHelper extends TaskingMapHelper { public void addCustomLayers(@NonNull Style mMapboxMapStyle, @NonNull Context context) { if (!isSymbolLayersLoaded) { Expression dynamicIconSize = interpolate(linear(), zoom(), - literal(11.98f), literal(1.2f), - literal(17.79f), literal(3f), - literal(18.8f), literal(3f)); + literal(0.98f), literal(0.9f)); Map servicePointTypeMap = EusmApplication.getInstance().getServicePointKeyToType(); for (Map.Entry entry : servicePointTypeMap.entrySet()) { @@ -51,7 +49,7 @@ public void addCustomLayers(@NonNull Style mMapboxMapStyle, @NonNull Context con SymbolLayer symbolLayer = new SymbolLayer(String.format("%s.layer", key), context.getString(R.string.reveal_datasource_name)); symbolLayer.setProperties(iconImage(key), iconSize(dynamicIconSize), iconIgnorePlacement(true), iconAllowOverlap(true)); - symbolLayer.setFilter(eq(get(AppConstants.CardDetailKeys.TYPE), servicePointType.text)); + symbolLayer.setFilter(eq(get(AppConstants.CardDetailKeys.TYPE), servicePointType.name)); mMapboxMapStyle.addLayer(symbolLayer); } } diff --git a/opensrp-eusm/src/main/java/org/smartregister/eusm/util/AppConstants.java b/opensrp-eusm/src/main/java/org/smartregister/eusm/util/AppConstants.java index 20eb159..2b3928c 100644 --- a/opensrp-eusm/src/main/java/org/smartregister/eusm/util/AppConstants.java +++ b/opensrp-eusm/src/main/java/org/smartregister/eusm/util/AppConstants.java @@ -140,6 +140,7 @@ interface CardDetailKeys { String NAME = "name"; String TYPE = "type"; String COMMUNE_ID = "communeId"; + String TYPE_TEXT = "typeText"; } interface LocationLevels { diff --git a/opensrp-eusm/src/main/java/org/smartregister/eusm/util/GeoJsonUtils.java b/opensrp-eusm/src/main/java/org/smartregister/eusm/util/GeoJsonUtils.java index ffed356..91050e1 100644 --- a/opensrp-eusm/src/main/java/org/smartregister/eusm/util/GeoJsonUtils.java +++ b/opensrp-eusm/src/main/java/org/smartregister/eusm/util/GeoJsonUtils.java @@ -1,6 +1,7 @@ package org.smartregister.eusm.util; import org.smartregister.domain.Location; +import org.smartregister.domain.LocationProperty; import org.smartregister.eusm.domain.StructureDetail; import java.util.ArrayList; @@ -21,9 +22,14 @@ public String getGeoJsonFromStructureDetail(List structureDetai Location location = structureDetail.getGeojson(); if (location != null) { String taskStatus = structureDetail.getTaskStatus(); - Map map = location.getProperties().getCustomProperties(); + LocationProperty locationProperty = location.getProperties(); + if (structureDetail.getStructureType() != null) { + locationProperty.setType(structureDetail.getStructureType().toLowerCase().trim().replace(" ", "")); + } + Map map = locationProperty.getCustomProperties(); map.put(AppConstants.CardDetailKeys.TASK_STATUS, taskStatus); map.put(STRUCTURE_NAME, structureDetail.getEntityName()); + map.put(AppConstants.CardDetailKeys.TYPE_TEXT, structureDetail.getStructureType()); map.put(AppConstants.CardDetailKeys.COMMUNE, structureDetail.getCommune()); map.put(AppConstants.CardDetailKeys.COMMUNE_ID, structureDetail.getParentId()); map.put(AppConstants.CardDetailKeys.DISTANCE_META, structureDetail.getDistanceMeta()); diff --git a/opensrp-eusm/src/test/java/org/smartregister/eusm/util/GeoJsonUtilsTest.java b/opensrp-eusm/src/test/java/org/smartregister/eusm/util/GeoJsonUtilsTest.java index b7aa48b..3f9aae7 100644 --- a/opensrp-eusm/src/test/java/org/smartregister/eusm/util/GeoJsonUtilsTest.java +++ b/opensrp-eusm/src/test/java/org/smartregister/eusm/util/GeoJsonUtilsTest.java @@ -39,6 +39,7 @@ public void testGetGeoJsonFromStructureDetailShouldReturnJsonStringWithMoreProps structureDetail.setCommune("Amabtorohanana"); structureDetail.setStructureId(UUID.randomUUID().toString()); structureDetail.setTaskStatus(Task.TaskStatus.READY.toString()); + structureDetail.setStructureType("waterpoint"); String jsonArrayString = geoJsonUtils.getGeoJsonFromStructureDetail(Collections.singletonList(structureDetail)); List structures = JsonFormUtils.gson.fromJson(jsonArrayString, new TypeToken>() { }.getType());