Skip to content

Commit 1085921

Browse files
committed
v1.20.0
2 parents f7b5edf + 7eeba47 commit 1085921

File tree

7 files changed

+112
-11
lines changed

7 files changed

+112
-11
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Software development life-cycle
8989
-------------------------------
9090
There are a some Grunt tasks defined to ease the development cycle. Let's see how to use them:
9191

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

9494
```
9595
# Inside the project dir, install the dependencies
@@ -110,6 +110,17 @@ npm http GET https://registry.npmjs.org/grunt-ngmin
110110
├── useragent@2.0.7 (lru-cache@2.2.4)
111111
├── connect@2.8.8 (methods@0.0.1, uid2@0.0.2, fresh@0.2.0, cookie@0.1.0, ..., send@0.1.4)
112112
└── socket.io@0.9.16 (base64id@0.1.0, policyfile@0.0.4, redis@0.7.3, socket.io-client@0.9.16)
113+
...
114+
$ bower install
115+
...
116+
bower jquery#* install jquery#3.2.1
117+
bower angular#1.4.9 install angular#1.4.9
118+
bower angular-sanitize#1.4.9 install angular-sanitize#1.4.9
119+
bower js-polyfills#^0.1.20 install js-polyfills#0.1.34
120+
bower angular-mocks#1.4.9 install angular-mocks#1.4.9
121+
bower angular-route#1.4.9 install angular-route#1.4.9
122+
bower openlayers#* install openlayers#e-tag:a8ff409d6
123+
...
113124
$
114125
```
115126

dist/angular-openlayers-directive.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1936,11 +1936,41 @@ angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$htt
19361936
var createAttribution = function(source) {
19371937
var attributions = [];
19381938
if (isDefined(source.attribution)) {
1939-
attributions.unshift(new ol.Attribution({html: source.attribution}));
1939+
// opt-out -> default tries to show an attribution
1940+
if (!(source.attribution === false)) { // jshint ignore:line
1941+
// we got some HTML so display that as the attribution
1942+
attributions.unshift(new ol.Attribution({html: source.attribution}));
1943+
}
1944+
} else {
1945+
// try to infer automatically
1946+
var attrib = extractAttributionFromSource(source);
1947+
if (attrib) {
1948+
attributions.unshift(attrib);
1949+
}
19401950
}
1951+
19411952
return attributions;
19421953
};
19431954

1955+
var extractAttributionFromSource = function(source) {
1956+
if (source && source.type) {
1957+
var ol3SourceInstance = ol.source[source.type];
1958+
if (ol3SourceInstance) {
1959+
// iterate over the object's props and try
1960+
// to find the attribution one as it differs
1961+
for (var prop in ol3SourceInstance) {
1962+
if (ol3SourceInstance.hasOwnProperty(prop)) {
1963+
if (prop.toLowerCase().indexOf('attribution') > -1) {
1964+
return ol.source[source.type][prop];
1965+
}
1966+
}
1967+
}
1968+
}
1969+
}
1970+
1971+
return null;
1972+
};
1973+
19441974
var createGroup = function(name) {
19451975
var olGroup = new ol.layer.Group();
19461976
olGroup.set('name', name);

dist/angular-openlayers-directive.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-openlayers-directive.min.no-header.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-openlayers-directive.pre.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1936,11 +1936,41 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
19361936
var createAttribution = function(source) {
19371937
var attributions = [];
19381938
if (isDefined(source.attribution)) {
1939-
attributions.unshift(new ol.Attribution({html: source.attribution}));
1939+
// opt-out -> default tries to show an attribution
1940+
if (!(source.attribution === false)) { // jshint ignore:line
1941+
// we got some HTML so display that as the attribution
1942+
attributions.unshift(new ol.Attribution({html: source.attribution}));
1943+
}
1944+
} else {
1945+
// try to infer automatically
1946+
var attrib = extractAttributionFromSource(source);
1947+
if (attrib) {
1948+
attributions.unshift(attrib);
1949+
}
19401950
}
1951+
19411952
return attributions;
19421953
};
19431954

1955+
var extractAttributionFromSource = function(source) {
1956+
if (source && source.type) {
1957+
var ol3SourceInstance = ol.source[source.type];
1958+
if (ol3SourceInstance) {
1959+
// iterate over the object's props and try
1960+
// to find the attribution one as it differs
1961+
for (var prop in ol3SourceInstance) {
1962+
if (ol3SourceInstance.hasOwnProperty(prop)) {
1963+
if (prop.toLowerCase().indexOf('attribution') > -1) {
1964+
return ol.source[source.type][prop];
1965+
}
1966+
}
1967+
}
1968+
}
1969+
}
1970+
1971+
return null;
1972+
};
1973+
19441974
var createGroup = function(name) {
19451975
var olGroup = new ol.layer.Group();
19461976
olGroup.set('name', name);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@
6666
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
6767
},
6868
"main": "dist/angular-openlayers-directive",
69-
"version": "1.19.3"
69+
"version": "1.20.0"
7070
}

src/services/olHelpers.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,11 +685,41 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
685685
var createAttribution = function(source) {
686686
var attributions = [];
687687
if (isDefined(source.attribution)) {
688-
attributions.unshift(new ol.Attribution({html: source.attribution}));
688+
// opt-out -> default tries to show an attribution
689+
if (!(source.attribution === false)) { // jshint ignore:line
690+
// we got some HTML so display that as the attribution
691+
attributions.unshift(new ol.Attribution({html: source.attribution}));
692+
}
693+
} else {
694+
// try to infer automatically
695+
var attrib = extractAttributionFromSource(source);
696+
if (attrib) {
697+
attributions.unshift(attrib);
698+
}
689699
}
700+
690701
return attributions;
691702
};
692703

704+
var extractAttributionFromSource = function(source) {
705+
if (source && source.type) {
706+
var ol3SourceInstance = ol.source[source.type];
707+
if (ol3SourceInstance) {
708+
// iterate over the object's props and try
709+
// to find the attribution one as it differs
710+
for (var prop in ol3SourceInstance) {
711+
if (ol3SourceInstance.hasOwnProperty(prop)) {
712+
if (prop.toLowerCase().indexOf('attribution') > -1) {
713+
return ol.source[source.type][prop];
714+
}
715+
}
716+
}
717+
}
718+
}
719+
720+
return null;
721+
};
722+
693723
var createGroup = function(name) {
694724
var olGroup = new ol.layer.Group();
695725
olGroup.set('name', name);

0 commit comments

Comments
 (0)