Skip to content

Commit

Permalink
Merge pull request #5371 from camptocamp/print-custom-scale
Browse files Browse the repository at this point in the history
Fix print custom scale
  • Loading branch information
sbrunner committed Dec 17, 2019
2 parents 6b8f768 + c7285de commit 16a239c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/print/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ PrintService.prototype.encodeMap_ = function(map, scale, object) {
object.projection = viewProjection.getCode();
object.rotation = viewRotation;
object.scale = scale;
object.useNearestScale = false;
object.layers = [];

const mapLayerGroup = map.getLayerGroup();
Expand Down
2 changes: 2 additions & 0 deletions src/print/mapfish-print-v3.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* @property {Array.<MapFishPrintLayer>} layers
* @property {string} projection
* @property {number} rotation
* @property {boolean} [useNearestScale] Indicates if the map should adjust its scale/zoom level to be
* equal to one of those defined in the configuration file.
*/


Expand Down
5 changes: 5 additions & 0 deletions test/spec/services/print.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ describe('ngeo.print.Service', () => {
projection: 'EPSG:3857',
rotation: 0,
scale: 500,
useNearestScale: false,
layers: [{
baseURL: 'http://example.com/wms',
imageFormat: 'image/jpeg',
Expand Down Expand Up @@ -173,6 +174,7 @@ describe('ngeo.print.Service', () => {
center: [3000, 4000],
projection: 'EPSG:3857',
scale: 500,
useNearestScale: false,
rotation: 0,
layers: [{
baseURL: 'http://example.com/wms',
Expand Down Expand Up @@ -248,6 +250,7 @@ describe('ngeo.print.Service', () => {
projection: 'EPSG:3857',
rotation: 0,
scale: 500,
useNearestScale: false,
layers: [{
baseURL: 'http://example.com/wmts/{Layer}/{Style}/' +
'{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg',
Expand Down Expand Up @@ -543,6 +546,7 @@ describe('ngeo.print.Service', () => {
projection: 'EPSG:3857',
rotation: 0,
scale: 500,
useNearestScale: false,
layers: [{
geoJson: {
type: 'FeatureCollection',
Expand Down Expand Up @@ -656,6 +660,7 @@ describe('ngeo.print.Service', () => {
center: [3000, 4000],
projection: 'EPSG:3857',
scale: 500,
useNearestScale: false,
layers: [{
baseURL: 'http://example.com/wms',
imageFormat: 'image/jpeg',
Expand Down

0 comments on commit 16a239c

Please sign in to comment.