Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4528 from geoadmin/fredj_share_measure
Browse files Browse the repository at this point in the history
Adapt getStyleFunction to new ol5 style function
  • Loading branch information
danduk82 authored Oct 23, 2018
2 parents 2affd1b + ea4ff7e commit c83064e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
8 changes: 2 additions & 6 deletions src/components/ExportKmlService.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ goog.require('ga_browsersniffer_service');
clone.setId(f.getId());
clone.getGeometry().setProperties(f.getGeometry().getProperties());
clone.getGeometry().transform(projection, 'EPSG:4326');
var styles;
// TODO should we test getStyle() too?
if (clone.getStyleFunction()) {
styles = clone.getStyleFunction().call(clone);
} else {
styles = layer.getStyleFunction().call(layer, clone);
}
var styles = clone.getStyleFunction() || layer.getStyleFunction();
styles = styles(clone);
var newStyle = {
fill: styles[0].getFill(),
stroke: styles[0].getStroke(),
Expand Down
2 changes: 1 addition & 1 deletion src/components/print/PrintLayerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ goog.require('ga_urlutils_service');
// Get the styles of the feature
if (!styles) {
if (feature.getStyleFunction()) {
styles = feature.getStyleFunction().call(feature, resolution);
styles = feature.getStyleFunction()(feature, resolution);
} else if (layer.getStyleFunction()) {
styles = layer.getStyleFunction()(feature, resolution);
}
Expand Down
6 changes: 3 additions & 3 deletions src/js/DrawController.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ goog.require('ga_styles_service');
});

return function(feature, resolution) {
if (!feature.getStyleFunction() ||
!feature.getStyleFunction().call(feature, resolution)) {
var styleFunction = feature.getStyleFunction();
if (!styleFunction || !styleFunction(feature, resolution)) {
return [newVertexStyle];
}
var styles = feature.getStyleFunction().call(feature, resolution);
var styles = styleFunction(feature, resolution);
// When a feature is selected we apply its current style and the
// vertex style.
return styles.concat([
Expand Down

0 comments on commit c83064e

Please sign in to comment.