@vidro/map-handler 1.1.3 → 1.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. package/README.md +39 -91
  2. package/dist/map-handler.js +1 -1
  3. package/examples/full/cachedToken.dat +1 -1
  4. package/examples/full/cachedTokenData.dat +1 -1
  5. package/examples/full/index.php +9 -78
  6. package/examples/full/tester.js +12 -177
  7. package/examples/serverLess/dist/index.23420cfa.js +117 -120
  8. package/examples/serverLess/dist/index.23420cfa.js.map +1 -1
  9. package/examples/serverLess/dist/index.html +1 -38
  10. package/examples/serverLess/index.html +1 -2
  11. package/examples/serverLess/main.js +2 -2
  12. package/examples/simple/index.html +1 -1
  13. package/examples/taigua/index.html +46 -8
  14. package/examples/taigua/main.js +467 -18
  15. package/examples/vidromap/index.php +1 -1
  16. package/package.json +1 -1
  17. package/src/index.js +178 -318
  18. package/examples/externalwms/index.js +0 -20
  19. package/examples/externalwms/index.php +0 -88
  20. package/examples/integration/tool/css/dist/home.css.min.css +0 -0
  21. package/examples/integration/tool/css/dist/home.min.css +0 -1
  22. package/examples/integration/tool/css/dist/home.min.css.map +0 -10
  23. package/examples/integration/tool/css/dist/style-login.css.min.css +0 -0
  24. package/examples/integration/tool/css/dist/style-login.min.css +0 -1
  25. package/examples/integration/tool/css/dist/style-login.min.css.map +0 -10
  26. package/examples/integration/tool/css/dist/style.css.min.css +0 -0
  27. package/examples/integration/tool/css/dist/style.min.css +0 -1
  28. package/examples/integration/tool/css/dist/style.min.css.map +0 -23
  29. package/examples/integration/tool/css/master/_bottom-sheet-2.scss +0 -103
  30. package/examples/integration/tool/css/master/_bottom-sheet.scss +0 -142
  31. package/examples/integration/tool/css/master/_colors.scss +0 -35
  32. package/examples/integration/tool/css/master/_dropdown-form.scss +0 -167
  33. package/examples/integration/tool/css/master/_forms.scss +0 -416
  34. package/examples/integration/tool/css/master/_header.scss +0 -134
  35. package/examples/integration/tool/css/master/_menu-toc.scss +0 -135
  36. package/examples/integration/tool/css/master/_menu-tools.scss +0 -187
  37. package/examples/integration/tool/css/master/_mixins.scss +0 -42
  38. package/examples/integration/tool/css/master/_notifyjs.scss +0 -39
  39. package/examples/integration/tool/css/master/_ol-map-controls.scss +0 -117
  40. package/examples/integration/tool/css/master/_simplelightbox.scss +0 -287
  41. package/examples/integration/tool/css/master/_toc-config.scss +0 -28
  42. package/examples/integration/tool/css/master/_toc-layouts.scss +0 -173
  43. package/examples/integration/tool/css/master/_tooltip.scss +0 -34
  44. package/examples/integration/tool/css/master/home.scss +0 -266
  45. package/examples/integration/tool/css/master/style-login.scss +0 -240
  46. package/examples/integration/tool/css/master/style.scss +0 -166
  47. package/examples/integration/tool/img/doc-gallery-placeholder.svg +0 -3
  48. package/examples/integration/tool/img/home/ic_calendar-clock.svg +0 -1
  49. package/examples/integration/tool/img/home/ic_caret-down.svg +0 -1
  50. package/examples/integration/tool/img/home/ic_cog.svg +0 -1
  51. package/examples/integration/tool/img/home/ic_marker.svg +0 -1
  52. package/examples/integration/tool/img/home/ic_play-circle.svg +0 -1
  53. package/examples/integration/tool/img/home/ic_power.svg +0 -1
  54. package/examples/integration/tool/img/home/ic_squares.svg +0 -1
  55. package/examples/integration/tool/img/home/ic_user-pointer.svg +0 -1
  56. package/examples/integration/tool/img/home/ic_user-square.svg +0 -1
  57. package/examples/integration/tool/img/home/logo_footer.svg +0 -1
  58. package/examples/integration/tool/img/ic/accessControl.svg +0 -1
  59. package/examples/integration/tool/img/ic/account-location.svg +0 -1
  60. package/examples/integration/tool/img/ic/actionDelete.svg +0 -64
  61. package/examples/integration/tool/img/ic/actionOpen.svg +0 -64
  62. package/examples/integration/tool/img/ic/addFile.svg +0 -100
  63. package/examples/integration/tool/img/ic/addFile_off.svg +0 -102
  64. package/examples/integration/tool/img/ic/arrow-left.svg +0 -1
  65. package/examples/integration/tool/img/ic/arrow-right-drop-circle-outline.svg +0 -1
  66. package/examples/integration/tool/img/ic/bt_add_photo.svg +0 -3
  67. package/examples/integration/tool/img/ic/bug.svg +0 -1
  68. package/examples/integration/tool/img/ic/caret-down-bottomsheet.svg +0 -3
  69. package/examples/integration/tool/img/ic/checkbox-blank-outline-grey.svg +0 -8
  70. package/examples/integration/tool/img/ic/checkbox-blank-outline-white.svg +0 -8
  71. package/examples/integration/tool/img/ic/checkbox-blank-outline.svg +0 -1
  72. package/examples/integration/tool/img/ic/checkbox-marked-outline-grey.svg +0 -8
  73. package/examples/integration/tool/img/ic/checkbox-marked-outline-white.svg +0 -8
  74. package/examples/integration/tool/img/ic/checkbox-marked-outline.svg +0 -1
  75. package/examples/integration/tool/img/ic/chevron-down-grey.svg +0 -7
  76. package/examples/integration/tool/img/ic/chevron-down-white.svg +0 -7
  77. package/examples/integration/tool/img/ic/chevron-down.svg +0 -1
  78. package/examples/integration/tool/img/ic/chevron-right-grey.svg +0 -7
  79. package/examples/integration/tool/img/ic/chevron-right-white.svg +0 -7
  80. package/examples/integration/tool/img/ic/chevron-right.svg +0 -1
  81. package/examples/integration/tool/img/ic/comment-text-outline.svg +0 -1
  82. package/examples/integration/tool/img/ic/cookie.svg +0 -1
  83. package/examples/integration/tool/img/ic/delete.svg +0 -1
  84. package/examples/integration/tool/img/ic/dot.svg +0 -1
  85. package/examples/integration/tool/img/ic/dump.svg +0 -1
  86. package/examples/integration/tool/img/ic/e.svg +0 -9
  87. package/examples/integration/tool/img/ic/eye-off.svg +0 -1
  88. package/examples/integration/tool/img/ic/eye.svg +0 -1
  89. package/examples/integration/tool/img/ic/forbidden.svg +0 -1
  90. package/examples/integration/tool/img/ic/form-title-1.svg +0 -3
  91. package/examples/integration/tool/img/ic/group.svg +0 -1
  92. package/examples/integration/tool/img/ic/hamburger.svg +0 -1
  93. package/examples/integration/tool/img/ic/ic-users.svg +0 -1
  94. package/examples/integration/tool/img/ic/ic_dropdown-form-close.svg +0 -3
  95. package/examples/integration/tool/img/ic/ic_dropdown-form-link.svg +0 -3
  96. package/examples/integration/tool/img/ic/ic_feature-edit-cancel.svg +0 -14
  97. package/examples/integration/tool/img/ic/ic_feature-edit-save.svg +0 -14
  98. package/examples/integration/tool/img/ic/ic_gallery-item-delete.svg +0 -3
  99. package/examples/integration/tool/img/ic/ic_gallery-item-view.svg +0 -3
  100. package/examples/integration/tool/img/ic/ic_gps.svg +0 -3
  101. package/examples/integration/tool/img/ic/ic_search.svg +0 -5
  102. package/examples/integration/tool/img/ic/ic_selector_fechas.svg +0 -63
  103. package/examples/integration/tool/img/ic/ic_zoom-to-extent.svg +0 -3
  104. package/examples/integration/tool/img/ic/icon_reminder.png +0 -0
  105. package/examples/integration/tool/img/ic/image-gallery-placeholder.svg +0 -55
  106. package/examples/integration/tool/img/ic/imaqua.svg +0 -87
  107. package/examples/integration/tool/img/ic/incidencia.svg +0 -77
  108. package/examples/integration/tool/img/ic/info_multi_selection.svg +0 -230
  109. package/examples/integration/tool/img/ic/layers.svg +0 -1
  110. package/examples/integration/tool/img/ic/map-marker.svg +0 -3
  111. package/examples/integration/tool/img/ic/map.svg +0 -1
  112. package/examples/integration/tool/img/ic/measure_area.svg +0 -111
  113. package/examples/integration/tool/img/ic/minus.svg +0 -7
  114. package/examples/integration/tool/img/ic/notification.svg +0 -1
  115. package/examples/integration/tool/img/ic/offline.svg +0 -3
  116. package/examples/integration/tool/img/ic/online.svg +0 -1
  117. package/examples/integration/tool/img/ic/pencil.svg +0 -3
  118. package/examples/integration/tool/img/ic/plus.svg +0 -1
  119. package/examples/integration/tool/img/ic/polygon_selection.svg +0 -68
  120. package/examples/integration/tool/img/ic/power.svg +0 -1
  121. package/examples/integration/tool/img/ic/remoteLocalized.svg +0 -4
  122. package/examples/integration/tool/img/ic/remoteStartLocalize.svg +0 -4
  123. package/examples/integration/tool/img/ic/ruler.svg +0 -125
  124. package/examples/integration/tool/img/ic/selection-plus.svg +0 -10
  125. package/examples/integration/tool/img/ic/selection.svg +0 -1
  126. package/examples/integration/tool/img/ic/settings.svg +0 -1
  127. package/examples/integration/tool/img/ic/sort.svg +0 -1
  128. package/examples/integration/tool/img/ic/sort_asc.svg +0 -1
  129. package/examples/integration/tool/img/ic/sort_desc.svg +0 -1
  130. package/examples/integration/tool/img/ic/spreadsheet.svg +0 -3
  131. package/examples/integration/tool/img/ic/times.svg +0 -1
  132. package/examples/integration/tool/img/ic/toolbar/AB3.svg +0 -1
  133. package/examples/integration/tool/img/ic/toolbar/AB4.svg +0 -1
  134. package/examples/integration/tool/img/ic/toolbar/IC1.svg +0 -1
  135. package/examples/integration/tool/img/ic/toolbar/TB1.svg +0 -1
  136. package/examples/integration/tool/img/ic/toolbar/TB11.svg +0 -5
  137. package/examples/integration/tool/img/ic/toolbar/TB2.svg +0 -1
  138. package/examples/integration/tool/img/ic/toolbar/TB20.svg +0 -1
  139. package/examples/integration/tool/img/ic/toolbar/TB21.svg +0 -54
  140. package/examples/integration/tool/img/ic/toolbar/TB3.svg +0 -1
  141. package/examples/integration/tool/img/ic/toolbar/TB31.svg +0 -1
  142. package/examples/integration/tool/img/ic/toolbar/TB32.svg +0 -57
  143. package/examples/integration/tool/img/ic/toolbar/TB4.svg +0 -1
  144. package/examples/integration/tool/img/ic/toolbar/TB5.svg +0 -1
  145. package/examples/integration/tool/img/ic/toolbar/TB6.svg +0 -1
  146. package/examples/integration/tool/img/ic/toolbar/TB7.svg +0 -1
  147. package/examples/integration/tool/img/ic/toolbar/TB8.svg +0 -1
  148. package/examples/integration/tool/img/ic/tools.svg +0 -28
  149. package/examples/integration/tool/img/ic/user.svg +0 -1
  150. package/examples/integration/tool/img/ic/vector-polygon.svg +0 -1
  151. package/examples/integration/tool/img/ic/visit_manager.svg +0 -135
  152. package/examples/integration/tool/img/logo-footer-login.png +0 -0
  153. package/examples/integration/tool/img/logo-footer.png +0 -0
  154. package/examples/integration/tool/img/logo-header-login.png +0 -0
  155. package/examples/integration/tool/img/logo-header-login@2x.png +0 -0
  156. package/examples/integration/tool/img/logo-header-login@3x.png +0 -0
  157. package/examples/integration/tool/img/logo-header.png +0 -0
  158. package/examples/integration/tool/img/logo-header@2x.png +0 -0
  159. package/examples/integration/tool/img/logo-header@3x.png +0 -0
  160. package/examples/integration/tool/img/logo_project.png +0 -0
  161. package/examples/integration/tool/img/photo-gallery-placeholder.svg +0 -3
  162. package/examples/integration/tool/img/pixel.png +0 -0
  163. package/examples/integration/tool/index.html +0 -228
  164. package/examples/integration/tool/js/demo.js +0 -238
  165. package/examples/integration/tool/js/interface.js +0 -147
  166. package/examples/integration/tool/js/jquery.js +0 -4
  167. package/examples/integration/vanguardia.html +0 -6636
  168. package/examples/taigua/global.css +0 -10
  169. package/examples/xavi/index.html +0 -37
  170. package/examples/xavi/main.js +0 -168
@@ -1,41 +1,490 @@
1
- var sessionToken ="eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI3YWU4NzJmODJjMzk0OTc2NDk0MzBjZGYyZGVhNDdjYWFhMzEyODFmIiwiZGF0YSI6eyJ6b29tIjo5LCJiYWNrZ3JvdW5kIjoiQ2FydG9EQkxpZ2h0Iiwic3JpZCI6bnVsbCwiZXh0ZW50IjpudWxsLCJnZW9zZXJ2aWNlIjoiUUdJUyIsIm5hbWUiOiJJbnZlcnNpb25zVEFJR1VBIiwicHJldmlldyI6ZmFsc2UsImFwaSI6Imh0dHBzOlwvXC9hcGkudmlkcm9zb2Z0d2FyZS5jb21cLyIsInR5cGUiOiJ2aWRyb21hcCIsInRva2VuIjoiMmE4MjUzYzY0NWY1MjQ5MmM0Yjc3YTNkNjQ2ZmI0YWEiLCJzaG93X2xheWVycyI6IiIsImlkIjoyMDAsImxvZ28iOiJodHRwczpcL1wvdGFpZ3VhLmNhdFwvd3AtY29udGVudFwvdXBsb2Fkc1wvMjAyMVwvMDdcL2xvZ28ucG5nIn19.K9D42ILcYlbJAGpTo96nCrENP_9ok_1RW_hdlJDoZFT3Q32DBvx7U8R4OeuC7HrlIi07PLXTdBb8x96jKkwwy-8pRWBYVRj50QYxh6-kGSZRSMhRFbSL27fKzFWmkZR1A2dmidWe5U4-BPbCOkhxERVcSFFupBYBImz-Fyix3K2COoXyajMshmZwcs4ew6WQ8YgsCayBY4nAuhgW12coPTLxdx33PtCKYSMsTV_d-czxRFD0CA0-PZlTFHK0xYX9lRpvLAkfYzJ_JrZ8txETHXelQeBtVJi-3qhEFE5AWQKQRQ3V-50CBbUD_L9ljDDJDOcgIr_lg8bMaXr0M4Y6D9Uvcm8AsTZ_Vg61oSIsZKv6AT1Gf4C8F5hc2mD7KDFfwUQMzJ6bLdvTF1mLTjq8vueDgRjFmYZcA8X5fDMOTt1LiPuC3pS06PMhfED6xhg6pIVLhmBtrXn7zsQwvV-JopjoYxDL2UMf4dfBG1lsqcAc8vNhU1p2YGFzxj01UZ_a9x89Dgn2uORNQPbWO6vEaXjertmyv3zPX9gQ0_gt97mDhLOLl9F995G-UBWXU6h6TDqu4sLjHxVmPPlOb84WOf6xxQLWfmDmilcwi54fJgs_tGXhS9F0iJ8Np_5X-YmRx5dYG9pBjFAwbcAeb4kbk3UN8ZyN1kqraM_Lv_DO73A";
2
- var clickedCoordinates = null;
1
+ var sessionToken =
2
+ "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2ODIwNzk1NTksImF1ZCI6ImY0ODkxOWMwN2IzOGE5YzlmMmUzZDAyYWQ1NGQxNzFiYzY5ZTczNzUiLCJkYXRhIjp7Inpvb20iOjksImJhY2tncm91bmQiOiJDYXJ0b0RCTGlnaHQiLCJzcmlkIjpudWxsLCJleHRlbnQiOm51bGwsImdlb3NlcnZpY2UiOiJRR0lTIiwibmFtZSI6IlBST1ZBMjAwNDIwMjNWMyIsInByZXZpZXciOnRydWUsImFwaSI6Imh0dHBzOlwvXC9hcGkudmlkcm9zb2Z0d2FyZS5jb21cLyIsInR5cGUiOiJ2aWRyb21hcCIsInRva2VuIjoiZWE1NzU5ZGYwYzU1YmJiYzJkNTdiYWY4ZjM4YTMyZDAiLCJzaG93X2xheWVycyI6Ik9CUkVTX0VOX0VYRUNVQ0lPX1YyLE9CUkVTX0ZJTkFMSVRaQURFU19WMixPQlJFU19QTEFOSUZJQ0FERVNfVjIsVE1fVEVSUkFTU0EiLCJpZCI6MjE5LCJsb2dvIjoiaHR0cHM6XC9cL3d3dy52aWRyb3NvZnR3YXJlLmNvbVwvbG9nb3NcL1ZJRFJPLnN2ZyJ9fQ.NwNbZrcYxm_hy8HbwRaEBjWoxGoEH1voUIraCaL7jc0ZwjotYtMABmfxW1SqqJPOALse1z61-r3odaeEW0g0nqKnlfbveeikO5viCo01L0gq-CJJdK4MemPEA-o7JgRqN3SImRaIUncJ3vrwtX-URmh2v_xp2YSzxyRYESOjlOhecmPLaUyP2T9S9nawg8Yx2y8QyPRAwauX_vAkE6u2K2QSfQPIVw0x7zy6v3WgzEGu6i3f5_hO14d10HB2QkhXm_XNj-yXcNB7djk30p7C1GwJH-VZxg6Ye3smyVNG6x0yLiWMUBJbPibsIdZFhlFUgBnYpjYP9vk_OLbzWIK5EKih99f584ohv_L9K4pat_4-ou265_0wvjM7iBQLykJddyNUHbcVgGJgKjeMw5glFGbpfLct9u6W7uTIWpjJdg1rwCNrrQBhgmGVCU8Luxj-durelRk7eQjXrl3ti0UJ4sXB09UKM-5AOXHwIMVB4CnpRL_-9zZD5-a_j1Jh5ozyyG6g2AdqpySXR_BLE_kph1-l3d3x6EwZCO5bfd_Z-lzrhUjwuMpoUKzzGp5JmEwjcWkzvsDEDu9XYuEDeU4zw57B6436MJFipnHXrAkuapyfjx1TZsSEuEh47B8x_Rm2hl65467NrDD5PeSauY2s75zB1OAOD8j7W072G7cbc4w";
3
+ //var clickedCoordinates = null;
3
4
  var communicator = new VidroMaps.Communicator({
4
5
  sessionToken: sessionToken,
5
6
  });
7
+ var selected_layer; //active layer
6
8
 
7
- communicator.on("onZoomChange", function (data) {
8
- console.log("onZoomChange event", data);
9
+ //var per geolocalització
10
+ var geoxy;
9
11
 
12
+ //codi per amagar parts del html ///////////////////////////////////////
13
+ //document.getElementById(id).style.visibility = "visible"; // show
14
+ //document.getElementById(btZoomToCoordinates).style.visibility = "hidden"; // hide
15
+ ///////////////////////////////////////////////////////////////////////
16
+
17
+ //ZoomIn -------------------------------------------------------------ok
18
+ var btZoomIn = document.getElementById("btZoomIn");
19
+ btZoomIn.addEventListener("click", function () {
20
+ //communicator.Geolocalize(true);
21
+ console.log("Zoom In");
22
+ communicator.ZoomIn();
23
+ });
24
+
25
+ //ZoomOut-------------------------------------------------------------ok
26
+ var btZoomOut = document.getElementById("btZoomOut");
27
+ btZoomOut.addEventListener("click", function () {
28
+ //communicator.Geolocalize(true);
29
+ console.log("Zoom Out");
30
+ communicator.ZoomOut();
31
+ });
32
+ //codi per butons caper
33
+ /***codi per mostrar i amagar layers**/
34
+ var btOfi = document.getElementById("btOfi");
35
+ btOfi.addEventListener("click", function () {
36
+ console.log("Activo capa Obra Finalitzada");
37
+ communicator.toggleLayer("OBRES_FINALITZADES_V2");
38
+ });
39
+ var btOex = document.getElementById("btOex");
40
+ btOex.addEventListener("click", function () {
41
+ console.log("Capa Obra Executada");
42
+ communicator.toggleLayer("OBRES_EN_EXECUCIO_V2");
43
+ });
44
+ var btOpl = document.getElementById("btOpl");
45
+ btOpl.addEventListener("click", function () {
46
+ console.log("Capa Obra Planificada");
47
+ communicator.toggleLayer("OBRES_PLANIFICADES_V2");
48
+ });
49
+ var btOtm = document.getElementById("btOtm");
50
+ btOtm.addEventListener("click", function () {
51
+ console.log("TM_TERRASSA");
52
+ communicator.toggleLayer("TM_TERRASSA");
10
53
  });
11
- communicator.on("error", function (data) {
12
- console.log("error", data);
13
54
 
55
+ var btMostraDades = document.getElementById("btGetElementsFromLayer");
56
+ btMostraDades.addEventListener("click", function () {
57
+ console.log("Mostrar Dades.");
14
58
  });
59
+ //Geolocation---------------------------------------------------------ok
60
+ var btGeoLocation = document.getElementById("btGeoLocation");
61
+ //quan cliquem al boto geolocalització executem->
62
+ btGeoLocation.addEventListener("click", function () {
63
+ console.log("Demanada Geolocalització");
64
+ communicator.Geolocalize(true);
15
65
 
16
- communicator.on("loaded", function (data) {
17
- console.log("loaded event");
18
-
19
- if(data.what==="map"){
66
+ /////////////////////////////////////////////
67
+ communicator.ZoomIn();
68
+ console.log("Geolocalitzo i aplico zoom x1");
69
+ //communicator.Geolocalize(true);
70
+ //communicator.ZoomIn();
71
+ //console.log("Geolocalitzo i aplico zoom x2");
72
+ //communicator.Geolocalize(true);
73
+ //communicator.ZoomIn();
74
+ //console.log("Geolocalitzo i aplico zoom x3");
75
+ //communicator.Geolocalize(true);
76
+ //communicator.ZoomIn();
77
+ //console.log("Geolocalitzo i aplico zoom x4");
78
+ //communicator.Geolocalize(true);
79
+ //communicator.ZoomIn();
80
+ //console.log("Geolocalitzo i aplico zoom x5");
81
+ //communicator.Geolocalize(true);
82
+ //communicator.ZoomIn();
83
+ //console.log("Geolocalitzo i aplico zoom x6");
84
+ //communicator.Geolocalize(true);
85
+ });
20
86
 
21
- setTimeout(()=>{
22
- communicator.toggleLayer('inversions', {gutter:null, transparent: true, singletile: true});
23
- },1000);
87
+ //zoomTocoordinates........................................................??
88
+ if (btZoomToCoordinates) {
89
+ btZoomToCoordinates.addEventListener("click", function (geoXY) {
90
+ console.log("btZoomToCoordinates clicked");
91
+ let level = 18;
92
+ if (document.getElementById("zoomLevelToCoordinates")) {
93
+ //zoom Level
94
+ level = document.getElementById("zoomLevelToCoordinates").value;
95
+ }
96
+ if (clickedCoordinates) {
97
+ communicator.zoomToCoordinates(
98
+ clickedCoordinates[0],
99
+ clickedCoordinates[1],
100
+ level
101
+ );
102
+ } else {
103
+ console.error("No coordinates provided");
104
+ }
105
+ });
24
106
  }
25
107
 
26
-
108
+ var btZoomToExtent = document.querySelector("#btZoomToExtent");
109
+ //capa actual
110
+ var currentActiveLayer = null;
111
+
112
+ function cleanContainers() {
113
+ containerMessages.innerHTML = "";
114
+ result_container.innerHTML = "";
115
+ }
116
+
117
+ //////////////////////////////////////////////////////////////////////////////////////
118
+ //events interceptats pel communicator i que fem amb ells. ///////////////////////////
119
+ //////////////////////////////////////////////////////////////////////////////////////
120
+ //per veure les capas
121
+ communicator.on("layers", function (data) {
122
+ console.log("layers received", data);
123
+ //fillDisplayedLayersSelect(data);
124
+ selected_layer = data[0]; //select first layer from available layers
125
+ communicator.setActiveLayer(selected_layer);
126
+ });
127
+
128
+ //error event
129
+ communicator.on("error", function (data) {
130
+ console.error("error", data);
131
+ cleanContainers();
132
+ Error_container.innerHTML = data.error;
27
133
  });
28
134
 
29
135
  //clicked coordinates
30
136
  communicator.on("coordinates", function (data) {
31
- console.info("coordinates", data);
32
-
137
+ console.info("Clic at coordinates", data);
138
+ //communicator.Geolocalize(true);
139
+ //geoxy.coordinates[0]= data.coordinates[0];
140
+ //geoxy.coordinates[1]= data.coordinates[1];
141
+ communicator.infoFromCoordinates("wms", selected_layer, null, "json");
33
142
  clickedCoordinates = [data.coordinates[0], data.coordinates[1]];
34
-
143
+ //result_container.innerHTML = `Clicked coordinates -> x: ${data.coordinates[0]}, y: ${data.coordinates[1]}`;
144
+ });
145
+
146
+ //event geolocation
147
+ communicator.on("geolocation", function (data) {
148
+ console.info("geolocation", data);
149
+ //communicator.Geolocalize(true);
150
+ try {
151
+ //provo d'agafar geoxy
152
+ console.log("intento agafar geoxy");
153
+ data.coordinates[0] = geoxy.coordinates[0];
154
+ data.coordinates[1] = geoxy.coordinates[1];
155
+ console.log("geoxy agafat");
156
+ } catch {
157
+ //no fem res
158
+ console.log("No hi ha geoxy");
159
+ }
160
+ console.log(
161
+ "geolocation data:" + data.coordinates[0] + ", " + data.coordinates[1]
162
+ );
163
+
164
+ communicator.zoomToCoordinates(data.coordinates[0], data.coordinates[1], 30);
165
+ //cleanContainers();
166
+ result_container.innerHTML = `geolocaiton: coordinates -> x: ${data.coordinates[0]}, y: ${data.coordinates[1]}`;
167
+ });
168
+
169
+ var containerMessages = document.getElementById("messages");
170
+
171
+ //event onZoomchange
172
+ communicator.on("onZoomChange", function (data) {
173
+ console.log("onZoomChange event", data);
174
+ cleanContainers();
175
+ //communicator.Geolocalize(true);
176
+ //containerMessages.innerHTML = `Zoom aplicat: ${data}`;
177
+ });
178
+
179
+ //event loaded
180
+ communicator.on("loaded", function (data) {
181
+ // communicator.Geolocalize(true);
182
+
183
+ communicator.setCustomColors({
184
+ geom_stroke_color: "rgb(19, 39, 99,0.5)",
185
+ geom_fill_color: "rgb(19, 39, 99,0.5)",
186
+ geom_stroke_width: 1,
187
+ geom_shape: "circle",
188
+ geom_radius: 100,
189
+ });
190
+
191
+ console.log("loaded event", data);
35
192
  });
36
193
 
194
+ //zoom to extent
195
+ if (btZoomToExtent) {
196
+ btZoomToExtent.addEventListener("click", function () {
197
+ cleanContainers();
198
+ //communicator.Geolocalize(true);
199
+ communicator.zoomToExtent();
200
+ });
201
+ }
202
+
203
+ //zoom to coordinates
204
+ if (btZoomToCoordinates) {
205
+ btZoomToCoordinates.addEventListener("click", function (data) {
206
+ cleanContainers();
207
+ // communicator.Geolocalize(true);
208
+ geoxy = data;
209
+ console.log(
210
+ "zoomToCoordinate data:" +
211
+ data.coordinates[0] +
212
+ ", " +
213
+ data.coordinates[1]
214
+ );
215
+ communicator.zoomToCoordinates(
216
+ data.coordinates[0],
217
+ data.coordinates[1],
218
+ 30
219
+ );
220
+ });
221
+ }
222
+
37
223
  //info event
224
+ /*
38
225
  communicator.on("info", function (data) {
39
226
  console.log("info received", data);
40
-
227
+ var dataToRender = data.data;
228
+ //depending on infoType, data.data can be an string or a JSON
229
+ if (data.infoType === "wms") {
230
+ dataToRender = JSON.stringify(data.data);
231
+ }
232
+ containerMessages.innerText = dataToRender;
233
+ console.log( "Info: " + dataToRender);
234
+
235
+ let options = {
236
+ 'geom': `POINT(${clickedCoordinates[0]} ${clickedCoordinates[1]})`,
237
+ 'zoom':{
238
+ 'type':'level',
239
+ 'zoomLevel':18
240
+ }
241
+ }
242
+ console.log(options);
243
+ communicator.Highlight(options)
244
+
245
+
246
+ });*/
247
+
248
+ /*infoFromCoordinates('wms','Arc',null,'json); */
249
+
250
+ //NEW AGAFA els elements de una capa i els mostra
251
+ //Mostrar dades de la capa
252
+ var btGetElementsFromLayer = document.querySelector("#btGetElementsFromLayer");
253
+ if (btGetElementsFromLayer) {
254
+ btGetElementsFromLayer.addEventListener("click", function () {
255
+ let limit = document.getElementById("limit")
256
+ ? document.getElementById("limit").value
257
+ : 100;
258
+ let format = document.getElementById("format")
259
+ ? document.getElementById("format").value
260
+ : "json";
261
+ communicator.getElementsFromLayer(selected_layer, limit, format);
262
+ });
263
+ }
264
+
265
+ //Layer elements list
266
+ communicator.on("layerElements", function (data) {
267
+ console.log("layerElements received", data);
268
+ var dataToRender = data.data;
269
+ var contenedor = document.getElementById("contenedor");
270
+ //mostro el contenidor amb un fade
271
+ contenedor.style.display = "block";
272
+ //contenedor.fade(1000);
273
+ //depending on requested format, data.data can be an string (xml) or a JSON
274
+ console.log(
275
+ typeof dataToRender === "object"
276
+ ? JSON.stringify(dataToRender)
277
+ : dataToRender
278
+ );
279
+
280
+ //codi xavi Javascript
281
+ var dades = JSON.stringify(dataToRender);
282
+ var json = jQuery.parseJSON(dades);
283
+ var id;
284
+ var dadesx = "";
285
+
286
+ //entro a 1- bucle
287
+ for (let i in json) {
288
+ //entro a 2n Bucle
289
+ for (let j in json[i]) {
290
+ if (json[i][j].hasOwnProperty("id")) {
291
+ id = json[i][j].id;
292
+ console.log("id:" + id);
293
+ dadesx = dadesx + "<h4>" + id + "</h4>";
294
+ }
295
+ if (json[i][j].hasOwnProperty("properties")) {
296
+ //entro a 3r Bucle
297
+ var htmlgeoXY = [];
298
+ for (let k in json[i][j]) {
299
+ for (let x in json[i][j][k]) {
300
+ if (json[i][j][k].hasOwnProperty("Codi_Obra")) {
301
+ dato = json[i][j][k].Codi_Obra;
302
+ console.log("Codi Obra:" + dato);
303
+ dadesx = dadesx + "<span>Codi Obra:" + dato + "</span><br>";
304
+ }
305
+ if (json[i][j][k].hasOwnProperty("Nom_Obra")) {
306
+ dato2 = json[i][j][k].Nom_Obra;
307
+ console.log("Nom Obra:" + dato2);
308
+ dadesx = dadesx + "<span>Nom Obra:" + dato2 + "</span><br>";
309
+ }
310
+ if (json[i][j][k].hasOwnProperty("Longitud")) {
311
+ dato3 = json[i][j][k].Longitud;
312
+ console.log(dato3);
313
+ dadesx = dadesx + "<span>Longitud:" + dato3 + "</span><br>";
314
+ }
315
+ if (json[i][j][k].hasOwnProperty("Cost_Obra")) {
316
+ dato7 = json[i][j][k].Cost_Obra;
317
+ console.log(dato7);
318
+ dadesx = dadesx + "<span>Cost Obra:" + dato7 + "</span><br>";
319
+ }
320
+ if (json[i][j][k].hasOwnProperty("Estat_Obra")) {
321
+ dato8 = json[i][j][k].Estat_Obra;
322
+ console.log(dato8);
323
+ dadesx = dadesx + "<span>Estat Obra:" + dato8 + "</span><br>";
324
+ }
325
+ if (json[i][j][k].hasOwnProperty("Any")) {
326
+ dato9 = json[i][j][k].Any;
327
+ console.log(dato9);
328
+ dadesx = dadesx + "<span>Estat Obra:" + dato9 + "</span><br>";
329
+ }
330
+
331
+ if (json[i][j][k].hasOwnProperty("X")) {
332
+ dato4 = json[i][j][k].X;
333
+ console.log("x: " + dato4);
334
+ htmlgeoXY[0] = dato4;
335
+
336
+ //dadesx= dadesx +"<span>x: " + dato4 + "</span><br>";
337
+ }
338
+ if (json[i][j][k].hasOwnProperty("Y")) {
339
+ dato5 = json[i][j][k].Y;
340
+ console.log("y: " + dato5);
341
+ htmlgeoXY[1] = dato5;
342
+
343
+ // dadesx= dadesx +"<span>y: " + dato5 + "</span><br>";
344
+ }
345
+ if (json[i][j][k].hasOwnProperty("Pem")) {
346
+ dato6 = json[i][j][k].Pem;
347
+ console.log("dato6: " + dato6);
348
+ htmlgeoXY[1] = dato6;
349
+ dadesx = dadesx + "<span>PEM:" + dato6 + "</span><BR>";
350
+ //provo de crear un buto parametritzat per a fer el zoom a la coordenada que toqui
351
+ console.log("Dades a inserir a name: " + id);
352
+ dadesx =
353
+ dadesx +
354
+ "<button name='" +
355
+ id +
356
+ "' class='fitxa' onclick='anaraxy(" +
357
+ dato4 +
358
+ "," +
359
+ dato5 +
360
+ ")'>Visualitzar el punt: " +
361
+ id +
362
+ "</button><BR>"; //monto el buto per anar punt de mostreig
363
+
364
+ //dadesx= dadesx + "<button id='btZoomToCoordinates' name='btZoomToCoordinates' value= "+ geoXY[0] + "," +geoXY[1] + "><img id='img' src='./img/diana.png'></button><br>"
365
+ }
366
+ break;
367
+ //console.log("Objecte k: "+ k);
368
+ }
369
+ }
370
+ }
371
+ }
372
+ }
373
+
374
+ document.getElementById("contenedor").innerHTML = dadesx;
41
375
  });
376
+ communicator.on("info", function (data) {
377
+ console.log("layerElements received", data);
378
+ var dataToRender = data.data;
379
+ //depending on requested format, data.data can be an string (xml) or a JSON
380
+ console.log(
381
+ typeof dataToRender === "object"
382
+ ? JSON.stringify(dataToRender)
383
+ : dataToRender
384
+ );
385
+
386
+ //codi xavi Javascript
387
+ var dades = JSON.stringify(dataToRender);
388
+ var json = jQuery.parseJSON(dades);
389
+ var id;
390
+ var dadesx = "";
391
+
392
+ //entro a 1- bucle
393
+ for (let i in json) {
394
+ //entro a 2n Bucle
395
+ for (let j in json[i]) {
396
+ if (json[i][j].hasOwnProperty("id")) {
397
+ id = json[i][j].id;
398
+ console.log("id:" + id);
399
+ dadesx = dadesx + "<h4>" + id + "</h4>";
400
+ }
401
+ if (json[i][j].hasOwnProperty("properties")) {
402
+ //entro a 3r Bucle
403
+ var htmlgeoXY = [];
404
+ for (let k in json[i][j]) {
405
+ for (let x in json[i][j][k]) {
406
+ if (json[i][j][k].hasOwnProperty("Codi Obra")) {
407
+ dato = json[i][j][k].codiObra;
408
+ console.log("Codi Obra:" + dato);
409
+ dadesx = dadesx + "<span>Codi Obra:" + dato + "</span><br>";
410
+ }
411
+ if (json[i][j][k].hasOwnProperty("Any")) {
412
+ dato2 = json[i][j][k].any;
413
+ console.log("Any:" + dato2);
414
+ dadesx = dadesx + "<span>Any:" + dato2 + "</span><br>";
415
+ }
416
+ if (json[i][j][k].hasOwnProperty("Longitud")) {
417
+ dato3 = json[i][j][k].Longitud;
418
+ console.log(dato3);
419
+ htmlgeoXY[0] = dato3;
420
+
421
+ dadesx = dadesx + "<span>Longitud: " + dato3 + "</span><br>";
422
+ }
423
+ if (json[i][j][k].hasOwnProperty("X")) {
424
+ dato4 = json[i][j][k].X;
425
+ console.log("x: " + dato4);
426
+ htmlgeoXY[0] = dato4;
427
+
428
+ dadesx = dadesx + "<span>x: " + dato4 + "</span><br>";
429
+ }
430
+ if (json[i][j][k].hasOwnProperty("Y")) {
431
+ dato5 = json[i][j][k].Y;
432
+ console.log("y: " + dato5);
433
+ htmlgeoXY[1] = dato5;
434
+
435
+ dadesx = dadesx + "<span>y: " + dato5 + "</span><br>";
436
+ }
437
+ if (json[i][j][k].hasOwnProperty("Pem")) {
438
+ dato6 = json[i][j][k].PEM;
439
+ console.log("dato6: " + dato6);
440
+ htmlgeoXY[1] = dato6;
441
+ dadesx = dadesx + "<span>PEM:" + dato6 + "</span><BR>";
442
+ //provo de crear un buto parametritzat per a fer el zoom a la coordenada que toqui
443
+ console.log("Dades a inserir a name: " + id);
444
+ dadesx =
445
+ dadesx +
446
+ "<button name='" +
447
+ id +
448
+ "' class='fitxa' onclick='anaraxy(" +
449
+ dato4 +
450
+ "," +
451
+ dato5 +
452
+ ")'>Visualitzar el punt: " +
453
+ id +
454
+ "</button><BR>"; //monto el buto per anar punt de mostreig
455
+
456
+ //dadesx= dadesx + "<button id='btZoomToCoordinates' name='btZoomToCoordinates' value= "+ geoXY[0] + "," +geoXY[1] + "><img id='img' src='./img/diana.png'></button><br>"
457
+ }
458
+ break;
459
+ //console.log("Objecte k: "+ k);
460
+ }
461
+ }
462
+ }
463
+ }
464
+ }
465
+
466
+ document.getElementById("contenedor").innerHTML = dadesx;
467
+ });
468
+
469
+ function anaraxy(x, y) {
470
+ console.log("Entro a funcio de anar a X,Y");
471
+ communicator.Geolocalize(false);
472
+ communicator.zoomToCoordinates(x, y, 18);
473
+
474
+ let options = {
475
+ geom: `POINT(${x} ${y})`,
476
+ zoom: {
477
+ type: "level",
478
+ zoomLevel: 18,
479
+ },
480
+ };
481
+ var contenedor = document.getElementById("contenedor");
482
+ contenedor.style.display = "none";
483
+ console.log("Amago el panell un cop fet el zoom");
484
+ console.log(options);
485
+ communicator.Highlight(options);
486
+
487
+ //geoxy.coordinates[0]= x;
488
+ //geoxy.coordinates[1]= y;
489
+ console.log("dades xy funcio anar a X,Y: " + x + "," + y);
490
+ }
@@ -14,7 +14,7 @@
14
14
 
15
15
  <div id="sessionToken"></div>
16
16
  <div>
17
- Paste your code here:<br> <textarea name="code" id="code" rows="10" cols="100" placeholder=""><iframe id="map-frame" name="map-frame" width="100%" height="600" src="http://localhost:3000?sessionToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2NTU4ODI0OTgsImF1ZCI6ImViZTY4YjcyYTJhYWQ3ZDUwZGM4NDI2NDhiZTE1Y2M4YmQyODU4ZmQiLCJkYXRhIjp7Inpvb20iOjksImJhY2tncm91bmQiOiJDYXJ0b0RCTGlnaHQiLCJzcmlkIjpudWxsLCJleHRlbnQiOm51bGwsImdlb3NlcnZpY2UiOiJRR0lTIiwibmFtZSI6IlBVTlRTTU9TVFJFSUcyIiwicHJldmlldyI6dHJ1ZSwiYXBpIjoiaHR0cHM6XC9cL2FwaS52aWRyb3NvZnR3YXJlLmNvbVwvIiwidHlwZSI6InZpZHJvbWFwIiwidG9rZW4iOiI3ODBkMTEwZWM1ZDc2ZDVjMTY1ZmYwNjA2MTA5ODFmMSIsInNob3dfbGF5ZXJzIjoiUFVOVFNNT1NUUkVJRyIsImlkIjoxOTEsImxvZ28iOiJodHRwczpcL1wvd3d3LnZpZHJvc29mdHdhcmUuY29tXC9sb2dvc1wvVklEUk8uc3ZnIn19.O4g8CSHm4JrfnpFk9632M7zBbO3MIz0xJ0RFRqD1BYabjlmsNF6odauTBi0OkNsvruGgbH4LOGfhv1-3GGyW7HgXga8QHnTNl8Zvx7IX5Rmgrah7MD0MLUWkAVnZEBgPGiat3LoMjp7LAMJz1UY5lFL9BYOQhe6qjusWJTvQ11Z-AO7ePVnvyn050653Lcf9L4QWUy5UNCE0WRJLNQBtoROg1OGcABsOfvuCx7iN6EBjlRZLYWPj570z4T4zNTZz9SloL6JYJsGSvOPn0BYtqAom4XsS_Alpm3h51Vw_DQh32vkVu1v-Vesm28M_a-HsyMq7x4ZQMbhy4hMgf7qOeUvJiD_Uxp8dlU-aL4XtByI1Yrb6MXcZD2m5BzAYaYLuY01jctRQvjaqSNqQajfYPybvmk-kvPpvYS-Qqhfyi2UIn5pOhqokM_eI5cU1LroyguLX1PVFDoLP2E1lsgg29muxDef5VFV7LkGxLEVDvh2SAiJn2TpyPYKjccoB3Kr6H2t4yfoL24j5wiGxnsGWE-DEdLt4ME2OmrjoEQ2mHxAVyuykkwU2gKpLwSnAvWzaQ8JIhHvOtL4Ff-UL2C34XZBA8_aKP3Oqz7Mj7ZQVomiaASVbPdjCpkMiHmdvuR3fOXSXyDKkOrr3mgfyrjSgjnmDDEaD7H8imS3nBpqJkUw"></iframe>
17
+ Paste your code here:<br> <textarea name="code" id="code" rows="10" cols="100" placeholder="">
18
18
  </textarea>
19
19
  </div>
20
20
  <div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vidro/map-handler",
3
- "version": "1.1.3",
3
+ "version": "1.1.15",
4
4
  "description": "Tool to achieve the easiest way of communication with the map",
5
5
  "homepage": "https://github.com/Vidro-Software-SL/maphandler",
6
6
  "repository": {