public static BufferedImage drawDistrictsByZipCode( String countryFile, int totalcolors, double min, double max, String[][] districts) { String cf = ""; SAXReader reader = new SAXReader(false); try { String sDoc = MedwanQuery.getInstance().getConfigString("templateSource") + countryFile; Document document = reader.read(new URL(sDoc)); Element root = document.getRootElement(); cf = root.attributeValue("directory") + "/" + root.attributeValue("countrymap"); } catch (Exception e) { if (Debug.enabled) Debug.println(e.getMessage()); } BufferedImage resultImage = toBufferedImage(Miscelaneous.getImage(cf)); for (int n = 0; n < districts.length; n++) { if (districts[n] != null) { District district = District.getDistrictWithZipcode(countryFile, districts[n][0]); if (district != null) { BufferedImage im1 = toBufferedImage( replaceColor( Miscelaneous.getImage(district.getMap()), 0xffff0000, getColor(totalcolors, min, max, Double.parseDouble(districts[n][1])))); resultImage = createComposite(resultImage, im1, 1f); } } } return resultImage; }
public static BufferedImage drawDistrictsById( String countryFile, int totalcolors, double min, double max, double[][] districts) { String cf = ""; SAXReader reader = new SAXReader(false); try { String sDoc = Constants.CLASSPATH + "/xml/" + countryFile; Document document = reader.read(new URL(sDoc)); Element root = document.getRootElement(); cf = root.attributeValue("directory") + "/" + root.attributeValue("countrymap"); } catch (Exception e) { if (Debug.enabled) Debug.println(e.getMessage()); } BufferedImage resultImage = toBufferedImage(Miscelaneous.getImage(cf)); for (int n = 0; n < districts.length; n++) { if (districts[n] != null) { District district = District.getDistrictWithId(countryFile, new Double(districts[n][0]).intValue() + ""); if (district != null) { int color = getColor(totalcolors, min, max, districts[n][1]); BufferedImage im1 = toBufferedImage( replaceColor(Miscelaneous.getImage(district.getMap()), 0xffff0000, color)); resultImage = createComposite(resultImage, im1, 1f); } } } return resultImage; }