@vidro/map-handler 1.1.4 → 1.1.16
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +39 -101
- package/dist/map-handler.js +1 -1
- package/examples/full/cachedToken.dat +1 -1
- package/examples/full/cachedTokenData.dat +1 -1
- package/examples/full/index.php +9 -78
- package/examples/full/tester.js +12 -177
- package/examples/serverLess/dist/index.23420cfa.js +117 -120
- package/examples/serverLess/dist/index.23420cfa.js.map +1 -1
- package/examples/serverLess/dist/index.html +1 -38
- package/examples/serverLess/index.html +1 -2
- package/examples/serverLess/main.js +2 -2
- package/examples/simple/index.html +1 -1
- package/examples/taigua/index.html +46 -8
- package/examples/taigua/main.js +467 -18
- package/examples/vidromap/index.php +1 -1
- package/package.json +1 -1
- package/src/index.js +180 -321
- package/examples/externalwms/index.js +0 -20
- package/examples/externalwms/index.php +0 -88
- package/examples/integration/tool/css/dist/home.css.min.css +0 -0
- package/examples/integration/tool/css/dist/home.min.css +0 -1
- package/examples/integration/tool/css/dist/home.min.css.map +0 -10
- package/examples/integration/tool/css/dist/style-login.css.min.css +0 -0
- package/examples/integration/tool/css/dist/style-login.min.css +0 -1
- package/examples/integration/tool/css/dist/style-login.min.css.map +0 -10
- package/examples/integration/tool/css/dist/style.css.min.css +0 -0
- package/examples/integration/tool/css/dist/style.min.css +0 -1
- package/examples/integration/tool/css/dist/style.min.css.map +0 -23
- package/examples/integration/tool/css/master/_bottom-sheet-2.scss +0 -103
- package/examples/integration/tool/css/master/_bottom-sheet.scss +0 -142
- package/examples/integration/tool/css/master/_colors.scss +0 -35
- package/examples/integration/tool/css/master/_dropdown-form.scss +0 -167
- package/examples/integration/tool/css/master/_forms.scss +0 -416
- package/examples/integration/tool/css/master/_header.scss +0 -134
- package/examples/integration/tool/css/master/_menu-toc.scss +0 -135
- package/examples/integration/tool/css/master/_menu-tools.scss +0 -187
- package/examples/integration/tool/css/master/_mixins.scss +0 -42
- package/examples/integration/tool/css/master/_notifyjs.scss +0 -39
- package/examples/integration/tool/css/master/_ol-map-controls.scss +0 -117
- package/examples/integration/tool/css/master/_simplelightbox.scss +0 -287
- package/examples/integration/tool/css/master/_toc-config.scss +0 -28
- package/examples/integration/tool/css/master/_toc-layouts.scss +0 -173
- package/examples/integration/tool/css/master/_tooltip.scss +0 -34
- package/examples/integration/tool/css/master/home.scss +0 -266
- package/examples/integration/tool/css/master/style-login.scss +0 -240
- package/examples/integration/tool/css/master/style.scss +0 -166
- package/examples/integration/tool/img/doc-gallery-placeholder.svg +0 -3
- package/examples/integration/tool/img/home/ic_calendar-clock.svg +0 -1
- package/examples/integration/tool/img/home/ic_caret-down.svg +0 -1
- package/examples/integration/tool/img/home/ic_cog.svg +0 -1
- package/examples/integration/tool/img/home/ic_marker.svg +0 -1
- package/examples/integration/tool/img/home/ic_play-circle.svg +0 -1
- package/examples/integration/tool/img/home/ic_power.svg +0 -1
- package/examples/integration/tool/img/home/ic_squares.svg +0 -1
- package/examples/integration/tool/img/home/ic_user-pointer.svg +0 -1
- package/examples/integration/tool/img/home/ic_user-square.svg +0 -1
- package/examples/integration/tool/img/home/logo_footer.svg +0 -1
- package/examples/integration/tool/img/ic/accessControl.svg +0 -1
- package/examples/integration/tool/img/ic/account-location.svg +0 -1
- package/examples/integration/tool/img/ic/actionDelete.svg +0 -64
- package/examples/integration/tool/img/ic/actionOpen.svg +0 -64
- package/examples/integration/tool/img/ic/addFile.svg +0 -100
- package/examples/integration/tool/img/ic/addFile_off.svg +0 -102
- package/examples/integration/tool/img/ic/arrow-left.svg +0 -1
- package/examples/integration/tool/img/ic/arrow-right-drop-circle-outline.svg +0 -1
- package/examples/integration/tool/img/ic/bt_add_photo.svg +0 -3
- package/examples/integration/tool/img/ic/bug.svg +0 -1
- package/examples/integration/tool/img/ic/caret-down-bottomsheet.svg +0 -3
- package/examples/integration/tool/img/ic/checkbox-blank-outline-grey.svg +0 -8
- package/examples/integration/tool/img/ic/checkbox-blank-outline-white.svg +0 -8
- package/examples/integration/tool/img/ic/checkbox-blank-outline.svg +0 -1
- package/examples/integration/tool/img/ic/checkbox-marked-outline-grey.svg +0 -8
- package/examples/integration/tool/img/ic/checkbox-marked-outline-white.svg +0 -8
- package/examples/integration/tool/img/ic/checkbox-marked-outline.svg +0 -1
- package/examples/integration/tool/img/ic/chevron-down-grey.svg +0 -7
- package/examples/integration/tool/img/ic/chevron-down-white.svg +0 -7
- package/examples/integration/tool/img/ic/chevron-down.svg +0 -1
- package/examples/integration/tool/img/ic/chevron-right-grey.svg +0 -7
- package/examples/integration/tool/img/ic/chevron-right-white.svg +0 -7
- package/examples/integration/tool/img/ic/chevron-right.svg +0 -1
- package/examples/integration/tool/img/ic/comment-text-outline.svg +0 -1
- package/examples/integration/tool/img/ic/cookie.svg +0 -1
- package/examples/integration/tool/img/ic/delete.svg +0 -1
- package/examples/integration/tool/img/ic/dot.svg +0 -1
- package/examples/integration/tool/img/ic/dump.svg +0 -1
- package/examples/integration/tool/img/ic/e.svg +0 -9
- package/examples/integration/tool/img/ic/eye-off.svg +0 -1
- package/examples/integration/tool/img/ic/eye.svg +0 -1
- package/examples/integration/tool/img/ic/forbidden.svg +0 -1
- package/examples/integration/tool/img/ic/form-title-1.svg +0 -3
- package/examples/integration/tool/img/ic/group.svg +0 -1
- package/examples/integration/tool/img/ic/hamburger.svg +0 -1
- package/examples/integration/tool/img/ic/ic-users.svg +0 -1
- package/examples/integration/tool/img/ic/ic_dropdown-form-close.svg +0 -3
- package/examples/integration/tool/img/ic/ic_dropdown-form-link.svg +0 -3
- package/examples/integration/tool/img/ic/ic_feature-edit-cancel.svg +0 -14
- package/examples/integration/tool/img/ic/ic_feature-edit-save.svg +0 -14
- package/examples/integration/tool/img/ic/ic_gallery-item-delete.svg +0 -3
- package/examples/integration/tool/img/ic/ic_gallery-item-view.svg +0 -3
- package/examples/integration/tool/img/ic/ic_gps.svg +0 -3
- package/examples/integration/tool/img/ic/ic_search.svg +0 -5
- package/examples/integration/tool/img/ic/ic_selector_fechas.svg +0 -63
- package/examples/integration/tool/img/ic/ic_zoom-to-extent.svg +0 -3
- package/examples/integration/tool/img/ic/icon_reminder.png +0 -0
- package/examples/integration/tool/img/ic/image-gallery-placeholder.svg +0 -55
- package/examples/integration/tool/img/ic/imaqua.svg +0 -87
- package/examples/integration/tool/img/ic/incidencia.svg +0 -77
- package/examples/integration/tool/img/ic/info_multi_selection.svg +0 -230
- package/examples/integration/tool/img/ic/layers.svg +0 -1
- package/examples/integration/tool/img/ic/map-marker.svg +0 -3
- package/examples/integration/tool/img/ic/map.svg +0 -1
- package/examples/integration/tool/img/ic/measure_area.svg +0 -111
- package/examples/integration/tool/img/ic/minus.svg +0 -7
- package/examples/integration/tool/img/ic/notification.svg +0 -1
- package/examples/integration/tool/img/ic/offline.svg +0 -3
- package/examples/integration/tool/img/ic/online.svg +0 -1
- package/examples/integration/tool/img/ic/pencil.svg +0 -3
- package/examples/integration/tool/img/ic/plus.svg +0 -1
- package/examples/integration/tool/img/ic/polygon_selection.svg +0 -68
- package/examples/integration/tool/img/ic/power.svg +0 -1
- package/examples/integration/tool/img/ic/remoteLocalized.svg +0 -4
- package/examples/integration/tool/img/ic/remoteStartLocalize.svg +0 -4
- package/examples/integration/tool/img/ic/ruler.svg +0 -125
- package/examples/integration/tool/img/ic/selection-plus.svg +0 -10
- package/examples/integration/tool/img/ic/selection.svg +0 -1
- package/examples/integration/tool/img/ic/settings.svg +0 -1
- package/examples/integration/tool/img/ic/sort.svg +0 -1
- package/examples/integration/tool/img/ic/sort_asc.svg +0 -1
- package/examples/integration/tool/img/ic/sort_desc.svg +0 -1
- package/examples/integration/tool/img/ic/spreadsheet.svg +0 -3
- package/examples/integration/tool/img/ic/times.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/AB3.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/AB4.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/IC1.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/TB1.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/TB11.svg +0 -5
- package/examples/integration/tool/img/ic/toolbar/TB2.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/TB20.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/TB21.svg +0 -54
- package/examples/integration/tool/img/ic/toolbar/TB3.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/TB31.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/TB32.svg +0 -57
- package/examples/integration/tool/img/ic/toolbar/TB4.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/TB5.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/TB6.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/TB7.svg +0 -1
- package/examples/integration/tool/img/ic/toolbar/TB8.svg +0 -1
- package/examples/integration/tool/img/ic/tools.svg +0 -28
- package/examples/integration/tool/img/ic/user.svg +0 -1
- package/examples/integration/tool/img/ic/vector-polygon.svg +0 -1
- package/examples/integration/tool/img/ic/visit_manager.svg +0 -135
- 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 +0 -3
- package/examples/integration/tool/img/pixel.png +0 -0
- package/examples/integration/tool/index.html +0 -228
- package/examples/integration/tool/js/demo.js +0 -238
- package/examples/integration/tool/js/interface.js +0 -147
- package/examples/integration/tool/js/jquery.js +0 -4
- package/examples/integration/vanguardia.html +0 -6636
- package/examples/taigua/global.css +0 -10
- package/examples/xavi/index.html +0 -37
- package/examples/xavi/main.js +0 -168
package/examples/taigua/main.js
CHANGED
@@ -1,41 +1,490 @@
|
|
1
|
-
var sessionToken =
|
2
|
-
|
1
|
+
var sessionToken =
|
2
|
+
"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2ODIwNzk1NTksImF1ZCI6ImY0ODkxOWMwN2IzOGE5YzlmMmUzZDAyYWQ1NGQxNzFiYzY5ZTczNzUiLCJkYXRhIjp7Inpvb20iOjksImJhY2tncm91bmQiOiJDYXJ0b0RCTGlnaHQiLCJzcmlkIjpudWxsLCJleHRlbnQiOm51bGwsImdlb3NlcnZpY2UiOiJRR0lTIiwibmFtZSI6IlBST1ZBMjAwNDIwMjNWMyIsInByZXZpZXciOnRydWUsImFwaSI6Imh0dHBzOlwvXC9hcGkudmlkcm9zb2Z0d2FyZS5jb21cLyIsInR5cGUiOiJ2aWRyb21hcCIsInRva2VuIjoiZWE1NzU5ZGYwYzU1YmJiYzJkNTdiYWY4ZjM4YTMyZDAiLCJzaG93X2xheWVycyI6Ik9CUkVTX0VOX0VYRUNVQ0lPX1YyLE9CUkVTX0ZJTkFMSVRaQURFU19WMixPQlJFU19QTEFOSUZJQ0FERVNfVjIsVE1fVEVSUkFTU0EiLCJpZCI6MjE5LCJsb2dvIjoiaHR0cHM6XC9cL3d3dy52aWRyb3NvZnR3YXJlLmNvbVwvbG9nb3NcL1ZJRFJPLnN2ZyJ9fQ.NwNbZrcYxm_hy8HbwRaEBjWoxGoEH1voUIraCaL7jc0ZwjotYtMABmfxW1SqqJPOALse1z61-r3odaeEW0g0nqKnlfbveeikO5viCo01L0gq-CJJdK4MemPEA-o7JgRqN3SImRaIUncJ3vrwtX-URmh2v_xp2YSzxyRYESOjlOhecmPLaUyP2T9S9nawg8Yx2y8QyPRAwauX_vAkE6u2K2QSfQPIVw0x7zy6v3WgzEGu6i3f5_hO14d10HB2QkhXm_XNj-yXcNB7djk30p7C1GwJH-VZxg6Ye3smyVNG6x0yLiWMUBJbPibsIdZFhlFUgBnYpjYP9vk_OLbzWIK5EKih99f584ohv_L9K4pat_4-ou265_0wvjM7iBQLykJddyNUHbcVgGJgKjeMw5glFGbpfLct9u6W7uTIWpjJdg1rwCNrrQBhgmGVCU8Luxj-durelRk7eQjXrl3ti0UJ4sXB09UKM-5AOXHwIMVB4CnpRL_-9zZD5-a_j1Jh5ozyyG6g2AdqpySXR_BLE_kph1-l3d3x6EwZCO5bfd_Z-lzrhUjwuMpoUKzzGp5JmEwjcWkzvsDEDu9XYuEDeU4zw57B6436MJFipnHXrAkuapyfjx1TZsSEuEh47B8x_Rm2hl65467NrDD5PeSauY2s75zB1OAOD8j7W072G7cbc4w";
|
3
|
+
//var clickedCoordinates = null;
|
3
4
|
var communicator = new VidroMaps.Communicator({
|
4
5
|
sessionToken: sessionToken,
|
5
6
|
});
|
7
|
+
var selected_layer; //active layer
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
//var per geolocalització
|
10
|
+
var geoxy;
|
9
11
|
|
12
|
+
//codi per amagar parts del html ///////////////////////////////////////
|
13
|
+
//document.getElementById(id).style.visibility = "visible"; // show
|
14
|
+
//document.getElementById(btZoomToCoordinates).style.visibility = "hidden"; // hide
|
15
|
+
///////////////////////////////////////////////////////////////////////
|
16
|
+
|
17
|
+
//ZoomIn -------------------------------------------------------------ok
|
18
|
+
var btZoomIn = document.getElementById("btZoomIn");
|
19
|
+
btZoomIn.addEventListener("click", function () {
|
20
|
+
//communicator.Geolocalize(true);
|
21
|
+
console.log("Zoom In");
|
22
|
+
communicator.ZoomIn();
|
23
|
+
});
|
24
|
+
|
25
|
+
//ZoomOut-------------------------------------------------------------ok
|
26
|
+
var btZoomOut = document.getElementById("btZoomOut");
|
27
|
+
btZoomOut.addEventListener("click", function () {
|
28
|
+
//communicator.Geolocalize(true);
|
29
|
+
console.log("Zoom Out");
|
30
|
+
communicator.ZoomOut();
|
31
|
+
});
|
32
|
+
//codi per butons caper
|
33
|
+
/***codi per mostrar i amagar layers**/
|
34
|
+
var btOfi = document.getElementById("btOfi");
|
35
|
+
btOfi.addEventListener("click", function () {
|
36
|
+
console.log("Activo capa Obra Finalitzada");
|
37
|
+
communicator.toggleLayer("OBRES_FINALITZADES_V2");
|
38
|
+
});
|
39
|
+
var btOex = document.getElementById("btOex");
|
40
|
+
btOex.addEventListener("click", function () {
|
41
|
+
console.log("Capa Obra Executada");
|
42
|
+
communicator.toggleLayer("OBRES_EN_EXECUCIO_V2");
|
43
|
+
});
|
44
|
+
var btOpl = document.getElementById("btOpl");
|
45
|
+
btOpl.addEventListener("click", function () {
|
46
|
+
console.log("Capa Obra Planificada");
|
47
|
+
communicator.toggleLayer("OBRES_PLANIFICADES_V2");
|
48
|
+
});
|
49
|
+
var btOtm = document.getElementById("btOtm");
|
50
|
+
btOtm.addEventListener("click", function () {
|
51
|
+
console.log("TM_TERRASSA");
|
52
|
+
communicator.toggleLayer("TM_TERRASSA");
|
10
53
|
});
|
11
|
-
communicator.on("error", function (data) {
|
12
|
-
console.log("error", data);
|
13
54
|
|
55
|
+
var btMostraDades = document.getElementById("btGetElementsFromLayer");
|
56
|
+
btMostraDades.addEventListener("click", function () {
|
57
|
+
console.log("Mostrar Dades.");
|
14
58
|
});
|
59
|
+
//Geolocation---------------------------------------------------------ok
|
60
|
+
var btGeoLocation = document.getElementById("btGeoLocation");
|
61
|
+
//quan cliquem al boto geolocalització executem->
|
62
|
+
btGeoLocation.addEventListener("click", function () {
|
63
|
+
console.log("Demanada Geolocalització");
|
64
|
+
communicator.Geolocalize(true);
|
15
65
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
66
|
+
/////////////////////////////////////////////
|
67
|
+
communicator.ZoomIn();
|
68
|
+
console.log("Geolocalitzo i aplico zoom x1");
|
69
|
+
//communicator.Geolocalize(true);
|
70
|
+
//communicator.ZoomIn();
|
71
|
+
//console.log("Geolocalitzo i aplico zoom x2");
|
72
|
+
//communicator.Geolocalize(true);
|
73
|
+
//communicator.ZoomIn();
|
74
|
+
//console.log("Geolocalitzo i aplico zoom x3");
|
75
|
+
//communicator.Geolocalize(true);
|
76
|
+
//communicator.ZoomIn();
|
77
|
+
//console.log("Geolocalitzo i aplico zoom x4");
|
78
|
+
//communicator.Geolocalize(true);
|
79
|
+
//communicator.ZoomIn();
|
80
|
+
//console.log("Geolocalitzo i aplico zoom x5");
|
81
|
+
//communicator.Geolocalize(true);
|
82
|
+
//communicator.ZoomIn();
|
83
|
+
//console.log("Geolocalitzo i aplico zoom x6");
|
84
|
+
//communicator.Geolocalize(true);
|
85
|
+
});
|
20
86
|
|
21
|
-
|
22
|
-
|
23
|
-
|
87
|
+
//zoomTocoordinates........................................................??
|
88
|
+
if (btZoomToCoordinates) {
|
89
|
+
btZoomToCoordinates.addEventListener("click", function (geoXY) {
|
90
|
+
console.log("btZoomToCoordinates clicked");
|
91
|
+
let level = 18;
|
92
|
+
if (document.getElementById("zoomLevelToCoordinates")) {
|
93
|
+
//zoom Level
|
94
|
+
level = document.getElementById("zoomLevelToCoordinates").value;
|
95
|
+
}
|
96
|
+
if (clickedCoordinates) {
|
97
|
+
communicator.zoomToCoordinates(
|
98
|
+
clickedCoordinates[0],
|
99
|
+
clickedCoordinates[1],
|
100
|
+
level
|
101
|
+
);
|
102
|
+
} else {
|
103
|
+
console.error("No coordinates provided");
|
104
|
+
}
|
105
|
+
});
|
24
106
|
}
|
25
107
|
|
26
|
-
|
108
|
+
var btZoomToExtent = document.querySelector("#btZoomToExtent");
|
109
|
+
//capa actual
|
110
|
+
var currentActiveLayer = null;
|
111
|
+
|
112
|
+
function cleanContainers() {
|
113
|
+
containerMessages.innerHTML = "";
|
114
|
+
result_container.innerHTML = "";
|
115
|
+
}
|
116
|
+
|
117
|
+
//////////////////////////////////////////////////////////////////////////////////////
|
118
|
+
//events interceptats pel communicator i que fem amb ells. ///////////////////////////
|
119
|
+
//////////////////////////////////////////////////////////////////////////////////////
|
120
|
+
//per veure les capas
|
121
|
+
communicator.on("layers", function (data) {
|
122
|
+
console.log("layers received", data);
|
123
|
+
//fillDisplayedLayersSelect(data);
|
124
|
+
selected_layer = data[0]; //select first layer from available layers
|
125
|
+
communicator.setActiveLayer(selected_layer);
|
126
|
+
});
|
127
|
+
|
128
|
+
//error event
|
129
|
+
communicator.on("error", function (data) {
|
130
|
+
console.error("error", data);
|
131
|
+
cleanContainers();
|
132
|
+
Error_container.innerHTML = data.error;
|
27
133
|
});
|
28
134
|
|
29
135
|
//clicked coordinates
|
30
136
|
communicator.on("coordinates", function (data) {
|
31
|
-
console.info("coordinates", data);
|
32
|
-
|
137
|
+
console.info("Clic at coordinates", data);
|
138
|
+
//communicator.Geolocalize(true);
|
139
|
+
//geoxy.coordinates[0]= data.coordinates[0];
|
140
|
+
//geoxy.coordinates[1]= data.coordinates[1];
|
141
|
+
communicator.infoFromCoordinates("wms", selected_layer, null, "json");
|
33
142
|
clickedCoordinates = [data.coordinates[0], data.coordinates[1]];
|
34
|
-
|
143
|
+
//result_container.innerHTML = `Clicked coordinates -> x: ${data.coordinates[0]}, y: ${data.coordinates[1]}`;
|
144
|
+
});
|
145
|
+
|
146
|
+
//event geolocation
|
147
|
+
communicator.on("geolocation", function (data) {
|
148
|
+
console.info("geolocation", data);
|
149
|
+
//communicator.Geolocalize(true);
|
150
|
+
try {
|
151
|
+
//provo d'agafar geoxy
|
152
|
+
console.log("intento agafar geoxy");
|
153
|
+
data.coordinates[0] = geoxy.coordinates[0];
|
154
|
+
data.coordinates[1] = geoxy.coordinates[1];
|
155
|
+
console.log("geoxy agafat");
|
156
|
+
} catch {
|
157
|
+
//no fem res
|
158
|
+
console.log("No hi ha geoxy");
|
159
|
+
}
|
160
|
+
console.log(
|
161
|
+
"geolocation data:" + data.coordinates[0] + ", " + data.coordinates[1]
|
162
|
+
);
|
163
|
+
|
164
|
+
communicator.zoomToCoordinates(data.coordinates[0], data.coordinates[1], 30);
|
165
|
+
//cleanContainers();
|
166
|
+
result_container.innerHTML = `geolocaiton: coordinates -> x: ${data.coordinates[0]}, y: ${data.coordinates[1]}`;
|
167
|
+
});
|
168
|
+
|
169
|
+
var containerMessages = document.getElementById("messages");
|
170
|
+
|
171
|
+
//event onZoomchange
|
172
|
+
communicator.on("onZoomChange", function (data) {
|
173
|
+
console.log("onZoomChange event", data);
|
174
|
+
cleanContainers();
|
175
|
+
//communicator.Geolocalize(true);
|
176
|
+
//containerMessages.innerHTML = `Zoom aplicat: ${data}`;
|
177
|
+
});
|
178
|
+
|
179
|
+
//event loaded
|
180
|
+
communicator.on("loaded", function (data) {
|
181
|
+
// communicator.Geolocalize(true);
|
182
|
+
|
183
|
+
communicator.setCustomColors({
|
184
|
+
geom_stroke_color: "rgb(19, 39, 99,0.5)",
|
185
|
+
geom_fill_color: "rgb(19, 39, 99,0.5)",
|
186
|
+
geom_stroke_width: 1,
|
187
|
+
geom_shape: "circle",
|
188
|
+
geom_radius: 100,
|
189
|
+
});
|
190
|
+
|
191
|
+
console.log("loaded event", data);
|
35
192
|
});
|
36
193
|
|
194
|
+
//zoom to extent
|
195
|
+
if (btZoomToExtent) {
|
196
|
+
btZoomToExtent.addEventListener("click", function () {
|
197
|
+
cleanContainers();
|
198
|
+
//communicator.Geolocalize(true);
|
199
|
+
communicator.zoomToExtent();
|
200
|
+
});
|
201
|
+
}
|
202
|
+
|
203
|
+
//zoom to coordinates
|
204
|
+
if (btZoomToCoordinates) {
|
205
|
+
btZoomToCoordinates.addEventListener("click", function (data) {
|
206
|
+
cleanContainers();
|
207
|
+
// communicator.Geolocalize(true);
|
208
|
+
geoxy = data;
|
209
|
+
console.log(
|
210
|
+
"zoomToCoordinate data:" +
|
211
|
+
data.coordinates[0] +
|
212
|
+
", " +
|
213
|
+
data.coordinates[1]
|
214
|
+
);
|
215
|
+
communicator.zoomToCoordinates(
|
216
|
+
data.coordinates[0],
|
217
|
+
data.coordinates[1],
|
218
|
+
30
|
219
|
+
);
|
220
|
+
});
|
221
|
+
}
|
222
|
+
|
37
223
|
//info event
|
224
|
+
/*
|
38
225
|
communicator.on("info", function (data) {
|
39
226
|
console.log("info received", data);
|
40
|
-
|
227
|
+
var dataToRender = data.data;
|
228
|
+
//depending on infoType, data.data can be an string or a JSON
|
229
|
+
if (data.infoType === "wms") {
|
230
|
+
dataToRender = JSON.stringify(data.data);
|
231
|
+
}
|
232
|
+
containerMessages.innerText = dataToRender;
|
233
|
+
console.log( "Info: " + dataToRender);
|
234
|
+
|
235
|
+
let options = {
|
236
|
+
'geom': `POINT(${clickedCoordinates[0]} ${clickedCoordinates[1]})`,
|
237
|
+
'zoom':{
|
238
|
+
'type':'level',
|
239
|
+
'zoomLevel':18
|
240
|
+
}
|
241
|
+
}
|
242
|
+
console.log(options);
|
243
|
+
communicator.Highlight(options)
|
244
|
+
|
245
|
+
|
246
|
+
});*/
|
247
|
+
|
248
|
+
/*infoFromCoordinates('wms','Arc',null,'json); */
|
249
|
+
|
250
|
+
//NEW AGAFA els elements de una capa i els mostra
|
251
|
+
//Mostrar dades de la capa
|
252
|
+
var btGetElementsFromLayer = document.querySelector("#btGetElementsFromLayer");
|
253
|
+
if (btGetElementsFromLayer) {
|
254
|
+
btGetElementsFromLayer.addEventListener("click", function () {
|
255
|
+
let limit = document.getElementById("limit")
|
256
|
+
? document.getElementById("limit").value
|
257
|
+
: 100;
|
258
|
+
let format = document.getElementById("format")
|
259
|
+
? document.getElementById("format").value
|
260
|
+
: "json";
|
261
|
+
communicator.getElementsFromLayer(selected_layer, limit, format);
|
262
|
+
});
|
263
|
+
}
|
264
|
+
|
265
|
+
//Layer elements list
|
266
|
+
communicator.on("layerElements", function (data) {
|
267
|
+
console.log("layerElements received", data);
|
268
|
+
var dataToRender = data.data;
|
269
|
+
var contenedor = document.getElementById("contenedor");
|
270
|
+
//mostro el contenidor amb un fade
|
271
|
+
contenedor.style.display = "block";
|
272
|
+
//contenedor.fade(1000);
|
273
|
+
//depending on requested format, data.data can be an string (xml) or a JSON
|
274
|
+
console.log(
|
275
|
+
typeof dataToRender === "object"
|
276
|
+
? JSON.stringify(dataToRender)
|
277
|
+
: dataToRender
|
278
|
+
);
|
279
|
+
|
280
|
+
//codi xavi Javascript
|
281
|
+
var dades = JSON.stringify(dataToRender);
|
282
|
+
var json = jQuery.parseJSON(dades);
|
283
|
+
var id;
|
284
|
+
var dadesx = "";
|
285
|
+
|
286
|
+
//entro a 1- bucle
|
287
|
+
for (let i in json) {
|
288
|
+
//entro a 2n Bucle
|
289
|
+
for (let j in json[i]) {
|
290
|
+
if (json[i][j].hasOwnProperty("id")) {
|
291
|
+
id = json[i][j].id;
|
292
|
+
console.log("id:" + id);
|
293
|
+
dadesx = dadesx + "<h4>" + id + "</h4>";
|
294
|
+
}
|
295
|
+
if (json[i][j].hasOwnProperty("properties")) {
|
296
|
+
//entro a 3r Bucle
|
297
|
+
var htmlgeoXY = [];
|
298
|
+
for (let k in json[i][j]) {
|
299
|
+
for (let x in json[i][j][k]) {
|
300
|
+
if (json[i][j][k].hasOwnProperty("Codi_Obra")) {
|
301
|
+
dato = json[i][j][k].Codi_Obra;
|
302
|
+
console.log("Codi Obra:" + dato);
|
303
|
+
dadesx = dadesx + "<span>Codi Obra:" + dato + "</span><br>";
|
304
|
+
}
|
305
|
+
if (json[i][j][k].hasOwnProperty("Nom_Obra")) {
|
306
|
+
dato2 = json[i][j][k].Nom_Obra;
|
307
|
+
console.log("Nom Obra:" + dato2);
|
308
|
+
dadesx = dadesx + "<span>Nom Obra:" + dato2 + "</span><br>";
|
309
|
+
}
|
310
|
+
if (json[i][j][k].hasOwnProperty("Longitud")) {
|
311
|
+
dato3 = json[i][j][k].Longitud;
|
312
|
+
console.log(dato3);
|
313
|
+
dadesx = dadesx + "<span>Longitud:" + dato3 + "</span><br>";
|
314
|
+
}
|
315
|
+
if (json[i][j][k].hasOwnProperty("Cost_Obra")) {
|
316
|
+
dato7 = json[i][j][k].Cost_Obra;
|
317
|
+
console.log(dato7);
|
318
|
+
dadesx = dadesx + "<span>Cost Obra:" + dato7 + "</span><br>";
|
319
|
+
}
|
320
|
+
if (json[i][j][k].hasOwnProperty("Estat_Obra")) {
|
321
|
+
dato8 = json[i][j][k].Estat_Obra;
|
322
|
+
console.log(dato8);
|
323
|
+
dadesx = dadesx + "<span>Estat Obra:" + dato8 + "</span><br>";
|
324
|
+
}
|
325
|
+
if (json[i][j][k].hasOwnProperty("Any")) {
|
326
|
+
dato9 = json[i][j][k].Any;
|
327
|
+
console.log(dato9);
|
328
|
+
dadesx = dadesx + "<span>Estat Obra:" + dato9 + "</span><br>";
|
329
|
+
}
|
330
|
+
|
331
|
+
if (json[i][j][k].hasOwnProperty("X")) {
|
332
|
+
dato4 = json[i][j][k].X;
|
333
|
+
console.log("x: " + dato4);
|
334
|
+
htmlgeoXY[0] = dato4;
|
335
|
+
|
336
|
+
//dadesx= dadesx +"<span>x: " + dato4 + "</span><br>";
|
337
|
+
}
|
338
|
+
if (json[i][j][k].hasOwnProperty("Y")) {
|
339
|
+
dato5 = json[i][j][k].Y;
|
340
|
+
console.log("y: " + dato5);
|
341
|
+
htmlgeoXY[1] = dato5;
|
342
|
+
|
343
|
+
// dadesx= dadesx +"<span>y: " + dato5 + "</span><br>";
|
344
|
+
}
|
345
|
+
if (json[i][j][k].hasOwnProperty("Pem")) {
|
346
|
+
dato6 = json[i][j][k].Pem;
|
347
|
+
console.log("dato6: " + dato6);
|
348
|
+
htmlgeoXY[1] = dato6;
|
349
|
+
dadesx = dadesx + "<span>PEM:" + dato6 + "</span><BR>";
|
350
|
+
//provo de crear un buto parametritzat per a fer el zoom a la coordenada que toqui
|
351
|
+
console.log("Dades a inserir a name: " + id);
|
352
|
+
dadesx =
|
353
|
+
dadesx +
|
354
|
+
"<button name='" +
|
355
|
+
id +
|
356
|
+
"' class='fitxa' onclick='anaraxy(" +
|
357
|
+
dato4 +
|
358
|
+
"," +
|
359
|
+
dato5 +
|
360
|
+
")'>Visualitzar el punt: " +
|
361
|
+
id +
|
362
|
+
"</button><BR>"; //monto el buto per anar punt de mostreig
|
363
|
+
|
364
|
+
//dadesx= dadesx + "<button id='btZoomToCoordinates' name='btZoomToCoordinates' value= "+ geoXY[0] + "," +geoXY[1] + "><img id='img' src='./img/diana.png'></button><br>"
|
365
|
+
}
|
366
|
+
break;
|
367
|
+
//console.log("Objecte k: "+ k);
|
368
|
+
}
|
369
|
+
}
|
370
|
+
}
|
371
|
+
}
|
372
|
+
}
|
373
|
+
|
374
|
+
document.getElementById("contenedor").innerHTML = dadesx;
|
41
375
|
});
|
376
|
+
communicator.on("info", function (data) {
|
377
|
+
console.log("layerElements received", data);
|
378
|
+
var dataToRender = data.data;
|
379
|
+
//depending on requested format, data.data can be an string (xml) or a JSON
|
380
|
+
console.log(
|
381
|
+
typeof dataToRender === "object"
|
382
|
+
? JSON.stringify(dataToRender)
|
383
|
+
: dataToRender
|
384
|
+
);
|
385
|
+
|
386
|
+
//codi xavi Javascript
|
387
|
+
var dades = JSON.stringify(dataToRender);
|
388
|
+
var json = jQuery.parseJSON(dades);
|
389
|
+
var id;
|
390
|
+
var dadesx = "";
|
391
|
+
|
392
|
+
//entro a 1- bucle
|
393
|
+
for (let i in json) {
|
394
|
+
//entro a 2n Bucle
|
395
|
+
for (let j in json[i]) {
|
396
|
+
if (json[i][j].hasOwnProperty("id")) {
|
397
|
+
id = json[i][j].id;
|
398
|
+
console.log("id:" + id);
|
399
|
+
dadesx = dadesx + "<h4>" + id + "</h4>";
|
400
|
+
}
|
401
|
+
if (json[i][j].hasOwnProperty("properties")) {
|
402
|
+
//entro a 3r Bucle
|
403
|
+
var htmlgeoXY = [];
|
404
|
+
for (let k in json[i][j]) {
|
405
|
+
for (let x in json[i][j][k]) {
|
406
|
+
if (json[i][j][k].hasOwnProperty("Codi Obra")) {
|
407
|
+
dato = json[i][j][k].codiObra;
|
408
|
+
console.log("Codi Obra:" + dato);
|
409
|
+
dadesx = dadesx + "<span>Codi Obra:" + dato + "</span><br>";
|
410
|
+
}
|
411
|
+
if (json[i][j][k].hasOwnProperty("Any")) {
|
412
|
+
dato2 = json[i][j][k].any;
|
413
|
+
console.log("Any:" + dato2);
|
414
|
+
dadesx = dadesx + "<span>Any:" + dato2 + "</span><br>";
|
415
|
+
}
|
416
|
+
if (json[i][j][k].hasOwnProperty("Longitud")) {
|
417
|
+
dato3 = json[i][j][k].Longitud;
|
418
|
+
console.log(dato3);
|
419
|
+
htmlgeoXY[0] = dato3;
|
420
|
+
|
421
|
+
dadesx = dadesx + "<span>Longitud: " + dato3 + "</span><br>";
|
422
|
+
}
|
423
|
+
if (json[i][j][k].hasOwnProperty("X")) {
|
424
|
+
dato4 = json[i][j][k].X;
|
425
|
+
console.log("x: " + dato4);
|
426
|
+
htmlgeoXY[0] = dato4;
|
427
|
+
|
428
|
+
dadesx = dadesx + "<span>x: " + dato4 + "</span><br>";
|
429
|
+
}
|
430
|
+
if (json[i][j][k].hasOwnProperty("Y")) {
|
431
|
+
dato5 = json[i][j][k].Y;
|
432
|
+
console.log("y: " + dato5);
|
433
|
+
htmlgeoXY[1] = dato5;
|
434
|
+
|
435
|
+
dadesx = dadesx + "<span>y: " + dato5 + "</span><br>";
|
436
|
+
}
|
437
|
+
if (json[i][j][k].hasOwnProperty("Pem")) {
|
438
|
+
dato6 = json[i][j][k].PEM;
|
439
|
+
console.log("dato6: " + dato6);
|
440
|
+
htmlgeoXY[1] = dato6;
|
441
|
+
dadesx = dadesx + "<span>PEM:" + dato6 + "</span><BR>";
|
442
|
+
//provo de crear un buto parametritzat per a fer el zoom a la coordenada que toqui
|
443
|
+
console.log("Dades a inserir a name: " + id);
|
444
|
+
dadesx =
|
445
|
+
dadesx +
|
446
|
+
"<button name='" +
|
447
|
+
id +
|
448
|
+
"' class='fitxa' onclick='anaraxy(" +
|
449
|
+
dato4 +
|
450
|
+
"," +
|
451
|
+
dato5 +
|
452
|
+
")'>Visualitzar el punt: " +
|
453
|
+
id +
|
454
|
+
"</button><BR>"; //monto el buto per anar punt de mostreig
|
455
|
+
|
456
|
+
//dadesx= dadesx + "<button id='btZoomToCoordinates' name='btZoomToCoordinates' value= "+ geoXY[0] + "," +geoXY[1] + "><img id='img' src='./img/diana.png'></button><br>"
|
457
|
+
}
|
458
|
+
break;
|
459
|
+
//console.log("Objecte k: "+ k);
|
460
|
+
}
|
461
|
+
}
|
462
|
+
}
|
463
|
+
}
|
464
|
+
}
|
465
|
+
|
466
|
+
document.getElementById("contenedor").innerHTML = dadesx;
|
467
|
+
});
|
468
|
+
|
469
|
+
function anaraxy(x, y) {
|
470
|
+
console.log("Entro a funcio de anar a X,Y");
|
471
|
+
communicator.Geolocalize(false);
|
472
|
+
communicator.zoomToCoordinates(x, y, 18);
|
473
|
+
|
474
|
+
let options = {
|
475
|
+
geom: `POINT(${x} ${y})`,
|
476
|
+
zoom: {
|
477
|
+
type: "level",
|
478
|
+
zoomLevel: 18,
|
479
|
+
},
|
480
|
+
};
|
481
|
+
var contenedor = document.getElementById("contenedor");
|
482
|
+
contenedor.style.display = "none";
|
483
|
+
console.log("Amago el panell un cop fet el zoom");
|
484
|
+
console.log(options);
|
485
|
+
communicator.Highlight(options);
|
486
|
+
|
487
|
+
//geoxy.coordinates[0]= x;
|
488
|
+
//geoxy.coordinates[1]= y;
|
489
|
+
console.log("dades xy funcio anar a X,Y: " + x + "," + y);
|
490
|
+
}
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
<div id="sessionToken"></div>
|
16
16
|
<div>
|
17
|
-
Paste your code here:<br> <textarea name="code" id="code" rows="10" cols="100" placeholder=""
|
17
|
+
Paste your code here:<br> <textarea name="code" id="code" rows="10" cols="100" placeholder="">
|
18
18
|
</textarea>
|
19
19
|
</div>
|
20
20
|
<div>
|
package/package.json
CHANGED