Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jul 16, 2018
2 parents 491bdb9 + 74d8c64 commit c23416c
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 18 deletions.
2 changes: 1 addition & 1 deletion contribs/gmf/src/import/importdatasourceComponent.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
novalidate
ng-show="$ctrl.mode === 'Local'">
<div class="form-group">
<div class="input-group input-group-sm">
<div class="input-group">
<input
name="file"
type="file"
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/layertree/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ exports.Controller_.prototype.getLegendIconURL = function(treeCtrl) {
const layerName = gmfLayerWMS.layers.split(',')[0];
const gmfOgcServer = this.gmfTreeManager_.getOgcServer(treeCtrl);
return this.layerHelper_.getWMSLegendURL(
gmfOgcServer.url, layerName, undefined, legendRule
gmfOgcServer.url, layerName, undefined, legendRule, 20, 20
);
};

Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/permalink/Permalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ exports.prototype.defaultThemeName = function() {
// check if we have a theme in url
const pathElements = this.ngeoLocation_.getPath().split('/');
if (this.themeInUrl_(pathElements)) {
return pathElements[pathElements.length - 1];
return decodeURI(pathElements[pathElements.length - 1]);
}

// check if we have a theme in the local storage
Expand Down
7 changes: 6 additions & 1 deletion docs/guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ or PR from persons outside of Camptocamp customers or developers.

- [Main principle](#main-principle)
- [Coding style guide](#coding-style-guide)
- [Main changes in the code between ngeo 2.2 and 2.2](#main-changes-in-the-code-between-ngeo-22-and-23)
- [Main changes in the code between ngeo 2.2 and 2.3](#main-changes-in-the-code-between-ngeo-22-and-23)
- [AngularJS names ](#angularJS-names)
- [Module management](#module-management)
- [Good practices on components creation](#good-practices-on-components-creation)
Expand Down Expand Up @@ -150,6 +150,11 @@ const myComponent = {
};
```

## `$injector` usage

`$injector` should be used only for the optional requirements.
The only exception is for the abstract controllers (in `gmf/controleurs`) to ease upgrade.

## Limit the use of `ng-controller`

Use one `ng-controller` only, the "main controller", somewhere at the root of
Expand Down
10 changes: 9 additions & 1 deletion src/map/LayerHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,13 @@ exports.prototype.getWMTSLegendURL = function(layer) {
* @param {string} layerName The name of a wms layer.
* @param {number=} opt_scale A scale.
* @param {string=} opt_legendRule rule parameters to add to the returned URL.
* @param {number=} opt_legendWidth the legend width.
* @param {number=} opt_legendHeight the legend height.
* @return {string|undefined} The legend URL or undefined.
* @export
*/
exports.prototype.getWMSLegendURL = function(url,
layerName, opt_scale, opt_legendRule) {
layerName, opt_scale, opt_legendRule, opt_legendWidth, opt_legendHeight) {
if (!url) {
return undefined;
}
Expand All @@ -387,6 +389,12 @@ exports.prototype.getWMSLegendURL = function(url,
}
if (opt_legendRule !== undefined) {
queryString['RULE'] = opt_legendRule;
if (opt_legendWidth !== undefined) {
queryString['WIDTH'] = opt_legendWidth;
}
if (opt_legendHeight !== undefined) {
queryString['HEIGHT'] = opt_legendHeight;
}
}
return olUri.appendParams(url, queryString);
};
Expand Down
2 changes: 1 addition & 1 deletion src/print/VectorEncoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ exports.prototype.encodeVectorLayer = function(arr, layer, resolution) {
let isOriginalFeatureAdded = false;
for (let j = 0, jj = styles.length; j < jj; ++j) {
const style = styles[j];
const styleId = olBase.getUid(style).toString();
let geometry = style.getGeometry();
let geojsonFeature;
if (!geometry) {
Expand Down Expand Up @@ -116,6 +115,7 @@ exports.prototype.encodeVectorLayer = function(arr, layer, resolution) {
}

const featureStyleProp = `_ngeo_style_${j}`;
const styleId = `${olBase.getUid(style).toString()}-${geometryType}`;
this.encodeVectorStyle(mapfishStyleObject, geometryType, style, styleId, featureStyleProp);
geojsonFeature.properties[featureStyleProp] = styleId;
}
Expand Down
43 changes: 31 additions & 12 deletions test/spec/services/print.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ describe('ngeo.print.Service', () => {
});

// styles for features2
const styles2 = [style2];
const styles2 = [style0, style2];

style3 = new olStyleStyle({
text: new olStyleText({
Expand Down Expand Up @@ -427,7 +427,7 @@ describe('ngeo.print.Service', () => {
const expectedStyle = {
version: 2
};
expectedStyle[`[_ngeo_style_0 = '${styleId0}']`] = {
expectedStyle[`[_ngeo_style_0 = '${styleId0}-Point']`] = {
symbolizers: [{
type: 'point',
pointRadius: 1,
Expand All @@ -436,15 +436,33 @@ describe('ngeo.print.Service', () => {
strokeWidth: 1
}]
};
expectedStyle[`[_ngeo_style_1 = '${styleId1}']`] = {
expectedStyle[`[_ngeo_style_0 = '${styleId0}-LineString']`] = {
symbolizers: [{
type: 'line',
strokeColor: '#010101',
strokeOpacity: 0.1,
strokeWidth: 1
}]
};
expectedStyle[`[_ngeo_style_1 = '${styleId1}-LineString']`] = {
symbolizers: [{
type: 'line',
strokeColor: '#020202',
strokeOpacity: 0.2,
strokeWidth: 2
}]
};
expectedStyle[`[_ngeo_style_0 = '${styleId2}']`] = {
expectedStyle[`[_ngeo_style_0 = '${styleId0}-Polygon']`] = {
symbolizers: [{
type: 'polygon',
fillColor: '#010101',
fillOpacity: 0.1,
strokeColor: '#010101',
strokeOpacity: 0.1,
strokeWidth: 1
}]
};
expectedStyle[`[_ngeo_style_1 = '${styleId2}-Polygon']`] = {
symbolizers: [{
type: 'polygon',
fillColor: '#030303',
Expand All @@ -454,7 +472,7 @@ describe('ngeo.print.Service', () => {
strokeWidth: 3
}]
};
expectedStyle[`[_ngeo_style_0 = '${styleId3}']`] = {
expectedStyle[`[_ngeo_style_0 = '${styleId3}-Point']`] = {
symbolizers: [{
type: 'Text',
fontColor: '#030303',
Expand All @@ -467,7 +485,7 @@ describe('ngeo.print.Service', () => {
labelYOffset: 42
}]
};
expectedStyle[`[_ngeo_style_1 = '${styleId4}']`] = {
expectedStyle[`[_ngeo_style_1 = '${styleId4}-Point']`] = {
symbolizers: [{
type: 'Text',
fontColor: '#030303',
Expand All @@ -484,27 +502,28 @@ describe('ngeo.print.Service', () => {
// the expected properties of feature0
const properties0 = {
foo: '0',
'_ngeo_style_0': styleId0
'_ngeo_style_0': `${styleId0}-Point`,
};

// the expected properties of feature1
const properties1 = {
foo: '1',
'_ngeo_style_0': styleId0,
'_ngeo_style_1': styleId1
'_ngeo_style_0': `${styleId0}-LineString`,
'_ngeo_style_1': `${styleId1}-LineString`,
};

// the expected properties of feature2
const properties2 = {
foo: '2',
'_ngeo_style_0': styleId2
'_ngeo_style_0': `${styleId0}-Polygon`,
'_ngeo_style_1': `${styleId2}-Polygon`,
};

// the expected properties of feature3
const properties3 = {
foo: '3',
'_ngeo_style_0': styleId3,
'_ngeo_style_1': styleId4
'_ngeo_style_0': `${styleId3}-Point`,
'_ngeo_style_1': `${styleId4}-Point`,
};

expect(spec).toEqual({
Expand Down

0 comments on commit c23416c

Please sign in to comment.