@vidro/map-handler 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +87 -8
- package/dist/map-handler.js +1 -1
- package/doc/giswater.png +0 -0
- package/doc/giswaterInfo.png +0 -0
- package/doc/giswaterInfoApi.png +0 -0
- package/doc/giswatergeojson.png +0 -0
- package/doc/multiTile.png +0 -0
- package/doc/multiTileNoGutter.png +0 -0
- package/doc/togglelayergiswater.png +0 -0
- package/doc/vidromaps-basic.png +0 -0
- package/examples/full/apidemo.js +43 -1
- package/examples/full/cachedToken.dat +1 -1
- package/examples/full/cachedTokenData.dat +1 -1
- package/examples/full/index.php +32 -16
- package/examples/full/tester.js +122 -20
- package/examples/integration/tool/css/dist/home.css.min.css +0 -0
- package/examples/integration/tool/css/dist/home.min.css +1 -0
- package/examples/integration/tool/css/dist/home.min.css.map +10 -0
- package/examples/integration/tool/css/dist/style-login.css.min.css +0 -0
- package/examples/integration/tool/css/dist/style-login.min.css +1 -0
- package/examples/integration/tool/css/dist/style-login.min.css.map +10 -0
- package/examples/integration/tool/css/dist/style.css.min.css +0 -0
- package/examples/integration/tool/css/dist/style.min.css +1 -0
- package/examples/integration/tool/css/dist/style.min.css.map +23 -0
- package/examples/integration/tool/css/master/_bottom-sheet-2.scss +103 -0
- package/examples/integration/tool/css/master/_bottom-sheet.scss +142 -0
- package/examples/integration/tool/css/master/_colors.scss +35 -0
- package/examples/integration/tool/css/master/_dropdown-form.scss +167 -0
- package/examples/integration/tool/css/master/_forms.scss +416 -0
- package/examples/integration/tool/css/master/_header.scss +134 -0
- package/examples/integration/tool/css/master/_menu-toc.scss +135 -0
- package/examples/integration/tool/css/master/_menu-tools.scss +187 -0
- package/examples/integration/tool/css/master/_mixins.scss +42 -0
- package/examples/integration/tool/css/master/_notifyjs.scss +39 -0
- package/examples/integration/tool/css/master/_ol-map-controls.scss +117 -0
- package/examples/integration/tool/css/master/_simplelightbox.scss +287 -0
- package/examples/integration/tool/css/master/_toc-config.scss +28 -0
- package/examples/integration/tool/css/master/_toc-layouts.scss +173 -0
- package/examples/integration/tool/css/master/_tooltip.scss +34 -0
- package/examples/integration/tool/css/master/home.scss +266 -0
- package/examples/integration/tool/css/master/style-login.scss +240 -0
- package/examples/integration/tool/css/master/style.scss +166 -0
- package/examples/integration/tool/img/doc-gallery-placeholder.svg +3 -0
- package/examples/integration/tool/img/home/ic_calendar-clock.svg +1 -0
- package/examples/integration/tool/img/home/ic_caret-down.svg +1 -0
- package/examples/integration/tool/img/home/ic_cog.svg +1 -0
- package/examples/integration/tool/img/home/ic_marker.svg +1 -0
- package/examples/integration/tool/img/home/ic_play-circle.svg +1 -0
- package/examples/integration/tool/img/home/ic_power.svg +1 -0
- package/examples/integration/tool/img/home/ic_squares.svg +1 -0
- package/examples/integration/tool/img/home/ic_user-pointer.svg +1 -0
- package/examples/integration/tool/img/home/ic_user-square.svg +1 -0
- package/examples/integration/tool/img/home/logo_footer.svg +1 -0
- package/examples/integration/tool/img/ic/accessControl.svg +1 -0
- package/examples/integration/tool/img/ic/account-location.svg +1 -0
- package/examples/integration/tool/img/ic/actionDelete.svg +64 -0
- package/examples/integration/tool/img/ic/actionOpen.svg +64 -0
- package/examples/integration/tool/img/ic/addFile.svg +100 -0
- package/examples/integration/tool/img/ic/addFile_off.svg +102 -0
- package/examples/integration/tool/img/ic/arrow-left.svg +1 -0
- package/examples/integration/tool/img/ic/arrow-right-drop-circle-outline.svg +1 -0
- package/examples/integration/tool/img/ic/bt_add_photo.svg +3 -0
- package/examples/integration/tool/img/ic/bug.svg +1 -0
- package/examples/integration/tool/img/ic/caret-down-bottomsheet.svg +3 -0
- package/examples/integration/tool/img/ic/checkbox-blank-outline-grey.svg +8 -0
- package/examples/integration/tool/img/ic/checkbox-blank-outline-white.svg +8 -0
- package/examples/integration/tool/img/ic/checkbox-blank-outline.svg +1 -0
- package/examples/integration/tool/img/ic/checkbox-marked-outline-grey.svg +8 -0
- package/examples/integration/tool/img/ic/checkbox-marked-outline-white.svg +8 -0
- package/examples/integration/tool/img/ic/checkbox-marked-outline.svg +1 -0
- package/examples/integration/tool/img/ic/chevron-down-grey.svg +7 -0
- package/examples/integration/tool/img/ic/chevron-down-white.svg +7 -0
- package/examples/integration/tool/img/ic/chevron-down.svg +1 -0
- package/examples/integration/tool/img/ic/chevron-right-grey.svg +7 -0
- package/examples/integration/tool/img/ic/chevron-right-white.svg +7 -0
- package/examples/integration/tool/img/ic/chevron-right.svg +1 -0
- package/examples/integration/tool/img/ic/comment-text-outline.svg +1 -0
- package/examples/integration/tool/img/ic/cookie.svg +1 -0
- package/examples/integration/tool/img/ic/delete.svg +1 -0
- package/examples/integration/tool/img/ic/dot.svg +1 -0
- package/examples/integration/tool/img/ic/dump.svg +1 -0
- package/examples/integration/tool/img/ic/e.svg +9 -0
- package/examples/integration/tool/img/ic/eye-off.svg +1 -0
- package/examples/integration/tool/img/ic/eye.svg +1 -0
- package/examples/integration/tool/img/ic/forbidden.svg +1 -0
- package/examples/integration/tool/img/ic/form-title-1.svg +3 -0
- package/examples/integration/tool/img/ic/group.svg +1 -0
- package/examples/integration/tool/img/ic/hamburger.svg +1 -0
- package/examples/integration/tool/img/ic/ic-users.svg +1 -0
- package/examples/integration/tool/img/ic/ic_dropdown-form-close.svg +3 -0
- package/examples/integration/tool/img/ic/ic_dropdown-form-link.svg +3 -0
- package/examples/integration/tool/img/ic/ic_feature-edit-cancel.svg +14 -0
- package/examples/integration/tool/img/ic/ic_feature-edit-save.svg +14 -0
- package/examples/integration/tool/img/ic/ic_gallery-item-delete.svg +3 -0
- package/examples/integration/tool/img/ic/ic_gallery-item-view.svg +3 -0
- package/examples/integration/tool/img/ic/ic_gps.svg +3 -0
- package/examples/integration/tool/img/ic/ic_search.svg +5 -0
- package/examples/integration/tool/img/ic/ic_selector_fechas.svg +63 -0
- package/examples/integration/tool/img/ic/ic_zoom-to-extent.svg +3 -0
- package/examples/integration/tool/img/ic/icon_reminder.png +0 -0
- package/examples/integration/tool/img/ic/image-gallery-placeholder.svg +55 -0
- package/examples/integration/tool/img/ic/imaqua.svg +87 -0
- package/examples/integration/tool/img/ic/incidencia.svg +77 -0
- package/examples/integration/tool/img/ic/info_multi_selection.svg +230 -0
- package/examples/integration/tool/img/ic/layers.svg +1 -0
- package/examples/integration/tool/img/ic/map-marker.svg +3 -0
- package/examples/integration/tool/img/ic/map.svg +1 -0
- package/examples/integration/tool/img/ic/measure_area.svg +111 -0
- package/examples/integration/tool/img/ic/minus.svg +7 -0
- package/examples/integration/tool/img/ic/notification.svg +1 -0
- package/examples/integration/tool/img/ic/offline.svg +3 -0
- package/examples/integration/tool/img/ic/online.svg +1 -0
- package/examples/integration/tool/img/ic/pencil.svg +3 -0
- package/examples/integration/tool/img/ic/plus.svg +1 -0
- package/examples/integration/tool/img/ic/polygon_selection.svg +68 -0
- package/examples/integration/tool/img/ic/power.svg +1 -0
- package/examples/integration/tool/img/ic/remoteLocalized.svg +4 -0
- package/examples/integration/tool/img/ic/remoteStartLocalize.svg +4 -0
- package/examples/integration/tool/img/ic/ruler.svg +125 -0
- package/examples/integration/tool/img/ic/selection-plus.svg +10 -0
- package/examples/integration/tool/img/ic/selection.svg +1 -0
- package/examples/integration/tool/img/ic/settings.svg +1 -0
- package/examples/integration/tool/img/ic/sort.svg +1 -0
- package/examples/integration/tool/img/ic/sort_asc.svg +1 -0
- package/examples/integration/tool/img/ic/sort_desc.svg +1 -0
- package/examples/integration/tool/img/ic/spreadsheet.svg +3 -0
- package/examples/integration/tool/img/ic/times.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/AB3.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/AB4.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/IC1.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB1.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB11.svg +5 -0
- package/examples/integration/tool/img/ic/toolbar/TB2.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB20.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB21.svg +54 -0
- package/examples/integration/tool/img/ic/toolbar/TB3.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB31.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB32.svg +57 -0
- package/examples/integration/tool/img/ic/toolbar/TB4.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB5.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB6.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB7.svg +1 -0
- package/examples/integration/tool/img/ic/toolbar/TB8.svg +1 -0
- package/examples/integration/tool/img/ic/tools.svg +28 -0
- package/examples/integration/tool/img/ic/user.svg +1 -0
- package/examples/integration/tool/img/ic/vector-polygon.svg +1 -0
- package/examples/integration/tool/img/ic/visit_manager.svg +135 -0
- package/examples/integration/tool/img/logo-footer-login.png +0 -0
- package/examples/integration/tool/img/logo-footer.png +0 -0
- package/examples/integration/tool/img/logo-header-login.png +0 -0
- package/examples/integration/tool/img/logo-header-login@2x.png +0 -0
- package/examples/integration/tool/img/logo-header-login@3x.png +0 -0
- package/examples/integration/tool/img/logo-header.png +0 -0
- package/examples/integration/tool/img/logo-header@2x.png +0 -0
- package/examples/integration/tool/img/logo-header@3x.png +0 -0
- package/examples/integration/tool/img/logo_project.png +0 -0
- package/examples/integration/tool/img/photo-gallery-placeholder.svg +3 -0
- package/examples/integration/tool/img/pixel.png +0 -0
- package/examples/integration/tool/index.html +228 -0
- package/examples/integration/tool/js/demo.js +238 -0
- package/examples/integration/tool/js/interface.js +147 -0
- package/examples/integration/tool/js/jquery.js +4 -0
- package/examples/integration/vanguardia.html +6636 -0
- package/examples/simple/index.html +1 -1
- package/examples/vidromap/index.js +2 -2
- package/examples/vidromap/index.php +18 -3
- package/flows.md +73 -0
- package/package.json +1 -1
- 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(
|
17
|
-
iframesContainer.innerHTML =
|
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=""></
|
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.
|
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
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 {
|