@vidro/map-handler 1.0.6 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. package/README.md +187 -10
  2. package/dist/map-handler.js +1 -1
  3. package/doc/giswater.png +0 -0
  4. package/doc/giswaterInfo.png +0 -0
  5. package/doc/giswaterInfoApi.png +0 -0
  6. package/doc/giswatergeojson.png +0 -0
  7. package/doc/multiTile.png +0 -0
  8. package/doc/multiTileNoGutter.png +0 -0
  9. package/doc/togglelayergiswater.png +0 -0
  10. package/doc/vidromaps-basic.png +0 -0
  11. package/examples/externalwms/index.js +20 -0
  12. package/examples/externalwms/index.php +88 -0
  13. package/examples/full/apidemo.js +43 -1
  14. package/examples/full/cachedToken.dat +1 -1
  15. package/examples/full/cachedTokenData.dat +1 -1
  16. package/examples/full/index.php +31 -16
  17. package/examples/full/tester.js +172 -12
  18. package/examples/integration/tool/css/dist/home.css.min.css +0 -0
  19. package/examples/integration/tool/css/dist/home.min.css +1 -0
  20. package/examples/integration/tool/css/dist/home.min.css.map +10 -0
  21. package/examples/integration/tool/css/dist/style-login.css.min.css +0 -0
  22. package/examples/integration/tool/css/dist/style-login.min.css +1 -0
  23. package/examples/integration/tool/css/dist/style-login.min.css.map +10 -0
  24. package/examples/integration/tool/css/dist/style.css.min.css +0 -0
  25. package/examples/integration/tool/css/dist/style.min.css +1 -0
  26. package/examples/integration/tool/css/dist/style.min.css.map +23 -0
  27. package/examples/integration/tool/css/master/_bottom-sheet-2.scss +103 -0
  28. package/examples/integration/tool/css/master/_bottom-sheet.scss +142 -0
  29. package/examples/integration/tool/css/master/_colors.scss +35 -0
  30. package/examples/integration/tool/css/master/_dropdown-form.scss +167 -0
  31. package/examples/integration/tool/css/master/_forms.scss +416 -0
  32. package/examples/integration/tool/css/master/_header.scss +134 -0
  33. package/examples/integration/tool/css/master/_menu-toc.scss +135 -0
  34. package/examples/integration/tool/css/master/_menu-tools.scss +187 -0
  35. package/examples/integration/tool/css/master/_mixins.scss +42 -0
  36. package/examples/integration/tool/css/master/_notifyjs.scss +39 -0
  37. package/examples/integration/tool/css/master/_ol-map-controls.scss +117 -0
  38. package/examples/integration/tool/css/master/_simplelightbox.scss +287 -0
  39. package/examples/integration/tool/css/master/_toc-config.scss +28 -0
  40. package/examples/integration/tool/css/master/_toc-layouts.scss +173 -0
  41. package/examples/integration/tool/css/master/_tooltip.scss +34 -0
  42. package/examples/integration/tool/css/master/home.scss +266 -0
  43. package/examples/integration/tool/css/master/style-login.scss +240 -0
  44. package/examples/integration/tool/css/master/style.scss +166 -0
  45. package/examples/integration/tool/img/doc-gallery-placeholder.svg +3 -0
  46. package/examples/integration/tool/img/home/ic_calendar-clock.svg +1 -0
  47. package/examples/integration/tool/img/home/ic_caret-down.svg +1 -0
  48. package/examples/integration/tool/img/home/ic_cog.svg +1 -0
  49. package/examples/integration/tool/img/home/ic_marker.svg +1 -0
  50. package/examples/integration/tool/img/home/ic_play-circle.svg +1 -0
  51. package/examples/integration/tool/img/home/ic_power.svg +1 -0
  52. package/examples/integration/tool/img/home/ic_squares.svg +1 -0
  53. package/examples/integration/tool/img/home/ic_user-pointer.svg +1 -0
  54. package/examples/integration/tool/img/home/ic_user-square.svg +1 -0
  55. package/examples/integration/tool/img/home/logo_footer.svg +1 -0
  56. package/examples/integration/tool/img/ic/accessControl.svg +1 -0
  57. package/examples/integration/tool/img/ic/account-location.svg +1 -0
  58. package/examples/integration/tool/img/ic/actionDelete.svg +64 -0
  59. package/examples/integration/tool/img/ic/actionOpen.svg +64 -0
  60. package/examples/integration/tool/img/ic/addFile.svg +100 -0
  61. package/examples/integration/tool/img/ic/addFile_off.svg +102 -0
  62. package/examples/integration/tool/img/ic/arrow-left.svg +1 -0
  63. package/examples/integration/tool/img/ic/arrow-right-drop-circle-outline.svg +1 -0
  64. package/examples/integration/tool/img/ic/bt_add_photo.svg +3 -0
  65. package/examples/integration/tool/img/ic/bug.svg +1 -0
  66. package/examples/integration/tool/img/ic/caret-down-bottomsheet.svg +3 -0
  67. package/examples/integration/tool/img/ic/checkbox-blank-outline-grey.svg +8 -0
  68. package/examples/integration/tool/img/ic/checkbox-blank-outline-white.svg +8 -0
  69. package/examples/integration/tool/img/ic/checkbox-blank-outline.svg +1 -0
  70. package/examples/integration/tool/img/ic/checkbox-marked-outline-grey.svg +8 -0
  71. package/examples/integration/tool/img/ic/checkbox-marked-outline-white.svg +8 -0
  72. package/examples/integration/tool/img/ic/checkbox-marked-outline.svg +1 -0
  73. package/examples/integration/tool/img/ic/chevron-down-grey.svg +7 -0
  74. package/examples/integration/tool/img/ic/chevron-down-white.svg +7 -0
  75. package/examples/integration/tool/img/ic/chevron-down.svg +1 -0
  76. package/examples/integration/tool/img/ic/chevron-right-grey.svg +7 -0
  77. package/examples/integration/tool/img/ic/chevron-right-white.svg +7 -0
  78. package/examples/integration/tool/img/ic/chevron-right.svg +1 -0
  79. package/examples/integration/tool/img/ic/comment-text-outline.svg +1 -0
  80. package/examples/integration/tool/img/ic/cookie.svg +1 -0
  81. package/examples/integration/tool/img/ic/delete.svg +1 -0
  82. package/examples/integration/tool/img/ic/dot.svg +1 -0
  83. package/examples/integration/tool/img/ic/dump.svg +1 -0
  84. package/examples/integration/tool/img/ic/e.svg +9 -0
  85. package/examples/integration/tool/img/ic/eye-off.svg +1 -0
  86. package/examples/integration/tool/img/ic/eye.svg +1 -0
  87. package/examples/integration/tool/img/ic/forbidden.svg +1 -0
  88. package/examples/integration/tool/img/ic/form-title-1.svg +3 -0
  89. package/examples/integration/tool/img/ic/group.svg +1 -0
  90. package/examples/integration/tool/img/ic/hamburger.svg +1 -0
  91. package/examples/integration/tool/img/ic/ic-users.svg +1 -0
  92. package/examples/integration/tool/img/ic/ic_dropdown-form-close.svg +3 -0
  93. package/examples/integration/tool/img/ic/ic_dropdown-form-link.svg +3 -0
  94. package/examples/integration/tool/img/ic/ic_feature-edit-cancel.svg +14 -0
  95. package/examples/integration/tool/img/ic/ic_feature-edit-save.svg +14 -0
  96. package/examples/integration/tool/img/ic/ic_gallery-item-delete.svg +3 -0
  97. package/examples/integration/tool/img/ic/ic_gallery-item-view.svg +3 -0
  98. package/examples/integration/tool/img/ic/ic_gps.svg +3 -0
  99. package/examples/integration/tool/img/ic/ic_search.svg +5 -0
  100. package/examples/integration/tool/img/ic/ic_selector_fechas.svg +63 -0
  101. package/examples/integration/tool/img/ic/ic_zoom-to-extent.svg +3 -0
  102. package/examples/integration/tool/img/ic/icon_reminder.png +0 -0
  103. package/examples/integration/tool/img/ic/image-gallery-placeholder.svg +55 -0
  104. package/examples/integration/tool/img/ic/imaqua.svg +87 -0
  105. package/examples/integration/tool/img/ic/incidencia.svg +77 -0
  106. package/examples/integration/tool/img/ic/info_multi_selection.svg +230 -0
  107. package/examples/integration/tool/img/ic/layers.svg +1 -0
  108. package/examples/integration/tool/img/ic/map-marker.svg +3 -0
  109. package/examples/integration/tool/img/ic/map.svg +1 -0
  110. package/examples/integration/tool/img/ic/measure_area.svg +111 -0
  111. package/examples/integration/tool/img/ic/minus.svg +7 -0
  112. package/examples/integration/tool/img/ic/notification.svg +1 -0
  113. package/examples/integration/tool/img/ic/offline.svg +3 -0
  114. package/examples/integration/tool/img/ic/online.svg +1 -0
  115. package/examples/integration/tool/img/ic/pencil.svg +3 -0
  116. package/examples/integration/tool/img/ic/plus.svg +1 -0
  117. package/examples/integration/tool/img/ic/polygon_selection.svg +68 -0
  118. package/examples/integration/tool/img/ic/power.svg +1 -0
  119. package/examples/integration/tool/img/ic/remoteLocalized.svg +4 -0
  120. package/examples/integration/tool/img/ic/remoteStartLocalize.svg +4 -0
  121. package/examples/integration/tool/img/ic/ruler.svg +125 -0
  122. package/examples/integration/tool/img/ic/selection-plus.svg +10 -0
  123. package/examples/integration/tool/img/ic/selection.svg +1 -0
  124. package/examples/integration/tool/img/ic/settings.svg +1 -0
  125. package/examples/integration/tool/img/ic/sort.svg +1 -0
  126. package/examples/integration/tool/img/ic/sort_asc.svg +1 -0
  127. package/examples/integration/tool/img/ic/sort_desc.svg +1 -0
  128. package/examples/integration/tool/img/ic/spreadsheet.svg +3 -0
  129. package/examples/integration/tool/img/ic/times.svg +1 -0
  130. package/examples/integration/tool/img/ic/toolbar/AB3.svg +1 -0
  131. package/examples/integration/tool/img/ic/toolbar/AB4.svg +1 -0
  132. package/examples/integration/tool/img/ic/toolbar/IC1.svg +1 -0
  133. package/examples/integration/tool/img/ic/toolbar/TB1.svg +1 -0
  134. package/examples/integration/tool/img/ic/toolbar/TB11.svg +5 -0
  135. package/examples/integration/tool/img/ic/toolbar/TB2.svg +1 -0
  136. package/examples/integration/tool/img/ic/toolbar/TB20.svg +1 -0
  137. package/examples/integration/tool/img/ic/toolbar/TB21.svg +54 -0
  138. package/examples/integration/tool/img/ic/toolbar/TB3.svg +1 -0
  139. package/examples/integration/tool/img/ic/toolbar/TB31.svg +1 -0
  140. package/examples/integration/tool/img/ic/toolbar/TB32.svg +57 -0
  141. package/examples/integration/tool/img/ic/toolbar/TB4.svg +1 -0
  142. package/examples/integration/tool/img/ic/toolbar/TB5.svg +1 -0
  143. package/examples/integration/tool/img/ic/toolbar/TB6.svg +1 -0
  144. package/examples/integration/tool/img/ic/toolbar/TB7.svg +1 -0
  145. package/examples/integration/tool/img/ic/toolbar/TB8.svg +1 -0
  146. package/examples/integration/tool/img/ic/tools.svg +28 -0
  147. package/examples/integration/tool/img/ic/user.svg +1 -0
  148. package/examples/integration/tool/img/ic/vector-polygon.svg +1 -0
  149. package/examples/integration/tool/img/ic/visit_manager.svg +135 -0
  150. package/examples/integration/tool/img/logo-footer-login.png +0 -0
  151. package/examples/integration/tool/img/logo-footer.png +0 -0
  152. package/examples/integration/tool/img/logo-header-login.png +0 -0
  153. package/examples/integration/tool/img/logo-header-login@2x.png +0 -0
  154. package/examples/integration/tool/img/logo-header-login@3x.png +0 -0
  155. package/examples/integration/tool/img/logo-header.png +0 -0
  156. package/examples/integration/tool/img/logo-header@2x.png +0 -0
  157. package/examples/integration/tool/img/logo-header@3x.png +0 -0
  158. package/examples/integration/tool/img/logo_project.png +0 -0
  159. package/examples/integration/tool/img/photo-gallery-placeholder.svg +3 -0
  160. package/examples/integration/tool/img/pixel.png +0 -0
  161. package/examples/integration/tool/index.html +228 -0
  162. package/examples/integration/tool/js/demo.js +238 -0
  163. package/examples/integration/tool/js/interface.js +147 -0
  164. package/examples/integration/tool/js/jquery.js +4 -0
  165. package/examples/integration/vanguardia.html +6636 -0
  166. package/examples/multipleIframes/index.js +82 -0
  167. package/examples/multipleIframes/index.php +52 -0
  168. package/examples/serverLess/dist/index.23420cfa.js +120 -117
  169. package/examples/serverLess/dist/index.23420cfa.js.map +1 -1
  170. package/examples/serverLess/dist/index.html +38 -1
  171. package/examples/serverLess/index.html +2 -1
  172. package/examples/serverLess/main.js +2 -2
  173. package/examples/simple/index.html +1 -1
  174. package/examples/taigua/index.html +15 -0
  175. package/examples/taigua/main.js +44 -0
  176. package/examples/vidromap/index.js +12 -79
  177. package/examples/vidromap/index.php +63 -48
  178. package/examples/xavi/index.html +37 -0
  179. package/examples/xavi/main.js +160 -0
  180. package/flows.md +73 -0
  181. package/package.json +1 -1
  182. package/src/index.js +160 -44
  183. package/src/shared/iframe-communicator.js +12 -5
  184. package/examples/vidromap/vidromap.js +0 -13
  185. package/examples/vidromap/vidromap.php +0 -59
@@ -16,7 +16,7 @@ const iframe = document.querySelector("#map-frame");
16
16
  const infoContainer = document.querySelector("#infoContainer");
17
17
  const infoContent = document.querySelector("#infoContent");
18
18
  const closeInfo = document.querySelector("#closeInfo");
19
-
19
+ /*
20
20
  //1. Get BMAPS user token
21
21
  axios
22
22
  .post(`${apiUrl}letsgo`, {
@@ -84,7 +84,7 @@ axios
84
84
  .catch(function (error) {
85
85
  console.log(error);
86
86
  });
87
-
87
+ */
88
88
  //DOM handlers
89
89
  closeInfo.addEventListener("click", (evt) => {
90
90
  infoContainer.style.display = "none";
@@ -12,7 +12,7 @@
12
12
  <br>https://www.vidrosoftware.com/examples/simple/?user=user&pwd=pwd&api=API URL
13
13
  </div>
14
14
  <div id="iframes-container">
15
- <iframe id="map-frame" name="map-frame" src="" style="width:100%; height:600px;" ></iframe>
15
+ <iframe id="map-frame" name="map-frame" src="http://localhost:3000/?sessionToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2NTQ2ODUzODYsImF1ZCI6IjFhOTQ1OTcyN2YyMTIzNWFkNzhmMWQ4N2NjMTIzMzAxOTQ3NTEyNDMiLCJkYXRhIjp7Inpvb20iOjQsImJhY2tncm91bmQiOiJDYXJ0b0RCTGlnaHQiLCJzcmlkIjpudWxsLCJleHRlbnQiOm51bGwsImdlb3NlcnZpY2UiOiJRR0lTIiwibmFtZSI6IlBhcmlzIiwicHJldmlldyI6dHJ1ZSwiYXBpIjoiaHR0cHM6XC9cL2FwaS52aWRyb3NvZnR3YXJlLmNvbVwvIiwidHlwZSI6InZpZHJvbWFwIiwidG9rZW4iOiIzZDAxNzBjNjZlNTE2MjM4ZWRiODU3ZjE1MDhlYzQyNCIsInNob3dfbGF5ZXJzIjoiIiwiaWQiOjExMSwibG9nbyI6Imh0dHBzOlwvXC93d3cudmlkcm9zb2Z0d2FyZS5jb21cL2xvZ29zXC9WSURSTy5zdmcifX0.OKluQa49gCA2r9cd80Did2CaPJCD7NR-fblL_D8EI4tTNBHavfIjxI_Nmj-K4PTqr54acJWwtih4f0bmLTE6aT0dF6aA3CVGfhOEC7yZc5gVncGSxL9l3HRQvevQHf_it6H-lCx5Yuee98tQyIMJJipMWpAjnkmmJoyk8K4Ri058J44XlI1EJKMv13dafIHUME9puoUry-GVXfImb3vNbZ0vvIr-XHQb8tD882qBgKxoe50bzdPMHdDmWLkN99RrVsfvX9Z1m3zeWxL-3DNOErRbqtN0gkMDh6u043LJ_hO0NyLd06Uxl2Cs5Q3bld9Bs4nYuAq4kADQHGBJJPiuI82KU9pmIWAkhzlhA00aPSulhHkz39WaSpbClFI82zftpqBOicuYP1f09gjyMT_oARlIP1wSSJw8E0rBpbPDHjSiJLcE4qKk3nZw6dz_n34zUCs_lvlU2QnRvJO5m77Iu1ZPqnaQx_HSgSV9T07aCvN-cas9H9Fx7uQXAhlU-AqHd68HX8MxXGsKceWtdJdb1aAFP_5LYXCYPzleD756uDatreIhmUzKZguiFEpiin74xozd-UAM75M1M1KmeZiZnqmtFW60Zq-VDHVhLSToD4xa6oT8pZUnSLWrGe3odkigHZSrnQUYPlesULD4eCGEWasfEXyfkB4Y2XbNewDuAPU" style="width:100%; height:600px;" ></iframe>
16
16
  </div>
17
17
  <button id="btZoomIn">Zoom In</button>
18
18
  <button id="btZoomOut">Zoom Out</button>
@@ -0,0 +1,15 @@
1
+
2
+ <!DOCTYPE html>
3
+ <html>
4
+
5
+ <body>
6
+ <div><iframe id="map-frame" name="map-frame" width="100%" height="600"
7
+ src="https://component.vidrosoftware.com?sessionToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2NTI3NzU1MjcsImF1ZCI6ImE4MmY1MTQ2Y2Y4NTQ3ODg1YjFiNzY2MjE5Yjk4YjI4YWJkZGJkNTIiLCJkYXRhIjp7Inpvb20iOjksImJhY2tncm91bmQiOiJDYXJ0b0RCTGlnaHQiLCJzcmlkIjpudWxsLCJleHRlbnQiOm51bGwsImdlb3NlcnZpY2UiOiJRR0lTIiwibmFtZSI6IlBST1ZBMjYiLCJwcmV2aWV3Ijp0cnVlLCJhcGkiOiJodHRwczpcL1wvYXBpLnZpZHJvc29mdHdhcmUuY29tXC8iLCJ0eXBlIjoidmlkcm9tYXAiLCJ0b2tlbiI6ImYzMTU5MTY4OTliZmVjODljZjM0NjlkMDVjNTlkZTY1Iiwic2hvd19sYXllcnMiOiJMSU5LUyxUUkFNUyxDT01QVFNSRUcsTk9ERVMiLCJpZCI6MTU5LCJsb2dvIjoiaHR0cHM6XC9cL3d3dy52aWRyb3NvZnR3YXJlLmNvbVwvbG9nb3NcL1ZJRFJPLnN2ZyJ9fQ.OAGvwBb20ZkBtI2HqLd7dwnS2kFFuOJmqs1WGSDX_6vm_KAhd3KQNvDqyZrXw3NJehTvOnes0fkK-gD3r2uKlz2beCdnoXLzVnkOYkO5rZpon6WIRNRtbSBqQ2dpgijnsWwH_inhs-EAUB-la9Itdmhk7SlswGWPcs7cU19YeaD6FizNaFaROB_1UHTWw-t7ks7GGkd47J0m5rl9AVvJNC3-SDsMLzcC7WO-rnibDtmB6cCgPFND0zpzjQlt0IYTHxTBsyS6MczcBsdl9jzyuO3rl802fZ5T1KhY5TxHGni8ljeMtXe0L-tNaJy6F6rjtfY2I4-RCZF4nQ6RPjd1AWoXhPI2Uw6YGu8TFIEGwK0k-vH6dRU2IrWXLuEgniirvLj4YZVVNtJzlhHeAE_yGE-3ygF3vU4aRWlD54gKv0lL1mO2EdeXbIUb4_jrlTwJN5Lxy2k0cv1t6HR8RVjTqj0k2gLDR-Rwe3bhNPQCuUyJOnllIh5OkKx-ZzxUU3qZ23T4phpqMCC67EQaJ1qrHcKX9nFZJ8qGwVaWbaQJHlPYQBpPCLtetNm7C5INxuEWmQMMvdlEtUyHlL8EQeYSc54kw_SaVTsHHs9PhX6uD-RcfzYFmfHcFKQaOO1oNFq6aHdIuK8BQuj8s_q4h4r3acU5QzHGwKuS9-0k3IOuvWU"></iframe>
8
+ </duv>
9
+ <div><button id="btZoomIn" name="btZoomIn">Zoom in</button></div>
10
+
11
+ <div id="messages"></div>
12
+ </body>
13
+ <script src="https://unpkg.com/@vidro/map-handler@1.0.5/dist/map-handler.js"></script>
14
+ <script src="main.js"></script>
15
+ </html>
@@ -0,0 +1,44 @@
1
+ var sessionToken =
2
+ "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2NTI3NzU1MjcsImF1ZCI6ImE4MmY1MTQ2Y2Y4NTQ3ODg1YjFiNzY2MjE5Yjk4YjI4YWJkZGJkNTIiLCJkYXRhIjp7Inpvb20iOjksImJhY2tncm91bmQiOiJDYXJ0b0RCTGlnaHQiLCJzcmlkIjpudWxsLCJleHRlbnQiOm51bGwsImdlb3NlcnZpY2UiOiJRR0lTIiwibmFtZSI6IlBST1ZBMjYiLCJwcmV2aWV3Ijp0cnVlLCJhcGkiOiJodHRwczpcL1wvYXBpLnZpZHJvc29mdHdhcmUuY29tXC8iLCJ0eXBlIjoidmlkcm9tYXAiLCJ0b2tlbiI6ImYzMTU5MTY4OTliZmVjODljZjM0NjlkMDVjNTlkZTY1Iiwic2hvd19sYXllcnMiOiJMSU5LUyxUUkFNUyxDT01QVFNSRUcsTk9ERVMiLCJpZCI6MTU5LCJsb2dvIjoiaHR0cHM6XC9cL3d3dy52aWRyb3NvZnR3YXJlLmNvbVwvbG9nb3NcL1ZJRFJPLnN2ZyJ9fQ.OAGvwBb20ZkBtI2HqLd7dwnS2kFFuOJmqs1WGSDX_6vm_KAhd3KQNvDqyZrXw3NJehTvOnes0fkK-gD3r2uKlz2beCdnoXLzVnkOYkO5rZpon6WIRNRtbSBqQ2dpgijnsWwH_inhs-EAUB-la9Itdmhk7SlswGWPcs7cU19YeaD6FizNaFaROB_1UHTWw-t7ks7GGkd47J0m5rl9AVvJNC3-SDsMLzcC7WO-rnibDtmB6cCgPFND0zpzjQlt0IYTHxTBsyS6MczcBsdl9jzyuO3rl802fZ5T1KhY5TxHGni8ljeMtXe0L-tNaJy6F6rjtfY2I4-RCZF4nQ6RPjd1AWoXhPI2Uw6YGu8TFIEGwK0k-vH6dRU2IrWXLuEgniirvLj4YZVVNtJzlhHeAE_yGE-3ygF3vU4aRWlD54gKv0lL1mO2EdeXbIUb4_jrlTwJN5Lxy2k0cv1t6HR8RVjTqj0k2gLDR-Rwe3bhNPQCuUyJOnllIh5OkKx-ZzxUU3qZ23T4phpqMCC67EQaJ1qrHcKX9nFZJ8qGwVaWbaQJHlPYQBpPCLtetNm7C5INxuEWmQMMvdlEtUyHlL8EQeYSc54kw_SaVTsHHs9PhX6uD-RcfzYFmfHcFKQaOO1oNFq6aHdIuK8BQuj8s_q4h4r3acU5QzHGwKuS9-0k3IOuvWU";
3
+ var clickedCoordinates = null;
4
+ var communicator = new VidroMaps.Communicator({
5
+ sessionToken: sessionToken,
6
+ });
7
+
8
+ var btZoomIn = document.getElementById("btZoomIn");
9
+ btZoomIn.addEventListener("click", function () {
10
+ console.log("m'han clicat");
11
+ communicator.ZoomIn();
12
+ });
13
+
14
+ var containerMessages = document.getElementById("messages");
15
+
16
+ communicator.on("onZoomChange", function (data) {
17
+ console.log("onZoomChange event", data);
18
+ containerMessages.innerHTML = data;
19
+ });
20
+
21
+ communicator.on("loaded", function (data) {
22
+ console.log("loaded event", data);
23
+ });
24
+
25
+ //clicked coordinates
26
+ communicator.on("coordinates", function (data) {
27
+ console.info("coordinates", data);
28
+
29
+ clickedCoordinates = [data.coordinates[0], data.coordinates[1]];
30
+ containerMessages.innerHTML = `Clicked coordinates -> x: ${data.coordinates[0]}, y: ${data.coordinates[1]}`;
31
+ communicator.infoFromCoordinates("wms", "COMPTSREG");
32
+ });
33
+
34
+ //info event
35
+ communicator.on("info", function (data) {
36
+ console.log("info received", data);
37
+ var dataToRender = data.data;
38
+ //depending on infoType, data.data can be an string or a JSON
39
+ if (data.infoType === "giswater") {
40
+ dataToRender = JSON.stringify(data.data);
41
+ }
42
+
43
+ containerMessages.innerText = dataToRender;
44
+ });
@@ -1,87 +1,20 @@
1
- // Config:
2
-
3
-
4
- // UI:
5
-
6
- var loginContainer = document.querySelector("#loginContainer");
7
-
8
- var btLoadMap = document.querySelector("#btLoadMap");
9
-
10
1
 
11
2
  var sessionToken = document.querySelector("#sessionToken");
12
3
  var mapContainer = document.querySelector("#mapContainer");
13
- var iframe = document.querySelector("#map-frame");
14
- var errorContainer = document.querySelector("#Error_container");
15
- mapContainer.classList.add("hide");
4
+ var codeContent = document.querySelector("#code");
5
+ var iframesContainer = document.querySelector("#iframes-container");
16
6
 
7
+ var iframe = document.querySelector("#map-frame");
8
+ var host = document.querySelector("#overrideHost");
9
+ var btLoadIframe = document.querySelector("#btLoadIframe");
17
10
 
18
11
 
19
12
  //************** MAP EXAMPLE
20
13
 
21
- btLoadMap.addEventListener("click", function (evt) {
22
- apiUrl = document.querySelector("#apiurl").value;
23
- var debug = parseInt(document.getElementById("debug").value);
24
- //Build XMLHttpRequest for map
25
- var name = document.querySelector("#name").value;
26
- var uri = `${apiUrl}/vidromap/${name}`;
27
- var zoom = document.querySelector("#zoom").value;
28
- var data = { zoom: zoom};
29
-
30
- var srid = document.querySelector("#srid").value;
31
- if(srid){
32
- data.srid = srid;
33
- }
34
- var geoserver = document.querySelector("#geoserver").value;
35
- if(geoserver){
36
- data.geoserver = geoserver;
37
- }
38
- var geoserverdata = document.querySelector("#geoserverdata").value;
39
- if(geoserverdata){
40
- data.geoserverdata = geoserverdata;
41
- }
42
- var show_layers = document.querySelector("#show_layers").value;
43
- if(show_layers){
44
- data.show_layers = show_layers;
45
- }
46
- var extent = document.querySelector("#extent").value;
47
- if(extent){
48
- data.extent = extent;
49
- }
50
-
51
-
52
- var oReq = new XMLHttpRequest();
53
-
54
- oReq.addEventListener("load", mapListener);
55
- oReq.open("POST", uri, true);
56
- oReq.setRequestHeader("Content-type", "application/json");
57
- oReq.send(JSON.stringify(data));
58
- console.log("Attempt to load map", `${apiUrl}/vidromap/${name}`);
59
- });
60
-
61
- function mapListener() {
62
- if (this.status === 200) {
63
- console.log("mapListener response", this.responseText);
64
- var res = JSON.parse(this.responseText);
65
- errorContainer.classList.add("hide");
66
- mapContainer.classList.remove("hide");
67
- iframe.src = `${res.message.iframe}?sessionToken=${res.message.sessionToken}`;
68
- sessionToken.innerHTML = res.message.sessionToken;
69
- localStorage.setItem("iframe", iframe.src);
70
- localStorage.setItem("sessionToken", res.message.sessionToken);
71
- } else {
72
- console.error(this.status);
73
- var res = JSON.parse(this.responseText);
74
- console.log(res.error);
75
- //show DOM error element
76
- errorContainer.innerHTML = res.error;
77
- errorContainer.classList.remove("hide");
78
- mapContainer.classList.add("hide");
79
- }
80
- }
81
- //************** END MAP EXAMPLE
82
-
83
-
84
-
85
-
86
-
87
-
14
+ if(btLoadIframe){
15
+ btLoadIframe.addEventListener("click", function (evt) {
16
+ if(codeContent.value!=""){
17
+ iframesContainer.innerHTML = codeContent.value;
18
+ }
19
+ });
20
+ }
@@ -6,74 +6,71 @@
6
6
  <link rel="icon" type="image/png" href="https://www.vidrosoftware.com/favicon/favicon-16x16.png" sizes="16x16" />
7
7
  </head>
8
8
  <body>
9
- <div class="form">
10
- <div>
11
- Api URL <input type="text" name="apiurl" id="apiurl" value="http://localhost" size="30">
12
- </div>
13
- </div>
9
+
14
10
 
15
11
 
16
12
  <div class="form" id="userData">
17
- <h1>Map Properties</h1>
13
+ <h1>Vidromap</h1>
18
14
 
15
+ <div id="sessionToken"></div>
19
16
  <div>
20
- Zoom: <input type="text" name="zoom" id="zoom" size="5" value="">
21
- </div>
22
- <div>
23
- Custom logo: <input type="text" name="logo" id="logo" size="25" value="">
24
- </div>
25
- <div>
26
- Name: <input type="text" name="name" id="name" size="25" value="opentest">
27
- </div>
28
- <div>
29
- Srid: <input type="text" name="srid" id="srid" size="18" placeholder="EPSG:4326" value="EPSG:25831">
30
- </div>
31
- <div>
32
- Geo server: <input type="text" name="geoserver" id="geoserver" size="54" value=""placeholder="https://nv.napr.gov.ge/geoserver/wms"> <small>Geo server url</small>
33
- </div>
34
- <div>
35
- Show Layers: <input type="text" name="show_layers" id="show_layers" size="25" value="" placeholder="NG_REG_LAYER"> <small>Show layers on map load</small>
17
+ Paste your code here:<br> <textarea name="code" id="code" rows="10" cols="100" placeholder=""><iframe id="map-frame" name="map-frame" src="http://localhost:3000?sessionToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2NTQ5MzMyMTksImF1ZCI6ImM1NzhjY2IyODFlMTY1ZGEwODljZWZlYzgxMGE5NDliNDllYWU5ODEiLCJkYXRhIjp7Inpvb20iOjksImJhY2tncm91bmQiOiJDYXJ0b0RCTGlnaHQiLCJzcmlkIjpudWxsLCJleHRlbnQiOm51bGwsImdlb3NlcnZpY2UiOiJRR0lTIiwibmFtZSI6IlBVTlRTTU9TVFJFSUcyIiwicHJldmlldyI6dHJ1ZSwiYXBpIjoiaHR0cHM6XC9cL2FwaS52aWRyb3NvZnR3YXJlLmNvbVwvIiwidHlwZSI6InZpZHJvbWFwIiwidG9rZW4iOiIwZGNkZTI2MjdhNDk0MTcxNjk0YTIxZmFmNjcwNmE5NiIsInNob3dfbGF5ZXJzIjoiUFVOVFNNT1NUUkVJRyIsImlkIjoxOTEsImxvZ28iOiJodHRwczpcL1wvd3d3LnZpZHJvc29mdHdhcmUuY29tXC9sb2dvc1wvVklEUk8uc3ZnIn19.qq2NOgCYPGqauE0IbCAoZoU8kHUaqhk9Z43f1ahFmNVAnjGpQ12xv2ITsvDR4g9LhfJg2s3MQaUKreZQTesIvDPLJGrwrCriDiBrsHnfgh0S0G3wQdUw58KxQapVVJKqznCK9QVaCQiA2xAm4HcLeRBHGpjd7f0sRa1kkGc-MGUkT5-S4WfPhJa7svs2YKM2n17MRBR5KCI6Ujlw-HMTt-UnBFs7CcHcvq-P5rbEs4UzMmvAiwM3Do-w3Mwx2fAeTq3RD1TdAobvPM3SiFKjoQINDW-4zj3Ds0Iuc2NNdIGzJX7hKelD80hXm5iHO3N8M-Du8lX2YCQS1qkz-XeKmRhKkLP_WCDC1ry1yKwTvd6xWvR_Hz1YbeAm6jmUYp6gIf0UZl_ZuwA-UQjMCWWmDrNvO9it215OwUEDPGznuvTfg-ESNLpmvxkedQoIsrVIRuSMwH4Vk990OMXSvYsZbJJZb71Z9BA1HhMQQ-ifT77m0vnBBfqeBikRAUhm0-uQq97JMRrb9GC9Pg_IQwg4jLtubirE5T-8JMjS6SWRfjeWdHmzFHngFxLkCayai7j8Bf8QoorBT0_zdcXYnzTKL3W9TDHmHdvQ4M8C7RVe3_NtNpJPm4ErmdWDL1NecsA8HUxWz5m6Y0FY7z8KO9hYpsRsj5MS4Q8zyldqvs91rx0" style="width:100%; height:600px;" ></iframe>
18
+
19
+ </textarea>
36
20
  </div>
37
21
  <div>
38
- Geo server data: <textarea name="geoserverdata" id="geoserverdata" rows="4" cols="50" placeholder="">{"options": {"params":{"LAYERS": "NG_REG_LAYER","FORMAT" : "image/png"},"srid" : "EPSG:4326","type" : "WMS"}}</textarea>
39
- </div>
22
+ <button id="btGetElementsFromLayer">List Elements from layer</button>
23
+ <select id="format">
24
+ <option id="xml" selected value="xml">XML</option>
25
+ <option id="json" value="json">JSON</option>
26
+ </select> <small>Output format</small> Limit:
27
+ <input type="limit" name="limit" id="limit" size="4" value="2"><br><br>
28
+ </div>
40
29
  <div>
41
- Override Capabitilites extent: <input type="text" name="extent" id="extent" size="55" value="417309, 4576150, 420550, 4578120" placeholder="397663,4615771,406392,4623596"> <small>Override project extent</small>
42
- </div>
43
- <div>
44
- Override iframe url: <input type="text" name="overrideHost" id="overrideHost" size="25" value="">
45
- </div>
46
-
47
- <div>
48
- Background: <input type="text" name="Background" id="Background" size="25" value="">
49
- </div>
50
-
51
-
52
- <div>
53
30
  Debug
31
+ <button id="btDebug">Debug</button>
54
32
  <select id="debug">
55
- <option id="1" value=1>True</option>
56
- <option id="0" selected value=0>False</option>
57
- </select>
58
- </div>
59
- <div>
60
- <button id="btLoadMap">Load Map</button>
33
+ <option id="1" selected value=1>Show logs</option>
34
+ <option id="0" value=0>Hide logs</option>
35
+ </select> <small>Show/hide component logs</small>
61
36
  </div>
62
37
  </div>
38
+ <div>
39
+ <button id="btLoadIframe">Load Map</button> -
40
+ <button id="btLoadWMSLayers">Load layers from wms</button>
41
+ </div>
63
42
  <div id="Error_container"></div>
64
- <div id="mapContainer" class="hide">
43
+ <div id="mapContainer">
65
44
 
66
- <div id="sessionToken"></div>
67
45
  <div id="iframes-container">
68
- <iframe id="map-frame" name="map-frame" src="" style="width:100%; height:600px;" allow="geolocation"></iframe>
46
+
69
47
  </div>
70
48
  <hr />
71
49
  <pre id="Result_container"></pre>
72
50
  <hr/>
51
+ <h2>Custom colors</h2>
52
+ Geom fill color: <input type="text" name="geom_fill_color" id="geom_fill_color" size="12" value="rgba(252,0,0,0.37)"><br><br>
53
+ Geom stroke color: <input type="text" name="geom_stroke_color" id="geom_stroke_color" size="12" value="rgba(252,0,0,0.37)"><br><br>
54
+ Geom stroke width: <input type="text" name="geom_stroke_width" id="geom_stroke_width" size="4" value="1"><br><br>
55
+ Geom shape for points - circle/square: <select id="geom_shape">
56
+ <option id="circle" selected value="circle">Circle</option>
57
+ <option id="square" value="square">Square</option>
58
+ </select><br><br>
59
+ Point radius: <input type="text" name="geom_radius" id="geom_radius" size="4" value="4"><br><br>
60
+ <button id="btSetColors">Set colors</button> <br><br>
61
+
73
62
  <h2>Zoom</h2>
74
63
  <button id="btZoomIn">Zoom In</button>
75
64
  <button id="btZoomOut">Zoom Out</button>
76
65
  <button id="btZoomToExtent">Zoom to extent</button>
66
+ <br><br>
67
+ <button id="btZoomToCoordinates">Zoom to coordinates</button>
68
+ ZoomToCoordinates level: <input type="text" name="zoomLevelToCoordinates" id="zoomLevelToCoordinates" size="5" value="4">
69
+ <h2>Add geometry</h2>
70
+ <button id="btAddPoint">Add point</button>
71
+ <button id="btAddPolygon">Add polygon</button>
72
+ <button id="btAddLine">Add line</button>
73
+ <button id="btClear">Clear geometries</button>
77
74
  <h2>Info</h2>
78
75
  <button id="btWMSInfo" disabled="true">WMS Info</button>
79
76
  <h2>Layers</h2>
@@ -83,11 +80,29 @@
83
80
  <button id="btGetActiveLayer">Get Active Layer</button>
84
81
  <span id="currentActiveLayer"></span>
85
82
 
83
+ <h2>Geolocation</h2>
84
+ <button id="btGeolocalize">Geolocalize User</button>
85
+ <button id="btStopGeolocalize">Cancel Geolocalize</button>
86
+
87
+ <h2>Highlight</h2>
88
+ <button id="btHighlight">Highlight geom</button>
89
+ Geom: <input type="text" name="geom" id="geom" size="25" value="">
90
+ <br>
91
+ Highlight to zoom level: <input type="text" name="zoomLevel" id="zoomLevel" size="5" value=""> or Zoom to geometry: <input type="checkbox" name="zoomToHighlightCheck" id="zoomToHighlightCheck" size="5" value="">
92
+ <h2>GeoJSON</h2>
93
+ <input type="file" id="geojsonfile" name="geojsonfile" accept="application/json"><small> Select geoJSON file</small><br><br>
94
+ <small>Or paste geoJSON content</small><br><br>
95
+ <textarea name="geojsondata" id="geojsondata" rows="10" cols="80" placeholder=""></textarea> <br><br>
96
+
97
+
98
+ <button id="btAddGeoJSON">Add GeoJSON </button><br><br>
99
+
100
+
86
101
  </div>
87
102
 
88
- <!--<script src="https://unpkg.com/@vidro/map-handler@1.0.1/dist/map-handler.js"></script>-->
103
+ <<!--script src="https://unpkg.com/@vidro/map-handler@1.0.8/dist/map-handler.js"></script>-->
89
104
  <script src="../../dist/map-handler.js"></script>
90
- <script src="../full/tester.js"></script>
91
- <script src="./vidromap.js"></script>
105
+ <script src="../full/taigua.js"></script>
106
+ <script src="./index.js"></script>
92
107
  </body>
93
108
  </html>
@@ -0,0 +1,37 @@
1
+
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <link rel="stylesheet" type="text/css" href="./css/fulla.css" media="screen" />
5
+ <body>
6
+ <div><iframe id="map-frame" name="map-frame" width="100%" height="750" allow="geolocation"
7
+ src="https://component.vidrosoftware.com?sessionToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJmYzYyYmY3ZTcyN2I5N2MxMTU3YzRjODQ0MjgxOGYyM2E5MDM0MmYyIiwiZGF0YSI6eyJ6b29tIjo5LCJiYWNrZ3JvdW5kIjoiQ2FydG9EQkxpZ2h0Iiwic3JpZCI6bnVsbCwiZXh0ZW50IjpudWxsLCJnZW9zZXJ2aWNlIjoiUUdJUyIsIm5hbWUiOiJQVU5UU01PU1RSRUlHMiIsInByZXZpZXciOmZhbHNlLCJhcGkiOiJodHRwczpcL1wvYXBpLnZpZHJvc29mdHdhcmUuY29tXC8iLCJ0eXBlIjoidmlkcm9tYXAiLCJ0b2tlbiI6ImIzYWM0N2M0MDIzYzJiMjBmNTU2MGVkZGFlMzllMDIyIiwic2hvd19sYXllcnMiOiJQVU5UU01PU1RSRUlHIiwiaWQiOjE5MSwibG9nbyI6Imh0dHBzOlwvXC93d3cudmlkcm9zb2Z0d2FyZS5jb21cL2xvZ29zXC9WSURSTy5zdmcifX0.V810R82nV0qpw4UcZQuUfINuTeCXSOX7bOwJzMxWurTcHXw-Zxlzb753aQuI0-biodJQrIvV_MQMh5PJImrKQOEEDa-z4pDiEhiHo1uAdOHLRHBmcdG7p_ejRVc76LGeIF3Dh566pnPPAFZRSdsd_tS5Wdeye84OTyUoQG9oZ27UsE-ctr43Umlo1oi-As0g41ITv6nuao51hSd1xOAqozKYqf1IUVY-z4g9EbvVikOn8RVs9BIedQOA3YtKPeV_UXMpjBIWgjnJDCkty08DYxZGsxnaoKo2YoBOTR9deaRIEVygvXPY485hJY3mD25SSmuJof474WlpmyVqSPZTunAMU7uRBCV-XpMYb9hlLzG0mXB26E-l41PEZGwPsBi0p-QvnYFcUhT2F9pZckcI63lxU4-XRdaTbaG0N3Aznk9zO6_RC3QEHp6fLaq74zrMUbOROR5gkBmEAg28PkUNv4zMPV91lcx6qLJVkO7M_4uzr9bSJmifC7XFvm5MiRSgdfEVCG4-TNnc_V-ake_ijNAFU-YsmSoZ2HejbZf61uemYu6S8_JnTAS1fGamv4DA4L0cDsCfNcwtbC-yIaQeRdq36b1Q612RcWIChX8MHpb_RoRfrI-lLsyf8VgX24I0piAAq9TAIsk2UYFu10ebYR0kpeMzXS0wxkKE-ArfTFU"></iframe>
8
+ </div>
9
+ <div id="botonera">
10
+
11
+ <button id="btZoomIn" name="btZoomIn"> <img id="img" src="./img/zoom-in.png"/></button>
12
+ <button id="btZoomOut" name="btZoomOut"><img id="img" src="./img/zoom-out.png"></button>
13
+ <button id="btPosition" name="btPosition"><img id="img" src="./img/geo.png"></button>
14
+ <button id="btZoomToCoordinates" name="btZoomToCoordinates"><img id="img" src="./img/geo.png"></button>
15
+ <button id="btGetElementsFromLayer" name="btGetElementsFromLayer">Get Elements from layer</button>
16
+ <br>
17
+ <label>Cercar:</label>
18
+ <ul>
19
+ <li><a href="">Punt 1</a></li>
20
+ <li><a href="">Punt 2</a></li>
21
+ </ul>
22
+
23
+ </div>
24
+ <p>
25
+ <a href="http://jigsaw.w3.org/css-validator/check/referer">
26
+ <img style="border:0;width:88px;height:31px"
27
+ src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
28
+ alt="¡CSS Válido!" />
29
+ </a>
30
+ </p>
31
+
32
+
33
+ <div id="messages"></div>
34
+ </body>
35
+ <script src="https://unpkg.com/@vidro/map-handler@1.0.7/dist/map-handler.js"></script>
36
+ <script src="main.js"></script>
37
+ </html>
@@ -0,0 +1,160 @@
1
+ var sessionToken =
2
+ "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2NTQ5MzMyMTksImF1ZCI6ImM1NzhjY2IyODFlMTY1ZGEwODljZWZlYzgxMGE5NDliNDllYWU5ODEiLCJkYXRhIjp7Inpvb20iOjksImJhY2tncm91bmQiOiJDYXJ0b0RCTGlnaHQiLCJzcmlkIjpudWxsLCJleHRlbnQiOm51bGwsImdlb3NlcnZpY2UiOiJRR0lTIiwibmFtZSI6IlBVTlRTTU9TVFJFSUcyIiwicHJldmlldyI6dHJ1ZSwiYXBpIjoiaHR0cHM6XC9cL2FwaS52aWRyb3NvZnR3YXJlLmNvbVwvIiwidHlwZSI6InZpZHJvbWFwIiwidG9rZW4iOiIwZGNkZTI2MjdhNDk0MTcxNjk0YTIxZmFmNjcwNmE5NiIsInNob3dfbGF5ZXJzIjoiUFVOVFNNT1NUUkVJRyIsImlkIjoxOTEsImxvZ28iOiJodHRwczpcL1wvd3d3LnZpZHJvc29mdHdhcmUuY29tXC9sb2dvc1wvVklEUk8uc3ZnIn19.qq2NOgCYPGqauE0IbCAoZoU8kHUaqhk9Z43f1ahFmNVAnjGpQ12xv2ITsvDR4g9LhfJg2s3MQaUKreZQTesIvDPLJGrwrCriDiBrsHnfgh0S0G3wQdUw58KxQapVVJKqznCK9QVaCQiA2xAm4HcLeRBHGpjd7f0sRa1kkGc-MGUkT5-S4WfPhJa7svs2YKM2n17MRBR5KCI6Ujlw-HMTt-UnBFs7CcHcvq-P5rbEs4UzMmvAiwM3Do-w3Mwx2fAeTq3RD1TdAobvPM3SiFKjoQINDW-4zj3Ds0Iuc2NNdIGzJX7hKelD80hXm5iHO3N8M-Du8lX2YCQS1qkz-XeKmRhKkLP_WCDC1ry1yKwTvd6xWvR_Hz1YbeAm6jmUYp6gIf0UZl_ZuwA-UQjMCWWmDrNvO9it215OwUEDPGznuvTfg-ESNLpmvxkedQoIsrVIRuSMwH4Vk990OMXSvYsZbJJZb71Z9BA1HhMQQ-ifT77m0vnBBfqeBikRAUhm0-uQq97JMRrb9GC9Pg_IQwg4jLtubirE5T-8JMjS6SWRfjeWdHmzFHngFxLkCayai7j8Bf8QoorBT0_zdcXYnzTKL3W9TDHmHdvQ4M8C7RVe3_NtNpJPm4ErmdWDL1NecsA8HUxWz5m6Y0FY7z8KO9hYpsRsj5MS4Q8zyldqvs91rx0"
3
+ var clickedCoordinates = null;
4
+ var communicator = new VidroMaps.Communicator({
5
+ sessionToken: sessionToken,
6
+ });
7
+ var selected_layer; //active layer
8
+
9
+ //ZoomIn -------------------------------------------------------------
10
+ var btZoomIn = document.getElementById("btZoomIn");
11
+ btZoomIn.addEventListener("click", function () {
12
+ console.log("Zoom In");
13
+ communicator.ZoomIn();
14
+ });
15
+ //ZoomOut-------------------------------------------------------------
16
+ var btZoomOut = document.getElementById("btZoomOut");
17
+ btZoomOut.addEventListener("click", function () {
18
+ console.log("Zoom Out");
19
+ communicator.ZoomOut();
20
+ });
21
+
22
+ //GeoPosicionament----------------------------------------------------
23
+ var btZoomToCoordinates = document.getElementById("btZoomToCoordinates");
24
+
25
+ /*btZoomToCoordinates.addEventListener("click", function () {
26
+ //console.log("m'han clicat i demanat geolocalitzacio");
27
+ //containerMessages.innerHTML = `Coordinates -> x: ${data.coordinates[0]}, y: ${data.coordinates[1]}`;
28
+ //communicator.zoomToCoordinates;
29
+
30
+ communicator.zoomToCoordinates(419006.12985785044, 4576698.8136144625, 18);
31
+ console.log("llego")
32
+ });
33
+ */
34
+
35
+ //zoomTocoordinates
36
+ if(btZoomToCoordinates){
37
+ btZoomToCoordinates.addEventListener("click", function(){
38
+ console.log("btZoomToCoordinates clicked" )
39
+ let level = 18;
40
+ if(document.getElementById('zoomLevelToCoordinates')){
41
+ //zoom Level
42
+ level = document.getElementById('zoomLevelToCoordinates').value
43
+ }
44
+ if(clickedCoordinates){
45
+ communicator.zoomToCoordinates(clickedCoordinates[0],clickedCoordinates[1],level);
46
+ }else{
47
+ console.error("No coordinates provided");
48
+ }
49
+ });
50
+ }
51
+
52
+
53
+ var btZoomToExtent = document.querySelector("#btZoomToExtent");
54
+
55
+ //capa actual
56
+ var currentActiveLayer = null;
57
+ function cleanContainers(){
58
+ Error_container.innerHTML = '';
59
+ Result_container.innerHTML = '';
60
+ }
61
+
62
+ //per veure les capas
63
+ communicator.on("layers", function(data){
64
+ console.log("layers received",data);
65
+ //fillDisplayedLayersSelect(data);
66
+ selected_layer = data[0]; //select first layer from available layers
67
+ });
68
+
69
+ //error event
70
+ communicator.on("error", function(data){
71
+ console.error("error",data);
72
+ cleanContainers();
73
+ Error_container.innerHTML = data.error;
74
+ });
75
+
76
+ //clicked coordinates
77
+ communicator.on("coordinates", function (data) {
78
+ console.info("coordinates", data);
79
+
80
+ clickedCoordinates = [data.coordinates[0], data.coordinates[1]];
81
+ containerMessages.innerHTML = `Clicked coordinates -> x: ${data.coordinates[0]}, y: ${data.coordinates[1]}`;
82
+ });
83
+
84
+ //event geolocation
85
+ communicator.on("geolocation", function(data){
86
+ console.info("geolocation",data);
87
+ containerMessages.innerHTML= `Geolocation: -> ${data}`;
88
+
89
+ cleanContainers();
90
+ });
91
+
92
+ //info event
93
+ communicator.on("info", function(data){
94
+ console.log("info received",data);
95
+ var dataToRender = data.data;
96
+ //depending on infoType, data.data can be an string or a JSON
97
+ if(data.infoType==="giswater"){
98
+ dataToRender = JSON.stringify(data.data)
99
+ }
100
+ cleanContainers();
101
+ Result_container.innerText = dataToRender;
102
+ });
103
+
104
+
105
+
106
+
107
+ var containerMessages = document.getElementById("messages");
108
+
109
+ //geolocation
110
+ communicator.on("geolocation", function(data){
111
+ console.info("geolocation",data);
112
+ cleanContainers();
113
+ result_container.innerHTML = `Clicked coordinates -> x: ${data.coordinates[0]}, y: ${data.coordinates[1]}`;
114
+
115
+ });
116
+
117
+
118
+
119
+ communicator.on("onZoomChange", function (data) {
120
+ console.log("onZoomChange event", data);
121
+ //containerMessages.innerHTML = `Zoom aplicat: ${data}`;
122
+ });
123
+
124
+ communicator.on("loaded", function (data) {
125
+ console.log("loaded event", data);
126
+ });
127
+
128
+ //zoom to extent
129
+ if(btZoomToExtent){
130
+ btZoomToExtent.addEventListener("click", function(){
131
+ cleanContainers();
132
+ communicator.zoomToExtent();
133
+ });
134
+ }
135
+
136
+
137
+ //info event
138
+ communicator.on("info", function (data) {
139
+ console.log("info received", data);
140
+ var dataToRender = data.data;
141
+ //depending on infoType, data.data can be an string or a JSON
142
+ if (data.infoType === "giswater") {
143
+ dataToRender = JSON.stringify(data.data);
144
+ }
145
+
146
+ containerMessages.innerText = dataToRender;
147
+ });
148
+
149
+
150
+ //NEW
151
+
152
+ var btGetElementsFromLayer = document.querySelector("#btGetElementsFromLayer");
153
+ if(btGetElementsFromLayer){
154
+
155
+ btGetElementsFromLayer.addEventListener("click", function(){
156
+ let limit = document.getElementById('limit') ? document.getElementById('limit').value : 100;
157
+ let format = document.getElementById('format') ? document.getElementById('format').value : 'xml';
158
+ communicator.getElementsFromLayer(selected_layer,limit,format);
159
+ });
160
+ }
package/flows.md ADDED
@@ -0,0 +1,73 @@
1
+ # Map Handler flows
2
+
3
+ This document defines use case flows of map handler
4
+
5
+ ## Vidromaps basic flow
6
+
7
+ Vidromaps basic flow
8
+
9
+ 1. Login to giswater - API `letsgo`
10
+ 2. Get map - API `map/{project_id}`
11
+ 3. Load iframe
12
+
13
+ ![](doc/vidromaps-basic.png)
14
+
15
+ ## Giswater basic flow
16
+
17
+ Giswater basic flow
18
+
19
+ 1. Login to giswater - API `letsgo`
20
+ 2. Get map - API `map/{project_id}`
21
+ 3. Load iframe
22
+
23
+
24
+ ![](doc/giswater.png)
25
+
26
+ ## Giswater info
27
+
28
+ Giswater info can be performed using mapHandler or usind API REST methods
29
+
30
+ 1. Login to giswater - API `letsgo`
31
+ 2. Get map - API `map/{project_id}`
32
+ 3. Load iframe
33
+ 4. Instance mapHandler - `new VidroMaps.Communicator({sessionToken});`
34
+ 5. Click on map
35
+
36
+ **Using mapHandler**
37
+
38
+ 6. Info`mapHandler.js` method [**`infofromcoordinates `**](https://github.com/Vidro-Software-SL/maphandler#infofromcoordinates)
39
+ ![](doc/giswaterInfo.png)
40
+
41
+ **Using API REST**
42
+
43
+ 6. Listen event [**`coordinates`**](https://github.com/Vidro-Software-SL/maphandler#coordinates)
44
+ 7. POST to API `giswater/info` with x, y, srid and device parameters.
45
+
46
+ ![](doc/giswaterInfoApi.png)
47
+
48
+
49
+ ## Giswater display layer
50
+
51
+ Display a Giswater layer using mapHandler
52
+
53
+ 1. Login to giswater - API `letsgo`
54
+ 2. Get map - API `map/{project_id}`
55
+ 3. Load iframe
56
+ 4. Instance mapHandler - `new VidroMaps.Communicator({sessionToken});`
57
+ 5. Render layer using `mapHandler.js` method [**`toggleLayer`**](https://github.com/Vidro-Software-SL/maphandler#togglelayer)
58
+
59
+ ![](doc/togglelayergiswater.png)
60
+
61
+ ## Giswater JSON layer
62
+
63
+ Giswater layers can be rendered as geojson.
64
+
65
+ 1. Login to giswater - API `letsgo`
66
+ 2. Get map - API `map/{project_id}`
67
+ 3. Load iframe
68
+ 4. Get geojson data for a layer - API `giswater/geojson/{project_id}/{layer_name}`.
69
+ 5. Instance mapHandler - `new VidroMaps.Communicator({sessionToken});`
70
+ 6. Render geojson data using `maphandler.js` method [**`addGeoJSON`**](https://github.com/Vidro-Software-SL/maphandler#addgeojson)
71
+ ![](doc/giswatergeojson.png)
72
+
73
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vidro/map-handler",
3
- "version": "1.0.6",
3
+ "version": "1.0.9",
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": {