Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.

Commit 6a84b51

Browse files
committed
Merge
2 parents a7a6b17 + 3c01532 commit 6a84b51

File tree

5 files changed

+330
-324
lines changed

5 files changed

+330
-324
lines changed

examples/js/controllers.js

Lines changed: 107 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,6 +2818,65 @@ var app = angular.module('webapp');
28182818
}
28192819
});
28202820
}]);
2821+
app.controller("LegendEsriLegendDataLegendServiceController", ["$scope", "$http", "$log", "leafletData", function($scope, $http, $log, leafletData) {
2822+
angular.extend($scope, {
2823+
options: {
2824+
controls: {
2825+
layers: {
2826+
visible: false
2827+
}
2828+
}
2829+
},
2830+
usa: {
2831+
lat: 39.931486,
2832+
lng: -101.406250,
2833+
zoom: 3
2834+
},
2835+
markers: {
2836+
m1: {
2837+
lat: 39.931486,
2838+
lng: -101.406250,
2839+
}
2840+
},
2841+
layers: {
2842+
baselayers: {
2843+
mapbox_light: {
2844+
name: 'Mapbox Light',
2845+
url: 'http://api.tiles.mapbox.com/v4/{mapid}/{z}/{x}/{y}.png?access_token={apikey}',
2846+
type: 'xyz',
2847+
layerOptions: {
2848+
apikey: 'pk.eyJ1IjoiYnVmYW51dm9scyIsImEiOiJLSURpX0pnIn0.2_9NrLz1U9bpwMQBhVk97Q',
2849+
mapid: 'bufanuvols.lia22g09'
2850+
}
2851+
}
2852+
},
2853+
overlays: {
2854+
usa_pop: {
2855+
name: "USA 2000-2010 Population Change",
2856+
type: "agsDynamic",
2857+
url: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer",
2858+
visible: true,
2859+
layerOptions: {
2860+
opacity: 0.85,
2861+
attribution: "Copyright:© 2014 Esri, DeLorme, HERE, TomTom"
2862+
}
2863+
}
2864+
},
2865+
},
2866+
legend: {
2867+
legendClass: "info legend-esri",
2868+
position: "bottomleft",
2869+
legendData: null
2870+
}
2871+
});
2872+
leafletData.getMap().then(function(map) {
2873+
$http.get("http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer/legend?f=json")
2874+
.then(function(data) {
2875+
$log.debug('data', data);
2876+
$scope.legend.legendData = data.data;
2877+
});
2878+
});
2879+
}]);
28212880
app.controller("LegendEsriLegendServiceController", [ "$scope", function($scope) {
28222881
angular.extend($scope, {
28232882
options: {
@@ -2934,6 +2993,26 @@ var app = angular.module('webapp');
29342993
name: "USA Social Vulnerability Index",
29352994
type: "agsDynamic",
29362995
url: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Social_Vulnerability_Index/MapServer",
2996+
visible: true,
2997+
layerOptions: {
2998+
opacity: 0.85,
2999+
attribution: "Copyright:© 2014 Esri, FAO, NOAA"
3000+
}
3001+
},
3002+
usa_by_sex: {
3003+
name: "USA Population by Sex",
3004+
type: "agsDynamic",
3005+
url: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Population_by_Sex/MapServer",
3006+
visible: false,
3007+
layerOptions: {
3008+
opacity: 0.85,
3009+
attribution: "Copyright:© 2014 Esri, FAO, NOAA"
3010+
}
3011+
},
3012+
usa_diversity: {
3013+
name: "USA Diversity Index",
3014+
type: "agsDynamic",
3015+
url: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Diversity_Index/MapServer",
29373016
visible: false,
29383017
layerOptions: {
29393018
opacity: 0.85,
@@ -2942,19 +3021,26 @@ var app = angular.module('webapp');
29423021
},
29433022
},
29443023
},
3024+
legendURL1: [
3025+
"http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer/legend?f=json",
3026+
"http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Social_Vulnerability_Index/MapServer/legend?f=json"
3027+
],
3028+
legendURL2: [
3029+
"http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Population_by_Sex/MapServer/legend?f=json",
3030+
"http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Diversity_Index/MapServer/legend?f=json"
3031+
],
29453032
legend: {
2946-
url: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer/legend?f=json",
29473033
legendClass: "info legend-esri",
29483034
position: "bottomleft",
29493035
},
2950-
legendURL1: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer/legend?f=json",
2951-
legendURL2: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Social_Vulnerability_Index/MapServer/legend?f=json",
29523036
switchLegend: function() {
2953-
$scope.layers.overlays.usa_social.visible = !$scope.layers.overlays.usa_social.visible;
3037+
$scope.layers.overlays.usa_by_sex.visible = !$scope.layers.overlays.usa_by_sex.visible;
3038+
$scope.layers.overlays.usa_diversity.visible = !$scope.layers.overlays.usa_diversity.visible;
29543039
$scope.legend.url =
29553040
$scope.legend.url == $scope.legendURL1? $scope.legendURL2:$scope.legendURL1;
29563041
}
29573042
});
3043+
$scope.legend.url = $scope.legendURL1;
29583044
}]);
29593045
app.controller('MarkersAddRemoveController', [ '$scope', function($scope) {
29603046
angular.extend($scope, {
@@ -4035,26 +4121,23 @@ var app = angular.module('webapp');
40354121
}
40364122
})
40374123
}]);
4038-
app.controller('MixedMOverlaysMarkersNestedNoWatchController', function ($scope, leafletData, $timeout) {
4124+
app.controller('MixedMOverlaysMarkersNestedNoWatchController', function ($scope, leafletData, $timeout, leafletLogger) {
4125+
leafletLogger.currentLevel = leafletLogger.LEVELS.debug;
40394126
var _clonedMarkers;
40404127
$timeout(function () {
40414128
//should do nothing (not watched) and only see one destroy
4042-
_clonedMarkers = angular.extend({},$scope.markers);
4043-
$scope.markers = {};
4129+
_clonedMarkers = angular.copy($scope.markers);
40444130
},1000);
40454131
$timeout(function () {
40464132
leafletData.getDirectiveControls().then(function (controls) {
40474133
//move all markers by a few decimal points
4048-
for (var layer in _clonedMarkers) {
4049-
var markerSet = _clonedMarkers[layer];
4050-
for (var markerName in markerSet) {
4051-
var marker = markerSet[markerName];
4052-
marker.lat += .05;
4053-
}
4134+
for (var markerName in _clonedMarkers) {
4135+
var marker = _clonedMarkers[markerName];
4136+
marker.lat += .05;
40544137
}
40554138
//force manual update
4139+
controls.markers.create(_clonedMarkers ,$scope.markers);
40564140
$scope.markers = _clonedMarkers;
4057-
controls.markers.create($scope.markers);
40584141
});
40594142
}, 4000);
40604143
angular.extend($scope, {
@@ -4071,105 +4154,17 @@ var app = angular.module('webapp');
40714154
lng: 2.19110,
40724155
zoom: 11
40734156
},
4074-
layers: {
4075-
baselayers: {
4076-
osm: {
4077-
name: 'OpenStreetMap',
4078-
type: 'xyz',
4079-
url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
4080-
layerOptions: {
4081-
subdomains: ['a', 'b', 'c'],
4082-
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
4083-
continuousWorld: true
4084-
}
4085-
},
4086-
cycle: {
4087-
name: 'OpenCycleMap',
4088-
type: 'xyz',
4089-
url: 'http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png',
4090-
layerOptions: {
4091-
subdomains: ['a', 'b', 'c'],
4092-
attribution: '&copy; <a href="http://www.opencyclemap.org/copyright">OpenCycleMap</a> contributors - &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
4093-
continuousWorld: true
4094-
}
4095-
}
4096-
},
4097-
overlays: {
4098-
hillshade: {
4099-
name: 'Hillshade Europa',
4100-
type: 'wms',
4101-
url: 'http://129.206.228.72/cached/hillshade',
4102-
visible: true,
4103-
layerOptions: {
4104-
layers: 'europe_wms:hs_srtm_europa',
4105-
format: 'image/png',
4106-
opacity: 0.25,
4107-
attribution: 'Hillshade layer by GIScience http://www.osm-wms.de',
4108-
crs: L.CRS.EPSG900913
4109-
}
4110-
},
4111-
fire: {
4112-
name: 'OpenFireMap',
4113-
type: 'xyz',
4114-
url: 'http://openfiremap.org/hytiles/{z}/{x}/{y}.png',
4115-
layerOptions: {
4116-
attribution: '&copy; <a href="http://www.openfiremap.org">OpenFireMap</a> contributors - &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
4117-
continuousWorld: true
4118-
}
4119-
},
4120-
cars: {
4121-
name: 'Cars',
4122-
type: 'group',
4123-
visible: true
4124-
},
4125-
bikes: {
4126-
name: 'Bicycles',
4127-
type: 'group',
4128-
visible: false
4129-
},
4130-
runners: {
4131-
name: 'Runners',
4132-
type: 'group',
4133-
visible: false
4134-
}
4135-
}
4136-
},
41374157
markers: {
4138-
cars: {
4139-
m1: {
4140-
lat: 42.20133,
4141-
lng: 2.19110,
4142-
message: "I'm a car"
4143-
},
4144-
m2: {
4145-
lat: 42.21133,
4146-
lng: 2.18110,
4147-
message: "I'm a car"
4148-
}
4149-
},
4150-
bikes: {
4151-
m3: {
4152-
lat: 42.19133,
4153-
lng: 2.18110,
4154-
layer: 'bikes',
4155-
message: 'A bike!!'
4156-
},
4157-
m4: {
4158-
lat: 42.3,
4159-
lng: 2.16110,
4160-
layer: 'bikes'
4161-
}
4162-
},
4163-
runners: {
4164-
m5: {
4165-
lat: 42.1,
4166-
lng: 2.16910
4167-
},
4168-
m6: {
4169-
lat: 42.15,
4170-
lng: 2.17110
4171-
}
4172-
}
4158+
m1: {
4159+
lat: 42.20133,
4160+
lng: 2.19110,
4161+
message: "I'm a car"
4162+
},
4163+
m2: {
4164+
lat: 42.21133,
4165+
lng: 2.18110,
4166+
message: "I'm a car"
4167+
}
41734168
}
41744169
});
41754170
});
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
app.controller("LegendEsriLegendDataLegendServiceController", ["$scope", "$http", "$log", "leafletData", function($scope, $http, $log, leafletData) {
2+
angular.extend($scope, {
3+
options: {
4+
controls: {
5+
layers: {
6+
visible: false
7+
}
8+
}
9+
},
10+
usa: {
11+
lat: 39.931486,
12+
lng: -101.406250,
13+
zoom: 3
14+
},
15+
markers: {
16+
m1: {
17+
lat: 39.931486,
18+
lng: -101.406250,
19+
}
20+
},
21+
layers: {
22+
baselayers: {
23+
mapbox_light: {
24+
name: 'Mapbox Light',
25+
url: 'http://api.tiles.mapbox.com/v4/{mapid}/{z}/{x}/{y}.png?access_token={apikey}',
26+
type: 'xyz',
27+
layerOptions: {
28+
apikey: 'pk.eyJ1IjoiYnVmYW51dm9scyIsImEiOiJLSURpX0pnIn0.2_9NrLz1U9bpwMQBhVk97Q',
29+
mapid: 'bufanuvols.lia22g09'
30+
}
31+
}
32+
},
33+
overlays: {
34+
usa_pop: {
35+
name: "USA 2000-2010 Population Change",
36+
type: "agsDynamic",
37+
url: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer",
38+
visible: true,
39+
layerOptions: {
40+
opacity: 0.85,
41+
attribution: "Copyright:© 2014 Esri, DeLorme, HERE, TomTom"
42+
}
43+
}
44+
},
45+
},
46+
legend: {
47+
legendClass: "info legend-esri",
48+
position: "bottomleft",
49+
legendData: null
50+
}
51+
});
52+
leafletData.getMap().then(function(map) {
53+
$http.get("http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer/legend?f=json")
54+
.then(function(data) {
55+
$log.debug('data', data);
56+
$scope.legend.legendData = data.data;
57+
});
58+
});
59+
}]);

examples/js/controllers/LegendEsriMultilayerLegendServiceController.js

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,26 @@
4545
name: "USA Social Vulnerability Index",
4646
type: "agsDynamic",
4747
url: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Social_Vulnerability_Index/MapServer",
48+
visible: true,
49+
layerOptions: {
50+
opacity: 0.85,
51+
attribution: "Copyright:© 2014 Esri, FAO, NOAA"
52+
}
53+
},
54+
usa_by_sex: {
55+
name: "USA Population by Sex",
56+
type: "agsDynamic",
57+
url: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Population_by_Sex/MapServer",
58+
visible: false,
59+
layerOptions: {
60+
opacity: 0.85,
61+
attribution: "Copyright:© 2014 Esri, FAO, NOAA"
62+
}
63+
},
64+
usa_diversity: {
65+
name: "USA Diversity Index",
66+
type: "agsDynamic",
67+
url: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Diversity_Index/MapServer",
4868
visible: false,
4969
layerOptions: {
5070
opacity: 0.85,
@@ -53,17 +73,24 @@
5373
},
5474
},
5575
},
76+
legendURL1: [
77+
"http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer/legend?f=json",
78+
"http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Social_Vulnerability_Index/MapServer/legend?f=json"
79+
],
80+
legendURL2: [
81+
"http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Population_by_Sex/MapServer/legend?f=json",
82+
"http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Diversity_Index/MapServer/legend?f=json"
83+
],
5684
legend: {
57-
url: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer/legend?f=json",
5885
legendClass: "info legend-esri",
5986
position: "bottomleft",
6087
},
61-
legendURL1: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer/legend?f=json",
62-
legendURL2: "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Social_Vulnerability_Index/MapServer/legend?f=json",
6388
switchLegend: function() {
64-
$scope.layers.overlays.usa_social.visible = !$scope.layers.overlays.usa_social.visible;
89+
$scope.layers.overlays.usa_by_sex.visible = !$scope.layers.overlays.usa_by_sex.visible;
90+
$scope.layers.overlays.usa_diversity.visible = !$scope.layers.overlays.usa_diversity.visible;
6591
$scope.legend.url =
6692
$scope.legend.url == $scope.legendURL1? $scope.legendURL2:$scope.legendURL1;
6793
}
6894
});
95+
$scope.legend.url = $scope.legendURL1;
6996
}]);

0 commit comments

Comments
 (0)