@vidro/map-handler 1.2.179 → 1.2.191
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 +4 -1
- package/dist/map-handler.js +1 -1
- package/examples/full/apidemo.js +46 -43
- package/examples/full/cachedToken.dat +1 -1
- package/examples/full/cachedTokenData.dat +1 -1
- package/examples/full/docker/Docker_compose.yml +14 -0
- package/examples/full/docker/Dockerfile +27 -0
- package/examples/full/index.php +6 -4
- package/examples/full/tester.css +74 -0
- package/examples/full/tester.js +11 -4
- package/examples/react-next/README.md +260 -18
- package/examples/react-next/components/AuthComponent.js +88 -0
- package/examples/react-next/components/MapButtons.js +151 -30
- package/examples/react-next/components/MapFilters.js +120 -0
- package/examples/react-next/components/MapInfo.js +36 -0
- package/examples/react-next/components/MapLayers.js +60 -0
- package/examples/react-next/components/MapList.js +43 -0
- package/examples/react-next/contexts/auth.js +3 -1
- package/examples/react-next/contexts/maps.js +35 -16
- package/examples/react-next/contexts/messages.js +1 -6
- package/examples/react-next/env.sample +3 -0
- package/examples/react-next/hooks/useMapEvents.js +41 -132
- package/examples/react-next/package.json +2 -2
- package/examples/react-next/pages/index.js +26 -16
- package/examples/react-next/public/discord.svg +8 -0
- package/examples/react-next/public/favicon.ico +0 -0
- package/examples/react-next/public/logo.png +0 -0
- package/package.json +1 -1
- package/src/index.js +8 -3
- package/examples/react-next/components/SessionComponent.js +0 -136
- package/examples/react-next/pages/_document.js +0 -13
- package/examples/react-next/public/globe.svg +0 -1
- package/examples/react-next/public/vercel.svg +0 -1
- package/examples/react-next/public/window.svg +0 -1
- package/examples/react-next/shared/maps-service.js +0 -65
@@ -0,0 +1,36 @@
|
|
1
|
+
import { useMaps } from "@/contexts/maps";
|
2
|
+
import useMapEvents from "@/hooks/useMapEvents";
|
3
|
+
const MapInfo = () => {
|
4
|
+
useMapEvents();
|
5
|
+
const {
|
6
|
+
zoomLevel,
|
7
|
+
mapScale,
|
8
|
+
clickedCoordinates,
|
9
|
+
map,
|
10
|
+
displayedLayers,
|
11
|
+
mapResolution,
|
12
|
+
} = useMaps();
|
13
|
+
if (!map) return null;
|
14
|
+
return (
|
15
|
+
<div className="absolute bg-white/60 right-0 p-5">
|
16
|
+
<div className="flex flex-col gap-1 text-xs">
|
17
|
+
<div>Zoom level: {zoomLevel}</div>
|
18
|
+
<div>Map scale: {mapScale}</div>
|
19
|
+
<div>Map resolution: {mapResolution}</div>
|
20
|
+
<div>Clicked coordinates: {clickedCoordinates}</div>
|
21
|
+
</div>
|
22
|
+
<div className="bg-black/20 p-5 text-left mt-2">
|
23
|
+
<span>Displayed Layers:</span>
|
24
|
+
|
25
|
+
{displayedLayers && displayedLayers.length > 0 && (
|
26
|
+
<div className="mt-1 flex flex-col gap-1 text-xs">
|
27
|
+
{displayedLayers.map((layer) => (
|
28
|
+
<div key={`lay_${layer}`}> - {layer}</div>
|
29
|
+
))}
|
30
|
+
</div>
|
31
|
+
)}
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
);
|
35
|
+
};
|
36
|
+
export default MapInfo;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { useAuth } from "@/contexts/auth";
|
2
|
+
import { useMaps } from "@/contexts/maps";
|
3
|
+
import { useMessages } from "@/contexts/messages";
|
4
|
+
import { useEffect, useState } from "react";
|
5
|
+
|
6
|
+
const MapLayers = () => {
|
7
|
+
const { GetMapInfo, mapId, mapLayers, setActiveLayer } = useMaps();
|
8
|
+
const { ToggleLayer } = useMessages();
|
9
|
+
const { logged } = useAuth();
|
10
|
+
const [selectedLayer, setSelectedLayer] = useState("-1");
|
11
|
+
|
12
|
+
useEffect(() => {
|
13
|
+
if (!mapId) return;
|
14
|
+
GetMapInfo(mapId);
|
15
|
+
}, [mapId]);
|
16
|
+
|
17
|
+
if (!logged) return null;
|
18
|
+
if (!mapId) return null;
|
19
|
+
return (
|
20
|
+
<>
|
21
|
+
<div>
|
22
|
+
{mapLayers && mapLayers.length === 0 && <div>No layers available</div>}
|
23
|
+
|
24
|
+
<div className="m-2 flex gap-2">
|
25
|
+
<label className="block text-sm font-medium text-gray-700 pt-2">
|
26
|
+
Layers
|
27
|
+
</label>
|
28
|
+
{mapLayers && mapLayers.length > 0 && (
|
29
|
+
<select
|
30
|
+
className="border border-gray-300 rounded-md p-2 w-60"
|
31
|
+
onChange={(e) => setSelectedLayer(e.target.value)}
|
32
|
+
value={selectedLayer}
|
33
|
+
>
|
34
|
+
<option value="-1">Select layer...</option>
|
35
|
+
{mapLayers.map((ele) => (
|
36
|
+
<option key={ele.id} value={ele.qgis_name}>
|
37
|
+
{ele.qgis_name} - {ele.alias}
|
38
|
+
</option>
|
39
|
+
))}
|
40
|
+
</select>
|
41
|
+
)}
|
42
|
+
|
43
|
+
<button
|
44
|
+
onClick={(e) => {
|
45
|
+
console.log("Toggle layer", selectedLayer);
|
46
|
+
setActiveLayer(selectedLayer);
|
47
|
+
ToggleLayer(selectedLayer);
|
48
|
+
}}
|
49
|
+
disabled={selectedLayer === "-1"}
|
50
|
+
className="border border-gray-300 bg-black text-white rounded-md p-2 mt-1 text-xs"
|
51
|
+
>
|
52
|
+
Toggle layer
|
53
|
+
</button>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
</>
|
57
|
+
);
|
58
|
+
};
|
59
|
+
|
60
|
+
export default MapLayers;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { useAuth } from "@/contexts/auth";
|
2
|
+
import { useMaps } from "@/contexts/maps";
|
3
|
+
import { useState } from "react";
|
4
|
+
|
5
|
+
const MapList = () => {
|
6
|
+
const { GetMap } = useMaps();
|
7
|
+
const { projects, logged } = useAuth();
|
8
|
+
const [selectedMap, setSelectedMap] = useState("-1");
|
9
|
+
if (!logged) return null;
|
10
|
+
return (
|
11
|
+
<div>
|
12
|
+
<div className="m-2 flex gap-2">
|
13
|
+
<label className="block text-sm font-medium text-gray-700 pt-2">
|
14
|
+
Maps
|
15
|
+
</label>
|
16
|
+
<select
|
17
|
+
className="border border-gray-300 rounded-md p-2 w-32"
|
18
|
+
onChange={(e) => setSelectedMap(e.target.value)}
|
19
|
+
value={selectedMap}
|
20
|
+
>
|
21
|
+
<option value="-1">Select a map</option>
|
22
|
+
{projects.map((projectId) => (
|
23
|
+
<option key={projectId} value={projectId}>
|
24
|
+
{projectId}
|
25
|
+
</option>
|
26
|
+
))}
|
27
|
+
</select>
|
28
|
+
|
29
|
+
<button
|
30
|
+
onClick={(e) => {
|
31
|
+
GetMap(selectedMap);
|
32
|
+
}}
|
33
|
+
disabled={selectedMap === "-1"}
|
34
|
+
className="border border-gray-300 bg-black text-white rounded-md p-2 mt-1 text-xs"
|
35
|
+
>
|
36
|
+
Load map
|
37
|
+
</button>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
);
|
41
|
+
};
|
42
|
+
|
43
|
+
export default MapList;
|
@@ -5,7 +5,9 @@ import { useRouter } from "next/navigation";
|
|
5
5
|
const AuthContext = createContext({});
|
6
6
|
|
7
7
|
export const AuthProvider = ({ children }) => {
|
8
|
-
const [apiUrl, setApiUrl] = useState(
|
8
|
+
const [apiUrl, setApiUrl] = useState(
|
9
|
+
process.env.NEXT_PUBLIC_APIURL ? process.env.NEXT_PUBLIC_APIURL : ""
|
10
|
+
);
|
9
11
|
const [logged, setLogged] = useState(null);
|
10
12
|
const [token, setToken] = useState(null);
|
11
13
|
const [userId, setUserId] = useState(null);
|
@@ -1,28 +1,24 @@
|
|
1
1
|
"use client";
|
2
2
|
import { createContext, useContext, useState, useEffect } from "react";
|
3
|
-
|
4
|
-
import MapService from "@/shared/maps-service";
|
5
3
|
import { useAuth } from "./auth";
|
6
4
|
|
7
5
|
const MapsContext = createContext({});
|
8
6
|
|
9
7
|
export const MapsProvider = ({ children }) => {
|
10
8
|
const { apiUrl, token } = useAuth();
|
11
|
-
const [loading, setLoading] = useState(true);
|
12
9
|
const [map, setMap] = useState(null);
|
13
10
|
const [mapId, setMapId] = useState(null);
|
14
|
-
|
15
|
-
const [mapInfo, setMapInfo] = useState(null);
|
11
|
+
|
16
12
|
const [mapError, setMapError] = useState(null);
|
17
13
|
const [mapReady, setMapReady] = useState(false);
|
18
|
-
|
19
|
-
const [componentUrl, setComponentUrl] = useState(null);
|
14
|
+
|
20
15
|
const [sessionToken, setSessionToken] = useState(null);
|
21
16
|
const [currentMapAction, setCurrentMapAction] = useState(null);
|
22
17
|
const [clickedCoordinates, setClickedCoordinates] = useState(null);
|
23
18
|
const [bboxCoordinates, setBboxcoordinates] = useState(null);
|
24
19
|
const [zoomLevel, setZoomLevel] = useState(null);
|
25
20
|
const [mapScale, setMapScale] = useState(null);
|
21
|
+
const [mapResolution, setMapResolution] = useState(null);
|
26
22
|
const [srid, setSrid] = useState(null);
|
27
23
|
|
28
24
|
//geolocations
|
@@ -36,9 +32,7 @@ export const MapsProvider = ({ children }) => {
|
|
36
32
|
//layers
|
37
33
|
const [displayedLayers, setDisplayedLayers] = useState([]);
|
38
34
|
const [activeLayer, setActiveLayer] = useState(null);
|
39
|
-
const [
|
40
|
-
//preselected layers - shortcut to displayed layers (the pills)
|
41
|
-
const [preselectedLayers, setPreselectedLayers] = useState([]);
|
35
|
+
const [mapLayers, setMapLayers] = useState(null);
|
42
36
|
|
43
37
|
const [infoLayerSource, setInfoLayerSource] = useState([]); //layer from info is received
|
44
38
|
|
@@ -64,24 +58,46 @@ export const MapsProvider = ({ children }) => {
|
|
64
58
|
});
|
65
59
|
const data = await response.json();
|
66
60
|
console.log("GetMap", data);
|
67
|
-
|
61
|
+
setMapId(id);
|
68
62
|
setMapError(false);
|
69
|
-
setSessionToken(data.message.
|
63
|
+
setSessionToken(data.message.sessionToken);
|
70
64
|
setMap(
|
71
65
|
`${data.message.iframe}?sessionToken=${data.message.sessionToken}`
|
72
66
|
);
|
73
|
-
setComponentUrl(data.iframe);
|
74
67
|
return;
|
75
68
|
} catch (error) {
|
76
69
|
console.error("Error fetching map:", error);
|
77
70
|
setSessionToken(null);
|
78
71
|
setMap(null);
|
79
|
-
|
80
|
-
setMaptoken(null);
|
72
|
+
setMapId(null);
|
81
73
|
throw error;
|
82
74
|
}
|
83
75
|
};
|
84
76
|
|
77
|
+
const GetMapInfo = async (id) => {
|
78
|
+
let url = `${apiUrl}map/detail/${id}`;
|
79
|
+
|
80
|
+
try {
|
81
|
+
const response = await fetch(url, {
|
82
|
+
method: "GET",
|
83
|
+
headers: {
|
84
|
+
"Content-Type": "application/json",
|
85
|
+
Authorization: `Bearer ${token}`,
|
86
|
+
},
|
87
|
+
});
|
88
|
+
const data = await response.json();
|
89
|
+
console.log("GetMapInfo", data);
|
90
|
+
console.log("Layers", data.message.layers);
|
91
|
+
setMapLayers(data.message.layers);
|
92
|
+
setConfiguredFilters(data.message.layerFilters);
|
93
|
+
return;
|
94
|
+
} catch (error) {
|
95
|
+
console.error("Error fetching map info:", error);
|
96
|
+
|
97
|
+
setMapLayers(null);
|
98
|
+
throw error;
|
99
|
+
}
|
100
|
+
};
|
85
101
|
return (
|
86
102
|
<MapsContext.Provider
|
87
103
|
value={{
|
@@ -89,7 +105,6 @@ export const MapsProvider = ({ children }) => {
|
|
89
105
|
setMapId,
|
90
106
|
GetMap,
|
91
107
|
map,
|
92
|
-
mapInfo,
|
93
108
|
sessionToken,
|
94
109
|
mapError,
|
95
110
|
mapReady,
|
@@ -129,6 +144,10 @@ export const MapsProvider = ({ children }) => {
|
|
129
144
|
mapScale,
|
130
145
|
setMapScale,
|
131
146
|
setSessionToken,
|
147
|
+
mapLayers,
|
148
|
+
GetMapInfo,
|
149
|
+
mapResolution,
|
150
|
+
setMapResolution,
|
132
151
|
}}
|
133
152
|
>
|
134
153
|
{children}
|
@@ -59,6 +59,7 @@ export const MessageProvider = ({ children }) => {
|
|
59
59
|
|
60
60
|
const Filters = (filters) => {
|
61
61
|
if (!communicator) return;
|
62
|
+
console.log("messages - Filters", filters);
|
62
63
|
communicator.setFilters(filters);
|
63
64
|
};
|
64
65
|
|
@@ -119,12 +120,6 @@ export const MessageProvider = ({ children }) => {
|
|
119
120
|
communicator.toggleLayer(layer, properties);
|
120
121
|
};
|
121
122
|
|
122
|
-
const doSetActiveLayer = (name) => {
|
123
|
-
if (!communicator) return;
|
124
|
-
console.log("doSetActiveLayer", { name });
|
125
|
-
communicator.setActiveLayer(name);
|
126
|
-
};
|
127
|
-
|
128
123
|
const removeLayer = (name) => {
|
129
124
|
if (!communicator) return;
|
130
125
|
console.log("removeLayer", { name });
|
@@ -1,199 +1,108 @@
|
|
1
1
|
"use client";
|
2
|
-
import { useEffect
|
3
|
-
import
|
4
|
-
import { useIntl } from "react-intl";
|
5
|
-
import { toast } from "react-toastify";
|
6
|
-
import { ERRORS, MAP_EVENTS, PLUGINS } from "@/shared/constants";
|
2
|
+
import { useEffect } from "react";
|
3
|
+
import { MAP_EVENTS } from "@/shared/constants";
|
7
4
|
import { useMessages } from "@/contexts/messages";
|
8
5
|
import { useMaps } from "@/contexts/maps";
|
9
|
-
|
10
|
-
|
11
|
-
const logger = new Logger("Hooks - useMapEvents");
|
12
|
-
const useMapEvents = (setShowInfo) => {
|
6
|
+
const useMapEvents = () => {
|
13
7
|
const {
|
14
|
-
doInfo,
|
15
|
-
setTiledReady,
|
16
8
|
setMapReady,
|
17
9
|
setDisplayedLayers,
|
18
10
|
setCurrentMapAction,
|
19
11
|
displayedLayers,
|
20
12
|
setZoomLevel,
|
21
|
-
mapInfo,
|
22
13
|
mapReady,
|
23
|
-
AddLayerToPreselectedLayers,
|
24
|
-
mapScale,
|
25
14
|
setMapScale,
|
15
|
+
setClickedCoordinates,
|
16
|
+
setSrid,
|
17
|
+
setBboxcoordinates,
|
18
|
+
setMapResolution,
|
26
19
|
} = useMaps();
|
27
|
-
const { message, setMessage,
|
28
|
-
const [cookieCoordinates, setCookieCoordindates] = useState(null);
|
29
|
-
const [cookieZoom, setCookieZoom] = useState(null);
|
30
|
-
const [cookieToc, setCookieToc] = useState(null);
|
31
|
-
|
32
|
-
useEffect(() => {
|
33
|
-
if (!cookieCoordinates) return;
|
34
|
-
if (!cookieZoom) return;
|
35
|
-
try {
|
36
|
-
logger.log("Cookie zoom", { cookieZoom, cookieCoordinates });
|
37
|
-
zoomToCoordinates(JSON.parse(cookieCoordinates), cookieZoom);
|
38
|
-
} catch (e) {
|
39
|
-
logger.error("error parsing coordinates", e);
|
40
|
-
}
|
41
|
-
}, [cookieCoordinates, cookieZoom]);
|
42
|
-
|
43
|
-
useEffect(() => {
|
44
|
-
if (!mapInfo) return;
|
45
|
-
if (mapInfo?.layers.length === 0) return;
|
46
|
-
logger.log("Cookie layers", { mapInfo, cookieToc });
|
47
|
-
if (!cookieToc || cookieToc === "undefined") return;
|
48
|
-
try {
|
49
|
-
const tocLayers = JSON.parse(cookieToc);
|
50
|
-
logger.log("Cookie layers", tocLayers);
|
51
|
-
tocLayers.forEach((element) => {
|
52
|
-
logger.log("Cookie layers adding", element);
|
53
|
-
//find layer in project layers
|
54
|
-
const lay = mapInfo.layers.find((ly) => ly.qgis_name === element);
|
55
|
-
//render layer
|
56
|
-
AddLayerToPreselectedLayers(lay.id);
|
57
|
-
});
|
58
|
-
} catch (e) {
|
59
|
-
logger.error("error parsing cookieToc", e);
|
60
|
-
}
|
61
|
-
}, [cookieToc, mapInfo]);
|
20
|
+
const { message, setMessage, Highlight } = useMessages();
|
62
21
|
|
63
22
|
useEffect(() => {
|
64
23
|
if (!message) return;
|
65
24
|
if (!mapReady) return;
|
66
|
-
if (!mapInfo) return;
|
67
25
|
|
68
26
|
switch (message.type) {
|
69
27
|
case MAP_EVENTS.ZOOM_CHANGE:
|
70
|
-
|
71
|
-
|
72
|
-
storeMapCookie(`${mapInfo.id}_zoom`, message.zoom);
|
73
|
-
setZoomLevel(message.zoom);
|
74
|
-
}
|
28
|
+
console.log("useMapEvents Zoom changed", message);
|
29
|
+
setZoomLevel(message.zoom);
|
75
30
|
setMapScale(message?.meta?.scale);
|
31
|
+
setMapResolution(message?.meta?.resolution);
|
76
32
|
setMessage(null);
|
77
33
|
break;
|
78
34
|
case MAP_EVENTS.CENTER_CHANGE:
|
79
|
-
if (mapInfo.zoomcookie) {
|
80
|
-
storeMapCookie(
|
81
|
-
`${mapInfo.id}_center`,
|
82
|
-
JSON.stringify(message.coordinates)
|
83
|
-
);
|
84
|
-
}
|
85
35
|
setMessage(null);
|
86
36
|
break;
|
87
37
|
default:
|
88
38
|
setMessage(null);
|
89
39
|
break;
|
90
40
|
}
|
91
|
-
}, [message,
|
41
|
+
}, [message, mapReady]);
|
92
42
|
|
93
43
|
useEffect(() => {
|
94
44
|
if (!message) return;
|
95
45
|
switch (message.type) {
|
96
|
-
case MAP_EVENTS.VERSION:
|
97
|
-
//ToDo
|
98
|
-
break;
|
99
46
|
case MAP_EVENTS.LOADED:
|
100
47
|
if (message.what === "map") {
|
101
|
-
|
102
|
-
//use cookie for zoom and position only if map is configured with zoomcookie
|
103
|
-
if (mapInfo.zoomcookie) {
|
104
|
-
setCookieCoordindates(readMapCookie(`${mapInfo.id}_center`));
|
105
|
-
setCookieZoom(readMapCookie(`${mapInfo.id}_zoom`));
|
106
|
-
}
|
107
|
-
//use cookie for toc layers configured with tocusecookie
|
108
|
-
if (mapInfo.tocusecookie) {
|
109
|
-
setCookieToc(readMapCookie(`${mapInfo.id}_toc`));
|
110
|
-
}
|
48
|
+
console.log("useMapEvents Map loaded and ready");
|
111
49
|
setMapReady(true);
|
112
50
|
} else if (message.what === "tiled") {
|
113
|
-
|
114
|
-
setTiledReady(true);
|
51
|
+
console.log("useMapEvents Tiled loaded");
|
115
52
|
}
|
116
53
|
if (message.what === "layer") {
|
117
|
-
if (mapInfo.tocusecookie) {
|
118
|
-
if (cookieToc && cookieToc !== "undefined") {
|
119
|
-
let currentCookie = JSON.parse(cookieToc);
|
120
|
-
if (!currentCookie.find((l) => l === message.layer)) {
|
121
|
-
logger.log("Store layer in TOC cookie", message.layer);
|
122
|
-
currentCookie.push(message.layer);
|
123
|
-
storeMapCookie(
|
124
|
-
`${mapInfo.id}_toc`,
|
125
|
-
JSON.stringify(currentCookie)
|
126
|
-
);
|
127
|
-
}
|
128
|
-
} else {
|
129
|
-
logger.log("Store layer in TOC cookie", message.layer);
|
130
|
-
storeMapCookie(
|
131
|
-
`${mapInfo.id}_toc`,
|
132
|
-
JSON.stringify([message.layer])
|
133
|
-
);
|
134
|
-
}
|
135
|
-
}
|
136
54
|
}
|
137
55
|
setMessage(null);
|
138
56
|
break;
|
139
57
|
case MAP_EVENTS.UNLOADED:
|
140
58
|
if (message.what === "tiled") {
|
141
|
-
|
142
|
-
setTiledReady(false);
|
59
|
+
console.log("useMapEvents Tiled unloaded");
|
143
60
|
}
|
144
61
|
setMessage(null);
|
145
62
|
break;
|
146
63
|
case MAP_EVENTS.LAYERS:
|
147
|
-
|
64
|
+
console.log("useMapEvents displayed layers", message.layers);
|
148
65
|
if (!message.layers) returns;
|
149
66
|
//check if is already displayed
|
150
67
|
setDisplayedLayers(message.layers);
|
151
68
|
setMessage(null);
|
152
69
|
break;
|
153
70
|
case MAP_EVENTS.GEOM_ADDED:
|
154
|
-
|
71
|
+
console.log("GeomAdded", message);
|
155
72
|
setCurrentMapAction(null);
|
73
|
+
//Highlight the added geom
|
74
|
+
Highlight(
|
75
|
+
{
|
76
|
+
feature_type: "HIGHLIGHT",
|
77
|
+
geom: message?.geom_astext,
|
78
|
+
},
|
79
|
+
2,
|
80
|
+
{
|
81
|
+
duration: 1500,
|
82
|
+
repeat: true,
|
83
|
+
},
|
84
|
+
0,
|
85
|
+
null
|
86
|
+
);
|
156
87
|
if (message?.geom_astext === null) {
|
157
88
|
setMessage(null);
|
158
89
|
return;
|
159
90
|
}
|
160
|
-
/************************************************************************************
|
161
|
-
***************** INFO *************************
|
162
|
-
***********************************************************************************/
|
163
|
-
(async () => {
|
164
|
-
/*
|
165
|
-
try {
|
166
|
-
const { data, error } = await doInfo(
|
167
|
-
message.geom_astext,
|
168
|
-
message.srid,
|
169
|
-
currentElementType.name
|
170
|
-
);
|
171
|
-
|
172
|
-
logger.log("GeomAdded info", { data, error });
|
173
|
-
if (error) {
|
174
|
-
return { error: error };
|
175
|
-
}
|
176
|
-
} catch (err) {
|
177
|
-
// Handle errors
|
178
|
-
logger.error("Error occurred:", err);
|
179
|
-
} finally {
|
180
|
-
// Clean up or perform additional actions
|
181
|
-
setMessage(null);
|
182
|
-
// setCurrentMapAction(null);
|
183
|
-
}*/
|
184
|
-
})();
|
185
|
-
break;
|
186
|
-
|
187
|
-
/************************************************************************************
|
188
|
-
***************** END INFO *************************
|
189
|
-
***********************************************************************************/
|
190
91
|
|
191
92
|
/************************************************************************************
|
192
93
|
***************** CLICKED COORDINATES *************************
|
193
94
|
***********************************************************************************/
|
194
95
|
|
195
|
-
|
196
|
-
|
96
|
+
//***************** MAP CLICKED COORDINATES *************************
|
97
|
+
case MAP_EVENTS.COORDINATES:
|
98
|
+
console.log("clicked coordinates", message);
|
99
|
+
|
100
|
+
setClickedCoordinates(message.coordinates);
|
101
|
+
setSrid(message.srid);
|
102
|
+
setBboxcoordinates(message.bbox);
|
103
|
+
setMessage(null);
|
104
|
+
break;
|
105
|
+
|
197
106
|
/************************************************************************************
|
198
107
|
***************** END CLICKED COORDINATES *************************
|
199
108
|
***********************************************************************************/
|
@@ -3,13 +3,13 @@
|
|
3
3
|
"version": "0.1.0",
|
4
4
|
"private": true,
|
5
5
|
"scripts": {
|
6
|
-
"dev": "next dev",
|
6
|
+
"dev": "next dev -p",
|
7
7
|
"build": "next build",
|
8
8
|
"start": "next start",
|
9
9
|
"lint": "next lint"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
|
-
"@vidro/map-handler": "^1.2.
|
12
|
+
"@vidro/map-handler": "^1.2.179",
|
13
13
|
"next": "15.1.6",
|
14
14
|
"react": "^19.0.0",
|
15
15
|
"react-dom": "^19.0.0"
|
@@ -1,10 +1,14 @@
|
|
1
1
|
import MapButtons from "@/components/MapButtons";
|
2
2
|
import MapIframe from "@/components/MapIframe";
|
3
|
-
import
|
3
|
+
import MapInfo from "@/components/MapInfo";
|
4
|
+
import AuthComponent from "@/components/AuthComponent";
|
4
5
|
import { AuthProvider } from "@/contexts/auth";
|
5
6
|
import { MapsProvider } from "@/contexts/maps";
|
6
7
|
import { MessageProvider } from "@/contexts/messages";
|
7
8
|
import Image from "next/image";
|
9
|
+
import MapList from "@/components/MapList";
|
10
|
+
import MapLayers from "@/components/MapLayers";
|
11
|
+
import MapFilters from "@/components/MapFilters";
|
8
12
|
|
9
13
|
export default function Home() {
|
10
14
|
return (
|
@@ -13,12 +17,19 @@ export default function Home() {
|
|
13
17
|
<MessageProvider>
|
14
18
|
<MapsProvider>
|
15
19
|
<main className="text-center">
|
16
|
-
<h1>Map component REACT integration</h1>
|
20
|
+
<h1 className="text-3xl">Map component REACT integration</h1>
|
17
21
|
<div className="my-5">
|
18
|
-
<
|
22
|
+
<AuthComponent />
|
19
23
|
</div>
|
24
|
+
<div className="my-5">
|
25
|
+
<MapList />
|
26
|
+
<MapLayers />
|
27
|
+
<MapFilters />
|
28
|
+
</div>
|
29
|
+
|
20
30
|
<div className="my-5 bg-gray-100 border border-gray-400 p-4">
|
21
31
|
<MapButtons />
|
32
|
+
<MapInfo />
|
22
33
|
<MapIframe />
|
23
34
|
</div>
|
24
35
|
</main>
|
@@ -28,48 +39,47 @@ export default function Home() {
|
|
28
39
|
<footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center">
|
29
40
|
<a
|
30
41
|
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
|
31
|
-
href="https://
|
42
|
+
href="https://www.vidrosoftware.com"
|
32
43
|
target="_blank"
|
33
44
|
rel="noopener noreferrer"
|
34
45
|
>
|
35
46
|
<Image
|
36
47
|
aria-hidden
|
37
|
-
src="/
|
38
|
-
alt="
|
39
|
-
width={
|
40
|
-
height={
|
48
|
+
src="/logo.png"
|
49
|
+
alt="Vidrosoftware"
|
50
|
+
width={150}
|
51
|
+
height={120}
|
41
52
|
/>
|
42
|
-
Learn
|
43
53
|
</a>
|
44
54
|
<a
|
45
55
|
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
|
46
|
-
href="https://
|
56
|
+
href="https://github.com/Vidro-Software-SL/maphandler"
|
47
57
|
target="_blank"
|
48
58
|
rel="noopener noreferrer"
|
49
59
|
>
|
50
60
|
<Image
|
51
61
|
aria-hidden
|
52
|
-
src="/
|
62
|
+
src="/file.svg"
|
53
63
|
alt="Window icon"
|
54
64
|
width={16}
|
55
65
|
height={16}
|
56
66
|
/>
|
57
|
-
|
67
|
+
Documentation
|
58
68
|
</a>
|
59
69
|
<a
|
60
70
|
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
|
61
|
-
href="https://
|
71
|
+
href="https://discord.com/channels/1305257097843179642/1305257098313072714"
|
62
72
|
target="_blank"
|
63
73
|
rel="noopener noreferrer"
|
64
74
|
>
|
65
75
|
<Image
|
66
76
|
aria-hidden
|
67
|
-
src="/
|
68
|
-
alt="
|
77
|
+
src="/discord.svg"
|
78
|
+
alt="Discord icon"
|
69
79
|
width={16}
|
70
80
|
height={16}
|
71
81
|
/>
|
72
|
-
|
82
|
+
Discord channel
|
73
83
|
</a>
|
74
84
|
</footer>
|
75
85
|
</div>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
3
|
+
<svg width="800px" height="800px" viewBox="0 -28.5 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
|
4
|
+
<g>
|
5
|
+
<path d="M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z" fill="#5865F2" fill-rule="nonzero">
|
6
|
+
|
7
|
+
</g>
|
8
|
+
</svg>
|
Binary file
|
Binary file
|
package/package.json
CHANGED