/** * @param file * @return * @throws FileNotFoundException * @throws UnsupportedEncodingException */ private static SvgFile createBackgroundFile(File file) throws UnsupportedEncodingException, FileNotFoundException { SvgFile svg = new SvgFile(file, MAG); svg.desc("DrawTrails of automics data, " + new Date()); svg.print("<filter id=\"desaturate\" primitiveUnits=\"objectBoundingBox\">"); // svg.print("<feImage x=\""+(500-width/2)+"\" y=\""+(500-width/2)+"\" width=\""+width+"\" // height=\""+width+"\" xlink:href=\"altontowers-zoom15.png\"/>"); svg.print( "<feImage x=\"0%\" y=\"0%\" width=\"100%\" height=\"100%\" xlink:href=\"altontowers-zoom15.png\"/>"); svg.print( "<feColorMatrix type=\"matrix\" values=\"0.3333 0.3333 0.3333 0 0 " + "0.3333 0.3333 0.3333 0 0 " + "0.3333 0.3333 0.3333 0 0 " + "0 0 0 1 0\"/>"); svg.print( "<feColorMatrix type=\"matrix\" values=\"0.3 0 0 0 0.7 " + "0 0.3 0 0 0.7 " + "0 0 0.3 0 0.7 " + "0 0 0 1 0\"/>"); svg.print("</filter>"); // zoom level - 2^zoom level tiles in x & y int zoom = 15; double imageWidth = 2 * Mercator.mercX(180) / Math.pow(2, zoom) * 640 / 256; svg.print( "<rect x=\"" + MAG * SCALE * 0.5 * (1 - imageWidth / width) + "\" y=\"" + MAG * SCALE * 0.5 * (1 - imageWidth / width) + "\" width=\"" + MAG * SCALE * (imageWidth / width) + "\" height=\"" + MAG * SCALE * (imageWidth / width) + "\" filter=\"url(#desaturate)\"/>"); return svg; }