Skip to content

Commit 0c8a038

Browse files
committed
v1.6.0
2 parents 666f0d3 + 0f8610a commit 0c8a038

8 files changed

+126
-82
lines changed

dist/angular-openlayers-directive.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,9 +1100,7 @@ angular.module('openlayers-directive').directive('olMarker', ["$log", "$q", "olM
11001100
};
11011101
}]);
11021102

1103-
angular.module('openlayers-directive').service('olData', ["$log", "$q", "olHelpers", function($log, $q, olHelpers) {
1104-
1105-
var obtainEffectiveMapId = olHelpers.obtainEffectiveMapId;
1103+
angular.module('openlayers-directive').service('olData', ["$log", "$q", function($log, $q) {
11061104

11071105
var maps = {};
11081106

@@ -1150,6 +1148,28 @@ angular.module('openlayers-directive').service('olData', ["$log", "$q", "olHelpe
11501148
return defer.promise;
11511149
};
11521150

1151+
function obtainEffectiveMapId(d, mapId) {
1152+
var id;
1153+
var i;
1154+
if (!angular.isDefined(mapId)) {
1155+
if (Object.keys(d).length === 1) {
1156+
for (i in d) {
1157+
if (d.hasOwnProperty(i)) {
1158+
id = i;
1159+
}
1160+
}
1161+
} else if (Object.keys(d).length === 0) {
1162+
id = 'main';
1163+
} else {
1164+
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
1165+
'you must provide the map ID to the olData.getXXX call');
1166+
}
1167+
} else {
1168+
id = mapId;
1169+
}
1170+
return id;
1171+
}
1172+
11531173
}]);
11541174

11551175
angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$http", function($q, $log, $http) {
@@ -1192,6 +1212,7 @@ angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$htt
11921212
attribution: ol.control.Attribution,
11931213
fullscreen: ol.control.FullScreen,
11941214
mouseposition: ol.control.MousePosition,
1215+
overviewmap: ol.control.OverviewMap,
11951216
rotate: ol.control.Rotate,
11961217
scaleline: ol.control.ScaleLine,
11971218
zoom: ol.control.Zoom,
@@ -1871,28 +1892,6 @@ angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$htt
18711892
return typeof value === 'boolean';
18721893
},
18731894

1874-
obtainEffectiveMapId: function(d, mapId) {
1875-
var id;
1876-
var i;
1877-
if (!angular.isDefined(mapId)) {
1878-
if (Object.keys(d).length === 1) {
1879-
for (i in d) {
1880-
if (d.hasOwnProperty(i)) {
1881-
id = i;
1882-
}
1883-
}
1884-
} else if (Object.keys(d).length === 0) {
1885-
id = 'main';
1886-
} else {
1887-
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
1888-
'you must provide the map ID to the olData.getXXX call');
1889-
}
1890-
} else {
1891-
id = mapId;
1892-
}
1893-
return id;
1894-
},
1895-
18961895
createStyle: createStyle,
18971896

18981897
setMapEvents: function(events, map, scope) {

dist/angular-openlayers-directive.min.js

Lines changed: 2 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: 2 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: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,9 +1100,7 @@ angular.module('openlayers-directive').directive('olMarker', function($log, $q,
11001100
};
11011101
});
11021102

1103-
angular.module('openlayers-directive').service('olData', function($log, $q, olHelpers) {
1104-
1105-
var obtainEffectiveMapId = olHelpers.obtainEffectiveMapId;
1103+
angular.module('openlayers-directive').service('olData', function($log, $q) {
11061104

11071105
var maps = {};
11081106

@@ -1150,6 +1148,28 @@ angular.module('openlayers-directive').service('olData', function($log, $q, olHe
11501148
return defer.promise;
11511149
};
11521150

1151+
function obtainEffectiveMapId(d, mapId) {
1152+
var id;
1153+
var i;
1154+
if (!angular.isDefined(mapId)) {
1155+
if (Object.keys(d).length === 1) {
1156+
for (i in d) {
1157+
if (d.hasOwnProperty(i)) {
1158+
id = i;
1159+
}
1160+
}
1161+
} else if (Object.keys(d).length === 0) {
1162+
id = 'main';
1163+
} else {
1164+
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
1165+
'you must provide the map ID to the olData.getXXX call');
1166+
}
1167+
} else {
1168+
id = mapId;
1169+
}
1170+
return id;
1171+
}
1172+
11531173
});
11541174

11551175
angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $http) {
@@ -1192,6 +1212,7 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
11921212
attribution: ol.control.Attribution,
11931213
fullscreen: ol.control.FullScreen,
11941214
mouseposition: ol.control.MousePosition,
1215+
overviewmap: ol.control.OverviewMap,
11951216
rotate: ol.control.Rotate,
11961217
scaleline: ol.control.ScaleLine,
11971218
zoom: ol.control.Zoom,
@@ -1871,28 +1892,6 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
18711892
return typeof value === 'boolean';
18721893
},
18731894

1874-
obtainEffectiveMapId: function(d, mapId) {
1875-
var id;
1876-
var i;
1877-
if (!angular.isDefined(mapId)) {
1878-
if (Object.keys(d).length === 1) {
1879-
for (i in d) {
1880-
if (d.hasOwnProperty(i)) {
1881-
id = i;
1882-
}
1883-
}
1884-
} else if (Object.keys(d).length === 0) {
1885-
id = 'main';
1886-
} else {
1887-
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
1888-
'you must provide the map ID to the olData.getXXX call');
1889-
}
1890-
} else {
1891-
id = mapId;
1892-
}
1893-
return id;
1894-
},
1895-
18961895
createStyle: createStyle,
18971896

18981897
setMapEvents: function(events, map, scope) {
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!DOCTYPE html>
2+
<html ng-app="demoapp">
3+
<head>
4+
<script src="../bower_components/openlayers3/build/ol.js"></script>
5+
<script src="../bower_components/angular/angular.min.js"></script>
6+
<script src="../bower_components/angular-sanitize/angular-sanitize.min.js"></script>
7+
<script src="../dist/angular-openlayers-directive.js"></script>
8+
<link rel="stylesheet" href="../bower_components/openlayers3/build/ol.css" />
9+
<link rel="stylesheet" href="../dist/angular-openlayers-directive.css" />
10+
<style>
11+
.ol-overviewmap-box {
12+
border: 2px solid red;
13+
}
14+
</style>
15+
<script>
16+
var app = angular.module("demoapp", ["openlayers-directive"]);
17+
app.controller("ControlOverviewmapController", [ '$scope', '$http', 'olData', function($scope, $http, olData) {
18+
angular.extend($scope, {
19+
center: {
20+
lat: 43.88,
21+
lon: 7.57,
22+
zoom: 4
23+
},
24+
layers: {
25+
main: {
26+
source: {
27+
type: 'BingMaps',
28+
key: 'Aj6XtE1Q1rIvehmjn2Rh1LR2qvMGZ-8vPS9Hn3jCeUiToM77JFnf-kFRzyMELDol',
29+
imagerySet: 'Aerial'
30+
}
31+
}
32+
},
33+
controls: [
34+
{ name: 'zoom', active: true },
35+
{ name: 'overviewmap', active: true, collapsed:false }
36+
]
37+
});
38+
} ]);
39+
</script>
40+
</head>
41+
<body ng-controller="ControlOverviewmapController">
42+
<openlayers ol-center="center" ol-layers="layers">
43+
<ol-control name="{{ control.name }}" ng-repeat="control in controls|filter: {active: true}" ol-control-properties="control"></ol-control>
44+
</openlayers>
45+
<h1>Overview control example</h1>
46+
<p>Example of the overviewmap control. Controls object:</p>
47+
<pre ng-bind="controls | json"></pre>
48+
</body>
49+
</html>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@
6161
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
6262
},
6363
"main": "dist/angular-openlayers-directive",
64-
"version": "1.5.0"
64+
"version": "1.6.0"
6565
}

src/services/olData.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
angular.module('openlayers-directive').service('olData', function($log, $q, olHelpers) {
2-
3-
var obtainEffectiveMapId = olHelpers.obtainEffectiveMapId;
1+
angular.module('openlayers-directive').service('olData', function($log, $q) {
42

53
var maps = {};
64

@@ -48,4 +46,26 @@ angular.module('openlayers-directive').service('olData', function($log, $q, olHe
4846
return defer.promise;
4947
};
5048

49+
function obtainEffectiveMapId(d, mapId) {
50+
var id;
51+
var i;
52+
if (!angular.isDefined(mapId)) {
53+
if (Object.keys(d).length === 1) {
54+
for (i in d) {
55+
if (d.hasOwnProperty(i)) {
56+
id = i;
57+
}
58+
}
59+
} else if (Object.keys(d).length === 0) {
60+
id = 'main';
61+
} else {
62+
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
63+
'you must provide the map ID to the olData.getXXX call');
64+
}
65+
} else {
66+
id = mapId;
67+
}
68+
return id;
69+
}
70+
5171
});

src/services/olHelpers.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
3838
attribution: ol.control.Attribution,
3939
fullscreen: ol.control.FullScreen,
4040
mouseposition: ol.control.MousePosition,
41+
overviewmap: ol.control.OverviewMap,
4142
rotate: ol.control.Rotate,
4243
scaleline: ol.control.ScaleLine,
4344
zoom: ol.control.Zoom,
@@ -717,28 +718,6 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
717718
return typeof value === 'boolean';
718719
},
719720

720-
obtainEffectiveMapId: function(d, mapId) {
721-
var id;
722-
var i;
723-
if (!angular.isDefined(mapId)) {
724-
if (Object.keys(d).length === 1) {
725-
for (i in d) {
726-
if (d.hasOwnProperty(i)) {
727-
id = i;
728-
}
729-
}
730-
} else if (Object.keys(d).length === 0) {
731-
id = 'main';
732-
} else {
733-
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
734-
'you must provide the map ID to the olData.getXXX call');
735-
}
736-
} else {
737-
id = mapId;
738-
}
739-
return id;
740-
},
741-
742721
createStyle: createStyle,
743722

744723
setMapEvents: function(events, map, scope) {

0 commit comments

Comments
 (0)