@vidro/map-handler 1.3.1 → 1.3.3
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 +67 -1
- package/dist/map-handler.js +1 -1
- package/map-handler.d.ts +134 -0
- package/package.json +11 -4
- package/src/types.d.ts +63 -0
- package/.babelrc +0 -6
- package/doc/animation.png +0 -0
- package/doc/confirmComponent.png +0 -0
- package/doc/giswater.png +0 -0
- package/doc/giswaterInfo.png +0 -0
- package/doc/giswaterInfoApi.png +0 -0
- package/doc/giswatergeojson.png +0 -0
- package/doc/multiTile.png +0 -0
- package/doc/multiTileNoGutter.png +0 -0
- package/doc/togglelayergiswater.png +0 -0
- package/doc/vidromaps-basic.png +0 -0
- package/examples/full/apidemo.js +0 -387
- package/examples/full/cachedToken.dat +0 -1
- package/examples/full/cachedTokenData.dat +0 -1
- package/examples/full/docker/Docker_compose.yml +0 -14
- package/examples/full/docker/Dockerfile +0 -27
- package/examples/full/index.php +0 -200
- package/examples/full/storeToken.php +0 -6
- package/examples/full/tester.css +0 -74
- package/examples/full/tester.js +0 -658
- package/examples/multipleIframes/index.js +0 -82
- package/examples/multipleIframes/index.php +0 -52
- package/examples/react-next/README.md +0 -282
- package/examples/react-next/atoms/PrintLayoutSelector.js +0 -50
- package/examples/react-next/atoms/PrintPaperSizeSelector.js +0 -48
- package/examples/react-next/atoms/ZoomToScaleButton.js +0 -57
- package/examples/react-next/components/AuthComponent.js +0 -88
- package/examples/react-next/components/MapButtons.js +0 -136
- package/examples/react-next/components/MapFilters.js +0 -120
- package/examples/react-next/components/MapIframe.js +0 -25
- package/examples/react-next/components/MapInfo.js +0 -36
- package/examples/react-next/components/MapLayers.js +0 -60
- package/examples/react-next/components/MapList.js +0 -51
- package/examples/react-next/contexts/auth.js +0 -147
- package/examples/react-next/contexts/maps.js +0 -185
- package/examples/react-next/contexts/messages.js +0 -360
- package/examples/react-next/contexts/print.js +0 -51
- package/examples/react-next/env.sample +0 -3
- package/examples/react-next/eslint.config.mjs +0 -14
- package/examples/react-next/hooks/useMapEvents.js +0 -118
- package/examples/react-next/jsconfig.json +0 -7
- package/examples/react-next/next.config.mjs +0 -6
- package/examples/react-next/package.json +0 -25
- package/examples/react-next/pages/_app.js +0 -5
- package/examples/react-next/pages/index.js +0 -90
- package/examples/react-next/postcss.config.mjs +0 -8
- package/examples/react-next/public/discord.svg +0 -8
- package/examples/react-next/public/favicon.ico +0 -0
- package/examples/react-next/public/file.svg +0 -1
- package/examples/react-next/public/logo.png +0 -0
- package/examples/react-next/public/next.svg +0 -1
- package/examples/react-next/shared/constants.js +0 -47
- package/examples/react-next/shared/cookies.js +0 -23
- package/examples/react-next/styles/globals.css +0 -24
- package/examples/react-next/tailwind.config.mjs +0 -17
- package/examples/serverLess/dist/index.23420cfa.js +0 -2973
- package/examples/serverLess/dist/index.23420cfa.js.map +0 -1
- package/examples/serverLess/dist/index.91b6cacc.js +0 -2
- package/examples/serverLess/dist/index.91b6cacc.js.map +0 -1
- package/examples/serverLess/dist/index.html +0 -1
- package/examples/serverLess/index.html +0 -39
- package/examples/serverLess/main.js +0 -113
- package/examples/serverLess/package.json +0 -18
- package/examples/serverLess/readme.md +0 -41
- package/examples/simple/index.html +0 -23
- package/examples/simple/simple.js +0 -80
- package/examples/taigua/index.html +0 -55
- package/examples/taigua/main.js +0 -490
- package/examples/tester.css +0 -74
- package/examples/vidromap/index.js +0 -20
- package/examples/vidromap/index.php +0 -111
- package/flows.md +0 -73
- package/helpers.md +0 -45
- package/src/index.js +0 -879
- package/src/shared/iframe-communicator.js +0 -18
- package/webpack.config.js +0 -22
package/examples/taigua/main.js
DELETED
|
@@ -1,490 +0,0 @@
|
|
|
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;
|
|
4
|
-
var communicator = new VidroMaps.Communicator({
|
|
5
|
-
sessionToken: sessionToken,
|
|
6
|
-
});
|
|
7
|
-
var selected_layer; //active layer
|
|
8
|
-
|
|
9
|
-
//var per geolocalització
|
|
10
|
-
var geoxy;
|
|
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");
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
var btMostraDades = document.getElementById("btGetElementsFromLayer");
|
|
56
|
-
btMostraDades.addEventListener("click", function () {
|
|
57
|
-
console.log("Mostrar Dades.");
|
|
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);
|
|
65
|
-
|
|
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
|
-
});
|
|
86
|
-
|
|
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
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
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;
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
//clicked coordinates
|
|
136
|
-
communicator.on("coordinates", function (data) {
|
|
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");
|
|
142
|
-
clickedCoordinates = [data.coordinates[0], data.coordinates[1]];
|
|
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);
|
|
192
|
-
});
|
|
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
|
-
|
|
223
|
-
//info event
|
|
224
|
-
/*
|
|
225
|
-
communicator.on("info", function (data) {
|
|
226
|
-
console.log("info received", data);
|
|
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;
|
|
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
|
-
}
|
package/examples/tester.css
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
* {
|
|
2
|
-
box-sizing: border-box;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
body{
|
|
6
|
-
background-color: ghostwhite;
|
|
7
|
-
color: lightslategrey;
|
|
8
|
-
font-family: Hack, monospace;
|
|
9
|
-
padding: 20px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
#sessionToken{
|
|
13
|
-
display: none;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
#iframes-container{
|
|
17
|
-
display: flex;
|
|
18
|
-
justify-content: space-between;
|
|
19
|
-
gap: 25px;
|
|
20
|
-
margin: 25px 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
iframe{
|
|
24
|
-
background-color: white;
|
|
25
|
-
border-radius: 5px;
|
|
26
|
-
overflow: hidden;
|
|
27
|
-
border: none;
|
|
28
|
-
box-shadow: 0 5px 10px 0 rgba(0, 0, 0, .2);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
iframe[name=map-frame]{
|
|
32
|
-
padding: 10px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
pre{
|
|
36
|
-
overflow: scroll;
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
.error{
|
|
40
|
-
color: red;
|
|
41
|
-
font-weight: bold;
|
|
42
|
-
}
|
|
43
|
-
.hide{
|
|
44
|
-
display: none;
|
|
45
|
-
}
|
|
46
|
-
.form{
|
|
47
|
-
margin: 20px;
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
.form div{
|
|
51
|
-
padding: 10px;
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
#Error_container{
|
|
56
|
-
color: red;
|
|
57
|
-
font-weight: bold;
|
|
58
|
-
}
|
|
59
|
-
#Result_container{
|
|
60
|
-
color: blue;
|
|
61
|
-
font-size: 10px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
small{
|
|
65
|
-
color: #ccc;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
@@ -1,20 +0,0 @@
|
|
|
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(codeContent.value!=""){
|
|
17
|
-
iframesContainer.innerHTML = codeContent.value;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|