Debian Codegraph @

dojox/geo/openlayers/tests/widgetFeature/test_widgetFeature_amd.html

raw symbols SCIP
1 <html>
2 <head profile="http://www.w3.org/2002/12/namespace">
3 <link rel="stylesheet" type="text/css" href="../../../../../dijit/themes/dijit.css">
4 <link rel="stylesheet" type="text/css" href="../../../../../dijit/themes/tundra/tundra.css">
5 <title>Dojo Widget Feature</title>
6 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
7
8 <!-- hosted version -->
9 <script type="text/javascript" src="http://openlayers.org/api/2/OpenLayers.js"></script>
10
11 <script type="text/javascript">
12 var dojoConfig = {
13 parseOnLoad : true,
14 async:true
15 };
16 </script>
17
18 <script type="text/javascript" src="../../../../../dojo/dojo.js"></script>
19
20 <script type="text/javascript">
21 require([
22 "dojo/ready",
23 "dojo/_base/array",
24 "dojo/_base/window",
25 "dojo/sniff",
26 "dojo/dom-construct",
27 "dojox/geo/openlayers/_base",
28 "dojox/geo/openlayers/widget/Map",
29 "dojox/geo/openlayers/Layer",
30 "dojox/geo/openlayers/WidgetFeature",
31 "dojox/charting/widget/Chart",
32 "dojox/charting/themes/PlotKit/blue",
33 "dijit/form/RadioButton",
34 "dojo/parser",
35 "dojox/charting/plot2d/Pie"
36 ],
37 function(ready, arr, win, sniff, domConstruct, openlayers, Map, Layer, WidgetFeature, Chart, blue, RadioButton){
38
39 var map;
40
41 ready(function(){
42 var opts = {
43 baseLayerType : openlayers.OSM
44 };
45
46 map = new Map({}, "map");
47 map.startup();
48
49 var loc = '{"position" : [2.940673, 47.179259], "extent" : "5"}';
50 map.map.fitTo(loc);
51
52 createCharts();
53 });
54
55 function toDeg(r){
56 return r * 180 / Math.PI;
57 }
58
59 var locs = [{
60 name : "Nice",
61 x : 7.262,
62 y : 43.706
63 }, {
64 name : "Aix-en-Provence",
65 x : 5.448,
66 y : 43.528
67 }, {
68 name : "Marseille",
69 x : 5.399,
70 y : 43.297
71 }, {
72 name : "Caen",
73 x : -0.360,
74 y : 49.184
75 }, {
76 name : "Dijon",
77 x : 5.036,
78 y : 47.322
79 }, {
80 name : "Besancon",
81 x : 6.026,
82 y : 47.245
83 }, {
84 name : "Brest",
85 x : -4.490,
86 y : 48.388
87 }, {
88 name : "Nimes",
89 x : 4.361,
90 y : 43.839
91 }, {
92 name : "Toulouse",
93 x : 1.450,
94 y : 43.600
95 }, {
96 name : "Bordeaux",
97 x : -0.575,
98 y : 44.843
99 }, {
100 name : "Montpellier",
101 x : 3.874,
102 y : 43.609
103 }, {
104 name : "Rennes",
105 x : -1.680,
106 y : 48.108
107 }, {
108 name : "Tours",
109 x : 0.684,
110 y : 47.393
111 }, {
112 name : "Grenoble",
113 x : 5.723,
114 y : 45.185
115 }, {
116 name : "Saint-Etienne",
117 x : 4.390,
118 y : 45.441
119 }, {
120 name : "Nantes",
121 x : -1.554,
122 y : 47.219
123 }, {
124 name : "Orleans",
125 x : 1.907,
126 y : 47.904
127 }, {
128 name : "Angers",
129 x : -0.556,
130 y : 47.471
131 }, {
132 name : "Reims",
133 x : 4.031,
134 y : 49.258
135 }, {
136 name : "Nancy",
137 x : 6.174,
138 y : 48.690
139 }, {
140 name : "Metz",
141 x : 6.183,
142 y : 49.109
143 }, {
144 name : "Lille",
145 x : 3.045,
146 y : 50.628
147 }, {
148 name : "Clermont-Ferrand",
149 x : 3.085,
150 y : 45.779
151 }, {
152 name : "Perpignan",
153 x : 2.893,
154 y : 42.698
155 }, {
156 name : "Strasbourg",
157 x : 7.756,
158 y : 48.584
159 }, {
160 name : "Mulhouse",
161 x : 7.333,
162 y : 47.748
163 }, {
164 name : "Lyon",
165 x : 4.835,
166 y : 45.760
167 }, {
168 name : "Villeurbanne",
169 x : 4.882,
170 y : 45.779
171 }, {
172 name : "Le Mans",
173 x : 0.203,
174 y : 47.996
175 }, {
176 name : "Paris",
177 x : 2.346,
178 y : 48.861
179 }, {
180 name : "Le Havre",
181 x : 0.127,
182 y : 49.501
183 }, {
184 name : "Rouen",
185 x : 1.089,
186 y : 49.438
187 }, {
188 name : "Amiens",
189 x : 2.293,
190 y : 49.894
191 }, {
192 name : "Toulon",
193 x : 5.934,
194 y : 43.127
195 }, {
196 name : "Limoges",
197 x : 1.259,
198 y : 45.832
199 }, {
200 name : "Boulogne-Billancourt",
201 x : 2.242,
202 y : 48.840
203 }];
204
205 var locsIE = [{
206 name : "Nice",
207 x : 7.262,
208 y : 43.706
209 }, {
210 name : "Saint-Etienne",
211 x : 4.390,
212 y : 45.441
213 }, {
214 name : "Strasbourg",
215 x : 7.756,
216 y : 48.584
217 }, {
218 name : "Boulogne-Billancourt",
219 x : 2.242,
220 y : 48.840
221 }];
222
223 function createCharts(){
224 var layer = new Layer();
225 map.map.addLayer(layer);
226 var lo;
227 if(sniff.isIE)
228 lo = locsIE;
229 else
230 lo = locs;
231 arr.forEach(lo, function(l){
232 var feature = createChart(l, {});
233 layer.addFeature(feature);
234 });
235 setTimeout(function(){
236 layer.redraw();
237 }, 500);
238 }
239
240 function getCoords(loc){
241 var lng = 0;
242 if(loc.hasOwnProperty('x'))
243 lng = loc.x;
244 if(loc.hasOwnProperty('lng'))
245 lng = openlayers.parseDMS(loc.lng, true);
246
247 var lat = 0;
248 if(loc.hasOwnProperty('y'))
249 lat = loc.y;
250 if(loc.hasOwnProperty('lat'))
251 lat = openlayers.parseDMS(loc.lat, true);
252 return [lng, lat];
253 }
254
255 function createButton(loc){
256 var db = domConstruct.create("div", {}, win.body());
257 var b = new RadioButton({
258 checked : false
259 }, db);
260 var c = getCoords(loc);
261 var f = {
262 longitude : c[0],
263 latitude : c[1],
264 widget : b,
265 width : 15,
266 height : 15
267 };
268 return new WidgetFeature(f);
269 }
270
271 function createChart(loc, params){
272 var feature = null, co = getCoords(loc), descr;
273
274 if(params.dijitId){
275 descr = {
276 longitude : co[0],
277 latitude : co[1],
278 dijitId : params.dijitId,
279 width : 50,
280 height : 50
281 };
282 feature = new WidgetFeature(descr);
283 }else{
284 var chartSize = 50;
285 descr = {
286 // location of the widget
287 longitude : co[0],
288 latitude : co[1],
289 // the function which creates the widget
290 createWidget : function(){
291 var div = domConstruct.create("div", {}, win.body());
292 var chart = new Chart({
293 margins : {
294 l : 0,
295 r : 0,
296 t : 0,
297 b : 0
298 }
299 }, div);
300 var c = chart.chart;
301 c.addPlot("default", {
302 type : "Pie",
303 radius : chartSize / 2,
304 labelOffset : chartSize,
305 fontColor : "black"
306 });
307
308 var ser = [2, 8, 12, 43, 56, 23, 43, 1, 33];
309 c.addSeries("Series", ser);
310 c.setTheme(blue);
311 c.render();
312 c.theme.plotarea.fill = undefined;
313 return chart;
314 },
315 width : chartSize,
316 height : chartSize
317 };
318 feature = new WidgetFeature(descr);
319 }
320 return feature;
321 }
322 });
323 </script>
324 </head>
325 <body class="tundra">
326 <div id="map" style="background-color: #b5d0d0; width: 100%; height: 100%;"></div>
327 </body>
328 </html>