Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove rotation and lang from the print spec #3987

Merged
merged 3 commits into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -830,14 +830,10 @@ exports.Controller_ = class {
const mapSize = this.map.getSize();
const viewResolution = this.map.getView().getResolution() || 0;
const scale = this.layoutInfo.scale || this.getOptimalScale_(mapSize, viewResolution);
const rotation = this.rotateMask ? -this.rotation : this.rotation;
const datasource = this.getDataSource_();

const customAttributes = {
'datasource': datasource,
'lang': this.gettextCatalog_.currentLanguage,
'rotation': rotation,
'scale': scale
'datasource': datasource
};

if (this.layoutInfo.simpleAttributes) {
Expand Down
17 changes: 14 additions & 3 deletions src/print/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ import olTilegridWMTS from 'ol/tilegrid/WMTS.js';
* @struct
* @param {string} url URL to MapFish print web service.
* @param {angular.$http} $http Angular $http service.
* @param {!angularGettext.Catalog} gettextCatalog Gettext service.
* @param {ngeo.map.LayerHelper} ngeoLayerHelper Ngeo Layer Helper service.
*/
const exports = function(url, $http, ngeoLayerHelper) {
const exports = function(url, $http, gettextCatalog, ngeoLayerHelper) {
/**
* @type {string}
* @private
Expand All @@ -72,6 +73,12 @@ const exports = function(url, $http, ngeoLayerHelper) {
*/
this.$http_ = $http;

/**
* @type {!angularGettext.Catalog}
* @private
*/
this.gettextCatalog_ = gettextCatalog;

/**
* @type {ngeo.map.LayerHelper}
* @private
Expand Down Expand Up @@ -134,9 +141,12 @@ exports.prototype.createSpec = function(
});
olObj.assign(attributes, customAttributes);

const lang = this.gettextCatalog_.currentLanguage;

const spec = /** @type {MapFishPrintSpec} */ ({
attributes,
format,
lang,
layout
});

Expand Down Expand Up @@ -454,19 +464,20 @@ exports.prototype.getCapabilities = function(opt_httpConfig) {

/**
* @param {angular.$http} $http Angular $http service.
* @param {!angularGettext.Catalog} gettextCatalog Gettext service.
* @param {ngeo.map.LayerHelper} ngeoLayerHelper Ngeo Layer Helper.
* @return {ngeox.CreatePrint} The function to create a print service.
* @ngInject
* @ngdoc service
* @ngname ngeoCreatePrint
*/
exports.createPrintServiceFactory = function($http, ngeoLayerHelper) {
exports.createPrintServiceFactory = function($http, gettextCatalog, ngeoLayerHelper) {
return (
/**
* @param {string} url URL to MapFish print service.
*/
function(url) {
return new exports(url, $http, ngeoLayerHelper);
return new exports(url, $http, gettextCatalog, ngeoLayerHelper);
}
);
};
Expand Down
4 changes: 4 additions & 0 deletions test/spec/services/print.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ describe('ngeo.print.Service', () => {
foo: 'fooval',
bar: 'barval'
},
lang: 'en',
format: 'pdf',
layout: 'foo layout'
});
Expand Down Expand Up @@ -181,6 +182,7 @@ describe('ngeo.print.Service', () => {
foo: 'fooval',
bar: 'barval'
},
lang: 'en',
format: 'pdf',
layout: 'foo layout'
});
Expand Down Expand Up @@ -277,6 +279,7 @@ describe('ngeo.print.Service', () => {
foo: 'fooval',
bar: 'barval'
},
lang: 'en',
format: 'pdf',
layout: 'foo layout'
});
Expand Down Expand Up @@ -553,6 +556,7 @@ describe('ngeo.print.Service', () => {
foo: 'fooval',
bar: 'barval'
},
lang: 'en',
format: 'pdf',
layout: 'foo layout'
});
Expand Down