Changeset 3858
- Timestamp:
- 11/02/11 23:20:25 (7 months ago)
- Location:
- print/trunk
- Files:
-
- 7 modified
-
. (modified) (1 prop)
-
docs/configuration.txt (modified) (1 diff)
-
src/main/java/org/mapfish/print/Transformer.java (modified) (18 diffs)
-
src/main/java/org/mapfish/print/config/Config.java (modified) (2 diffs)
-
src/main/java/org/mapfish/print/config/layout/MapBlock.java (modified) (1 diff)
-
src/main/java/org/mapfish/print/map/renderers/SVGTileRenderer.java (modified) (1 diff)
-
src/main/webapp (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
-
print/trunk
- Property svn:ignore
-
old new 3 3 build 4 4 target 5 .project 6 .classpath 7 .git 8 deploy.sh 9 build_and_deploy.sh 10 lib 11 build.sh 12 bin 13 .settings 14
-
- Property svn:ignore
-
print/trunk/docs/configuration.txt
r3856 r3858 12 12 - 190 13 13 {...} 14 15 ?maxSvgWidth: 2048 # set the maximum dimensions to 2048 points, this is useful when using MapServer and a maximum dimension is there 16 ?maxSvgHeight: 2048 17 ?integerSvg: false # the library in MapServer <= 5.6 does not support floating point values in the SVG coordinate space, set this to true if using a WMS that does not support floating point values in SVG coordinates 18 14 19 ?outputFormats: 15 20 - pdf -
print/trunk/src/main/java/org/mapfish/print/Transformer.java
r3789 r3858 35 35 */ 36 36 public class Transformer implements Cloneable { 37 private static final String GOOGLE_WKT = "PROJCS[\"Google Mercator\"," 38 + "GEOGCS[\"WGS 84\"," 39 + "DATUM[\"World Geodetic System 1984\"," 40 + "SPHEROID[\"WGS 84\", 6378137.0, 298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]," 41 + "AUTHORITY[\"EPSG\",\"6326\"]]," 42 + "PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]]," 43 + "UNIT[\"degree\", 0.017453292519943295]," 44 + "AXIS[\"Geodetic latitude\", NORTH]," 45 + "AXIS[\"Geodetic longitude\", EAST]," 46 + "AUTHORITY[\"EPSG\",\"4326\"]]," 47 + "PROJECTION[\"Mercator_1SP\"]," 48 + "PARAMETER[\"semi_minor\", 6378137.0]," 49 + "PARAMETER[\"latitude_of_origin\", 0.0]," 50 + "PARAMETER[\"central_meridian\", 0.0]," 51 + "PARAMETER[\"scale_factor\", 1.0]," 52 + "PARAMETER[\"false_easting\", 0.0]," 53 + "PARAMETER[\"false_northing\", 0.0]," 54 + "UNIT[\"m\", 1.0]," + "AXIS[\"Easting\", EAST]," 55 + "AXIS[\"Northing\", NORTH]," 56 + "AUTHORITY[\"EPSG\",\"900913\"]]"; 57 58 59 60 private int svgFactor; 37 private static final String GOOGLE_WKT = "PROJCS[\"Google Mercator\"," 38 + "GEOGCS[\"WGS 84\"," 39 + "DATUM[\"World Geodetic System 1984\"," 40 + "SPHEROID[\"WGS 84\", 6378137.0, 298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]," 41 + "AUTHORITY[\"EPSG\",\"6326\"]]," 42 + "PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]]," 43 + "UNIT[\"degree\", 0.017453292519943295]," 44 + "AXIS[\"Geodetic latitude\", NORTH]," 45 + "AXIS[\"Geodetic longitude\", EAST]," 46 + "AUTHORITY[\"EPSG\",\"4326\"]]," 47 + "PROJECTION[\"Mercator_1SP\"]," 48 + "PARAMETER[\"semi_minor\", 6378137.0]," 49 + "PARAMETER[\"latitude_of_origin\", 0.0]," 50 + "PARAMETER[\"central_meridian\", 0.0]," 51 + "PARAMETER[\"scale_factor\", 1.0]," 52 + "PARAMETER[\"false_easting\", 0.0]," 53 + "PARAMETER[\"false_northing\", 0.0]," + "UNIT[\"m\", 1.0]," 54 + "AXIS[\"Easting\", EAST]," + "AXIS[\"Northing\", NORTH]," 55 + "AUTHORITY[\"EPSG\",\"900913\"]]"; 56 57 private float svgFactor = 1.0f; 61 58 public float minGeoX; 62 59 public float minGeoY; … … 77 74 78 75 /** 76 * @param centerX 77 * geographic center in projection - x 78 * @param centerY 79 * geographic center in projection - y 80 * @param paperWidth 81 * e.g. map width in pt on the PDF 82 * @param paperHeight 83 * e.g. map height in pt on the PDF 84 * @param scale 85 * e.g. 10000 if scale is 1:10,000 86 * @param dpi 87 * as selected in request 88 * @param unitEnum 89 * the distance unit of the map e.g. DistanceUnit.M for meters 90 * @param rotation 91 * the rotation of the map per the request 79 92 * @param geodeticSRS 80 93 * if not null then it is a the srs to use with the geodetic … … 83 96 public Transformer(float centerX, float centerY, float paperWidth, 84 97 float paperHeight, int scale, int dpi, DistanceUnit unitEnum, 85 double rotation, String geodeticSRS ) {98 double rotation, String geodeticSRS, RenderingContext context) { 86 99 this.dpi = dpi; 87 100 pixelPerGeoUnit = (float) (unitEnum.convertTo(dpi, DistanceUnit.IN) / scale); … … 90 103 float geoHeight = paperHeight * dpi / 72.0f / pixelPerGeoUnit; 91 104 92 //target at least 600DPI for the SVG precision 93 svgFactor = Math.max((600 + dpi - 1) / dpi, 1); 105 /** 106 * The following code has been changed due to the fact that it seems 107 * wrong. However, I'm not sure if my "correction" solves the problem 108 * for the better. So, please review. 109 * 110 * The ('wrong') code below can be reformed: (600 + dpi - 1) / dpi = 1 + 111 * 599/dpi and is never smaller than 1, since dpi>1. Also, it does not 112 * make sense, as this factor gets smaller with increasing values for 113 * dpi. 114 */ 115 // target at least 600DPI for the SVG precision 116 // svgFactor = Math.max((600 + dpi - 1) / dpi, 1); 117 118 /** 119 * svgFactor seems to not matter so much so we set it to 1 (above) needs 120 * to get bigger if DPI increases and at standard 72 DPI needs to be 1.0 121 */ 122 if (context.getConfig().getIntegerSvg()) { // integerSvg: true # in yaml 123 // config file 124 if (dpi < 600) { // target at least 600 DPI, this is a hack and only 125 // needed for MapServer <= 5.6 where integers 126 // are put into SVG 127 svgFactor = 600f / 72.0f; 128 /** 129 * = 8.33 so almost 9 as before with svgFactor being (600 + dpi 130 * -1)/dpi = ~9 if dpi = 72 131 */ 132 } else { 133 svgFactor = dpi / 72.0f; // gets greater than 8.33 134 } 135 } // else defaults to 1.0 as it should with MapServer >= 6 and CAIRO SVG 136 // rendering with floating point values 94 137 95 138 this.paperWidth = paperWidth; … … 97 140 this.scale = scale; 98 141 this.rotation = rotation; 99 142 100 143 if (geodeticSRS != null) { 101 144 computeGeodeticBBox(geoWidth, geoHeight, centerX, centerY, dpi, … … 163 206 if (rotation != 0.0) { 164 207 double height = getStraightBitmapH(); 165 width = Math.abs(width * Math.cos(rotation)) + Math.abs(height * Math.sin(rotation)); 208 width = Math.abs(width * Math.cos(rotation)) 209 + Math.abs(height * Math.sin(rotation)); 166 210 } 167 211 return Math.round(width); … … 172 216 if (rotation != 0.0) { 173 217 double width = getStraightBitmapW(); 174 height = Math.abs(height * Math.cos(rotation)) + Math.abs(width * Math.sin(rotation)); 218 height = Math.abs(height * Math.cos(rotation)) 219 + Math.abs(width * Math.sin(rotation)); 175 220 } 176 221 return Math.round(height); … … 181 226 if (rotation != 0.0) { 182 227 float height = getGeoH(); 183 width = (float) (Math.abs(width * Math.cos(rotation)) + Math.abs(height * Math.sin(rotation))); 228 width = (float) (Math.abs(width * Math.cos(rotation)) + Math 229 .abs(height * Math.sin(rotation))); 184 230 } 185 231 return width; … … 190 236 if (rotation != 0.0) { 191 237 float width = getGeoW(); 192 height = (float) (Math.abs(height * Math.cos(rotation)) + Math.abs(width * Math.sin(rotation))); 238 height = (float) (Math.abs(height * Math.cos(rotation)) + Math 239 .abs(width * Math.sin(rotation))); 193 240 } 194 241 return height; … … 199 246 if (rotation != 0.0) { 200 247 float height = getPaperH(); 201 width = (float) (Math.abs(width * Math.cos(rotation)) + Math.abs(height * Math.sin(rotation))); 248 width = (float) (Math.abs(width * Math.cos(rotation)) + Math 249 .abs(height * Math.sin(rotation))); 202 250 } 203 251 return width; … … 208 256 if (rotation != 0.0) { 209 257 float width = getPaperW(); 210 height = (float) (Math.abs(height * Math.cos(rotation)) + Math.abs(width * Math.sin(rotation))); 258 height = (float) (Math.abs(height * Math.cos(rotation)) + Math 259 .abs(width * Math.sin(rotation))); 211 260 } 212 261 return height; … … 230 279 231 280 public long getRotatedSvgW() { 232 return getRotatedBitmapW() * svgFactor;281 return (long) (getRotatedBitmapW() * svgFactor); 233 282 } 234 283 235 284 public long getRotatedSvgH() { 236 return getRotatedBitmapH() * svgFactor;285 return (long) (getRotatedBitmapH() * svgFactor); 237 286 } 238 287 … … 271 320 */ 272 321 public AffineTransform getBaseTransform() { 273 final AffineTransform result = AffineTransform.getTranslateInstance(paperPosX, paperPosY); 322 final AffineTransform result = AffineTransform.getTranslateInstance( 323 paperPosX, paperPosY); 274 324 if (rotation != 0.0F) { 275 325 result.translate(getPaperW() / 2, getPaperH() / 2); … … 281 331 282 332 /** 283 * @param reverseRotation True to do the rotation in the other direction 284 * @return The affine transformation to go from geographic coordinated to paper coordinates 333 * @param reverseRotation 334 * True to do the rotation in the other direction 335 * @return The affine transformation to go from geographic coordinated to 336 * paper coordinates 285 337 */ 286 338 public AffineTransform getGeoTransform(boolean reverseRotation) { 287 final AffineTransform result = AffineTransform.getTranslateInstance(paperPosX, paperPosY); 339 final AffineTransform result = AffineTransform.getTranslateInstance( 340 paperPosX, paperPosY); 288 341 if (rotation != 0.0F) { 289 result.rotate((reverseRotation ? -1 : 1) * rotation, getPaperW() / 2, getPaperH() / 2); 342 result.rotate((reverseRotation ? -1 : 1) * rotation, 343 getPaperW() / 2, getPaperH() / 2); 290 344 } 291 345 result.scale(getPaperW() / getGeoW(), getPaperH() / getGeoH()); … … 296 350 public AffineTransform getSvgTransform() { 297 351 final AffineTransform result = getBaseTransform(); 298 result.scale(getPaperW() / getStraightSvgW(), getPaperH() / getStraightSvgH()); 352 result.scale(getPaperW() / getStraightSvgW(), getPaperH() 353 / getStraightSvgH()); 299 354 return result; 300 355 } … … 302 357 public AffineTransform getPdfTransform() { 303 358 final AffineTransform result = getBaseTransform(); 304 result.scale(getPaperW() / getStraightBitmapW(), getPaperH() / getStraightBitmapH()); 359 result.scale(getPaperW() / getStraightBitmapW(), getPaperH() 360 / getStraightBitmapH()); 305 361 return result; 306 362 } … … 318 374 float destH = mainTransformer.getGeoH() / factor; 319 375 320 // fix aspect ratio376 // fix aspect ratio 321 377 if (destW / destH > getGeoW() / getGeoH()) { 322 378 destH = getGeoH() * destW / getGeoW(); … … 358 414 } 359 415 360 public int getSvgFactor() {416 public float getSvgFactor() { 361 417 return svgFactor; 362 418 } -
print/trunk/src/main/java/org/mapfish/print/config/Config.java
r3831 r3858 68 68 private double maxSvgH = Double.MAX_VALUE; 69 69 70 private boolean integerSvg = true; 71 70 72 private List<String> overlayLayers = null; 71 73 … … 428 430 return overlayLayers; 429 431 } 432 433 /** 434 * @return the integerSvg true if for example MapServer 5.6 or earlier is used where integers are put into the SVG 435 */ 436 public boolean getIntegerSvg() { 437 return integerSvg; 438 } 439 440 /** 441 * @param integerSvg the integerSvg to set 442 */ 443 public void setIntegerSvg(boolean integerSvg) { 444 this.integerSvg = integerSvg; 445 } 430 446 } -
print/trunk/src/main/java/org/mapfish/print/config/layout/MapBlock.java
r3828 r3858 149 149 double rotation = params.optFloat("rotation", 0.0F) * Math.PI / 180.0; 150 150 return new Transformer(centerX, centerY, width, height, scale, dpi, 151 unitEnum, rotation, srs );151 unitEnum, rotation, srs, context); 152 152 } 153 153 -
print/trunk/src/main/java/org/mapfish/print/map/renderers/SVGTileRenderer.java
r3826 r3858 142 142 private TranscoderInput getTranscoderInput(URL url, Transformer transformer, RenderingContext context) { 143 143 final float zoomFactor = transformer.getSvgFactor() * context.getStyleFactor(); 144 //final float zoomFactor = context.getStyleFactor(); 144 145 if (svgZoomOut != null && zoomFactor != 1.0f) { 145 146 javax.xml.transform.Transformer xslt = null; -
print/trunk/src/main/webapp
-
Property
svn:ignore set
to
test.yaml
test.html
environment_theme.yaml
config2.yaml
configVector.yaml
smap.yaml
portal.yaml
configPremiumGoogle.yaml
config.yaml.bak
vector.html
oe.html
Copy of configVector.yaml
configNonPremiumGoogle.yaml
-
Property
svn:ignore set
to
