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

Merge remote-tracking branch 'origin/2.3' #4675

Merged
merged 7 commits into from
Feb 22, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions contribs/gmf/src/contextualdata/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ module.directive('gmfContextualdata', contextualDataComponent);
* @param {angular.ITimeoutService} $timeout Angular timeout service.
* @param {!angular.IScope} $scope Scope.
* @param {import("gmf/raster/RasterService.js").RasterService} gmfRaster Gmf Raster service
* @param {angular.auto.IInjectorService} $injector Angular injector service.
*
* @constructor
* @hidden
* @ngdoc controller
* @ngInject
*/
export function ContextualdataController($compile, $timeout, $scope, gmfRaster) {
export function ContextualdataController($compile, $timeout, $scope, gmfRaster, $injector) {

/**
* @type {import("ol/Map.js").default}
Expand Down Expand Up @@ -131,6 +132,14 @@ export function ContextualdataController($compile, $timeout, $scope, gmfRaster)
*/
this.gmfRaster_ = gmfRaster;

/**
* @type {Object}
* @private
*/
this.gmfContextualdataOptions_ = $injector.has('gmfContextualdataOptions') ?
$injector.get('gmfContextualdataOptions') : {};

angular.element('body').on('mousedown', this.hidePopover.bind(this));
}

/**
Expand Down Expand Up @@ -187,7 +196,7 @@ ContextualdataController.prototype.setContent_ = function(coordinate) {
const getRasterError = () => {
console.error('Error on getting the raster.');
};
this.gmfRaster_.getRaster(coordinate).then(
this.gmfRaster_.getRaster(coordinate, this.gmfContextualdataOptions_.rasterParams).then(
getRasterSuccess,
getRasterError
);
Expand Down
23 changes: 15 additions & 8 deletions contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ import 'bootstrap/js/src/dropdown.js';
* Fields that can come from a print v3 server and can be used in the partial
* of the gmf print panel.
* @typedef {Object} PrintLayoutInfo
* @property {Array.<PrintSimpleAttributes>} [simpleAttributes] Custom print layoutInfo.
* @property {Array<PrintSimpleAttributes>} [simpleAttributes] Custom print layoutInfo.
* @property {Array<string>} [attributes] The list of all the attributes name.
* @property {number} [dpi] The selected 'dpi'.
* @property {Array.<number>} [dpis] The list of 'dpis'.
* @property {Object.<string, boolean>} [formats] The list of active 'formats' (png, pdf, ...).
* @property {Array<number>} [dpis] The list of 'dpis'.
* @property {Object<string, boolean>} [formats] The list of active 'formats' (png, pdf, ...).
* @property {string} [layout] The selected 'layout'.
* @property {Array.<string>} [layouts] The list of 'layouts'.
* @property {Array<string>} [layouts] The list of 'layouts'.
* @property {boolean} [legend] The legend checkbox.
* @property {number} [scale] The selected 'scale'.
* @property {Array.<number>} [scales] The list of 'scales'
* @property {Array<number>} [scales] The list of 'scales'
*/


Expand Down Expand Up @@ -795,11 +796,15 @@ class Controller {
if (!this.layoutInfo.simpleAttributes) {
this.layoutInfo.simpleAttributes = [];
}
if (!this.layoutInfo.attributes) {
this.layoutInfo.attributes = [];
}
const simpleAttributes = this.layoutInfo.simpleAttributes;
const previousAttributes = simpleAttributes.splice(0, simpleAttributes.length);

// The attributes without 'clientParams' are the custom layout information (defined by end user).
this.layout_.attributes.forEach((attribute) => {
this.layoutInfo.attributes.push(attribute.name);
if (!attribute['clientParams']) {
name = `${attribute.name}`;
const defaultValue = attribute.default;
Expand Down Expand Up @@ -942,9 +947,11 @@ class Controller {
const scale = this.layoutInfo.scale || this.getOptimalScale_(mapSize, viewResolution);
const datasource = this.getDataSource_();

const customAttributes = {
'datasource': datasource
};
const customAttributes = {};

if (this.layoutInfo.attributes.indexOf('datasource') >= 0) {
customAttributes['datasource'] = datasource;
}

if (this.layoutInfo.simpleAttributes) {
this.layoutInfo.simpleAttributes.forEach((field) => {
Expand Down
41 changes: 10 additions & 31 deletions src/filter/RuleHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,42 +543,21 @@ export class RuleHelper {
beginValue = moment(lowerBoundary).format('YYYY-MM-DD');
endValue = moment(upperBoundary).format('YYYY-MM-DD');
} else if (operator === rtot.EQUALS) {
beginValue = moment(
expression
).format(
'YYYY-MM-DD HH:mm:ss'
);
endValue = moment(
expression
).add(
1, 'days'
).subtract(
1, 'seconds'
).format(
'YYYY-MM-DD HH:mm:ss'
);
beginValue = moment(expression)
.format('YYYY-MM-DD');
endValue = beginValue;
} else if (operator === rtot.BEGINS) {
beginValue = moment(
expression
).format(
'YYYY-MM-DD'
);
beginValue = moment(expression)
.format('YYYY-MM-DD');
// NOTE: end value is CURRENT + 30 years
endValue = moment(
expression
).add(
30, 'years'
).format(
'YYYY-MM-DD'
);
endValue = moment(expression)
.add(30, 'years')
.format('YYYY-MM-DD');
} else if (operator === rtot.ENDS) {
// NOTE: begin value is hardcoded to 1970-01-01
beginValue = '1970-01-01';
endValue = moment(
expression
).format(
'YYYY-MM-DD'
);
endValue = moment(expression)
.format('YYYY-MM-DD');
}
if (beginValue && endValue) {
filter = olFormatFilter.during(
Expand Down