Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Apr 26, 2018
2 parents b213c1a + 9b3f870 commit 4adb811
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 52 deletions.
3 changes: 3 additions & 0 deletions contribs/gmf/less/search.less
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ gmf-search {
}
}
}
.tt-menu.tt-open.gmf-search-no-results {
display: block !important;
}
}

// Overrides for small browser widths only
Expand Down
11 changes: 10 additions & 1 deletion contribs/gmf/src/disclaimer/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ gmf.disclaimer.component = angular.module('gmfDisclaimer', [
* @param {!angular.Scope} $scope Angular scope.
* @param {!angular.$sce} $sce Angular sce service.
* @param {!angular.$timeout} $timeout Angular timeout service.
* @param {!angularGettext.Catalog} gettextCatalog Gettext catalog.
* @param {!ngeox.PopupFactory} ngeoCreatePopup Popup service.
* @param {!ngeo.message.Disclaimer} ngeoDisclaimer Ngeo Disclaimer service.
* @param {!ngeo.misc.EventHelper} ngeoEventHelper Ngeo Event Helper.
Expand All @@ -40,7 +41,7 @@ gmf.disclaimer.component = angular.module('gmfDisclaimer', [
* @ngname GmfDisclaimerController
*/
gmf.disclaimer.component.Controller_ = function($element, $scope, $sce, $timeout,
ngeoCreatePopup, ngeoDisclaimer, ngeoEventHelper, ngeoLayerHelper) {
gettextCatalog, ngeoCreatePopup, ngeoDisclaimer, ngeoEventHelper, ngeoLayerHelper) {

/**
* @type {?ol.Map}
Expand Down Expand Up @@ -92,6 +93,12 @@ gmf.disclaimer.component.Controller_ = function($element, $scope, $sce, $timeout
*/
this.timeout_ = $timeout;

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

/**
* @type {!angular.JQLite}
* @private
Expand Down Expand Up @@ -251,6 +258,7 @@ gmf.disclaimer.component.Controller_.prototype.$onDestroy = function() {
* @private
*/
gmf.disclaimer.component.Controller_.prototype.showDisclaimerMessage_ = function(msg) {
msg = this.gettextCatalog_.getString(msg);
if (this.external) {
if (this.msgs_.indexOf(msg) < 0) {
this.msgs_.push(msg);
Expand All @@ -273,6 +281,7 @@ gmf.disclaimer.component.Controller_.prototype.showDisclaimerMessage_ = function
* @private
*/
gmf.disclaimer.component.Controller_.prototype.closeDisclaimerMessage_ = function(msg) {
msg = this.gettextCatalog_.getString(msg);
if (this.external) {
this.visibility = false;
this.msgs_.length = 0;
Expand Down
12 changes: 6 additions & 6 deletions contribs/gmf/src/print/component.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,9 @@

<div class="col-md-5">
<input
class="form-control"
class="form-control gmf-print-rotation-input"
type="range"
ng-model="$ctrl.getSetRotation"
ng-model-options="{getterSetter: true}"
value="0"
min="-180"
max="180"
data-toggle="tooltip"
Expand All @@ -168,10 +167,11 @@

<div class="col-md-4">
<input
class="form-control"
class="form-control gmf-print-rotation-input"
type="number"
ng-model="$ctrl.getSetRotation"
ng-model-options="{getterSetter: true}">
min="-180"
max="180"
value="0">
</div>
</div>

Expand Down
54 changes: 29 additions & 25 deletions contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ gmf.print.component.component('gmfPrint', gmf.print.component.component_);
gmf.print.component.Controller_ = class {

/**
* @param {angular.JQLite} $element Element.
* @param {angular.Scope} $rootScope Angular root scope.
* @param {angular.Scope} $scope Angular scope.
* @param {angular.$timeout} $timeout Angular timeout service.
Expand All @@ -202,7 +203,7 @@ gmf.print.component.Controller_ = class {
* @ngdoc controller
* @ngname GmfPrintController
*/
constructor($rootScope, $scope, $timeout, $q, $injector,
constructor($element, $rootScope, $scope, $timeout, $q, $injector,
gettextCatalog, ngeoLayerHelper, ngeoFeatureOverlayMgr, ngeoPrintUtils,
ngeoCreatePrint, gmfPrintUrl, gmfAuthenticationService, ngeoQueryResult,
$filter, gmfPrintState, gmfThemes) {
Expand Down Expand Up @@ -436,6 +437,19 @@ gmf.print.component.Controller_ = class {
*/
this.scaleManuallySelected_ = false;

/**
* @type {angular.JQLite}
* @export
*/
this.rotationInput_ = $element.find('.gmf-print-rotation-input');

this.rotationInput_.on('input', (event) => {
const rotation = $(event.target).val();
if (rotation !== '') {
this.setRotation(/** @type {number} */ (rotation));
}
});

/**
* @type {function(ol.render.Event)}
*/
Expand Down Expand Up @@ -563,7 +577,7 @@ gmf.print.component.Controller_ = class {
ol.events.unlistenByKey(this.postComposeListenerKey_);
ol.events.unlistenByKey(this.pointerDragListenerKey_);
ol.events.unlistenByKey(this.mapViewResolutionChangeKey_);
this.getSetRotation(0);
this.setRotation(0);
this.map.render(); // Redraw (remove) post compose mask;
}
}
Expand Down Expand Up @@ -731,32 +745,22 @@ gmf.print.component.Controller_ = class {


/**
* Getter setter to update or get the current rotation value. Param and result
* are in degree. Updating the rotation will redraw the mask or rorate the
* map (depending on the configuration);
* @param {number=} opt_rotation The optional new rotation value.
* @return {number} The new value of rotation;
* @export
* Set the current rotation value.
* Updating the rotation will redraw the mask or rotate the map (depending on the configuration).
* @param {number} rotation The optional new rotation value in degrees.
*/
getSetRotation(opt_rotation) {
if (opt_rotation !== undefined) {
let rotation = parseInt(opt_rotation, 10);
if (rotation > 180) {
rotation = -180;
} else if (rotation < -180) {
rotation = 180;
}
this.rotation = rotation;
setRotation(rotation) {
this.rotation = ol.math.clamp(rotation, -180, 180);

// Render the map to update the postcompose mask or rotate the map.
if (this.rotateMask) {
this.map.render();
} else {
this.map.getView().setRotation(ol.math.toRadians(this.rotation));
}
// sync all the inputs
this.rotationInput_.val(this.rotation.toString());

// Render the map to update the postcompose mask or rotate the map.
if (this.rotateMask_) {
this.map.render();
} else {
this.map.getView().setRotation(ol.math.toRadians(this.rotation));
}
return this.rotation;
}


Expand Down Expand Up @@ -793,7 +797,7 @@ gmf.print.component.Controller_ = class {
const increment = Math.round(ol.math.toDegrees(angle) * boost);

// Set rotation then update the view.
this.getSetRotation(this.rotation + increment);
this.setRotation(this.rotation + increment);
this.$scope_.$digest();
}
// Prepare the removal of this session of drags events
Expand Down
3 changes: 2 additions & 1 deletion contribs/gmf/src/search/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -1037,8 +1037,9 @@ gmf.search.component.SearchController_ = class {
}
if (empty) {
message.show();
menu.show();
menu.addClass('gmf-search-no-results');
} else {
menu.removeClass('gmf-search-no-results');
message.hide();
}
}
Expand Down
11 changes: 8 additions & 3 deletions contribs/gmf/test/spec/controllers/gmfprintcontroller.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ describe('GmfPrintController', () => {
$controller = _$controller_;
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
const $element = angular.element('<div></div>');
gmfPrintCtrl = $controller('GmfPrintController', {
$element: $element,
$scope: $scope,
gmfPrintUrl: ''
});
Expand All @@ -25,11 +27,14 @@ describe('GmfPrintController', () => {
gmfPrintCtrl.parseCapabilities_({data: gmf.test.data.printcapabilities});
}));

it('Get Set rotation', () => {
it('Set rotation', () => {
expect(gmfPrintCtrl.rotation).toBe(0);
gmfPrintCtrl.getSetRotation(25);
expect(gmfPrintCtrl.rotation).toBe(gmfPrintCtrl.getSetRotation());
gmfPrintCtrl.setRotation(25);
expect(gmfPrintCtrl.rotation).toBe(25);
gmfPrintCtrl.setRotation(190);
expect(gmfPrintCtrl.rotation).toBe(180);
gmfPrintCtrl.setRotation(-1000);
expect(gmfPrintCtrl.rotation).toBe(-180);
});

it('Set layout and test depending layout informations changes', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/filter/rulecomponent.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
<span>{{ $ctrl.timeToDate($ctrl.rule.upperBoundary) }}</span>
</div>
<div ng-switch-default>
<span>{{ $ctrl.rule.operator }}</span>
<span>{{ $ctrl.operatorsShortFormat[$ctrl.rule.operator] }}</span>
<span>{{ $ctrl.timeToDate($ctrl.rule.getExpression()) }}</span>
</div>
</div>
Expand Down Expand Up @@ -291,7 +291,7 @@
<span>{{ $ctrl.rule.upperBoundary }}</span>
</div>
<div ng-switch-default>
<span>{{ $ctrl.rule.operator }}</span>
<span>{{ $ctrl.operatorsShortFormat[$ctrl.rule.operator] }}</span>
<span>{{ $ctrl.rule.getExpression() }}</span>
</div>
</div>
Expand Down
17 changes: 17 additions & 0 deletions src/filter/rulecomponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,23 @@ ngeo.filter.ruleComponent.RuleController_ = class {
[tot.EQUALS]: gettextCatalog.getString('Is equal to')
};

/**
* @type {Object.<string, string>}
* @export
*/
this.operatorsShortFormat = {
[ot.EQUAL_TO]: '=',
[ot.GREATER_THAN]: '>',
[ot.GREATER_THAN_OR_EQUAL_TO]: '>=',
[ot.LESSER_THAN]: '<',
[ot.LESSER_THAN_OR_EQUAL_TO]: '<=',
[ot.NOT_EQUAL_TO]: '!=',
[ot.LIKE]: '~',
[tot.BEGINS]: '>=',
[tot.ENDS]: '<=',
[tot.EQUALS]: '='
};

/**
* Time property used when the rule is of type 'date|datetime' and uses
* a range of date.
Expand Down
2 changes: 1 addition & 1 deletion src/format/xsdattribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ ngeo.format.XSDAttribute.prototype.setAttributeByXsdType_ = function(
attribute.type = ngeo.format.AttributeType.DATETIME;
} else if (type === 'xsd:time') {
attribute.type = ngeo.format.AttributeType.TIME;
} else if (type === 'xsd:decimal') {
} else if (type === 'xsd:decimal' || type === 'xsd:double') {
attribute.type = ngeo.format.AttributeType.NUMBER;
attribute.numType = ngeo.format.XSDAttribute.NumberType.FLOAT;
} else if (type === 'xsd:integer') {
Expand Down
9 changes: 5 additions & 4 deletions src/message/displaywindowComponent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
goog.provide('ngeo.message.displaywindowComponent');

goog.require('goog.asserts');
goog.require('ngeo'); // nowebpack
// webpack: import 'jquery-ui/ui/widgets/resizable.js';
// webpack: import 'jquery-ui/ui/widgets/draggable.js';
Expand Down Expand Up @@ -51,7 +52,7 @@ ngeo.message.displaywindowComponent.Controller_ = class {
* @param {!jQuery} $element Element.
* @param {!angular.$sce} $sce Angular sce service.
* @param {!angular.Scope} $scope Scope.
* @param {angular.$compile} $compile The compile provider.
* @param {!angular.$compile} $compile The compile provider.
* @private
* @ngInject
* @ngdoc controller
Expand Down Expand Up @@ -153,7 +154,7 @@ ngeo.message.displaywindowComponent.Controller_ = class {
this.sce_ = $sce;

/**
* @type {angular.Scope}
* @type {!angular.Scope}
* @private
*/
this.scope_ = $scope;
Expand Down Expand Up @@ -201,10 +202,10 @@ ngeo.message.displaywindowComponent.Controller_ = class {
}

if (this.contentTemplate) {
const scope = this.contentScope || this.scope_;
const scope = goog.asserts.assert(this.contentScope || this.scope_);
const compiled = this.compile_(this.contentTemplate)(scope);
const displayWindow = this.element_.find('.ngeo-displaywindow .windowcontainer .animation-container');
displayWindow.append(compiled);
displayWindow.append(/** @type {?} */ (compiled));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/misc/datepickerComponent.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div ng-if="::datepickerCtrl.time.widget === 'datepicker'">
<div class="ngeo-datepicker-start-date">
<span ng-if="::datepickerCtrl.time.mode === 'range'" translate>From:</span>
<span ng-if="::datepickerCtrl.time.mode !== 'range'"translate>Date:</span>
<span ng-if="::datepickerCtrl.time.mode !== 'range'" translate>Date:</span>
<input name="sdate" ui-date="datepickerCtrl.sdateOptions" ng-model="datepickerCtrl.sdate" required=""/>
</div>
<div
Expand Down
8 changes: 4 additions & 4 deletions src/misc/datepickerComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ ngeo.misc.datepickerComponent.component_ = function(ngeoDatePickerTemplateUrl,
$['datepicker']['setDefaults']($['datepicker']['regional'][lang]);

ctrl.sdateOptions = angular.extend({}, ctrl.sdateOptions, {
'minDate': ctrl.initialMinDate,
'maxDate': ctrl.initialMaxDate,
'onClose': (selectedDate) => {
if (selectedDate) {
$(element[0]).find('input[name="edate"]').datepicker('option', 'minDate', selectedDate);
Expand All @@ -70,6 +72,8 @@ ngeo.misc.datepickerComponent.component_ = function(ngeoDatePickerTemplateUrl,
});

ctrl.edateOptions = angular.extend({}, ctrl.edateOptions, {
'minDate': ctrl.initialMinDate,
'maxDate': ctrl.initialMaxDate,
'onClose': (selectedDate) => {
if (selectedDate) {
$(element[0]).find('input[name="sdate"]').datepicker('option', 'maxDate', selectedDate);
Expand Down Expand Up @@ -166,8 +170,6 @@ ngeo.misc.datepickerComponent.Controller_ = function($scope, $injector,
* @export
*/
this.edateOptions = {
'minDate': this.initialMinDate,
'maxDate': this.initialMaxDate,
'changeMonth': true,
'changeYear': true
};
Expand All @@ -178,8 +180,6 @@ ngeo.misc.datepickerComponent.Controller_ = function($scope, $injector,
* @export
*/
this.sdateOptions = {
'minDate': this.initialMinDate,
'maxDate': this.initialMaxDate,
'changeMonth': true,
'changeYear': true
};
Expand Down
8 changes: 4 additions & 4 deletions src/rule/rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ ngeo.rule.Rule.SpatialOperatorType = {
* @enum {string}
*/
ngeo.rule.Rule.TemporalOperatorType = {
BEGINS: '>=',
DURING: '..',
ENDS: '<=',
EQUALS: '='
BEGINS: 'time_start',
DURING: 'time_during',
ENDS: 'time_end',
EQUALS: 'time_equal'
};

0 comments on commit 4adb811

Please sign in to comment.