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' #4187

Merged
merged 13 commits into from
Aug 29, 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
2 changes: 1 addition & 1 deletion contribs/gmf/apps/desktop/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@
ngeo-resizemap-state="profileChartActive">
</gmf-profile>
</footer>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,default-3.6"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3&key=AIzaSyCYnqxEQA5sz13sWSgMr97ejzvUeGP8gz4"></script>
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
Expand Down
3 changes: 2 additions & 1 deletion contribs/gmf/apps/desktop_alt/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
ngeo-map-query-active="mainCtrl.queryActive"
ngeo-map-query-autoclear="mainCtrl.queryAutoClear"
ngeo-bbox-query=""
ngeo-bbox-query-limit="50"
ngeo-bbox-query-map="::mainCtrl.map"
ngeo-bbox-query-active="mainCtrl.queryActive"
ngeo-bbox-query-autoclear="mainCtrl.queryAutoClear">
Expand Down Expand Up @@ -348,7 +349,7 @@
ngeo-resizemap-state="queryGridActive">
</gmf-displayquerygrid>
</footer>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,default-3.6"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3&key=AIzaSyCYnqxEQA5sz13sWSgMr97ejzvUeGP8gz4"></script>
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/apps/mobile/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
</gmf-authentication>
</div>
</ngeo-modal>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,default-3.6"></script>
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
<% } %>
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/apps/mobile_alt/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
gmf-mobile-nav-back="authCtrl.gmfUser.username !== null">
</gmf-authentication>
</nav>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=es6,default-3.6"></script>
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
<% } %>
Expand Down
5 changes: 4 additions & 1 deletion contribs/gmf/src/datasource/WFSAliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ const exports = class {
*/
describe(dataSource) {
// Only QGIS Server supports WFS aliases
if (dataSource.ogcServerType === 'qgisserver' && !dataSource.attributes) {
if (dataSource.ogcServerType === 'qgisserver' &&
dataSource.wfsUrl_ &&
dataSource.getOGCLayerNames().length == 1 &&
!dataSource.attributes) {
// Trigger an additional WFS DescribeFeatureType request to get
// datasource attributes, including aliases.
this.ngeoDataSourcesHelper_.getDataSourceAttributes(dataSource);
Expand Down
46 changes: 42 additions & 4 deletions contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,22 @@ exports.component_ = {

exports.component('gmfPrint', exports.component_);

/**
* @typedef {{
* useBbox: (boolean|undefined),
* label: (Object.<string, boolean>),
* params: (Object.<string, Object.<string, string>>)
* }}
*/
exports.optionsLegendType;

/**
* @typedef {{
* scaleInput: (boolean|undefined),
* legend: (optionsLegendType|undefined)
* }}
*/
exports.optionsType;

/**
* @private
Expand Down Expand Up @@ -336,8 +352,27 @@ exports.Controller_ = class {
*/
this.scaleInput = false;

/**
* @type optionsLegendType
* @private
*/
this.gmfLegendOptions_ = {
useBbox: true,
label: {},
params: {},
};

if ($injector.has('gmfPrintOptions')) {
this.scaleInput = $injector.get('gmfPrintOptions')['scaleInput'];
/**
* @type optionsType
*/
const options = $injector.get('gmfPrintOptions');
if (options.scaleInput) {
this.scaleInput = options.scaleInput;
}
if (options.legend) {
Object.assign(this.gmfLegendOptions_, options.legend);
}
}

/**
Expand Down Expand Up @@ -1121,15 +1156,18 @@ exports.Controller_ = class {
let icons = this.getMetadataLegendImage_(name);
if (!icons) {
icons = this.ngeoLayerHelper_.getWMSLegendURL(source.getUrl(), name,
scale, undefined, undefined, undefined, source.serverType_, dpi, bbox,
this.map.getView().getProjection().getCode()
scale, undefined, undefined, undefined, source.serverType_, dpi,
this.gmfLegendOptions_.useBbox ? bbox : undefined,
this.map.getView().getProjection().getCode(),
this.gmfLegendOptions_.params[layer.getSource().serverType_]
);
}
// Don't add classes without legend url or from layers without any
// active name.
if (icons && name.length !== 0) {
classes.push(Object.assign({
'name': gettextCatalog.getString(name),
'name': this.gmfLegendOptions_.label[layer.getSource().serverType_] === false ? '' :
gettextCatalog.getString(name),
'icons': [icons]
}, layer.getSource().serverType_ === 'qgis' ? {
'dpi': dpi,
Expand Down
1 change: 1 addition & 0 deletions contribs/gmf/src/sass/map.scss
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ button[ngeo-mobile-geolocation] {
text-overflow: ellipsis;
white-space: nowrap;
flex: 1 1 auto;
width: inherit;
}

.gmf-thumb {
Expand Down
23 changes: 12 additions & 11 deletions src/datasource/Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,21 @@ const exports = class {
// We know, at this point, that there's only one definition that
// was returned. Just to be sure, let's do a bunch of assertions.
const ogcLayerName = dataSource.getOGCLayerNames()[0];
googAsserts.assertString(
ogcLayerName, 'The data source should have only one ogcLayer.');
const element = featureType.element[0];
googAsserts.assert(element.name === ogcLayerName);
googAsserts.assert(
featureType.complexType[0].name === element.type);
googAsserts.assertString(ogcLayerName, 'The data source should have only one ogcLayer.');
for (const element of featureType.element) {
if (element.name === ogcLayerName) {
googAsserts.assert(featureType.complexType[0].name === element.type);

const complexContent = featureType['complexType'][0]['complexContent'];
const attributes = new ngeoFormatWFSAttribute().read(complexContent);
const complexContent = featureType.complexType[0].complexContent;
const attributes = new ngeoFormatWFSAttribute().read(complexContent);

// Set the attributes in the data source
dataSource.setAttributes(attributes);
// Set the attributes in the data source
dataSource.setAttributes(attributes);

wfsDescribeFeatureTypeDefer.resolve(attributes);
wfsDescribeFeatureTypeDefer.resolve(attributes);
break;
}
}
});
}

Expand Down
6 changes: 5 additions & 1 deletion src/map/LayerHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,13 @@ exports.prototype.getWMTSLegendURL = function(layer) {
* @param {number=} opt_dpi the DPI.
* @param {Array.number=} opt_bbox the bbox.
* @param {string=} opt_srs The projection code.
* @param {Object.<string, string>=} opt_additionalQueryString Additional query string parameters.
* @return {string|undefined} The legend URL or undefined.
* @export
*/
exports.prototype.getWMSLegendURL = function(url,
layerName, opt_scale, opt_legendRule, opt_legendWidth, opt_legendHeight,
opt_servertype, opt_dpi, opt_bbox, opt_srs) {
opt_servertype, opt_dpi, opt_bbox, opt_srs, opt_additionalQueryString) {
if (!url) {
return undefined;
}
Expand Down Expand Up @@ -432,6 +433,9 @@ exports.prototype.getWMSLegendURL = function(url,
queryString['HEIGHT'] = Math.round((opt_bbox[3] - opt_bbox[1]) / opt_scale * 39.37 * opt_dpi);
}
}
if (opt_additionalQueryString) {
Object.assign(queryString, opt_additionalQueryString);
}
return olUri.appendParams(url, queryString);
};

Expand Down