Skip to content

Commit

Permalink
v1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
www committed Dec 25, 2015
2 parents 666f0d3 + 0f8610a commit 0c8a038
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 82 deletions.
49 changes: 24 additions & 25 deletions dist/angular-openlayers-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -1100,9 +1100,7 @@ angular.module('openlayers-directive').directive('olMarker', ["$log", "$q", "olM
};
}]);

angular.module('openlayers-directive').service('olData', ["$log", "$q", "olHelpers", function($log, $q, olHelpers) {

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

var maps = {};

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

function obtainEffectiveMapId(d, mapId) {
var id;
var i;
if (!angular.isDefined(mapId)) {
if (Object.keys(d).length === 1) {
for (i in d) {
if (d.hasOwnProperty(i)) {
id = i;
}
}
} else if (Object.keys(d).length === 0) {
id = 'main';
} else {
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
'you must provide the map ID to the olData.getXXX call');
}
} else {
id = mapId;
}
return id;
}

}]);

angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$http", function($q, $log, $http) {
Expand Down Expand Up @@ -1192,6 +1212,7 @@ angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$htt
attribution: ol.control.Attribution,
fullscreen: ol.control.FullScreen,
mouseposition: ol.control.MousePosition,
overviewmap: ol.control.OverviewMap,
rotate: ol.control.Rotate,
scaleline: ol.control.ScaleLine,
zoom: ol.control.Zoom,
Expand Down Expand Up @@ -1871,28 +1892,6 @@ angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$htt
return typeof value === 'boolean';
},

obtainEffectiveMapId: function(d, mapId) {
var id;
var i;
if (!angular.isDefined(mapId)) {
if (Object.keys(d).length === 1) {
for (i in d) {
if (d.hasOwnProperty(i)) {
id = i;
}
}
} else if (Object.keys(d).length === 0) {
id = 'main';
} else {
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
'you must provide the map ID to the olData.getXXX call');
}
} else {
id = mapId;
}
return id;
},

createStyle: createStyle,

setMapEvents: function(events, map, scope) {
Expand Down
5 changes: 2 additions & 3 deletions dist/angular-openlayers-directive.min.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

49 changes: 24 additions & 25 deletions dist/angular-openlayers-directive.pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -1100,9 +1100,7 @@ angular.module('openlayers-directive').directive('olMarker', function($log, $q,
};
});

angular.module('openlayers-directive').service('olData', function($log, $q, olHelpers) {

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

var maps = {};

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

function obtainEffectiveMapId(d, mapId) {
var id;
var i;
if (!angular.isDefined(mapId)) {
if (Object.keys(d).length === 1) {
for (i in d) {
if (d.hasOwnProperty(i)) {
id = i;
}
}
} else if (Object.keys(d).length === 0) {
id = 'main';
} else {
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
'you must provide the map ID to the olData.getXXX call');
}
} else {
id = mapId;
}
return id;
}

});

angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $http) {
Expand Down Expand Up @@ -1192,6 +1212,7 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
attribution: ol.control.Attribution,
fullscreen: ol.control.FullScreen,
mouseposition: ol.control.MousePosition,
overviewmap: ol.control.OverviewMap,
rotate: ol.control.Rotate,
scaleline: ol.control.ScaleLine,
zoom: ol.control.Zoom,
Expand Down Expand Up @@ -1871,28 +1892,6 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
return typeof value === 'boolean';
},

obtainEffectiveMapId: function(d, mapId) {
var id;
var i;
if (!angular.isDefined(mapId)) {
if (Object.keys(d).length === 1) {
for (i in d) {
if (d.hasOwnProperty(i)) {
id = i;
}
}
} else if (Object.keys(d).length === 0) {
id = 'main';
} else {
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
'you must provide the map ID to the olData.getXXX call');
}
} else {
id = mapId;
}
return id;
},

createStyle: createStyle,

setMapEvents: function(events, map, scope) {
Expand Down
49 changes: 49 additions & 0 deletions examples/105-controls-overviewmap-example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html ng-app="demoapp">
<head>
<script src="../bower_components/openlayers3/build/ol.js"></script>
<script src="../bower_components/angular/angular.min.js"></script>
<script src="../bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script src="../dist/angular-openlayers-directive.js"></script>
<link rel="stylesheet" href="../bower_components/openlayers3/build/ol.css" />
<link rel="stylesheet" href="../dist/angular-openlayers-directive.css" />
<style>
.ol-overviewmap-box {
border: 2px solid red;
}
</style>
<script>
var app = angular.module("demoapp", ["openlayers-directive"]);
app.controller("ControlOverviewmapController", [ '$scope', '$http', 'olData', function($scope, $http, olData) {
angular.extend($scope, {
center: {
lat: 43.88,
lon: 7.57,
zoom: 4
},
layers: {
main: {
source: {
type: 'BingMaps',
key: 'Aj6XtE1Q1rIvehmjn2Rh1LR2qvMGZ-8vPS9Hn3jCeUiToM77JFnf-kFRzyMELDol',
imagerySet: 'Aerial'
}
}
},
controls: [
{ name: 'zoom', active: true },
{ name: 'overviewmap', active: true, collapsed:false }
]
});
} ]);
</script>
</head>
<body ng-controller="ControlOverviewmapController">
<openlayers ol-center="center" ol-layers="layers">
<ol-control name="{{ control.name }}" ng-repeat="control in controls|filter: {active: true}" ol-control-properties="control"></ol-control>
</openlayers>
<h1>Overview control example</h1>
<p>Example of the overviewmap control. Controls object:</p>
<pre ng-bind="controls | json"></pre>
</body>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"main": "dist/angular-openlayers-directive",
"version": "1.5.0"
"version": "1.6.0"
}
26 changes: 23 additions & 3 deletions src/services/olData.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
angular.module('openlayers-directive').service('olData', function($log, $q, olHelpers) {

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

var maps = {};

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

function obtainEffectiveMapId(d, mapId) {
var id;
var i;
if (!angular.isDefined(mapId)) {
if (Object.keys(d).length === 1) {
for (i in d) {
if (d.hasOwnProperty(i)) {
id = i;
}
}
} else if (Object.keys(d).length === 0) {
id = 'main';
} else {
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
'you must provide the map ID to the olData.getXXX call');
}
} else {
id = mapId;
}
return id;
}

});
23 changes: 1 addition & 22 deletions src/services/olHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
attribution: ol.control.Attribution,
fullscreen: ol.control.FullScreen,
mouseposition: ol.control.MousePosition,
overviewmap: ol.control.OverviewMap,
rotate: ol.control.Rotate,
scaleline: ol.control.ScaleLine,
zoom: ol.control.Zoom,
Expand Down Expand Up @@ -717,28 +718,6 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
return typeof value === 'boolean';
},

obtainEffectiveMapId: function(d, mapId) {
var id;
var i;
if (!angular.isDefined(mapId)) {
if (Object.keys(d).length === 1) {
for (i in d) {
if (d.hasOwnProperty(i)) {
id = i;
}
}
} else if (Object.keys(d).length === 0) {
id = 'main';
} else {
$log.error('[AngularJS - Openlayers] - You have more than 1 map on the DOM, ' +
'you must provide the map ID to the olData.getXXX call');
}
} else {
id = mapId;
}
return id;
},

createStyle: createStyle,

setMapEvents: function(events, map, scope) {
Expand Down

0 comments on commit 0c8a038

Please sign in to comment.