import { useEffect, useRef, useState } from 'react' import GeoJSON from 'ol/format/GeoJSON' import 'ol/ol.css' import Map from 'ol/Map' import View from 'ol/View' import { Draw, Modify, Select, Snap, Translate } from 'ol/interaction' import { OSM, Vector as VectorSource, XYZ } from 'ol/source' import { Tile as TileLayer, Vector as VectorLayer } from 'ol/layer' import { Divider, IconButton, Slider, Stack, Select as MUISelect, MenuItem, Box } from '@mui/material' import { Adjust, Api, CircleOutlined, OpenWith, RectangleOutlined, Rule, Straighten, Timeline, Undo, Warning } from '@mui/icons-material' import { Type } from 'ol/geom/Geometry' import { click, noModifierKeys, shiftKeyOnly } from 'ol/events/condition' import Feature from 'ol/Feature' import { SatelliteMapsProvider } from '../../interfaces/map' import { containsExtent } from 'ol/extent' import { drawingLayerStyle, regionsLayerStyle, selectStyle } from './MapStyles' import { googleMapsSatelliteSource, regionsLayerSource, yandexMapsSatelliteSource } from './MapSources' import { mapCenter, mapExtent } from './MapConstants' const MapComponent = () => { const mapElement = useRef(null) const [currentTool, setCurrentTool] = useState(null) const map = useRef(null) const [satMapsProvider, setSatMapsProvider] = useState('yandex') const gMapsSatSource = useRef(googleMapsSatelliteSource) const yMapsSatSource = useRef(yandexMapsSatelliteSource) const satLayer = useRef(new TileLayer({ source: gMapsSatSource.current, })) const draw = useRef(null) const snap = useRef(null) const selectFeature = useRef