@vidro/map-handler 1.1.4 → 1.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. package/README.md +39 -101
  2. package/dist/map-handler.js +1 -1
  3. package/examples/full/cachedToken.dat +1 -1
  4. package/examples/full/cachedTokenData.dat +1 -1
  5. package/examples/full/index.php +9 -78
  6. package/examples/full/tester.js +12 -177
  7. package/examples/serverLess/dist/index.23420cfa.js +117 -120
  8. package/examples/serverLess/dist/index.23420cfa.js.map +1 -1
  9. package/examples/serverLess/dist/index.html +1 -38
  10. package/examples/serverLess/index.html +1 -2
  11. package/examples/serverLess/main.js +2 -2
  12. package/examples/simple/index.html +1 -1
  13. package/examples/taigua/index.html +46 -8
  14. package/examples/taigua/main.js +467 -18
  15. package/examples/vidromap/index.php +1 -1
  16. package/package.json +1 -1
  17. package/src/index.js +178 -321
  18. package/examples/externalwms/index.js +0 -20
  19. package/examples/externalwms/index.php +0 -88
  20. package/examples/integration/tool/css/dist/home.css.min.css +0 -0
  21. package/examples/integration/tool/css/dist/home.min.css +0 -1
  22. package/examples/integration/tool/css/dist/home.min.css.map +0 -10
  23. package/examples/integration/tool/css/dist/style-login.css.min.css +0 -0
  24. package/examples/integration/tool/css/dist/style-login.min.css +0 -1
  25. package/examples/integration/tool/css/dist/style-login.min.css.map +0 -10
  26. package/examples/integration/tool/css/dist/style.css.min.css +0 -0
  27. package/examples/integration/tool/css/dist/style.min.css +0 -1
  28. package/examples/integration/tool/css/dist/style.min.css.map +0 -23
  29. package/examples/integration/tool/css/master/_bottom-sheet-2.scss +0 -103
  30. package/examples/integration/tool/css/master/_bottom-sheet.scss +0 -142
  31. package/examples/integration/tool/css/master/_colors.scss +0 -35
  32. package/examples/integration/tool/css/master/_dropdown-form.scss +0 -167
  33. package/examples/integration/tool/css/master/_forms.scss +0 -416
  34. package/examples/integration/tool/css/master/_header.scss +0 -134
  35. package/examples/integration/tool/css/master/_menu-toc.scss +0 -135
  36. package/examples/integration/tool/css/master/_menu-tools.scss +0 -187
  37. package/examples/integration/tool/css/master/_mixins.scss +0 -42
  38. package/examples/integration/tool/css/master/_notifyjs.scss +0 -39
  39. package/examples/integration/tool/css/master/_ol-map-controls.scss +0 -117
  40. package/examples/integration/tool/css/master/_simplelightbox.scss +0 -287
  41. package/examples/integration/tool/css/master/_toc-config.scss +0 -28
  42. package/examples/integration/tool/css/master/_toc-layouts.scss +0 -173
  43. package/examples/integration/tool/css/master/_tooltip.scss +0 -34
  44. package/examples/integration/tool/css/master/home.scss +0 -266
  45. package/examples/integration/tool/css/master/style-login.scss +0 -240
  46. package/examples/integration/tool/css/master/style.scss +0 -166
  47. package/examples/integration/tool/img/doc-gallery-placeholder.svg +0 -3
  48. package/examples/integration/tool/img/home/ic_calendar-clock.svg +0 -1
  49. package/examples/integration/tool/img/home/ic_caret-down.svg +0 -1
  50. package/examples/integration/tool/img/home/ic_cog.svg +0 -1
  51. package/examples/integration/tool/img/home/ic_marker.svg +0 -1
  52. package/examples/integration/tool/img/home/ic_play-circle.svg +0 -1
  53. package/examples/integration/tool/img/home/ic_power.svg +0 -1
  54. package/examples/integration/tool/img/home/ic_squares.svg +0 -1
  55. package/examples/integration/tool/img/home/ic_user-pointer.svg +0 -1
  56. package/examples/integration/tool/img/home/ic_user-square.svg +0 -1
  57. package/examples/integration/tool/img/home/logo_footer.svg +0 -1
  58. package/examples/integration/tool/img/ic/accessControl.svg +0 -1
  59. package/examples/integration/tool/img/ic/account-location.svg +0 -1
  60. package/examples/integration/tool/img/ic/actionDelete.svg +0 -64
  61. package/examples/integration/tool/img/ic/actionOpen.svg +0 -64
  62. package/examples/integration/tool/img/ic/addFile.svg +0 -100
  63. package/examples/integration/tool/img/ic/addFile_off.svg +0 -102
  64. package/examples/integration/tool/img/ic/arrow-left.svg +0 -1
  65. package/examples/integration/tool/img/ic/arrow-right-drop-circle-outline.svg +0 -1
  66. package/examples/integration/tool/img/ic/bt_add_photo.svg +0 -3
  67. package/examples/integration/tool/img/ic/bug.svg +0 -1
  68. package/examples/integration/tool/img/ic/caret-down-bottomsheet.svg +0 -3
  69. package/examples/integration/tool/img/ic/checkbox-blank-outline-grey.svg +0 -8
  70. package/examples/integration/tool/img/ic/checkbox-blank-outline-white.svg +0 -8
  71. package/examples/integration/tool/img/ic/checkbox-blank-outline.svg +0 -1
  72. package/examples/integration/tool/img/ic/checkbox-marked-outline-grey.svg +0 -8
  73. package/examples/integration/tool/img/ic/checkbox-marked-outline-white.svg +0 -8
  74. package/examples/integration/tool/img/ic/checkbox-marked-outline.svg +0 -1
  75. package/examples/integration/tool/img/ic/chevron-down-grey.svg +0 -7
  76. package/examples/integration/tool/img/ic/chevron-down-white.svg +0 -7
  77. package/examples/integration/tool/img/ic/chevron-down.svg +0 -1
  78. package/examples/integration/tool/img/ic/chevron-right-grey.svg +0 -7
  79. package/examples/integration/tool/img/ic/chevron-right-white.svg +0 -7
  80. package/examples/integration/tool/img/ic/chevron-right.svg +0 -1
  81. package/examples/integration/tool/img/ic/comment-text-outline.svg +0 -1
  82. package/examples/integration/tool/img/ic/cookie.svg +0 -1
  83. package/examples/integration/tool/img/ic/delete.svg +0 -1
  84. package/examples/integration/tool/img/ic/dot.svg +0 -1
  85. package/examples/integration/tool/img/ic/dump.svg +0 -1
  86. package/examples/integration/tool/img/ic/e.svg +0 -9
  87. package/examples/integration/tool/img/ic/eye-off.svg +0 -1
  88. package/examples/integration/tool/img/ic/eye.svg +0 -1
  89. package/examples/integration/tool/img/ic/forbidden.svg +0 -1
  90. package/examples/integration/tool/img/ic/form-title-1.svg +0 -3
  91. package/examples/integration/tool/img/ic/group.svg +0 -1
  92. package/examples/integration/tool/img/ic/hamburger.svg +0 -1
  93. package/examples/integration/tool/img/ic/ic-users.svg +0 -1
  94. package/examples/integration/tool/img/ic/ic_dropdown-form-close.svg +0 -3
  95. package/examples/integration/tool/img/ic/ic_dropdown-form-link.svg +0 -3
  96. package/examples/integration/tool/img/ic/ic_feature-edit-cancel.svg +0 -14
  97. package/examples/integration/tool/img/ic/ic_feature-edit-save.svg +0 -14
  98. package/examples/integration/tool/img/ic/ic_gallery-item-delete.svg +0 -3
  99. package/examples/integration/tool/img/ic/ic_gallery-item-view.svg +0 -3
  100. package/examples/integration/tool/img/ic/ic_gps.svg +0 -3
  101. package/examples/integration/tool/img/ic/ic_search.svg +0 -5
  102. package/examples/integration/tool/img/ic/ic_selector_fechas.svg +0 -63
  103. package/examples/integration/tool/img/ic/ic_zoom-to-extent.svg +0 -3
  104. package/examples/integration/tool/img/ic/icon_reminder.png +0 -0
  105. package/examples/integration/tool/img/ic/image-gallery-placeholder.svg +0 -55
  106. package/examples/integration/tool/img/ic/imaqua.svg +0 -87
  107. package/examples/integration/tool/img/ic/incidencia.svg +0 -77
  108. package/examples/integration/tool/img/ic/info_multi_selection.svg +0 -230
  109. package/examples/integration/tool/img/ic/layers.svg +0 -1
  110. package/examples/integration/tool/img/ic/map-marker.svg +0 -3
  111. package/examples/integration/tool/img/ic/map.svg +0 -1
  112. package/examples/integration/tool/img/ic/measure_area.svg +0 -111
  113. package/examples/integration/tool/img/ic/minus.svg +0 -7
  114. package/examples/integration/tool/img/ic/notification.svg +0 -1
  115. package/examples/integration/tool/img/ic/offline.svg +0 -3
  116. package/examples/integration/tool/img/ic/online.svg +0 -1
  117. package/examples/integration/tool/img/ic/pencil.svg +0 -3
  118. package/examples/integration/tool/img/ic/plus.svg +0 -1
  119. package/examples/integration/tool/img/ic/polygon_selection.svg +0 -68
  120. package/examples/integration/tool/img/ic/power.svg +0 -1
  121. package/examples/integration/tool/img/ic/remoteLocalized.svg +0 -4
  122. package/examples/integration/tool/img/ic/remoteStartLocalize.svg +0 -4
  123. package/examples/integration/tool/img/ic/ruler.svg +0 -125
  124. package/examples/integration/tool/img/ic/selection-plus.svg +0 -10
  125. package/examples/integration/tool/img/ic/selection.svg +0 -1
  126. package/examples/integration/tool/img/ic/settings.svg +0 -1
  127. package/examples/integration/tool/img/ic/sort.svg +0 -1
  128. package/examples/integration/tool/img/ic/sort_asc.svg +0 -1
  129. package/examples/integration/tool/img/ic/sort_desc.svg +0 -1
  130. package/examples/integration/tool/img/ic/spreadsheet.svg +0 -3
  131. package/examples/integration/tool/img/ic/times.svg +0 -1
  132. package/examples/integration/tool/img/ic/toolbar/AB3.svg +0 -1
  133. package/examples/integration/tool/img/ic/toolbar/AB4.svg +0 -1
  134. package/examples/integration/tool/img/ic/toolbar/IC1.svg +0 -1
  135. package/examples/integration/tool/img/ic/toolbar/TB1.svg +0 -1
  136. package/examples/integration/tool/img/ic/toolbar/TB11.svg +0 -5
  137. package/examples/integration/tool/img/ic/toolbar/TB2.svg +0 -1
  138. package/examples/integration/tool/img/ic/toolbar/TB20.svg +0 -1
  139. package/examples/integration/tool/img/ic/toolbar/TB21.svg +0 -54
  140. package/examples/integration/tool/img/ic/toolbar/TB3.svg +0 -1
  141. package/examples/integration/tool/img/ic/toolbar/TB31.svg +0 -1
  142. package/examples/integration/tool/img/ic/toolbar/TB32.svg +0 -57
  143. package/examples/integration/tool/img/ic/toolbar/TB4.svg +0 -1
  144. package/examples/integration/tool/img/ic/toolbar/TB5.svg +0 -1
  145. package/examples/integration/tool/img/ic/toolbar/TB6.svg +0 -1
  146. package/examples/integration/tool/img/ic/toolbar/TB7.svg +0 -1
  147. package/examples/integration/tool/img/ic/toolbar/TB8.svg +0 -1
  148. package/examples/integration/tool/img/ic/tools.svg +0 -28
  149. package/examples/integration/tool/img/ic/user.svg +0 -1
  150. package/examples/integration/tool/img/ic/vector-polygon.svg +0 -1
  151. package/examples/integration/tool/img/ic/visit_manager.svg +0 -135
  152. package/examples/integration/tool/img/logo-footer-login.png +0 -0
  153. package/examples/integration/tool/img/logo-footer.png +0 -0
  154. package/examples/integration/tool/img/logo-header-login.png +0 -0
  155. package/examples/integration/tool/img/logo-header-login@2x.png +0 -0
  156. package/examples/integration/tool/img/logo-header-login@3x.png +0 -0
  157. package/examples/integration/tool/img/logo-header.png +0 -0
  158. package/examples/integration/tool/img/logo-header@2x.png +0 -0
  159. package/examples/integration/tool/img/logo-header@3x.png +0 -0
  160. package/examples/integration/tool/img/logo_project.png +0 -0
  161. package/examples/integration/tool/img/photo-gallery-placeholder.svg +0 -3
  162. package/examples/integration/tool/img/pixel.png +0 -0
  163. package/examples/integration/tool/index.html +0 -228
  164. package/examples/integration/tool/js/demo.js +0 -238
  165. package/examples/integration/tool/js/interface.js +0 -147
  166. package/examples/integration/tool/js/jquery.js +0 -4
  167. package/examples/integration/vanguardia.html +0 -6636
  168. package/examples/taigua/global.css +0 -10
  169. package/examples/xavi/index.html +0 -37
  170. package/examples/xavi/main.js +0 -168
@@ -43,7 +43,6 @@ var btDebug = document.querySelector("#btDebug");
43
43
  var btAddGeoJSONFromGiswater = document.querySelector(
44
44
  "#btAddGeoJSONFromGiswater"
45
45
  );
46
- var btCenterToCoordinates = document.querySelector("#btCenterToCoordinates");
47
46
  //override layer properties
48
47
  var overrideLayerProperties = document.querySelector(
49
48
  "#overrideLayerProperties"
@@ -62,40 +61,6 @@ var geom_radius = document.querySelector("#geom_radius");
62
61
  var btSetColors = document.querySelector("#btSetColors");
63
62
  var btGetElementsFromLayer = document.querySelector("#btGetElementsFromLayer");
64
63
  var btGetToc = document.querySelector("#btGetToc");
65
- var btChangeBackground = document.querySelector("#btChangeBackground");
66
- var newBackground = document.querySelector("#newBackground");
67
- //vector layer create
68
- var btAddVectorLayer = document.querySelector("#btAddVectorLayer");
69
- var vectorLayerName = document.querySelector("#vectorLayerName");
70
- var btRemoveVectorLayer = document.querySelector("#btRemoveVectorLayer");
71
-
72
- var btMeasureDistance = document.querySelector("#btMeasureDistance");
73
- var btMeasureArea = document.querySelector("#btMeasureArea");
74
- var btCancelMeasure = document.querySelector("#btCancelMeasure");
75
-
76
- var btDrawGeometryInLayer = document.querySelector("#btDrawGeometryInLayer");
77
- var geomAstext = document.querySelector("#geomAstext");
78
- var geomLabel = document.querySelector("#geomLabel");
79
- var layerToDraw = document.querySelector("#layerToDraw");
80
- var uuid = document.querySelector("#uuid");
81
- var btRemoveGeometryInLayer = document.querySelector(
82
- "#btRemoveGeometryInLayer"
83
- );
84
- var fillcolor = document.querySelector("#fillcolor");
85
- var strokecolor = document.querySelector("#strokecolor");
86
- var radius = document.querySelector("#radius");
87
- var strokeWidth = document.querySelector("#strokeWidth");
88
- var font = document.querySelector("#font");
89
- var fontSize = document.querySelector("#fontSize");
90
- var fontStrokeColor = document.querySelector("#fontStrokeColor");
91
- var fontFillColor = document.querySelector("#fontFillColor");
92
- var fontStrokeWidth = document.querySelector("#fontStrokeWidth");
93
- var labelPlacement = document.querySelector("#labelPlacementfont");
94
- var fontSize = document.querySelector("#fontSize");
95
- var labelBaseline = document.querySelector("#labelBaseline");
96
- var labelAlign = document.querySelector("#labelAlign");
97
- var display = document.querySelector("#display");
98
- var maxReso = document.querySelector("#maxReso");
99
64
 
100
65
  var geoJSONName = null; //geoJSON file name
101
66
  var geoJSONContent = null; // geojson file content
@@ -129,18 +94,6 @@ communicator.on("geomAdded", function (data) {
129
94
 
130
95
  communicator.on("loaded", function (data) {
131
96
  console.log("loaded", data);
132
- communicator.setCustomColors({
133
- geom_stroke_color: "rgb(19, 39, 99,0.5)",
134
- geom_fill_color: "rgb(19, 39, 99,0.5)",
135
- geom_stroke_width: 1,
136
- geom_shape: "circle",
137
- geom_radius: 200,
138
- measure_fill_color: "rgba(222,218,125,0.63)",
139
- measure_stroke_color: "rgba(255,0,0,1)",
140
- });
141
- });
142
- communicator.on("capabilities", function (data) {
143
- console.log("capabilities", data);
144
97
  });
145
98
 
146
99
  communicator.on("layers", function (data) {
@@ -170,8 +123,6 @@ communicator.on("coordinates", function (data) {
170
123
  cleanContainers();
171
124
  clickedCoordinates = [data.coordinates[0], data.coordinates[1]];
172
125
  Result_container.innerHTML = `Clicked coordinates -> x: ${data.coordinates[0]}, y: ${data.coordinates[1]}`;
173
- if (geomAstext)
174
- geomAstext.value = `POINT(${data.coordinates[0]} ${data.coordinates[1]})`;
175
126
  });
176
127
 
177
128
  communicator.on("activeLayer", function (data) {
@@ -240,12 +191,6 @@ communicator.on("availableWMSLayers", function (data) {
240
191
  console.log("availableWMSLayers", data);
241
192
  fillLayersSelect(data);
242
193
  });
243
- communicator.on("MeasureEnd", function (data) {
244
- console.log("MeasureEnd", data);
245
-
246
- });
247
-
248
-
249
194
 
250
195
  function fillLayersSelect(options) {
251
196
  console.log("fillLayersSelect", options);
@@ -317,16 +262,6 @@ if (btZoomToCoordinates) {
317
262
  });
318
263
  }
319
264
 
320
- if (btCenterToCoordinates) {
321
- btCenterToCoordinates.addEventListener("click", function () {
322
- if (clickedCoordinates) {
323
- communicator.centerMap(clickedCoordinates);
324
- } else {
325
- console.warn("No coordinates provided");
326
- Error_container.innerHTML = "No coordinates provided";
327
- }
328
- });
329
- }
330
265
  if (btAddPoint) {
331
266
  btAddPoint.addEventListener("click", function () {
332
267
  communicator.AddGeom("Point");
@@ -414,45 +349,13 @@ if (btGetToc) {
414
349
  communicator.getToc();
415
350
  });
416
351
  }
417
- if (btChangeBackground) {
418
- btChangeBackground.addEventListener("click", function (evt) {
419
- if (newBackground.value) {
420
- console.log("btChangeBackground", newBackground.value);
421
- communicator.changeBackground(newBackground.value);
422
- } else {
423
- console.warn("no active layer");
424
- }
425
- });
426
- }
427
-
428
- //************* Vector layers create and delete */
429
-
430
- if (btAddVectorLayer) {
431
- btAddVectorLayer.addEventListener("click", function (evt) {
432
- if (vectorLayerName.value) {
433
- console.log("btAddVectorLayer", vectorLayerName.value);
434
352
 
435
- communicator.toggleLayer(vectorLayerName.value, {
436
- gutter: gutter ? gutter.value : 5,
437
- transparent: toggleTransparentLayer.checked,
438
- layerType: "vector",
439
- });
440
- if (layerToDraw) layerToDraw.value = vectorLayerName.value;
441
- } else {
442
- console.warn("no vector layer name");
443
- }
444
- });
445
- }
446
- if (btRemoveVectorLayer) {
447
- btRemoveVectorLayer.addEventListener("click", function (evt) {
448
- if (vectorLayerName.value) {
449
- console.log("btRemoveVectorLayer", vectorLayerName.value);
450
- //communicator.changeBackground(newBackground.value);
451
- } else {
452
- console.warn("no vector layer name");
453
- }
454
- });
455
- }
353
+ /*
354
+ overrideLayerProperties
355
+ gutter
356
+ toggleTransparentLayer
357
+ toggleSingleTile
358
+ containerOverride*/
456
359
 
457
360
  //**********************************************************
458
361
  //************** END LAYERS ****************
@@ -475,7 +378,9 @@ if (btWMSInfo) {
475
378
  communicator.infoFromCoordinates(
476
379
  "wms",
477
380
  document.getElementById("layers").value,
478
- 5,
381
+ hitTolerance.value == "" || hitTolerance.value == null
382
+ ? 5
383
+ : parseInt(hitTolerance.value),
479
384
  document.getElementById("formatWMS").value
480
385
  );
481
386
  });
@@ -576,6 +481,9 @@ if (btAddGeoJSON) {
576
481
  console.log("using geoJSON file");
577
482
  geoToSend = geoJSONContent;
578
483
  }
484
+ var fillcolor = document.querySelector("#fillcolor");
485
+ var strokecolor = document.querySelector("#strokecolor");
486
+
579
487
  //Check JSON
580
488
  try {
581
489
  let options = {
@@ -738,76 +646,3 @@ if (btGetElementsFromLayer) {
738
646
  //**********************************************************
739
647
  //************** END WMS TABLE ****************
740
648
  //**********************************************************
741
- if (btDrawGeometryInLayer) {
742
- btDrawGeometryInLayer.addEventListener("click", function () {
743
- let geomAstext = document.getElementById("geomAstext").value;
744
- let geomLabel = document.getElementById("geomLabel").value;
745
- let layerToDraw = document.getElementById("layerToDraw").value;
746
- let uuid = document.getElementById("uuid").value
747
- ? document.getElementById("uuid").value
748
- : Math.floor(Math.random() * 100);
749
-
750
- let style = {
751
- geom_stroke_color: strokecolor.value ? strokecolor.value : null,
752
- geom_fill_color: fillcolor.value ? fillcolor.value : null,
753
- geom_radius: radius.value ? Number(radius.value) : null,
754
- geom_stroke_width: strokeWidth.value ? Number(strokeWidth.value) : null,
755
- font: font.value ? font.value : "arial",
756
- fontSize: fontSize.value ? fontSize.value : 12,
757
- fontStrokeColor: fontStrokeColor ? fontStrokeColor.value : null,
758
- fontFillColor: fontFillColor ? fontFillColor.value : null,
759
- fontStrokeWidth: fontStrokeWidth ? fontStrokeWidth.value : null,
760
- placement: labelPlacement ? labelPlacement.value : null,
761
- baseline: labelBaseline ? labelBaseline.value : null,
762
- align: labelAlign ? labelAlign.value : null,
763
- maxReso: maxReso ? maxReso.value : null,
764
- display: display ? display.value : null,
765
- };
766
-
767
- communicator.drawGeometryInLayer(
768
- uuid,
769
- layerToDraw,
770
- geomAstext,
771
- geomLabel,
772
- style
773
- );
774
- });
775
- }
776
- if (btRemoveGeometryInLayer) {
777
- btRemoveGeometryInLayer.addEventListener("click", function () {
778
- let layer = document.getElementById("layerToDraw").value;
779
- let uuid = document.getElementById("uuid").value
780
- ? document.getElementById("uuid").value
781
- : Math.floor(Math.random() * 100);
782
-
783
- communicator.removeGeometryFromLayer(uuid, layer);
784
- });
785
- btRemoveGeometryInLayer;
786
- }
787
-
788
- //**********************************************************
789
- //************** MEASURE ****************
790
- //**********************************************************
791
- if (btMeasureDistance) {
792
- btMeasureDistance.addEventListener("click", function () {
793
- console.log("Button measureDistance clicked");
794
- communicator.initMeasure('line','Clica para empezar a medir','Clica para continuar midiendo','Clica para continuar midiendo');
795
-
796
- });
797
- }
798
- if (btMeasureArea) {
799
- btMeasureArea.addEventListener("click", function () {
800
- console.log("Button btMeasureArea clicked");
801
- communicator.initMeasure('area','Clica para empezar a medir','Clica para continuar midiendo','Clica para continuar midiendo');
802
- });
803
- }
804
- if (btCancelMeasure) {
805
- btCancelMeasure.addEventListener("click", function () {
806
- console.log("Button btCancelMeasure clicked");
807
- communicator.cancelMeasure();
808
- });
809
- }
810
-
811
-
812
-
813
-
@@ -442,95 +442,92 @@ id) /*: string*/
442
442
  }
443
443
 
444
444
  },{}],"2X3X1":[function(require,module,exports) {
445
- require("axios");
446
- require("@vidro/map-handler");
447
- var _xml2jsonLight = require("xml2json-light");
445
+ var _axios = require("axios");
448
446
  var _parcelHelpers = require("@parcel/transformer-js/lib/esmodule-helpers.js");
447
+ var _axiosDefault = _parcelHelpers.interopDefault(_axios);
448
+ var _vidroMapHandler = require("@vidro/map-handler");
449
+ var _xml2jsonLight = require("xml2json-light");
449
450
  var _xml2jsonLightDefault = _parcelHelpers.interopDefault(_xml2jsonLight);
450
451
  // open source XML to JSON, used for parse WMS Info
451
452
  let clickedPoint = null;
452
453
  // store clicked coordinates for further use
453
- const apiUrl = "<YOUR API URL>";
454
- const user = "<YOUR USER>";
455
- const pwd = "<YOUR USER PASSWORD>";
456
- const customLogo = "<YOUR LOGO URL>";
454
+ const apiUrl = "https://bmaps.bgeo.es/api/";
455
+ const user = "test@bgeo.es";
456
+ const pwd = "test.12345";
457
+ const customLogo = "https://ssl.gstatic.com/ui/v1/icons/mail/rfr/logo_gmail_lockup_default_2x_r2.png";
457
458
  const layerToLoad = "Arc";
458
- // Layer to be loaded
459
459
  const zoomLevel = 17;
460
460
  // DOM Elements
461
461
  const iframe = document.querySelector("#map-frame");
462
462
  const infoContainer = document.querySelector("#infoContainer");
463
463
  const infoContent = document.querySelector("#infoContent");
464
464
  const closeInfo = document.querySelector("#closeInfo");
465
- /*
466
- //1. Get BMAPS user token
467
- axios
468
- .post(`${apiUrl}letsgo`, {
469
- user: user,
470
- pwd: pwd,
471
- })
472
- .then(function (response) {
473
- console.log(response.data.message);
474
- const userToken = response.data.message.token;
475
- //2. Get first user project
476
- const project_id = response.data.message.projects[0];
477
- console.log(project_id);
478
- //3. Get Map
479
- axios
480
- .get(`${apiUrl}map/${project_id}`, {
481
- headers: { Authorization: `Bearer ${userToken}` },
482
- params: {
483
- logo: customLogo,
484
- active_layer: layerToLoad,
485
- show_layers: layerToLoad,
486
- zoom: zoomLevel,
487
- },
488
- })
489
- .then(function (response) {
490
- console.log(response.data.message);
491
- const sessionToken = response.data.message.sessionToken;
492
- //4. Load iframe
493
- iframe.src = `${response.data.message.iframe}?sessionToken=${sessionToken}`;
494
- //5. Use js lib
495
- const communicator = new Communicator({
496
- sessionToken: sessionToken,
497
- });
498
- //6. Do WMS info on clickclicked coordinates
499
- communicator.on("coordinates", function (data) {
500
- console.info("clicked coordinates", data);
501
- //create geometry for highlight clicked point and center map
502
- clickedPoint = `POINT(${data.coordinates[0]} ${data.coordinates[1]})`;
503
- communicator.infoFromCoordinates("wms", layerToLoad);
504
- });
505
-
506
- //info event
507
- communicator.on("info", function (data) {
508
- console.log("info received", data);
509
- communicator.clear(); //clear previous higlight geometry
510
- //highlight click point and center map o it
511
- communicator.Highlight({
512
- geom: clickedPoint,
513
- zoom: { type: "level", zoomLevel: zoomLevel },
514
- });
515
- //parse WMS and display Arc Id attributte
516
- let arc_id = parseWMSInfo(data.data);
517
- if (arc_id) {
518
- infoContainer.style.display = "block"; //show info container
519
- infoContent.innerHTML = `ID: ${parseWMSInfo(data.data)}`;
520
- } else {
521
- infoContainer.style.display = "none"; //hide info container in case there's no info
522
- }
523
- });
524
- })
525
- .catch(function (error) {
526
- console.log(error);
527
- });
528
- })
529
-
530
- .catch(function (error) {
531
- console.log(error);
465
+ // 1. Get BMAPS user token
466
+ _axiosDefault.default.post(`${apiUrl}letsgo`, {
467
+ user: user,
468
+ pwd: pwd
469
+ }).then(function (response) {
470
+ console.log(response.data.message);
471
+ const userToken = response.data.message.token;
472
+ // 2. Get first user project
473
+ const project_id = response.data.message.projects[0];
474
+ console.log(project_id);
475
+ // 3. Get Map
476
+ _axiosDefault.default.get(`${apiUrl}map/${project_id}`, {
477
+ headers: {
478
+ Authorization: `Bearer ${userToken}`
479
+ },
480
+ params: {
481
+ logo: customLogo,
482
+ active_layer: layerToLoad,
483
+ show_layers: layerToLoad,
484
+ zoom: zoomLevel
485
+ }
486
+ }).then(function (response) {
487
+ console.log(response.data.message);
488
+ const sessionToken = response.data.message.sessionToken;
489
+ // 4. Load iframe
490
+ iframe.src = `${response.data.message.iframe}?sessionToken=${sessionToken}`;
491
+ // 5. Use js lib
492
+ const communicator = new _vidroMapHandler.Communicator({
493
+ sessionToken: sessionToken
494
+ });
495
+ // 6. Do WMS info on clickclicked coordinates
496
+ communicator.on("coordinates", function (data) {
497
+ console.info("clicked coordinates", data);
498
+ // create geometry for highlight clicked point and center map
499
+ clickedPoint = `POINT(${data.coordinates[0]} ${data.coordinates[1]})`;
500
+ communicator.infoFromCoordinates("wms", layerToLoad);
501
+ });
502
+ // info event
503
+ communicator.on("info", function (data) {
504
+ console.log("info received", data);
505
+ communicator.clear();
506
+ // clear previous higlight geometry
507
+ // highlight click point and center map o it
508
+ communicator.Highlight({
509
+ geom: clickedPoint,
510
+ zoom: {
511
+ type: "level",
512
+ zoomLevel: zoomLevel
513
+ }
514
+ });
515
+ // parse WMS and display Arc Id attributte
516
+ let arc_id = parseWMSInfo(data.data);
517
+ if (arc_id) {
518
+ infoContainer.style.display = "block";
519
+ // show info container
520
+ infoContent.innerHTML = `ID: ${parseWMSInfo(data.data)}`;
521
+ } else {
522
+ infoContainer.style.display = "none";
523
+ }
524
+ });
525
+ }).catch(function (error) {
526
+ console.log(error);
527
+ });
528
+ }).catch(function (error) {
529
+ console.log(error);
532
530
  });
533
- */
534
531
  // DOM handlers
535
532
  closeInfo.addEventListener("click", evt => {
536
533
  infoContainer.style.display = "none";
@@ -549,7 +546,7 @@ const parseWMSInfo = data => {
549
546
  }
550
547
  };
551
548
 
552
- },{"axios":"7rA65","@vidro/map-handler":"4YjT0","xml2json-light":"4Mf7p","@parcel/transformer-js/lib/esmodule-helpers.js":"5gA8y"}],"7rA65":[function(require,module,exports) {
549
+ },{"axios":"7rA65","@parcel/transformer-js/lib/esmodule-helpers.js":"5gA8y","@vidro/map-handler":"4YjT0","xml2json-light":"4Mf7p"}],"7rA65":[function(require,module,exports) {
553
550
  module.exports = require('./lib/axios');
554
551
  },{"./lib/axios":"4qfhW"}],"4qfhW":[function(require,module,exports) {
555
552
  'use strict';
@@ -2294,6 +2291,48 @@ module.exports = function isAxiosError(payload) {
2294
2291
  return (typeof payload === 'object') && (payload.isAxiosError === true);
2295
2292
  };
2296
2293
 
2294
+ },{}],"5gA8y":[function(require,module,exports) {
2295
+ "use strict";
2296
+
2297
+ exports.interopDefault = function (a) {
2298
+ return a && a.__esModule ? a : {
2299
+ default: a
2300
+ };
2301
+ };
2302
+
2303
+ exports.defineInteropFlag = function (a) {
2304
+ Object.defineProperty(a, '__esModule', {
2305
+ value: true
2306
+ });
2307
+ };
2308
+
2309
+ exports.exportAll = function (source, dest) {
2310
+ Object.keys(source).forEach(function (key) {
2311
+ if (key === 'default' || key === '__esModule') {
2312
+ return;
2313
+ } // Skip duplicate re-exports when they have the same value.
2314
+
2315
+
2316
+ if (key in dest && dest[key] === source[key]) {
2317
+ return;
2318
+ }
2319
+
2320
+ Object.defineProperty(dest, key, {
2321
+ enumerable: true,
2322
+ get: function () {
2323
+ return source[key];
2324
+ }
2325
+ });
2326
+ });
2327
+ return dest;
2328
+ };
2329
+
2330
+ exports.export = function (dest, destName, get) {
2331
+ Object.defineProperty(dest, destName, {
2332
+ enumerable: true,
2333
+ get: get
2334
+ });
2335
+ };
2297
2336
  },{}],"4YjT0":[function(require,module,exports) {
2298
2337
  var define;
2299
2338
  !(function (e, t) {
@@ -2929,48 +2968,6 @@ function replaceAttributes(xmlStr) {
2929
2968
  return xmlStr;
2930
2969
  }
2931
2970
 
2932
- },{}],"5gA8y":[function(require,module,exports) {
2933
- "use strict";
2934
-
2935
- exports.interopDefault = function (a) {
2936
- return a && a.__esModule ? a : {
2937
- default: a
2938
- };
2939
- };
2940
-
2941
- exports.defineInteropFlag = function (a) {
2942
- Object.defineProperty(a, '__esModule', {
2943
- value: true
2944
- });
2945
- };
2946
-
2947
- exports.exportAll = function (source, dest) {
2948
- Object.keys(source).forEach(function (key) {
2949
- if (key === 'default' || key === '__esModule') {
2950
- return;
2951
- } // Skip duplicate re-exports when they have the same value.
2952
-
2953
-
2954
- if (key in dest && dest[key] === source[key]) {
2955
- return;
2956
- }
2957
-
2958
- Object.defineProperty(dest, key, {
2959
- enumerable: true,
2960
- get: function () {
2961
- return source[key];
2962
- }
2963
- });
2964
- });
2965
- return dest;
2966
- };
2967
-
2968
- exports.export = function (dest, destName, get) {
2969
- Object.defineProperty(dest, destName, {
2970
- enumerable: true,
2971
- get: get
2972
- });
2973
- };
2974
- },{}]},["1sDb8","2X3X1"], "2X3X1", "parcelRequire2eac")
2971
+ },{}]},["1sDb8","2X3X1"], "2X3X1", "parcelRequire917b")
2975
2972
 
2976
2973
  //# sourceMappingURL=index.23420cfa.js.map