- Timestamp:
- 07/21/10 11:03:18 (22 months ago)
- Location:
- framework/client/trunk/mfbase/mapfish
- Files:
-
- 3 modified
-
core/PrintProtocol.js (modified) (3 diffs)
-
widgets/print/Base.js (modified) (2 diffs)
-
widgets/print/BaseWidget.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
framework/client/trunk/mfbase/mapfish/core/PrintProtocol.js
r3522 r3592 79 79 80 80 /** 81 * APIProperty: geodetic 82 * {Boolean} True if the projection is geodetic, for a correct scale 83 * calculation. 84 */ 85 geodetic: false, 86 87 /** 81 88 * Constructor: OpenLayers.Layer 82 89 * … … 89 96 * params - {Object} additional params to send in the Ajax calls 90 97 */ 91 initialize: function(map, config, overrides, dpi, params ) {98 initialize: function(map, config, overrides, dpi, params, geodetic) { 92 99 this.config = config; 93 100 this.spec = {pages: []}; 94 101 overrides = this.fixOverrides(overrides, map); 102 this.geodetic = (geodetic != undefined) ? geodetic : this.geodetic; 95 103 this.addMapParams(overrides, map, dpi); 96 104 this.addOverviewMapParams(overrides, map, dpi); … … 278 286 spec.units = map.baseLayer.units; 279 287 spec.srs = map.baseLayer.projection.getCode(); 288 spec.geodetic = this.geodetic; 280 289 var layers = spec.layers = []; 281 290 this.fillLayers(layers, map.layers, overrides, dpi); -
framework/client/trunk/mfbase/mapfish/widgets/print/Base.js
r3084 r3592 98 98 99 99 /** 100 * APIProperty: geodetic 101 * {Boolean} True if the projection is geodetic, for a correct scale 102 * calculation. 103 */ 104 geodetic: false, 105 106 /** 100 107 * Method: initPrint 101 108 * loads the configuration … … 155 162 156 163 var printCommand = new mapfish.PrintProtocol(this.map, this.config, 157 this.overrides, this.getCurDpi(), this.serviceParams );164 this.overrides, this.getCurDpi(), this.serviceParams, this.geodetic); 158 165 if (this.layerTree) { 159 166 this.addLegends(printCommand.spec); -
framework/client/trunk/mfbase/mapfish/widgets/print/BaseWidget.js
r3084 r3592 25 25 * @requires OpenLayers/Layer/Vector.js 26 26 * @requires OpenLayers/Feature/Vector.js 27 * @requires OpenLayers/Geometry/Polygon.js 28 * @requires OpenLayers/Util.js 29 * @requires OpenLayers/Projection.js 27 30 * @requires OpenLayers/Geometry/Polygon.js 28 31 */ … … 414 417 var unitsRatio = OpenLayers.INCHES_PER_UNIT[this.map.baseLayer.units]; 415 418 416 var size = layout.map; 417 var w = size.width / 72.0 / unitsRatio * scale / 2.0; 418 var h = size.height / 72.0 / unitsRatio * scale / 2.0; 419 var w = layout.map.width / 72.0 / unitsRatio * scale / 2.0; 420 var h = layout.map.height / 72.0 / unitsRatio * scale / 2.0; 421 422 var proj = this.map.getProjectionObject(); 423 if (this.geodetic && (proj.projCode != 'EPGS:4326')) { 424 var wgs84 = new OpenLayers.Projection('EPSG:4326'); 425 var wgs84center = center.clone().transform(proj, wgs84); 426 427 var dest = OpenLayers.Util.destinationVincenty; 428 var wp1 = dest(wgs84center, 90, w); 429 var wp2 = dest(wgs84center, 270, w); 430 var hp1 = dest(wgs84center, 0, h); 431 var hp2 = dest(wgs84center, 180, h); 432 433 var p = OpenLayers.Geometry.Point; 434 var bounds = new OpenLayers.Geometry.Polygon([ 435 new OpenLayers.Geometry.LinearRing([ 436 new p(wp1.lon, wp1.lat), new p(hp2.lon, hp2.lat), 437 new p(wp2.lon, wp2.lat), new p(hp1.lon, hp1.lat) 438 ]) 439 ]).getBounds(); 440 441 return bounds.transform(wgs84, proj); 442 } 419 443 420 444 return new OpenLayers.Bounds( 421 center.lon - w, 422 center.lat - h, 423 center.lon + w, 424 center.lat + h); 445 center.lon - w, 446 center.lat - h, 447 center.lon + w, 448 center.lat + h 449 ); 425 450 }, 426 451
