private void shadeCountries() { for (Marker marker : countryMarkers) { // Find data for country of the current marker String countryId = marker.getId(); if (lifeExpByCountry.containsKey(countryId)) { float lifeExp = lifeExpByCountry.get(countryId); int colorLevel = (int) map(lifeExp, 40, 90, 10, 255); marker.setColor(color(255 - colorLevel, 100, colorLevel)); } else { marker.setColor(color(150, 150, 150)); } } }
private void shadeCountries() { for (Marker marker : coutryMarkers) { String coutryId = marker.getId(); if (lifeExpByCountry.containsKey(coutryId)) { float lifeExp = lifeExpByCountry.get(coutryId); // now encode values as brightness (values range between 40-90) int colorLevel = (int) map(lifeExp, 40, 90, 10, 255); marker.setColor(color(255 - colorLevel, 100, colorLevel)); } else { marker.setColor(color(150, 150, 150)); } } }
@Test public void testCountryMarker() { addCountryMarker(); Location berlinLocation = new Location(52.5f, 13.4f); Location pragueLocation = new Location(50.08f, 14.42f); for (Marker marker : map.getMarkers()) { if ("DEU".equals(marker.getId())) { AbstractShapeMarker shapeMarker = (AbstractShapeMarker) marker; assertTrue(shapeMarker.isInsideByLocation(berlinLocation)); assertFalse(shapeMarker.isInsideByLocation(pragueLocation)); } } }