Advertisement
Guest User

Untitled

a guest
May 21st, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. var time=0;
  2. // display weather data
  3. jetscope.timeline.addHandler('precipitation', function (event) {
  4. //layers['Precipitation'].clearLayers();
  5. //var features = [];
  6.  
  7. console.log(time);
  8. console.log(event.time);
  9. if(event.time!=time)
  10. {
  11. layers['Precipitation'].clearLayers();
  12. time = event.time;
  13. }
  14. else
  15. {
  16. console.log(event);
  17. console.log(event.time);
  18.  
  19. switch (event.action) {
  20. case 'update': {
  21. //features.append(event.features);
  22. //console.log(event);
  23.  
  24. L.geoJSON(event.features, {
  25. style: function(feature) {
  26. // console.log("-----");
  27. // console.log(feature.geometry.level);
  28. // console.log(feature.geometries);
  29.  
  30.  
  31. switch (feature.geometry.level) {
  32. case 1:
  33. {
  34. console.log("1");
  35. return {
  36. color: "#0000FF",
  37. fillColor: "#0000FF",
  38. fillOpacity: 1,
  39. weight: 1
  40. }
  41. }
  42. case 2:
  43. {
  44. console.log("2");
  45. return {
  46. color: "#000FF0",
  47. fillColor: "#000FF0",
  48. fillOpacity: 1,
  49. weight: 1
  50.  
  51. };
  52. }
  53. case 3:
  54. {
  55. console.log("3");
  56. return {
  57. color: "#00FF00",
  58. fillColor: "#00FF00",
  59. fillOpacity: 1,
  60. weight: 1
  61. };
  62. }
  63. case 4:
  64. {
  65. console.log("4");
  66. return {
  67. color: "#0FF000",
  68. fillColor: "#0FF000",
  69. fillOpacity: 1,
  70. weight: 1
  71. };
  72. }
  73. default:
  74. {
  75. console.log("5");
  76. return {
  77. color: "#FF0000",
  78. fillColor: "#FF0000",
  79. fillOpacity: 1,
  80. weight: 1
  81.  
  82. };
  83. }
  84. }
  85. }
  86. }).addTo(layers['Precipitation']);
  87.  
  88.  
  89. //L.geoJSON(event.features).addTo(layers['Precipitation']);
  90. //console.log(event.features.type);
  91. //for (var i=0; i< event.features.coordinates.length;i++)
  92. //{
  93. // console.log(event.features.coordinates[i].latLng);
  94. //}
  95.  
  96. }
  97. case 'remove': {
  98. // TBD
  99. //layers['Precipitation'].clearLayers();
  100.  
  101. break;
  102. }
  103. }
  104.  
  105. }
  106.  
  107. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement