@vidro/map-handler 1.0.6 → 1.0.9
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.
- package/README.md +187 -10
- 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/externalwms/index.js +20 -0
- package/examples/externalwms/index.php +88 -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 +31 -16
- package/examples/full/tester.js +172 -12
- 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/multipleIframes/index.js +82 -0
- package/examples/multipleIframes/index.php +52 -0
- package/examples/serverLess/dist/index.23420cfa.js +120 -117
- package/examples/serverLess/dist/index.23420cfa.js.map +1 -1
- package/examples/serverLess/dist/index.html +38 -1
- package/examples/serverLess/index.html +2 -1
- package/examples/serverLess/main.js +2 -2
- package/examples/simple/index.html +1 -1
- package/examples/taigua/index.html +15 -0
- package/examples/taigua/main.js +44 -0
- package/examples/vidromap/index.js +12 -79
- package/examples/vidromap/index.php +63 -48
- package/examples/xavi/index.html +37 -0
- package/examples/xavi/main.js +160 -0
- package/flows.md +73 -0
- package/package.json +1 -1
- package/src/index.js +160 -44
- package/src/shared/iframe-communicator.js +12 -5
- package/examples/vidromap/vidromap.js +0 -13
- package/examples/vidromap/vidromap.php +0 -59
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Map Handler
|
|
2
2
|
|
|
3
|
-
#### Version 1.0.
|
|
3
|
+
#### Version 1.0.9 - June 2022
|
|
4
4
|
|
|
5
5
|
Tool to achieve the easiest way of communication with the map iframe.
|
|
6
6
|
|
|
@@ -8,6 +8,8 @@ Tool to achieve the easiest way of communication with the map iframe.
|
|
|
8
8
|
- [Events](#Events)
|
|
9
9
|
- [Methods](#Methods)
|
|
10
10
|
|
|
11
|
+
Some of the multiple use case flows are documented in [flows.md](flows.md)
|
|
12
|
+
|
|
11
13
|
## TL;DR
|
|
12
14
|
|
|
13
15
|
```
|
|
@@ -40,7 +42,7 @@ Tool to achieve the easiest way of communication with the map iframe.
|
|
|
40
42
|
|
|
41
43
|
### 0. Pre-requisites
|
|
42
44
|
|
|
43
|
-
You should have one iframe already created on the DOM with the attributes `name="map-frame"`.
|
|
45
|
+
You should have one iframe already created on the DOM with the attributes `name="map-frame" id="map-frame"`.
|
|
44
46
|
|
|
45
47
|
### 1. Include the library:
|
|
46
48
|
|
|
@@ -94,6 +96,7 @@ setDebug(0);
|
|
|
94
96
|
communicator.on("onZoomChange", function(data){
|
|
95
97
|
console.log("onZoomChange event",data);
|
|
96
98
|
});
|
|
99
|
+
|
|
97
100
|
|
|
98
101
|
### Available events
|
|
99
102
|
|
|
@@ -148,6 +151,14 @@ Notifies an array of displayed GeoJSON layers
|
|
|
148
151
|
|
|
149
152
|
Notifies wich layer is marked as active
|
|
150
153
|
|
|
154
|
+
##### WMSInfoAvailable
|
|
155
|
+
|
|
156
|
+
Notifies when WMS is available for this map
|
|
157
|
+
|
|
158
|
+
##### availableWMSLayers
|
|
159
|
+
|
|
160
|
+
List of available layers from WMS server
|
|
161
|
+
|
|
151
162
|
##### coordinates
|
|
152
163
|
|
|
153
164
|
Notifies clicked coordinates (x,y)
|
|
@@ -177,6 +188,14 @@ Notifies info results. There're 2 availables infos `wms` and `giswater`
|
|
|
177
188
|
{type: "info", infoType: "giswater", data: {…}}
|
|
178
189
|
```
|
|
179
190
|
|
|
191
|
+
##### layerElements
|
|
192
|
+
|
|
193
|
+
Receives a list of elements from a `getElementsFromLayer request
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
{type: "layerElements", data: {xml or json}}
|
|
197
|
+
```
|
|
198
|
+
|
|
180
199
|
##### geolocation
|
|
181
200
|
|
|
182
201
|
Notifies user position, coordinates (x,y)
|
|
@@ -236,13 +255,14 @@ Zooms to given coordinates
|
|
|
236
255
|
|
|
237
256
|
> Params
|
|
238
257
|
|
|
239
|
-
-
|
|
258
|
+
- lat (x) `<integer>`
|
|
259
|
+
- long (y) `<integer>`
|
|
240
260
|
- zoomLevel `<integer>` - zoom level
|
|
241
261
|
|
|
242
262
|
> E.G.
|
|
243
263
|
|
|
244
264
|
```
|
|
245
|
-
zoomToCoordinates(
|
|
265
|
+
zoomToCoordinates(419006.12985785044, 4576698.8136144625,18);
|
|
246
266
|
|
|
247
267
|
```
|
|
248
268
|
|
|
@@ -277,13 +297,33 @@ Shows/hides a layer
|
|
|
277
297
|
> Params
|
|
278
298
|
|
|
279
299
|
- layerName `<string>` - layer name
|
|
300
|
+
- properties `<object>` - _optional_ layer properties
|
|
301
|
+
- gutter `<integer>` - The size in pixels of the gutter around image tiles to ignore, only applies for multitile layer
|
|
302
|
+
- singletile `<boolean>` - SingleTile Layer
|
|
303
|
+
- transparent `<boolean>` - Transparent Layer
|
|
304
|
+
|
|
305
|
+
By default, layer properties will be:
|
|
306
|
+
|
|
307
|
+
`gutter: 0`
|
|
308
|
+
|
|
309
|
+
`singletile: false` - will render a multitile layer
|
|
310
|
+
|
|
311
|
+
`transparent: true`
|
|
280
312
|
|
|
281
313
|
> E.G.
|
|
282
314
|
|
|
315
|
+
With no properties
|
|
316
|
+
|
|
283
317
|
```
|
|
284
318
|
toggleLayer('somelayer_name');
|
|
285
319
|
```
|
|
286
320
|
|
|
321
|
+
With properties
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
toggleLayer('somelayer_name', {gutter: 10, transparent: false, singletile: false);
|
|
325
|
+
```
|
|
326
|
+
|
|
287
327
|
##### setActiveLayer()
|
|
288
328
|
|
|
289
329
|
Sets a layer as acticve layer, used for infos
|
|
@@ -304,6 +344,37 @@ Reloads displayed layers
|
|
|
304
344
|
reloadDisplayedLayers();
|
|
305
345
|
```
|
|
306
346
|
|
|
347
|
+
##### loadWMSAvailableLayers
|
|
348
|
+
|
|
349
|
+
Gets a list of available layers from WMS server
|
|
350
|
+
|
|
351
|
+
> E.G.
|
|
352
|
+
|
|
353
|
+
```
|
|
354
|
+
loadWMSAvailableLayers();
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
An `availableWMSLayers ` event will be received after calling the method.
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
##### getElementsFromLayer
|
|
362
|
+
|
|
363
|
+
Gets a list of elements from a layer, based on a WMS request
|
|
364
|
+
|
|
365
|
+
```
|
|
366
|
+
getElementsFromLayer(layer,limit,format)
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
> Params
|
|
370
|
+
|
|
371
|
+
- layer `<string>` - layer name
|
|
372
|
+
- limit `<integer>` - limit output number of elements (default 100)
|
|
373
|
+
- format `<string>` - output format
|
|
374
|
+
- `xml` - default
|
|
375
|
+
- `json`
|
|
376
|
+
|
|
377
|
+
|
|
307
378
|
##### infoFromCoordinates
|
|
308
379
|
|
|
309
380
|
There're two available info from coordinates `wms` or `giswater`.
|
|
@@ -380,8 +451,10 @@ Params
|
|
|
380
451
|
|
|
381
452
|
let options = {
|
|
382
453
|
'geom': 'MULTILINESTRING((418596.62555076234 4577083.383681167,419026.2319996517 4577216.795306675))',
|
|
383
|
-
'
|
|
384
|
-
|
|
454
|
+
'zoom':{
|
|
455
|
+
'type':'level',
|
|
456
|
+
'zoomLevel':6
|
|
457
|
+
}
|
|
385
458
|
}
|
|
386
459
|
|
|
387
460
|
Highlight(options);
|
|
@@ -390,7 +463,9 @@ Highlight(options);
|
|
|
390
463
|
|
|
391
464
|
let options = {
|
|
392
465
|
'geom': 'MULTILINESTRING((418596.62555076234 4577083.383681167,419026.2319996517 4577216.795306675))',
|
|
393
|
-
'
|
|
466
|
+
'zoom':{
|
|
467
|
+
'type':'element'
|
|
468
|
+
}
|
|
394
469
|
}
|
|
395
470
|
|
|
396
471
|
Highlight(options);
|
|
@@ -493,6 +568,58 @@ getGiswaterLayerAvailableFilters(layername);
|
|
|
493
568
|
getGiswaterLayerAvailableFilters("Arc");
|
|
494
569
|
```
|
|
495
570
|
|
|
571
|
+
##### setCustomColors
|
|
572
|
+
|
|
573
|
+
Sets colors and stroke width for added & highlight geometries.
|
|
574
|
+
|
|
575
|
+
Properties:
|
|
576
|
+
|
|
577
|
+
- `geom_stroke_color` - stroke color in RGB format
|
|
578
|
+
- `geom_fill_color` - fill color in RGB format
|
|
579
|
+
- `geom_stroke_width` - stroke width in pixels, default 1.
|
|
580
|
+
- `geom_shape` - shape por point, `circle`(default) or `square`
|
|
581
|
+
- `radius` - point radius or square side in pixels. Default 4.
|
|
582
|
+
|
|
583
|
+
```
|
|
584
|
+
setCustomColors({geom_stroke_color, geom_fill_color, geom_stroke_width,geom_shape});
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
> E.G.
|
|
588
|
+
|
|
589
|
+
```
|
|
590
|
+
setCustomColors({
|
|
591
|
+
geom_stroke_color: 'rgb(19, 39, 99,0.5)',
|
|
592
|
+
geom_fill_color: 'rgb(19, 39, 99,0.5)',
|
|
593
|
+
geom_stroke_width: 1,
|
|
594
|
+
geom_shape: 'circle',
|
|
595
|
+
radius: 2
|
|
596
|
+
});
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
On Bmaps projects, default values are taken from Backoffice:
|
|
600
|
+
|
|
601
|
+
```
|
|
602
|
+
geom_stroke_color -> Bmaps: geom_select_stroke_color
|
|
603
|
+
geom_fill_color -> Bmaps: geom_select_fill_color
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
### Multiple iframes
|
|
609
|
+
|
|
610
|
+
Is possible to use multiple iframe on a single page, follow this steps.
|
|
611
|
+
|
|
612
|
+
- Set to your `iframe` tags the id & value
|
|
613
|
+
- Add to each `iframe.src` `&domId=IFRAME_ID`
|
|
614
|
+
- Instantiate each iframe:
|
|
615
|
+
|
|
616
|
+
```
|
|
617
|
+
var communicator = new VidroMaps.Communicator({
|
|
618
|
+
sessionToken: sessionToken,
|
|
619
|
+
id:'IFRAME_ID'
|
|
620
|
+
});
|
|
621
|
+
```
|
|
622
|
+
|
|
496
623
|
## Examples
|
|
497
624
|
|
|
498
625
|
### Simple
|
|
@@ -507,7 +634,7 @@ A simple integration with just zoom buttons
|
|
|
507
634
|
2. Request a user token to the API
|
|
508
635
|
3. Loads the first map of the user
|
|
509
636
|
|
|
510
|
-
[
|
|
637
|
+
[https://www.vidrosoftware.com/examples/simple/?user=USER&pwd=USER_PASWORD&api=API_URL]()
|
|
511
638
|
|
|
512
639
|
### Full
|
|
513
640
|
|
|
@@ -521,7 +648,19 @@ Full integration
|
|
|
521
648
|
2. Stores token and last map loaded in a fake cache
|
|
522
649
|
3. There's a form for choosing map and customize map parameters
|
|
523
650
|
|
|
524
|
-
[
|
|
651
|
+
[https://www.vidrosoftware.com/examples/full/]()
|
|
652
|
+
|
|
653
|
+
### Vidromaps
|
|
654
|
+
|
|
655
|
+
`examples/vidromaps/`
|
|
656
|
+
|
|
657
|
+
Vidromaps integration
|
|
658
|
+
|
|
659
|
+
##### How it works
|
|
660
|
+
|
|
661
|
+
1. Paste iframe code
|
|
662
|
+
|
|
663
|
+
[https://www.vidrosoftware.com/examples/vidromaps/]()
|
|
525
664
|
|
|
526
665
|
### Serverless
|
|
527
666
|
|
|
@@ -534,4 +673,42 @@ Server less sample integration
|
|
|
534
673
|
1. Gets user, password and API url from the url
|
|
535
674
|
2. Request a user token to the API
|
|
536
675
|
3. Loads the first map of the user with one layer rendered
|
|
537
|
-
4. On map click, performs an wms info, displays one attribute, highlights the clicked point and centers map on that point
|
|
676
|
+
4. On map click, performs an wms info, displays one attribute, highlights the clicked point and centers map on that point
|
|
677
|
+
|
|
678
|
+
### Mutiple iframes
|
|
679
|
+
|
|
680
|
+
`examples/multipleiframes/`
|
|
681
|
+
|
|
682
|
+
Multiple iframes integration
|
|
683
|
+
|
|
684
|
+
##### How it works
|
|
685
|
+
|
|
686
|
+
1. Replace `YOUR_SESSION_TOKEN` with your session token code on both inputs `code1` and `code2`.
|
|
687
|
+
|
|
688
|
+
[https://www.vidrosoftware.com/examples/multipleiframes/]()
|
|
689
|
+
|
|
690
|
+
### Known issues
|
|
691
|
+
|
|
692
|
+
- **Custom logo is not displayed**
|
|
693
|
+
|
|
694
|
+
Could be CORS issue. Check the headers sent by your server.
|
|
695
|
+
|
|
696
|
+
With Apache can be solved with and `.htaccess` file with this content:
|
|
697
|
+
|
|
698
|
+
```
|
|
699
|
+
Header set Access-Control-Allow-Origin "*"
|
|
700
|
+
Header add Cross-Origin-Resource-Policy: "cross-origin"
|
|
701
|
+
Header add Cross-Origin-Embedder-Policy: "require-corp"
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
- **QGIS Broken symbology**
|
|
705
|
+
|
|
706
|
+
QGIS multi tile layers could show broken symbology:
|
|
707
|
+
|
|
708
|
+

|
|
709
|
+
|
|
710
|
+
This can be solved using `singletile: true` or adding `gutter: value in pixels` if is a multitiule layer, on toggleLayer method.
|
|
711
|
+
|
|
712
|
+
Is if is a Giswwater project, you can set this options (`Render mode` and `Gutter`) on Bmaps backoffice.
|
|
713
|
+
|
|
714
|
+

|
package/dist/map-handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VidroMaps=t():e.VidroMaps=t()}(self,(function(){return(()=>{"use strict";var e={187:e=>{var t,n="object"==typeof Reflect?Reflect:null,o=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(n,o){function r(n){e.removeListener(t,i),o(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}v(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&v(e,"error",t,{once:!0})}(e,r)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function c(e,t,n,o){var r,i,s,c;if(a(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),void 0===s)s=i[t]=n,++e._eventsCount;else if("function"==typeof s?s=i[t]=o?[n,s]:[s,n]:o?s.unshift(n):s.push(n),(r=u(e))>0&&s.length>r&&!s.warned){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=s.length,c=f,console&&console.warn&&console.warn(c)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,n){var o={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=f.bind(o);return r.listener=n,o.wrapFn=r,r}function p(e,t,n){var o=e._events;if(void 0===o)return[];var r=o[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):d(r,r.length)}function y(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function d(e,t){for(var n=new Array(t),o=0;o<t;++o)n[o]=e[o];return n}function v(e,t,n,o){if("function"==typeof e.on)o.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(i){o.once&&e.removeEventListener(t,r),n(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return u(this)},i.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,f=d(u,c);for(n=0;n<c;++n)o(f[n],this,t)}return!0},i.prototype.addListener=function(e,t){return c(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return c(this,e,t,!0)},i.prototype.once=function(e,t){return a(t),this.on(e,l(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,l(this,e,t)),this},i.prototype.removeListener=function(e,t){var n,o,r,i,s;if(a(t),void 0===(o=this._events))return this;if(void 0===(n=o[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,r=i;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(o[e]=n[0]),void 0!==o.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,n,o;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,i=Object.keys(n);for(o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},i.prototype.listeners=function(e){return p(this,e,!0)},i.prototype.rawListeners=function(e){return p(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},i.prototype.listenerCount=y,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{Communicator:()=>l});var e=n(187),t="undefined"==typeof window,r=function(e){t||window.top.frames["map-frame"].postMessage(e,"*")};function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?u(e):t}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(l,e);var t,n,o=(t=l,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,o=c(t);if(n){var r=c(this).constructor;e=Reflect.construct(o,arguments,r)}else e=o.apply(this,arguments);return a(this,e)});function l(e){var t,n=e.sessionToken;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),f(u(t=o.call(this)),"onMessageReceived",(function(e){switch(e.data.type){case"onZoomChange":t.emit("onZoomChange",e.data.zoom);break;case"geomAdded":t.emit("geomAdded",e.data.geom_astext);break;case"layers":t.emit("layers",e.data.layers);break;case"geoJSONlayers":t.emit("geoJSONlayers",e.data.layers);break;case"info":t.emit("info",e.data);break;case"error":t.emit("error",e.data);break;case"coordinates":t.emit("coordinates",e.data);break;case"activeLayer":t.emit("activeLayer",e.data);break;case"geolocation":t.emit("geolocation",e.data);break;case"WMSInfoAvailable":t.emit("WMSInfoAvailable",e.data);break;case"giswaterTiledBackgroundDisplayed":t.emit("giswaterTiledBackgroundDisplayed",e.data);break;case"giswaterTiledBackgroundAvailable":t.emit("giswaterTiledBackgroundAvailable",e.data);break;case"GiswaterLayerAvailableFilters":t.emit("GiswaterLayerAvailableFilters",e.data);break;case"loaded":t.emit("loaded",e.data)}})),f(u(t),"ZoomIn",(function(){r({type:"zoomIn",sessionToken:t.sessionToken})})),f(u(t),"ZoomOut",(function(){r({type:"zoomOut",sessionToken:t.sessionToken})})),f(u(t),"AddGeom",(function(e){r({type:"AddGeom",geom:e,sessionToken:t.sessionToken})})),f(u(t),"toggleLayer",(function(e){r({type:"toggleLayer",layer:e,sessionToken:t.sessionToken})})),f(u(t),"setActiveLayer",(function(e){r({type:"setActiveLayer",layer:e,sessionToken:t.sessionToken})})),f(u(t),"getActiveLayer",(function(){r({type:"getActiveLayer",sessionToken:t.sessionToken})})),f(u(t),"clear",(function(){r({type:"clear",sessionToken:t.sessionToken})})),f(u(t),"Highlight",(function(e){r({type:"highlight",geom:e.geom,zoom:e.zoom,sessionToken:t.sessionToken})})),f(u(t),"zoomToExtent",(function(){r({type:"zoomToExtent",sessionToken:t.sessionToken})})),f(u(t),"zoomToCoordinates",(function(e,n,o){isNaN(parseInt(o))||r({type:"zoomToCoordinates",sessionToken:t.sessionToken,coordinates:[e,n],zoomLevel:o})})),f(u(t),"infoFromCoordinates",(function(e,n,o){r({type:"infoFromCoordinates",info:e,layer:void 0===n?null:n,hitTolerance:void 0!==o?parseInt(o):5,sessionToken:t.sessionToken})})),f(u(t),"Geolocalize",(function(e){r({type:"Geolocalize",toggle:e,sessionToken:t.sessionToken})})),f(u(t),"toggleGiswaterTiled",(function(e){r({type:"toggleGiswaterTiled",toggle:e,sessionToken:t.sessionToken})})),f(u(t),"reloadDisplayedLayers",(function(){return r({type:"reloadDisplayedLayers",sessionToken:t.sessionToken})})),f(u(t),"addGeoJSON",(function(e,n,o){return e?r({type:"addGeoJSON",geoJSON:e,options:void 0!==n?n:{fillcolor:null,strokecolor:null},name:o||Math.random().toString(36).substring(7),sessionToken:t.sessionToken}):void t.emit("error",{error:"No geoJSON data"})})),f(u(t),"clearGeoJSON",(function(){return r({type:"clearGeoJSON",sessionToken:t.sessionToken})})),f(u(t),"removeGeoJSONLayer",(function(e){return e?r({type:"removeGeoJSONLayer",name:e,sessionToken:t.sessionToken}):void t.emit("error",{error:"No geoJSON data"})})),f(u(t),"setGiswaterFilters",(function(e){var n=e;if(e){if("object"!=i(e)){e=(e=(e=e.trim()).replace(/^\s+|\s+$/g,"")).replace(/\\/g,"");try{n=JSON.parse(e)}catch(e){return void t.emit("error",{error:"Filters is not a valid JSON"})}}return r({type:"setGiswaterFilters",filters:n,sessionToken:t.sessionToken})}t.emit("error",{error:"No filters"})})),f(u(t),"getGiswaterLayerAvailableFilters",(function(e){return e?r({type:"getGiswaterLayerAvailableFilters",name:e,sessionToken:t.sessionToken}):void t.emit("error",{error:"No layer_name"})})),f(u(t),"setDebug",(function(e){if(!isNaN(parseInt(e)))return r({type:"setDebug",what:e,sessionToken:t.sessionToken})})),"undefined"==typeof window?a(t):(window.addEventListener("message",(function(e){return t.onMessageReceived(e)})),t.sessionToken=n,t)}return l}(e.EventEmitter)})(),o})()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VidroMaps=t():e.VidroMaps=t()}(self,(function(){return(()=>{"use strict";var e={187:e=>{var t,o="object"==typeof Reflect?Reflect:null,n=o&&"function"==typeof o.apply?o.apply:function(e,t,o){return Function.prototype.apply.call(e,t,o)};t=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(o,n){function r(o){e.removeListener(t,s),n(o)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),o([].slice.call(arguments))}y(e,t,s,{once:!0}),"error"!==t&&function(e,t,o){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,r)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var i=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,o,n){var r,s,i,u;if(a(o),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,o.listener?o.listener:o),s=e._events),i=s[t]),void 0===i)i=s[t]=o,++e._eventsCount;else if("function"==typeof i?i=s[t]=n?[o,i]:[i,o]:n?i.unshift(o):i.push(o),(r=l(e))>0&&i.length>r&&!i.warned){i.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=i.length,u=c,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,o){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:o},r=c.bind(n);return r.listener=o,n.wrapFn=r,r}function f(e,t,o){var n=e._events;if(void 0===n)return[];var r=n[t];return void 0===r?[]:"function"==typeof r?o?[r.listener||r]:[r]:o?function(e){for(var t=new Array(e.length),o=0;o<t.length;++o)t[o]=e[o].listener||e[o];return t}(r):m(r,r.length)}function p(e){var t=this._events;if(void 0!==t){var o=t[e];if("function"==typeof o)return 1;if(void 0!==o)return o.length}return 0}function m(e,t){for(var o=new Array(t),n=0;n<t;++n)o[n]=e[n];return o}function y(e,t,o,n){if("function"==typeof e.on)n.once?e.once(t,o):e.on(t,o);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(s){n.once&&e.removeEventListener(t,r),o(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(e){for(var t=[],o=1;o<arguments.length;o++)t.push(arguments[o]);var r="error"===e,s=this._events;if(void 0!==s)r=r&&void 0===s.error;else if(!r)return!1;if(r){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var l=s[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var u=l.length,c=m(l,u);for(o=0;o<u;++o)n(c[o],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},s.prototype.removeListener=function(e,t){var o,n,r,s,i;if(a(t),void 0===(n=this._events))return this;if(void 0===(o=n[e]))return this;if(o===t||o.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,o.listener||t));else if("function"!=typeof o){for(r=-1,s=o.length-1;s>=0;s--)if(o[s]===t||o[s].listener===t){i=o[s].listener,r=s;break}if(r<0)return this;0===r?o.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(o,r),1===o.length&&(n[e]=o[0]),void 0!==n.removeListener&&this.emit("removeListener",e,i||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,o,n;if(void 0===(o=this._events))return this;if(void 0===o.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==o[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete o[e]),this;if(0===arguments.length){var r,s=Object.keys(o);for(n=0;n<s.length;++n)"removeListener"!==(r=s[n])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=o[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return f(this,e,!0)},s.prototype.rawListeners=function(e){return f(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,o),s.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{Communicator:()=>d});var e=o(187),t="undefined"==typeof window,r=function e(o){var n,r,s=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r=function(e){t||window.top.frames[s.domId].postMessage(e,"*")},(n="sendMessageToMap")in this?Object.defineProperty(this,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):this[n]=r,this.domId="map-frame","string"==typeof o.id&&(this.domId=o.id)};function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?l(e):t}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(d,e);var t,o,n=(t=d,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=u(t);if(o){var r=u(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return a(this,e)});function d(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),c(l(t=n.call(this)),"onMessageReceived",(function(e){switch(e.data.type){case"onZoomChange":t.emitEvent("onZoomChange",e.data.zoom,e.data.domId);break;case"geomAdded":t.emitEvent("geomAdded",e.data.geom_astext,e.data.domId);break;case"layers":t.emitEvent("layers",e.data.layers,e.data.domId);break;case"geoJSONlayers":t.emitEvent("geoJSONlayers",e.data.layers,e.data.domId);break;case"info":t.emitEvent("info",e.data,e.data.domId);break;case"error":t.emitEvent("error",e.data,e.data.domId);break;case"coordinates":t.emitEvent("coordinates",e.data,e.data.domId);break;case"activeLayer":t.emitEvent("activeLayer",e.data,e.data.domId);break;case"geolocation":t.emitEvent("geolocation",e.data,e.data.domId);break;case"WMSInfoAvailable":t.emitEvent("WMSInfoAvailable",e.data,e.data.domId);break;case"giswaterTiledBackgroundDisplayed":t.emitEvent("giswaterTiledBackgroundDisplayed",e.data,e.data.domId);break;case"giswaterTiledBackgroundAvailable":t.emitEvent("giswaterTiledBackgroundAvailable",e.data,e.data.domId);break;case"GiswaterLayerAvailableFilters":t.emitEvent("GiswaterLayerAvailableFilters",e.data,e.data.domId);break;case"loaded":t.emitEvent("loaded",e.data,e.data.domId);break;case"availableWMSLayers":t.emitEvent("availableWMSLayers",e.data.layers,e.data.domId);break;case"layerElements":t.emitEvent("layerElements",e.data,e.data.domId)}})),c(l(t),"emitEvent",(function(e,o,n){n===t.domId&&(delete o.domId,t.emit(e,o))})),c(l(t),"ZoomIn",(function(){t.com.sendMessageToMap({type:"zoomIn",sessionToken:t.sessionToken})})),c(l(t),"ZoomOut",(function(){t.com.sendMessageToMap({type:"zoomOut",sessionToken:t.sessionToken})})),c(l(t),"AddGeom",(function(e){t.com.sendMessageToMap({type:"AddGeom",geom:e,sessionToken:t.sessionToken})})),c(l(t),"toggleLayer",(function(e,o){void 0===o&&(o={gutter:null,transparent:null,singletile:null}),null!==o.singletile&&"boolean"!=typeof o.singletile&&(o.singletile=null,t.emit("error",{error:"singleTile must be a Boolean"})),""!==o.gutter&&null!==o.gutter&&(isNaN(parseInt(o.gutter))&&(o.gutter=null,t.emit("error",{error:"Gutter must be a number"})),o.singletile&&(o.gutter=null,t.emit("error",{error:"Gutter can only be user with multitile layers; set singletile to false"}))),null!==o.transparent&&"boolean"!=typeof o.transparent&&(o.transparent=null,t.emit("error",{error:"transparent must be a Boolean"})),t.com.sendMessageToMap({type:"toggleLayer",layer:e,gutter:isNaN(parseInt(o.gutter))?null:parseInt(o.gutter),transparent:o.transparent,singletile:o.singletile,sessionToken:t.sessionToken})})),c(l(t),"setActiveLayer",(function(e){t.com.sendMessageToMap({type:"setActiveLayer",layer:e,sessionToken:t.sessionToken})})),c(l(t),"getActiveLayer",(function(){t.com.sendMessageToMap({type:"getActiveLayer",sessionToken:t.sessionToken})})),c(l(t),"loadWMSAvailableLayers",(function(){t.com.sendMessageToMap({type:"loadWMSAvailableLayers",sessionToken:t.sessionToken})})),c(l(t),"clear",(function(){t.com.sendMessageToMap({type:"clear",sessionToken:t.sessionToken})})),c(l(t),"Highlight",(function(e){t.com.sendMessageToMap({type:"highlight",geom:e.geom,zoom:e.zoom,sessionToken:t.sessionToken})})),c(l(t),"zoomToExtent",(function(){t.com.sendMessageToMap({type:"zoomToExtent",sessionToken:t.sessionToken})})),c(l(t),"zoomToCoordinates",(function(e,o,n){isNaN(parseInt(n))||t.com.sendMessageToMap({type:"zoomToCoordinates",sessionToken:t.sessionToken,coordinates:[e,o],zoomLevel:n})})),c(l(t),"infoFromCoordinates",(function(e,o,n){var r=void 0===o?null:o;t.com.sendMessageToMap({type:"infoFromCoordinates",info:e,layer:r,hitTolerance:void 0!==n?parseInt(n):5,sessionToken:t.sessionToken})})),c(l(t),"getElementsFromLayer",(function(e,o,n){var r=void 0===n?"xml":n.toLowerCase();if(console.log(r),"xml"===r||"json"===r)if(isNaN(o))console.error("Limit must be a number");else{var s=void 0===e?null:e;t.com.sendMessageToMap({type:"getElementsFromLayer",layer:s,limit:void 0!==o?parseInt(o):100,format:n,sessionToken:t.sessionToken})}else console.error("Format must be 'xml' or 'json")})),c(l(t),"Geolocalize",(function(e){t.com.sendMessageToMap({type:"Geolocalize",toggle:e,sessionToken:t.sessionToken})})),c(l(t),"toggleGiswaterTiled",(function(e){t.com.sendMessageToMap({type:"toggleGiswaterTiled",toggle:e,sessionToken:t.sessionToken})})),c(l(t),"reloadDisplayedLayers",(function(){return t.com.sendMessageToMap({type:"reloadDisplayedLayers",sessionToken:t.sessionToken})})),c(l(t),"addGeoJSON",(function(e,o,n){return e?t.com.sendMessageToMap({type:"addGeoJSON",geoJSON:e,options:void 0!==o?o:{fillcolor:null,strokecolor:null},name:n||Math.random().toString(36).substring(7),sessionToken:t.sessionToken}):void t.emit("error",{error:"No geoJSON data"})})),c(l(t),"clearGeoJSON",(function(){return t.com.sendMessageToMap({type:"clearGeoJSON",sessionToken:t.sessionToken})})),c(l(t),"removeGeoJSONLayer",(function(e){return e?t.com.sendMessageToMap({type:"removeGeoJSONLayer",name:e,sessionToken:t.sessionToken}):void t.emit("error",{error:"No geoJSON data"})})),c(l(t),"setGiswaterFilters",(function(e){var o=e;if(e){if("object"!=s(e)){e=(e=(e=e.trim()).replace(/^\s+|\s+$/g,"")).replace(/\\/g,"");try{o=JSON.parse(e)}catch(e){return void t.emit("error",{error:"Filters is not a valid JSON"})}}return t.com.sendMessageToMap({type:"setGiswaterFilters",filters:o,sessionToken:t.sessionToken})}t.emit("error",{error:"No filters"})})),c(l(t),"getGiswaterLayerAvailableFilters",(function(e){return e?t.com.sendMessageToMap({type:"getGiswaterLayerAvailableFilters",name:e,sessionToken:t.sessionToken}):void t.emit("error",{error:"No layer_name"})})),c(l(t),"setDebug",(function(e){isNaN(parseInt(e))?console.error("Debug is not a integer"):t.com.sendMessageToMap({type:"setDebug",what:e,sessionToken:t.sessionToken})})),c(l(t),"setCustomColors",(function(e){if("object"===s(e)){if(e.hasOwnProperty("geom_stroke_width")){if(isNaN(parseInt(e.geom_stroke_width)))return void console.error("geom_stroke_width is not an number");e.geom_stroke_width=parseInt(e.geom_stroke_width)}else e.geom_stroke_width=1;if(e.hasOwnProperty("geom_radius")){if(isNaN(parseInt(e.geom_radius)))return void console.error("geom_stroke_width is not an number");e.geom_radius=parseInt(e.geom_radius)}else e.geom_radius=4;e.hasOwnProperty("geom_shape")&&"circle"!==e.geom_shape&&"square"!==e.geom_shape&&(e.geom_shape="circle",console.error("geom_shape must be either 'circle' or 'square'")),t.com.sendMessageToMap({type:"setCustomColors",properties:e,sessionToken:t.sessionToken})}else console.error("properties is not an object")})),t.domId="map-frame","undefined"==typeof window?a(t):("string"==typeof e.id&&(t.domId=e.id),t.com=new r(e),window.addEventListener("message",(function(e){return t.onMessageReceived(e)})),t.sessionToken=e.sessionToken,t)}return d}(e.EventEmitter)})(),n})()}));
|
package/doc/giswater.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
var sessionToken = document.querySelector("#sessionToken");
|
|
3
|
+
var mapContainer = document.querySelector("#mapContainer");
|
|
4
|
+
var codeContent = document.querySelector("#code");
|
|
5
|
+
var iframesContainer = document.querySelector("#iframes-container");
|
|
6
|
+
|
|
7
|
+
var iframe = document.querySelector("#map-frame");
|
|
8
|
+
var host = document.querySelector("#overrideHost");
|
|
9
|
+
var btLoadIframe = document.querySelector("#btLoadIframe");
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
//************** MAP EXAMPLE
|
|
13
|
+
|
|
14
|
+
if(btLoadIframe){
|
|
15
|
+
btLoadIframe.addEventListener("click", function (evt) {
|
|
16
|
+
if(code.value!=""){
|
|
17
|
+
iframesContainer.innerHTML = code.value;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>🛠️ MAP TESTER - Vidro Map</title>
|
|
4
|
+
<link rel="stylesheet" href="../tester.css"></link>
|
|
5
|
+
<link rel="icon" type="image/png" href="https://www.vidrosoftware.com/favicon/favicon-32x32.png" sizes="32x32" />
|
|
6
|
+
<link rel="icon" type="image/png" href="https://www.vidrosoftware.com/favicon/favicon-16x16.png" sizes="16x16" />
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<div class="form" id="userData">
|
|
13
|
+
<h1>Vidromap</h1>
|
|
14
|
+
|
|
15
|
+
<div id="sessionToken"></div>
|
|
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.eyJleHAiOjE2MzIzMzA3MDMsImF1ZCI6IjVkM2Y5NWU3YTg5NjBjYWQ4MWU2OGQ1ZTQzODYzZmRhMGJiOTM5NDUiLCJkYXRhIjp7Inpvb20iOjQsImJhY2tncm91bmQiOiJDYXJ0b0RCTGlnaHQiLCJzcmlkIjoiRVBTRzoyNTgzMSIsImV4dGVudCI6IjQxNzE1MC4wMzEsIDQ1NzYxNjQuMzY0LCA0MjA3MDAuMTg3LCA0NTc4MTExLjczNiIsImdlb3NlcnZpY2UiOm51bGwsIm5hbWUiOiJnZW9qc29uIiwicHJldmlldyI6dHJ1ZSwiYXBpIjoiaHR0cHM6XC9cL2RldmFwaS52aWRyb3NvZnR3YXJlLmNvbVwvIiwidHlwZSI6InZpZHJvbWFwIiwidG9rZW4iOiI4YjNhM2ZjYzM5YzNlMTczOWMzZDcyZGI3ZDg1MDU3MSIsInNob3dfbGF5ZXJzIjoiIiwiaWQiOjE0LCJsb2dvIjoiaHR0cHM6XC9cL3d3dy52aWRyb3NvZnR3YXJlLmNvbVwvbG9nb3NcL1ZJRFJPLnN2ZyJ9fQ.MPaZ956QccNsh8S8G70UwWu93xD-HcUDdk5RufJxrGCBi8gT-LJ-8JiJdd9z8L8vrtZsekdn-h4md9WkLmot8THE8lHl1lFF0DEh_qFdHHxtdHVbp6OfTaQthEU9MBKVXPdB1igTAVtl__uPbM_2u9ItdMhePDNTq8NnzgUhyjMSZW0uj-dq5Yli2xL4NY8BYkiEHLdF8kbpcyjyenH0c2-GV8JnAEFz3rxNdv7d0guvaADMer2DpJzstkKFCWKZtqJbBYq9j0sZ4Ypzsh9YK3lSqAoDeg-VyszRMFHfr9JWXkt2iy4s0FSAOG11HKDQcLMUkjPlPWMtDT92NDbjWH5ZLBHjuPklO1HX77QIcON1z1HjNVq5fqMSnXK_s0dniRmIp9W6FM9rv012aP61v7_VA6LwSEw6zAK7mlL686HmLGtHQ5emG-EzwJLQMGaZ-VgDSWnSntA5QNU1B0R4lhwlmEuEMAgGjI7aNh2q4BlqgZC2uDszjtyteOwdlxRn3M6zjv3W22_qaJA2mnQI7cDwMqbYRDZ7R4uUCEMyTxLk26QOa0lYsj3ZYCiBSC2LlQFeJu7XuKrHtR-9B6Q2bYq1c5ht6cqxIBPBoZPV0V3FnmFX8cU3AJUEUDNJ4m9KhwBsTFW9yJV5gfM-56zGIh09COxSJAhrqCRcEzSHMpk"></iframe></textarea>
|
|
18
|
+
</div>
|
|
19
|
+
<div>
|
|
20
|
+
External wms url: <input type="text" name="service_uri" id="service_uri" size="55" value="https://nv.napr.gov.ge/geoserver/wms" placeholder="https://nv.napr.gov.ge/geoserver/wms">
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div>
|
|
24
|
+
Debug
|
|
25
|
+
<button id="btDebug">Debug</button>
|
|
26
|
+
<select id="debug">
|
|
27
|
+
<option id="1" selected value=1>Show logs</option>
|
|
28
|
+
<option id="0" value=0>Hide logs</option>
|
|
29
|
+
</select> <small>Show/hide component logs</small>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div>
|
|
33
|
+
<button id="btLoadIframe">Load Map</button> -
|
|
34
|
+
<button id="btLoadWMSLayers">Load layers from wms</button>
|
|
35
|
+
</div>
|
|
36
|
+
<div id="Error_container"></div>
|
|
37
|
+
<div id="mapContainer">
|
|
38
|
+
|
|
39
|
+
<div id="iframes-container">
|
|
40
|
+
|
|
41
|
+
</div>
|
|
42
|
+
<hr />
|
|
43
|
+
<pre id="Result_container"></pre>
|
|
44
|
+
<hr/>
|
|
45
|
+
<h2>Zoom</h2>
|
|
46
|
+
<button id="btZoomIn">Zoom In</button>
|
|
47
|
+
<button id="btZoomOut">Zoom Out</button>
|
|
48
|
+
<button id="btZoomToExtent">Zoom to extent</button>
|
|
49
|
+
<br><br>
|
|
50
|
+
<button id="btZoomToCoordinates">Zoom to coordinates</button>
|
|
51
|
+
ZoomToCoordinates level: <input type="text" name="zoomLevelToCoordinates" id="zoomLevelToCoordinates" size="5" value="4">
|
|
52
|
+
<h2>Add geometry</h2>
|
|
53
|
+
<button id="btAddPoint">Add point</button>
|
|
54
|
+
<button id="btAddPolygon">Add polygon</button>
|
|
55
|
+
<button id="btAddLine">Add line</button>
|
|
56
|
+
<button id="btClear">Clear geometries</button>
|
|
57
|
+
<h2>Info</h2>
|
|
58
|
+
<button id="btWMSInfo" disabled="true">WMS Info</button>
|
|
59
|
+
<h2>Layers</h2>
|
|
60
|
+
Project Layers: <select id="projectlayers"></select> - <small>click on "Load Project Layers button</small> <button id="btToggleLayer">Add / Remove Layer</button><br><br>
|
|
61
|
+
Displayed Layers: <select id="layers"></select> -
|
|
62
|
+
<button id="btActiveLayer">Set Active Layer</button>
|
|
63
|
+
<button id="btGetActiveLayer">Get Active Layer</button>
|
|
64
|
+
<span id="currentActiveLayer"></span>
|
|
65
|
+
|
|
66
|
+
<h2>Geolocation</h2>
|
|
67
|
+
<button id="btGeolocalize">Geolocalize User</button>
|
|
68
|
+
<button id="btStopGeolocalize">Cancel Geolocalize</button>
|
|
69
|
+
|
|
70
|
+
<h2>Highlight</h2>
|
|
71
|
+
<button id="btHighlight">Highlight geom</button>
|
|
72
|
+
Geom: <input type="text" name="geom" id="geom" size="25" value="">
|
|
73
|
+
<br>
|
|
74
|
+
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="">
|
|
75
|
+
<h2>GeoJSON</h2>
|
|
76
|
+
|
|
77
|
+
<input type="file" id="geojsonfile" name="geojsonfile" accept="application/json"><small> Select geoJSON file</small><br><br>
|
|
78
|
+
<small>Or paste geoJSON content</small><br><br>
|
|
79
|
+
<textarea name="geojsondata" id="geojsondata" rows="10" cols="80" placeholder=""></textarea> <br><br>
|
|
80
|
+
<button id="btAddGeoJSON">Add GeoJSON </button><br><br>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<!--<script src="https://unpkg.com/@vidro/map-handler@1.0.7/dist/map-handler.js"></script>-->
|
|
84
|
+
<script src="../../dist/map-handler.js"></script>
|
|
85
|
+
<script src="../full/tester.js"></script>
|
|
86
|
+
<script src="./index.js"></script>
|
|
87
|
+
</body>
|
|
88
|
+
</html>
|
package/examples/full/apidemo.js
CHANGED
|
@@ -19,7 +19,7 @@ var btLoadMap = document.querySelector("#btLoadMap");
|
|
|
19
19
|
var btLoadProjectLayers = document.querySelector("#btLoadProjectLayers");
|
|
20
20
|
var projectlayers = document.getElementById("projectlayers");
|
|
21
21
|
var userData = document.querySelector("#userData");
|
|
22
|
-
|
|
22
|
+
var btAddGeoJSONFromGiswater = document.querySelector("#btAddGeoJSONFromGiswater");
|
|
23
23
|
|
|
24
24
|
var btLogin = document.querySelector("#btLogin");
|
|
25
25
|
|
|
@@ -272,6 +272,7 @@ btLoadProjectLayers.addEventListener("click", function (evt) {
|
|
|
272
272
|
oReq.send();
|
|
273
273
|
console.log("Attempt to load project layers", uri);
|
|
274
274
|
});
|
|
275
|
+
|
|
275
276
|
function layersListener() {
|
|
276
277
|
if (this.status === 200) {
|
|
277
278
|
console.log("layersListener response", this.responseText);
|
|
@@ -303,3 +304,44 @@ function fillLayersSelect(options){
|
|
|
303
304
|
//empty previous options
|
|
304
305
|
|
|
305
306
|
}
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
if(btAddGeoJSONFromGiswater){
|
|
310
|
+
btAddGeoJSONFromGiswater.addEventListener("click", function(){
|
|
311
|
+
let lay = document.getElementById('currentActiveLayerForGeoJSON').innerHTML.trim();
|
|
312
|
+
console.log(`Requesting Giswater GeoJSON for layer ${lay}`)
|
|
313
|
+
if(lay && lay!==''){
|
|
314
|
+
apiUrl = document.querySelector("#apiurl").value;
|
|
315
|
+
//Build XMLHttpRequest
|
|
316
|
+
var selectedProjectId =
|
|
317
|
+
projects_select.options[projects_select.selectedIndex].value;
|
|
318
|
+
var uri = `${apiUrl}giswater/geojson/${selectedProjectId}/${lay}`;
|
|
319
|
+
var oReq = new XMLHttpRequest();
|
|
320
|
+
oReq.addEventListener("load", GeoJSONListener);
|
|
321
|
+
oReq.open("GET", uri, true);
|
|
322
|
+
oReq.setRequestHeader('Authorization',`Bearer ${usertoken.value}`);
|
|
323
|
+
oReq.setRequestHeader("Content-type", "application/json");
|
|
324
|
+
oReq.send();
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function GeoJSONListener(){
|
|
330
|
+
if (this.status === 200) {
|
|
331
|
+
try{
|
|
332
|
+
var res = JSON.parse(this.responseText);
|
|
333
|
+
console.log("GeoJSONListener response", res.message);
|
|
334
|
+
if(document.getElementById('geojsondata')){
|
|
335
|
+
document.getElementById('geojsondata').value = JSON.stringify(res.message);
|
|
336
|
+
var btAddGeoJSON = document.querySelector("#btAddGeoJSON");
|
|
337
|
+
if(btAddGeoJSON){
|
|
338
|
+
btAddGeoJSON.click();
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}catch(e){
|
|
342
|
+
console.error("Invalid API response")
|
|
343
|
+
}
|
|
344
|
+
} else {
|
|
345
|
+
console.error(this.status);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
68195fd70708b9e6b99b3e0a86b7b542
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
129,130,131,132,126,128,117,162
|
package/examples/full/index.php
CHANGED
|
@@ -55,8 +55,6 @@
|
|
|
55
55
|
<div>
|
|
56
56
|
Use Giswater tiled: <input type="checkbox" name="use_giswater_tiled" id="use_giswater_tiled" size="5" value=""> <small>If tiled background available, load it with map render</small>
|
|
57
57
|
</div>
|
|
58
|
-
|
|
59
|
-
|
|
60
58
|
<div>
|
|
61
59
|
Override Capabitilites extent: <input type="text" name="extent" id="extent" size="55" value="" placeholder="397663,4615771,406392,4623596"> <small>Override project extent</small>
|
|
62
60
|
</div>
|
|
@@ -92,6 +90,31 @@
|
|
|
92
90
|
<hr />
|
|
93
91
|
<pre id="Result_container"></pre>
|
|
94
92
|
<hr/>
|
|
93
|
+
<h2>Layers</h2>
|
|
94
|
+
Project Layers: <select id="projectlayers"></select> - <small>click on "Load Project Layers button</small> <button id="btToggleLayer">Add / Remove Layer</button><br><br>
|
|
95
|
+
Displayed Layers: <select id="layers"></select> -
|
|
96
|
+
<button id="btActiveLayer">Set Active Layer</button>
|
|
97
|
+
<button id="btGetActiveLayer">Get Active Layer</button>
|
|
98
|
+
<span id="currentActiveLayer"></span>
|
|
99
|
+
<button id="btReloadDisplayedLayers">Reload displayed layers</button>
|
|
100
|
+
<br><br>
|
|
101
|
+
Override layer properties (gutter, single/multi tile, transparent)
|
|
102
|
+
<input type="checkbox" name="overrideLayerProperties" id="overrideLayerProperties" value="">
|
|
103
|
+
<div id="containerOverride" style="display: none;">____________________________________________________<br><br>
|
|
104
|
+
Gutter: <input type="text" name="gutter" id="gutter" size="5" value="">
|
|
105
|
+
<br><br>
|
|
106
|
+
Transparent layer:
|
|
107
|
+
<input type="checkbox" name="toggleTransparentLayer" id="toggleTransparentLayer" checked value=""><br><br>
|
|
108
|
+
SingleTile layer:
|
|
109
|
+
<input type="checkbox" name="toggleSingleTile" id="toggleSingleTile" checked value=""><br>
|
|
110
|
+
____________________________________________________
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<h4>Tiled layer</h4>
|
|
114
|
+
<button id="btToggleGiswaterTiled" disabled="true">Show/hide tiled Giswater tiled background</button>
|
|
115
|
+
<input type="checkbox" name="toggleGiswaterTiledCheck" id="toggleGiswaterTiledCheck" size="5" value=""><br><br>
|
|
116
|
+
<small>only for giswater projects with tiled enabled</small>
|
|
117
|
+
</div>
|
|
95
118
|
<h2>Zoom</h2>
|
|
96
119
|
<button id="btZoomIn">Zoom In</button>
|
|
97
120
|
<button id="btZoomOut">Zoom Out</button>
|
|
@@ -107,18 +130,7 @@
|
|
|
107
130
|
<h2>Info</h2>
|
|
108
131
|
<button id="btWMSInfo" disabled="true">WMS Info</button>
|
|
109
132
|
<button id="btGiswaterInfo">Giswater Info</button>
|
|
110
|
-
|
|
111
|
-
Project Layers: <select id="projectlayers"></select> - <small>click on "Load Project Layers button</small> <button id="btToggleLayer">Add / Remove Layer</button><br><br>
|
|
112
|
-
Displayed Layers: <select id="layers"></select> -
|
|
113
|
-
<button id="btActiveLayer">Set Active Layer</button>
|
|
114
|
-
<button id="btGetActiveLayer">Get Active Layer</button>
|
|
115
|
-
<span id="currentActiveLayer"></span>
|
|
116
|
-
<button id="btReloadDisplayedLayers">Reload displayed layers</button>
|
|
117
|
-
<h4>Tiled layer</h4>
|
|
118
|
-
<button id="btToggleGiswaterTiled" disabled="true">Show/hide tiled Giswater tiled background</button>
|
|
119
|
-
<input type="checkbox" name="toggleGiswaterTiledCheck" id="toggleGiswaterTiledCheck" size="5" value=""><br><br>
|
|
120
|
-
<small>only for giswater projects with tiled enabled</small>
|
|
121
|
-
</div>
|
|
133
|
+
|
|
122
134
|
<h2>Geolocation</h2>
|
|
123
135
|
<button id="btGeolocalize">Geolocalize User</button>
|
|
124
136
|
<button id="btStopGeolocalize">Cancel Geolocalize</button>
|
|
@@ -133,16 +145,19 @@
|
|
|
133
145
|
<textarea name="giswaterFilters" id="giswaterFilters" rows="10" cols="20">{"expl_id":[1,2,3]}</textarea>
|
|
134
146
|
<h2>GeoJSON</h2>
|
|
135
147
|
<input type="file" id="geojsonfile" name="geojsonfile" accept="application/json"><small> Select geoJSON file</small><br><br>
|
|
148
|
+
<small>Load a geojson from a Giswater layer<b><span id="currentActiveLayerForGeoJSON"></span></b></span></small> <button id="btAddGeoJSONFromGiswater" disabled>Add GeoJSON from Giswater Layer </button>
|
|
149
|
+
<input type="hidden" name="geojsondata" id="geojsondata"/>
|
|
150
|
+
<br><br>
|
|
136
151
|
<b>Options</b><br><br>
|
|
137
152
|
Stroke color: <input type="text" name="strokecolor" id="strokecolor" size="10" value="#994d4d" placeholder="#000000"> <small>Override stroke color, desfault #ff0000</small><br>
|
|
138
153
|
Fill color: <input type="text" name="fillcolor" id="fillcolor" size="10" value="#4d995c" placeholder="#000000"> <small>Override fill color, desfault #ff0000</small><br><br>
|
|
139
154
|
<button id="btAddGeoJSON">Add GeoJSON Layer</button> <button id="btClearGeoJSON">Clear GeoJSON Layers</button><br><br>
|
|
140
155
|
<input type="text" name="hitTolerance" id="hitTolerance" size="5" value="" placeholder="5"> <small>Override hit tolerance</small><br><br>
|
|
156
|
+
|
|
141
157
|
Selected GeoJSON Layer: <select id="geojsonlayers"></select> - <button id="btGeoJSONInfo" disabled="true">GeoJSON Info</button> <button id="btRemoveGeoJSONLayer" disabled="true">Remove GeoJSON Layer</button><br><br>
|
|
142
158
|
|
|
143
159
|
|
|
144
|
-
<script src="https://unpkg.com/@vidro/map-handler@1.0.
|
|
145
|
-
<!--<script src="../../dist/map-handler.js"></script>-->
|
|
160
|
+
<script src="https://unpkg.com/@vidro/map-handler@1.0.8/dist/map-handler.js"></script>
|
|
146
161
|
<script src="./tester.js"></script>
|
|
147
162
|
<script src="./apidemo.js"></script>
|
|
148
163
|
</body>
|