├── .gitignore ├── .prettierrc ├── README.md ├── bower.json ├── examples ├── data.js ├── index.html └── styles.js ├── lib ├── dat.gui.js ├── detector.js ├── stats.js └── three.js └── threejs-layer.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 2, 4 | "useTabs": false, 5 | "semi": true, 6 | "singleQuote": true, 7 | "trailingComma": "none", 8 | "bracketSpacing": false, 9 | "jsxBracketSameLine": true, 10 | "arrowParens": "avoid", 11 | "parser": "babylon" 12 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Three.js Layer for the Google Maps API 2 | 3 | Google Maps API layer that uses [Three.js](http://mrdoob.github.com/three.js/) to for super fast animation. 4 | 5 | ### Usage 6 | 7 | ```js 8 | new ThreejsLayer(options, completeCallback); 9 | ``` 10 | 11 | ### Example 12 | 13 | 14 | ```js 15 | new ThreejsLayer({ map: map }, function(layer){ 16 | 17 | var geometry = new THREE.Geometry(), 18 | location = new google.maps.LatLng(lat, lng), 19 | vertex = layer.fromLatLngToVertex(location); 20 | 21 | geometry.vertices.push( vertex ); 22 | 23 | var particles = new THREE.ParticleSystem(geometry, material); 24 | layer.add(particles); 25 | }); 26 | 27 | ``` 28 | 29 | ### About 30 | 31 | Based on the excellent [CanvasLayer](https://google-maps-utility-library-v3.googlecode.com/svn/trunk/canvaslayer/docs/reference.html) by [@brendankenny](https://github.com/brendankenny) 32 | 33 | Developed by [Martin Kleppe](https://plus.google.com/103747379090421872359/) at [Ubilabs](http://www.ubilabs.net). 34 | 35 | Released under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0). 36 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "google-maps-api-threejs-layer", 3 | "version": "0.1.0", 4 | "homepage": "https://github.com/ubilabs/google-maps-api-threejs-layer", 5 | "description": "https://github.com/ubilabs/google-maps-api-threejs-layer", 6 | "main": "threejs-layer.js", 7 | "keywords": [ 8 | "three", 9 | "threejs", 10 | "three.js", 11 | "3D", 12 | "webgl", 13 | "google", 14 | "maps", 15 | "googlemaps", 16 | "gmaps" 17 | ], 18 | "license": "Apache2", 19 | "ignore": [ 20 | "**/.*", 21 | "*.md", 22 | "docs", 23 | "editor", 24 | "examples/*", 25 | "!examples/js", 26 | "src", 27 | "test", 28 | "utils", 29 | "LICENSE" 30 | ] 31 | } -------------------------------------------------------------------------------- /examples/data.js: -------------------------------------------------------------------------------- 1 | var photos = [ 2 | [27.772333,-15.696667], 3 | [40.4695,-79.8235], 4 | [41.016111,28.963889], 5 | [55.748241,37.544318], 6 | [49.843266,24.03295], 7 | [41.913441,-87.648256], 8 | [51.991,-0.993333], 9 | [48.868689,2.332397], 10 | [-23.626167,-46.579667], 11 | [-16.67357,-49.240882], 12 | [39.755422,-104.988538], 13 | [37.325,-122.007333], 14 | [37.216694,128.004486], 15 | [39.052333,-94.5805], 16 | [39.755422,-104.988538], 17 | [40.4695,-79.8235], 18 | [37.807667,-122.469667], 19 | [26.241794,50.595564], 20 | [37.325,-122.007167], 21 | [39.052333,-94.5805], 22 | [51.495358,-0.14456], 23 | [37.793333,-122.397], 24 | [40.4695,-79.8235], 25 | [39.052166,-94.5805], 26 | [39.755422,-104.988538], 27 | [39.755422,-104.988538], 28 | [25.029667,121.487], 29 | [39.755422,-104.988538], 30 | [54.398374,-1.708631], 31 | [51.824333,4.152833], 32 | [40.4695,-79.8235], 33 | [37.325,-122.007167], 34 | [29.770833,102.369166], 35 | [40.7535,-73.9765], 36 | [37.203808,128.004669], 37 | [39.755422,-104.988538], 38 | [40.775667,-73.975333], 39 | [40.4695,-79.8235], 40 | [25.029833,121.487167], 41 | [45.468072,9.176353], 42 | [-23.626,-46.579667], 43 | [39.755422,-104.988538], 44 | [40.4695,-79.8235], 45 | [37.216694,128.004486], 46 | [40.4695,-79.8235], 47 | [-23.626,-46.579833], 48 | [23.575713,119.576327], 49 | [37.216694,128.004486], 50 | [37.216694,128.004486], 51 | [39.755422,-104.988538], 52 | [49.226818,-123.101845], 53 | [23.575711,119.576319], 54 | [40.4695,-79.8235], 55 | [23.575711,119.576322], 56 | [39.755422,-104.988538], 57 | [25.028333,121.484833], 58 | [-23.626,-46.579667], 59 | [48.868689,2.332397], 60 | [25.364295,51.518306], 61 | [38.925554,-77.053556], 62 | [37.325,-122.007333], 63 | [43.848833,-79.348333], 64 | [25.036,121.506667], 65 | [33.801525,-118.176452], 66 | [43.942729,12.45979], 67 | [37.325,-122.007167], 68 | [37.216694,128.004486], 69 | [25.028333,121.484833], 70 | [37.216694,128.004486], 71 | [-23.626167,-46.579667], 72 | [31.432471,-87.402892], 73 | [37.216694,128.004486], 74 | [-23.085818,-44.238879], 75 | [37.216694,128.004486], 76 | [39.755422,-104.988538], 77 | [51.464166,-0.0415], 78 | [-23.626,-46.579667], 79 | [40.708184,-73.998782], 80 | [41.902308,12.46562], 81 | [37.216694,128.004486], 82 | [-23.626167,-46.579667], 83 | [26.241794,50.595564], 84 | [39.546279,21.75883], 85 | [13.726211,100.590305], 86 | [31.271068,32.303645], 87 | [39.755422,-104.988538], 88 | [39.455248,-0.351634], 89 | [44.410133,8.92623], 90 | [50.839166,-0.9795], 91 | [55.878,-4.322667], 92 | [-23.626167,-46.579667], 93 | [40.681786,-73.972545], 94 | [40.4695,-79.8235], 95 | [49.611132,6.132411], 96 | [37.325,-122.007167], 97 | [39.755422,-104.988538], 98 | [43.848833,-79.348333], 99 | [25.036,121.506667], 100 | [25.035736,121.537717], 101 | [37.216694,128.004486], 102 | [39.755422,-104.988538], 103 | [40.4695,-79.8235], 104 | [38.764659,16.540519], 105 | [33.801525,-118.176452], 106 | [39.052333,-94.5805], 107 | [33.801525,-118.176452], 108 | [39.755422,-104.988538], 109 | [27.772333,-15.696667], 110 | [43.359759,-5.845885], 111 | [43.848833,-79.348333], 112 | [46.478832,30.716958], 113 | [37.2445,-121.8505], 114 | [37.325,-122.007167], 115 | [41.961333,-87.683667], 116 | [26.241794,50.595564], 117 | [37.216694,128.004486], 118 | [43.360136,-5.845648], 119 | [37.325,-122.007333], 120 | [51.991,-0.993333], 121 | [48.868689,2.332397], 122 | [39.755422,-104.988538], 123 | [51.450045,-0.045519], 124 | [-33.429731,-70.623571], 125 | [55.001065,-1.416699], 126 | [37.203747,128.0045], 127 | [51.520994,-0.169462], 128 | [30.260777,-89.799293], 129 | [37.203747,128.0045], 130 | [39.77714,-75.966408], 131 | [25.05314,121.513381], 132 | [60.472915,15.571746], 133 | [51.608776,-3.978698], 134 | [37.203747,128.0045], 135 | [48.422337,-123.369727], 136 | [37.203747,128.0045], 137 | [51.543795,-0.089966], 138 | [23.575722,119.576305], 139 | [54.838367,83.105349], 140 | [50.848616,5.899829], 141 | [-22.902871,-43.124277], 142 | [37.203463,128.009033], 143 | [43.006428,-7.544678], 144 | [42.23426,-8.72288], 145 | [37.203747,128.0045], 146 | [37.203747,128.0045], 147 | [41.385719,2.170049], 148 | [37.203747,128.0045], 149 | [37.203747,128.0045], 150 | [37.203747,128.0045], 151 | [40.681786,-73.972545], 152 | [37.203463,128.009033], 153 | [39.052833,-94.581167], 154 | [37.203594,128.004652], 155 | [43.40228,4.983665], 156 | [39.052333,-94.5805], 157 | [50.853113,5.890796], 158 | [35.846717,-84.156485], 159 | [41.994355,-70.058014], 160 | [40.723019,-73.995854], 161 | [37.203747,128.0045], 162 | [37.203747,128.0045], 163 | [32.815699,-17.013015], 164 | [50.855951,5.882856], 165 | [50.228378,12.86495], 166 | [50.898878,4.522461], 167 | [27.772333,-15.696667], 168 | [37.203463,128.009033], 169 | [43.403862,4.983451], 170 | [48.964828,7.354145], 171 | [37.203747,128.0045], 172 | [23.57573,119.576297], 173 | [37.203747,128.0045], 174 | [37.535355,-77.433756], 175 | [25.013333,121.466], 176 | [37.203747,128.0045], 177 | [37.203747,128.0045], 178 | [37.203747,128.0045], 179 | [36.363936,25.449013], 180 | [25.027667,121.483167], 181 | [37.203594,128.004652], 182 | [37.204688,128.00995], 183 | [37.203463,128.009033], 184 | [35.846717,-84.156485], 185 | [21.85393,96.086425], 186 | [51.54449,-0.089268], 187 | [50.228378,12.86495], 188 | [26.241794,50.595564], 189 | [37.203747,128.0045], 190 | [37.203747,128.0045], 191 | [37.203747,128.0045], 192 | [51.444333,-2.593333], 193 | [22.886125,-109.909287], 194 | [43.082837,11.670827], 195 | [37.204688,128.00995], 196 | [-9.010724,-35.216674], 197 | [43.480639,-8.122844], 198 | [36.864311,-96.222412], 199 | [37.203669,128.004775], 200 | [52.98273,-6.039133], 201 | [51.520994,-0.169462], 202 | [39.351052,-76.91833], 203 | [41.368258,2.153685], 204 | [37.203463,128.009033], 205 | [51.520994,-0.169462], 206 | [-25.411289,-49.26763], 207 | [50.853113,5.890796], 208 | [37.203747,128.0045], 209 | [37.203747,128.0045], 210 | [40.681786,-73.972545], 211 | [52.514621,13.432811], 212 | [-33.420087,-70.603653], 213 | [45.269952,8.463738], 214 | [52.144603,-0.739345], 215 | [45.320791,8.418347], 216 | [40.762048,-73.925457], 217 | [3.881313,-77.043685], 218 | [49.075874,2.223825], 219 | [37.203463,128.009033], 220 | [51.520994,-0.169462], 221 | [37.203747,128.0045], 222 | [37.203747,128.0045], 223 | [36.430398,25.416011], 224 | [37.203594,128.004652], 225 | [51.520994,-0.169462], 226 | [37.203747,128.0045], 227 | [53.481882,-2.243803], 228 | [23.575722,119.576361], 229 | [35.625556,-78.328611], 230 | [37.203747,128.0045], 231 | [37.203747,128.0045], 232 | [42.348204,-71.082701], 233 | [40.849666,-73.947166], 234 | [32.78915,-17.136611], 235 | [39.050833,-94.581667], 236 | [37.203747,128.0045], 237 | [37.203747,128.0045], 238 | [37.203747,128.0045], 239 | [50.973667,-1.369333], 240 | [37.203463,128.009033], 241 | [37.203594,128.004652], 242 | [52.118604,4.288835], 243 | [25.153364,51.613769], 244 | [38.899101,-77.028999], 245 | [50.853113,5.890796], 246 | [38.899101,-77.028999], 247 | [41.987375,2.825202], 248 | [41.368258,2.153685], 249 | [51.520994,-0.169462], 250 | [53.890926,-1.237313], 251 | [43.00622,-7.545279], 252 | [51.520994,-0.169462], 253 | [53.890926,-1.237313], 254 | [43.00622,-7.545279], 255 | [41.022812,28.974423], 256 | [37.203747,128.0045], 257 | [83.205302,-140.625], 258 | [51.392667,1.399667], 259 | [52.514236,13.417782], 260 | [37.203747,128.0045], 261 | [48.652603,-2.363262], 262 | [37.203747,128.0045], 263 | [37.559819,127.021179], 264 | [37.203747,128.0045], 265 | [50.848616,5.899829], 266 | [37.203747,128.0045], 267 | [37.203747,128.0045], 268 | [37.203747,128.0045], 269 | [37.203594,128.004652], 270 | [37.203463,128.009033], 271 | [37.203747,128.0045], 272 | [51.203018,3.219401], 273 | [41.368258,2.153685], 274 | [23.57568,119.576294], 275 | [37.203747,128.0045], 276 | [42.816923,-75.539616], 277 | [41.905822,12.482014], 278 | [22.88936,-109.911733], 279 | [48.964709,7.35408], 280 | [37.203669,128.004775], 281 | [48.421881,-123.373074], 282 | [-13.313457,-72.145156], 283 | [37.203747,128.0045], 284 | [41.368258,2.153685], 285 | [37.203669,128.004775], 286 | [37.203747,128.0045], 287 | [37.203747,128.0045], 288 | [48.853588,2.350997], 289 | [21.418554,95.572814], 290 | [37.203747,128.0045], 291 | [-13.313457,-72.145156], 292 | [37.203747,128.0045], 293 | [39.050833,-94.581667], 294 | [25.013333,121.465833], 295 | [36.3479,25.46339], 296 | [37.203463,128.009033], 297 | [39.994679,-76.28477], 298 | [37.203747,128.0045], 299 | [37.203594,128.004652], 300 | [51.344615,-0.09347], 301 | [48.119516,11.669875], 302 | [51.996243,4.144034], 303 | [43.26865,-2.94612], 304 | [48.421141,-123.372817], 305 | [40.698291,-73.996632], 306 | [50.973667,-1.369], 307 | [39.533041,44.092254], 308 | [40.442635,-3.713464], 309 | [37.203669,128.004775], 310 | [59.329949,18.057199], 311 | [-33.429901,-70.622391], 312 | [37.203747,128.0045], 313 | [22.88936,-109.911733], 314 | [25.027833,121.483833], 315 | [37.203747,128.0045], 316 | [37.203747,128.0045], 317 | [39.050833,-94.581667], 318 | [25.013333,121.466], 319 | [36.424873,25.431118], 320 | [37.203747,128.0045], 321 | [43.006565,-7.543841], 322 | [-16.67357,-49.240882], 323 | [51.520994,-0.169462], 324 | [34.043579,-4.99554], 325 | [37.203747,128.0045], 326 | [37.203747,128.0045], 327 | [37.203747,128.0045], 328 | [37.203747,128.0045], 329 | [25.013333,121.466], 330 | [22.88936,-109.911733], 331 | [50.973667,-1.369333], 332 | [37.203669,128.004775], 333 | [40.836303,14.250547], 334 | [48.422052,-123.372559], 335 | [3.068075,101.678367], 336 | [41.655535,-0.881996], 337 | [37.203747,128.0045], 338 | [51.520994,-0.169462], 339 | [20.873568,107.174377], 340 | [37.203747,128.0045], 341 | [39.050833,-94.581667], 342 | [37.203463,128.009033], 343 | [41.913441,-87.648256], 344 | [25.013333,121.465833], 345 | [37.203747,128.0045], 346 | [37.203747,128.0045], 347 | [37.203463,128.009033], 348 | [37.203747,128.0045], 349 | [37.204688,128.00995], 350 | [37.203669,128.004775], 351 | [37.203747,128.0045], 352 | [45.43801,12.335887], 353 | [37.203747,128.0045], 354 | [47.487165,-3.101513], 355 | [51.520994,-0.169462], 356 | [37.203463,128.009033], 357 | [-7.851818,-38.116722], 358 | [37.203463,128.009033], 359 | [41.913441,-87.648256], 360 | [37.203747,128.0045], 361 | [37.203747,128.0045], 362 | [50.079078,14.433219], 363 | [45.269961,8.463841], 364 | [51.520994,-0.169462], 365 | [23.575725,119.576313], 366 | [39.053,-94.581167], 367 | [-13.313457,-72.145156], 368 | [50.228378,12.86495], 369 | [37.203463,128.009033], 370 | [37.203669,128.004775], 371 | [45.26993,8.463888], 372 | [37.203747,128.0045], 373 | [37.203747,128.0045], 374 | [37.203747,128.0045], 375 | [39.052833,-94.581167], 376 | [25.013833,121.466167], 377 | [37.203747,128.0045], 378 | [37.203747,128.0045], 379 | [50.853113,5.890796], 380 | [37.203747,128.0045], 381 | [51.543125,-0.092449], 382 | [24.133199,89.067008], 383 | [23.575694,119.576277], 384 | [22.88936,-109.911733], 385 | [37.203669,128.004775], 386 | [51.520994,-0.169462], 387 | [36.412441,-114.5541], 388 | [37.203747,128.0045], 389 | [41.368258,2.153685], 390 | [23.57568,119.576286], 391 | [37.203747,128.0045], 392 | [45.270352,8.463177], 393 | [10.757762,106.699218], 394 | [37.203463,128.009033], 395 | [51.031334,11.272337], 396 | [51.723971,-0.831769], 397 | [48.421141,-123.373847], 398 | [37.203669,128.004775], 399 | [43.405741,4.986133], 400 | [35.245619,9.316406], 401 | [25.013333,121.465833], 402 | [23.575713,119.57633], 403 | [37.203747,128.0045], 404 | [37.203747,128.0045], 405 | [48.4057,-4.07769], 406 | [49.332058,8.570365], 407 | [50.855951,5.882856], 408 | [37.203747,128.0045], 409 | [37.203747,128.0045], 410 | [37.203747,128.0045], 411 | [46.210183,4.358596], 412 | [32.758984,-16.945037], 413 | [17.168085,104.137285], 414 | [37.203669,128.004775], 415 | [47.678684,-122.32663], 416 | [37.203747,128.0045], 417 | [37.203747,128.0045], 418 | [-16.67357,-49.240882], 419 | [-13.313457,-72.145156], 420 | [41.971555,-70.076806], 421 | [25.013333,121.465833], 422 | [35.846717,-84.156485], 423 | [3.880216,-77.042999], 424 | [37.203669,128.004775], 425 | [19.289372,-99.095392], 426 | [35.012784,135.67774], 427 | [40.764941,-111.876525], 428 | [37.203463,128.009033], 429 | [51.16418,10.45415], 430 | [47.464162,-1.409597], 431 | [52.353894,4.865724], 432 | [37.203747,128.0045], 433 | [51.480656,-0.186937], 434 | [37.203747,128.0045], 435 | [41.368258,2.153685], 436 | [37.203747,128.0045], 437 | [37.203747,128.0045], 438 | [37.203747,128.0045], 439 | [-22.902871,-43.124277], 440 | [43.402288,4.983408], 441 | [37.203669,128.004775], 442 | [23.57568,119.576288], 443 | [55.167844,-1.858663], 444 | [37.203463,128.009033], 445 | [41.064084,1.085736], 446 | [0,0], 447 | [25.013333,121.466], 448 | [58.145126,7.997524], 449 | [25.013167,121.465833], 450 | [48.119516,11.669875], 451 | [50.854102,5.872857], 452 | [48.886954,2.34115], 453 | [25.013167,121.465833], 454 | [37.809307,-122.412307], 455 | [32.813896,-17.261924], 456 | [-22.902871,-43.124277], 457 | [53.528765,9.998888], 458 | [33.884596,-117.282623], 459 | [39.050833,-94.581667], 460 | [43.283977,5.37132], 461 | [48.120133,11.666358], 462 | [37.203669,128.004775], 463 | [35.846717,-84.156485], 464 | [39.053,-94.581167], 465 | [37.203747,128.0045], 466 | [37.203747,128.0045], 467 | [37.203747,128.0045], 468 | [37.203747,128.0045], 469 | [35.846717,-84.156485], 470 | [41.913441,-87.648256], 471 | [37.203747,128.0045], 472 | [37.203747,128.0045], 473 | [42.586528,1.055211], 474 | [26.241794,50.595564], 475 | [-13.313457,-72.145156], 476 | [37.203747,128.0045], 477 | [37.203747,128.0045], 478 | [35.846717,-84.156485], 479 | [40.600007,-84.95676], 480 | [36.347208,25.45927], 481 | [50.848616,5.899829], 482 | [37.203747,128.0045], 483 | [37.203747,128.0045], 484 | [43.642473,-79.387121], 485 | [43.407884,5.054433], 486 | [36.491972,-4.693358], 487 | [41.73041,-72.566971], 488 | [37.203463,128.009033], 489 | [25.028,121.484333], 490 | [-22.902871,-43.124277], 491 | [45.270002,8.463738], 492 | [41.667769,-72.305754], 493 | [32.058,34.77317], 494 | [37.203747,128.0045], 495 | [37.203747,128.0045], 496 | [37.203747,128.0045], 497 | [37.203747,128.0045], 498 | [40.710572,-73.955841], 499 | [41.076738,29.026865], 500 | [37.203747,128.0045], 501 | [37.343959,-5.976562], 502 | [32.058,34.77317], 503 | [37.203747,128.0045], 504 | [37.203747,128.0045], 505 | [37.203747,128.0045], 506 | [37.203747,128.0045], 507 | [40.710572,-73.955841], 508 | [41.076738,29.026865], 509 | [37.203747,128.0045], 510 | [37.343959,-5.976562], 511 | [37.203747,128.0045], 512 | [37.203747,128.0045], 513 | [37.203747,128.0045], 514 | [25.014,121.466333], 515 | [47.383166,8.665], 516 | [50.853113,5.890796], 517 | [39.050833,-94.581667], 518 | [25.013333,121.466], 519 | [37.203747,128.0045], 520 | [37.203747,128.0045], 521 | [37.203747,128.0045], 522 | [32.07792,131.467895], 523 | [51.340668,-0.091491], 524 | [51.520994,-0.169462], 525 | [25.014,121.466333], 526 | [36.430812,25.419445], 527 | [55.690207,12.594602], 528 | [37.203747,128.0045], 529 | [25.033934,121.537896], 530 | [37.203669,128.004775], 531 | [51.465229,-0.070399], 532 | [-7.851138,-38.115348], 533 | [37.203747,128.0045], 534 | [36.422801,25.415325], 535 | [37.203747,128.0045], 536 | [50.973667,-1.369167], 537 | [42.994524,-3.006241], 538 | [37.203747,128.0045], 539 | [25.013333,121.466], 540 | [42.024889,-71.312481], 541 | [37.203463,128.009033], 542 | [26.241794,50.595564], 543 | [52.915667,-1.474167], 544 | [-22.904088,-43.117582], 545 | [51.72724,0.42469], 546 | [51.518086,7.474983], 547 | [52.408898,-4.084135], 548 | [52.408908,-4.084199], 549 | [40.857003,14.257036], 550 | [51.540061,-0.097103], 551 | [26.241794,50.595564], 552 | [41.058325,-124.143076], 553 | [33.449373,-112.068765], 554 | [16.491563,97.630863], 555 | [20.788133,-156.003684], 556 | [40.44264,-3.71326], 557 | [52.408885,-4.084124], 558 | [48.885855,2.343106], 559 | [34.840595,-82.420819], 560 | [50.726703,-1.839609], 561 | [39.050833,-94.581667], 562 | [37.791494,-122.397671], 563 | [45.474603,-122.652316], 564 | [42.059855,2.222585], 565 | [21.105,-86.789932], 566 | [42.644061,-71.313972], 567 | [51.154208,-2.84254], 568 | [23.575727,119.576288], 569 | [40.689845,-73.946257], 570 | [-23.557929,-46.658989], 571 | [40.689845,-73.946257], 572 | [28.650411,77.235774], 573 | [48.839045,2.403945], 574 | [42.890272,-0.561676], 575 | [45.181204,9.153499], 576 | [40.754746,-73.973704], 577 | [50.726703,-1.839609], 578 | [51.901189,-2.076308], 579 | [52.216862,0.109863], 580 | [50.726703,-1.839609], 581 | [51.154208,-2.84254], 582 | [5.455376,36.692276], 583 | [37.761386,-121.959991], 584 | [23.575694,119.576288], 585 | [53.277166,64.225166], 586 | [53.958279,-1.091701], 587 | [21.105,-86.789932], 588 | [23.575694,119.57628], 589 | [41.055473,-83.595138], 590 | [56.157797,10.159407], 591 | [51.154208,-2.84254], 592 | [42.704086,-82.55062], 593 | [51.518086,7.474983], 594 | [51.523454,7.481582], 595 | [52.408931,-4.084414], 596 | [50.726703,-1.839609], 597 | [51.154208,-2.84254], 598 | [51.517569,7.473192], 599 | [37.761166,-121.9605], 600 | [23.575722,119.576288], 601 | [45.536264,12.636298], 602 | [51.523454,7.481582], 603 | [51.523454,7.481582], 604 | [43.717612,10.399675], 605 | [42.354167,-71.071998], 606 | [43.720032,10.40064], 607 | [56.035969,12.613184], 608 | [53.14269,7.046656], 609 | [25.034,121.5075], 610 | [50.726703,-1.839609], 611 | [25.042833,121.5485], 612 | [51.531593,-0.11263], 613 | [43.720032,10.40064], 614 | [-13.493802,31.569213], 615 | [41.055473,-83.595138], 616 | [50.948173,6.944881], 617 | [51.523454,7.481582], 618 | [52.516071,13.376979], 619 | [21.164456,-105.224603], 620 | [48.885982,2.343235], 621 | [45.066593,7.659673], 622 | [50.726703,-1.839609], 623 | [50.726703,-1.839609], 624 | [44.618607,-1.117129], 625 | [45.464732,9.193164], 626 | [51.518086,7.474983], 627 | [51.523454,7.481582], 628 | [42.583042,1.006278], 629 | [51.537876,-0.099881], 630 | [25.034167,121.5075], 631 | [47.67134,-122.325542], 632 | [38.124846,13.356585], 633 | [1.286182,103.854371], 634 | [37.759166,-121.959167], 635 | [35.625556,-78.328611], 636 | [-23.56287,-46.654659], 637 | [43.082853,11.67087], 638 | [46.312278,14.901956], 639 | [33.449373,-112.068765], 640 | [43.514198,13.60073], 641 | [43.511214,13.623948], 642 | [51.472575,-0.45104], 643 | [29.563901,106.583862], 644 | [25.013667,121.466333], 645 | [28.64817,-81.32792], 646 | [52.209869,0.11156], 647 | [41.529833,-8.782833], 648 | [48.858926,2.293245], 649 | [52.081114,4.320545], 650 | [20.600666,-100.376334], 651 | [51.518086,7.474983], 652 | [41.913441,-87.648256], 653 | [31.115267,-7.796173], 654 | [44.007759,8.17238], 655 | [53.938411,-1.087614], 656 | [41.530833,-8.783], 657 | [35.885799,14.4031], 658 | [25.034,121.5075], 659 | [51.901189,-2.076308], 660 | [39.748815,-8.813041], 661 | [25.013833,121.4665], 662 | [37.810661,-122.476759], 663 | [21.31651,-157.870447], 664 | [25.013167,121.465833], 665 | [51.608776,-3.978698], 666 | [50.726703,-1.839609], 667 | [37.761386,-121.959991], 668 | [37.761386,-121.959991], 669 | [41.055473,-83.595138], 670 | [43.15752,-5.82903], 671 | [25.043653,121.505162], 672 | [43.720032,10.40064], 673 | [35.446,139.639333], 674 | [38.124986,13.356537], 675 | [-26.79742,-60.424468], 676 | [43.511214,13.623948], 677 | [43.580841,7.123217], 678 | [37.672545,-1.700426], 679 | [6.019858,-75.433917], 680 | [46.446745,30.747725], 681 | [40.827667,-73.918833], 682 | [41.913441,-87.648256], 683 | [51.571029,-0.33978], 684 | [52.330408,-0.68407], 685 | [50.726703,-1.839609], 686 | [36.777721,-6.3576], 687 | [49.793981,9.930986], 688 | [51.518086,7.474983], 689 | [22.986333,120.197666], 690 | [50.726703,-1.839609], 691 | [43.720032,10.40064], 692 | [61.113,10.4655], 693 | [41.055473,-83.595138], 694 | [46.40493,11.31596], 695 | [55.681666,37.545666], 696 | [37.7615,-121.960001], 697 | [35.444666,139.641], 698 | [29.319754,48.089346], 699 | [52.408921,-4.084199], 700 | [54.988842,-8.496036], 701 | [37.761386,-121.959991], 702 | [50.726703,-1.839609], 703 | [40.766956,-73.921337], 704 | [51.154208,-2.84254], 705 | [52.408895,-4.084135], 706 | [25.043653,121.505162], 707 | [52.408888,-4.084103], 708 | [43.642,-79.438167], 709 | [50.726703,-1.839609], 710 | [26.241794,50.595564], 711 | [50.858366,-1.31307], 712 | [23.575694,119.576294], 713 | [25.013167,121.465833], 714 | [36.777721,-6.3576], 715 | [39.050833,-94.581667], 716 | [-2.898981,-79.009895], 717 | [25.013167,121.465833], 718 | [26.241794,50.595564], 719 | [21.031035,105.853797], 720 | [-22.968352,-43.225637], 721 | [16.288753,97.584857], 722 | [53.943779,-1.087056], 723 | [43.3415,-70.4655], 724 | [41.981378,2.825503], 725 | [43.341666,-70.4655], 726 | [36.556321,-121.919885], 727 | [41.385719,2.170049], 728 | [23.575675,119.576291], 729 | [50.726703,-1.839609], 730 | [51.340679,12.379113], 731 | [39.050833,-94.581667], 732 | [39.050833,-94.581667], 733 | [43.641667,-79.438], 734 | [25.749229,-80.262947], 735 | [40.339258,-74.674576], 736 | [52.537317,-1.695542], 737 | [40.397795,-105.569214], 738 | [35.446833,139.641333], 739 | [19.4319,-99.13285], 740 | [51.523454,7.481582], 741 | [51.523454,7.481582], 742 | [51.523454,7.481582], 743 | [51.523454,7.481582], 744 | [51.523454,7.481582], 745 | [51.523454,7.481582], 746 | [51.523454,7.481582], 747 | [51.523454,7.481582], 748 | [51.523454,7.481582], 749 | [51.523454,7.481582], 750 | [51.523454,7.481582], 751 | [51.523454,7.481582], 752 | [51.518086,7.474983], 753 | [50.726703,-1.839609], 754 | [41.055473,-83.595138], 755 | [47.368328,4.57811], 756 | [47.998975,7.855246], 757 | [43.006381,-7.545225], 758 | [51.448711,-0.937743], 759 | [51.518086,7.474983], 760 | [40.681786,-73.972545], 761 | [51.901189,-2.076308], 762 | [52.408892,-4.084124], 763 | [52.408879,-4.083845], 764 | [52.408911,-4.084382], 765 | [52.408888,-4.084081], 766 | [51.523454,7.481582], 767 | [-23.618501,-46.68782], 768 | [38.867897,-77.086448], 769 | [52.409023,-4.084714], 770 | [43.503803,13.622145], 771 | [46.494991,11.35443], 772 | [25.013833,121.466167], 773 | [37.761333,-121.959834], 774 | [52.352581,-7.694258], 775 | [51.154208,-2.84254], 776 | [34.67924,135.505199], 777 | [51.518086,7.474983], 778 | [5.358091,100.542529], 779 | [20.600666,-100.3765], 780 | [37.973307,-122.528876], 781 | [41.40823,-75.670394], 782 | [45.26647,8.923702], 783 | [40.702244,-74.010719], 784 | [44.303552,-124.105871], 785 | [51.511644,-1.128544], 786 | [51.154208,-2.84254], 787 | [23.575713,119.576272], 788 | [40.720169,-73.996819], 789 | [26.241794,50.595564], 790 | [48.650319,-2.022943], 791 | [43.341666,-70.465667], 792 | [43.511214,13.623948], 793 | [37.761386,-121.959991], 794 | [43.57592,-90.840194], 795 | [48.83077,2.355384], 796 | [41.157978,-8.618774], 797 | [41.763557,-74.156055], 798 | [16.46506,97.630348], 799 | [40.903652,37.821121], 800 | [51.154208,-2.84254], 801 | [43.244834,-77.684971], 802 | [53.1285,-6.063333], 803 | [41.062556,29.016896], 804 | [36.825363,15.107231], 805 | [36.831661,-2.641999], 806 | [47.926841,23.90203], 807 | [1.367635,103.994468], 808 | [39.209507,9.12481], 809 | [-37.858998,-57.775554], 810 | [55.000659,-1.416356], 811 | [1.36512,103.99141], 812 | [45.456236,8.462567], 813 | [51.608776,-3.978698], 814 | [50.726703,-1.839609], 815 | [-34.915988,-57.947301], 816 | [43.511214,13.623948], 817 | [37.761386,-121.959991], 818 | [51.041451,3.754752], 819 | [35.706399,-79.025859], 820 | [23.575725,119.576288], 821 | [44.474951,26.082186], 822 | [40.420299,-3.70577], 823 | [39.050833,-94.581667], 824 | [41.892317,12.48687], 825 | [51.50632,-0.12714], 826 | [40.780755,-73.976327], 827 | [37.761166,-121.960001], 828 | [21.105,-86.789932], 829 | [53.52415,-1.519029], 830 | [32.896499,-97.036], 831 | [52.390256,4.793466], 832 | [-7.152167,-34.84483], 833 | [25.013667,121.466], 834 | [-25.349688,27.105159], 835 | [52.408928,-4.084424], 836 | [35.447666,139.643666], 837 | [51.523454,7.481582], 838 | [51.154208,-2.84254], 839 | [55.167838,-1.858642], 840 | [51.539448,-0.160889], 841 | [37.203613,128.004683], 842 | [39.732632,-104.960439], 843 | [48.890793,-123.345739], 844 | [26.241794,50.595564], 845 | [35.824033,-78.622863], 846 | [37.203613,128.004683], 847 | [49.510448,2.12781], 848 | [42.141,-83.2765], 849 | [53.958279,-1.091701], 850 | [44.022724,4.845099], 851 | [-0.856901,-78.908271], 852 | [47.724862,10.309381], 853 | [43.720032,10.40064], 854 | [-0.952333,100.432891], 855 | [34.436217,-119.135098], 856 | [39.214965,9.153821], 857 | [37.203613,128.004683], 858 | [52.3545,4.859], 859 | [41.913441,-87.648256], 860 | [41.692737,-8.83219], 861 | [-30.052026,-51.176279], 862 | [57.647272,-1.970136], 863 | [37.203613,128.004683], 864 | [-16.67357,-49.240882], 865 | [37.000423,-89.16558], 866 | [37.203613,128.004683], 867 | [43.723567,10.392594], 868 | [43.723048,10.396574], 869 | [37.203613,128.004683], 870 | [23.57573,119.576313], 871 | [26.278485,73.018054], 872 | [47.65419,-122.205123], 873 | [46.504418,-116.341867], 874 | [49.010739,2.575092], 875 | [49.010739,2.575092], 876 | [42.454803,11.418453], 877 | [43.723567,10.392594], 878 | [32.8685,-117.253333], 879 | [19.030557,-97.996287], 880 | [19.030557,-97.996287], 881 | [52.791305,7.239035], 882 | [50.338147,-4.239563], 883 | [35.823841,-78.622788], 884 | [43.720032,10.40064], 885 | [-23.593318,-46.68221], 886 | [43.26887,-2.934272], 887 | [37.203613,128.004683], 888 | [37.203613,128.004683], 889 | [26.278485,73.018054], 890 | [37.203613,128.004683], 891 | [7.87395,80.78971], 892 | [37.203613,128.004683], 893 | [29.563901,106.583862], 894 | [39.050833,-94.581667], 895 | [52.916333,-1.474], 896 | [41.918628,12.470855], 897 | [50.786546,-1.080973], 898 | [41.806781,13.788359], 899 | [43.341333,-70.4655], 900 | [37.203613,128.004683], 901 | [37.203613,128.004683], 902 | [40.96685,-78.877021], 903 | [41.806781,13.788359], 904 | [26.241794,50.595564], 905 | [44.854058,1.333218], 906 | [37.203613,128.004683], 907 | [37.203613,128.004683], 908 | [53.415543,-3.037719], 909 | [50.302169,-5.235843], 910 | [37.203613,128.004683], 911 | [37.203613,128.004683], 912 | [20.5915,-100.390334], 913 | [57.233175,-2.70195], 914 | [40.74087,-74.007912], 915 | [19.030557,-97.996287], 916 | [37.203613,128.004683], 917 | [23.575747,119.576386], 918 | [37.203613,128.004683], 919 | [40.442611,-3.713003], 920 | [47.54759,10.217654], 921 | [37.269335,-112.947939], 922 | [51.608776,-3.978698], 923 | [35.463833,-114.9195], 924 | [40.96685,-78.877021], 925 | [47.544247,10.266705], 926 | [19.030557,-97.996287], 927 | [40.681786,-73.972545], 928 | [37.203613,128.004683], 929 | [37.203613,128.004683], 930 | [51.608776,-3.978698], 931 | [37.203613,128.004683], 932 | [39.050833,-94.581667], 933 | [31.206992,121.425136], 934 | [48.935276,2.360092], 935 | [37.203613,128.004683], 936 | [6.39736,81.556062], 937 | [43.720032,10.40064], 938 | [37.203613,128.004683], 939 | [44.970293,-110.697126], 940 | [33.706062,73.074874], 941 | [50.456478,-4.51841], 942 | [37.203613,128.004683], 943 | [26.46045,127.812758], 944 | [46.624359,8.034629], 945 | [26.46045,127.812758], 946 | [40.653164,14.657135], 947 | [37.203613,128.004683], 948 | [29.563901,106.583862], 949 | [37.203613,128.004683], 950 | [28.649996,77.234745], 951 | [20.600666,-100.376334], 952 | [37.203613,128.004683], 953 | [-28.138226,153.472952], 954 | [52.916,-1.476], 955 | [51.531347,-0.117609], 956 | [42.357227,-85.268347], 957 | [42.994532,-3.006284], 958 | [43.104993,5.880432], 959 | [40.742184,-73.988382], 960 | [48.858772,2.313438], 961 | [37.203613,128.004683], 962 | [20.6005,-100.376334], 963 | [37.203613,128.004683], 964 | [37.203613,128.004683], 965 | [43.723048,10.396574], 966 | [44.973299,3.637933], 967 | [13.79687,-88.918792], 968 | [45.124,7.23564], 969 | [42.410339,13.552193], 970 | [26.46045,127.812758], 971 | [22.411249,114.153541], 972 | [34.089878,-118.376408], 973 | [37.203613,128.004683], 974 | [52.308268,0.636112], 975 | [44.911969,-110.391654], 976 | [47.044744,-122.907357], 977 | [52.308268,0.636112], 978 | [-7.8,110.366699], 979 | [41.806781,13.788359], 980 | [37.765015,-122.386043], 981 | [43.72349,10.393581], 982 | [43.347166,-70.484167], 983 | [26.05573,92.854476], 984 | [37.203613,128.004683], 985 | [41.806781,13.788359], 986 | [52.389822,4.89295], 987 | [37.269335,-112.947939], 988 | [37.203613,128.004683], 989 | [26.46045,127.812758], 990 | [21.556052,-157.874683], 991 | [40.681786,-73.972545], 992 | [57.681348,-1.939086], 993 | [49.010739,2.575092], 994 | [26.278485,73.018054], 995 | [57.23271,-2.701606], 996 | [36.945981,-1.917114], 997 | [39.050833,-94.581667], 998 | [51.523454,7.481582], 999 | [51.523454,7.481582], 1000 | [51.523454,7.481582], 1001 | [32.647108,-83.597631], 1002 | [37.765015,-122.386043], 1003 | [43.347166,-70.484167], 1004 | [26.05573,92.854476], 1005 | [37.203613,128.004683], 1006 | [41.806781,13.788359], 1007 | [52.389822,4.89295], 1008 | [37.269335,-112.947939], 1009 | [21.556052,-157.874683], 1010 | [26.46045,127.812758], 1011 | [37.203613,128.004683], 1012 | [49.010739,2.575092], 1013 | [26.278485,73.018054], 1014 | [57.681348,-1.939086], 1015 | [40.681786,-73.972545], 1016 | [57.23271,-2.701606], 1017 | [36.945981,-1.917114], 1018 | [39.050833,-94.581667], 1019 | [37.203613,128.004683], 1020 | [37.203613,128.004683], 1021 | [37.203613,128.004683], 1022 | [41.488792,-81.700489], 1023 | [23.575713,119.576377], 1024 | [43.323223,-3.017228], 1025 | [43.723048,10.396574], 1026 | [51.448721,-0.937775], 1027 | [37.203613,128.004683], 1028 | [52.916167,-1.475833], 1029 | [43.723048,10.396574], 1030 | [52.759588,5.833413], 1031 | [37.203613,128.004683], 1032 | [55.807663,37.512492], 1033 | [51.530726,-0.116493], 1034 | [39.050833,-94.581667], 1035 | [45.251718,19.851222], 1036 | [33.805,-84.303333], 1037 | [43.361166,-70.478001], 1038 | [20.600833,-100.376334], 1039 | [37.203613,128.004683], 1040 | [43.723048,10.396574], 1041 | [45.442232,10.994868], 1042 | [37.203613,128.004683], 1043 | [43.349805,-80.32967], 1044 | [40.704586,-73.996353], 1045 | [23.57575,119.576386], 1046 | [37.269335,-112.947939], 1047 | [39.592571,-0.553439], 1048 | [48.249,11.561666], 1049 | [48.248,11.564166], 1050 | [49.010739,2.575092], 1051 | [48.858235,2.294554], 1052 | [37.203613,128.004683], 1053 | [31.80111,35.121486], 1054 | [40.74087,-74.007912], 1055 | [43.723048,10.396574], 1056 | [35.823933,-78.622723], 1057 | [48.1535,16.458667], 1058 | [41.913441,-87.648256], 1059 | [13.845397,100.56748], 1060 | [45.523761,-122.671896], 1061 | [32.832489,-96.705429], 1062 | [51.608776,-3.978698], 1063 | [34.118991,74.818367], 1064 | [52.524237,-1.467264], 1065 | [51.5275,-0.009], 1066 | [37.203613,128.004683], 1067 | [49.010739,2.575092], 1068 | [26.241794,50.595564], 1069 | [47.498519,8.73299], 1070 | [23.575713,119.57638], 1071 | [25.764585,-80.130779], 1072 | [43.3415,-70.465667], 1073 | [48.248,11.564333], 1074 | [42.251029,-87.841728], 1075 | [45.280047,1.267098], 1076 | [37.203613,128.004683], 1077 | [52.916,-1.475833], 1078 | [37.203613,128.004683], 1079 | [-34.496331,137.482781], 1080 | [37.203613,128.004683], 1081 | [35.824046,-78.622713], 1082 | [51.521708,-3.208072], 1083 | [40.723749,-74.009395], 1084 | [41.806781,13.788359], 1085 | [43.341666,-70.4655], 1086 | [43.723412,10.394933], 1087 | [29.563901,106.583862], 1088 | [48.248,11.5645], 1089 | [39.050833,-94.581667], 1090 | [39.775758,-86.148691], 1091 | [41.949652,-71.086498], 1092 | [43.01268,-76.460895], 1093 | [37.203613,128.004683], 1094 | [37.203613,128.004683], 1095 | [37.203613,128.004683], 1096 | [45.465247,9.19488], 1097 | [37.203613,128.004683], 1098 | [37.203613,128.004683], 1099 | [37.269335,-112.947939], 1100 | [37.203613,128.004683], 1101 | [37.203613,128.004683], 1102 | [36.777721,-6.3576], 1103 | [52.915833,-1.474833], 1104 | [45.293697,8.857169], 1105 | [48.248333,11.563833], 1106 | [45.805364,10.104975], 1107 | [39.050833,-94.581667], 1108 | [-34.512575,-58.492883], 1109 | [52.368167,4.970167], 1110 | [37.203613,128.004683], 1111 | [23.575711,119.576394], 1112 | [39.592571,-0.553439], 1113 | [37.203613,128.004683], 1114 | [43.341666,-70.465667], 1115 | [44.854058,1.333218], 1116 | [35.625556,-78.328611], 1117 | [43.723412,10.394933], 1118 | [28.65026,77.23586], 1119 | [42.704086,-82.55062], 1120 | [45.423712,-75.698708], 1121 | [37.203613,128.004683], 1122 | [37.203613,128.004683], 1123 | [37.84039,-122.261624], 1124 | [36.777721,-6.3576], 1125 | [37.203613,128.004683], 1126 | [37.203613,128.004683], 1127 | [37.203613,128.004683], 1128 | [26.46045,127.812758], 1129 | [37.269335,-112.947939], 1130 | [37.203613,128.004683], 1131 | [42.779472,-8.893368], 1132 | [39.050833,-94.581667], 1133 | [36.393651,30.47264], 1134 | [37.203613,128.004683], 1135 | [52.915833,-1.476], 1136 | [-19.991094,57.602691], 1137 | [36.25333,-5.967136], 1138 | [41.385719,2.170049], 1139 | [45.629404,-125.36499], 1140 | [23.575744,119.576386], 1141 | [43.723048,10.396574], 1142 | [19.289372,-99.095392], 1143 | [37.203613,128.004683], 1144 | [31.206992,121.425136], 1145 | [52.916167,-1.475833], 1146 | [37.203613,128.004683], 1147 | [44.92215,-110.43766], 1148 | [46.470793,6.910014], 1149 | [48.852806,2.349994], 1150 | [51.870635,-0.571117], 1151 | [37.203613,128.004683], 1152 | [37.203613,128.004683], 1153 | [41.046022,28.989851], 1154 | [45.442232,10.994868], 1155 | [26.278485,73.018054], 1156 | [49.010739,2.575092], 1157 | [23.575719,119.576288], 1158 | [37.203613,128.004683], 1159 | [37.203613,128.004683], 1160 | [51.439623,5.52329], 1161 | [43.720032,10.40064], 1162 | [53.803571,-1.389169], 1163 | [37.203613,128.004683], 1164 | [48.863649,-123.363343], 1165 | [52.308268,0.636112], 1166 | [35.625556,-78.328611], 1167 | [47.574889,-122.400419], 1168 | [26.46045,127.812758], 1169 | [26.278485,73.018054], 1170 | [52.308268,0.636112], 1171 | [52.791288,7.239056], 1172 | [26.278485,73.018054], 1173 | [35.602881,-83.414125], 1174 | [45.532376,-122.661841], 1175 | [40.7767,-73.87204], 1176 | [42.994524,-3.006198], 1177 | [37.203613,128.004683], 1178 | [33.394615,-96.959238], 1179 | [37.203613,128.004683], 1180 | [38.263734,-85.669178], 1181 | [35.82415,-78.622756], 1182 | [35.5156,-83.306064], 1183 | [52.308268,0.636112], 1184 | [36.782892,34.606933], 1185 | [20.558833,-100.3605], 1186 | [37.808334,-122.419238], 1187 | [26.46045,127.812758], 1188 | [43.3595,-70.4785], 1189 | [37.203613,128.004683], 1190 | [53.958279,-1.091701], 1191 | [49.607602,6.553655], 1192 | [37.203613,128.004683], 1193 | [48.853096,2.369163], 1194 | [37.251803,-112.956307], 1195 | [40.752806,-73.977175], 1196 | [37.203613,128.004683], 1197 | [37.203613,128.004683], 1198 | [53.957183,-1.092463], 1199 | [26.241794,50.595564], 1200 | [57.673902,-1.99022], 1201 | [19.030557,-97.996287], 1202 | [41.913441,-87.648256], 1203 | [41.806781,13.788359], 1204 | [42.253744,1.860423], 1205 | [37.203613,128.004683], 1206 | [37.203613,128.004683], 1207 | [30.877021,77.059088], 1208 | [43.361166,-70.476667], 1209 | [26.46045,127.812758], 1210 | [42.893998,-85.643283], 1211 | [20.5915,-100.390334], 1212 | [30.752052,120.475219], 1213 | [52.627788,-2.4863], 1214 | [40.681786,-73.972545], 1215 | [40.758724,-73.978596], 1216 | [30.751136,120.482011], 1217 | [25.223,55.349666], 1218 | [57.601219,-4.428559], 1219 | [59.685784,30.453801], 1220 | [25.130833,55.115666], 1221 | [60.165704,24.945746], 1222 | [40.758724,-73.978596], 1223 | [24.136414,120.676574], 1224 | [12.206817,120.051383], 1225 | [26.757802,-77.328453], 1226 | [50.852754,0.574582], 1227 | [50.852754,0.574582], 1228 | [24.136414,120.676574], 1229 | [30.750455,120.4823], 1230 | [23.57573,119.576313], 1231 | [48.249,11.559333], 1232 | [30.752044,120.477066], 1233 | [30.753338,120.474594], 1234 | [41.918628,12.470855], 1235 | [39.951447,-86.137779], 1236 | [36.4117,-79.3764], 1237 | [43.641667,-79.438], 1238 | [41.918628,12.470855], 1239 | [44.139644,-77.41801], 1240 | [57.69866,11.932482], 1241 | [48.248833,11.565], 1242 | [30.750291,120.485038], 1243 | [57.69866,11.932482], 1244 | [30.750988,120.482383], 1245 | [30.751127,120.482038], 1246 | [25.196,55.279833], 1247 | [48.248666,11.565], 1248 | [31.223049,121.456863], 1249 | [51.901189,-2.076308], 1250 | [26.758777,-77.329134], 1251 | [25.046258,121.519031], 1252 | [37.891808,128.829575], 1253 | [24.136414,120.676574], 1254 | [50.852693,0.569894], 1255 | [23.575722,119.576272], 1256 | [25.196333,55.2725], 1257 | [35.625556,-78.328611], 1258 | [-34.608749,-58.362911], 1259 | [49.390509,-124.641067], 1260 | [50.852331,0.567137], 1261 | [30.75175,120.477652], 1262 | [30.750272,120.482291], 1263 | [31.234875,121.471244], 1264 | [30.750497,120.481827], 1265 | [59.920553,10.750572], 1266 | [30.751208,120.481941], 1267 | [37.891808,128.829575], 1268 | [37.891808,128.829575], 1269 | [36.738884,3.02124], 1270 | [37.910313,128.819991], 1271 | [25.245833,55.298833], 1272 | [30.750105,120.482252], 1273 | [51.388815,0.078277], 1274 | [12.206817,120.051383], 1275 | [37.891808,128.829575], 1276 | [30.752797,120.475655], 1277 | [43.722994,10.395104], 1278 | [30.739186,120.493072], 1279 | [30.750122,120.482313], 1280 | [50.852331,0.567137], 1281 | [12.206817,120.051383], 1282 | [39.145167,-94.575667], 1283 | [44.49993,11.350774], 1284 | [12.206817,120.051383], 1285 | [40.758724,-73.978596], 1286 | [44.93967,-122.962219], 1287 | [-33.916155,18.408279], 1288 | [37.694687,26.617126], 1289 | [52.524681,-1.467007], 1290 | [40.278438,22.494539], 1291 | [12.206817,120.051383], 1292 | [30.751261,120.481941], 1293 | [30.750272,120.48233], 1294 | [50.852754,0.574582], 1295 | [48.249,11.558833], 1296 | [36.918038,-113.864681], 1297 | [48.86218,2.345074], 1298 | [42.612,-70.665333], 1299 | [25.223166,55.350666], 1300 | [40.758724,-73.978596], 1301 | [40.486697,-79.919936], 1302 | [40.486697,-79.919936], 1303 | [52.707595,-2.75465], 1304 | [-26.509904,-28.828125], 1305 | [12.206817,120.051383], 1306 | [12.206817,120.051383], 1307 | [48.248833,11.563333], 1308 | [57.69866,11.932482], 1309 | [50.956655,4.664436], 1310 | [42.610167,-70.671333], 1311 | [30.739186,120.493072], 1312 | [30.753338,120.474594], 1313 | [30.752852,120.475691], 1314 | [45.090974,7.633552], 1315 | [30.75105,120.483077], 1316 | [37.891808,128.829575], 1317 | [37.910313,128.819991], 1318 | [30.750488,120.482352], 1319 | [43.722994,10.395104], 1320 | [24.136414,120.676574], 1321 | [50.853984,0.586599], 1322 | [24.136414,120.676574], 1323 | [46.822029,6.938295], 1324 | [51.409037,16.421653], 1325 | [48.254833,11.558666], 1326 | [30.753322,120.474602], 1327 | [30.751377,120.478577], 1328 | [24.136414,120.676574], 1329 | [24.136414,120.676574], 1330 | [45.03203,7.665388], 1331 | [26.758502,-77.326689], 1332 | [12.206817,120.051383], 1333 | [24.136414,120.676574], 1334 | [50.856368,0.594892], 1335 | [39.145,-94.5755], 1336 | [30.750108,120.482252], 1337 | [53.20832,-6.101918], 1338 | [29.333333,48.083333], 1339 | [50.856368,0.594892], 1340 | [40.957174,-4.143583], 1341 | [39.145167,-94.575667], 1342 | [43.641833,-79.438], 1343 | [-11.667745,34.244922], 1344 | [26.758661,-77.328434], 1345 | [28.484082,-16.196651], 1346 | [10.792167,106.669167], 1347 | [63.364631,11.964247], 1348 | [48.248833,11.565], 1349 | [43.862133,11.570942], 1350 | [12.206817,120.051383], 1351 | [12.206817,120.051383], 1352 | [37.891808,128.829575], 1353 | [25.223,55.349666], 1354 | [46.52013,-1.814546], 1355 | [50.8548,0.584077], 1356 | [50.852754,0.574582], 1357 | [30.751122,120.481977], 1358 | [12.206817,120.051383], 1359 | [12.206817,120.051383], 1360 | [12.206817,120.051383], 1361 | [36.315281,-75.807333], 1362 | [57.69866,11.932482], 1363 | [51.390958,0.07656], 1364 | [30.751683,120.474547], 1365 | [48.856918,2.341209], 1366 | [26.758072,-77.329303], 1367 | [35.763089,-5.809535], 1368 | [38.85585,-97.606186], 1369 | [52.5897,-1.252441], 1370 | [40.486697,-79.919936], 1371 | [33.706419,-118.287906], 1372 | [22.271623,114.172668], 1373 | [30.752852,120.475669], 1374 | [30.739133,120.493386], 1375 | [48.647633,-123.398437], 1376 | [50.855284,0.59015], 1377 | [48.248833,11.565], 1378 | [43.722777,10.396134], 1379 | [39.473239,-0.421814], 1380 | [49.897212,-97.141767], 1381 | [50.855284,0.59015], 1382 | [39.050833,-94.581667], 1383 | [51.789483,-0.225042], 1384 | [30.751119,120.4822], 1385 | [30.751908,120.476477], 1386 | [28.013801,102.354125], 1387 | [37.891808,128.829575], 1388 | [44.11606,-73.825893], 1389 | [43.641667,-79.438], 1390 | [30.751377,120.478577], 1391 | [39.145,-94.5755], 1392 | [40.681786,-73.972545], 1393 | [39.050833,-94.581667], 1394 | [50.852331,0.567137], 1395 | [42.734991,-77.907789], 1396 | [12.206817,120.051383], 1397 | [44.419068,8.536376], 1398 | [19.036805,72.888793], 1399 | [49.127837,12.129867], 1400 | [37.910313,128.819991], 1401 | [46.528325,9.195447], 1402 | [25.144833,55.192333], 1403 | [24.136414,120.676574], 1404 | [43.538225,-7.041265], 1405 | [25.032805,121.543235], 1406 | [41.918628,12.470855], 1407 | [57.69866,11.932482], 1408 | [61.250423,11.252746], 1409 | [63.364573,11.963388], 1410 | [24.136414,120.676574], 1411 | [30.752858,120.475722], 1412 | [25.861288,-77.186895], 1413 | [12.206817,120.051383], 1414 | [26.756772,-77.32895], 1415 | [49.897371,-97.142937], 1416 | [40.486697,-79.919936], 1417 | [38.677151,15.890414], 1418 | [59.305227,18.076376], 1419 | [25.223499,55.351666], 1420 | [12.206817,120.051383], 1421 | [42.612,-70.665333], 1422 | [39.050833,-94.581667], 1423 | [30.753275,120.47435], 1424 | [52.858361,9.524305], 1425 | [51.499553,-0.126686], 1426 | [23.575691,119.576261], 1427 | [30.751219,120.481977], 1428 | [39.145,-94.5755], 1429 | [30.751758,120.47515], 1430 | [30.751661,120.477997], 1431 | [40.735551,-73.990396], 1432 | [29.563901,106.583862], 1433 | [43.538225,-7.041265], 1434 | [25.085054,121.544609], 1435 | [-33.45751,-70.770492], 1436 | [12.206817,120.051383], 1437 | [50.854834,0.584034], 1438 | [48.886843,2.387466], 1439 | [57.69866,11.932482], 1440 | [41.664705,-72.79541], 1441 | [51.512779,-0.124645], 1442 | [12.206817,120.051383], 1443 | [30.750522,120.481588], 1444 | [-23.587748,-46.654789], 1445 | [39.145,-94.575833], 1446 | [48.248833,11.5635], 1447 | [43.721978,10.396971], 1448 | [24.136414,120.676574], 1449 | [43.723048,10.396574], 1450 | [20.592499,-100.389501], 1451 | [51.504588,-0.076873], 1452 | [50.852754,0.574582], 1453 | [37.891808,128.829575], 1454 | [30.75208,120.475747], 1455 | [25.196,55.279833], 1456 | [51.60629,-2.510032], 1457 | [25.030472,121.554994], 1458 | [59.424212,5.284856], 1459 | [41.029716,28.97442], 1460 | [23.449167,120.434167], 1461 | [42.348173,-83.457448], 1462 | [36.228977,-113.063491], 1463 | [26.266805,-77.130142], 1464 | [53.998284,-6.170196], 1465 | [25.121166,55.200333], 1466 | [25.085443,121.544265], 1467 | [39.145,-94.575833], 1468 | [36.918038,-113.864681], 1469 | [35.885799,14.4031], 1470 | [-27.468879,153.022827], 1471 | [-53.158814,-70.921897], 1472 | [24.136414,120.676574], 1473 | [57.69866,11.932482], 1474 | [43.862133,11.570942], 1475 | [30.75173,120.477622], 1476 | [30.750611,120.482475], 1477 | [40.692104,-74.001755], 1478 | [25.861561,-77.184098], 1479 | [40.486697,-79.919936], 1480 | [12.206817,120.051383], 1481 | [43.641833,-79.438167], 1482 | [50.852331,0.567137], 1483 | [37.910313,128.819991], 1484 | [35.967031,-79.066343], 1485 | [30.752333,120.475433], 1486 | [-11.667542,34.245102], 1487 | [51.989789,5.948077], 1488 | [12.206817,120.051383], 1489 | [25.583499,91.878143], 1490 | [57.69866,11.932482], 1491 | [51.497843,-0.118789], 1492 | [37.507225,126.987438], 1493 | [24.136414,120.676574], 1494 | [40.758724,-73.978596], 1495 | [31.234794,121.471352], 1496 | [30.75263,120.475555], 1497 | [35.14313,-106.55601], 1498 | [12.206817,120.051383], 1499 | [53.958279,-1.091701], 1500 | [44.691951,-0.527853], 1501 | [40.758724,-73.978596], 1502 | [20.592499,-100.389501], 1503 | [30.750522,120.481588], 1504 | [12.206817,120.051383], 1505 | [48.248833,11.5635], 1506 | [43.723048,10.396574], 1507 | [-23.587748,-46.654789], 1508 | [43.721978,10.396971], 1509 | [39.145,-94.575833], 1510 | [51.512779,-0.124645], 1511 | [57.69866,11.932482], 1512 | [24.136414,120.676574], 1513 | [51.504588,-0.076873], 1514 | [50.852754,0.574582], 1515 | [37.891808,128.829575], 1516 | [30.75208,120.475747], 1517 | [25.196,55.279833], 1518 | [51.60629,-2.510032], 1519 | [59.424212,5.284856], 1520 | [25.030472,121.554994], 1521 | [23.449167,120.434167], 1522 | [41.029716,28.97442], 1523 | [35.885799,14.4031], 1524 | [26.266805,-77.130142], 1525 | [36.228977,-113.063491], 1526 | [39.145,-94.575833], 1527 | [36.918038,-113.864681], 1528 | [42.348173,-83.457448], 1529 | [25.121166,55.200333], 1530 | [53.998284,-6.170196], 1531 | [25.085443,121.544265], 1532 | [-27.468879,153.022827], 1533 | [-53.158814,-70.921897], 1534 | [24.136414,120.676574], 1535 | [57.69866,11.932482], 1536 | [43.862133,11.570942], 1537 | [30.75173,120.477622], 1538 | [30.750611,120.482475], 1539 | [40.692104,-74.001755], 1540 | [25.861561,-77.184098], 1541 | [40.486697,-79.919936], 1542 | [12.206817,120.051383], 1543 | [43.641833,-79.438167], 1544 | [50.852331,0.567137], 1545 | [37.910313,128.819991], 1546 | [35.967031,-79.066343], 1547 | [30.752333,120.475433], 1548 | [-11.667542,34.245102], 1549 | [51.989789,5.948077], 1550 | [12.206817,120.051383], 1551 | [25.583499,91.878143], 1552 | [57.69866,11.932482], 1553 | [51.497843,-0.118789], 1554 | [37.507225,126.987438], 1555 | [24.136414,120.676574], 1556 | [50.853025,0.572801], 1557 | [31.234794,121.471352], 1558 | [40.758724,-73.978596], 1559 | [40.758724,-73.978596], 1560 | [12.206817,120.051383], 1561 | [30.75263,120.475555], 1562 | [35.14313,-106.55601], 1563 | [44.691951,-0.527853], 1564 | [49.897663,-97.142684], 1565 | [53.958279,-1.091701], 1566 | [30.751577,120.477525], 1567 | [23.575672,119.576277], 1568 | [30.751086,120.481977], 1569 | [25.195833,55.2775], 1570 | [40.276906,22.493476], 1571 | [31.223049,121.456863], 1572 | [39.900057,32.864463], 1573 | [50.853401,0.57882], 1574 | [53.958686,-1.091251], 1575 | [40.758724,-73.978596], 1576 | [43.862133,11.570942], 1577 | [12.206817,120.051383], 1578 | [24.136414,120.676574], 1579 | [48.248166,11.557833], 1580 | [57.69866,11.932482], 1581 | [30.750386,120.484925], 1582 | [43.723048,10.396574], 1583 | [40.279656,22.496223], 1584 | [36.774092,34.650878], 1585 | [30.751222,120.481977], 1586 | [51.225207,6.784223], 1587 | [53.985972,-6.15921], 1588 | [46.529333,9.199233], 1589 | [40.339258,-74.674576], 1590 | [24.84859,120.921535], 1591 | [39.050833,-94.581667], 1592 | [43.282391,-2.984161], 1593 | [39.145167,-94.575833], 1594 | [26.758238,-77.329192], 1595 | [30.751127,120.482186], 1596 | [42.165667,-8.594167], 1597 | [37.689254,26.916503], 1598 | [37.3805,-122.0145], 1599 | [26.758811,-77.328287], 1600 | [40.758724,-73.978596], 1601 | [50.455755,-4.470748], 1602 | [31.234866,121.471327], 1603 | [55.869056,-4.290944], 1604 | [39.050833,-94.581834], 1605 | [53.320583,-2.395478], 1606 | [4.621255,-74.073257], 1607 | [34.33597,-92.76148], 1608 | [52.627788,-2.4863], 1609 | [24.136414,120.676574], 1610 | [40.758724,-73.978596], 1611 | [30.751213,120.481977], 1612 | [23.57568,119.576269], 1613 | [31.223152,121.456894], 1614 | [31.234908,121.470825], 1615 | [25.110005,121.466274], 1616 | [41.487202,-72.515516], 1617 | [43.268991,-2.934422], 1618 | [43.282477,-2.984483], 1619 | [38.838236,-97.609705], 1620 | [30.751222,120.481977], 1621 | [36.065871,-79.092306], 1622 | [50.9719,-2.720659], 1623 | [48.248833,11.558833], 1624 | [30.751277,120.481925], 1625 | [26.75848,-77.329045], 1626 | [50.853703,0.573778], 1627 | [28.470511,-16.255838], 1628 | [12.206817,120.051383], 1629 | [37.910313,128.819991], 1630 | [-23.558558,-46.557784], 1631 | [50.852693,0.569894], 1632 | [50.853984,0.586599], 1633 | [51.901189,-2.076308], 1634 | [25.098366,121.546297], 1635 | [22.156088,-80.450134], 1636 | [38.855483,-97.602066], 1637 | [45.486646,9.205138], 1638 | [25.144166,55.191833], 1639 | [43.282415,-2.984504], 1640 | [42.610167,-70.671333], 1641 | [24.136414,120.676574], 1642 | [43.15548,-5.412483], 1643 | [40.425887,-3.721146], 1644 | [50.853401,0.57882], 1645 | [48.861446,2.335002], 1646 | [-11.678395,34.248777], 1647 | [52.51924,-1.467243], 1648 | [33.804255,-117.916967], 1649 | [51.409037,16.421653], 1650 | [53.472576,-2.299548], 1651 | [48.778711,9.179313], 1652 | [37.910313,128.819991], 1653 | [46.528325,9.195447], 1654 | [30.751177,120.481941], 1655 | [52.519243,-1.467254], 1656 | [48.248833,11.565], 1657 | [51.755727,8.733787], 1658 | [51.387209,0.07965], 1659 | [41.918628,12.470855], 1660 | [24.136414,120.676574], 1661 | [49.390718,-124.640648], 1662 | [49.270179,4.895713], 1663 | [30.751122,120.482191], 1664 | [42.611167,-70.665667], 1665 | [30.751141,120.482125], 1666 | [25.195833,55.2775], 1667 | [30.752388,120.4757], 1668 | [50.853025,0.572801], 1669 | [33.449373,-112.068765], 1670 | [42.735011,-77.907789], 1671 | [12.206817,120.051383], 1672 | [57.221611,-5.716323], 1673 | [50.359042,3.525581], 1674 | [12.206817,120.051383], 1675 | [12.206817,120.051383], 1676 | [42.5859,-78.018362], 1677 | [12.206817,120.051383], 1678 | [12.206817,120.051383], 1679 | [49.390652,-124.640563], 1680 | [40.425652,-3.72108], 1681 | [26.21768,-77.210395], 1682 | [39.050833,-94.581667], 1683 | [47.551208,-65.674095], 1684 | [25.051857,121.518344], 1685 | [37.1791,-7.9517], 1686 | [48.247666,11.561], 1687 | [30.752313,120.475661], 1688 | [50.453897,-4.470405], 1689 | [48.248333,11.561833], 1690 | [22.157678,-80.450134], 1691 | [42.77959,-1.453027], 1692 | [60.880767,11.563453], 1693 | [37.506944,126.987397], 1694 | [51.387209,0.081367], 1695 | [37.910313,128.819991], 1696 | [12.206817,120.051383], 1697 | [12.206817,120.051383], 1698 | [48.853124,2.349271], 1699 | [28.013801,102.354125], 1700 | [40.486697,-79.919936], 1701 | [50.852331,0.567137], 1702 | [50.856398,0.594871], 1703 | [48.20641,16.35442], 1704 | [51.78168,-0.216287], 1705 | [45.424946,-75.699845], 1706 | [3.144511,101.690332], 1707 | [43.862133,11.570942], 1708 | [39.145,-94.575667], 1709 | [53.890926,-1.237313], 1710 | [43.862133,11.570942], 1711 | [30.739186,120.493072], 1712 | [26.760241,-77.330123], 1713 | [25.109849,121.46696], 1714 | [57.69866,11.932482], 1715 | [37.891808,128.829575], 1716 | [-11.677973,34.253805], 1717 | [30.751033,120.482063], 1718 | [37.506911,126.987463], 1719 | [38.074852,20.799865], 1720 | [25.911344,-77.223887], 1721 | [43.722777,10.396134], 1722 | [24.136414,120.676574], 1723 | [43.641833,-79.438], 1724 | [13.456074,-16.587295], 1725 | [36.777721,-6.3576], 1726 | [48.247666,11.561166], 1727 | [40.758724,-73.978596], 1728 | [43.722994,10.395104], 1729 | [26.757586,-77.327398], 1730 | [-11.665978,34.249058], 1731 | [24.136414,120.676574], 1732 | [40.758724,-73.978596], 1733 | [31.223105,121.456588], 1734 | [30.751158,120.479425], 1735 | [41.918628,12.470855], 1736 | [48.248833,11.563333], 1737 | [36.21635,-112.060791], 1738 | [51.50632,-0.12714], 1739 | [12.206817,120.051383], 1740 | [51.209659,-2.642287], 1741 | [24.136414,120.676574], 1742 | [60.168188,24.942755], 1743 | [48.29617,14.29207], 1744 | [50.8548,0.584077], 1745 | [39.145167,-94.575667], 1746 | [37.891808,128.829575], 1747 | [-11.684842,34.253644], 1748 | [50.853096,0.57175], 1749 | [50.852693,0.569894], 1750 | [50.852693,0.569894], 1751 | [49.390498,-124.641056], 1752 | [-11.665978,34.249058], 1753 | [40.758724,-73.978596], 1754 | [31.223105,121.456588], 1755 | [43.722994,10.395104], 1756 | [24.136414,120.676574], 1757 | [26.757586,-77.327398], 1758 | [48.248833,11.563333], 1759 | [36.21635,-112.060791], 1760 | [30.751158,120.479425], 1761 | [41.918628,12.470855], 1762 | [51.50632,-0.12714], 1763 | [12.206817,120.051383], 1764 | [51.209659,-2.642287], 1765 | [24.136414,120.676574], 1766 | [60.168188,24.942755], 1767 | [48.29617,14.29207], 1768 | [50.8548,0.584077], 1769 | [-11.684842,34.253644], 1770 | [39.145167,-94.575667], 1771 | [37.891808,128.829575], 1772 | [50.853096,0.57175], 1773 | [50.852693,0.569894], 1774 | [50.852693,0.569894], 1775 | [50.852754,0.574582], 1776 | [12.206817,120.051383], 1777 | [23.575713,119.576311], 1778 | [12.206817,120.051383], 1779 | [50.856374,0.590096], 1780 | [50.852693,0.569894], 1781 | [49.896606,-97.143966], 1782 | [25.194838,55.276217], 1783 | [30.752486,120.475463], 1784 | [45.498722,-73.57957], 1785 | [24.136414,120.676574], 1786 | [25.861838,-77.1845], 1787 | [43.282329,-2.984397], 1788 | [50.853232,0.576964], 1789 | [47.599681,17.526626], 1790 | [45.266667,-79.967333], 1791 | [39.145,-94.5755], 1792 | [30.752277,120.476197], 1793 | [43.722777,10.396134], 1794 | [48.247666,11.561166], 1795 | [25.229499,55.319], 1796 | [51.49795,-0.127716], 1797 | [42.586655,-78.018464], 1798 | [26.21773,-77.21042], 1799 | [12.206817,120.051383], 1800 | [12.206817,120.051383], 1801 | [40.74087,-74.007912], 1802 | [39.050833,-94.581667], 1803 | [30.751722,120.474777], 1804 | [30.739186,120.493072], 1805 | [50.539181,-4.941101], 1806 | [24.136414,120.676574], 1807 | [38.855383,-97.602496], 1808 | [-11.684859,34.253619], 1809 | [50.852331,0.567137], 1810 | [50.378887,2.773962], 1811 | [53.957183,-1.092463], 1812 | [37.910313,128.819991], 1813 | [30.752147,120.476363], 1814 | [48.248166,11.5615], 1815 | [36.315281,-75.807333], 1816 | [40.758724,-73.978596], 1817 | [47.55455,10.218483], 1818 | [30.752552,120.475555], 1819 | [48.248833,11.56], 1820 | [37.891808,128.829575], 1821 | [30.370431,-98.003911], 1822 | [12.206817,120.051383], 1823 | [30.753255,120.474372], 1824 | [56.653395,-4.96788], 1825 | [-23.539646,-46.730664], 1826 | [12.206817,120.051383], 1827 | [12.206817,120.051383], 1828 | [25.861622,-77.184039], 1829 | [52.525095,-1.46632], 1830 | [6.019858,-75.433917], 1831 | [42.611167,-70.6655], 1832 | [50.852331,0.567137], 1833 | [26.753063,-77.311578], 1834 | [12.206817,120.051383], 1835 | [51.78168,-0.216287], 1836 | [52.572248,5.801339], 1837 | [52.18454,4.497592], 1838 | [12.206817,120.051383], 1839 | [26.758261,-77.330481], 1840 | [40.758724,-73.978596], 1841 | [46.159671,9.330719], 1842 | [37.891808,128.829575], 1843 | [39.050833,-94.581834], 1844 | [43.538225,-7.041265], 1845 | [30.739186,120.493072], 1846 | [31.233808,121.471763], 1847 | [40.758724,-73.978596], 1848 | [-33.426839,-70.61531], 1849 | [26.241794,50.595564], 1850 | [22.271459,113.948608], 1851 | [42.585705,-78.020631], 1852 | [52.627788,-2.4863], 1853 | [40.420299,-3.70577], 1854 | [31.223152,121.456894], 1855 | [39.900353,32.863433], 1856 | [12.206817,120.051383], 1857 | [41.196089,-73.078881], 1858 | [12.206817,120.051383], 1859 | [43.862133,11.570942], 1860 | [25.121166,55.200333], 1861 | [25.132166,55.117333], 1862 | [24.957425,121.536827], 1863 | [48.249,11.561666], 1864 | [24.136414,120.676574], 1865 | [24.136414,120.676574], 1866 | [30.279981,-97.720108], 1867 | [40.758724,-73.978596], 1868 | [51.783416,-0.217237], 1869 | [51.901189,-2.076308], 1870 | [51.050648,8.387525], 1871 | [37.910313,128.819991], 1872 | [22.157837,-80.45082], 1873 | [32.811804,-79.72023], 1874 | [12.206817,120.051383], 1875 | [12.206817,120.051383], 1876 | [57.28968,-6.173678], 1877 | [24.136414,120.676574], 1878 | [25.030472,121.554994], 1879 | [39.047572,-94.582171], 1880 | [50.855426,0.565291], 1881 | [57.69866,11.932482], 1882 | [30.751336,120.478958], 1883 | [12.206817,120.051383], 1884 | [24.136414,120.676574], 1885 | [57.69866,11.932482], 1886 | [35.625556,-78.328611], 1887 | [30.750991,120.48243], 1888 | [30.751116,120.482072], 1889 | [64.153442,-22.030334], 1890 | [50.852331,0.567137], 1891 | [31.234933,121.470877], 1892 | [29.563901,106.583862], 1893 | [25.861633,-77.183959], 1894 | [24.136414,120.676574], 1895 | [57.69866,11.932482], 1896 | [30.750775,120.482513], 1897 | [30.750525,120.481438], 1898 | [34.052666,-118.264], 1899 | [24.136414,120.676574], 1900 | [33.449373,-112.068765], 1901 | [12.206817,120.051383], 1902 | [30.750102,120.482252], 1903 | [51.783416,-0.217237], 1904 | [4.634002,-74.092597], 1905 | [40.758724,-73.978596], 1906 | [31.728021,-110.880546], 1907 | [41.892055,12.509307], 1908 | [39.908682,116.448383], 1909 | [40.486697,-79.919936], 1910 | [12.999372,80.273323], 1911 | [12.206817,120.051383], 1912 | [45.511944,-122.618056], 1913 | [52.308268,0.636112], 1914 | [42.61453,-78.011445], 1915 | [28.22315,-16.631069], 1916 | [28.22315,-16.631069], 1917 | [45.577449,-122.118896], 1918 | [53.360092,-2.273526], 1919 | [40.792873,-72.997629], 1920 | [45.267167,-79.9675], 1921 | [41.767726,140.716495], 1922 | [4.695641,-74.030502], 1923 | [38.917082,1.455345], 1924 | [51.751321,-0.223771], 1925 | [28.22315,-16.631069], 1926 | [28.22315,-16.631069], 1927 | [53.391568,-2.59485], 1928 | [39.001411,-77.24649], 1929 | [41.118054,1.250596], 1930 | [57.69866,11.932482], 1931 | [12.206817,120.051383], 1932 | [-7.4038,111.4461], 1933 | [23.1462,113.293997], 1934 | [35.684071,-0.604248], 1935 | [23.575733,119.576261], 1936 | [12.206817,120.051383], 1937 | [12.206817,120.051383], 1938 | [42.739654,12.737437], 1939 | [47.506197,19.0467], 1940 | [25.194838,55.276217], 1941 | [46.561102,23.781795], 1942 | [25.194838,55.276217], 1943 | [38.903858,1.457061], 1944 | [12.206817,120.051383], 1945 | [2.419877,-76.605262], 1946 | [47.5035,19.0404], 1947 | [5.464055,100.356442], 1948 | [28.22315,-16.631069], 1949 | [44.016937,-72.850542], 1950 | [38.888,-77.1265], 1951 | [40.385324,-3.745511], 1952 | [39.89818,-76.157913], 1953 | [44.328033,27.800144], 1954 | [37.769485,-122.46653], 1955 | [42.727111,-77.923414], 1956 | [28.22315,-16.631069], 1957 | [42.585986,-78.018075], 1958 | [42.614677,-78.011714], 1959 | [51.372985,1.131334], 1960 | [38.888,-77.1275], 1961 | [41.892346,12.47137], 1962 | [43.48257,-1.558789], 1963 | [28.22315,-16.631069], 1964 | [42.721333,-77.927064], 1965 | [52.524384,-1.467189], 1966 | [45.474306,9.186029], 1967 | [47.550166,-122.317167], 1968 | [46.333654,-63.204345], 1969 | [47.506197,19.0467], 1970 | [40.358661,18.162074], 1971 | [43.326163,-3.017759], 1972 | [48.206299,16.354463], 1973 | [22.309276,114.223315], 1974 | [19.590844,104.677734], 1975 | [54.470037,-2.58522], 1976 | [37.698355,-122.189426], 1977 | [39.050666,-94.581667], 1978 | [43.769036,11.250246], 1979 | [12.206817,120.051383], 1980 | [12.206817,120.051383], 1981 | [1.305822,103.850648], 1982 | [51.499469,-0.128558], 1983 | [12.206817,120.051383], 1984 | [46.25428,20.14841], 1985 | [59.334778,18.077162], 1986 | [37.769485,-122.46653], 1987 | [38.902549,-77.006135], 1988 | [42.727244,-77.919684], 1989 | [41.697786,44.798488], 1990 | [45.489166,-122.529445], 1991 | [15.990059,120.329116], 1992 | [51.515256,-0.141879], 1993 | [29.576293,118.940048], 1994 | [12.206817,120.051383], 1995 | [49.683315,5.813622], 1996 | [51.776688,3.86723], 1997 | [50.820773,-0.138359], 1998 | [37.534504,127.085895], 1999 | [12.206817,120.051383], 2000 | [1.415225,103.900043], 2001 | [45.5025,-122.473612], 2002 | [53.958279,-1.091701], 2003 | [38.784214,-77.073377], 2004 | [-18.94753,48.521381], 2005 | [47.506197,19.0467], 2006 | [43.782371,11.254989], 2007 | [49.42013,0.238094], 2008 | [38.888,-77.1265], 2009 | [40.5895,-74.473667], 2010 | [46.802409,23.40002], 2011 | [35.166671,-5.26667], 2012 | [38.044576,23.582611], 2013 | [33.582333,-101.845667], 2014 | [41.487202,-72.515516], 2015 | [42.599527,-78.02965], 2016 | [53.744596,-0.364404], 2017 | [39.825833,-86.1865], 2018 | [29.576293,118.940048], 2019 | [22.616823,120.283255], 2020 | [38.888333,-77.128167], 2021 | [-33.419523,-70.617628], 2022 | [29.563901,106.583862], 2023 | [48.722791,21.256676], 2024 | [45.068928,7.692811], 2025 | [43.769036,11.250246], 2026 | [28.22315,-16.631069], 2027 | [39.050833,-94.581667], 2028 | [23.575719,119.576277], 2029 | [39.832663,-76.242113], 2030 | [29.563901,106.583862], 2031 | [40.76052,-73.98468], 2032 | [50.096081,14.425484], 2033 | [29.563901,106.583862], 2034 | [40.5895,-74.473667], 2035 | [55.736728,26.247459], 2036 | [12.206817,120.051383], 2037 | [64.863919,-24.038489], 2038 | [12.206817,120.051383], 2039 | [28.22315,-16.631069], 2040 | [-33.463039,-70.647941], 2041 | [-12.768328,34.178419], 2042 | [38.888167,-77.1265], 2043 | [42.727136,-77.92257], 2044 | [15.990059,120.329116], 2045 | [39.29055,-76.609596], 2046 | [43.722777,10.396134], 2047 | [47.595514,17.527999], 2048 | [38.953001,1.522293], 2049 | [47.506197,19.0467], 2050 | [37.769485,-122.46653], 2051 | [33.583333,-101.845667], 2052 | [35.668523,139.705817], 2053 | [47.597829,17.525253], 2054 | [39.825833,-86.1865], 2055 | [23.575736,119.576263], 2056 | [55.77819,37.636907], 2057 | [12.206817,120.051383], 2058 | [12.206817,120.051383], 2059 | [12.206817,120.051383], 2060 | [28.22315,-16.631069], 2061 | [42.701319,-77.937956], 2062 | [42.702711,-77.928589], 2063 | [46.011094,-122.845537], 2064 | [36.777721,-6.3576], 2065 | [42.614697,-78.011831], 2066 | [48.86218,2.345074], 2067 | [28.22315,-16.631069], 2068 | [43.720373,10.395491], 2069 | [45.520833,-122.670278], 2070 | [37.769485,-122.46653], 2071 | [47.506197,19.0467], 2072 | [37.557121,126.977378], 2073 | [49.684587,5.8142], 2074 | [23.1462,113.293997], 2075 | [19.415271,-99.172416], 2076 | [42.721472,-77.927256], 2077 | [37.769485,-122.46653], 2078 | [12.206817,120.051383], 2079 | [45.068894,7.693219], 2080 | [44.977701,-93.273078], 2081 | [41.760684,140.705165], 2082 | [46.910566,-124.112131], 2083 | [42.727238,-77.919917], 2084 | [34.712871,135.504089], 2085 | [51.624144,-2.690534], 2086 | [43.715294,10.395212], 2087 | [28.22315,-16.631069], 2088 | [1.307002,103.849296], 2089 | [53.824598,-0.440944], 2090 | [12.206817,120.051383], 2091 | [39.050833,-94.581667], 2092 | [28.698391,-81.411899], 2093 | [48.868747,2.330696], 2094 | [23.1462,113.293997], 2095 | [40.741603,-73.985664], 2096 | [48.082275,9.078623], 2097 | [51.606286,5.152636], 2098 | [41.767726,140.716495], 2099 | [28.22315,-16.631069], 2100 | [51.751317,-0.224039], 2101 | [23.575719,119.576247], 2102 | [52.36328,4.904939], 2103 | [38.888333,-77.127833], 2104 | [32.221549,-110.969749], 2105 | [41.884151,-87.632408], 2106 | [28.22315,-16.631069], 2107 | [53.843323,-0.45384], 2108 | [46.383293,25.832462], 2109 | [42.734977,-77.907789], 2110 | [42.727336,-77.920909], 2111 | [47.506197,19.0467], 2112 | [12.206817,120.051383], 2113 | [12.206817,120.051383], 2114 | [12.206817,120.051383], 2115 | [-23.557653,-46.660866], 2116 | [34.712871,135.504089], 2117 | [40.339258,-74.674576], 2118 | [25.194838,55.276217], 2119 | [12.206817,120.051383], 2120 | [42.735138,-77.90732], 2121 | [42.70098,-77.938637], 2122 | [23.575727,119.576227], 2123 | [40.358808,18.161945], 2124 | [28.22315,-16.631069], 2125 | [28.22315,-16.631069], 2126 | [43.715294,10.395212], 2127 | [47.506197,19.0467], 2128 | [42.882756,-9.144401], 2129 | [42.727202,-77.91952], 2130 | [28.22315,-16.631069], 2131 | [47.147086,9.797058], 2132 | [22.312049,114.18555], 2133 | [43.862167,-123.026333], 2134 | [37.769485,-122.46653], 2135 | [32.904979,-117.243339], 2136 | [39.825833,-86.1865], 2137 | [37.769485,-122.46653], 2138 | [12.206817,120.051383], 2139 | [-12.767967,34.178138], 2140 | [38.891344,-77.016978], 2141 | [55.783101,37.619998], 2142 | [40.681786,-73.972545], 2143 | [39.001411,-77.24649], 2144 | [28.22315,-16.631069], 2145 | [50.06258,10.248119], 2146 | [42.620955,-77.988075], 2147 | [42.616936,-77.996456], 2148 | [47.506197,19.0467], 2149 | [28.22315,-16.631069], 2150 | [12.206817,120.051383], 2151 | [51.584203,-3.012871], 2152 | [41.760684,140.705165], 2153 | [63.3639,11.966724], 2154 | [38.98637,-77.096916], 2155 | [45.685011,-121.420814], 2156 | [39.825833,-86.186333], 2157 | [40.742832,-73.987663], 2158 | [28.22315,-16.631069], 2159 | [53.780356,-0.304387], 2160 | [35.894056,139.233856], 2161 | [43.722777,10.396134], 2162 | [48.834837,2.370128], 2163 | [37.769485,-122.46653], 2164 | [28.698391,-81.411899], 2165 | [42.175275,-87.879939], 2166 | [64.863919,-24.038489], 2167 | [12.206817,120.051383], 2168 | [-22.858678,-43.266031], 2169 | [57.69866,11.932482], 2170 | [46.011121,-122.845526], 2171 | [42.7014,-77.938384], 2172 | [37.769485,-122.46653], 2173 | [44.977701,-93.273078], 2174 | [38.888667,-77.127833], 2175 | [50.086879,14.416154], 2176 | [52.915833,-1.475833], 2177 | [55.864394,-4.431862], 2178 | [3.157065,101.646215], 2179 | [53.957183,-1.092463], 2180 | [-22.900109,-43.135381], 2181 | [12.206817,120.051383], 2182 | [23.575719,119.576241], 2183 | [12.206817,120.051383], 2184 | [47.148867,9.798431], 2185 | [40.736038,-73.990591], 2186 | [23.1462,113.293897], 2187 | [32.837089,-117.255432], 2188 | [44.881174,-110.735321], 2189 | [28.22315,-16.631069], 2190 | [33.641833,-84.438667], 2191 | [26.443859,50.104671], 2192 | [33.583667,-101.845667], 2193 | [39.469188,-0.376819], 2194 | [23.1462,113.293997], 2195 | [-12.18025,34.023422], 2196 | [42.702675,-77.928781], 2197 | [52.916,-1.475667], 2198 | [30.567333,103.967643], 2199 | [42.607327,-78.023317], 2200 | [12.206817,120.051383], 2201 | [-1.36904,35.0354], 2202 | [41.415955,-5.975189], 2203 | [28.64649,-81.33214], 2204 | [12.206817,120.051383], 2205 | [51.385075,-2.375552], 2206 | [23.1462,113.293997], 2207 | [47.493897,19.044897], 2208 | [50.105497,8.6753], 2209 | [42.612463,-78.008198], 2210 | [37.741755,-97.272874], 2211 | [38.95774,35.431701], 2212 | [42.585936,-78.017889], 2213 | [42.726936,-77.921439], 2214 | [28.22315,-16.631069], 2215 | [57.69866,11.932482], 2216 | [12.206817,120.051383], 2217 | [-12.752314,34.176497], 2218 | [42.093987,12.269282], 2219 | [34.122833,-118.303834], 2220 | [-19.931745,-43.938123], 2221 | [38.888333,-77.127333], 2222 | [23.575727,119.576261], 2223 | [-22.966333,-43.332164], 2224 | [37.769485,-122.46653], 2225 | [56.768613,-3.833477], 2226 | [33.5835,-101.848], 2227 | [39.825833,-86.1865], 2228 | [42.73205,-77.915045], 2229 | [12.206817,120.051383], 2230 | [28.22315,-16.631069], 2231 | [28.22315,-16.631069], 2232 | [55.971204,-2.939186], 2233 | [39.493,-76.367], 2234 | [27.433988,-82.684465], 2235 | [53.365105,-2.288171], 2236 | [47.506197,19.0467], 2237 | [28.22315,-16.631069], 2238 | [39.200304,-76.658906], 2239 | [28.22315,-16.631069], 2240 | [47.048975,-122.904204], 2241 | [53.828664,-0.112792], 2242 | [28.22315,-16.631069], 2243 | [28.22315,-16.631069], 2244 | [51.501276,-0.14177], 2245 | [45.515068,25.367195], 2246 | [-23.584229,-46.672931], 2247 | [28.22315,-16.631069], 2248 | [12.206817,120.051383], 2249 | [37.769485,-122.46653], 2250 | [36.097383,-98.587188], 2251 | [20.243319,85.843643], 2252 | [23.575727,119.576261], 2253 | [38.888333,-77.127333], 2254 | [56.768613,-3.833477], 2255 | [33.5835,-101.848], 2256 | [39.825833,-86.1865], 2257 | [42.73205,-77.915045], 2258 | [12.206817,120.051383], 2259 | [28.22315,-16.631069], 2260 | [28.22315,-16.631069], 2261 | [55.971204,-2.939186], 2262 | [39.493,-76.367], 2263 | [27.433988,-82.684465], 2264 | [53.365105,-2.288171], 2265 | [47.506197,19.0467], 2266 | [28.22315,-16.631069], 2267 | [39.200304,-76.658906], 2268 | [28.22315,-16.631069], 2269 | [47.048975,-122.904204], 2270 | [53.828664,-0.112792], 2271 | [36.097383,-98.587188], 2272 | [12.206817,120.051383], 2273 | [28.22315,-16.631069], 2274 | [28.22315,-16.631069], 2275 | [28.22315,-16.631069], 2276 | [-23.584229,-46.672931], 2277 | [51.501276,-0.14177], 2278 | [45.515068,25.367195], 2279 | [37.769485,-122.46653], 2280 | [20.243319,85.843643], 2281 | [50.738788,7.011569], 2282 | [47.506197,19.0467], 2283 | [28.22315,-16.631069], 2284 | [41.760684,140.705165], 2285 | [59.685857,30.453066], 2286 | [52.308268,0.636112], 2287 | [38.888,-77.1275], 2288 | [28.22315,-16.631069], 2289 | [1.307002,103.849296], 2290 | [37.769485,-122.46653], 2291 | [43.715294,10.395212], 2292 | [45.513055,-122.623612], 2293 | [42.612855,-78.010859], 2294 | [12.206817,120.051383], 2295 | [12.206817,120.051383], 2296 | [37.741182,-97.263936], 2297 | [39.29055,-76.609596], 2298 | [52.308268,0.636112], 2299 | [37.769485,-122.46653], 2300 | [51.519198,-0.127823], 2301 | [39.75877,-82.840046], 2302 | [43.722482,10.395855], 2303 | [42.586247,-78.017959], 2304 | [12.206817,120.051383], 2305 | [12.206817,120.051383], 2306 | [48.5422,21.4593], 2307 | [25.774598,-80.134577], 2308 | [53.36379,-2.285939], 2309 | [12.206817,120.051383], 2310 | [53.723294,-0.479085], 2311 | [46.33555,-63.292236], 2312 | [39.050666,-94.581667], 2313 | [57.69866,11.932482], 2314 | [28.22315,-16.631069], 2315 | [28.22315,-16.631069], 2316 | [42.177382,-87.824674], 2317 | [46.378438,25.83332], 2318 | [52.308268,0.636112], 2319 | [12.206817,120.051383], 2320 | [37.769485,-122.46653], 2321 | [12.206817,120.051383], 2322 | [42.175247,-87.879939], 2323 | [57.69866,11.932482], 2324 | [37.740589,-97.266941], 2325 | [43.72335,10.394064], 2326 | [47.506197,19.0467], 2327 | [39.493,-76.367], 2328 | [33.583333,-101.8465], 2329 | [42.645955,-71.311912], 2330 | [12.206817,120.051383], 2331 | [12.206817,120.051383], 2332 | [12.206817,120.051383], 2333 | [36.093776,-98.591308], 2334 | [38.899101,-77.028999], 2335 | [12.206817,120.051383], 2336 | [45.512777,-122.615834], 2337 | [45.249996,27.973079], 2338 | [39.762748,-75.12091], 2339 | [52.915833,-1.475833], 2340 | [-7.4038,111.4461], 2341 | [37.739346,-97.265224], 2342 | [6.75785,73.154762], 2343 | [42.701222,-77.938042], 2344 | [12.206817,120.051383], 2345 | [12.206817,120.051383], 2346 | [28.22315,-16.631069], 2347 | [59.447502,-135.322622], 2348 | [53.344044,-6.266369], 2349 | [29.762514,-95.367293], 2350 | [56.768613,-3.833477], 2351 | [37.910313,128.819991], 2352 | [43.769036,11.250246], 2353 | [47.598755,17.526626], 2354 | [52.649729,-7.245483], 2355 | [42.466018,141.16333], 2356 | [52.649729,-7.250976], 2357 | [-6.17,106.68], 2358 | [51.28599,0.801508], 2359 | [51.499753,-0.130119], 2360 | [41.55305,-8.41701], 2361 | [37.910313,128.819991], 2362 | [30.272333,120.093333], 2363 | [43.384833,-70.543667], 2364 | [39.050666,-94.581667], 2365 | [41.368258,2.153685], 2366 | [32.661764,-117.107825], 2367 | [44.667798,10.726046], 2368 | [51.871854,-0.383319], 2369 | [40.681786,-73.972545], 2370 | [19.951002,-99.644451], 2371 | [37.910313,128.819991], 2372 | [48.834837,2.370128], 2373 | [13.74594,100.534451], 2374 | [33.768231,-118.19566], 2375 | [51.01049,-3.110699], 2376 | [37.910313,128.819991], 2377 | [64.880711,-23.985856], 2378 | [41.887071,-87.633937], 2379 | [43.769036,11.250246], 2380 | [51.81253,-0.161859], 2381 | [25.0805,121.567833], 2382 | [13.74594,100.534451], 2383 | [37.696076,-121.906805], 2384 | [51.875219,-0.363492], 2385 | [52.644729,-7.245483], 2386 | [37.910313,128.819991], 2387 | [59.35477,18.037683], 2388 | [43.709578,10.399932], 2389 | [38.627738,-90.199508], 2390 | [43.366,-70.431834], 2391 | [43.709578,10.399932], 2392 | [40.691102,-73.951185], 2393 | [37.910313,128.819991], 2394 | [50.491268,-4.03307], 2395 | [41.55305,-8.41701], 2396 | [37.910313,128.819991], 2397 | [51.874662,-0.367355], 2398 | [41.024463,39.566917], 2399 | [51.875219,-0.363922], 2400 | [35.625556,-78.328611], 2401 | [51.87135,-0.385551], 2402 | [37.910313,128.819991], 2403 | [37.910313,128.819991], 2404 | [39.381161,-120.119962], 2405 | [39.427927,-120.084675], 2406 | [59.3065,18.1105], 2407 | [43.709578,10.399932], 2408 | [37.910313,128.819991], 2409 | [24.685658,121.824147], 2410 | [55.666512,-3.755355], 2411 | [52.690235,1.317157], 2412 | [42.466018,141.16333], 2413 | [42.466018,141.16333], 2414 | [47.601533,17.52388], 2415 | [37.910313,128.819991], 2416 | [39.050833,-94.581667], 2417 | [55.666512,-3.755355], 2418 | [52.643063,-7.250976], 2419 | [37.910313,128.819991], 2420 | [-7.927144,-14.41226], 2421 | [37.707378,-77.556003], 2422 | [51.524388,-0.13624], 2423 | [42.466018,141.16333], 2424 | [10.784702,106.704035], 2425 | [37.910313,128.819991], 2426 | [41.005164,39.716262], 2427 | [41.001289,39.716548], 2428 | [39.050666,-94.581667], 2429 | [42.918595,3.046989], 2430 | [35.4206,137.097516], 2431 | [33.768231,-118.19566], 2432 | [37.910313,128.819991], 2433 | [37.910313,128.819991], 2434 | [51.876437,-0.356712], 2435 | [44.44664,1.44076], 2436 | [37.910313,128.819991], 2437 | [41.767726,140.716495], 2438 | [42.466018,141.16333], 2439 | [43.709578,10.399932], 2440 | [42.466018,141.16333], 2441 | [45.513795,10.732402], 2442 | [23.575736,119.576263], 2443 | [37.910313,128.819991], 2444 | [39.050666,-94.581667], 2445 | [37.910313,128.819991], 2446 | [51.875961,-0.371303], 2447 | [45.513795,10.732402], 2448 | [51.499753,-0.130119], 2449 | [41.918101,-87.633283], 2450 | [42.466018,141.16333], 2451 | [24.685658,121.824147], 2452 | [55.666512,-3.755355], 2453 | [37.910313,128.819991], 2454 | [51.499753,-0.130119], 2455 | [39.451202,-120.182884], 2456 | [52.089421,4.73545], 2457 | [31.373264,121.50164], 2458 | [49.25462,-0.374999], 2459 | [43.7175,-79.3775], 2460 | [45.416843,9.398138], 2461 | [39.929838,-120.843923], 2462 | [39.451202,-120.182884], 2463 | [37.910313,128.819991], 2464 | [25.0805,121.567833], 2465 | [37.910313,128.819991], 2466 | [-23.96169,-46.328098], 2467 | [30.278333,120.1055], 2468 | [52.648062,-7.250976], 2469 | [45.769072,10.812563], 2470 | [23.575727,119.576269], 2471 | [44.98318,-93.265961], 2472 | [52.943647,1.177811], 2473 | [24.685658,121.824147], 2474 | [24.628917,-82.746963], 2475 | [52.308268,0.636112], 2476 | [53.958279,-1.091701], 2477 | [50.978078,0.969371], 2478 | [37.910313,128.819991], 2479 | [60.474722,-1.606112], 2480 | [39.492833,-76.366667], 2481 | [48.595339,1.557472], 2482 | [45.513795,10.732402], 2483 | [23.575705,119.57628], 2484 | [39.492833,-76.367], 2485 | [51.811833,-0.161248], 2486 | [42.466018,141.16333], 2487 | [43.709578,10.399932], 2488 | [25.0805,121.567833], 2489 | [53.562749,9.98713], 2490 | [47.600144,17.527999], 2491 | [37.910313,128.819991], 2492 | [35.546229,139.454569], 2493 | [-26.830775,-48.6296], 2494 | [37.910313,128.819991], 2495 | [40.752806,-73.977175], 2496 | [42.466018,141.16333], 2497 | [39.391236,-120.09237], 2498 | [37.910313,128.819991], 2499 | [52.943672,1.17558], 2500 | [39.050833,-94.581667], 2501 | [37.910313,128.819991], 2502 | [39.050833,-94.581667], 2503 | [42.466018,141.16333], 2504 | [37.910313,128.819991], 2505 | [37.910313,128.819991], 2506 | [50.978078,0.969371], 2507 | [51.485451,-0.133842], 2508 | [51.876967,-0.353965], 2509 | [37.910313,128.819991], 2510 | [37.910313,128.819991], 2511 | [51.499753,-0.130119], 2512 | [43.709578,10.399932], 2513 | [-7.927144,-14.41226], 2514 | [25.043537,121.532506], 2515 | [49.611132,6.132411], 2516 | [45.513795,10.732402], 2517 | [39.492833,-76.367], 2518 | [51.499753,-0.130119], 2519 | [37.910313,128.819991], 2520 | [51.790755,-0.190906], 2521 | [39.450525,-120.183339], 2522 | [-31.938993,115.869264], 2523 | [42.504502,141.157836], 2524 | [41.368258,2.153685], 2525 | [51.499753,-0.130119], 2526 | [41.004969,39.716434], 2527 | [55.686076,37.671775], 2528 | [55.948947,-3.186893], 2529 | [39.3915,-120.092134], 2530 | [43.709578,10.399932], 2531 | [37.910313,128.819991], 2532 | [37.910313,128.819991], 2533 | [43.365833,-70.431834], 2534 | [45.513795,10.732402], 2535 | [19.945273,-99.673805], 2536 | [12.24987,109.196029], 2537 | [42.466018,141.16333], 2538 | [51.511445,-0.139243], 2539 | [40.681786,-73.972545], 2540 | [43.769036,11.250246], 2541 | [53.958279,-1.091701], 2542 | [51.892172,-2.080192], 2543 | [32.472891,34.973137], 2544 | [43.346833,-70.485167], 2545 | [52.516071,13.376979], 2546 | [43.769443,11.250858], 2547 | [55.666512,-3.755355], 2548 | [50.682666,4.369333], 2549 | [25.0805,121.567833], 2550 | [37.910313,128.819991], 2551 | [37.910313,128.819991], 2552 | [43.366,-70.431834], 2553 | [42.466018,141.16333], 2554 | [55.666512,-3.755355], 2555 | [24.775702,121.699051], 2556 | [43.709578,10.399932], 2557 | [37.910313,128.819991], 2558 | [37.910313,128.819991], 2559 | [19.895807,-99.748306], 2560 | [51.514935,-0.145432], 2561 | [39.432061,-120.200462], 2562 | [33.788449,-80.362243], 2563 | [38.627738,-90.199508], 2564 | [65.470165,12.331809], 2565 | [23.57575,119.576252], 2566 | [40.018593,-75.312448], 2567 | [51.499753,-0.130119], 2568 | [55.952479,-3.18861], 2569 | [31.728459,-110.879859], 2570 | [55.666512,-3.755355], 2571 | [55.94223,-3.192], 2572 | [42.504502,141.157836], 2573 | [41.55305,-8.41701], 2574 | [39.432258,-120.199862], 2575 | [51.532611,0.719194], 2576 | [42.77959,-1.453027], 2577 | [30.275167,120.086], 2578 | [37.910313,128.819991], 2579 | [41.671821,-0.902423], 2580 | [37.910313,128.819991], 2581 | [55.666512,-3.755355], 2582 | [43.365833,-70.431834], 2583 | [37.910313,128.819991], 2584 | [37.910313,128.819991], 2585 | [50.922058,0.761489], 2586 | [38.713417,-9.134166], 2587 | [37.910313,128.819991], 2588 | [59.118926,18.019815], 2589 | [37.910313,128.819991], 2590 | [28.291004,-81.362149], 2591 | [52.643063,-7.245483], 2592 | [53.388441,-1.355491], 2593 | [46.194999,9.45125], 2594 | [37.910313,128.819991], 2595 | [56.768613,-3.833477], 2596 | [51.499753,-0.130119], 2597 | [33.396479,-96.961641], 2598 | [51.485678,-0.147478], 2599 | [25.080833,121.568166], 2600 | [45.513795,10.732402], 2601 | [37.910313,128.819991], 2602 | [44.526359,6.40841], 2603 | [43.134423,-70.930287], 2604 | [51.28599,0.801508], 2605 | [50.7111,-1.973387], 2606 | [39.492833,-76.367], 2607 | [37.910313,128.819991], 2608 | [37.910313,128.819991], 2609 | [29.563901,106.583862], 2610 | [27.773633,-15.579986], 2611 | [42.466018,141.16333], 2612 | [55.666512,-3.755355], 2613 | [51.499753,-0.130119], 2614 | [45.452153,9.181716], 2615 | [51.50632,-0.12714], 2616 | [-7.927144,-14.41226], 2617 | [43.365833,-70.431834], 2618 | [52.644729,-7.245483], 2619 | [37.910313,128.819991], 2620 | [43.366,-70.431834], 2621 | [33.788449,-80.362243], 2622 | [24.685658,121.824147], 2623 | [53.942734,-1.086401], 2624 | [37.910313,128.819991], 2625 | [45.513795,10.732402], 2626 | [55.666512,-3.755355], 2627 | [53.958279,-1.091701], 2628 | [60.472851,15.571746], 2629 | [41.05306,28.99389], 2630 | [45.513795,10.732402], 2631 | [41.001289,39.716548], 2632 | [55.950653,-3.164577], 2633 | [37.910313,128.819991], 2634 | [37.910313,128.819991], 2635 | [29.563901,106.583862], 2636 | [59.957803,10.756988], 2637 | [38.70941,0.062656], 2638 | [50.922058,0.761489], 2639 | [37.910313,128.819991], 2640 | [37.910313,128.819991], 2641 | [42.466018,141.16333], 2642 | [39.450425,-120.183367], 2643 | [40.759381,-73.981995], 2644 | [37.910313,128.819991], 2645 | [37.910313,128.819991], 2646 | [50.824318,-0.157091], 2647 | [55.666512,-3.755355], 2648 | [51.875616,-0.361518], 2649 | [41.767726,140.716495], 2650 | [51.28599,0.801508], 2651 | [52.308268,0.636112], 2652 | [42.911418,3.025269], 2653 | [39.050666,-94.581667], 2654 | [51.499753,-0.130119], 2655 | [50.818462,-0.136277], 2656 | [51.499753,-0.130119], 2657 | [26.486553,-80.157966], 2658 | [39.391216,-120.092262], 2659 | [43.499756,-1.541862], 2660 | [33.788449,-80.362243], 2661 | [48.891358,2.344551], 2662 | [37.910313,128.819991], 2663 | [37.910313,128.819991], 2664 | [37.910313,128.819991], 2665 | [44.756334,-93.199308], 2666 | [41.55305,-8.41701], 2667 | [41.767726,140.716495], 2668 | [55.666512,-3.755355], 2669 | [23.575744,119.576252], 2670 | [37.910313,128.819991], 2671 | [39.452488,-120.18187], 2672 | [51.499753,-0.130119], 2673 | [51.499753,-0.130119], 2674 | [43.709578,10.399932], 2675 | [1.415118,103.900301], 2676 | [59.307795,18.030518], 2677 | [42.466018,141.16333], 2678 | [43.709578,10.399932], 2679 | [55.666512,-3.755355], 2680 | [25.0805,121.567833], 2681 | [51.499753,-0.130119], 2682 | [48.797592,-113.657813], 2683 | [37.910313,128.819991], 2684 | [20.854636,-156.663837], 2685 | [37.910313,128.819991], 2686 | [33.788449,-80.362243], 2687 | [24.775702,121.699051], 2688 | [51.876464,-0.359115], 2689 | [41.451118,2.209039], 2690 | [52.308268,0.636112], 2691 | [-7.927144,-14.41226], 2692 | [24.685658,121.824147], 2693 | [51.499753,-0.130119], 2694 | [25.030705,121.554651], 2695 | [51.500782,-0.121965], 2696 | [29.563901,106.583862], 2697 | [37.910313,128.819991], 2698 | [37.910313,128.819991], 2699 | [51.485702,-0.147081], 2700 | [39.050666,-94.581667], 2701 | [43.769036,11.250246], 2702 | [23.4135,121.3393], 2703 | [56.03483,-3.371171], 2704 | [60.473105,15.571746], 2705 | [41.991394,-4.63726], 2706 | [39.432258,-120.199862], 2707 | [45.513795,10.732402], 2708 | [37.910313,128.819991], 2709 | [45.513795,10.732402], 2710 | [37.910313,128.819991], 2711 | [-22.80958,-43.356762], 2712 | [41.767726,140.716495], 2713 | [32.033298,34.75], 2714 | [42.466018,141.16333], 2715 | [37.910313,128.819991], 2716 | [23.575705,119.576275], 2717 | [43.709578,10.399932], 2718 | [37.910313,128.819991], 2719 | [55.950833,-3.164577], 2720 | [42.466018,141.16333], 2721 | [45.513795,10.732402], 2722 | [51.50632,-0.12714], 2723 | [37.910313,128.819991], 2724 | [59.905704,10.74686], 2725 | [37.910313,128.819991], 2726 | [19.972542,-99.561023], 2727 | [43.709578,10.399932], 2728 | [51.871827,-0.383148], 2729 | [51.875245,-0.363836], 2730 | [23.575711,119.576269], 2731 | [24.775702,121.699051], 2732 | [33.788449,-80.362243], 2733 | [52.651395,-7.250976], 2734 | [51.28599,0.801508], 2735 | [52.638063,-7.245483], 2736 | [51.499753,-0.130119], 2737 | [51.563412,-1.230468], 2738 | [39.432061,-120.200462], 2739 | [41.451118,2.209039], 2740 | [41.767726,140.716495], 2741 | [48.865367,2.346995], 2742 | [43.769036,11.250246], 2743 | [43.769443,11.250858], 2744 | [37.910313,128.819991], 2745 | [51.532222,0.716666], 2746 | [37.910313,128.819991], 2747 | [37.910313,128.819991], 2748 | [37.910313,128.819991], 2749 | [37.910313,128.819991], 2750 | [25.138757,121.554851], 2751 | [25.138757,121.554851], 2752 | [45.816627,15.973391], 2753 | [37.910313,128.819991], 2754 | [55.666512,-3.755355], 2755 | [55.666512,-3.755355], 2756 | [51.499753,-0.130119], 2757 | [43.769036,11.250246], 2758 | [41.001289,39.716548], 2759 | [47.55278,7.594749], 2760 | [37.910313,128.819991], 2761 | [37.910313,128.819991], 2762 | [37.910313,128.819991], 2763 | [35.697595,139.583131], 2764 | [44.34779,3.62257], 2765 | [51.499753,-0.130119], 2766 | [30.275167,120.086167], 2767 | [52.122317,6.494407], 2768 | [51.688752,5.187197], 2769 | [45.513795,10.732402], 2770 | [51.877259,-0.351133], 2771 | [43.769036,11.250246], 2772 | [37.910313,128.819991], 2773 | [37.910313,128.819991], 2774 | [37.910313,128.819991], 2775 | [51.811833,-0.161248], 2776 | [52.96444,-2.196682], 2777 | [52.648062,-7.245483], 2778 | [41.368258,2.153685], 2779 | [51.499753,-0.130119], 2780 | [37.167866,-7.944145], 2781 | [45.329736,-122.571272], 2782 | [39.927411,8.400506], 2783 | [35.209871,-106.666426], 2784 | [50.826667,-0.137667], 2785 | [51.499753,-0.130119], 2786 | [51.53275,0.7195], 2787 | [51.499753,-0.130119], 2788 | [45.071247,7.685108], 2789 | [38.952358,-90.193322], 2790 | [32.6494,-16.944223], 2791 | [45.513795,10.732402], 2792 | [39.3915,-120.092134], 2793 | [37.910313,128.819991], 2794 | [40.088242,-83.018199], 2795 | [51.499753,-0.130119], 2796 | [39.432258,-120.199862], 2797 | [41.001289,39.716548], 2798 | [41.368258,2.153685], 2799 | [45.702582,-0.328903], 2800 | [43.709578,10.399932], 2801 | [43.709578,10.399932], 2802 | [37.910313,128.819991], 2803 | [30.278333,120.115167], 2804 | [40.339258,-74.674576], 2805 | [40.752212,-73.977612], 2806 | [41.019348,39.56232], 2807 | [45.513795,10.732402], 2808 | [31.322509,-113.534957], 2809 | [25.138757,121.554851], 2810 | [52.524909,-1.46631], 2811 | [40.738528,-73.985749], 2812 | [39.492833,-76.366667], 2813 | [42.633177,-70.762424], 2814 | [43.482445,-1.560745], 2815 | [55.754264,37.620191], 2816 | [37.910313,128.819991], 2817 | [50.922058,0.761489], 2818 | [50.978078,0.969371], 2819 | [51.499753,-0.130119], 2820 | [44.526359,6.40841], 2821 | [-7.927144,-14.41226], 2822 | [45.513795,10.732402], 2823 | [43.326294,-1.999473], 2824 | [51.499753,-0.130119], 2825 | [37.910313,128.819991], 2826 | [50.922058,0.761489], 2827 | [39.445369,-120.187531], 2828 | [40.64,-111.982833], 2829 | [42.504502,141.157836], 2830 | [50.956074,-0.535293], 2831 | [46.301168,7.707973], 2832 | [45.190818,9.150449], 2833 | [42.983949,-76.177997], 2834 | [42.504502,141.157836], 2835 | [13.633975,25.345458], 2836 | [47.987164,-66.781597], 2837 | [37.43419,-122.17606], 2838 | ["0.000000","0.000000"], 2839 | [46.057389,-84.67884], 2840 | [37.203663,128.00473], 2841 | [20.68053,-156.442823], 2842 | [53.479477,-2.218894], 2843 | ["0.000000","0.000000"], 2844 | [29.751997,-95.357773], 2845 | [29.751997,-95.357773], 2846 | [37.910313,128.819991], 2847 | [30.75033,120.484663], 2848 | [23.575716,119.57628], 2849 | [30.749855,120.482597], 2850 | [40.753986,-73.984208], 2851 | [42.548539,-88.571401], 2852 | [30.753777,120.47438], 2853 | [37.910313,128.819991], 2854 | [37.910313,128.819991], 2855 | [43.769311,11.256115], 2856 | [42.504502,141.157836], 2857 | [49.199681,-2.020196], 2858 | [31.617263,-7.988696], 2859 | [45.456236,8.462567], 2860 | [41.412189,2.131267], 2861 | [53.479331,-2.218894], 2862 | [44.852765,1.541862], 2863 | [43.700702,-73.987013], 2864 | [37.910313,128.819991], 2865 | [59.685779,30.454112], 2866 | [39.050833,-94.581667], 2867 | [41.615386,-83.693878], 2868 | [37.910313,128.819991], 2869 | [45.861579,-123.197212], 2870 | [37.910313,128.819991], 2871 | [30.752127,120.476477], 2872 | [30.75215,120.476477], 2873 | [37.203663,128.00473], 2874 | [29.751997,-95.357773], 2875 | [47.727666,23.51], 2876 | [49.199539,-2.01952], 2877 | [30.751994,120.477097], 2878 | [27.768734,-82.651562], 2879 | [59.204821,10.943713], 2880 | [59.920101,10.753917], 2881 | [47.987164,-66.781597], 2882 | [40.753986,-73.984208], 2883 | [48.854945,2.286615], 2884 | [36.637759,-81.514778], 2885 | [47.426391,9.373709], 2886 | [29.751997,-95.357773], 2887 | [47.987164,-66.781597], 2888 | [47.597829,17.532119], 2889 | [23.575738,119.57628], 2890 | [47.603848,17.525253], 2891 | [51.3422,-0.476226], 2892 | [47.727333,23.5105], 2893 | [28.404537,-13.878822], 2894 | [27.768734,-82.651562], 2895 | [27.768734,-82.651562], 2896 | [37.204333,128.004666], 2897 | [27.768734,-82.651562], 2898 | [37.910313,128.819991], 2899 | [42.529911,-88.599532], 2900 | [27.768734,-82.651562], 2901 | [43.718636,-7.707939], 2902 | [53.479426,-2.219603], 2903 | [53.480071,-2.248377], 2904 | [30.751736,120.476738], 2905 | [34.04922,-118.239696], 2906 | [52.808679,7.020705], 2907 | [42.398666,-71.033334], 2908 | [44.060399,12.566159], 2909 | [41.205756,-83.902126], 2910 | [53.483283,-2.202587], 2911 | [30.751191,120.4793], 2912 | [30.751652,120.476844], 2913 | [47.987164,-66.781597], 2914 | [60.557911,9.009046], 2915 | [36.1208,-115.172393], 2916 | [39.233981,25.859413], 2917 | [51.228817,-2.319831], 2918 | [51.22756,1.209663], 2919 | [43.718388,-7.707853], 2920 | [50.870653,1.869735], 2921 | [30.75163,120.477538], 2922 | [43.346833,-70.485167], 2923 | [37.203663,128.00473], 2924 | [37.910313,128.819991], 2925 | [15.269778,145.826511], 2926 | [37.910313,128.819991], 2927 | [37.910313,128.819991], 2928 | [37.910313,128.819991], 2929 | [30.753508,120.474258], 2930 | [45.226017,11.660356], 2931 | [37.910313,128.819991], 2932 | [13.633975,25.345458], 2933 | [20.68053,-156.442823], 2934 | [42.504502,141.157836], 2935 | [50.870328,1.870422], 2936 | [42.504502,141.157836], 2937 | [-13.5165,-71.978667], 2938 | [37.203663,128.00473], 2939 | [51.3422,-0.476226], 2940 | [43.347333,-70.48], 2941 | [45.228344,11.651644], 2942 | [29.751997,-95.357773], 2943 | [13.633975,25.345458], 2944 | [45.541521,-122.661952], 2945 | [47.7255,23.510666], 2946 | [59.336814,18.090813], 2947 | [53.479414,-2.225482], 2948 | [30.750402,120.481338], 2949 | [19.420167,-102.064], 2950 | [37.910313,128.819991], 2951 | [38.132126,14.743309], 2952 | [37.910313,128.819991], 2953 | [37.910313,128.819991], 2954 | [42.54382,-88.583568], 2955 | [39.448691,-120.183178], 2956 | [13.412429,103.864603], 2957 | [39.448752,-120.183453], 2958 | [52.638525,-1.685881], 2959 | [27.768734,-82.651562], 2960 | [13.633975,25.345458], 2961 | [3.158208,101.711493], 2962 | [29.934139,-90.364517], 2963 | [30.751536,120.47718], 2964 | [43.779971,11.258347], 2965 | [27.768734,-82.651562], 2966 | [28.655947,-81.200637], 2967 | [54.869099,-1.689147], 2968 | [30.751513,120.477469], 2969 | [42.504502,141.157836], 2970 | [45.226017,11.660356], 2971 | [47.727333,23.5105], 2972 | [43.769036,11.250246], 2973 | [43.463558,11.877639], 2974 | [49.279501,-123.114627], 2975 | [30.751525,120.477197], 2976 | [53.479567,-2.251982], 2977 | [37.910313,128.819991], 2978 | [40.906718,9.101669], 2979 | [40.753986,-73.984208], 2980 | [43.346666,-70.484667], 2981 | [43.701074,-73.987228], 2982 | [58.954166,17.5724], 2983 | [30.750852,120.480058], 2984 | [40.681786,-73.972545], 2985 | [47.987164,-66.781597], 2986 | [42.398666,-71.033167], 2987 | [45.228344,11.651644], 2988 | [52.028548,4.700517], 2989 | [51.3422,-0.476226], 2990 | [30.749552,120.483663], 2991 | [30.753963,120.474372], 2992 | [30.753508,120.474258], 2993 | [55.97447,-3.301391], 2994 | [40.753986,-73.984208], 2995 | [51.3422,-0.476226], 2996 | [43.346833,-70.485167], 2997 | [54.965519,-2.039766], 2998 | [52.372835,4.942624], 2999 | [37.203663,128.00473], 3000 | [47.987164,-66.781597], 3001 | [37.910313,128.819991] 3002 | ]; -------------------------------------------------------------------------------- /examples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Three.js Layer - Google Maps API 7 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 132 | 133 | 134 | 135 | 136 |
137 | 138 | 139 | -------------------------------------------------------------------------------- /examples/styles.js: -------------------------------------------------------------------------------- 1 | var styles = [ 2 | { 3 | "stylers": [ 4 | { "invert_lightness": true }, 5 | { "saturation": -100 }, 6 | { "visibility": "on" } 7 | ] 8 | },{ 9 | "elementType": "labels", 10 | "stylers": [ 11 | { "visibility": "off" } 12 | ] 13 | },{ 14 | "featureType": "landscape", 15 | "stylers": [ 16 | { "color": "#000000" } 17 | ] 18 | },{ 19 | "featureType": "road", 20 | "stylers": [ 21 | { "visibility": "off" } 22 | ] 23 | },{ 24 | "featureType": "poi", 25 | "stylers": [ 26 | { "visibility": "off" } 27 | ] 28 | },{ 29 | "featureType": "administrative", 30 | "stylers": [ 31 | { "visibility": "off" } 32 | ] 33 | },{ 34 | "featureType": "administrative.country", 35 | "elementType": "geometry", 36 | "stylers": [ 37 | { "visibility": "on" } 38 | ] 39 | } 40 | ]; -------------------------------------------------------------------------------- /lib/dat.gui.js: -------------------------------------------------------------------------------- 1 | /** 2 | * dat-gui JavaScript Controller Library 3 | * http://code.google.com/p/dat-gui 4 | * 5 | * Copyright 2011 Data Arts Team, Google Creative Lab 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | */ 13 | 14 | /** @namespace */ 15 | var dat = dat || {}; 16 | 17 | /** @namespace */ 18 | dat.gui = dat.gui || {}; 19 | 20 | /** @namespace */ 21 | dat.utils = dat.utils || {}; 22 | 23 | /** @namespace */ 24 | dat.controllers = dat.controllers || {}; 25 | 26 | /** @namespace */ 27 | dat.dom = dat.dom || {}; 28 | 29 | /** @namespace */ 30 | dat.color = dat.color || {}; 31 | 32 | dat.utils.css = (function () { 33 | return { 34 | load: function (url, doc) { 35 | doc = doc || document; 36 | var link = doc.createElement('link'); 37 | link.type = 'text/css'; 38 | link.rel = 'stylesheet'; 39 | link.href = url; 40 | doc.getElementsByTagName('head')[0].appendChild(link); 41 | }, 42 | inject: function(css, doc) { 43 | doc = doc || document; 44 | var injected = document.createElement('style'); 45 | injected.type = 'text/css'; 46 | injected.innerHTML = css; 47 | doc.getElementsByTagName('head')[0].appendChild(injected); 48 | } 49 | } 50 | })(); 51 | 52 | 53 | dat.utils.common = (function () { 54 | 55 | var ARR_EACH = Array.prototype.forEach; 56 | var ARR_SLICE = Array.prototype.slice; 57 | 58 | /** 59 | * Band-aid methods for things that should be a lot easier in JavaScript. 60 | * Implementation and structure inspired by underscore.js 61 | * http://documentcloud.github.com/underscore/ 62 | */ 63 | 64 | return { 65 | 66 | BREAK: {}, 67 | 68 | extend: function(target) { 69 | 70 | this.each(ARR_SLICE.call(arguments, 1), function(obj) { 71 | 72 | for (var key in obj) 73 | if (!this.isUndefined(obj[key])) 74 | target[key] = obj[key]; 75 | 76 | }, this); 77 | 78 | return target; 79 | 80 | }, 81 | 82 | defaults: function(target) { 83 | 84 | this.each(ARR_SLICE.call(arguments, 1), function(obj) { 85 | 86 | for (var key in obj) 87 | if (this.isUndefined(target[key])) 88 | target[key] = obj[key]; 89 | 90 | }, this); 91 | 92 | return target; 93 | 94 | }, 95 | 96 | compose: function() { 97 | var toCall = ARR_SLICE.call(arguments); 98 | return function() { 99 | var args = ARR_SLICE.call(arguments); 100 | for (var i = toCall.length -1; i >= 0; i--) { 101 | args = [toCall[i].apply(this, args)]; 102 | } 103 | return args[0]; 104 | } 105 | }, 106 | 107 | each: function(obj, itr, scope) { 108 | 109 | 110 | if (ARR_EACH && obj.forEach === ARR_EACH) { 111 | 112 | obj.forEach(itr, scope); 113 | 114 | } else if (obj.length === obj.length + 0) { // Is number but not NaN 115 | 116 | for (var key = 0, l = obj.length; key < l; key++) 117 | if (key in obj && itr.call(scope, obj[key], key) === this.BREAK) 118 | return; 119 | 120 | } else { 121 | 122 | for (var key in obj) 123 | if (itr.call(scope, obj[key], key) === this.BREAK) 124 | return; 125 | 126 | } 127 | 128 | }, 129 | 130 | defer: function(fnc) { 131 | setTimeout(fnc, 0); 132 | }, 133 | 134 | toArray: function(obj) { 135 | if (obj.toArray) return obj.toArray(); 136 | return ARR_SLICE.call(obj); 137 | }, 138 | 139 | isUndefined: function(obj) { 140 | return obj === undefined; 141 | }, 142 | 143 | isNull: function(obj) { 144 | return obj === null; 145 | }, 146 | 147 | isNaN: function(obj) { 148 | return obj !== obj; 149 | }, 150 | 151 | isArray: Array.isArray || function(obj) { 152 | return obj.constructor === Array; 153 | }, 154 | 155 | isObject: function(obj) { 156 | return obj === Object(obj); 157 | }, 158 | 159 | isNumber: function(obj) { 160 | return obj === obj+0; 161 | }, 162 | 163 | isString: function(obj) { 164 | return obj === obj+''; 165 | }, 166 | 167 | isBoolean: function(obj) { 168 | return obj === false || obj === true; 169 | }, 170 | 171 | isFunction: function(obj) { 172 | return Object.prototype.toString.call(obj) === '[object Function]'; 173 | } 174 | 175 | }; 176 | 177 | })(); 178 | 179 | 180 | dat.controllers.Controller = (function (common) { 181 | 182 | /** 183 | * @class An "abstract" class that represents a given property of an object. 184 | * 185 | * @param {Object} object The object to be manipulated 186 | * @param {string} property The name of the property to be manipulated 187 | * 188 | * @member dat.controllers 189 | */ 190 | var Controller = function(object, property) { 191 | 192 | this.initialValue = object[property]; 193 | 194 | /** 195 | * Those who extend this class will put their DOM elements in here. 196 | * @type {DOMElement} 197 | */ 198 | this.domElement = document.createElement('div'); 199 | 200 | /** 201 | * The object to manipulate 202 | * @type {Object} 203 | */ 204 | this.object = object; 205 | 206 | /** 207 | * The name of the property to manipulate 208 | * @type {String} 209 | */ 210 | this.property = property; 211 | 212 | /** 213 | * The function to be called on change. 214 | * @type {Function} 215 | * @ignore 216 | */ 217 | this.__onChange = undefined; 218 | 219 | /** 220 | * The function to be called on finishing change. 221 | * @type {Function} 222 | * @ignore 223 | */ 224 | this.__onFinishChange = undefined; 225 | 226 | }; 227 | 228 | common.extend( 229 | 230 | Controller.prototype, 231 | 232 | /** @lends dat.controllers.Controller.prototype */ 233 | { 234 | 235 | /** 236 | * Specify that a function fire every time someone changes the value with 237 | * this Controller. 238 | * 239 | * @param {Function} fnc This function will be called whenever the value 240 | * is modified via this Controller. 241 | * @returns {dat.controllers.Controller} this 242 | */ 243 | onChange: function(fnc) { 244 | this.__onChange = fnc; 245 | return this; 246 | }, 247 | 248 | /** 249 | * Specify that a function fire every time someone "finishes" changing 250 | * the value wih this Controller. Useful for values that change 251 | * incrementally like numbers or strings. 252 | * 253 | * @param {Function} fnc This function will be called whenever 254 | * someone "finishes" changing the value via this Controller. 255 | * @returns {dat.controllers.Controller} this 256 | */ 257 | onFinishChange: function(fnc) { 258 | this.__onFinishChange = fnc; 259 | return this; 260 | }, 261 | 262 | /** 263 | * Change the value of object[property] 264 | * 265 | * @param {Object} newValue The new value of object[property] 266 | */ 267 | setValue: function(newValue) { 268 | this.object[this.property] = newValue; 269 | if (this.__onChange) { 270 | this.__onChange.call(this, newValue); 271 | } 272 | this.updateDisplay(); 273 | return this; 274 | }, 275 | 276 | /** 277 | * Gets the value of object[property] 278 | * 279 | * @returns {Object} The current value of object[property] 280 | */ 281 | getValue: function() { 282 | return this.object[this.property]; 283 | }, 284 | 285 | /** 286 | * Refreshes the visual display of a Controller in order to keep sync 287 | * with the object's current value. 288 | * @returns {dat.controllers.Controller} this 289 | */ 290 | updateDisplay: function() { 291 | return this; 292 | }, 293 | 294 | /** 295 | * @returns {Boolean} true if the value has deviated from initialValue 296 | */ 297 | isModified: function() { 298 | return this.initialValue !== this.getValue() 299 | } 300 | 301 | } 302 | 303 | ); 304 | 305 | return Controller; 306 | 307 | 308 | })(dat.utils.common); 309 | 310 | 311 | dat.dom.dom = (function (common) { 312 | 313 | var EVENT_MAP = { 314 | 'HTMLEvents': ['change'], 315 | 'MouseEvents': ['click','mousemove','mousedown','mouseup', 'mouseover'], 316 | 'KeyboardEvents': ['keydown'] 317 | }; 318 | 319 | var EVENT_MAP_INV = {}; 320 | common.each(EVENT_MAP, function(v, k) { 321 | common.each(v, function(e) { 322 | EVENT_MAP_INV[e] = k; 323 | }); 324 | }); 325 | 326 | var CSS_VALUE_PIXELS = /(\d+(\.\d+)?)px/; 327 | 328 | function cssValueToPixels(val) { 329 | 330 | if (val === '0' || common.isUndefined(val)) return 0; 331 | 332 | var match = val.match(CSS_VALUE_PIXELS); 333 | 334 | if (!common.isNull(match)) { 335 | return parseFloat(match[1]); 336 | } 337 | 338 | // TODO ...ems? %? 339 | 340 | return 0; 341 | 342 | } 343 | 344 | /** 345 | * @namespace 346 | * @member dat.dom 347 | */ 348 | var dom = { 349 | 350 | /** 351 | * 352 | * @param elem 353 | * @param selectable 354 | */ 355 | makeSelectable: function(elem, selectable) { 356 | 357 | if (elem === undefined || elem.style === undefined) return; 358 | 359 | elem.onselectstart = selectable ? function() { 360 | return false; 361 | } : function() { 362 | }; 363 | 364 | elem.style.MozUserSelect = selectable ? 'auto' : 'none'; 365 | elem.style.KhtmlUserSelect = selectable ? 'auto' : 'none'; 366 | elem.unselectable = selectable ? 'on' : 'off'; 367 | 368 | }, 369 | 370 | /** 371 | * 372 | * @param elem 373 | * @param horizontal 374 | * @param vertical 375 | */ 376 | makeFullscreen: function(elem, horizontal, vertical) { 377 | 378 | if (common.isUndefined(horizontal)) horizontal = true; 379 | if (common.isUndefined(vertical)) vertical = true; 380 | 381 | elem.style.position = 'absolute'; 382 | 383 | if (horizontal) { 384 | elem.style.left = 0; 385 | elem.style.right = 0; 386 | } 387 | if (vertical) { 388 | elem.style.top = 0; 389 | elem.style.bottom = 0; 390 | } 391 | 392 | }, 393 | 394 | /** 395 | * 396 | * @param elem 397 | * @param eventType 398 | * @param params 399 | */ 400 | fakeEvent: function(elem, eventType, params, aux) { 401 | params = params || {}; 402 | var className = EVENT_MAP_INV[eventType]; 403 | if (!className) { 404 | throw new Error('Event type ' + eventType + ' not supported.'); 405 | } 406 | var evt = document.createEvent(className); 407 | switch (className) { 408 | case 'MouseEvents': 409 | var clientX = params.x || params.clientX || 0; 410 | var clientY = params.y || params.clientY || 0; 411 | evt.initMouseEvent(eventType, params.bubbles || false, 412 | params.cancelable || true, window, params.clickCount || 1, 413 | 0, //screen X 414 | 0, //screen Y 415 | clientX, //client X 416 | clientY, //client Y 417 | false, false, false, false, 0, null); 418 | break; 419 | case 'KeyboardEvents': 420 | var init = evt.initKeyboardEvent || evt.initKeyEvent; // webkit || moz 421 | common.defaults(params, { 422 | cancelable: true, 423 | ctrlKey: false, 424 | altKey: false, 425 | shiftKey: false, 426 | metaKey: false, 427 | keyCode: undefined, 428 | charCode: undefined 429 | }); 430 | init(eventType, params.bubbles || false, 431 | params.cancelable, window, 432 | params.ctrlKey, params.altKey, 433 | params.shiftKey, params.metaKey, 434 | params.keyCode, params.charCode); 435 | break; 436 | default: 437 | evt.initEvent(eventType, params.bubbles || false, 438 | params.cancelable || true); 439 | break; 440 | } 441 | common.defaults(evt, aux); 442 | elem.dispatchEvent(evt); 443 | }, 444 | 445 | /** 446 | * 447 | * @param elem 448 | * @param event 449 | * @param func 450 | * @param bool 451 | */ 452 | bind: function(elem, event, func, bool) { 453 | bool = bool || false; 454 | if (elem.addEventListener) 455 | elem.addEventListener(event, func, bool); 456 | else if (elem.attachEvent) 457 | elem.attachEvent('on' + event, func); 458 | return dom; 459 | }, 460 | 461 | /** 462 | * 463 | * @param elem 464 | * @param event 465 | * @param func 466 | * @param bool 467 | */ 468 | unbind: function(elem, event, func, bool) { 469 | bool = bool || false; 470 | if (elem.removeEventListener) 471 | elem.removeEventListener(event, func, bool); 472 | else if (elem.detachEvent) 473 | elem.detachEvent('on' + event, func); 474 | return dom; 475 | }, 476 | 477 | /** 478 | * 479 | * @param elem 480 | * @param className 481 | */ 482 | addClass: function(elem, className) { 483 | if (elem.className === undefined) { 484 | elem.className = className; 485 | } else if (elem.className !== className) { 486 | var classes = elem.className.split(/ +/); 487 | if (classes.indexOf(className) == -1) { 488 | classes.push(className); 489 | elem.className = classes.join(' ').replace(/^\s+/, '').replace(/\s+$/, ''); 490 | } 491 | } 492 | return dom; 493 | }, 494 | 495 | /** 496 | * 497 | * @param elem 498 | * @param className 499 | */ 500 | removeClass: function(elem, className) { 501 | if (className) { 502 | if (elem.className === undefined) { 503 | // elem.className = className; 504 | } else if (elem.className === className) { 505 | elem.removeAttribute('class'); 506 | } else { 507 | var classes = elem.className.split(/ +/); 508 | var index = classes.indexOf(className); 509 | if (index != -1) { 510 | classes.splice(index, 1); 511 | elem.className = classes.join(' '); 512 | } 513 | } 514 | } else { 515 | elem.className = undefined; 516 | } 517 | return dom; 518 | }, 519 | 520 | hasClass: function(elem, className) { 521 | return new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)').test(elem.className) || false; 522 | }, 523 | 524 | /** 525 | * 526 | * @param elem 527 | */ 528 | getWidth: function(elem) { 529 | 530 | var style = getComputedStyle(elem); 531 | 532 | return cssValueToPixels(style['border-left-width']) + 533 | cssValueToPixels(style['border-right-width']) + 534 | cssValueToPixels(style['padding-left']) + 535 | cssValueToPixels(style['padding-right']) + 536 | cssValueToPixels(style['width']); 537 | }, 538 | 539 | /** 540 | * 541 | * @param elem 542 | */ 543 | getHeight: function(elem) { 544 | 545 | var style = getComputedStyle(elem); 546 | 547 | return cssValueToPixels(style['border-top-width']) + 548 | cssValueToPixels(style['border-bottom-width']) + 549 | cssValueToPixels(style['padding-top']) + 550 | cssValueToPixels(style['padding-bottom']) + 551 | cssValueToPixels(style['height']); 552 | }, 553 | 554 | /** 555 | * 556 | * @param elem 557 | */ 558 | getOffset: function(elem) { 559 | var offset = {left: 0, top:0}; 560 | if (elem.offsetParent) { 561 | do { 562 | offset.left += elem.offsetLeft; 563 | offset.top += elem.offsetTop; 564 | } while (elem = elem.offsetParent); 565 | } 566 | return offset; 567 | }, 568 | 569 | // http://stackoverflow.com/posts/2684561/revisions 570 | /** 571 | * 572 | * @param elem 573 | */ 574 | isActive: function(elem) { 575 | return elem === document.activeElement && ( elem.type || elem.href ); 576 | } 577 | 578 | }; 579 | 580 | return dom; 581 | 582 | })(dat.utils.common); 583 | 584 | 585 | dat.controllers.OptionController = (function (Controller, dom, common) { 586 | 587 | /** 588 | * @class Provides a select input to alter the property of an object, using a 589 | * list of accepted values. 590 | * 591 | * @extends dat.controllers.Controller 592 | * 593 | * @param {Object} object The object to be manipulated 594 | * @param {string} property The name of the property to be manipulated 595 | * @param {Object|string[]} options A map of labels to acceptable values, or 596 | * a list of acceptable string values. 597 | * 598 | * @member dat.controllers 599 | */ 600 | var OptionController = function(object, property, options) { 601 | 602 | OptionController.superclass.call(this, object, property); 603 | 604 | var _this = this; 605 | 606 | /** 607 | * The drop down menu 608 | * @ignore 609 | */ 610 | this.__select = document.createElement('select'); 611 | 612 | if (common.isArray(options)) { 613 | var map = {}; 614 | common.each(options, function(element) { 615 | map[element] = element; 616 | }); 617 | options = map; 618 | } 619 | 620 | common.each(options, function(value, key) { 621 | 622 | var opt = document.createElement('option'); 623 | opt.innerHTML = key; 624 | opt.setAttribute('value', value); 625 | _this.__select.appendChild(opt); 626 | 627 | }); 628 | 629 | // Acknowledge original value 630 | this.updateDisplay(); 631 | 632 | dom.bind(this.__select, 'change', function() { 633 | var desiredValue = this.options[this.selectedIndex].value; 634 | _this.setValue(desiredValue); 635 | }); 636 | 637 | this.domElement.appendChild(this.__select); 638 | 639 | }; 640 | 641 | OptionController.superclass = Controller; 642 | 643 | common.extend( 644 | 645 | OptionController.prototype, 646 | Controller.prototype, 647 | 648 | { 649 | 650 | setValue: function(v) { 651 | var toReturn = OptionController.superclass.prototype.setValue.call(this, v); 652 | if (this.__onFinishChange) { 653 | this.__onFinishChange.call(this, this.getValue()); 654 | } 655 | return toReturn; 656 | }, 657 | 658 | updateDisplay: function() { 659 | this.__select.value = this.getValue(); 660 | return OptionController.superclass.prototype.updateDisplay.call(this); 661 | } 662 | 663 | } 664 | 665 | ); 666 | 667 | return OptionController; 668 | 669 | })(dat.controllers.Controller, 670 | dat.dom.dom, 671 | dat.utils.common); 672 | 673 | 674 | dat.controllers.NumberController = (function (Controller, common) { 675 | 676 | /** 677 | * @class Represents a given property of an object that is a number. 678 | * 679 | * @extends dat.controllers.Controller 680 | * 681 | * @param {Object} object The object to be manipulated 682 | * @param {string} property The name of the property to be manipulated 683 | * @param {Object} [params] Optional parameters 684 | * @param {Number} [params.min] Minimum allowed value 685 | * @param {Number} [params.max] Maximum allowed value 686 | * @param {Number} [params.step] Increment by which to change value 687 | * 688 | * @member dat.controllers 689 | */ 690 | var NumberController = function(object, property, params) { 691 | 692 | NumberController.superclass.call(this, object, property); 693 | 694 | params = params || {}; 695 | 696 | this.__min = params.min; 697 | this.__max = params.max; 698 | this.__step = params.step; 699 | 700 | if (common.isUndefined(this.__step)) { 701 | 702 | if (this.initialValue == 0) { 703 | this.__impliedStep = 1; // What are we, psychics? 704 | } else { 705 | // Hey Doug, check this out. 706 | this.__impliedStep = Math.pow(10, Math.floor(Math.log(this.initialValue)/Math.LN10))/10; 707 | } 708 | 709 | } else { 710 | 711 | this.__impliedStep = this.__step; 712 | 713 | } 714 | 715 | this.__precision = numDecimals(this.__impliedStep); 716 | 717 | 718 | }; 719 | 720 | NumberController.superclass = Controller; 721 | 722 | common.extend( 723 | 724 | NumberController.prototype, 725 | Controller.prototype, 726 | 727 | /** @lends dat.controllers.NumberController.prototype */ 728 | { 729 | 730 | setValue: function(v) { 731 | 732 | if (this.__min !== undefined && v < this.__min) { 733 | v = this.__min; 734 | } else if (this.__max !== undefined && v > this.__max) { 735 | v = this.__max; 736 | } 737 | 738 | if (this.__step !== undefined && v % this.__step != 0) { 739 | v = Math.round(v / this.__step) * this.__step; 740 | } 741 | 742 | return NumberController.superclass.prototype.setValue.call(this, v); 743 | 744 | }, 745 | 746 | /** 747 | * Specify a minimum value for object[property]. 748 | * 749 | * @param {Number} minValue The minimum value for 750 | * object[property] 751 | * @returns {dat.controllers.NumberController} this 752 | */ 753 | min: function(v) { 754 | this.__min = v; 755 | return this; 756 | }, 757 | 758 | /** 759 | * Specify a maximum value for object[property]. 760 | * 761 | * @param {Number} maxValue The maximum value for 762 | * object[property] 763 | * @returns {dat.controllers.NumberController} this 764 | */ 765 | max: function(v) { 766 | this.__max = v; 767 | return this; 768 | }, 769 | 770 | /** 771 | * Specify a step value that dat.controllers.NumberController 772 | * increments by. 773 | * 774 | * @param {Number} stepValue The step value for 775 | * dat.controllers.NumberController 776 | * @default if minimum and maximum specified increment is 1% of the 777 | * difference otherwise stepValue is 1 778 | * @returns {dat.controllers.NumberController} this 779 | */ 780 | step: function(v) { 781 | this.__step = v; 782 | return this; 783 | } 784 | 785 | } 786 | 787 | ); 788 | 789 | function numDecimals(x) { 790 | x = x.toString(); 791 | if (x.indexOf('.') > -1) { 792 | return x.length - x.indexOf('.') - 1; 793 | } else { 794 | return 0; 795 | } 796 | } 797 | 798 | return NumberController; 799 | 800 | })(dat.controllers.Controller, 801 | dat.utils.common); 802 | 803 | 804 | dat.controllers.NumberControllerBox = (function (NumberController, dom, common) { 805 | 806 | /** 807 | * @class Represents a given property of an object that is a number and 808 | * provides an input element with which to manipulate it. 809 | * 810 | * @extends dat.controllers.Controller 811 | * @extends dat.controllers.NumberController 812 | * 813 | * @param {Object} object The object to be manipulated 814 | * @param {string} property The name of the property to be manipulated 815 | * @param {Object} [params] Optional parameters 816 | * @param {Number} [params.min] Minimum allowed value 817 | * @param {Number} [params.max] Maximum allowed value 818 | * @param {Number} [params.step] Increment by which to change value 819 | * 820 | * @member dat.controllers 821 | */ 822 | var NumberControllerBox = function(object, property, params) { 823 | 824 | this.__truncationSuspended = false; 825 | 826 | NumberControllerBox.superclass.call(this, object, property, params); 827 | 828 | var _this = this; 829 | 830 | /** 831 | * {Number} Previous mouse y position 832 | * @ignore 833 | */ 834 | var prev_y; 835 | 836 | this.__input = document.createElement('input'); 837 | this.__input.setAttribute('type', 'text'); 838 | 839 | // Makes it so manually specified values are not truncated. 840 | 841 | dom.bind(this.__input, 'change', onChange); 842 | dom.bind(this.__input, 'blur', onBlur); 843 | dom.bind(this.__input, 'mousedown', onMouseDown); 844 | dom.bind(this.__input, 'keydown', function(e) { 845 | 846 | // When pressing entire, you can be as precise as you want. 847 | if (e.keyCode === 13) { 848 | _this.__truncationSuspended = true; 849 | this.blur(); 850 | _this.__truncationSuspended = false; 851 | } 852 | 853 | }); 854 | 855 | function onChange() { 856 | var attempted = parseFloat(_this.__input.value); 857 | if (!common.isNaN(attempted)) _this.setValue(attempted); 858 | } 859 | 860 | function onBlur() { 861 | onChange(); 862 | if (_this.__onFinishChange) { 863 | _this.__onFinishChange.call(_this, _this.getValue()); 864 | } 865 | } 866 | 867 | function onMouseDown(e) { 868 | dom.bind(window, 'mousemove', onMouseDrag); 869 | dom.bind(window, 'mouseup', onMouseUp); 870 | prev_y = e.clientY; 871 | } 872 | 873 | function onMouseDrag(e) { 874 | 875 | var diff = prev_y - e.clientY; 876 | _this.setValue(_this.getValue() + diff * _this.__impliedStep); 877 | 878 | prev_y = e.clientY; 879 | 880 | } 881 | 882 | function onMouseUp() { 883 | dom.unbind(window, 'mousemove', onMouseDrag); 884 | dom.unbind(window, 'mouseup', onMouseUp); 885 | } 886 | 887 | this.updateDisplay(); 888 | 889 | this.domElement.appendChild(this.__input); 890 | 891 | }; 892 | 893 | NumberControllerBox.superclass = NumberController; 894 | 895 | common.extend( 896 | 897 | NumberControllerBox.prototype, 898 | NumberController.prototype, 899 | 900 | { 901 | 902 | updateDisplay: function() { 903 | 904 | this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision); 905 | return NumberControllerBox.superclass.prototype.updateDisplay.call(this); 906 | } 907 | 908 | } 909 | 910 | ); 911 | 912 | function roundToDecimal(value, decimals) { 913 | var tenTo = Math.pow(10, decimals); 914 | return Math.round(value * tenTo) / tenTo; 915 | } 916 | 917 | return NumberControllerBox; 918 | 919 | })(dat.controllers.NumberController, 920 | dat.dom.dom, 921 | dat.utils.common); 922 | 923 | 924 | dat.controllers.NumberControllerSlider = (function (NumberController, dom, css, common, styleSheet) { 925 | 926 | /** 927 | * @class Represents a given property of an object that is a number, contains 928 | * a minimum and maximum, and provides a slider element with which to 929 | * manipulate it. It should be noted that the slider element is made up of 930 | * <div> tags, not the html5 931 | * <slider> element. 932 | * 933 | * @extends dat.controllers.Controller 934 | * @extends dat.controllers.NumberController 935 | * 936 | * @param {Object} object The object to be manipulated 937 | * @param {string} property The name of the property to be manipulated 938 | * @param {Number} minValue Minimum allowed value 939 | * @param {Number} maxValue Maximum allowed value 940 | * @param {Number} stepValue Increment by which to change value 941 | * 942 | * @member dat.controllers 943 | */ 944 | var NumberControllerSlider = function(object, property, min, max, step) { 945 | 946 | NumberControllerSlider.superclass.call(this, object, property, { min: min, max: max, step: step }); 947 | 948 | var _this = this; 949 | 950 | this.__background = document.createElement('div'); 951 | this.__foreground = document.createElement('div'); 952 | 953 | 954 | 955 | dom.bind(this.__background, 'mousedown', onMouseDown); 956 | 957 | dom.addClass(this.__background, 'slider'); 958 | dom.addClass(this.__foreground, 'slider-fg'); 959 | 960 | function onMouseDown(e) { 961 | 962 | dom.bind(window, 'mousemove', onMouseDrag); 963 | dom.bind(window, 'mouseup', onMouseUp); 964 | 965 | onMouseDrag(e); 966 | } 967 | 968 | function onMouseDrag(e) { 969 | 970 | e.preventDefault(); 971 | 972 | var offset = dom.getOffset(_this.__background); 973 | var width = dom.getWidth(_this.__background); 974 | 975 | _this.setValue( 976 | map(e.clientX, offset.left, offset.left + width, _this.__min, _this.__max) 977 | ); 978 | 979 | return false; 980 | 981 | } 982 | 983 | function onMouseUp() { 984 | dom.unbind(window, 'mousemove', onMouseDrag); 985 | dom.unbind(window, 'mouseup', onMouseUp); 986 | if (_this.__onFinishChange) { 987 | _this.__onFinishChange.call(_this, _this.getValue()); 988 | } 989 | } 990 | 991 | this.updateDisplay(); 992 | 993 | this.__background.appendChild(this.__foreground); 994 | this.domElement.appendChild(this.__background); 995 | 996 | }; 997 | 998 | NumberControllerSlider.superclass = NumberController; 999 | 1000 | /** 1001 | * Injects default stylesheet for slider elements. 1002 | */ 1003 | NumberControllerSlider.useDefaultStyles = function() { 1004 | css.inject(styleSheet); 1005 | }; 1006 | 1007 | common.extend( 1008 | 1009 | NumberControllerSlider.prototype, 1010 | NumberController.prototype, 1011 | 1012 | { 1013 | 1014 | updateDisplay: function() { 1015 | var pct = (this.getValue() - this.__min)/(this.__max - this.__min); 1016 | this.__foreground.style.width = pct*100+'%'; 1017 | return NumberControllerSlider.superclass.prototype.updateDisplay.call(this); 1018 | } 1019 | 1020 | } 1021 | 1022 | 1023 | 1024 | ); 1025 | 1026 | function map(v, i1, i2, o1, o2) { 1027 | return o1 + (o2 - o1) * ((v - i1) / (i2 - i1)); 1028 | } 1029 | 1030 | return NumberControllerSlider; 1031 | 1032 | })(dat.controllers.NumberController, 1033 | dat.dom.dom, 1034 | dat.utils.css, 1035 | dat.utils.common, 1036 | ".slider {\n box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);\n height: 1em;\n border-radius: 1em;\n background-color: #eee;\n padding: 0 0.5em;\n overflow: hidden;\n}\n\n.slider-fg {\n padding: 1px 0 2px 0;\n background-color: #aaa;\n height: 1em;\n margin-left: -0.5em;\n padding-right: 0.5em;\n border-radius: 1em 0 0 1em;\n}\n\n.slider-fg:after {\n display: inline-block;\n border-radius: 1em;\n background-color: #fff;\n border: 1px solid #aaa;\n content: '';\n float: right;\n margin-right: -1em;\n margin-top: -1px;\n height: 0.9em;\n width: 0.9em;\n}"); 1037 | 1038 | 1039 | dat.controllers.FunctionController = (function (Controller, dom, common) { 1040 | 1041 | /** 1042 | * @class Provides a GUI interface to fire a specified method, a property of an object. 1043 | * 1044 | * @extends dat.controllers.Controller 1045 | * 1046 | * @param {Object} object The object to be manipulated 1047 | * @param {string} property The name of the property to be manipulated 1048 | * 1049 | * @member dat.controllers 1050 | */ 1051 | var FunctionController = function(object, property, text) { 1052 | 1053 | FunctionController.superclass.call(this, object, property); 1054 | 1055 | var _this = this; 1056 | 1057 | this.__button = document.createElement('div'); 1058 | this.__button.innerHTML = text === undefined ? 'Fire' : text; 1059 | dom.bind(this.__button, 'click', function(e) { 1060 | e.preventDefault(); 1061 | _this.fire(); 1062 | return false; 1063 | }); 1064 | 1065 | dom.addClass(this.__button, 'button'); 1066 | 1067 | this.domElement.appendChild(this.__button); 1068 | 1069 | 1070 | }; 1071 | 1072 | FunctionController.superclass = Controller; 1073 | 1074 | common.extend( 1075 | 1076 | FunctionController.prototype, 1077 | Controller.prototype, 1078 | { 1079 | 1080 | fire: function() { 1081 | if (this.__onChange) { 1082 | this.__onChange.call(this); 1083 | } 1084 | if (this.__onFinishChange) { 1085 | this.__onFinishChange.call(this, this.getValue()); 1086 | } 1087 | this.getValue().call(this.object); 1088 | } 1089 | } 1090 | 1091 | ); 1092 | 1093 | return FunctionController; 1094 | 1095 | })(dat.controllers.Controller, 1096 | dat.dom.dom, 1097 | dat.utils.common); 1098 | 1099 | 1100 | dat.controllers.BooleanController = (function (Controller, dom, common) { 1101 | 1102 | /** 1103 | * @class Provides a checkbox input to alter the boolean property of an object. 1104 | * @extends dat.controllers.Controller 1105 | * 1106 | * @param {Object} object The object to be manipulated 1107 | * @param {string} property The name of the property to be manipulated 1108 | * 1109 | * @member dat.controllers 1110 | */ 1111 | var BooleanController = function(object, property) { 1112 | 1113 | BooleanController.superclass.call(this, object, property); 1114 | 1115 | var _this = this; 1116 | this.__prev = this.getValue(); 1117 | 1118 | this.__checkbox = document.createElement('input'); 1119 | this.__checkbox.setAttribute('type', 'checkbox'); 1120 | 1121 | 1122 | dom.bind(this.__checkbox, 'change', onChange, false); 1123 | 1124 | this.domElement.appendChild(this.__checkbox); 1125 | 1126 | // Match original value 1127 | this.updateDisplay(); 1128 | 1129 | function onChange() { 1130 | _this.setValue(!_this.__prev); 1131 | } 1132 | 1133 | }; 1134 | 1135 | BooleanController.superclass = Controller; 1136 | 1137 | common.extend( 1138 | 1139 | BooleanController.prototype, 1140 | Controller.prototype, 1141 | 1142 | { 1143 | 1144 | setValue: function(v) { 1145 | var toReturn = BooleanController.superclass.prototype.setValue.call(this, v); 1146 | if (this.__onFinishChange) { 1147 | this.__onFinishChange.call(this, this.getValue()); 1148 | } 1149 | this.__prev = this.getValue(); 1150 | return toReturn; 1151 | }, 1152 | 1153 | updateDisplay: function() { 1154 | 1155 | if (this.getValue() === true) { 1156 | this.__checkbox.setAttribute('checked', 'checked'); 1157 | this.__checkbox.checked = true; 1158 | } else { 1159 | this.__checkbox.checked = false; 1160 | } 1161 | 1162 | return BooleanController.superclass.prototype.updateDisplay.call(this); 1163 | 1164 | } 1165 | 1166 | 1167 | } 1168 | 1169 | ); 1170 | 1171 | return BooleanController; 1172 | 1173 | })(dat.controllers.Controller, 1174 | dat.dom.dom, 1175 | dat.utils.common); 1176 | 1177 | 1178 | dat.color.toString = (function (common) { 1179 | 1180 | return function(color) { 1181 | 1182 | if (color.a == 1 || common.isUndefined(color.a)) { 1183 | 1184 | var s = color.hex.toString(16); 1185 | while (s.length < 6) { 1186 | s = '0' + s; 1187 | } 1188 | 1189 | return '#' + s; 1190 | 1191 | } else { 1192 | 1193 | return 'rgba(' + Math.round(color.r) + ',' + Math.round(color.g) + ',' + Math.round(color.b) + ',' + color.a + ')'; 1194 | 1195 | } 1196 | 1197 | } 1198 | 1199 | })(dat.utils.common); 1200 | 1201 | 1202 | dat.color.interpret = (function (toString, common) { 1203 | 1204 | var result, toReturn; 1205 | 1206 | var interpret = function() { 1207 | 1208 | toReturn = false; 1209 | 1210 | var original = arguments.length > 1 ? common.toArray(arguments) : arguments[0]; 1211 | 1212 | common.each(INTERPRETATIONS, function(family) { 1213 | 1214 | if (family.litmus(original)) { 1215 | 1216 | common.each(family.conversions, function(conversion, conversionName) { 1217 | 1218 | result = conversion.read(original); 1219 | 1220 | if (toReturn === false && result !== false) { 1221 | toReturn = result; 1222 | result.conversionName = conversionName; 1223 | result.conversion = conversion; 1224 | return common.BREAK; 1225 | 1226 | } 1227 | 1228 | }); 1229 | 1230 | return common.BREAK; 1231 | 1232 | } 1233 | 1234 | }); 1235 | 1236 | return toReturn; 1237 | 1238 | }; 1239 | 1240 | var INTERPRETATIONS = [ 1241 | 1242 | // Strings 1243 | { 1244 | 1245 | litmus: common.isString, 1246 | 1247 | conversions: { 1248 | 1249 | THREE_CHAR_HEX: { 1250 | 1251 | read: function(original) { 1252 | 1253 | var test = original.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i); 1254 | if (test === null) return false; 1255 | 1256 | return { 1257 | space: 'HEX', 1258 | hex: parseInt( 1259 | '0x' + 1260 | test[1].toString() + test[1].toString() + 1261 | test[2].toString() + test[2].toString() + 1262 | test[3].toString() + test[3].toString()) 1263 | }; 1264 | 1265 | }, 1266 | 1267 | write: toString 1268 | 1269 | }, 1270 | 1271 | SIX_CHAR_HEX: { 1272 | 1273 | read: function(original) { 1274 | 1275 | var test = original.match(/^#([A-F0-9]{6})$/i); 1276 | if (test === null) return false; 1277 | 1278 | return { 1279 | space: 'HEX', 1280 | hex: parseInt('0x' + test[1].toString()) 1281 | }; 1282 | 1283 | }, 1284 | 1285 | write: toString 1286 | 1287 | }, 1288 | 1289 | CSS_RGB: { 1290 | 1291 | read: function(original) { 1292 | 1293 | var test = original.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/); 1294 | if (test === null) return false; 1295 | 1296 | return { 1297 | space: 'RGB', 1298 | r: parseFloat(test[1]), 1299 | g: parseFloat(test[2]), 1300 | b: parseFloat(test[3]) 1301 | }; 1302 | 1303 | }, 1304 | 1305 | write: toString 1306 | 1307 | }, 1308 | 1309 | CSS_RGBA: { 1310 | 1311 | read: function(original) { 1312 | 1313 | var test = original.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/); 1314 | if (test === null) return false; 1315 | 1316 | return { 1317 | space: 'RGB', 1318 | r: parseFloat(test[1]), 1319 | g: parseFloat(test[2]), 1320 | b: parseFloat(test[3]), 1321 | a: parseFloat(test[4]) 1322 | }; 1323 | 1324 | }, 1325 | 1326 | write: toString 1327 | 1328 | } 1329 | 1330 | } 1331 | 1332 | }, 1333 | 1334 | // Numbers 1335 | { 1336 | 1337 | litmus: common.isNumber, 1338 | 1339 | conversions: { 1340 | 1341 | HEX: { 1342 | read: function(original) { 1343 | return { 1344 | space: 'HEX', 1345 | hex: original, 1346 | conversionName: 'HEX' 1347 | } 1348 | }, 1349 | 1350 | write: function(color) { 1351 | return color.hex; 1352 | } 1353 | } 1354 | 1355 | } 1356 | 1357 | }, 1358 | 1359 | // Arrays 1360 | { 1361 | 1362 | litmus: common.isArray, 1363 | 1364 | conversions: { 1365 | 1366 | RGB_ARRAY: { 1367 | read: function(original) { 1368 | if (original.length != 3) return false; 1369 | return { 1370 | space: 'RGB', 1371 | r: original[0], 1372 | g: original[1], 1373 | b: original[2] 1374 | }; 1375 | }, 1376 | 1377 | write: function(color) { 1378 | return [color.r, color.g, color.b]; 1379 | } 1380 | 1381 | }, 1382 | 1383 | RGBA_ARRAY: { 1384 | read: function(original) { 1385 | if (original.length != 4) return false; 1386 | return { 1387 | space: 'RGB', 1388 | r: original[0], 1389 | g: original[1], 1390 | b: original[2], 1391 | a: original[3] 1392 | }; 1393 | }, 1394 | 1395 | write: function(color) { 1396 | return [color.r, color.g, color.b, color.a]; 1397 | } 1398 | 1399 | } 1400 | 1401 | } 1402 | 1403 | }, 1404 | 1405 | // Objects 1406 | { 1407 | 1408 | litmus: common.isObject, 1409 | 1410 | conversions: { 1411 | 1412 | RGBA_OBJ: { 1413 | read: function(original) { 1414 | if (common.isNumber(original.r) && 1415 | common.isNumber(original.g) && 1416 | common.isNumber(original.b) && 1417 | common.isNumber(original.a)) { 1418 | return { 1419 | space: 'RGB', 1420 | r: original.r, 1421 | g: original.g, 1422 | b: original.b, 1423 | a: original.a 1424 | } 1425 | } 1426 | return false; 1427 | }, 1428 | 1429 | write: function(color) { 1430 | return { 1431 | r: color.r, 1432 | g: color.g, 1433 | b: color.b, 1434 | a: color.a 1435 | } 1436 | } 1437 | }, 1438 | 1439 | RGB_OBJ: { 1440 | read: function(original) { 1441 | if (common.isNumber(original.r) && 1442 | common.isNumber(original.g) && 1443 | common.isNumber(original.b)) { 1444 | return { 1445 | space: 'RGB', 1446 | r: original.r, 1447 | g: original.g, 1448 | b: original.b 1449 | } 1450 | } 1451 | return false; 1452 | }, 1453 | 1454 | write: function(color) { 1455 | return { 1456 | r: color.r, 1457 | g: color.g, 1458 | b: color.b 1459 | } 1460 | } 1461 | }, 1462 | 1463 | HSVA_OBJ: { 1464 | read: function(original) { 1465 | if (common.isNumber(original.h) && 1466 | common.isNumber(original.s) && 1467 | common.isNumber(original.v) && 1468 | common.isNumber(original.a)) { 1469 | return { 1470 | space: 'HSV', 1471 | h: original.h, 1472 | s: original.s, 1473 | v: original.v, 1474 | a: original.a 1475 | } 1476 | } 1477 | return false; 1478 | }, 1479 | 1480 | write: function(color) { 1481 | return { 1482 | h: color.h, 1483 | s: color.s, 1484 | v: color.v, 1485 | a: color.a 1486 | } 1487 | } 1488 | }, 1489 | 1490 | HSV_OBJ: { 1491 | read: function(original) { 1492 | if (common.isNumber(original.h) && 1493 | common.isNumber(original.s) && 1494 | common.isNumber(original.v)) { 1495 | return { 1496 | space: 'HSV', 1497 | h: original.h, 1498 | s: original.s, 1499 | v: original.v 1500 | } 1501 | } 1502 | return false; 1503 | }, 1504 | 1505 | write: function(color) { 1506 | return { 1507 | h: color.h, 1508 | s: color.s, 1509 | v: color.v 1510 | } 1511 | } 1512 | 1513 | } 1514 | 1515 | } 1516 | 1517 | } 1518 | 1519 | 1520 | ]; 1521 | 1522 | return interpret; 1523 | 1524 | 1525 | })(dat.color.toString, 1526 | dat.utils.common); 1527 | 1528 | 1529 | dat.GUI = dat.gui.GUI = (function (css, saveDialogueContents, styleSheet, controllerFactory, Controller, BooleanController, FunctionController, NumberControllerBox, NumberControllerSlider, OptionController, ColorController, requestAnimationFrame, CenteredDiv, dom, common) { 1530 | 1531 | css.inject(styleSheet); 1532 | 1533 | /** Outer-most className for GUI's */ 1534 | var CSS_NAMESPACE = 'dg'; 1535 | 1536 | var HIDE_KEY_CODE = 72; 1537 | 1538 | /** The only value shared between the JS and SCSS. Use caution. */ 1539 | var CLOSE_BUTTON_HEIGHT = 20; 1540 | 1541 | var DEFAULT_DEFAULT_PRESET_NAME = 'Default'; 1542 | 1543 | var SUPPORTS_LOCAL_STORAGE = (function() { 1544 | try { 1545 | return 'localStorage' in window && window['localStorage'] !== null; 1546 | } catch (e) { 1547 | return false; 1548 | } 1549 | })(); 1550 | 1551 | var SAVE_DIALOGUE; 1552 | 1553 | /** Have we yet to create an autoPlace GUI? */ 1554 | var auto_place_virgin = true; 1555 | 1556 | /** Fixed position div that auto place GUI's go inside */ 1557 | var auto_place_container; 1558 | 1559 | /** Are we hiding the GUI's ? */ 1560 | var hide = false; 1561 | 1562 | /** GUI's which should be hidden */ 1563 | var hideable_guis = []; 1564 | 1565 | /** 1566 | * A lightweight controller library for JavaScript. It allows you to easily 1567 | * manipulate variables and fire functions on the fly. 1568 | * @class 1569 | * 1570 | * @member dat.gui 1571 | * 1572 | * @param {Object} [params] 1573 | * @param {String} [params.name] The name of this GUI. 1574 | * @param {Object} [params.load] JSON object representing the saved state of 1575 | * this GUI. 1576 | * @param {Boolean} [params.auto=true] 1577 | * @param {dat.gui.GUI} [params.parent] The GUI I'm nested in. 1578 | * @param {Boolean} [params.closed] If true, starts closed 1579 | */ 1580 | var GUI = function(params) { 1581 | 1582 | var _this = this; 1583 | 1584 | /** 1585 | * Outermost DOM Element 1586 | * @type DOMElement 1587 | */ 1588 | this.domElement = document.createElement('div'); 1589 | this.__ul = document.createElement('ul'); 1590 | this.domElement.appendChild(this.__ul); 1591 | 1592 | dom.addClass(this.domElement, CSS_NAMESPACE); 1593 | 1594 | /** 1595 | * Nested GUI's by name 1596 | * @ignore 1597 | */ 1598 | this.__folders = {}; 1599 | 1600 | this.__controllers = []; 1601 | 1602 | /** 1603 | * List of objects I'm remembering for save, only used in top level GUI 1604 | * @ignore 1605 | */ 1606 | this.__rememberedObjects = []; 1607 | 1608 | /** 1609 | * Maps the index of remembered objects to a map of controllers, only used 1610 | * in top level GUI. 1611 | * 1612 | * @private 1613 | * @ignore 1614 | * 1615 | * @example 1616 | * [ 1617 | * { 1618 | * propertyName: Controller, 1619 | * anotherPropertyName: Controller 1620 | * }, 1621 | * { 1622 | * propertyName: Controller 1623 | * } 1624 | * ] 1625 | */ 1626 | this.__rememberedObjectIndecesToControllers = []; 1627 | 1628 | this.__listening = []; 1629 | 1630 | params = params || {}; 1631 | 1632 | // Default parameters 1633 | params = common.defaults(params, { 1634 | autoPlace: true, 1635 | width: GUI.DEFAULT_WIDTH 1636 | }); 1637 | 1638 | params = common.defaults(params, { 1639 | resizable: params.autoPlace, 1640 | hideable: params.autoPlace 1641 | }); 1642 | 1643 | 1644 | if (!common.isUndefined(params.load)) { 1645 | 1646 | // Explicit preset 1647 | if (params.preset) params.load.preset = params.preset; 1648 | 1649 | } else { 1650 | 1651 | params.load = { preset: DEFAULT_DEFAULT_PRESET_NAME }; 1652 | 1653 | } 1654 | 1655 | if (common.isUndefined(params.parent) && params.hideable) { 1656 | hideable_guis.push(this); 1657 | } 1658 | 1659 | // Only root level GUI's are resizable. 1660 | params.resizable = common.isUndefined(params.parent) && params.resizable; 1661 | 1662 | 1663 | if (params.autoPlace && common.isUndefined(params.scrollable)) { 1664 | params.scrollable = true; 1665 | } 1666 | // params.scrollable = common.isUndefined(params.parent) && params.scrollable === true; 1667 | 1668 | // Not part of params because I don't want people passing this in via 1669 | // constructor. Should be a 'remembered' value. 1670 | var use_local_storage = 1671 | SUPPORTS_LOCAL_STORAGE && 1672 | localStorage.getItem(getLocalStorageHash(this, 'isLocal')) === 'true'; 1673 | 1674 | Object.defineProperties(this, 1675 | 1676 | /** @lends dat.gui.GUI.prototype */ 1677 | { 1678 | 1679 | /** 1680 | * The parent GUI 1681 | * @type dat.gui.GUI 1682 | */ 1683 | parent: { 1684 | get: function() { 1685 | return params.parent; 1686 | } 1687 | }, 1688 | 1689 | scrollable: { 1690 | get: function() { 1691 | return params.scrollable; 1692 | } 1693 | }, 1694 | 1695 | /** 1696 | * Handles GUI's element placement for you 1697 | * @type Boolean 1698 | */ 1699 | autoPlace: { 1700 | get: function() { 1701 | return params.autoPlace; 1702 | } 1703 | }, 1704 | 1705 | /** 1706 | * The identifier for a set of saved values 1707 | * @type String 1708 | */ 1709 | preset: { 1710 | 1711 | get: function() { 1712 | if (_this.parent) { 1713 | return _this.getRoot().preset; 1714 | } else { 1715 | return params.load.preset; 1716 | } 1717 | }, 1718 | 1719 | set: function(v) { 1720 | if (_this.parent) { 1721 | _this.getRoot().preset = v; 1722 | } else { 1723 | params.load.preset = v; 1724 | } 1725 | setPresetSelectIndex(this); 1726 | _this.revert(); 1727 | } 1728 | 1729 | }, 1730 | 1731 | /** 1732 | * The width of GUI element 1733 | * @type Number 1734 | */ 1735 | width: { 1736 | get: function() { 1737 | return params.width; 1738 | }, 1739 | set: function(v) { 1740 | params.width = v; 1741 | setWidth(_this, v); 1742 | } 1743 | }, 1744 | 1745 | /** 1746 | * The name of GUI. Used for folders. i.e 1747 | * a folder's name 1748 | * @type String 1749 | */ 1750 | name: { 1751 | get: function() { 1752 | return params.name; 1753 | }, 1754 | set: function(v) { 1755 | // TODO Check for collisions among sibling folders 1756 | params.name = v; 1757 | if (title_row_name) { 1758 | title_row_name.innerHTML = params.name; 1759 | } 1760 | } 1761 | }, 1762 | 1763 | /** 1764 | * Whether the GUI is collapsed or not 1765 | * @type Boolean 1766 | */ 1767 | closed: { 1768 | get: function() { 1769 | return params.closed; 1770 | }, 1771 | set: function(v) { 1772 | params.closed = v; 1773 | if (params.closed) { 1774 | dom.addClass(_this.__ul, GUI.CLASS_CLOSED); 1775 | } else { 1776 | dom.removeClass(_this.__ul, GUI.CLASS_CLOSED); 1777 | } 1778 | // For browsers that aren't going to respect the CSS transition, 1779 | // Lets just check our height against the window height right off 1780 | // the bat. 1781 | this.onResize(); 1782 | 1783 | if (_this.__closeButton) { 1784 | _this.__closeButton.innerHTML = v ? GUI.TEXT_OPEN : GUI.TEXT_CLOSED; 1785 | } 1786 | } 1787 | }, 1788 | 1789 | /** 1790 | * Contains all presets 1791 | * @type Object 1792 | */ 1793 | load: { 1794 | get: function() { 1795 | return params.load; 1796 | } 1797 | }, 1798 | 1799 | /** 1800 | * Determines whether or not to use localStorage as the means for 1801 | * remembering 1802 | * @type Boolean 1803 | */ 1804 | useLocalStorage: { 1805 | 1806 | get: function() { 1807 | return use_local_storage; 1808 | }, 1809 | set: function(bool) { 1810 | if (SUPPORTS_LOCAL_STORAGE) { 1811 | use_local_storage = bool; 1812 | if (bool) { 1813 | dom.bind(window, 'unload', saveToLocalStorage); 1814 | } else { 1815 | dom.unbind(window, 'unload', saveToLocalStorage); 1816 | } 1817 | localStorage.setItem(getLocalStorageHash(_this, 'isLocal'), bool); 1818 | } 1819 | } 1820 | 1821 | } 1822 | 1823 | }); 1824 | 1825 | // Are we a root level GUI? 1826 | if (common.isUndefined(params.parent)) { 1827 | 1828 | params.closed = false; 1829 | 1830 | dom.addClass(this.domElement, GUI.CLASS_MAIN); 1831 | dom.makeSelectable(this.domElement, false); 1832 | 1833 | // Are we supposed to be loading locally? 1834 | if (SUPPORTS_LOCAL_STORAGE) { 1835 | 1836 | if (use_local_storage) { 1837 | 1838 | _this.useLocalStorage = true; 1839 | 1840 | var saved_gui = localStorage.getItem(getLocalStorageHash(this, 'gui')); 1841 | 1842 | if (saved_gui) { 1843 | params.load = JSON.parse(saved_gui); 1844 | } 1845 | 1846 | } 1847 | 1848 | } 1849 | 1850 | this.__closeButton = document.createElement('div'); 1851 | this.__closeButton.innerHTML = GUI.TEXT_CLOSED; 1852 | dom.addClass(this.__closeButton, GUI.CLASS_CLOSE_BUTTON); 1853 | this.domElement.appendChild(this.__closeButton); 1854 | 1855 | dom.bind(this.__closeButton, 'click', function() { 1856 | 1857 | _this.closed = !_this.closed; 1858 | 1859 | 1860 | }); 1861 | 1862 | 1863 | // Oh, you're a nested GUI! 1864 | } else { 1865 | 1866 | if (params.closed === undefined) { 1867 | params.closed = true; 1868 | } 1869 | 1870 | var title_row_name = document.createTextNode(params.name); 1871 | dom.addClass(title_row_name, 'controller-name'); 1872 | 1873 | var title_row = addRow(_this, title_row_name); 1874 | 1875 | var on_click_title = function(e) { 1876 | e.preventDefault(); 1877 | _this.closed = !_this.closed; 1878 | return false; 1879 | }; 1880 | 1881 | dom.addClass(this.__ul, GUI.CLASS_CLOSED); 1882 | 1883 | dom.addClass(title_row, 'title'); 1884 | dom.bind(title_row, 'click', on_click_title); 1885 | 1886 | if (!params.closed) { 1887 | this.closed = false; 1888 | } 1889 | 1890 | } 1891 | 1892 | if (params.autoPlace) { 1893 | 1894 | if (common.isUndefined(params.parent)) { 1895 | 1896 | if (auto_place_virgin) { 1897 | auto_place_container = document.createElement('div'); 1898 | dom.addClass(auto_place_container, CSS_NAMESPACE); 1899 | dom.addClass(auto_place_container, GUI.CLASS_AUTO_PLACE_CONTAINER); 1900 | document.body.appendChild(auto_place_container); 1901 | auto_place_virgin = false; 1902 | } 1903 | 1904 | // Put it in the dom for you. 1905 | auto_place_container.appendChild(this.domElement); 1906 | 1907 | // Apply the auto styles 1908 | dom.addClass(this.domElement, GUI.CLASS_AUTO_PLACE); 1909 | 1910 | } 1911 | 1912 | 1913 | // Make it not elastic. 1914 | if (!this.parent) setWidth(_this, params.width); 1915 | 1916 | } 1917 | 1918 | dom.bind(window, 'resize', function() { _this.onResize() }); 1919 | dom.bind(this.__ul, 'webkitTransitionEnd', function() { _this.onResize(); }); 1920 | dom.bind(this.__ul, 'transitionend', function() { _this.onResize() }); 1921 | dom.bind(this.__ul, 'oTransitionEnd', function() { _this.onResize() }); 1922 | this.onResize(); 1923 | 1924 | 1925 | if (params.resizable) { 1926 | addResizeHandle(this); 1927 | } 1928 | 1929 | function saveToLocalStorage() { 1930 | localStorage.setItem(getLocalStorageHash(_this, 'gui'), JSON.stringify(_this.getSaveObject())); 1931 | } 1932 | 1933 | var root = _this.getRoot(); 1934 | function resetWidth() { 1935 | var root = _this.getRoot(); 1936 | root.width += 1; 1937 | common.defer(function() { 1938 | root.width -= 1; 1939 | }); 1940 | } 1941 | 1942 | if (!params.parent) { 1943 | resetWidth(); 1944 | } 1945 | 1946 | }; 1947 | 1948 | GUI.toggleHide = function() { 1949 | 1950 | hide = !hide; 1951 | common.each(hideable_guis, function(gui) { 1952 | gui.domElement.style.zIndex = hide ? -999 : 999; 1953 | gui.domElement.style.opacity = hide ? 0 : 1; 1954 | }); 1955 | }; 1956 | 1957 | GUI.CLASS_AUTO_PLACE = 'a'; 1958 | GUI.CLASS_AUTO_PLACE_CONTAINER = 'ac'; 1959 | GUI.CLASS_MAIN = 'main'; 1960 | GUI.CLASS_CONTROLLER_ROW = 'cr'; 1961 | GUI.CLASS_TOO_TALL = 'taller-than-window'; 1962 | GUI.CLASS_CLOSED = 'closed'; 1963 | GUI.CLASS_CLOSE_BUTTON = 'close-button'; 1964 | GUI.CLASS_DRAG = 'drag'; 1965 | 1966 | GUI.DEFAULT_WIDTH = 245; 1967 | GUI.TEXT_CLOSED = 'Close Controls'; 1968 | GUI.TEXT_OPEN = 'Open Controls'; 1969 | 1970 | dom.bind(window, 'keydown', function(e) { 1971 | 1972 | if (document.activeElement.type !== 'text' && 1973 | (e.which === HIDE_KEY_CODE || e.keyCode == HIDE_KEY_CODE)) { 1974 | GUI.toggleHide(); 1975 | } 1976 | 1977 | }, false); 1978 | 1979 | common.extend( 1980 | 1981 | GUI.prototype, 1982 | 1983 | /** @lends dat.gui.GUI */ 1984 | { 1985 | 1986 | /** 1987 | * @param object 1988 | * @param property 1989 | * @returns {dat.controllers.Controller} The new controller that was added. 1990 | * @instance 1991 | */ 1992 | add: function(object, property) { 1993 | 1994 | return add( 1995 | this, 1996 | object, 1997 | property, 1998 | { 1999 | factoryArgs: Array.prototype.slice.call(arguments, 2) 2000 | } 2001 | ); 2002 | 2003 | }, 2004 | 2005 | /** 2006 | * @param object 2007 | * @param property 2008 | * @returns {dat.controllers.ColorController} The new controller that was added. 2009 | * @instance 2010 | */ 2011 | addColor: function(object, property) { 2012 | 2013 | return add( 2014 | this, 2015 | object, 2016 | property, 2017 | { 2018 | color: true 2019 | } 2020 | ); 2021 | 2022 | }, 2023 | 2024 | /** 2025 | * @param controller 2026 | * @instance 2027 | */ 2028 | remove: function(controller) { 2029 | 2030 | // TODO listening? 2031 | this.__ul.removeChild(controller.__li); 2032 | this.__controllers.slice(this.__controllers.indexOf(controller), 1); 2033 | var _this = this; 2034 | common.defer(function() { 2035 | _this.onResize(); 2036 | }); 2037 | 2038 | }, 2039 | 2040 | destroy: function() { 2041 | 2042 | if (this.autoPlace) { 2043 | auto_place_container.removeChild(this.domElement); 2044 | } 2045 | 2046 | }, 2047 | 2048 | /** 2049 | * @param name 2050 | * @returns {dat.gui.GUI} The new folder. 2051 | * @throws {Error} if this GUI already has a folder by the specified 2052 | * name 2053 | * @instance 2054 | */ 2055 | addFolder: function(name) { 2056 | 2057 | // We have to prevent collisions on names in order to have a key 2058 | // by which to remember saved values 2059 | if (this.__folders[name] !== undefined) { 2060 | throw new Error('You already have a folder in this GUI by the' + 2061 | ' name "' + name + '"'); 2062 | } 2063 | 2064 | var new_gui_params = { name: name, parent: this }; 2065 | 2066 | // We need to pass down the autoPlace trait so that we can 2067 | // attach event listeners to open/close folder actions to 2068 | // ensure that a scrollbar appears if the window is too short. 2069 | new_gui_params.autoPlace = this.autoPlace; 2070 | 2071 | // Do we have saved appearance data for this folder? 2072 | 2073 | if (this.load && // Anything loaded? 2074 | this.load.folders && // Was my parent a dead-end? 2075 | this.load.folders[name]) { // Did daddy remember me? 2076 | 2077 | // Start me closed if I was closed 2078 | new_gui_params.closed = this.load.folders[name].closed; 2079 | 2080 | // Pass down the loaded data 2081 | new_gui_params.load = this.load.folders[name]; 2082 | 2083 | } 2084 | 2085 | var gui = new GUI(new_gui_params); 2086 | this.__folders[name] = gui; 2087 | 2088 | var li = addRow(this, gui.domElement); 2089 | dom.addClass(li, 'folder'); 2090 | return gui; 2091 | 2092 | }, 2093 | 2094 | open: function() { 2095 | this.closed = false; 2096 | }, 2097 | 2098 | close: function() { 2099 | this.closed = true; 2100 | }, 2101 | 2102 | onResize: function() { 2103 | 2104 | var root = this.getRoot(); 2105 | 2106 | if (root.scrollable) { 2107 | 2108 | var top = dom.getOffset(root.__ul).top; 2109 | var h = 0; 2110 | 2111 | common.each(root.__ul.childNodes, function(node) { 2112 | if (! (root.autoPlace && node === root.__save_row)) 2113 | h += dom.getHeight(node); 2114 | }); 2115 | 2116 | if (window.innerHeight - top - CLOSE_BUTTON_HEIGHT < h) { 2117 | dom.addClass(root.domElement, GUI.CLASS_TOO_TALL); 2118 | root.__ul.style.height = window.innerHeight - top - CLOSE_BUTTON_HEIGHT + 'px'; 2119 | } else { 2120 | dom.removeClass(root.domElement, GUI.CLASS_TOO_TALL); 2121 | root.__ul.style.height = 'auto'; 2122 | } 2123 | 2124 | } 2125 | 2126 | if (root.__resize_handle) { 2127 | common.defer(function() { 2128 | root.__resize_handle.style.height = root.__ul.offsetHeight + 'px'; 2129 | }); 2130 | } 2131 | 2132 | if (root.__closeButton) { 2133 | root.__closeButton.style.width = root.width + 'px'; 2134 | } 2135 | 2136 | }, 2137 | 2138 | /** 2139 | * Mark objects for saving. The order of these objects cannot change as 2140 | * the GUI grows. When remembering new objects, append them to the end 2141 | * of the list. 2142 | * 2143 | * @param {Object...} objects 2144 | * @throws {Error} if not called on a top level GUI. 2145 | * @instance 2146 | */ 2147 | remember: function() { 2148 | 2149 | if (common.isUndefined(SAVE_DIALOGUE)) { 2150 | SAVE_DIALOGUE = new CenteredDiv(); 2151 | SAVE_DIALOGUE.domElement.innerHTML = saveDialogueContents; 2152 | } 2153 | 2154 | if (this.parent) { 2155 | throw new Error("You can only call remember on a top level GUI."); 2156 | } 2157 | 2158 | var _this = this; 2159 | 2160 | common.each(Array.prototype.slice.call(arguments), function(object) { 2161 | if (_this.__rememberedObjects.length == 0) { 2162 | addSaveMenu(_this); 2163 | } 2164 | if (_this.__rememberedObjects.indexOf(object) == -1) { 2165 | _this.__rememberedObjects.push(object); 2166 | } 2167 | }); 2168 | 2169 | if (this.autoPlace) { 2170 | // Set save row width 2171 | setWidth(this, this.width); 2172 | } 2173 | 2174 | }, 2175 | 2176 | /** 2177 | * @returns {dat.gui.GUI} the topmost parent GUI of a nested GUI. 2178 | * @instance 2179 | */ 2180 | getRoot: function() { 2181 | var gui = this; 2182 | while (gui.parent) { 2183 | gui = gui.parent; 2184 | } 2185 | return gui; 2186 | }, 2187 | 2188 | /** 2189 | * @returns {Object} a JSON object representing the current state of 2190 | * this GUI as well as its remembered properties. 2191 | * @instance 2192 | */ 2193 | getSaveObject: function() { 2194 | 2195 | var toReturn = this.load; 2196 | 2197 | toReturn.closed = this.closed; 2198 | 2199 | // Am I remembering any values? 2200 | if (this.__rememberedObjects.length > 0) { 2201 | 2202 | toReturn.preset = this.preset; 2203 | 2204 | if (!toReturn.remembered) { 2205 | toReturn.remembered = {}; 2206 | } 2207 | 2208 | toReturn.remembered[this.preset] = getCurrentPreset(this); 2209 | 2210 | } 2211 | 2212 | toReturn.folders = {}; 2213 | common.each(this.__folders, function(element, key) { 2214 | toReturn.folders[key] = element.getSaveObject(); 2215 | }); 2216 | 2217 | return toReturn; 2218 | 2219 | }, 2220 | 2221 | save: function() { 2222 | 2223 | if (!this.load.remembered) { 2224 | this.load.remembered = {}; 2225 | } 2226 | 2227 | this.load.remembered[this.preset] = getCurrentPreset(this); 2228 | markPresetModified(this, false); 2229 | 2230 | }, 2231 | 2232 | saveAs: function(presetName) { 2233 | 2234 | if (!this.load.remembered) { 2235 | 2236 | // Retain default values upon first save 2237 | this.load.remembered = {}; 2238 | this.load.remembered[DEFAULT_DEFAULT_PRESET_NAME] = getCurrentPreset(this, true); 2239 | 2240 | } 2241 | 2242 | this.load.remembered[presetName] = getCurrentPreset(this); 2243 | this.preset = presetName; 2244 | addPresetOption(this, presetName, true); 2245 | 2246 | }, 2247 | 2248 | revert: function(gui) { 2249 | 2250 | common.each(this.__controllers, function(controller) { 2251 | // Make revert work on Default. 2252 | if (!this.getRoot().load.remembered) { 2253 | controller.setValue(controller.initialValue); 2254 | } else { 2255 | recallSavedValue(gui || this.getRoot(), controller); 2256 | } 2257 | }, this); 2258 | 2259 | common.each(this.__folders, function(folder) { 2260 | folder.revert(folder); 2261 | }); 2262 | 2263 | if (!gui) { 2264 | markPresetModified(this.getRoot(), false); 2265 | } 2266 | 2267 | 2268 | }, 2269 | 2270 | listen: function(controller) { 2271 | 2272 | var init = this.__listening.length == 0; 2273 | this.__listening.push(controller); 2274 | if (init) updateDisplays(this.__listening); 2275 | 2276 | } 2277 | 2278 | } 2279 | 2280 | ); 2281 | 2282 | function add(gui, object, property, params) { 2283 | 2284 | if (object[property] === undefined) { 2285 | throw new Error("Object " + object + " has no property \"" + property + "\""); 2286 | } 2287 | 2288 | var controller; 2289 | 2290 | if (params.color) { 2291 | 2292 | controller = new ColorController(object, property); 2293 | 2294 | } else { 2295 | 2296 | var factoryArgs = [object,property].concat(params.factoryArgs); 2297 | controller = controllerFactory.apply(gui, factoryArgs); 2298 | 2299 | } 2300 | 2301 | if (params.before instanceof Controller) { 2302 | params.before = params.before.__li; 2303 | } 2304 | 2305 | recallSavedValue(gui, controller); 2306 | 2307 | dom.addClass(controller.domElement, 'c'); 2308 | 2309 | var name = document.createElement('span'); 2310 | dom.addClass(name, 'property-name'); 2311 | name.innerHTML = controller.property; 2312 | 2313 | var container = document.createElement('div'); 2314 | container.appendChild(name); 2315 | container.appendChild(controller.domElement); 2316 | 2317 | var li = addRow(gui, container, params.before); 2318 | 2319 | dom.addClass(li, GUI.CLASS_CONTROLLER_ROW); 2320 | dom.addClass(li, typeof controller.getValue()); 2321 | 2322 | augmentController(gui, li, controller); 2323 | 2324 | gui.__controllers.push(controller); 2325 | 2326 | return controller; 2327 | 2328 | } 2329 | 2330 | /** 2331 | * Add a row to the end of the GUI or before another row. 2332 | * 2333 | * @param gui 2334 | * @param [dom] If specified, inserts the dom content in the new row 2335 | * @param [liBefore] If specified, places the new row before another row 2336 | */ 2337 | function addRow(gui, dom, liBefore) { 2338 | var li = document.createElement('li'); 2339 | if (dom) li.appendChild(dom); 2340 | if (liBefore) { 2341 | gui.__ul.insertBefore(li, params.before); 2342 | } else { 2343 | gui.__ul.appendChild(li); 2344 | } 2345 | gui.onResize(); 2346 | return li; 2347 | } 2348 | 2349 | function augmentController(gui, li, controller) { 2350 | 2351 | controller.__li = li; 2352 | controller.__gui = gui; 2353 | 2354 | common.extend(controller, { 2355 | 2356 | options: function(options) { 2357 | 2358 | if (arguments.length > 1) { 2359 | controller.remove(); 2360 | 2361 | return add( 2362 | gui, 2363 | controller.object, 2364 | controller.property, 2365 | { 2366 | before: controller.__li.nextElementSibling, 2367 | factoryArgs: [common.toArray(arguments)] 2368 | } 2369 | ); 2370 | 2371 | } 2372 | 2373 | if (common.isArray(options) || common.isObject(options)) { 2374 | controller.remove(); 2375 | 2376 | return add( 2377 | gui, 2378 | controller.object, 2379 | controller.property, 2380 | { 2381 | before: controller.__li.nextElementSibling, 2382 | factoryArgs: [options] 2383 | } 2384 | ); 2385 | 2386 | } 2387 | 2388 | }, 2389 | 2390 | name: function(v) { 2391 | controller.__li.firstElementChild.firstElementChild.innerHTML = v; 2392 | return controller; 2393 | }, 2394 | 2395 | listen: function() { 2396 | controller.__gui.listen(controller); 2397 | return controller; 2398 | }, 2399 | 2400 | remove: function() { 2401 | controller.__gui.remove(controller); 2402 | return controller; 2403 | } 2404 | 2405 | }); 2406 | 2407 | // All sliders should be accompanied by a box. 2408 | if (controller instanceof NumberControllerSlider) { 2409 | 2410 | var box = new NumberControllerBox(controller.object, controller.property, 2411 | { min: controller.__min, max: controller.__max, step: controller.__step }); 2412 | 2413 | common.each(['updateDisplay', 'onChange', 'onFinishChange'], function(method) { 2414 | var pc = controller[method]; 2415 | var pb = box[method]; 2416 | controller[method] = box[method] = function() { 2417 | var args = Array.prototype.slice.call(arguments); 2418 | pc.apply(controller, args); 2419 | return pb.apply(box, args); 2420 | } 2421 | }); 2422 | 2423 | dom.addClass(li, 'has-slider'); 2424 | controller.domElement.insertBefore(box.domElement, controller.domElement.firstElementChild); 2425 | 2426 | } 2427 | else if (controller instanceof NumberControllerBox) { 2428 | 2429 | var r = function(returned) { 2430 | 2431 | // Have we defined both boundaries? 2432 | if (common.isNumber(controller.__min) && common.isNumber(controller.__max)) { 2433 | 2434 | // Well, then lets just replace this with a slider. 2435 | controller.remove(); 2436 | return add( 2437 | gui, 2438 | controller.object, 2439 | controller.property, 2440 | { 2441 | before: controller.__li.nextElementSibling, 2442 | factoryArgs: [controller.__min, controller.__max, controller.__step] 2443 | }); 2444 | 2445 | } 2446 | 2447 | return returned; 2448 | 2449 | }; 2450 | 2451 | controller.min = common.compose(r, controller.min); 2452 | controller.max = common.compose(r, controller.max); 2453 | 2454 | } 2455 | else if (controller instanceof BooleanController) { 2456 | 2457 | dom.bind(li, 'click', function() { 2458 | dom.fakeEvent(controller.__checkbox, 'click'); 2459 | }); 2460 | 2461 | dom.bind(controller.__checkbox, 'click', function(e) { 2462 | e.stopPropagation(); // Prevents double-toggle 2463 | }) 2464 | 2465 | } 2466 | else if (controller instanceof FunctionController) { 2467 | 2468 | dom.bind(li, 'click', function() { 2469 | dom.fakeEvent(controller.__button, 'click'); 2470 | }); 2471 | 2472 | dom.bind(li, 'mouseover', function() { 2473 | dom.addClass(controller.__button, 'hover'); 2474 | }); 2475 | 2476 | dom.bind(li, 'mouseout', function() { 2477 | dom.removeClass(controller.__button, 'hover'); 2478 | }); 2479 | 2480 | } 2481 | else if (controller instanceof ColorController) { 2482 | 2483 | dom.addClass(li, 'color'); 2484 | controller.updateDisplay = common.compose(function(r) { 2485 | li.style.borderLeftColor = controller.__color.toString(); 2486 | return r; 2487 | }, controller.updateDisplay); 2488 | 2489 | controller.updateDisplay(); 2490 | 2491 | } 2492 | 2493 | controller.setValue = common.compose(function(r) { 2494 | if (gui.getRoot().__preset_select && controller.isModified()) { 2495 | markPresetModified(gui.getRoot(), true); 2496 | } 2497 | return r; 2498 | }, controller.setValue); 2499 | 2500 | } 2501 | 2502 | function recallSavedValue(gui, controller) { 2503 | 2504 | // Find the topmost GUI, that's where remembered objects live. 2505 | var root = gui.getRoot(); 2506 | 2507 | // Does the object we're controlling match anything we've been told to 2508 | // remember? 2509 | var matched_index = root.__rememberedObjects.indexOf(controller.object); 2510 | 2511 | // Why yes, it does! 2512 | if (matched_index != -1) { 2513 | 2514 | // Let me fetch a map of controllers for thcommon.isObject. 2515 | var controller_map = 2516 | root.__rememberedObjectIndecesToControllers[matched_index]; 2517 | 2518 | // Ohp, I believe this is the first controller we've created for this 2519 | // object. Lets make the map fresh. 2520 | if (controller_map === undefined) { 2521 | controller_map = {}; 2522 | root.__rememberedObjectIndecesToControllers[matched_index] = 2523 | controller_map; 2524 | } 2525 | 2526 | // Keep track of this controller 2527 | controller_map[controller.property] = controller; 2528 | 2529 | // Okay, now have we saved any values for this controller? 2530 | if (root.load && root.load.remembered) { 2531 | 2532 | var preset_map = root.load.remembered; 2533 | 2534 | // Which preset are we trying to load? 2535 | var preset; 2536 | 2537 | if (preset_map[gui.preset]) { 2538 | 2539 | preset = preset_map[gui.preset]; 2540 | 2541 | } else if (preset_map[DEFAULT_DEFAULT_PRESET_NAME]) { 2542 | 2543 | // Uhh, you can have the default instead? 2544 | preset = preset_map[DEFAULT_DEFAULT_PRESET_NAME]; 2545 | 2546 | } else { 2547 | 2548 | // Nada. 2549 | 2550 | return; 2551 | 2552 | } 2553 | 2554 | 2555 | // Did the loaded object remember thcommon.isObject? 2556 | if (preset[matched_index] && 2557 | 2558 | // Did we remember this particular property? 2559 | preset[matched_index][controller.property] !== undefined) { 2560 | 2561 | // We did remember something for this guy ... 2562 | var value = preset[matched_index][controller.property]; 2563 | 2564 | // And that's what it is. 2565 | controller.initialValue = value; 2566 | controller.setValue(value); 2567 | 2568 | } 2569 | 2570 | } 2571 | 2572 | } 2573 | 2574 | } 2575 | 2576 | function getLocalStorageHash(gui, key) { 2577 | // TODO how does this deal with multiple GUI's? 2578 | return document.location.href + '.' + key; 2579 | 2580 | } 2581 | 2582 | function addSaveMenu(gui) { 2583 | 2584 | var div = gui.__save_row = document.createElement('li'); 2585 | 2586 | dom.addClass(gui.domElement, 'has-save'); 2587 | 2588 | gui.__ul.insertBefore(div, gui.__ul.firstChild); 2589 | 2590 | dom.addClass(div, 'save-row'); 2591 | 2592 | var gears = document.createElement('span'); 2593 | gears.innerHTML = ' '; 2594 | dom.addClass(gears, 'button gears'); 2595 | 2596 | // TODO replace with FunctionController 2597 | var button = document.createElement('span'); 2598 | button.innerHTML = 'Save'; 2599 | dom.addClass(button, 'button'); 2600 | dom.addClass(button, 'save'); 2601 | 2602 | var button2 = document.createElement('span'); 2603 | button2.innerHTML = 'New'; 2604 | dom.addClass(button2, 'button'); 2605 | dom.addClass(button2, 'save-as'); 2606 | 2607 | var button3 = document.createElement('span'); 2608 | button3.innerHTML = 'Revert'; 2609 | dom.addClass(button3, 'button'); 2610 | dom.addClass(button3, 'revert'); 2611 | 2612 | var select = gui.__preset_select = document.createElement('select'); 2613 | 2614 | if (gui.load && gui.load.remembered) { 2615 | 2616 | common.each(gui.load.remembered, function(value, key) { 2617 | addPresetOption(gui, key, key == gui.preset); 2618 | }); 2619 | 2620 | } else { 2621 | addPresetOption(gui, DEFAULT_DEFAULT_PRESET_NAME, false); 2622 | } 2623 | 2624 | dom.bind(select, 'change', function() { 2625 | 2626 | 2627 | for (var index = 0; index < gui.__preset_select.length; index++) { 2628 | gui.__preset_select[index].innerHTML = gui.__preset_select[index].value; 2629 | } 2630 | 2631 | gui.preset = this.value; 2632 | 2633 | }); 2634 | 2635 | div.appendChild(select); 2636 | div.appendChild(gears); 2637 | div.appendChild(button); 2638 | div.appendChild(button2); 2639 | div.appendChild(button3); 2640 | 2641 | if (SUPPORTS_LOCAL_STORAGE) { 2642 | 2643 | var saveLocally = document.getElementById('dg-save-locally'); 2644 | var explain = document.getElementById('dg-local-explain'); 2645 | 2646 | saveLocally.style.display = 'block'; 2647 | 2648 | var localStorageCheckBox = document.getElementById('dg-local-storage'); 2649 | 2650 | if (localStorage.getItem(getLocalStorageHash(gui, 'isLocal')) === 'true') { 2651 | localStorageCheckBox.setAttribute('checked', 'checked'); 2652 | } 2653 | 2654 | function showHideExplain() { 2655 | explain.style.display = gui.useLocalStorage ? 'block' : 'none'; 2656 | } 2657 | 2658 | showHideExplain(); 2659 | 2660 | // TODO: Use a boolean controller, fool! 2661 | dom.bind(localStorageCheckBox, 'change', function() { 2662 | gui.useLocalStorage = !gui.useLocalStorage; 2663 | showHideExplain(); 2664 | }); 2665 | 2666 | } 2667 | 2668 | var newConstructorTextArea = document.getElementById('dg-new-constructor'); 2669 | 2670 | dom.bind(newConstructorTextArea, 'keydown', function(e) { 2671 | if (e.metaKey && (e.which === 67 || e.keyCode == 67)) { 2672 | SAVE_DIALOGUE.hide(); 2673 | } 2674 | }); 2675 | 2676 | dom.bind(gears, 'click', function() { 2677 | newConstructorTextArea.innerHTML = JSON.stringify(gui.getSaveObject(), undefined, 2); 2678 | SAVE_DIALOGUE.show(); 2679 | newConstructorTextArea.focus(); 2680 | newConstructorTextArea.select(); 2681 | }); 2682 | 2683 | dom.bind(button, 'click', function() { 2684 | gui.save(); 2685 | }); 2686 | 2687 | dom.bind(button2, 'click', function() { 2688 | var presetName = prompt('Enter a new preset name.'); 2689 | if (presetName) gui.saveAs(presetName); 2690 | }); 2691 | 2692 | dom.bind(button3, 'click', function() { 2693 | gui.revert(); 2694 | }); 2695 | 2696 | // div.appendChild(button2); 2697 | 2698 | } 2699 | 2700 | function addResizeHandle(gui) { 2701 | 2702 | gui.__resize_handle = document.createElement('div'); 2703 | 2704 | common.extend(gui.__resize_handle.style, { 2705 | 2706 | width: '6px', 2707 | marginLeft: '-3px', 2708 | height: '200px', 2709 | cursor: 'ew-resize', 2710 | position: 'absolute' 2711 | // border: '1px solid blue' 2712 | 2713 | }); 2714 | 2715 | var pmouseX; 2716 | 2717 | dom.bind(gui.__resize_handle, 'mousedown', dragStart); 2718 | dom.bind(gui.__closeButton, 'mousedown', dragStart); 2719 | 2720 | gui.domElement.insertBefore(gui.__resize_handle, gui.domElement.firstElementChild); 2721 | 2722 | function dragStart(e) { 2723 | 2724 | e.preventDefault(); 2725 | 2726 | pmouseX = e.clientX; 2727 | 2728 | dom.addClass(gui.__closeButton, GUI.CLASS_DRAG); 2729 | dom.bind(window, 'mousemove', drag); 2730 | dom.bind(window, 'mouseup', dragStop); 2731 | 2732 | return false; 2733 | 2734 | } 2735 | 2736 | function drag(e) { 2737 | 2738 | e.preventDefault(); 2739 | 2740 | gui.width += pmouseX - e.clientX; 2741 | gui.onResize(); 2742 | pmouseX = e.clientX; 2743 | 2744 | return false; 2745 | 2746 | } 2747 | 2748 | function dragStop() { 2749 | 2750 | dom.removeClass(gui.__closeButton, GUI.CLASS_DRAG); 2751 | dom.unbind(window, 'mousemove', drag); 2752 | dom.unbind(window, 'mouseup', dragStop); 2753 | 2754 | } 2755 | 2756 | } 2757 | 2758 | function setWidth(gui, w) { 2759 | gui.domElement.style.width = w + 'px'; 2760 | // Auto placed save-rows are position fixed, so we have to 2761 | // set the width manually if we want it to bleed to the edge 2762 | if (gui.__save_row && gui.autoPlace) { 2763 | gui.__save_row.style.width = w + 'px'; 2764 | }if (gui.__closeButton) { 2765 | gui.__closeButton.style.width = w + 'px'; 2766 | } 2767 | } 2768 | 2769 | function getCurrentPreset(gui, useInitialValues) { 2770 | 2771 | var toReturn = {}; 2772 | 2773 | // For each object I'm remembering 2774 | common.each(gui.__rememberedObjects, function(val, index) { 2775 | 2776 | var saved_values = {}; 2777 | 2778 | // The controllers I've made for thcommon.isObject by property 2779 | var controller_map = 2780 | gui.__rememberedObjectIndecesToControllers[index]; 2781 | 2782 | // Remember each value for each property 2783 | common.each(controller_map, function(controller, property) { 2784 | saved_values[property] = useInitialValues ? controller.initialValue : controller.getValue(); 2785 | }); 2786 | 2787 | // Save the values for thcommon.isObject 2788 | toReturn[index] = saved_values; 2789 | 2790 | }); 2791 | 2792 | return toReturn; 2793 | 2794 | } 2795 | 2796 | function addPresetOption(gui, name, setSelected) { 2797 | var opt = document.createElement('option'); 2798 | opt.innerHTML = name; 2799 | opt.value = name; 2800 | gui.__preset_select.appendChild(opt); 2801 | if (setSelected) { 2802 | gui.__preset_select.selectedIndex = gui.__preset_select.length - 1; 2803 | } 2804 | } 2805 | 2806 | function setPresetSelectIndex(gui) { 2807 | for (var index = 0; index < gui.__preset_select.length; index++) { 2808 | if (gui.__preset_select[index].value == gui.preset) { 2809 | gui.__preset_select.selectedIndex = index; 2810 | } 2811 | } 2812 | } 2813 | 2814 | function markPresetModified(gui, modified) { 2815 | var opt = gui.__preset_select[gui.__preset_select.selectedIndex]; 2816 | // console.log('mark', modified, opt); 2817 | if (modified) { 2818 | opt.innerHTML = opt.value + "*"; 2819 | } else { 2820 | opt.innerHTML = opt.value; 2821 | } 2822 | } 2823 | 2824 | function updateDisplays(controllerArray) { 2825 | 2826 | 2827 | if (controllerArray.length != 0) { 2828 | 2829 | requestAnimationFrame(function() { 2830 | updateDisplays(controllerArray); 2831 | }); 2832 | 2833 | } 2834 | 2835 | common.each(controllerArray, function(c) { 2836 | c.updateDisplay(); 2837 | }); 2838 | 2839 | } 2840 | 2841 | return GUI; 2842 | 2843 | })(dat.utils.css, 2844 | "
\n\n Here's the new load parameter for your GUI's constructor:\n\n \n\n
\n\n Automatically save\n values to localStorage on exit.\n\n
The values saved to localStorage will\n override those passed to dat.GUI's constructor. This makes it\n easier to work incrementally, but localStorage is fragile,\n and your friends may not see the same values you do.\n \n
\n \n
\n\n
", 2845 | ".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save ul{margin-top:27px}.dg.a.has-save ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height 0.1s ease-out;-o-transition:height 0.1s ease-out;-moz-transition:height 0.1s ease-out;transition:height 0.1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li > *{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n", 2846 | dat.controllers.factory = (function (OptionController, NumberControllerBox, NumberControllerSlider, StringController, FunctionController, BooleanController, common) { 2847 | 2848 | return function(object, property) { 2849 | 2850 | var initialValue = object[property]; 2851 | 2852 | // Providing options? 2853 | if (common.isArray(arguments[2]) || common.isObject(arguments[2])) { 2854 | return new OptionController(object, property, arguments[2]); 2855 | } 2856 | 2857 | // Providing a map? 2858 | 2859 | if (common.isNumber(initialValue)) { 2860 | 2861 | if (common.isNumber(arguments[2]) && common.isNumber(arguments[3])) { 2862 | 2863 | // Has min and max. 2864 | return new NumberControllerSlider(object, property, arguments[2], arguments[3]); 2865 | 2866 | } else { 2867 | 2868 | return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3] }); 2869 | 2870 | } 2871 | 2872 | } 2873 | 2874 | if (common.isString(initialValue)) { 2875 | return new StringController(object, property); 2876 | } 2877 | 2878 | if (common.isFunction(initialValue)) { 2879 | return new FunctionController(object, property, ''); 2880 | } 2881 | 2882 | if (common.isBoolean(initialValue)) { 2883 | return new BooleanController(object, property); 2884 | } 2885 | 2886 | } 2887 | 2888 | })(dat.controllers.OptionController, 2889 | dat.controllers.NumberControllerBox, 2890 | dat.controllers.NumberControllerSlider, 2891 | dat.controllers.StringController = (function (Controller, dom, common) { 2892 | 2893 | /** 2894 | * @class Provides a text input to alter the string property of an object. 2895 | * 2896 | * @extends dat.controllers.Controller 2897 | * 2898 | * @param {Object} object The object to be manipulated 2899 | * @param {string} property The name of the property to be manipulated 2900 | * 2901 | * @member dat.controllers 2902 | */ 2903 | var StringController = function(object, property) { 2904 | 2905 | StringController.superclass.call(this, object, property); 2906 | 2907 | var _this = this; 2908 | 2909 | this.__input = document.createElement('input'); 2910 | this.__input.setAttribute('type', 'text'); 2911 | 2912 | dom.bind(this.__input, 'keyup', onChange); 2913 | dom.bind(this.__input, 'change', onChange); 2914 | dom.bind(this.__input, 'blur', onBlur); 2915 | dom.bind(this.__input, 'keydown', function(e) { 2916 | if (e.keyCode === 13) { 2917 | this.blur(); 2918 | } 2919 | }); 2920 | 2921 | 2922 | function onChange() { 2923 | _this.setValue(_this.__input.value); 2924 | } 2925 | 2926 | function onBlur() { 2927 | if (_this.__onFinishChange) { 2928 | _this.__onFinishChange.call(_this, _this.getValue()); 2929 | } 2930 | } 2931 | 2932 | this.updateDisplay(); 2933 | 2934 | this.domElement.appendChild(this.__input); 2935 | 2936 | }; 2937 | 2938 | StringController.superclass = Controller; 2939 | 2940 | common.extend( 2941 | 2942 | StringController.prototype, 2943 | Controller.prototype, 2944 | 2945 | { 2946 | 2947 | updateDisplay: function() { 2948 | // Stops the caret from moving on account of: 2949 | // keyup -> setValue -> updateDisplay 2950 | if (!dom.isActive(this.__input)) { 2951 | this.__input.value = this.getValue(); 2952 | } 2953 | return StringController.superclass.prototype.updateDisplay.call(this); 2954 | } 2955 | 2956 | } 2957 | 2958 | ); 2959 | 2960 | return StringController; 2961 | 2962 | })(dat.controllers.Controller, 2963 | dat.dom.dom, 2964 | dat.utils.common), 2965 | dat.controllers.FunctionController, 2966 | dat.controllers.BooleanController, 2967 | dat.utils.common), 2968 | dat.controllers.Controller, 2969 | dat.controllers.BooleanController, 2970 | dat.controllers.FunctionController, 2971 | dat.controllers.NumberControllerBox, 2972 | dat.controllers.NumberControllerSlider, 2973 | dat.controllers.OptionController, 2974 | dat.controllers.ColorController = (function (Controller, dom, Color, interpret, common) { 2975 | 2976 | var ColorController = function(object, property) { 2977 | 2978 | ColorController.superclass.call(this, object, property); 2979 | 2980 | this.__color = new Color(this.getValue()); 2981 | this.__temp = new Color(0); 2982 | 2983 | var _this = this; 2984 | 2985 | this.domElement = document.createElement('div'); 2986 | 2987 | dom.makeSelectable(this.domElement, false); 2988 | 2989 | this.__selector = document.createElement('div'); 2990 | this.__selector.className = 'selector'; 2991 | 2992 | this.__saturation_field = document.createElement('div'); 2993 | this.__saturation_field.className = 'saturation-field'; 2994 | 2995 | this.__field_knob = document.createElement('div'); 2996 | this.__field_knob.className = 'field-knob'; 2997 | this.__field_knob_border = '2px solid '; 2998 | 2999 | this.__hue_knob = document.createElement('div'); 3000 | this.__hue_knob.className = 'hue-knob'; 3001 | 3002 | this.__hue_field = document.createElement('div'); 3003 | this.__hue_field.className = 'hue-field'; 3004 | 3005 | this.__input = document.createElement('input'); 3006 | this.__input.type = 'text'; 3007 | this.__input_textShadow = '0 1px 1px '; 3008 | 3009 | dom.bind(this.__input, 'keydown', function(e) { 3010 | if (e.keyCode === 13) { // on enter 3011 | onBlur.call(this); 3012 | } 3013 | }); 3014 | 3015 | dom.bind(this.__input, 'blur', onBlur); 3016 | 3017 | dom.bind(this.__selector, 'mousedown', function(e) { 3018 | 3019 | dom 3020 | .addClass(this, 'drag') 3021 | .bind(window, 'mouseup', function(e) { 3022 | dom.removeClass(_this.__selector, 'drag'); 3023 | }); 3024 | 3025 | }); 3026 | 3027 | var value_field = document.createElement('div'); 3028 | 3029 | common.extend(this.__selector.style, { 3030 | width: '122px', 3031 | height: '102px', 3032 | padding: '3px', 3033 | backgroundColor: '#222', 3034 | boxShadow: '0px 1px 3px rgba(0,0,0,0.3)' 3035 | }); 3036 | 3037 | common.extend(this.__field_knob.style, { 3038 | position: 'absolute', 3039 | width: '12px', 3040 | height: '12px', 3041 | border: this.__field_knob_border + (this.__color.v < .5 ? '#fff' : '#000'), 3042 | boxShadow: '0px 1px 3px rgba(0,0,0,0.5)', 3043 | borderRadius: '12px', 3044 | zIndex: 1 3045 | }); 3046 | 3047 | common.extend(this.__hue_knob.style, { 3048 | position: 'absolute', 3049 | width: '15px', 3050 | height: '2px', 3051 | borderRight: '4px solid #fff', 3052 | zIndex: 1 3053 | }); 3054 | 3055 | common.extend(this.__saturation_field.style, { 3056 | width: '100px', 3057 | height: '100px', 3058 | border: '1px solid #555', 3059 | marginRight: '3px', 3060 | display: 'inline-block', 3061 | cursor: 'pointer' 3062 | }); 3063 | 3064 | common.extend(value_field.style, { 3065 | width: '100%', 3066 | height: '100%', 3067 | background: 'none' 3068 | }); 3069 | 3070 | linearGradient(value_field, 'top', 'rgba(0,0,0,0)', '#000'); 3071 | 3072 | common.extend(this.__hue_field.style, { 3073 | width: '15px', 3074 | height: '100px', 3075 | display: 'inline-block', 3076 | border: '1px solid #555', 3077 | cursor: 'ns-resize' 3078 | }); 3079 | 3080 | hueGradient(this.__hue_field); 3081 | 3082 | common.extend(this.__input.style, { 3083 | outline: 'none', 3084 | // width: '120px', 3085 | textAlign: 'center', 3086 | // padding: '4px', 3087 | // marginBottom: '6px', 3088 | color: '#fff', 3089 | border: 0, 3090 | fontWeight: 'bold', 3091 | textShadow: this.__input_textShadow + 'rgba(0,0,0,0.7)' 3092 | }); 3093 | 3094 | dom.bind(this.__saturation_field, 'mousedown', fieldDown); 3095 | dom.bind(this.__field_knob, 'mousedown', fieldDown); 3096 | 3097 | dom.bind(this.__hue_field, 'mousedown', function(e) { 3098 | setH(e); 3099 | dom.bind(window, 'mousemove', setH); 3100 | dom.bind(window, 'mouseup', unbindH); 3101 | }); 3102 | 3103 | function fieldDown(e) { 3104 | setSV(e); 3105 | // document.body.style.cursor = 'none'; 3106 | dom.bind(window, 'mousemove', setSV); 3107 | dom.bind(window, 'mouseup', unbindSV); 3108 | } 3109 | 3110 | function unbindSV() { 3111 | dom.unbind(window, 'mousemove', setSV); 3112 | dom.unbind(window, 'mouseup', unbindSV); 3113 | // document.body.style.cursor = 'default'; 3114 | } 3115 | 3116 | function onBlur() { 3117 | var i = interpret(this.value); 3118 | if (i !== false) { 3119 | _this.__color.__state = i; 3120 | _this.setValue(_this.__color.toOriginal()); 3121 | } else { 3122 | this.value = _this.__color.toString(); 3123 | } 3124 | } 3125 | 3126 | function unbindH() { 3127 | dom.unbind(window, 'mousemove', setH); 3128 | dom.unbind(window, 'mouseup', unbindH); 3129 | } 3130 | 3131 | this.__saturation_field.appendChild(value_field); 3132 | this.__selector.appendChild(this.__field_knob); 3133 | this.__selector.appendChild(this.__saturation_field); 3134 | this.__selector.appendChild(this.__hue_field); 3135 | this.__hue_field.appendChild(this.__hue_knob); 3136 | 3137 | this.domElement.appendChild(this.__input); 3138 | this.domElement.appendChild(this.__selector); 3139 | 3140 | this.updateDisplay(); 3141 | 3142 | function setSV(e) { 3143 | 3144 | e.preventDefault(); 3145 | 3146 | var w = dom.getWidth(_this.__saturation_field); 3147 | var o = dom.getOffset(_this.__saturation_field); 3148 | var s = (e.clientX - o.left + document.body.scrollLeft) / w; 3149 | var v = 1 - (e.clientY - o.top + document.body.scrollTop) / w; 3150 | 3151 | if (v > 1) v = 1; 3152 | else if (v < 0) v = 0; 3153 | 3154 | if (s > 1) s = 1; 3155 | else if (s < 0) s = 0; 3156 | 3157 | _this.__color.v = v; 3158 | _this.__color.s = s; 3159 | 3160 | _this.setValue(_this.__color.toOriginal()); 3161 | 3162 | 3163 | return false; 3164 | 3165 | } 3166 | 3167 | function setH(e) { 3168 | 3169 | e.preventDefault(); 3170 | 3171 | var s = dom.getHeight(_this.__hue_field); 3172 | var o = dom.getOffset(_this.__hue_field); 3173 | var h = 1 - (e.clientY - o.top + document.body.scrollTop) / s; 3174 | 3175 | if (h > 1) h = 1; 3176 | else if (h < 0) h = 0; 3177 | 3178 | _this.__color.h = h * 360; 3179 | 3180 | _this.setValue(_this.__color.toOriginal()); 3181 | 3182 | return false; 3183 | 3184 | } 3185 | 3186 | }; 3187 | 3188 | ColorController.superclass = Controller; 3189 | 3190 | common.extend( 3191 | 3192 | ColorController.prototype, 3193 | Controller.prototype, 3194 | 3195 | { 3196 | 3197 | updateDisplay: function() { 3198 | 3199 | var i = interpret(this.getValue()); 3200 | 3201 | if (i !== false) { 3202 | 3203 | var mismatch = false; 3204 | 3205 | // Check for mismatch on the interpreted value. 3206 | 3207 | common.each(Color.COMPONENTS, function(component) { 3208 | if (!common.isUndefined(i[component]) && 3209 | !common.isUndefined(this.__color.__state[component]) && 3210 | i[component] !== this.__color.__state[component]) { 3211 | mismatch = true; 3212 | return {}; // break 3213 | } 3214 | }, this); 3215 | 3216 | // If nothing diverges, we keep our previous values 3217 | // for statefulness, otherwise we recalculate fresh 3218 | if (mismatch) { 3219 | common.extend(this.__color.__state, i); 3220 | } 3221 | 3222 | } 3223 | 3224 | common.extend(this.__temp.__state, this.__color.__state); 3225 | 3226 | this.__temp.a = 1; 3227 | 3228 | var flip = (this.__color.v < .5 || this.__color.s > .5) ? 255 : 0; 3229 | var _flip = 255 - flip; 3230 | 3231 | common.extend(this.__field_knob.style, { 3232 | marginLeft: 100 * this.__color.s - 7 + 'px', 3233 | marginTop: 100 * (1 - this.__color.v) - 7 + 'px', 3234 | backgroundColor: this.__temp.toString(), 3235 | border: this.__field_knob_border + 'rgb(' + flip + ',' + flip + ',' + flip +')' 3236 | }); 3237 | 3238 | this.__hue_knob.style.marginTop = (1 - this.__color.h / 360) * 100 + 'px' 3239 | 3240 | this.__temp.s = 1; 3241 | this.__temp.v = 1; 3242 | 3243 | linearGradient(this.__saturation_field, 'left', '#fff', this.__temp.toString()); 3244 | 3245 | common.extend(this.__input.style, { 3246 | backgroundColor: this.__input.value = this.__color.toString(), 3247 | color: 'rgb(' + flip + ',' + flip + ',' + flip +')', 3248 | textShadow: this.__input_textShadow + 'rgba(' + _flip + ',' + _flip + ',' + _flip +',.7)' 3249 | }); 3250 | 3251 | } 3252 | 3253 | } 3254 | 3255 | ); 3256 | 3257 | var vendors = ['-moz-','-o-','-webkit-','-ms-','']; 3258 | 3259 | function linearGradient(elem, x, a, b) { 3260 | elem.style.background = ''; 3261 | common.each(vendors, function(vendor) { 3262 | elem.style.cssText += 'background: ' + vendor + 'linear-gradient('+x+', '+a+' 0%, ' + b + ' 100%); '; 3263 | }); 3264 | } 3265 | 3266 | function hueGradient(elem) { 3267 | elem.style.background = ''; 3268 | elem.style.cssText += 'background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);' 3269 | elem.style.cssText += 'background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);' 3270 | elem.style.cssText += 'background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);' 3271 | elem.style.cssText += 'background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);' 3272 | elem.style.cssText += 'background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);' 3273 | } 3274 | 3275 | 3276 | return ColorController; 3277 | 3278 | })(dat.controllers.Controller, 3279 | dat.dom.dom, 3280 | dat.color.Color = (function (interpret, math, toString, common) { 3281 | 3282 | var Color = function() { 3283 | 3284 | this.__state = interpret.apply(this, arguments); 3285 | 3286 | if (this.__state === false) { 3287 | throw 'Failed to interpret color arguments'; 3288 | } 3289 | 3290 | this.__state.a = this.__state.a || 1; 3291 | 3292 | 3293 | }; 3294 | 3295 | Color.COMPONENTS = ['r','g','b','h','s','v','hex','a']; 3296 | 3297 | common.extend(Color.prototype, { 3298 | 3299 | toString: function() { 3300 | return toString(this); 3301 | }, 3302 | 3303 | toOriginal: function() { 3304 | return this.__state.conversion.write(this); 3305 | } 3306 | 3307 | }); 3308 | 3309 | defineRGBComponent(Color.prototype, 'r', 2); 3310 | defineRGBComponent(Color.prototype, 'g', 1); 3311 | defineRGBComponent(Color.prototype, 'b', 0); 3312 | 3313 | defineHSVComponent(Color.prototype, 'h'); 3314 | defineHSVComponent(Color.prototype, 's'); 3315 | defineHSVComponent(Color.prototype, 'v'); 3316 | 3317 | Object.defineProperty(Color.prototype, 'a', { 3318 | 3319 | get: function() { 3320 | return this.__state.a; 3321 | }, 3322 | 3323 | set: function(v) { 3324 | this.__state.a = v; 3325 | } 3326 | 3327 | }); 3328 | 3329 | Object.defineProperty(Color.prototype, 'hex', { 3330 | 3331 | get: function() { 3332 | 3333 | if (!this.__state.space !== 'HEX') { 3334 | this.__state.hex = math.rgb_to_hex(this.r, this.g, this.b); 3335 | } 3336 | 3337 | return this.__state.hex; 3338 | 3339 | }, 3340 | 3341 | set: function(v) { 3342 | 3343 | this.__state.space = 'HEX'; 3344 | this.__state.hex = v; 3345 | 3346 | } 3347 | 3348 | }); 3349 | 3350 | function defineRGBComponent(target, component, componentHexIndex) { 3351 | 3352 | Object.defineProperty(target, component, { 3353 | 3354 | get: function() { 3355 | 3356 | if (this.__state.space === 'RGB') { 3357 | return this.__state[component]; 3358 | } 3359 | 3360 | recalculateRGB(this, component, componentHexIndex); 3361 | 3362 | return this.__state[component]; 3363 | 3364 | }, 3365 | 3366 | set: function(v) { 3367 | 3368 | if (this.__state.space !== 'RGB') { 3369 | recalculateRGB(this, component, componentHexIndex); 3370 | this.__state.space = 'RGB'; 3371 | } 3372 | 3373 | this.__state[component] = v; 3374 | 3375 | } 3376 | 3377 | }); 3378 | 3379 | } 3380 | 3381 | function defineHSVComponent(target, component) { 3382 | 3383 | Object.defineProperty(target, component, { 3384 | 3385 | get: function() { 3386 | 3387 | if (this.__state.space === 'HSV') 3388 | return this.__state[component]; 3389 | 3390 | recalculateHSV(this); 3391 | 3392 | return this.__state[component]; 3393 | 3394 | }, 3395 | 3396 | set: function(v) { 3397 | 3398 | if (this.__state.space !== 'HSV') { 3399 | recalculateHSV(this); 3400 | this.__state.space = 'HSV'; 3401 | } 3402 | 3403 | this.__state[component] = v; 3404 | 3405 | } 3406 | 3407 | }); 3408 | 3409 | } 3410 | 3411 | function recalculateRGB(color, component, componentHexIndex) { 3412 | 3413 | if (color.__state.space === 'HEX') { 3414 | 3415 | color.__state[component] = math.component_from_hex(color.__state.hex, componentHexIndex); 3416 | 3417 | } else if (color.__state.space === 'HSV') { 3418 | 3419 | common.extend(color.__state, math.hsv_to_rgb(color.__state.h, color.__state.s, color.__state.v)); 3420 | 3421 | } else { 3422 | 3423 | throw 'Corrupted color state'; 3424 | 3425 | } 3426 | 3427 | } 3428 | 3429 | function recalculateHSV(color) { 3430 | 3431 | var result = math.rgb_to_hsv(color.r, color.g, color.b); 3432 | 3433 | common.extend(color.__state, 3434 | { 3435 | s: result.s, 3436 | v: result.v 3437 | } 3438 | ); 3439 | 3440 | if (!common.isNaN(result.h)) { 3441 | color.__state.h = result.h; 3442 | } else if (common.isUndefined(color.__state.h)) { 3443 | color.__state.h = 0; 3444 | } 3445 | 3446 | } 3447 | 3448 | return Color; 3449 | 3450 | })(dat.color.interpret, 3451 | dat.color.math = (function () { 3452 | 3453 | var tmpComponent; 3454 | 3455 | return { 3456 | 3457 | hsv_to_rgb: function(h, s, v) { 3458 | 3459 | var hi = Math.floor(h / 60) % 6; 3460 | 3461 | var f = h / 60 - Math.floor(h / 60); 3462 | var p = v * (1.0 - s); 3463 | var q = v * (1.0 - (f * s)); 3464 | var t = v * (1.0 - ((1.0 - f) * s)); 3465 | var c = [ 3466 | [v, t, p], 3467 | [q, v, p], 3468 | [p, v, t], 3469 | [p, q, v], 3470 | [t, p, v], 3471 | [v, p, q] 3472 | ][hi]; 3473 | 3474 | return { 3475 | r: c[0] * 255, 3476 | g: c[1] * 255, 3477 | b: c[2] * 255 3478 | }; 3479 | 3480 | }, 3481 | 3482 | rgb_to_hsv: function(r, g, b) { 3483 | 3484 | var min = Math.min(r, g, b), 3485 | max = Math.max(r, g, b), 3486 | delta = max - min, 3487 | h, s; 3488 | 3489 | if (max != 0) { 3490 | s = delta / max; 3491 | } else { 3492 | return { 3493 | h: NaN, 3494 | s: 0, 3495 | v: 0 3496 | }; 3497 | } 3498 | 3499 | if (r == max) { 3500 | h = (g - b) / delta; 3501 | } else if (g == max) { 3502 | h = 2 + (b - r) / delta; 3503 | } else { 3504 | h = 4 + (r - g) / delta; 3505 | } 3506 | h /= 6; 3507 | if (h < 0) { 3508 | h += 1; 3509 | } 3510 | 3511 | return { 3512 | h: h * 360, 3513 | s: s, 3514 | v: max / 255 3515 | }; 3516 | }, 3517 | 3518 | rgb_to_hex: function(r, g, b) { 3519 | var hex = this.hex_with_component(0, 2, r); 3520 | hex = this.hex_with_component(hex, 1, g); 3521 | hex = this.hex_with_component(hex, 0, b); 3522 | return hex; 3523 | }, 3524 | 3525 | component_from_hex: function(hex, componentIndex) { 3526 | return (hex >> (componentIndex * 8)) & 0xFF; 3527 | }, 3528 | 3529 | hex_with_component: function(hex, componentIndex, value) { 3530 | return value << (tmpComponent = componentIndex * 8) | (hex & ~ (0xFF << tmpComponent)); 3531 | } 3532 | 3533 | } 3534 | 3535 | })(), 3536 | dat.color.toString, 3537 | dat.utils.common), 3538 | dat.color.interpret, 3539 | dat.utils.common), 3540 | dat.utils.requestAnimationFrame = (function () { 3541 | 3542 | /** 3543 | * requirejs version of Paul Irish's RequestAnimationFrame 3544 | * http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 3545 | */ 3546 | 3547 | return window.webkitRequestAnimationFrame || 3548 | window.mozRequestAnimationFrame || 3549 | window.oRequestAnimationFrame || 3550 | window.msRequestAnimationFrame || 3551 | function(callback, element) { 3552 | 3553 | window.setTimeout(callback, 1000 / 60); 3554 | 3555 | }; 3556 | })(), 3557 | dat.dom.CenteredDiv = (function (dom, common) { 3558 | 3559 | 3560 | var CenteredDiv = function() { 3561 | 3562 | this.backgroundElement = document.createElement('div'); 3563 | common.extend(this.backgroundElement.style, { 3564 | backgroundColor: 'rgba(0,0,0,0.8)', 3565 | top: 0, 3566 | left: 0, 3567 | display: 'none', 3568 | zIndex: '1000', 3569 | opacity: 0, 3570 | WebkitTransition: 'opacity 0.2s linear' 3571 | }); 3572 | 3573 | dom.makeFullscreen(this.backgroundElement); 3574 | this.backgroundElement.style.position = 'fixed'; 3575 | 3576 | this.domElement = document.createElement('div'); 3577 | common.extend(this.domElement.style, { 3578 | position: 'fixed', 3579 | display: 'none', 3580 | zIndex: '1001', 3581 | opacity: 0, 3582 | WebkitTransition: '-webkit-transform 0.2s ease-out, opacity 0.2s linear' 3583 | }); 3584 | 3585 | 3586 | document.body.appendChild(this.backgroundElement); 3587 | document.body.appendChild(this.domElement); 3588 | 3589 | var _this = this; 3590 | dom.bind(this.backgroundElement, 'click', function() { 3591 | _this.hide(); 3592 | }); 3593 | 3594 | 3595 | }; 3596 | 3597 | CenteredDiv.prototype.show = function() { 3598 | 3599 | var _this = this; 3600 | 3601 | 3602 | 3603 | this.backgroundElement.style.display = 'block'; 3604 | 3605 | this.domElement.style.display = 'block'; 3606 | this.domElement.style.opacity = 0; 3607 | // this.domElement.style.top = '52%'; 3608 | this.domElement.style.webkitTransform = 'scale(1.1)'; 3609 | 3610 | this.layout(); 3611 | 3612 | common.defer(function() { 3613 | _this.backgroundElement.style.opacity = 1; 3614 | _this.domElement.style.opacity = 1; 3615 | _this.domElement.style.webkitTransform = 'scale(1)'; 3616 | }); 3617 | 3618 | }; 3619 | 3620 | CenteredDiv.prototype.hide = function() { 3621 | 3622 | var _this = this; 3623 | 3624 | var hide = function() { 3625 | 3626 | _this.domElement.style.display = 'none'; 3627 | _this.backgroundElement.style.display = 'none'; 3628 | 3629 | dom.unbind(_this.domElement, 'webkitTransitionEnd', hide); 3630 | dom.unbind(_this.domElement, 'transitionend', hide); 3631 | dom.unbind(_this.domElement, 'oTransitionEnd', hide); 3632 | 3633 | }; 3634 | 3635 | dom.bind(this.domElement, 'webkitTransitionEnd', hide); 3636 | dom.bind(this.domElement, 'transitionend', hide); 3637 | dom.bind(this.domElement, 'oTransitionEnd', hide); 3638 | 3639 | this.backgroundElement.style.opacity = 0; 3640 | // this.domElement.style.top = '48%'; 3641 | this.domElement.style.opacity = 0; 3642 | this.domElement.style.webkitTransform = 'scale(1.1)'; 3643 | 3644 | }; 3645 | 3646 | CenteredDiv.prototype.layout = function() { 3647 | this.domElement.style.left = window.innerWidth/2 - dom.getWidth(this.domElement) / 2 + 'px'; 3648 | this.domElement.style.top = window.innerHeight/2 - dom.getHeight(this.domElement) / 2 + 'px'; 3649 | }; 3650 | 3651 | function lockScroll(e) { 3652 | console.log(e); 3653 | } 3654 | 3655 | return CenteredDiv; 3656 | 3657 | })(dat.dom.dom, 3658 | dat.utils.common), 3659 | dat.dom.dom, 3660 | dat.utils.common); -------------------------------------------------------------------------------- /lib/detector.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * @author mr.doob / http://mrdoob.com/ 4 | */ 5 | 6 | var Detector = { 7 | 8 | canvas: !! window.CanvasRenderingContext2D, 9 | webgl: ( function () { try { return !! window.WebGLRenderingContext && !! document.createElement( 'canvas' ).getContext( 'experimental-webgl' ); } catch( e ) { return false; } } )(), 10 | workers: !! window.Worker, 11 | fileapi: window.File && window.FileReader && window.FileList && window.Blob, 12 | 13 | getWebGLErrorMessage: function () { 14 | 15 | var element = document.createElement( 'div' ); 16 | element.id = 'webgl-error-message'; 17 | element.style.fontFamily = 'monospace'; 18 | element.style.fontSize = '13px'; 19 | element.style.fontWeight = 'normal'; 20 | element.style.textAlign = 'center'; 21 | element.style.background = '#fff'; 22 | element.style.color = '#000'; 23 | element.style.padding = '1.5em'; 24 | element.style.width = '400px'; 25 | element.style.margin = '5em auto 0'; 26 | 27 | if ( ! this.webgl ) { 28 | 29 | element.innerHTML = window.WebGLRenderingContext ? [ 30 | 'Your graphics card does not seem to support WebGL.
', 31 | 'Find out how to get it here.' 32 | ].join( '\n' ) : [ 33 | 'Your browser does not seem to support WebGL.
', 34 | 'Find out how to get it here.' 35 | ].join( '\n' ); 36 | 37 | } 38 | 39 | return element; 40 | 41 | }, 42 | 43 | addGetWebGLMessage: function ( parameters ) { 44 | 45 | var parent, id, element; 46 | 47 | parameters = parameters || {}; 48 | 49 | parent = parameters.parent !== undefined ? parameters.parent : document.body; 50 | id = parameters.id !== undefined ? parameters.id : 'oldie'; 51 | 52 | element = Detector.getWebGLErrorMessage(); 53 | element.id = id; 54 | 55 | parent.appendChild( element ); 56 | 57 | } 58 | }; -------------------------------------------------------------------------------- /lib/stats.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | * @url https://github.com/mrdoob/stats.js 4 | */ 5 | 6 | var Stats = function () { 7 | 8 | var startTime = Date.now(), prevTime = startTime; 9 | var ms = 0, msMin = Infinity, msMax = 0; 10 | var fps = 0, fpsMin = Infinity, fpsMax = 0; 11 | var frames = 0, mode = 0; 12 | 13 | var container = document.createElement( 'div' ); 14 | container.id = 'stats'; 15 | container.addEventListener( 'mousedown', function ( event ) { event.preventDefault(); setMode( ++ mode % 2 ) }, false ); 16 | container.style.cssText = 'width:80px;opacity:0.9;cursor:pointer'; 17 | 18 | var fpsDiv = document.createElement( 'div' ); 19 | fpsDiv.id = 'fps'; 20 | fpsDiv.style.cssText = 'padding:0 0 3px 3px;text-align:left;background-color:#002'; 21 | container.appendChild( fpsDiv ); 22 | 23 | var fpsText = document.createElement( 'div' ); 24 | fpsText.id = 'fpsText'; 25 | fpsText.style.cssText = 'color:#0ff;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px'; 26 | fpsText.innerHTML = 'FPS'; 27 | fpsDiv.appendChild( fpsText ); 28 | 29 | var fpsGraph = document.createElement( 'div' ); 30 | fpsGraph.id = 'fpsGraph'; 31 | fpsGraph.style.cssText = 'position:relative;width:74px;height:30px;background-color:#0ff'; 32 | fpsDiv.appendChild( fpsGraph ); 33 | 34 | while ( fpsGraph.children.length < 74 ) { 35 | 36 | var bar = document.createElement( 'span' ); 37 | bar.style.cssText = 'width:1px;height:30px;float:left;background-color:#113'; 38 | fpsGraph.appendChild( bar ); 39 | 40 | } 41 | 42 | var msDiv = document.createElement( 'div' ); 43 | msDiv.id = 'ms'; 44 | msDiv.style.cssText = 'padding:0 0 3px 3px;text-align:left;background-color:#020;display:none'; 45 | container.appendChild( msDiv ); 46 | 47 | var msText = document.createElement( 'div' ); 48 | msText.id = 'msText'; 49 | msText.style.cssText = 'color:#0f0;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px'; 50 | msText.innerHTML = 'MS'; 51 | msDiv.appendChild( msText ); 52 | 53 | var msGraph = document.createElement( 'div' ); 54 | msGraph.id = 'msGraph'; 55 | msGraph.style.cssText = 'position:relative;width:74px;height:30px;background-color:#0f0'; 56 | msDiv.appendChild( msGraph ); 57 | 58 | while ( msGraph.children.length < 74 ) { 59 | 60 | var bar = document.createElement( 'span' ); 61 | bar.style.cssText = 'width:1px;height:30px;float:left;background-color:#131'; 62 | msGraph.appendChild( bar ); 63 | 64 | } 65 | 66 | var setMode = function ( value ) { 67 | 68 | mode = value; 69 | 70 | switch ( mode ) { 71 | 72 | case 0: 73 | fpsDiv.style.display = 'block'; 74 | msDiv.style.display = 'none'; 75 | break; 76 | case 1: 77 | fpsDiv.style.display = 'none'; 78 | msDiv.style.display = 'block'; 79 | break; 80 | } 81 | 82 | } 83 | 84 | var updateGraph = function ( dom, value ) { 85 | 86 | var child = dom.appendChild( dom.firstChild ); 87 | child.style.height = value + 'px'; 88 | 89 | } 90 | 91 | return { 92 | 93 | REVISION: 11, 94 | 95 | domElement: container, 96 | 97 | setMode: setMode, 98 | 99 | begin: function () { 100 | 101 | startTime = Date.now(); 102 | 103 | }, 104 | 105 | end: function () { 106 | 107 | var time = Date.now(); 108 | 109 | ms = time - startTime; 110 | msMin = Math.min( msMin, ms ); 111 | msMax = Math.max( msMax, ms ); 112 | 113 | msText.textContent = ms + ' MS (' + msMin + '-' + msMax + ')'; 114 | updateGraph( msGraph, Math.min( 30, 30 - ( ms / 200 ) * 30 ) ); 115 | 116 | frames ++; 117 | 118 | if ( time > prevTime + 1000 ) { 119 | 120 | fps = Math.round( ( frames * 1000 ) / ( time - prevTime ) ); 121 | fpsMin = Math.min( fpsMin, fps ); 122 | fpsMax = Math.max( fpsMax, fps ); 123 | 124 | fpsText.textContent = fps + ' FPS (' + fpsMin + '-' + fpsMax + ')'; 125 | updateGraph( fpsGraph, Math.min( 30, 30 - ( fps / 100 ) * 30 ) ); 126 | 127 | prevTime = time; 128 | frames = 0; 129 | 130 | } 131 | 132 | return time; 133 | 134 | }, 135 | 136 | update: function () { 137 | 138 | startTime = this.end(); 139 | 140 | } 141 | 142 | } 143 | 144 | }; -------------------------------------------------------------------------------- /threejs-layer.js: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright 2012 Ubiabs 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | **/ 16 | 17 | /** 18 | * Base on the CanvasLayer utility library: 19 | * https://google-maps-utility-library-v3.googlecode.com/svn/trunk/canvaslayer/docs/reference.html 20 | */ 21 | 22 | /** 23 | * Creates a new Three.js layer. 24 | * @param {Object} options Options passed to initialize method. 25 | * @param {Function} callback Callback to execute when map was updated. 26 | */ 27 | function ThreejsLayer(options, callback) { 28 | this.bindAll(); 29 | this.callback = callback; 30 | this.initialize(options || {}); 31 | 32 | this.firstRun = true; 33 | 34 | if (options.map) { 35 | this.setMap(options.map); 36 | } 37 | } 38 | 39 | /** 40 | * Extend OverlayView. 41 | * @see https://developers.google.com/maps/documentation/javascript/reference#OverlayView 42 | * @type {google.maps.OverlayView} 43 | */ 44 | ThreejsLayer.prototype = new google.maps.OverlayView(); 45 | 46 | /** 47 | * Get browser specifiv CSS transform property. 48 | * 49 | * @return {String} The property. 50 | */ 51 | ThreejsLayer.CSS_TRANSFORM = (function () { 52 | var div = document.createElement('div'); 53 | var props = [ 54 | 'transform', 55 | 'WebkitTransform', 56 | 'MozTransform', 57 | 'OTransform', 58 | 'msTransform' 59 | ]; 60 | 61 | for (var i = 0; i < props.length; i++) { 62 | var prop = props[i]; 63 | if (div.style[prop] !== undefined) { 64 | return prop; 65 | } 66 | } 67 | 68 | return props[0]; 69 | })(); 70 | 71 | /** 72 | * Bind all methods to the instance. 73 | */ 74 | ThreejsLayer.prototype.bindAll = function () { 75 | var instance = this; 76 | 77 | function bind(name) { 78 | var method = instance[name]; 79 | if (typeof method != "function") { 80 | return; 81 | } 82 | instance[name] = function () { 83 | return method.apply(instance, arguments); 84 | }; 85 | } 86 | 87 | for (var all in instance) { 88 | bind(all); 89 | } 90 | }; 91 | 92 | /** 93 | * Initialize the layer with the given options. 94 | * @param {Object} options - Options 95 | */ 96 | ThreejsLayer.prototype.initialize = function (options) { 97 | 98 | this.options = options; 99 | 100 | this.camera = new THREE.OrthographicCamera(0, 256, 256, 0, -3000, 3000); 101 | this.camera.position.z = 1000; 102 | this.renderertype = options.renderertype || ''; 103 | this.scene = new THREE.Scene(); 104 | 105 | this.webgl = (function () { 106 | try { 107 | var canvas = document.createElement('canvas'); 108 | return !!window.WebGLRenderingContext && (canvas.getContext('webgl') || canvas.getContext('experimental-webgl')); 109 | } catch (e) { 110 | return false; 111 | } 112 | })(); 113 | 114 | if (this.renderertype == 'Canvas' || !this.webgl) { 115 | this.renderer = new THREE.CanvasRenderer({ 116 | alpha: true, 117 | clearColor: 0x000000, 118 | clearAlpha: 0 119 | }); 120 | this.renderertype = 'Canvas'; 121 | } else { 122 | this.renderer = new THREE.WebGLRenderer({ 123 | alpha: true, 124 | clearColor: 0x000000, 125 | clearAlpha: 0 126 | }); 127 | this.renderertype = 'WebGL'; 128 | } 129 | 130 | this.canvas = this.renderer.domElement; 131 | }; 132 | 133 | /** 134 | * This method is called once after setMap() is called with a valid map. 135 | * @see https://developers.google.com/maps/documentation/javascript/reference#OverlayView 136 | */ 137 | ThreejsLayer.prototype.onAdd = function () { 138 | 139 | this.map = this.getMap(); 140 | 141 | this.getPanes().overlayLayer.appendChild(this.canvas); 142 | 143 | this.changeHandler = google.maps.event.addListener( 144 | this.map, 145 | 'bounds_changed', 146 | this.draw 147 | ); 148 | 149 | this.draw(); 150 | }; 151 | 152 | /** 153 | * This method is called once following a call to setMap(null). 154 | * @see https://developers.google.com/maps/documentation/javascript/reference#OverlayView 155 | */ 156 | ThreejsLayer.prototype.onRemove = function () { 157 | 158 | if (!this.map) { 159 | return; 160 | } 161 | 162 | this.map = null; 163 | 164 | this.canvas.parentElement.removeChild(this.canvas); 165 | 166 | if (this.changeHandler) { 167 | google.maps.event.removeListener(this.changeHandler); 168 | this.changeHandler = null; 169 | } 170 | }; 171 | 172 | /** 173 | * This method is called when the layer postion needs an update. 174 | */ 175 | ThreejsLayer.prototype.draw = function () { 176 | 177 | if (!this.map) { 178 | return; 179 | } 180 | 181 | var bounds = this.map.getBounds(); 182 | 183 | var topLeft = new google.maps.LatLng( 184 | bounds.getNorthEast().lat(), 185 | bounds.getSouthWest().lng() 186 | ); 187 | 188 | var projection = this.getProjection(); 189 | var point = projection.fromLatLngToDivPixel(topLeft); 190 | var width = projection.getWorldWidth(); 191 | var center = (this.map.getCenter().lng() % 360 + 360) % 360; 192 | 193 | if ( 194 | bounds.getSouthWest().lng() == -180 && 195 | bounds.getNorthEast().lng() == 180 && 196 | center < 180 197 | ) { 198 | point.x -= width; 199 | } 200 | 201 | this.canvas.style[ThreejsLayer.CSS_TRANSFORM] = 'translate(' + 202 | Math.round(point.x) + 'px,' + 203 | Math.round(point.y) + 'px)'; 204 | 205 | if (this.firstRun) { 206 | this.firstRun = false; 207 | 208 | if (this.callback) { 209 | this.callback(this); 210 | } 211 | } 212 | 213 | this.update(); 214 | }; 215 | 216 | /** 217 | * Call this method when the layer's size changed. 218 | */ 219 | ThreejsLayer.prototype.resize = function () { 220 | 221 | if (!this.map) { 222 | return; 223 | } 224 | 225 | var div = this.map.getDiv(), 226 | width = div.clientWidth, 227 | height = div.clientHeight; 228 | 229 | if (width == this.width && height == this.height) { 230 | return; 231 | } 232 | 233 | this.width = width; 234 | this.height = height; 235 | 236 | this.renderer.setSize(width, height); 237 | this.update(); 238 | }; 239 | 240 | /** 241 | * This method is called when the Three.js camera needs an update. 242 | */ 243 | ThreejsLayer.prototype.update = function () { 244 | 245 | var projection = this.map.getProjection(), 246 | zoom, scale, offset, bounds, topLeft; 247 | 248 | if (!projection) { 249 | return; 250 | } 251 | 252 | bounds = this.map.getBounds(); 253 | 254 | topLeft = new google.maps.LatLng( 255 | bounds.getSouthWest().lat(), 256 | bounds.getSouthWest().lng() 257 | ); 258 | 259 | zoom = this.map.getZoom(); 260 | scale = Math.pow(2, zoom); 261 | offset = projection.fromLatLngToPoint(topLeft); 262 | 263 | if ( 264 | bounds.getCenter().lng() < 265 | bounds.getSouthWest().lng() 266 | ) { 267 | offset.x -= 256; 268 | } 269 | 270 | this.resize(); 271 | 272 | this.camera.position.x = offset.x; 273 | this.camera.position.y = 255 - offset.y; 274 | 275 | this.camera.scale.x = this.width / 256 / scale; 276 | this.camera.scale.y = this.height / 256 / scale; 277 | 278 | this.render(); 279 | }; 280 | 281 | /** 282 | * Renders the layer deferred. 283 | */ 284 | ThreejsLayer.prototype.render = function () { 285 | cancelAnimationFrame(this.animationFrame); 286 | this.animationFrame = requestAnimationFrame(this.deferredRender); 287 | }; 288 | 289 | /** 290 | * The final rendering. If you have passed a function to `options.render` 291 | * it will be executed here. 292 | */ 293 | ThreejsLayer.prototype.deferredRender = function () { 294 | if (typeof this.options.render === false) { 295 | return; 296 | } else if (typeof this.options.render == "function") { 297 | this.options.render(); 298 | } else { 299 | this.renderer.render(this.scene, this.camera); 300 | } 301 | }; 302 | 303 | /** 304 | * Shortcut method to add new geometry to the scene. 305 | * @param {Geometry} geometry The Three.js geometry to add. 306 | */ 307 | ThreejsLayer.prototype.add = function (geometry) { 308 | this.scene.add(geometry); 309 | }; 310 | 311 | /** 312 | * Helper method to convert for LatLng to vertex. 313 | * @param {google.maps.LatLng} latLng - The LatLng to convert. 314 | * @return {THREE.Vector3} The resulting vertex. 315 | */ 316 | ThreejsLayer.prototype.fromLatLngToVertex = function (latLng) { 317 | var projection = this.map.getProjection(), 318 | point = projection.fromLatLngToPoint(latLng), 319 | vertex = new THREE.Vector3(); 320 | 321 | vertex.x = point.x; 322 | vertex.y = 255 - point.y; 323 | vertex.z = 0; 324 | 325 | return vertex; 326 | }; --------------------------------------------------------------------------------