Skip to content

Commit

Permalink
v1.20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
www committed Aug 24, 2017
2 parents f7b5edf + 7eeba47 commit 1085921
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 11 deletions.
13 changes: 12 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Software development life-cycle
-------------------------------
There are a some Grunt tasks defined to ease the development cycle. Let's see how to use them:

First, make sure you have npm and grunt-cli installed globally. Let's install the dependencies.
First, make sure you have npm, bower and grunt-cli installed globally. Let's install the dependencies.

```
# Inside the project dir, install the dependencies
Expand All @@ -110,6 +110,17 @@ npm http GET https://registry.npmjs.org/grunt-ngmin
├── useragent@2.0.7 (lru-cache@2.2.4)
├── connect@2.8.8 (methods@0.0.1, uid2@0.0.2, fresh@0.2.0, cookie@0.1.0, ..., send@0.1.4)
└── socket.io@0.9.16 (base64id@0.1.0, policyfile@0.0.4, redis@0.7.3, socket.io-client@0.9.16)
...
$ bower install
...
bower jquery#* install jquery#3.2.1
bower angular#1.4.9 install angular#1.4.9
bower angular-sanitize#1.4.9 install angular-sanitize#1.4.9
bower js-polyfills#^0.1.20 install js-polyfills#0.1.34
bower angular-mocks#1.4.9 install angular-mocks#1.4.9
bower angular-route#1.4.9 install angular-route#1.4.9
bower openlayers#* install openlayers#e-tag:a8ff409d6
...
$
```

Expand Down
32 changes: 31 additions & 1 deletion dist/angular-openlayers-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -1936,11 +1936,41 @@ angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$htt
var createAttribution = function(source) {
var attributions = [];
if (isDefined(source.attribution)) {
attributions.unshift(new ol.Attribution({html: source.attribution}));
// opt-out -> default tries to show an attribution
if (!(source.attribution === false)) { // jshint ignore:line
// we got some HTML so display that as the attribution
attributions.unshift(new ol.Attribution({html: source.attribution}));
}
} else {
// try to infer automatically
var attrib = extractAttributionFromSource(source);
if (attrib) {
attributions.unshift(attrib);
}
}

return attributions;
};

var extractAttributionFromSource = function(source) {
if (source && source.type) {
var ol3SourceInstance = ol.source[source.type];
if (ol3SourceInstance) {
// iterate over the object's props and try
// to find the attribution one as it differs
for (var prop in ol3SourceInstance) {
if (ol3SourceInstance.hasOwnProperty(prop)) {
if (prop.toLowerCase().indexOf('attribution') > -1) {
return ol.source[source.type][prop];
}
}
}
}
}

return null;
};

var createGroup = function(name) {
var olGroup = new ol.layer.Group();
olGroup.set('name', name);
Expand Down
6 changes: 3 additions & 3 deletions dist/angular-openlayers-directive.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/angular-openlayers-directive.min.no-header.js

Large diffs are not rendered by default.

32 changes: 31 additions & 1 deletion dist/angular-openlayers-directive.pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -1936,11 +1936,41 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
var createAttribution = function(source) {
var attributions = [];
if (isDefined(source.attribution)) {
attributions.unshift(new ol.Attribution({html: source.attribution}));
// opt-out -> default tries to show an attribution
if (!(source.attribution === false)) { // jshint ignore:line
// we got some HTML so display that as the attribution
attributions.unshift(new ol.Attribution({html: source.attribution}));
}
} else {
// try to infer automatically
var attrib = extractAttributionFromSource(source);
if (attrib) {
attributions.unshift(attrib);
}
}

return attributions;
};

var extractAttributionFromSource = function(source) {
if (source && source.type) {
var ol3SourceInstance = ol.source[source.type];
if (ol3SourceInstance) {
// iterate over the object's props and try
// to find the attribution one as it differs
for (var prop in ol3SourceInstance) {
if (ol3SourceInstance.hasOwnProperty(prop)) {
if (prop.toLowerCase().indexOf('attribution') > -1) {
return ol.source[source.type][prop];
}
}
}
}
}

return null;
};

var createGroup = function(name) {
var olGroup = new ol.layer.Group();
olGroup.set('name', name);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"main": "dist/angular-openlayers-directive",
"version": "1.19.3"
"version": "1.20.0"
}
32 changes: 31 additions & 1 deletion src/services/olHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,41 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
var createAttribution = function(source) {
var attributions = [];
if (isDefined(source.attribution)) {
attributions.unshift(new ol.Attribution({html: source.attribution}));
// opt-out -> default tries to show an attribution
if (!(source.attribution === false)) { // jshint ignore:line
// we got some HTML so display that as the attribution
attributions.unshift(new ol.Attribution({html: source.attribution}));
}
} else {
// try to infer automatically
var attrib = extractAttributionFromSource(source);
if (attrib) {
attributions.unshift(attrib);
}
}

return attributions;
};

var extractAttributionFromSource = function(source) {
if (source && source.type) {
var ol3SourceInstance = ol.source[source.type];
if (ol3SourceInstance) {
// iterate over the object's props and try
// to find the attribution one as it differs
for (var prop in ol3SourceInstance) {
if (ol3SourceInstance.hasOwnProperty(prop)) {
if (prop.toLowerCase().indexOf('attribution') > -1) {
return ol.source[source.type][prop];
}
}
}
}
}

return null;
};

var createGroup = function(name) {
var olGroup = new ol.layer.Group();
olGroup.set('name', name);
Expand Down

0 comments on commit 1085921

Please sign in to comment.