@@ -2818,6 +2818,65 @@ var app = angular.module('webapp');
2818
2818
}
2819
2819
} ) ;
2820
2820
} ] ) ;
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
+ } ] ) ;
2821
2880
app . controller ( "LegendEsriLegendServiceController" , [ "$scope" , function ( $scope ) {
2822
2881
angular . extend ( $scope , {
2823
2882
options : {
@@ -2934,6 +2993,26 @@ var app = angular.module('webapp');
2934
2993
name : "USA Social Vulnerability Index" ,
2935
2994
type : "agsDynamic" ,
2936
2995
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" ,
2937
3016
visible : false ,
2938
3017
layerOptions : {
2939
3018
opacity : 0.85 ,
@@ -2942,19 +3021,26 @@ var app = angular.module('webapp');
2942
3021
} ,
2943
3022
} ,
2944
3023
} ,
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
+ ] ,
2945
3032
legend : {
2946
- url : "http://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_1990-2000_Population_Change/MapServer/legend?f=json" ,
2947
3033
legendClass : "info legend-esri" ,
2948
3034
position : "bottomleft" ,
2949
3035
} ,
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" ,
2952
3036
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 ;
2954
3039
$scope . legend . url =
2955
3040
$scope . legend . url == $scope . legendURL1 ? $scope . legendURL2 :$scope . legendURL1 ;
2956
3041
}
2957
3042
} ) ;
3043
+ $scope . legend . url = $scope . legendURL1 ;
2958
3044
} ] ) ;
2959
3045
app . controller ( 'MarkersAddRemoveController' , [ '$scope' , function ( $scope ) {
2960
3046
angular . extend ( $scope , {
@@ -4035,26 +4121,23 @@ var app = angular.module('webapp');
4035
4121
}
4036
4122
} )
4037
4123
} ] ) ;
4038
- app . controller ( 'MixedMOverlaysMarkersNestedNoWatchController' , function ( $scope , leafletData , $timeout ) {
4124
+ app . controller ( 'MixedMOverlaysMarkersNestedNoWatchController' , function ( $scope , leafletData , $timeout , leafletLogger ) {
4125
+ leafletLogger . currentLevel = leafletLogger . LEVELS . debug ;
4039
4126
var _clonedMarkers ;
4040
4127
$timeout ( function ( ) {
4041
4128
//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 ) ;
4044
4130
} , 1000 ) ;
4045
4131
$timeout ( function ( ) {
4046
4132
leafletData . getDirectiveControls ( ) . then ( function ( controls ) {
4047
4133
//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 ;
4054
4137
}
4055
4138
//force manual update
4139
+ controls . markers . create ( _clonedMarkers , $scope . markers ) ;
4056
4140
$scope . markers = _clonedMarkers ;
4057
- controls . markers . create ( $scope . markers ) ;
4058
4141
} ) ;
4059
4142
} , 4000 ) ;
4060
4143
angular . extend ( $scope , {
@@ -4071,105 +4154,17 @@ var app = angular.module('webapp');
4071
4154
lng : 2.19110 ,
4072
4155
zoom : 11
4073
4156
} ,
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 : '© <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 : '© <a href="http://www.opencyclemap.org/copyright">OpenCycleMap</a> contributors - © <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 : '© <a href="http://www.openfiremap.org">OpenFireMap</a> contributors - © <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
- } ,
4137
4157
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
+ }
4173
4168
}
4174
4169
} ) ;
4175
4170
} ) ;
0 commit comments