|
|
|
@ -1,22 +1,17 @@
|
|
|
|
import { Fragment, useState, useRef } from "react";
|
|
|
|
|
|
|
|
import { Dialog, Disclosure, Menu, Transition } from "@headlessui/react";
|
|
|
|
import { Dialog, Disclosure, Menu, Transition } from "@headlessui/react";
|
|
|
|
import { XMarkIcon } from "@heroicons/react/24/outline";
|
|
|
|
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
ChevronUpIcon,
|
|
|
|
|
|
|
|
ChevronDownIcon,
|
|
|
|
ChevronDownIcon,
|
|
|
|
FunnelIcon,
|
|
|
|
ChevronUpIcon
|
|
|
|
MinusIcon,
|
|
|
|
|
|
|
|
PlusIcon,
|
|
|
|
|
|
|
|
} from "@heroicons/react/20/solid";
|
|
|
|
} from "@heroicons/react/20/solid";
|
|
|
|
|
|
|
|
import { XMarkIcon } from "@heroicons/react/24/outline";
|
|
|
|
|
|
|
|
import { Fragment, useRef, useState } from "react";
|
|
|
|
|
|
|
|
|
|
|
|
import Map, { Layer, Source, Popup, ScaleControl } from "react-map-gl";
|
|
|
|
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
|
|
|
|
|
|
import Map, { Layer, Popup, ScaleControl, Source } from "react-map-gl/maplibre";
|
|
|
|
import mapstyle from "./points.json";
|
|
|
|
import mapstyle from "./points.json";
|
|
|
|
|
|
|
|
|
|
|
|
mapstyle.sources.remap.url = import.meta.env.MODE === "development" ? "http://localhost:8080/capabilities/remap.json" : mapstyle.sources.remap.url
|
|
|
|
mapstyle.sources.remap.url = import.meta.env.MODE === "development" ? "http://localhost:8080/capabilities/remap.json" : mapstyle.sources.remap.url
|
|
|
|
|
|
|
|
|
|
|
|
const MAPBOX_TOKEN =
|
|
|
|
|
|
|
|
"pk.eyJ1IjoiZ2hlcm1hbnQiLCJhIjoiY2wzbHR0YW1sMXB0YjNkcXd5NWpqaWpybiJ9.jyLcIcB7NLbtZzGYIJZWWg";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const paintedLayers = mapstyle.layers.reduce((acc, cur) => ({ ...acc, [cur.id]: cur }), {})
|
|
|
|
const paintedLayers = mapstyle.layers.reduce((acc, cur) => ({ ...acc, [cur.id]: cur }), {})
|
|
|
|
const pointsColors = mapstyle.layers.find(layer => layer.id == "Объекты").paint["circle-color"].slice(2, -1).reduce((acc, cur, i, source) => (i % 2 == 0 ? [...acc, { name: cur, color: source[i + 1] }] : acc), [])
|
|
|
|
const pointsColors = mapstyle.layers.find(layer => layer.id == "Объекты").paint["circle-color"].slice(2, -1).reduce((acc, cur, i, source) => (i % 2 == 0 ? [...acc, { name: cur, color: source[i + 1] }] : acc), [])
|
|
|
|
const pointsSizes = mapstyle.layers.find(layer => layer.id == "Объекты").paint["circle-radius"].slice(3).reduce((acc, cur, i, source) => (i % 2 == 0 ? [...acc, { value: cur, size: source[i + 1] }] : acc), [])
|
|
|
|
const pointsSizes = mapstyle.layers.find(layer => layer.id == "Объекты").paint["circle-radius"].slice(3).reduce((acc, cur, i, source) => (i % 2 == 0 ? [...acc, { value: cur, size: source[i + 1] }] : acc), [])
|
|
|
|
@ -1103,7 +1098,6 @@ export default function Points({ mapOptions, onMapOptionClick }) {
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
minZoom={mapstyle.minZoom}
|
|
|
|
minZoom={mapstyle.minZoom}
|
|
|
|
ref={mapRef}
|
|
|
|
ref={mapRef}
|
|
|
|
mapboxAccessToken={MAPBOX_TOKEN}
|
|
|
|
|
|
|
|
interactiveLayerIds={["Объекты"]}
|
|
|
|
interactiveLayerIds={["Объекты"]}
|
|
|
|
onClick={handleClick}
|
|
|
|
onClick={handleClick}
|
|
|
|
onMouseEnter={handleMouseEnter}
|
|
|
|
onMouseEnter={handleMouseEnter}
|
|
|
|
@ -1119,13 +1113,6 @@ export default function Points({ mapOptions, onMapOptionClick }) {
|
|
|
|
{popupInfo.region_name}
|
|
|
|
{popupInfo.region_name}
|
|
|
|
</Popup>}
|
|
|
|
</Popup>}
|
|
|
|
<ScaleControl />
|
|
|
|
<ScaleControl />
|
|
|
|
<Source
|
|
|
|
|
|
|
|
id="basemap"
|
|
|
|
|
|
|
|
tileSize={512}
|
|
|
|
|
|
|
|
{...mapstyle.sources.basemap}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<Layer {...paintedLayers["Подложка"]} />
|
|
|
|
|
|
|
|
</Source>
|
|
|
|
|
|
|
|
<Source
|
|
|
|
<Source
|
|
|
|
id="remap"
|
|
|
|
id="remap"
|
|
|
|
{...mapstyle.sources.remap}
|
|
|
|
{...mapstyle.sources.remap}
|
|
|
|
|