@vidro/map-handler 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.md +87 -8
  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/full/apidemo.js +43 -1
  12. package/examples/full/cachedToken.dat +1 -1
  13. package/examples/full/cachedTokenData.dat +1 -1
  14. package/examples/full/index.php +32 -16
  15. package/examples/full/tester.js +122 -20
  16. package/examples/integration/tool/css/dist/home.css.min.css +0 -0
  17. package/examples/integration/tool/css/dist/home.min.css +1 -0
  18. package/examples/integration/tool/css/dist/home.min.css.map +10 -0
  19. package/examples/integration/tool/css/dist/style-login.css.min.css +0 -0
  20. package/examples/integration/tool/css/dist/style-login.min.css +1 -0
  21. package/examples/integration/tool/css/dist/style-login.min.css.map +10 -0
  22. package/examples/integration/tool/css/dist/style.css.min.css +0 -0
  23. package/examples/integration/tool/css/dist/style.min.css +1 -0
  24. package/examples/integration/tool/css/dist/style.min.css.map +23 -0
  25. package/examples/integration/tool/css/master/_bottom-sheet-2.scss +103 -0
  26. package/examples/integration/tool/css/master/_bottom-sheet.scss +142 -0
  27. package/examples/integration/tool/css/master/_colors.scss +35 -0
  28. package/examples/integration/tool/css/master/_dropdown-form.scss +167 -0
  29. package/examples/integration/tool/css/master/_forms.scss +416 -0
  30. package/examples/integration/tool/css/master/_header.scss +134 -0
  31. package/examples/integration/tool/css/master/_menu-toc.scss +135 -0
  32. package/examples/integration/tool/css/master/_menu-tools.scss +187 -0
  33. package/examples/integration/tool/css/master/_mixins.scss +42 -0
  34. package/examples/integration/tool/css/master/_notifyjs.scss +39 -0
  35. package/examples/integration/tool/css/master/_ol-map-controls.scss +117 -0
  36. package/examples/integration/tool/css/master/_simplelightbox.scss +287 -0
  37. package/examples/integration/tool/css/master/_toc-config.scss +28 -0
  38. package/examples/integration/tool/css/master/_toc-layouts.scss +173 -0
  39. package/examples/integration/tool/css/master/_tooltip.scss +34 -0
  40. package/examples/integration/tool/css/master/home.scss +266 -0
  41. package/examples/integration/tool/css/master/style-login.scss +240 -0
  42. package/examples/integration/tool/css/master/style.scss +166 -0
  43. package/examples/integration/tool/img/doc-gallery-placeholder.svg +3 -0
  44. package/examples/integration/tool/img/home/ic_calendar-clock.svg +1 -0
  45. package/examples/integration/tool/img/home/ic_caret-down.svg +1 -0
  46. package/examples/integration/tool/img/home/ic_cog.svg +1 -0
  47. package/examples/integration/tool/img/home/ic_marker.svg +1 -0
  48. package/examples/integration/tool/img/home/ic_play-circle.svg +1 -0
  49. package/examples/integration/tool/img/home/ic_power.svg +1 -0
  50. package/examples/integration/tool/img/home/ic_squares.svg +1 -0
  51. package/examples/integration/tool/img/home/ic_user-pointer.svg +1 -0
  52. package/examples/integration/tool/img/home/ic_user-square.svg +1 -0
  53. package/examples/integration/tool/img/home/logo_footer.svg +1 -0
  54. package/examples/integration/tool/img/ic/accessControl.svg +1 -0
  55. package/examples/integration/tool/img/ic/account-location.svg +1 -0
  56. package/examples/integration/tool/img/ic/actionDelete.svg +64 -0
  57. package/examples/integration/tool/img/ic/actionOpen.svg +64 -0
  58. package/examples/integration/tool/img/ic/addFile.svg +100 -0
  59. package/examples/integration/tool/img/ic/addFile_off.svg +102 -0
  60. package/examples/integration/tool/img/ic/arrow-left.svg +1 -0
  61. package/examples/integration/tool/img/ic/arrow-right-drop-circle-outline.svg +1 -0
  62. package/examples/integration/tool/img/ic/bt_add_photo.svg +3 -0
  63. package/examples/integration/tool/img/ic/bug.svg +1 -0
  64. package/examples/integration/tool/img/ic/caret-down-bottomsheet.svg +3 -0
  65. package/examples/integration/tool/img/ic/checkbox-blank-outline-grey.svg +8 -0
  66. package/examples/integration/tool/img/ic/checkbox-blank-outline-white.svg +8 -0
  67. package/examples/integration/tool/img/ic/checkbox-blank-outline.svg +1 -0
  68. package/examples/integration/tool/img/ic/checkbox-marked-outline-grey.svg +8 -0
  69. package/examples/integration/tool/img/ic/checkbox-marked-outline-white.svg +8 -0
  70. package/examples/integration/tool/img/ic/checkbox-marked-outline.svg +1 -0
  71. package/examples/integration/tool/img/ic/chevron-down-grey.svg +7 -0
  72. package/examples/integration/tool/img/ic/chevron-down-white.svg +7 -0
  73. package/examples/integration/tool/img/ic/chevron-down.svg +1 -0
  74. package/examples/integration/tool/img/ic/chevron-right-grey.svg +7 -0
  75. package/examples/integration/tool/img/ic/chevron-right-white.svg +7 -0
  76. package/examples/integration/tool/img/ic/chevron-right.svg +1 -0
  77. package/examples/integration/tool/img/ic/comment-text-outline.svg +1 -0
  78. package/examples/integration/tool/img/ic/cookie.svg +1 -0
  79. package/examples/integration/tool/img/ic/delete.svg +1 -0
  80. package/examples/integration/tool/img/ic/dot.svg +1 -0
  81. package/examples/integration/tool/img/ic/dump.svg +1 -0
  82. package/examples/integration/tool/img/ic/e.svg +9 -0
  83. package/examples/integration/tool/img/ic/eye-off.svg +1 -0
  84. package/examples/integration/tool/img/ic/eye.svg +1 -0
  85. package/examples/integration/tool/img/ic/forbidden.svg +1 -0
  86. package/examples/integration/tool/img/ic/form-title-1.svg +3 -0
  87. package/examples/integration/tool/img/ic/group.svg +1 -0
  88. package/examples/integration/tool/img/ic/hamburger.svg +1 -0
  89. package/examples/integration/tool/img/ic/ic-users.svg +1 -0
  90. package/examples/integration/tool/img/ic/ic_dropdown-form-close.svg +3 -0
  91. package/examples/integration/tool/img/ic/ic_dropdown-form-link.svg +3 -0
  92. package/examples/integration/tool/img/ic/ic_feature-edit-cancel.svg +14 -0
  93. package/examples/integration/tool/img/ic/ic_feature-edit-save.svg +14 -0
  94. package/examples/integration/tool/img/ic/ic_gallery-item-delete.svg +3 -0
  95. package/examples/integration/tool/img/ic/ic_gallery-item-view.svg +3 -0
  96. package/examples/integration/tool/img/ic/ic_gps.svg +3 -0
  97. package/examples/integration/tool/img/ic/ic_search.svg +5 -0
  98. package/examples/integration/tool/img/ic/ic_selector_fechas.svg +63 -0
  99. package/examples/integration/tool/img/ic/ic_zoom-to-extent.svg +3 -0
  100. package/examples/integration/tool/img/ic/icon_reminder.png +0 -0
  101. package/examples/integration/tool/img/ic/image-gallery-placeholder.svg +55 -0
  102. package/examples/integration/tool/img/ic/imaqua.svg +87 -0
  103. package/examples/integration/tool/img/ic/incidencia.svg +77 -0
  104. package/examples/integration/tool/img/ic/info_multi_selection.svg +230 -0
  105. package/examples/integration/tool/img/ic/layers.svg +1 -0
  106. package/examples/integration/tool/img/ic/map-marker.svg +3 -0
  107. package/examples/integration/tool/img/ic/map.svg +1 -0
  108. package/examples/integration/tool/img/ic/measure_area.svg +111 -0
  109. package/examples/integration/tool/img/ic/minus.svg +7 -0
  110. package/examples/integration/tool/img/ic/notification.svg +1 -0
  111. package/examples/integration/tool/img/ic/offline.svg +3 -0
  112. package/examples/integration/tool/img/ic/online.svg +1 -0
  113. package/examples/integration/tool/img/ic/pencil.svg +3 -0
  114. package/examples/integration/tool/img/ic/plus.svg +1 -0
  115. package/examples/integration/tool/img/ic/polygon_selection.svg +68 -0
  116. package/examples/integration/tool/img/ic/power.svg +1 -0
  117. package/examples/integration/tool/img/ic/remoteLocalized.svg +4 -0
  118. package/examples/integration/tool/img/ic/remoteStartLocalize.svg +4 -0
  119. package/examples/integration/tool/img/ic/ruler.svg +125 -0
  120. package/examples/integration/tool/img/ic/selection-plus.svg +10 -0
  121. package/examples/integration/tool/img/ic/selection.svg +1 -0
  122. package/examples/integration/tool/img/ic/settings.svg +1 -0
  123. package/examples/integration/tool/img/ic/sort.svg +1 -0
  124. package/examples/integration/tool/img/ic/sort_asc.svg +1 -0
  125. package/examples/integration/tool/img/ic/sort_desc.svg +1 -0
  126. package/examples/integration/tool/img/ic/spreadsheet.svg +3 -0
  127. package/examples/integration/tool/img/ic/times.svg +1 -0
  128. package/examples/integration/tool/img/ic/toolbar/AB3.svg +1 -0
  129. package/examples/integration/tool/img/ic/toolbar/AB4.svg +1 -0
  130. package/examples/integration/tool/img/ic/toolbar/IC1.svg +1 -0
  131. package/examples/integration/tool/img/ic/toolbar/TB1.svg +1 -0
  132. package/examples/integration/tool/img/ic/toolbar/TB11.svg +5 -0
  133. package/examples/integration/tool/img/ic/toolbar/TB2.svg +1 -0
  134. package/examples/integration/tool/img/ic/toolbar/TB20.svg +1 -0
  135. package/examples/integration/tool/img/ic/toolbar/TB21.svg +54 -0
  136. package/examples/integration/tool/img/ic/toolbar/TB3.svg +1 -0
  137. package/examples/integration/tool/img/ic/toolbar/TB31.svg +1 -0
  138. package/examples/integration/tool/img/ic/toolbar/TB32.svg +57 -0
  139. package/examples/integration/tool/img/ic/toolbar/TB4.svg +1 -0
  140. package/examples/integration/tool/img/ic/toolbar/TB5.svg +1 -0
  141. package/examples/integration/tool/img/ic/toolbar/TB6.svg +1 -0
  142. package/examples/integration/tool/img/ic/toolbar/TB7.svg +1 -0
  143. package/examples/integration/tool/img/ic/toolbar/TB8.svg +1 -0
  144. package/examples/integration/tool/img/ic/tools.svg +28 -0
  145. package/examples/integration/tool/img/ic/user.svg +1 -0
  146. package/examples/integration/tool/img/ic/vector-polygon.svg +1 -0
  147. package/examples/integration/tool/img/ic/visit_manager.svg +135 -0
  148. package/examples/integration/tool/img/logo-footer-login.png +0 -0
  149. package/examples/integration/tool/img/logo-footer.png +0 -0
  150. package/examples/integration/tool/img/logo-header-login.png +0 -0
  151. package/examples/integration/tool/img/logo-header-login@2x.png +0 -0
  152. package/examples/integration/tool/img/logo-header-login@3x.png +0 -0
  153. package/examples/integration/tool/img/logo-header.png +0 -0
  154. package/examples/integration/tool/img/logo-header@2x.png +0 -0
  155. package/examples/integration/tool/img/logo-header@3x.png +0 -0
  156. package/examples/integration/tool/img/logo_project.png +0 -0
  157. package/examples/integration/tool/img/photo-gallery-placeholder.svg +3 -0
  158. package/examples/integration/tool/img/pixel.png +0 -0
  159. package/examples/integration/tool/index.html +228 -0
  160. package/examples/integration/tool/js/demo.js +238 -0
  161. package/examples/integration/tool/js/interface.js +147 -0
  162. package/examples/integration/tool/js/jquery.js +4 -0
  163. package/examples/integration/vanguardia.html +6636 -0
  164. package/examples/simple/index.html +1 -1
  165. package/examples/vidromap/index.js +2 -2
  166. package/examples/vidromap/index.php +18 -3
  167. package/flows.md +73 -0
  168. package/package.json +1 -1
  169. package/src/index.js +75 -2
@@ -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.eyJleHAiOjE2NDE5ODcyOTEsImF1ZCI6IjUyNmY5ODMyZDIxYWI0ZDI4ZjU0M2MxZWM1NzYxYTc0MjE3YjFiMDkiLCJkYXRhIjp7Inpvb20iOjE0LCJiYWNrZ3JvdW5kIjoiQ2FydG9EQkxpZ2h0Iiwic3JpZCI6bnVsbCwiZXh0ZW50IjpudWxsLCJnZW9zZXJ2aWNlIjoiUUdJUyIsIm5hbWUiOiJ0ZXN0ZmlsZSIsInByZXZpZXciOnRydWUsImFwaSI6Imh0dHBzOlwvXC9hcGkudmlkcm9zb2Z0d2FyZS5jb21cLyIsInR5cGUiOiJ2aWRyb21hcCIsInRva2VuIjoiMjNhYzNjMmY1YTEzYTY1NmVkNDBhYjU3N2E3YmU4Y2QiLCJzaG93X2xheWVycyI6ImxpbmVzIiwiaWQiOjYsImxvZ28iOiJodHRwczpcL1wvd3d3LnZpZHJvc29mdHdhcmUuY29tXC9sb2dvc1wvVklEUk8uc3ZnIn19.VlK69JRMTdHskUuYMT86sH_8adKZdwZHpOu3I1EzU-RQcVGaNIA-dwgqEPQG9qVXJNNWVlYA3YkPk7S0g4XpwHvdOZLqKO8a5Iwx9gYCPOAemGnNc3pQzf_OtBv8h2OuBZDRPeZEzB7PJ7WgRqvXJG6SsNWzaU8TXrMjs2aYiaS7ztSMIORT0jzwq1ssjl1lTwWdNOz_hgZVwcJNbBb1-aSTIV8SD3miru4iujokVDCLj8IhM_chb6RipegZb_lQc6AEm6vcxDBBIlpIXuJq-cot05w_eY6LuL9HPsah1ifxWGSQ8HM_-QLzna7eMEb9KzMHGmx0EIpO5bRBy358QLXkesxpxjLMe2BhRef-j7UlFojptVhsvZKCdE6-KCmzz52WH5d9xgFxlfypQopx3jPeMqZmIRdGQSaedKIgvnj8T_hiltG08KItM5LatVC-9L1XnDpffRlHIc96IOmYzWpDcbIltK6k4NudohV49liWBP0sv-d51TGSNePGnyXZS4rdNAouo-sI5V2fvtTn3nOfmMqMmlXEc41m43tE_ULIo9R1S0SIg7taPEc3vImzRNL6lcAhLjT0TIQZrQXBpiL_Ml8SRhPm7PWdw-VEIFhl3aZFA5e-BpK3A4fb_pn-Ooc1Dg0hVBnteX5COAcZJkYHqYhKBhKP23UaWoLG3l0" 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>
@@ -13,8 +13,8 @@ var btLoadIframe = document.querySelector("#btLoadIframe");
13
13
 
14
14
  if(btLoadIframe){
15
15
  btLoadIframe.addEventListener("click", function (evt) {
16
- if(code.value!=""){
17
- iframesContainer.innerHTML = code.value;
16
+ if(codeContent.value!=""){
17
+ iframesContainer.innerHTML = codeContent.value;
18
18
  }
19
19
  });
20
20
  }
@@ -14,7 +14,9 @@
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=""></textarea>
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.eyJleHAiOjE2NDMxMjM5MTcsImF1ZCI6ImVjNWI4ZDI5OWM1NjVlZjUxYmQxZmU4MzY1OGE5NTgwNDk0MDZkMjMiLCJkYXRhIjp7Inpvb20iOjE0LCJiYWNrZ3JvdW5kIjoiQ2FydG9EQkxpZ2h0Iiwic3JpZCI6bnVsbCwiZXh0ZW50IjpudWxsLCJnZW9zZXJ2aWNlIjoiUUdJUyIsIm5hbWUiOiJ0ZXN0ZmlsZSIsInByZXZpZXciOnRydWUsImFwaSI6Imh0dHBzOlwvXC9hcGkudmlkcm9zb2Z0d2FyZS5jb21cLyIsInR5cGUiOiJ2aWRyb21hcCIsInRva2VuIjoiNmJiNTM2MjY1NWU3MzdlNjY2YzY5OGU2ZmI1ZjA5YzQiLCJzaG93X2xheWVycyI6ImxpbmVzIiwiaWQiOjYsImxvZ28iOiJodHRwczpcL1wvd3d3LnZpZHJvc29mdHdhcmUuY29tXC9sb2dvc1wvVklEUk8uc3ZnIn19.Ocv0JUFhVHRep6-bkEt0AJ9KnmXcSVc9khMzS1d3Sb33n5jAXvgt2nAjh4CckUSkJUsekuQqk6Y0ZdiWIyOp780U3S5JK962PivB00tXB_05YHPyfU5XPrVbDWTMUcww9Qg9kYdTZsTjede3cOfjbGlU_opg2igL1hlKqkbeqBY2vAfhHF_zNa2EShcEIke21AIpuAo6h-FJXzkCRSQbGtnqEhJCXWT0LNQCns5Rc1q5fKpg98iaEUFFZRu3rM58s0UTK5sUu6LAXXbRWXDw3Q4jkCuGrV58QPeqVHjJQOo70hDWvV33HFJSSJZP2TkhWapPZqw7UxhPipo4K7p9WnFBmGWQqrhQ5yiQZY92E4Y8cwAsUvLbuJwBO-jZAsk4kNI8uK9L6Uy5JvEw6G-Ce8HUbEF3E-nYQKHzKtqOpLpsgo1PNFIV7PcWlQPhFZnOtSBjhH-DCKX9QzgiKu4n9L7uKUE_7YvxeJ8Zs-Oi0QoxBPa1GJ0KYGJg4VHBPuVRSfq9Plwtv8uWG-etJQjQYCDNM6z6oWjw9m1CzS67kFp49p3ek46MdlI86URGTUDX7u4bjuvCdYZdOxYGdw6XkCMdyeIxFXX2CUOQZPeFtc3wGZbHI7-WFqkkbnBJ2fDWQfOpcUncEeCSiKuvgI9pykhCXnP7TKA0DFHCJmcDuzo"></iframe>
18
+
19
+ </textarea>
18
20
  </div>
19
21
  <div>
20
22
  Debug
@@ -38,6 +40,17 @@
38
40
  <hr />
39
41
  <pre id="Result_container"></pre>
40
42
  <hr/>
43
+ <h2>Custom colors</h2>
44
+ 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>
45
+ 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>
46
+ Geom stroke width: <input type="text" name="geom_stroke_width" id="geom_stroke_width" size="4" value="1"><br><br>
47
+ Geom shape for points - circle/square: <select id="geom_shape">
48
+ <option id="circle" selected value="circle">Circle</option>
49
+ <option id="square" value="square">Square</option>
50
+ </select><br><br>
51
+ Point radius: <input type="text" name="geom_radius" id="geom_radius" size="4" value="4"><br><br>
52
+ <button id="btSetColors">Set colors</button> <br><br>
53
+
41
54
  <h2>Zoom</h2>
42
55
  <button id="btZoomIn">Zoom In</button>
43
56
  <button id="btZoomOut">Zoom Out</button>
@@ -69,14 +82,16 @@
69
82
  <br>
70
83
  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="">
71
84
  <h2>GeoJSON</h2>
72
-
73
85
  <input type="file" id="geojsonfile" name="geojsonfile" accept="application/json"><small> Select geoJSON file</small><br><br>
74
86
  <small>Or paste geoJSON content</small><br><br>
75
87
  <textarea name="geojsondata" id="geojsondata" rows="10" cols="80" placeholder=""></textarea> <br><br>
88
+
89
+
76
90
  <button id="btAddGeoJSON">Add GeoJSON </button><br><br>
91
+
77
92
  </div>
78
93
 
79
- <script src="https://unpkg.com/@vidro/map-handler@1.0.7/dist/map-handler.js"></script>
94
+ <script src="https://unpkg.com/@vidro/map-handler@1.0.8/dist/map-handler.js"></script>
80
95
  <script src="../full/tester.js"></script>
81
96
  <script src="./index.js"></script>
82
97
  </body>
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.7",
3
+ "version": "1.0.8",
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": {
package/src/index.js CHANGED
@@ -67,10 +67,44 @@ class Communicator extends EventEmitter {
67
67
  });
68
68
  }
69
69
 
70
- toggleLayer = (layer) => {
70
+ toggleLayer = (layer,properties) => {
71
+ if(typeof properties==='undefined'){
72
+ properties = {
73
+ gutter: null,
74
+ transparent: null,
75
+ singletile: null
76
+ };
77
+ }
78
+
79
+ if(properties.singletile!==null){
80
+ if(typeof properties.singletile!=='boolean'){
81
+ properties.singletile = null;
82
+ this.emit("error",{error:"singleTile must be a Boolean"});
83
+ }
84
+ }
85
+ if(properties.gutter!=='' && properties.gutter!==null){
86
+ if(isNaN(parseInt(properties.gutter))){
87
+ properties.gutter = null;
88
+ this.emit("error",{error:"Gutter must be a number"});
89
+ }
90
+ if(properties.singletile){
91
+ properties.gutter = null;
92
+ this.emit("error",{error:"Gutter can only be user with multitile layers; set singletile to false"});
93
+ }
94
+ }
95
+
96
+ if(properties.transparent!==null){
97
+ if(typeof properties.transparent!=='boolean'){
98
+ properties.transparent = null;
99
+ this.emit("error",{error:"transparent must be a Boolean"});
100
+ }
101
+ }
71
102
  this.com.sendMessageToMap({
72
103
  type: "toggleLayer",
73
104
  layer: layer,
105
+ gutter: !isNaN(parseInt(properties.gutter)) ? parseInt(properties.gutter) : null,
106
+ transparent: properties.transparent,
107
+ singletile: properties.singletile,
74
108
  sessionToken: this.sessionToken,
75
109
  });
76
110
  }
@@ -240,7 +274,6 @@ class Communicator extends EventEmitter {
240
274
  }
241
275
 
242
276
  setDebug = (what) =>{
243
- console.log("setDebug culo",what)
244
277
  if(!isNaN(parseInt(what))){
245
278
  this.com.sendMessageToMap({
246
279
  type: "setDebug",
@@ -252,6 +285,46 @@ class Communicator extends EventEmitter {
252
285
  }
253
286
  }
254
287
 
288
+ setCustomColors = (properties)=>{
289
+ //validate data
290
+ if(typeof properties!=='object'){
291
+ console.error("properties is not an object");
292
+ return;
293
+ }
294
+ if(properties.hasOwnProperty('geom_stroke_width')){
295
+ if(isNaN(parseInt(properties.geom_stroke_width))){
296
+ console.error("geom_stroke_width is not an number");
297
+ return;
298
+ }else{
299
+ properties.geom_stroke_width = parseInt(properties.geom_stroke_width);
300
+ }
301
+ }else{
302
+ properties.geom_stroke_width = 1;
303
+ }
304
+ if(properties.hasOwnProperty('geom_radius')){
305
+ if(isNaN(parseInt(properties.geom_radius))){
306
+ console.error("geom_stroke_width is not an number");
307
+ return;
308
+ }else{
309
+ properties.geom_radius = parseInt(properties.geom_radius);
310
+ }
311
+ }else{
312
+ properties.geom_radius = 4;
313
+ }
314
+
315
+ if(properties.hasOwnProperty('geom_shape')){
316
+ if(properties.geom_shape!=="circle" && properties.geom_shape!=="square"){
317
+ properties.geom_shape = 'circle';
318
+ console.error("geom_shape must be either 'circle' or 'square'");
319
+ }
320
+ }
321
+ this.com.sendMessageToMap({
322
+ type: "setCustomColors",
323
+ properties: properties,
324
+ sessionToken: this.sessionToken,
325
+ });
326
+ }
327
+
255
328
  }
256
329
 
257
330
  export {