@corva/ui 3.70.0-5 → 3.70.0-6
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/cjs-bundle/components/BICOffsetPickerDialog/components/Map/Map.js +1 -1
- package/cjs-bundle/components/BICOffsetPickerDialog/components/Map/Map.js.map +1 -1
- package/cjs-bundle/components/OffsetWellMap/OffsetWellMap.js +1 -1
- package/cjs-bundle/components/OffsetWellMap/OffsetWellMap.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js.map +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/Map/OffsetWellMap/OffsetWellMap.js +1 -1
- package/cjs-bundle/components/OffsetWellPickerV5/components/MapPreloader/MapPreloader.js +1 -1
- package/cjs-bundle/components/PinnableFilters/effects/index.js +1 -1
- package/cjs-bundle/components/PinnableFilters/effects/index.js.map +1 -1
- package/cjs-bundle/config/mapbox/index.js +1 -1
- package/cjs-bundle/config/mapbox/index.js.map +1 -1
- package/components/BICOffsetPickerDialog/components/Map/Map.d.ts.map +1 -1
- package/components/BICOffsetPickerDialog/components/Map/Map.js +1 -1
- package/components/BICOffsetPickerDialog/components/Map/Map.js.map +1 -1
- package/components/OffsetWellMap/OffsetWellMap.d.ts.map +1 -1
- package/components/OffsetWellMap/OffsetWellMap.js +1 -1
- package/components/OffsetWellMap/OffsetWellMap.js.map +1 -1
- package/components/OffsetWellPickerV2/components/Map/Map.d.ts.map +1 -1
- package/components/OffsetWellPickerV2/components/Map/Map.js +1 -1
- package/components/OffsetWellPickerV2/components/Map/Map.js.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.d.ts.map +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js +1 -1
- package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js.map +1 -1
- package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/OffsetWellMap.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/components/Map/OffsetWellMap/OffsetWellMap.js +1 -1
- package/components/OffsetWellPickerV5/components/MapPreloader/MapPreloader.d.ts.map +1 -1
- package/components/OffsetWellPickerV5/components/MapPreloader/MapPreloader.js +1 -1
- package/components/PinnableFilters/effects/index.js +1 -1
- package/components/PinnableFilters/effects/index.js.map +1 -1
- package/config/mapbox/index.d.ts +1 -0
- package/config/mapbox/index.d.ts.map +1 -1
- package/config/mapbox/index.js +1 -1
- package/config/mapbox/index.js.map +1 -1
- package/mcp-server/server.mjs +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffsetWellMap.js","sources":["../../../src/components/OffsetWellMap/OffsetWellMap.js"],"sourcesContent":["import { createElement, useRef, useEffect, useState, useMemo } from 'react';\nimport ReactDOM from 'react-dom';\nimport { get } from 'lodash';\nimport classNames from 'classnames';\nimport { Tooltip } from '@material-ui/core';\nimport { Add as ZoomInIcon, Remove as ZoomOutIcon } from '@material-ui/icons';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nimport SubjectWellIcon from './CustomIcon/SubjectWellIcon.svg';\nimport SubjectHighlightWellIcon from './CustomIcon/SubjectHighlightWellIcon.svg';\nimport { usePreviousWells } from './effects';\nimport { WellTooltip } from './WellTooltip';\nimport { getAllFormations } from './utils';\n\nimport styles from './OffsetWellMap.module.css';\n\nimport mapboxgl from '~/config/mapboxGl';\nimport { mapbox } from '~/utils';\n\nconst { isValidCoordinates } = mapbox;\nconst DEFAULT_COORDS = [29.749907, -95.358421];\nconst WELL_MARKER_SIZE = 5;\nconst HIGHLIGHT_MARKER_SIZE = 12;\nconst OFFSET_WELL_COLOR = '#03BCD4';\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst HIGHLIGHT_WELL_COLOR = '#63EFFF';\nconst METERS_IN_MILE = 1609.34;\nconst ZOOM_INIT_VALUE = 3;\nconst ZOOM_MAX_VALUE = 18;\nconst ZOOM_MIN_VALUE = 1;\nconst MAX_RADIUS = 3000;\n\nconst RADIUS_SOURCE_ID = 'radius-circle';\nconst RADIUS_LAYER_ID = 'radius-circle-fill';\nconst WELLS_SOURCE_ID = 'wells';\nconst WELLS_HALO_LAYER_ID = 'wells-halo';\nconst WELLS_LAYER_ID = 'wells-circle';\nconst WELLS_ACTIVE_LAYER_ID = 'wells-active-highlight';\nconst WELLS_HOVER_LAYER_ID = 'wells-hover-highlight';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\nconst NO_HOVER_FILTER = ['==', ['id'], -1];\n\n// NOTE: Props keep the Leaflet [lat, lng] convention; mapbox-gl expects [lng, lat]\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl circle layers are pixel-radius, so approximate the meter radius with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const degreesLng = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const degreesLat = radiusMeters / 110574;\n const ring = [];\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * 2 * Math.PI;\n ring.push([lng + degreesLng * Math.cos(theta), lat + degreesLat * Math.sin(theta)]);\n }\n return { type: 'Polygon', coordinates: [ring] };\n};\n\nconst getCircleBounds = ([lat, lng], radiusMeters) => {\n const degreesLng = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const degreesLat = radiusMeters / 110574;\n return [\n [lng - degreesLng, lat - degreesLat],\n [lng + degreesLng, lat + degreesLat],\n ];\n};\n\n/** @type {React.FC<import('./OffsetWellMapProps').OffsetWellMapProps>} */\nconst OffsetWellMap = ({\n isViewOnly,\n subjectWell = null,\n wells,\n offsetWellIds,\n radius,\n handleChanageOffsetWell,\n handleChangeOffsetWell = handleChanageOffsetWell,\n activeWellId,\n isClickable = true,\n classes = {},\n}) => {\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, 'topHole.coordinates');\n }, [subjectWell]);\n const formationColors = useMemo(() => getAllFormations(wells), [wells]);\n\n const containerRef = useRef();\n const mapRef = useRef();\n const popupRef = useRef();\n const radiusBoundsRef = useRef(null);\n const wellsBoundsRef = useRef(null);\n const subjectIconRef = useRef();\n const wellByFeatureIdRef = useRef(new Map());\n const subjectFeatureIdRef = useRef(null);\n const hoveredFeatureIdRef = useRef(null);\n const [isSubjectWellHovered, setIsSubjectWellHovered] = useState(false);\n const isActiveWellIsSubjectWell = subjectWell?.id === activeWellId;\n const prevWells = usePreviousWells(wells);\n const [isMapReady, setIsMapReady] = useState(false);\n const [zoom, setZoom] = useState(ZOOM_INIT_VALUE);\n\n // NOTE: Initialize map\n useEffect(() => {\n const map = new mapboxgl.Map({\n container: containerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: ZOOM_INIT_VALUE,\n // NOTE: keep the zoom buttons' disable logic (zoom === ZOOM_MAX_VALUE) reachable\n maxZoom: ZOOM_MAX_VALUE,\n attributionControl: false,\n scrollZoom: false,\n doubleClickZoom: false,\n });\n mapRef.current = map;\n\n // NOTE: GL zoom is fractional where Leaflet was integer\n map.on('zoomend', () => setZoom(Math.round(map.getZoom())));\n\n // NOTE: Sources/layers can only be added after the style loads\n map.on('load', () => {\n map.addSource(RADIUS_SOURCE_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n map.addLayer({\n id: RADIUS_LAYER_ID,\n type: 'fill',\n source: RADIUS_SOURCE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n map.addSource(WELLS_SOURCE_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n map.addLayer({\n id: WELLS_HALO_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n filter: ['==', ['get', 'isOffsetWell'], true],\n paint: {\n 'circle-radius': HIGHLIGHT_MARKER_SIZE,\n 'circle-color': ['get', 'color'],\n 'circle-opacity': 0.08,\n },\n });\n map.addLayer({\n id: WELLS_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n layout: {\n 'circle-sort-key': ['get', 'order'],\n },\n paint: {\n 'circle-radius': WELL_MARKER_SIZE,\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n map.addLayer({\n id: WELLS_ACTIVE_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n filter: ['==', ['get', 'isActive'], true],\n paint: {\n 'circle-radius': HIGHLIGHT_MARKER_SIZE,\n 'circle-color': ['get', 'color'],\n 'circle-opacity': 0.24,\n },\n });\n map.addLayer({\n id: WELLS_HOVER_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n filter: NO_HOVER_FILTER,\n paint: {\n 'circle-radius': [\n 'case',\n ['get', 'isSubjectWell'],\n WELL_MARKER_SIZE,\n HIGHLIGHT_MARKER_SIZE,\n ],\n 'circle-color': [\n 'case',\n ['get', 'isSubjectWell'],\n HIGHLIGHT_WELL_COLOR,\n ['get', 'color'],\n ],\n 'circle-opacity': 0.24,\n },\n });\n\n setIsMapReady(true);\n });\n\n return () => {\n map.remove();\n mapRef.current = null;\n popupRef.current = null;\n subjectIconRef.current = null;\n radiusBoundsRef.current = null;\n wellsBoundsRef.current = null;\n };\n }, []);\n\n // NOTE: Radius circle\n useEffect(() => {\n radiusBoundsRef.current =\n subjectWellCoords && radius\n ? getCircleBounds(subjectWellCoords, radius * METERS_IN_MILE)\n : null;\n\n const map = mapRef.current;\n if (!map || !isMapReady) {\n return;\n }\n\n map.getSource(RADIUS_SOURCE_ID).setData(\n subjectWellCoords && radius\n ? {\n type: 'Feature',\n properties: {},\n geometry: makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE),\n }\n : EMPTY_FEATURE_COLLECTION\n );\n }, [radius, subjectWellCoords, isMapReady]);\n\n const showTooltip = (well, isOffsetWell, isSubjectWell, coords) => {\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(WellTooltip(), {\n isViewOnly,\n well,\n color: get(formationColors, well.formation, '#BDBDBD'),\n isOffsetWell,\n isSubjectWell,\n isClickable,\n });\n ReactDOM.render(<>{popUpContent}</>, popUpContainer);\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({\n closeButton: false,\n offset: HIGHLIGHT_MARKER_SIZE,\n });\n }\n popupRef.current\n .setLngLat(toLngLat(coords))\n .setDOMContent(popUpContainer)\n .addTo(mapRef.current);\n };\n\n // NOTE: Subject well hover swaps the subject marker color\n useEffect(() => {\n const map = mapRef.current;\n if (!map || !isMapReady) {\n return;\n }\n\n map.setPaintProperty(\n WELLS_LAYER_ID,\n 'circle-color',\n isSubjectWellHovered\n ? ['case', ['get', 'isSubjectWell'], HIGHLIGHT_WELL_COLOR, ['get', 'color']]\n : ['get', 'color']\n );\n }, [isSubjectWellHovered, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!wells || !offsetWellIds) {\n return undefined;\n }\n\n popupRef.current?.remove();\n\n const offsetWells = [];\n const unSelectedWells = [];\n wells.forEach(well => {\n if (well.id !== subjectWell?.id) {\n if (offsetWellIds.includes(well.id)) {\n offsetWells.push(well);\n } else {\n unSelectedWells.push(well);\n }\n }\n });\n const sortedWells = [...unSelectedWells, ...offsetWells, subjectWell];\n\n const features = [];\n const wellsBounds = new mapboxgl.LngLatBounds();\n wellByFeatureIdRef.current.clear();\n subjectFeatureIdRef.current = null;\n sortedWells.forEach((well, index) => {\n const coords = well?.topHole?.coordinates;\n\n if (coords && isValidCoordinates(coords)) {\n const isSubjectWell = subjectWell?.id === well.id;\n const isOffsetWell = offsetWellIds.includes(well.id) && !isSubjectWell;\n const color = isSubjectWell\n ? OFFSET_WELL_COLOR\n : get(formationColors, well.formation, '#BDBDBD');\n const opacity = isOffsetWell ? 0.7 : 0.3;\n\n features.push({\n type: 'Feature',\n id: index,\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n properties: {\n color,\n opacity: isSubjectWell ? 1 : opacity,\n isSubjectWell,\n isOffsetWell,\n isActive: well.id === activeWellId && !isActiveWellIsSubjectWell,\n order: index,\n },\n });\n wellByFeatureIdRef.current.set(index, { well, coords, isOffsetWell, isSubjectWell });\n if (isSubjectWell) {\n subjectFeatureIdRef.current = index;\n }\n wellsBounds.extend(toLngLat(coords));\n }\n });\n wellsBoundsRef.current = features.length ? wellsBounds : null;\n\n const map = mapRef.current;\n if (!map || !isMapReady) {\n return undefined;\n }\n\n map.getSource(WELLS_SOURCE_ID).setData({ type: 'FeatureCollection', features });\n map.setFilter(WELLS_HOVER_LAYER_ID, NO_HOVER_FILTER);\n hoveredFeatureIdRef.current = null;\n\n const handleMouseMove = e => {\n const feature = e.features?.[0];\n if (!feature || hoveredFeatureIdRef.current === feature.id) {\n return;\n }\n const entry = wellByFeatureIdRef.current.get(feature.id);\n if (!entry) {\n return;\n }\n\n hoveredFeatureIdRef.current = feature.id;\n map.getCanvas().style.cursor = 'pointer';\n\n // Highlight\n map.setFilter(WELLS_HOVER_LAYER_ID, ['==', ['id'], feature.id]);\n showTooltip(entry.well, entry.isOffsetWell, entry.isSubjectWell, entry.coords);\n if (entry.isSubjectWell) {\n setIsSubjectWellHovered(true);\n }\n };\n\n const handleMouseLeave = e => {\n // NOTE: Leaflet cleared hover on leaving the ENLARGED highlight marker, so keep the\n // hover while the cursor is still over the hover halo (or another well marker)\n if (\n e?.point &&\n map.queryRenderedFeatures(e.point, { layers: [WELLS_LAYER_ID, WELLS_HOVER_LAYER_ID] })\n .length\n ) {\n return;\n }\n const wasSubjectWell =\n hoveredFeatureIdRef.current !== null &&\n hoveredFeatureIdRef.current === subjectFeatureIdRef.current;\n hoveredFeatureIdRef.current = null;\n map.getCanvas().style.cursor = '';\n map.setFilter(WELLS_HOVER_LAYER_ID, NO_HOVER_FILTER);\n popupRef.current?.remove();\n if (wasSubjectWell) {\n setIsSubjectWellHovered(false);\n }\n };\n\n const handleClick = e => {\n if (isViewOnly) return;\n const entry = wellByFeatureIdRef.current.get(e.features?.[0]?.id);\n if (!entry) {\n return;\n }\n handleChangeOffsetWell(entry.well, !entry.isOffsetWell);\n };\n\n map.on('mousemove', WELLS_LAYER_ID, handleMouseMove);\n map.on('mouseleave', WELLS_LAYER_ID, handleMouseLeave);\n map.on('mouseleave', WELLS_HOVER_LAYER_ID, handleMouseLeave);\n map.on('click', WELLS_LAYER_ID, handleClick);\n\n setTimeout(() => {\n if (radius < MAX_RADIUS && mapRef.current && radiusBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_LAYER_ID, handleMouseMove);\n map.off('mouseleave', WELLS_LAYER_ID, handleMouseLeave);\n map.off('mouseleave', WELLS_HOVER_LAYER_ID, handleMouseLeave);\n map.off('click', WELLS_LAYER_ID, handleClick);\n };\n }, [subjectWell, wells, offsetWellIds, activeWellId, isMapReady]);\n\n // NOTE: Subject Well Icon\n\n useEffect(() => {\n const map = mapRef.current;\n\n if (subjectIconRef.current) {\n subjectIconRef.current.remove();\n subjectIconRef.current = null;\n }\n\n if (!map || !subjectWellCoords) return;\n\n const isHighlighted = isSubjectWellHovered || isActiveWellIsSubjectWell;\n const icon = document.createElement('img');\n icon.src = isHighlighted ? SubjectHighlightWellIcon : SubjectWellIcon;\n const [iconWidth, iconHeight] = isHighlighted ? [70, 20] : [62, 12];\n const [anchorX, anchorY] = isHighlighted ? [35, 29] : [31, 25];\n icon.width = iconWidth;\n icon.height = iconHeight;\n\n icon.addEventListener('mouseover', () => {\n setIsSubjectWellHovered(true);\n\n // Highlight\n if (subjectFeatureIdRef.current !== null && map.getLayer(WELLS_HOVER_LAYER_ID)) {\n hoveredFeatureIdRef.current = subjectFeatureIdRef.current;\n map.setFilter(WELLS_HOVER_LAYER_ID, ['==', ['id'], subjectFeatureIdRef.current]);\n }\n showTooltip(subjectWell, false, true, subjectWellCoords);\n });\n\n icon.addEventListener('mouseout', () => {\n hoveredFeatureIdRef.current = null;\n if (map.getLayer(WELLS_HOVER_LAYER_ID)) {\n map.setFilter(WELLS_HOVER_LAYER_ID, NO_HOVER_FILTER);\n }\n popupRef.current?.remove();\n setIsSubjectWellHovered(false);\n });\n\n subjectIconRef.current = new mapboxgl.Marker({\n element: icon,\n anchor: 'center',\n // NOTE: Leaflet anchored the icon at [anchorX, anchorY] from its top-left corner\n offset: [iconWidth / 2 - anchorX, iconHeight / 2 - anchorY],\n })\n .setLngLat(toLngLat(subjectWellCoords))\n .addTo(map);\n }, [isSubjectWellHovered, subjectWellCoords, radius, subjectWell, isActiveWellIsSubjectWell]);\n\n // NOTE: Map Update\n useEffect(() => {\n if (radius > MAX_RADIUS) {\n mapRef.current.setZoom(1);\n return;\n }\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusBoundsRef.current && radius) {\n mapRef.current.fitBounds(radiusBoundsRef.current, { padding: 5 });\n }\n } else if (mapRef.current && wellsBoundsRef.current) {\n mapRef.current.fitBounds(wellsBoundsRef.current);\n }\n if (subjectWellCoords && mapRef.current) {\n mapRef.current.easeTo({ center: toLngLat(subjectWellCoords), duration: 700 });\n }\n }, 500);\n }, [radius, subjectWell, subjectWellCoords]);\n\n const handleZoomIn = () => {\n mapRef.current.setZoom(zoom + 1);\n };\n\n const handleZoomOut = () => {\n if (zoom > 1) {\n mapRef.current.setZoom(zoom - 1);\n }\n };\n\n return (\n <div className={classNames(styles.mapView, classes.root)}>\n <div\n className={classNames(styles.mapMain, classes.map)}\n ref={containerRef}\n onDoubleClick={handleZoomIn}\n >\n <div className={styles.zoomGroup}>\n <Tooltip title={zoom < ZOOM_MAX_VALUE ? 'Zoom in' : ''} placement=\"left\">\n <div\n className={classNames(styles.zoomButton, {\n [styles.zoomDisabled]: zoom === ZOOM_MAX_VALUE,\n })}\n onClick={handleZoomIn}\n >\n <ZoomInIcon className={styles.zoomInOutIcon} />\n </div>\n </Tooltip>\n <Tooltip title={zoom > ZOOM_MIN_VALUE ? 'Zoom out' : ''} placement=\"left\">\n <div\n className={classNames(styles.zoomButton, {\n [styles.zoomDisabled]: zoom === ZOOM_MIN_VALUE,\n })}\n onClick={handleZoomOut}\n >\n <ZoomOutIcon className={styles.zoomInOutIcon} />\n </div>\n </Tooltip>\n </div>\n </div>\n </div>\n );\n};\n\nexport default OffsetWellMap;\n"],"names":["isValidCoordinates","mapbox","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","NO_HOVER_FILTER","toLngLat","_ref","_ref2","_slicedToArray","lat","makeCirclePolygon","_ref3","radiusMeters","_ref4","lng","points","degreesLng","Math","cos","PI","degreesLat","ring","i","theta","push","sin","coordinates","OffsetWellMap","_ref7","isViewOnly","_ref7$subjectWell","subjectWell","wells","offsetWellIds","radius","handleChanageOffsetWell","_ref7$handleChangeOff","handleChangeOffsetWell","activeWellId","_ref7$isClickable","isClickable","_ref7$classes","classes","subjectWellCoords","useMemo","get","formationColors","getAllFormations","containerRef","useRef","mapRef","popupRef","radiusBoundsRef","wellsBoundsRef","subjectIconRef","wellByFeatureIdRef","Map","subjectFeatureIdRef","hoveredFeatureIdRef","useState","_useState2","_useState","isSubjectWellHovered","setIsSubjectWellHovered","isActiveWellIsSubjectWell","id","prevWells","usePreviousWells","_useState4","_useState3","isMapReady","setIsMapReady","_useState6","_useState5","zoom","setZoom","useEffect","map","mapboxgl","container","current","style","center","maxZoom","attributionControl","scrollZoom","doubleClickZoom","on","round","getZoom","addSource","data","addLayer","source","paint","filter","layout","remove","_ref6","getSource","setData","properties","geometry","showTooltip","well","isOffsetWell","isSubjectWell","coords","popUpContainer","document","createElement","popUpContent","WellTooltip","color","formation","ReactDOM","render","_jsx","_Fragment","children","Popup","closeButton","offset","setLngLat","setDOMContent","addTo","setPaintProperty","_popupRef$current","offsetWells","unSelectedWells","forEach","includes","sortedWells","wellsBounds","LngLatBounds","clear","index","_well$topHole","topHole","opacity","isActive","order","set","extend","length","setFilter","handleMouseMove","e","_e$features","feature","entry","getCanvas","cursor","handleMouseLeave","_popupRef$current2","point","queryRenderedFeatures","layers","wasSubjectWell","handleClick","_e$features2","_e$features2$","setTimeout","fitBounds","padding","off","isHighlighted","icon","src","_ref9","iconWidth","iconHeight","_ref11","anchorX","anchorY","width","height","addEventListener","getLayer","_popupRef$current3","Marker","element","anchor","easeTo","duration","handleZoomIn","className","classNames","styles","mapView","root","mapMain","ref","onDoubleClick","_jsxs","zoomGroup","Tooltip","title","placement","zoomButton","_defineProperty","zoomDisabled","onClick","ZoomInIcon","zoomInOutIcon","ZoomOutIcon"],"mappings":"oxBAMsC,IAa9BA,EAAuBC,EAAvBD,mBACFE,EAAiB,CAAC,WAAY,WAmB9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAClEC,EAAkB,CAAC,KAAM,CAAC,OAAQ,GAGlCC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,EAAI,EAGrCC,EAAoB,SAAHC,EAAgBC,GAIrC,IAJmE,IAAAC,EAAAL,EAAAG,EAAA,GAAzCF,EAAGI,EAAA,GAAEC,EAAGD,EAAA,GAAiBE,yDAAS,GACtDC,EAAaJ,GAAgB,OAASK,KAAKC,IAAKT,EAAMQ,KAAKE,GAAM,MACjEC,EAAaR,EAAe,OAC5BS,EAAO,GACJC,EAAI,EAAGA,GAAKP,EAAQO,GAAK,EAAG,CACnC,IAAMC,EAASD,EAAIP,EAAU,EAAIE,KAAKE,GACtCE,EAAKG,KAAK,CAACV,EAAME,EAAaC,KAAKC,IAAIK,GAAQd,EAAMW,EAAaH,KAAKQ,IAAIF,IAC7E,CACA,MAAO,CAAErB,KAAM,UAA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IAAM8I,GAAe,WACnBvI,EAAO8B,QAAQL,QAAQD,GAAO,IAShC,OACE2C,EAAA,MAAA,CAAKqE,UAAWC,EAAWC,EAAOC,QAASnJ,EAAQoJ,MAAMvE,SACvDF,EAAA,MAAA,CACEqE,UAAWC,EAAWC,EAAOG,QAASrJ,EAAQmC,KAC9CmH,IAAKhJ,EACLiJ,cAAeR,GAAalE,SAE5B2E,EAAA,MAAA,CAAKR,UAAWE,EAAOO,UAAU5E,SAAA,CAC/BF,EAAC+E,EAAO,CAACC,MAAO3H,GA7cH,GA6c2B,UAAY,GAAI4H,UAAU,OAAM/E,SACtEF,EAAA,MAAA,CACEqE,UAAWC,EAAWC,EAAOW,WAAUC,EAAA,GACpCZ,EAAOa,aAhdD,KAgdgB/H,KAEzBgI,QAASjB,GAAalE,SAEtBF,EAACsF,EAAU,CAACjB,UAAWE,EAAOgB,oBAGlCvF,EAAC+E,EAAO,CAACC,MAAO3H,GAtdH,EAsd2B,WAAa,GAAI4H,UAAU,OAAM/E,SACvEF,EAAA,MAAA,CACEqE,UAAWC,EAAWC,EAAOW,WAAUC,EAAA,GACpCZ,EAAOa,aAzdD,IAydgB/H,KAEzBgI,QA7BU,WAChBhI,GAAO,GACTxB,EAAO8B,QAAQL,QAAQD,GAAO,IA2BC6C,SAEvBF,EAACwF,EAAW,CAACnB,UAAWE,EAAOgB,0BAO7C"}
|
|
1
|
+
{"version":3,"file":"OffsetWellMap.js","sources":["../../../src/components/OffsetWellMap/OffsetWellMap.js"],"sourcesContent":["import { createElement, useRef, useEffect, useState, useMemo } from 'react';\nimport ReactDOM from 'react-dom';\nimport { get } from 'lodash';\nimport classNames from 'classnames';\nimport { Tooltip } from '@material-ui/core';\nimport { Add as ZoomInIcon, Remove as ZoomOutIcon } from '@material-ui/icons';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nimport SubjectWellIcon from './CustomIcon/SubjectWellIcon.svg';\nimport SubjectHighlightWellIcon from './CustomIcon/SubjectHighlightWellIcon.svg';\nimport { usePreviousWells } from './effects';\nimport { WellTooltip } from './WellTooltip';\nimport { getAllFormations } from './utils';\n\nimport styles from './OffsetWellMap.module.css';\n\nimport mapboxgl from '~/config/mapboxGl';\nimport { IS_MAPBOX_ENABLED } from '~/config/mapbox';\nimport { mapbox } from '~/utils';\n\nconst { isValidCoordinates } = mapbox;\nconst DEFAULT_COORDS = [29.749907, -95.358421];\nconst WELL_MARKER_SIZE = 5;\nconst HIGHLIGHT_MARKER_SIZE = 12;\nconst OFFSET_WELL_COLOR = '#03BCD4';\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst HIGHLIGHT_WELL_COLOR = '#63EFFF';\nconst METERS_IN_MILE = 1609.34;\nconst ZOOM_INIT_VALUE = 3;\nconst ZOOM_MAX_VALUE = 18;\nconst ZOOM_MIN_VALUE = 1;\nconst MAX_RADIUS = 3000;\n\nconst RADIUS_SOURCE_ID = 'radius-circle';\nconst RADIUS_LAYER_ID = 'radius-circle-fill';\nconst WELLS_SOURCE_ID = 'wells';\nconst WELLS_HALO_LAYER_ID = 'wells-halo';\nconst WELLS_LAYER_ID = 'wells-circle';\nconst WELLS_ACTIVE_LAYER_ID = 'wells-active-highlight';\nconst WELLS_HOVER_LAYER_ID = 'wells-hover-highlight';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\nconst NO_HOVER_FILTER = ['==', ['id'], -1];\n\n// NOTE: Props keep the Leaflet [lat, lng] convention; mapbox-gl expects [lng, lat]\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl circle layers are pixel-radius, so approximate the meter radius with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const degreesLng = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const degreesLat = radiusMeters / 110574;\n const ring = [];\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * 2 * Math.PI;\n ring.push([lng + degreesLng * Math.cos(theta), lat + degreesLat * Math.sin(theta)]);\n }\n return { type: 'Polygon', coordinates: [ring] };\n};\n\nconst getCircleBounds = ([lat, lng], radiusMeters) => {\n const degreesLng = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const degreesLat = radiusMeters / 110574;\n return [\n [lng - degreesLng, lat - degreesLat],\n [lng + degreesLng, lat + degreesLat],\n ];\n};\n\n/** @type {React.FC<import('./OffsetWellMapProps').OffsetWellMapProps>} */\nconst OffsetWellMap = ({\n isViewOnly,\n subjectWell = null,\n wells,\n offsetWellIds,\n radius,\n handleChanageOffsetWell,\n handleChangeOffsetWell = handleChanageOffsetWell,\n activeWellId,\n isClickable = true,\n classes = {},\n}) => {\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, 'topHole.coordinates');\n }, [subjectWell]);\n const formationColors = useMemo(() => getAllFormations(wells), [wells]);\n\n const containerRef = useRef();\n const mapRef = useRef();\n const popupRef = useRef();\n const radiusBoundsRef = useRef(null);\n const wellsBoundsRef = useRef(null);\n const subjectIconRef = useRef();\n const wellByFeatureIdRef = useRef(new Map());\n const subjectFeatureIdRef = useRef(null);\n const hoveredFeatureIdRef = useRef(null);\n const [isSubjectWellHovered, setIsSubjectWellHovered] = useState(false);\n const isActiveWellIsSubjectWell = subjectWell?.id === activeWellId;\n const prevWells = usePreviousWells(wells);\n const [isMapReady, setIsMapReady] = useState(false);\n const [zoom, setZoom] = useState(ZOOM_INIT_VALUE);\n\n // NOTE: Initialize map\n useEffect(() => {\n if (!IS_MAPBOX_ENABLED) return undefined;\n\n const map = new mapboxgl.Map({\n container: containerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: ZOOM_INIT_VALUE,\n // NOTE: keep the zoom buttons' disable logic (zoom === ZOOM_MAX_VALUE) reachable\n maxZoom: ZOOM_MAX_VALUE,\n attributionControl: false,\n scrollZoom: false,\n doubleClickZoom: false,\n });\n mapRef.current = map;\n\n // NOTE: GL zoom is fractional where Leaflet was integer\n map.on('zoomend', () => setZoom(Math.round(map.getZoom())));\n\n // NOTE: Sources/layers can only be added after the style loads\n map.on('load', () => {\n map.addSource(RADIUS_SOURCE_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n map.addLayer({\n id: RADIUS_LAYER_ID,\n type: 'fill',\n source: RADIUS_SOURCE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n map.addSource(WELLS_SOURCE_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n map.addLayer({\n id: WELLS_HALO_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n filter: ['==', ['get', 'isOffsetWell'], true],\n paint: {\n 'circle-radius': HIGHLIGHT_MARKER_SIZE,\n 'circle-color': ['get', 'color'],\n 'circle-opacity': 0.08,\n },\n });\n map.addLayer({\n id: WELLS_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n layout: {\n 'circle-sort-key': ['get', 'order'],\n },\n paint: {\n 'circle-radius': WELL_MARKER_SIZE,\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n map.addLayer({\n id: WELLS_ACTIVE_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n filter: ['==', ['get', 'isActive'], true],\n paint: {\n 'circle-radius': HIGHLIGHT_MARKER_SIZE,\n 'circle-color': ['get', 'color'],\n 'circle-opacity': 0.24,\n },\n });\n map.addLayer({\n id: WELLS_HOVER_LAYER_ID,\n type: 'circle',\n source: WELLS_SOURCE_ID,\n filter: NO_HOVER_FILTER,\n paint: {\n 'circle-radius': [\n 'case',\n ['get', 'isSubjectWell'],\n WELL_MARKER_SIZE,\n HIGHLIGHT_MARKER_SIZE,\n ],\n 'circle-color': [\n 'case',\n ['get', 'isSubjectWell'],\n HIGHLIGHT_WELL_COLOR,\n ['get', 'color'],\n ],\n 'circle-opacity': 0.24,\n },\n });\n\n setIsMapReady(true);\n });\n\n return () => {\n map.remove();\n mapRef.current = null;\n popupRef.current = null;\n subjectIconRef.current = null;\n radiusBoundsRef.current = null;\n wellsBoundsRef.current = null;\n };\n }, []);\n\n // NOTE: Radius circle\n useEffect(() => {\n radiusBoundsRef.current =\n subjectWellCoords && radius\n ? getCircleBounds(subjectWellCoords, radius * METERS_IN_MILE)\n : null;\n\n const map = mapRef.current;\n if (!map || !isMapReady) {\n return;\n }\n\n map.getSource(RADIUS_SOURCE_ID).setData(\n subjectWellCoords && radius\n ? {\n type: 'Feature',\n properties: {},\n geometry: makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE),\n }\n : EMPTY_FEATURE_COLLECTION\n );\n }, [radius, subjectWellCoords, isMapReady]);\n\n const showTooltip = (well, isOffsetWell, isSubjectWell, coords) => {\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(WellTooltip(), {\n isViewOnly,\n well,\n color: get(formationColors, well.formation, '#BDBDBD'),\n isOffsetWell,\n isSubjectWell,\n isClickable,\n });\n ReactDOM.render(<>{popUpContent}</>, popUpContainer);\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({\n closeButton: false,\n offset: HIGHLIGHT_MARKER_SIZE,\n });\n }\n popupRef.current\n .setLngLat(toLngLat(coords))\n .setDOMContent(popUpContainer)\n .addTo(mapRef.current);\n };\n\n // NOTE: Subject well hover swaps the subject marker color\n useEffect(() => {\n const map = mapRef.current;\n if (!map || !isMapReady) {\n return;\n }\n\n map.setPaintProperty(\n WELLS_LAYER_ID,\n 'circle-color',\n isSubjectWellHovered\n ? ['case', ['get', 'isSubjectWell'], HIGHLIGHT_WELL_COLOR, ['get', 'color']]\n : ['get', 'color']\n );\n }, [isSubjectWellHovered, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!wells || !offsetWellIds) {\n return undefined;\n }\n\n popupRef.current?.remove();\n\n const offsetWells = [];\n const unSelectedWells = [];\n wells.forEach(well => {\n if (well.id !== subjectWell?.id) {\n if (offsetWellIds.includes(well.id)) {\n offsetWells.push(well);\n } else {\n unSelectedWells.push(well);\n }\n }\n });\n const sortedWells = [...unSelectedWells, ...offsetWells, subjectWell];\n\n const features = [];\n const wellsBounds = new mapboxgl.LngLatBounds();\n wellByFeatureIdRef.current.clear();\n subjectFeatureIdRef.current = null;\n sortedWells.forEach((well, index) => {\n const coords = well?.topHole?.coordinates;\n\n if (coords && isValidCoordinates(coords)) {\n const isSubjectWell = subjectWell?.id === well.id;\n const isOffsetWell = offsetWellIds.includes(well.id) && !isSubjectWell;\n const color = isSubjectWell\n ? OFFSET_WELL_COLOR\n : get(formationColors, well.formation, '#BDBDBD');\n const opacity = isOffsetWell ? 0.7 : 0.3;\n\n features.push({\n type: 'Feature',\n id: index,\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n properties: {\n color,\n opacity: isSubjectWell ? 1 : opacity,\n isSubjectWell,\n isOffsetWell,\n isActive: well.id === activeWellId && !isActiveWellIsSubjectWell,\n order: index,\n },\n });\n wellByFeatureIdRef.current.set(index, { well, coords, isOffsetWell, isSubjectWell });\n if (isSubjectWell) {\n subjectFeatureIdRef.current = index;\n }\n wellsBounds.extend(toLngLat(coords));\n }\n });\n wellsBoundsRef.current = features.length ? wellsBounds : null;\n\n const map = mapRef.current;\n if (!map || !isMapReady) {\n return undefined;\n }\n\n map.getSource(WELLS_SOURCE_ID).setData({ type: 'FeatureCollection', features });\n map.setFilter(WELLS_HOVER_LAYER_ID, NO_HOVER_FILTER);\n hoveredFeatureIdRef.current = null;\n\n const handleMouseMove = e => {\n const feature = e.features?.[0];\n if (!feature || hoveredFeatureIdRef.current === feature.id) {\n return;\n }\n const entry = wellByFeatureIdRef.current.get(feature.id);\n if (!entry) {\n return;\n }\n\n hoveredFeatureIdRef.current = feature.id;\n map.getCanvas().style.cursor = 'pointer';\n\n // Highlight\n map.setFilter(WELLS_HOVER_LAYER_ID, ['==', ['id'], feature.id]);\n showTooltip(entry.well, entry.isOffsetWell, entry.isSubjectWell, entry.coords);\n if (entry.isSubjectWell) {\n setIsSubjectWellHovered(true);\n }\n };\n\n const handleMouseLeave = e => {\n // NOTE: Leaflet cleared hover on leaving the ENLARGED highlight marker, so keep the\n // hover while the cursor is still over the hover halo (or another well marker)\n if (\n e?.point &&\n map.queryRenderedFeatures(e.point, { layers: [WELLS_LAYER_ID, WELLS_HOVER_LAYER_ID] })\n .length\n ) {\n return;\n }\n const wasSubjectWell =\n hoveredFeatureIdRef.current !== null &&\n hoveredFeatureIdRef.current === subjectFeatureIdRef.current;\n hoveredFeatureIdRef.current = null;\n map.getCanvas().style.cursor = '';\n map.setFilter(WELLS_HOVER_LAYER_ID, NO_HOVER_FILTER);\n popupRef.current?.remove();\n if (wasSubjectWell) {\n setIsSubjectWellHovered(false);\n }\n };\n\n const handleClick = e => {\n if (isViewOnly) return;\n const entry = wellByFeatureIdRef.current.get(e.features?.[0]?.id);\n if (!entry) {\n return;\n }\n handleChangeOffsetWell(entry.well, !entry.isOffsetWell);\n };\n\n map.on('mousemove', WELLS_LAYER_ID, handleMouseMove);\n map.on('mouseleave', WELLS_LAYER_ID, handleMouseLeave);\n map.on('mouseleave', WELLS_HOVER_LAYER_ID, handleMouseLeave);\n map.on('click', WELLS_LAYER_ID, handleClick);\n\n setTimeout(() => {\n if (radius < MAX_RADIUS && mapRef.current && radiusBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_LAYER_ID, handleMouseMove);\n map.off('mouseleave', WELLS_LAYER_ID, handleMouseLeave);\n map.off('mouseleave', WELLS_HOVER_LAYER_ID, handleMouseLeave);\n map.off('click', WELLS_LAYER_ID, handleClick);\n };\n }, [subjectWell, wells, offsetWellIds, activeWellId, isMapReady]);\n\n // NOTE: Subject Well Icon\n\n useEffect(() => {\n const map = mapRef.current;\n\n if (subjectIconRef.current) {\n subjectIconRef.current.remove();\n subjectIconRef.current = null;\n }\n\n if (!map || !subjectWellCoords) return;\n\n const isHighlighted = isSubjectWellHovered || isActiveWellIsSubjectWell;\n const icon = document.createElement('img');\n icon.src = isHighlighted ? SubjectHighlightWellIcon : SubjectWellIcon;\n const [iconWidth, iconHeight] = isHighlighted ? [70, 20] : [62, 12];\n const [anchorX, anchorY] = isHighlighted ? [35, 29] : [31, 25];\n icon.width = iconWidth;\n icon.height = iconHeight;\n\n icon.addEventListener('mouseover', () => {\n setIsSubjectWellHovered(true);\n\n // Highlight\n if (subjectFeatureIdRef.current !== null && map.getLayer(WELLS_HOVER_LAYER_ID)) {\n hoveredFeatureIdRef.current = subjectFeatureIdRef.current;\n map.setFilter(WELLS_HOVER_LAYER_ID, ['==', ['id'], subjectFeatureIdRef.current]);\n }\n showTooltip(subjectWell, false, true, subjectWellCoords);\n });\n\n icon.addEventListener('mouseout', () => {\n hoveredFeatureIdRef.current = null;\n if (map.getLayer(WELLS_HOVER_LAYER_ID)) {\n map.setFilter(WELLS_HOVER_LAYER_ID, NO_HOVER_FILTER);\n }\n popupRef.current?.remove();\n setIsSubjectWellHovered(false);\n });\n\n subjectIconRef.current = new mapboxgl.Marker({\n element: icon,\n anchor: 'center',\n // NOTE: Leaflet anchored the icon at [anchorX, anchorY] from its top-left corner\n offset: [iconWidth / 2 - anchorX, iconHeight / 2 - anchorY],\n })\n .setLngLat(toLngLat(subjectWellCoords))\n .addTo(map);\n }, [isSubjectWellHovered, subjectWellCoords, radius, subjectWell, isActiveWellIsSubjectWell]);\n\n // NOTE: Map Update\n useEffect(() => {\n if (radius > MAX_RADIUS) {\n mapRef.current?.setZoom(1);\n return;\n }\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusBoundsRef.current && radius) {\n mapRef.current.fitBounds(radiusBoundsRef.current, { padding: 5 });\n }\n } else if (mapRef.current && wellsBoundsRef.current) {\n mapRef.current.fitBounds(wellsBoundsRef.current);\n }\n if (subjectWellCoords && mapRef.current) {\n mapRef.current.easeTo({ center: toLngLat(subjectWellCoords), duration: 700 });\n }\n }, 500);\n }, [radius, subjectWell, subjectWellCoords]);\n\n const handleZoomIn = () => {\n mapRef.current?.setZoom(zoom + 1);\n };\n\n const handleZoomOut = () => {\n if (zoom > 1) {\n mapRef.current?.setZoom(zoom - 1);\n }\n };\n\n return (\n <div className={classNames(styles.mapView, classes.root)}>\n <div\n className={classNames(styles.mapMain, classes.map)}\n ref={containerRef}\n onDoubleClick={handleZoomIn}\n >\n <div className={styles.zoomGroup}>\n <Tooltip title={zoom < ZOOM_MAX_VALUE ? 'Zoom in' : ''} placement=\"left\">\n <div\n className={classNames(styles.zoomButton, {\n [styles.zoomDisabled]: zoom === ZOOM_MAX_VALUE,\n })}\n onClick={handleZoomIn}\n >\n <ZoomInIcon className={styles.zoomInOutIcon} />\n </div>\n </Tooltip>\n <Tooltip title={zoom > ZOOM_MIN_VALUE ? 'Zoom out' : ''} placement=\"left\">\n <div\n className={classNames(styles.zoomButton, {\n [styles.zoomDisabled]: zoom === ZOOM_MIN_VALUE,\n })}\n onClick={handleZoomOut}\n >\n <ZoomOutIcon className={styles.zoomInOutIcon} />\n </div>\n </Tooltip>\n </div>\n </div>\n </div>\n );\n};\n\nexport default OffsetWellMap;\n"],"names":["isValidCoordinates","mapbox","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","NO_HOVER_FILTER","toLngLat","_ref","_ref2","_slicedToArray","lat","makeCirclePolygon","_ref3","radiusMeters","_ref4","lng","points","degreesLng","Math","cos","PI","degreesLat","ring","i","theta","push","sin","coordinates","OffsetWellMap","_ref7","isViewOnly","_ref7$subjectWell","subjectWell","wells","offsetWellIds","radius","handleChanageOffsetWell","_ref7$handleChangeOff","handleChangeOffsetWell","activeWellId","_ref7$isClickable","isClickable","_ref7$classes","classes","subjectWellCoords","useMemo","get","formationColors","getAllFormations","containerRef","useRef","mapRef","popupRef","radiusBoundsRef","wellsBoundsRef","subjectIconRef","wellByFeatureIdRef","Map","subjectFeatureIdRef","hoveredFeatureIdRef","useState","_useState2","_useState","isSubjectWellHovered","setIsSubjectWellHovered","isActiveWellIsSubjectWell","id","prevWells","usePreviousWells","_useState4","_useState3","isMapReady","setIsMapReady","_useState6","_useState5","zoom","setZoom","useEffect","IS_MAPBOX_ENABLED","map","mapboxgl","container","current","style","center","maxZoom","attributionControl","scrollZoom","doubleClickZoom","on","round","getZoom","addSource","data","addLayer","source","paint","filter","layout","remove","_ref6","getSource","setData","properties","geometry","showTooltip","well","isOffsetWell","isSubjectWell","coords","popUpContainer","document","createElement","popUpContent","WellTooltip","color","formation","ReactDOM","render","_jsx","_Fragment","children","Popup","closeButton","offset","setLngLat","setDOMContent","addTo","setPaintProperty","_popupRef$current","offsetWells","unSelectedWells","forEach","includes","sortedWells","wellsBounds","LngLatBounds","clear","index","_well$topHole","topHole","opacity","isActive","order","set","extend","length","setFilter","handleMouseMove","e","_e$features","feature","entry","getCanvas","cursor","handleMouseLeave","_popupRef$current2","point","queryRenderedFeatures","layers","wasSubjectWell","handleClick","_e$features2","_e$features2$","setTimeout","fitBounds","padding","off","isHighlighted","icon","src","_ref9","iconWidth","iconHeight","_ref11","anchorX","anchorY","width","height","addEventListener","getLayer","_popupRef$current3","Marker","element","anchor","_mapRef$current","easeTo","duration","handleZoomIn","_mapRef$current2","className","classNames","styles","mapView","root","mapMain","ref","onDoubleClick","_jsxs","zoomGroup","Tooltip","title","placement","zoomButton","_defineProperty","zoomDisabled","onClick","ZoomInIcon","zoomInOutIcon","_mapRef$current3","ZoomOutIcon"],"mappings":"q1BAMsC,IAc9BA,EAAuBC,EAAvBD,mBACFE,EAAiB,CAAC,WAAY,WAmB9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAClEC,EAAkB,CAAC,KAAM,CAAC,OAAQ,GAGlCC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,EAAI,EAGrCC,EAAoB,SAAHC,EAAgBC,GAIrC,IAJmE,I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,GACpCZ,EAAOa,aA3dD,IA2dgBlI,KAEzBmI,QA7BU,WACN,IAAAG,EAAVtI,GAAO,IACT,QAAAxB,EAAAA,EAAO+B,eAAP,IAAA+H,GAAAA,EAAgBrI,QAAQD,GAAO,KA2BA8C,SAEvBF,EAAC2F,EAAW,CAACpB,UAAWE,EAAOgB,0BAO7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.d.ts","sourceRoot":"","sources":["../../../../../src/components/OffsetWellPickerV2/components/Map/Map.js"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Map.d.ts","sourceRoot":"","sources":["../../../../../src/components/OffsetWellPickerV2/components/Map/Map.js"],"names":[],"mappings":";;AAwDA;;;;;;;;;gBAuRC;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA7UqB,YAAY;AAgBlC,gDAAyC,EAAE,CAAC;AAC5C,wCAAiC,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/slicedToArray";import{memo as t,useRef as o,useState as n,useMemo as i,useEffect as a,createElement as l}from"react";import s from"react-dom";import
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/slicedToArray";import{memo as t,useRef as o,useState as n,useMemo as i,useEffect as a,createElement as l}from"react";import s from"react-dom";import c from"prop-types";import{get as u,sortBy as m}from"lodash";import{MuiThemeProvider as p}from"@material-ui/core/styles";import d from"./Map.css.js";import{mapbox as f}from"../../../../utils/index.js";import{darkTheme as h}from"../../../../config/theme/index.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/helpers/typeof";import"@babel/runtime/regenerator";import"highcharts";import"highcharts/highcharts-more";import"highcharts/modules/solid-gauge";import"highcharts/modules/heatmap";import"highcharts/modules/boost";import"highcharts/modules/exporting";import"highcharts/modules/xrange";import"highcharts/modules/dumbbell";import"highcharts/modules/pattern-fill";import"highcharts/modules/annotations";import"highcharts-multicolor-series";import"dompurify";import{IS_MAPBOX_ENABLED as b}from"../../../../config/mapbox/index.js";import"@babel/runtime/helpers/createClass";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/assertThisInitialized";import"@babel/runtime/helpers/inherits";import"@babel/runtime/helpers/possibleConstructorReturn";import"@babel/runtime/helpers/getPrototypeOf";import"@babel/runtime/helpers/toArray";import"@babel/runtime/helpers/toConsumableArray";import"../../../../clients/subscriptions/constants.js";import"../../../../clients/subscriptions.v1.js";import"../../../../clients/subscriptions/subscriptions-client.factory.js";import"../../../../config/extendNative.js";import"../../../../config/mapboxGl/index.js";import"mapbox-gl/dist/mapbox-gl.css";import{jsxs as g,jsx as y}from"react/jsx-runtime";import v from"mapbox-gl";function F(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function j(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?F(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):F(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var w=f.isValidCoordinates,O=["#FF00FF","#F5BD80","#FF0000","#0080FF","#FF8000","#58ACFA","#FA58F4","#40FF00","#4B8A08","#40FF00","#D8F781"],x=[29.749907,-95.358421],C={type:"FeatureCollection",features:[]},P=function(e){var t=r(e,2),o=t[0];return[t[1],o]};function S(t){var c=t.subjectWell,f=t.wells,F=t.offsetWells,S=t.radius,M=t.subjectWellMarkerSize,D=t.wellMarkerSize,N=t.popUpFormatter,k=t.coordsDataPath,I=o(null),W=o(null),L=o(null),B=o(null),z=o(null),A=o(),T=n(!1),E=r(T,2),q=E[0],R=E[1],U=i((function(){return f.filter((function(e){return!c||c.id!==e.id}))}),[c,f]),G=i((function(){return c&&u(c,k)}),[c,k]),V=i((function(){var r=[],t=!1;U.forEach((function(e){"Null"===e.formation?t=!0:c&&c.formation===e.formation||r.includes(e.formation)||r.push(e.formation)}));var o=c?[c.formation].concat(m(r)):m(r);t&&!o.includes("Null")&&o.push("Null");var n=o.reduce((function(r,t,o){return j(j({},r),{},e({},t,O[o%O.length]))}),{});return[o,n]}),[c,U]),Z=r(V,2),_=Z[0],H=Z[1];return a((function(){if(b){W.current=new v.Map({container:I.current,style:"mapbox://styles/mapbox/dark-v9",center:P(x),zoom:1,attributionControl:!1,scrollZoom:!1}),W.current.addControl(new v.NavigationControl({showCompass:!1}),"bottom-right"),W.current.on("load",(function(){W.current.addSource("radius-circle",{type:"geojson",data:C}),W.current.addLayer({id:"radius-circle",type:"fill",source:"radius-circle",paint:{"fill-color":"#03BCD4","fill-opacity":.2}}),W.current.addSource("wells",{type:"geojson",data:C}),W.current.addLayer({id:"wells",type:"circle",source:"wells",paint:{"circle-radius":["get","radius"],"circle-color":["get","color"],"circle-opacity":["get","opacity"]}}),R(!0)}));var e=W.current;return function(){e.remove(),W.current=null,L.current=null,B.current=null}}}),[]),a((function(){if(W.current&&q){if(!G)return W.current.getSource("radius-circle").setData(C),void(L.current=null);var e=function(e,t){for(var o=r(e,2),n=o[0],i=o[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,l=[],s=t/(111320*Math.cos(n*Math.PI/180)),c=t/110574,u=0;u<=a;u+=1){var m=u/a*(2*Math.PI);l.push([i+s*Math.cos(m),n+c*Math.sin(m)])}return l}(G,1609.34*S);W.current.getSource("radius-circle").setData({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}}),L.current=e.reduce((function(e,r){return e.extend(r)}),new v.LngLatBounds)}}),[S,G,q]),a((function(){var e;if(W.current&&q){var r=A.current;A.current=f,null===(e=z.current)||void 0===e||e.remove();var t=F.map((function(e){return e.id})),o=[],n={},i=new v.LngLatBounds;f.forEach((function(e){var r=u(e,k);if(r&&w(r)){var a=c&&c.id===e.id,l=t.includes(e.id),s=a?M:D,m=a||l?"#00FFFF":H[e.formation],p=a||l?1:.3;n[e.id]=e,i.extend(P(r)),o.push({type:"Feature",geometry:{type:"Point",coordinates:P(r)},properties:{wellId:e.id,radius:s,color:m,opacity:p}})}})),W.current.getSource("wells").setData({type:"FeatureCollection",features:o}),B.current=o.length?i:null;var a=W.current,m=null,d=function(e){a.getCanvas().style.cursor="pointer";var r=n[e.features[0].properties.wellId];if(r&&r.id!==m&&(m=r.id,N)){var t=document.createElement("div"),o=l(N,{well:r,color:H[r.formation]});s.render(y(p,{theme:h,children:o}),t),z.current||(z.current=new v.Popup({closeButton:!1,maxWidth:"none"})),z.current.setLngLat(P(u(r,k))).setDOMContent(t).addTo(a)}},b=function(){m=null,a.getCanvas().style.cursor=""};return a.on("mousemove","wells",d),a.on("mouseleave","wells",b),setTimeout((function(){W.current&&L.current&&f!==r&&W.current.fitBounds(L.current,{padding:5})}),500),function(){a.off("mousemove","wells",d),a.off("mouseleave","wells",b)}}}),[c,f,F,H,q]),a((function(){setTimeout((function(){c?W.current&&L.current&&W.current.fitBounds(L.current,{padding:5}):W.current&&B.current&&W.current.fitBounds(B.current)}),500)}),[S,c,q]),g("div",{className:d.map,children:[y("div",{className:d.mapMain,ref:I}),g("div",{className:d.mapFooter,children:[F&&g("div",{className:d.mapFooterItem,children:[y("div",{className:d.mapFooterItemSquare,style:{backgroundColor:"#00FFFF"}}),y("div",{className:d.mapFooterItemLabel,children:"Selected Offset Wells"})]}),_.map((function(e){return g("div",{className:d.mapFooterItem,children:[y("div",{className:d.mapFooterItemSquare,style:{backgroundColor:H[e]}}),y("div",{className:d.mapFooterItemLabel,children:e})]},e)}))]})]})}S.propTypes={subjectWell:c.shape({id:c.number,formation:c.string}),wells:c.arrayOf(c.shape({})).isRequired,offsetWells:c.arrayOf(c.shape({})),radius:c.number.isRequired,subjectWellMarkerSize:c.number,wellMarkerSize:c.number,popUpFormatter:c.func,coordsDataPath:c.string},S.defaultProps={subjectWell:null,subjectWellMarkerSize:10,wellMarkerSize:5,popUpFormatter:null,coordsDataPath:"settings.top_hole.coordinates",offsetWells:null};var M=t(S);export{M as default};
|
|
2
2
|
//# sourceMappingURL=Map.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sources":["../../../../../src/components/OffsetWellPickerV2/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { get, sortBy } from 'lodash';\nimport { MuiThemeProvider } from '@material-ui/core/styles';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\nimport { theme } from '~/config';\nimport mapboxgl from '~/config/mapboxGl';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nconst { isValidCoordinates } = mapbox;\n\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 10;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#00FFFF';\nconst COLORS = [\n '#FF00FF',\n '#F5BD80',\n '#FF0000',\n '#0080FF',\n '#FF8000',\n '#58ACFA',\n '#FA58F4',\n '#40FF00',\n '#4B8A08',\n '#40FF00',\n '#D8F781',\n];\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\n\nconst RADIUS_CIRCLE_ID = 'radius-circle';\nconst WELLS_ID = 'wells';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\n\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl has no geographic-radius circle primitive, so approximate it with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const ring = [];\n const distanceX = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const distanceY = radiusMeters / 110574;\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * (2 * Math.PI);\n ring.push([lng + distanceX * Math.cos(theta), lat + distanceY * Math.sin(theta)]);\n }\n return ring;\n};\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n subjectWell,\n wells,\n offsetWells,\n radius,\n subjectWellMarkerSize,\n wellMarkerSize,\n popUpFormatter,\n coordsDataPath,\n}) {\n const mapContainerRef = useRef(null);\n const mapRef = useRef(null);\n const radiusCircleBoundsRef = useRef(null);\n const markersBoundsRef = useRef(null);\n const popupRef = useRef(null);\n const prevWellsRef = useRef();\n const [isMapReady, setIsMapReady] = useState(false);\n\n const restWells = useMemo(() => {\n return wells.filter(well => !subjectWell || subjectWell.id !== well.id);\n }, [subjectWell, wells]);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Get well marker colors according to its target formation\n const [formations, colorDict] = useMemo(() => {\n // NOTE: Determine well marker colors\n const restFormations = [];\n let hasNullFormation = false;\n\n restWells.forEach(well => {\n if (well.formation === 'Null') {\n hasNullFormation = true;\n } else if (\n (!subjectWell || subjectWell.formation !== well.formation) &&\n !restFormations.includes(well.formation)\n ) {\n restFormations.push(well.formation);\n }\n });\n\n const sortedFormations = subjectWell\n ? [subjectWell.formation].concat(sortBy(restFormations))\n : sortBy(restFormations);\n\n if (hasNullFormation && !sortedFormations.includes('Null')) {\n sortedFormations.push('Null');\n }\n\n const colors = sortedFormations.reduce(\n (result, item, idx) => ({\n ...result,\n [item]: COLORS[idx % COLORS.length],\n }),\n {}\n );\n\n return [sortedFormations, colors];\n }, [subjectWell, restWells]);\n\n // NOTE: Initialize map\n useEffect(() => {\n mapRef.current = new mapboxgl.Map({\n container: mapContainerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: 1,\n attributionControl: false,\n scrollZoom: false,\n });\n\n mapRef.current.addControl(\n new mapboxgl.NavigationControl({ showCompass: false }),\n 'bottom-right'\n );\n\n // NOTE: Sources/layers can only be added once the style has loaded.\n // The radius circle layer is added first so well markers render above it (was bringToBack)\n mapRef.current.on('load', () => {\n mapRef.current.addSource(RADIUS_CIRCLE_ID, {\n type: 'geojson',\n data: EMPTY_FEATURE_COLLECTION,\n });\n mapRef.current.addLayer({\n id: RADIUS_CIRCLE_ID,\n type: 'fill',\n source: RADIUS_CIRCLE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n mapRef.current.addSource(WELLS_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: WELLS_ID,\n type: 'circle',\n source: WELLS_ID,\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n\n setIsMapReady(true);\n });\n\n const map = mapRef.current;\n return () => {\n map.remove();\n mapRef.current = null;\n radiusCircleBoundsRef.current = null;\n markersBoundsRef.current = null;\n };\n }, []);\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current || !isMapReady) {\n return;\n }\n\n if (!subjectWellCoords) {\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData(EMPTY_FEATURE_COLLECTION);\n radiusCircleBoundsRef.current = null;\n return;\n }\n\n const ring = makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE);\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData({\n type: 'Feature',\n geometry: { type: 'Polygon', coordinates: [ring] },\n });\n radiusCircleBoundsRef.current = ring.reduce(\n (bounds, coord) => bounds.extend(coord),\n new mapboxgl.LngLatBounds()\n );\n }, [radius, subjectWellCoords, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !isMapReady) {\n return undefined;\n }\n\n const prevWells = prevWellsRef.current;\n prevWellsRef.current = wells;\n\n popupRef.current?.remove();\n\n const offsetWellIds = offsetWells.map(well => well.id);\n\n const features = [];\n const wellsById = {};\n const bounds = new mapboxgl.LngLatBounds();\n wells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? subjectWellMarkerSize : wellMarkerSize;\n const color = isWellSubject || isWellOffset ? OFFSET_WELL_COLOR : colorDict[well.formation];\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n wellsById[well.id] = well;\n bounds.extend(toLngLat(coords));\n features.push({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n properties: { wellId: well.id, radius: r, color, opacity },\n });\n }\n });\n\n mapRef.current.getSource(WELLS_ID).setData({ type: 'FeatureCollection', features });\n markersBoundsRef.current = features.length ? bounds : null;\n\n const map = mapRef.current;\n let hoveredWellId = null;\n\n const handleMouseMove = e => {\n map.getCanvas().style.cursor = 'pointer';\n\n const well = wellsById[e.features[0].properties.wellId];\n if (!well || well.id === hoveredWellId) {\n return;\n }\n hoveredWellId = well.id;\n\n if (popUpFormatter) {\n // Container to put React generated content in.\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(popUpFormatter, {\n well,\n color: colorDict[well.formation],\n });\n // NOTE: Custom popup may have buttons\n ReactDOM.render(\n <MuiThemeProvider theme={theme.darkTheme}>{popUpContent}</MuiThemeProvider>,\n popUpContainer\n );\n\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({ closeButton: false, maxWidth: 'none' });\n }\n popupRef.current\n .setLngLat(toLngLat(get(well, coordsDataPath)))\n .setDOMContent(popUpContainer)\n .addTo(map);\n }\n };\n\n const handleMouseLeave = () => {\n hoveredWellId = null;\n map.getCanvas().style.cursor = '';\n };\n\n map.on('mousemove', WELLS_ID, handleMouseMove);\n map.on('mouseleave', WELLS_ID, handleMouseLeave);\n\n setTimeout(() => {\n if (mapRef.current && radiusCircleBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_ID, handleMouseMove);\n map.off('mouseleave', WELLS_ID, handleMouseLeave);\n };\n }, [subjectWell, wells, offsetWells, colorDict, isMapReady]);\n\n useEffect(() => {\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusCircleBoundsRef.current) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, {\n padding: 5,\n });\n }\n } else if (mapRef.current && markersBoundsRef.current) {\n mapRef.current.fitBounds(markersBoundsRef.current);\n }\n }, 500);\n }, [radius, subjectWell, isMapReady]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n\n <div className={styles.mapFooter}>\n {offsetWells && (\n <div className={styles.mapFooterItem}>\n <div\n className={styles.mapFooterItemSquare}\n style={{ backgroundColor: OFFSET_WELL_COLOR }}\n />\n <div className={styles.mapFooterItemLabel}>Selected Offset Wells</div>\n </div>\n )}\n\n {formations.map(item => (\n <div className={styles.mapFooterItem} key={item}>\n <div\n className={styles.mapFooterItemSquare}\n style={{ backgroundColor: colorDict[item] }}\n />\n <div className={styles.mapFooterItemLabel}>{item}</div>\n </div>\n ))}\n </div>\n </div>\n );\n}\n\nWellsMap.propTypes = {\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n subjectWellMarkerSize: PropTypes.number,\n wellMarkerSize: PropTypes.number,\n popUpFormatter: PropTypes.func,\n coordsDataPath: PropTypes.string,\n};\n\nWellsMap.defaultProps = {\n subjectWell: null,\n subjectWellMarkerSize: DEFAULT_SUBJECT_WELL_MARKER_SIZE,\n wellMarkerSize: DEFAULT_WELL_MARKER_SIZE,\n popUpFormatter: null,\n coordsDataPath: 'settings.top_hole.coordinates',\n offsetWells: null,\n};\n\nexport default memo(WellsMap);\n"],"names":["isValidCoordinates","mapbox","COLORS","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","toLngLat","_ref","_ref2","_slicedToArray","lat","WellsMap","_ref5","subjectWell","wells","offsetWells","radius","subjectWellMarkerSize","wellMarkerSize","popUpFormatter","coordsDataPath","mapContainerRef","useRef","mapRef","radiusCircleBoundsRef","markersBoundsRef","popupRef","prevWellsRef","useState","_useState2","_useState","isMapReady","setIsMapReady","restWells","useMemo","filter","well","id","subjectWellCoords","get","restFormations","hasNullFormation","forEach","formation","includes","push","sortedFormations","concat","sortBy","colors","reduce","result","item","idx","length","_useMemo2","_useMemo","formations","colorDict","useEffect","current","mapboxgl","Map","container","style","center","zoom","attributionControl","scrollZoom","addControl","NavigationControl","showCompass","on","addSource","data","addLayer","source","paint","map","remove","getSource","setData","ring","_ref3","radiusMeters","_ref4","lng","points","distanceX","Math","cos","PI","distanceY","i","theta","sin","makeCirclePolygon","geometry","coordinates","bounds","coord","extend","LngLatBounds","_popupRef$current","prevWells","offsetWellIds","wellsById","coords","isWellSubject","isWellOffset","r","color","opacity","properties","wellId","hoveredWellId","handleMouseMove","e","getCanvas","cursor","popUpContainer","document","createElement","popUpContent","ReactDOM","render","_jsx","MuiThemeProvider","theme","children","Popup","closeButton","maxWidth","setLngLat","setDOMContent","addTo","handleMouseLeave","setTimeout","fitBounds","padding","off","_jsxs","className","styles","mapMain","ref","mapFooter","mapFooterItem","mapFooterItemSquare","backgroundColor","mapFooterItemLabel","propTypes","PropTypes","shape","number","string","arrayOf","isRequired","func","defaultProps","memo"],"mappings":"6yEAaA,IAAQA,EAAuBC,EAAvBD,mBAOFE,EAAS,CACb,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAGIC,EAAiB,CAAC,WAAY,WAI9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAElEC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAF,EAA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vB7I,MAAO0I,EAAUI,QAAQJ,EAAUC,MAAM,CAAA,IAAKI,WAC9C9I,YAAayI,EAAUI,QAAQJ,EAAUC,MAAM,CAAE,IACjDzI,OAAQwI,EAAUE,OAAOG,WACzB5I,sBAAuBuI,EAAUE,OACjCxI,eAAgBsI,EAAUE,OAC1BvI,eAAgBqI,EAAUM,KAC1B1I,eAAgBoI,EAAUG,QAG5BhJ,EAASoJ,aAAe,CACtBlJ,YAAa,KACbI,sBA7UuC,GA8UvCC,eA7U+B,EA8U/BC,eAAgB,KAChBC,eAAgB,gCAChBL,YAAa,MAGf,IAAeiJ,EAAAA,EAAKrJ"}
|
|
1
|
+
{"version":3,"file":"Map.js","sources":["../../../../../src/components/OffsetWellPickerV2/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { get, sortBy } from 'lodash';\nimport { MuiThemeProvider } from '@material-ui/core/styles';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\nimport { theme } from '~/config';\nimport mapboxgl from '~/config/mapboxGl';\nimport { IS_MAPBOX_ENABLED } from '~/config/mapbox';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nconst { isValidCoordinates } = mapbox;\n\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 10;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#00FFFF';\nconst COLORS = [\n '#FF00FF',\n '#F5BD80',\n '#FF0000',\n '#0080FF',\n '#FF8000',\n '#58ACFA',\n '#FA58F4',\n '#40FF00',\n '#4B8A08',\n '#40FF00',\n '#D8F781',\n];\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\n\nconst RADIUS_CIRCLE_ID = 'radius-circle';\nconst WELLS_ID = 'wells';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\n\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl has no geographic-radius circle primitive, so approximate it with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const ring = [];\n const distanceX = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const distanceY = radiusMeters / 110574;\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * (2 * Math.PI);\n ring.push([lng + distanceX * Math.cos(theta), lat + distanceY * Math.sin(theta)]);\n }\n return ring;\n};\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n subjectWell,\n wells,\n offsetWells,\n radius,\n subjectWellMarkerSize,\n wellMarkerSize,\n popUpFormatter,\n coordsDataPath,\n}) {\n const mapContainerRef = useRef(null);\n const mapRef = useRef(null);\n const radiusCircleBoundsRef = useRef(null);\n const markersBoundsRef = useRef(null);\n const popupRef = useRef(null);\n const prevWellsRef = useRef();\n const [isMapReady, setIsMapReady] = useState(false);\n\n const restWells = useMemo(() => {\n return wells.filter(well => !subjectWell || subjectWell.id !== well.id);\n }, [subjectWell, wells]);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Get well marker colors according to its target formation\n const [formations, colorDict] = useMemo(() => {\n // NOTE: Determine well marker colors\n const restFormations = [];\n let hasNullFormation = false;\n\n restWells.forEach(well => {\n if (well.formation === 'Null') {\n hasNullFormation = true;\n } else if (\n (!subjectWell || subjectWell.formation !== well.formation) &&\n !restFormations.includes(well.formation)\n ) {\n restFormations.push(well.formation);\n }\n });\n\n const sortedFormations = subjectWell\n ? [subjectWell.formation].concat(sortBy(restFormations))\n : sortBy(restFormations);\n\n if (hasNullFormation && !sortedFormations.includes('Null')) {\n sortedFormations.push('Null');\n }\n\n const colors = sortedFormations.reduce(\n (result, item, idx) => ({\n ...result,\n [item]: COLORS[idx % COLORS.length],\n }),\n {}\n );\n\n return [sortedFormations, colors];\n }, [subjectWell, restWells]);\n\n // NOTE: Initialize map\n useEffect(() => {\n if (!IS_MAPBOX_ENABLED) return undefined;\n\n mapRef.current = new mapboxgl.Map({\n container: mapContainerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: 1,\n attributionControl: false,\n scrollZoom: false,\n });\n\n mapRef.current.addControl(\n new mapboxgl.NavigationControl({ showCompass: false }),\n 'bottom-right'\n );\n\n // NOTE: Sources/layers can only be added once the style has loaded.\n // The radius circle layer is added first so well markers render above it (was bringToBack)\n mapRef.current.on('load', () => {\n mapRef.current.addSource(RADIUS_CIRCLE_ID, {\n type: 'geojson',\n data: EMPTY_FEATURE_COLLECTION,\n });\n mapRef.current.addLayer({\n id: RADIUS_CIRCLE_ID,\n type: 'fill',\n source: RADIUS_CIRCLE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n mapRef.current.addSource(WELLS_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: WELLS_ID,\n type: 'circle',\n source: WELLS_ID,\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n\n setIsMapReady(true);\n });\n\n const map = mapRef.current;\n return () => {\n map.remove();\n mapRef.current = null;\n radiusCircleBoundsRef.current = null;\n markersBoundsRef.current = null;\n };\n }, []);\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current || !isMapReady) {\n return;\n }\n\n if (!subjectWellCoords) {\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData(EMPTY_FEATURE_COLLECTION);\n radiusCircleBoundsRef.current = null;\n return;\n }\n\n const ring = makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE);\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData({\n type: 'Feature',\n geometry: { type: 'Polygon', coordinates: [ring] },\n });\n radiusCircleBoundsRef.current = ring.reduce(\n (bounds, coord) => bounds.extend(coord),\n new mapboxgl.LngLatBounds()\n );\n }, [radius, subjectWellCoords, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !isMapReady) {\n return undefined;\n }\n\n const prevWells = prevWellsRef.current;\n prevWellsRef.current = wells;\n\n popupRef.current?.remove();\n\n const offsetWellIds = offsetWells.map(well => well.id);\n\n const features = [];\n const wellsById = {};\n const bounds = new mapboxgl.LngLatBounds();\n wells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? subjectWellMarkerSize : wellMarkerSize;\n const color = isWellSubject || isWellOffset ? OFFSET_WELL_COLOR : colorDict[well.formation];\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n wellsById[well.id] = well;\n bounds.extend(toLngLat(coords));\n features.push({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n properties: { wellId: well.id, radius: r, color, opacity },\n });\n }\n });\n\n mapRef.current.getSource(WELLS_ID).setData({ type: 'FeatureCollection', features });\n markersBoundsRef.current = features.length ? bounds : null;\n\n const map = mapRef.current;\n let hoveredWellId = null;\n\n const handleMouseMove = e => {\n map.getCanvas().style.cursor = 'pointer';\n\n const well = wellsById[e.features[0].properties.wellId];\n if (!well || well.id === hoveredWellId) {\n return;\n }\n hoveredWellId = well.id;\n\n if (popUpFormatter) {\n // Container to put React generated content in.\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(popUpFormatter, {\n well,\n color: colorDict[well.formation],\n });\n // NOTE: Custom popup may have buttons\n ReactDOM.render(\n <MuiThemeProvider theme={theme.darkTheme}>{popUpContent}</MuiThemeProvider>,\n popUpContainer\n );\n\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({ closeButton: false, maxWidth: 'none' });\n }\n popupRef.current\n .setLngLat(toLngLat(get(well, coordsDataPath)))\n .setDOMContent(popUpContainer)\n .addTo(map);\n }\n };\n\n const handleMouseLeave = () => {\n hoveredWellId = null;\n map.getCanvas().style.cursor = '';\n };\n\n map.on('mousemove', WELLS_ID, handleMouseMove);\n map.on('mouseleave', WELLS_ID, handleMouseLeave);\n\n setTimeout(() => {\n if (mapRef.current && radiusCircleBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_ID, handleMouseMove);\n map.off('mouseleave', WELLS_ID, handleMouseLeave);\n };\n }, [subjectWell, wells, offsetWells, colorDict, isMapReady]);\n\n useEffect(() => {\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusCircleBoundsRef.current) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, {\n padding: 5,\n });\n }\n } else if (mapRef.current && markersBoundsRef.current) {\n mapRef.current.fitBounds(markersBoundsRef.current);\n }\n }, 500);\n }, [radius, subjectWell, isMapReady]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n\n <div className={styles.mapFooter}>\n {offsetWells && (\n <div className={styles.mapFooterItem}>\n <div\n className={styles.mapFooterItemSquare}\n style={{ backgroundColor: OFFSET_WELL_COLOR }}\n />\n <div className={styles.mapFooterItemLabel}>Selected Offset Wells</div>\n </div>\n )}\n\n {formations.map(item => (\n <div className={styles.mapFooterItem} key={item}>\n <div\n className={styles.mapFooterItemSquare}\n style={{ backgroundColor: colorDict[item] }}\n />\n <div className={styles.mapFooterItemLabel}>{item}</div>\n </div>\n ))}\n </div>\n </div>\n );\n}\n\nWellsMap.propTypes = {\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n subjectWellMarkerSize: PropTypes.number,\n wellMarkerSize: PropTypes.number,\n popUpFormatter: PropTypes.func,\n coordsDataPath: PropTypes.string,\n};\n\nWellsMap.defaultProps = {\n subjectWell: null,\n subjectWellMarkerSize: DEFAULT_SUBJECT_WELL_MARKER_SIZE,\n wellMarkerSize: DEFAULT_WELL_MARKER_SIZE,\n popUpFormatter: null,\n coordsDataPath: 'settings.top_hole.coordinates',\n offsetWells: null,\n};\n\nexport default memo(WellsMap);\n"],"names":["isValidCoordinates","mapbox","COLORS","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","toLngLat","_ref","_ref2","_slicedToArray","lat","WellsMap","_ref5","subjectWell","wells","offsetWells","radius","subjectWellMarkerSize","wellMarkerSize","popUpFormatter","coordsDataPath","mapContainerRef","useRef","mapRef","radiusCircleBoundsRef","markersBoundsRef","popupRef","prevWellsRef","useState","_useState2","_useState","isMapReady","setIsMapReady","restWells","useMemo","filter","well","id","subjectWellCoords","get","restFormations","hasNullFormation","forEach","formation","includes","push","sortedFormations","concat","sortBy","colors","reduce","result","item","idx","length","_useMemo2","_useMemo","formations","colorDict","useEffect","IS_MAPBOX_ENABLED","current","mapboxgl","Map","container","style","center","zoom","attributionControl","scrollZoom","addControl","NavigationControl","showCompass","on","addSource","data","addLayer","source","paint","map","remove","getSource","setData","ring","_ref3","radiusMeters","_ref4","lng","points","distanceX","Math","cos","PI","distanceY","i","theta","sin","makeCirclePolygon","geometry","coordinates","bounds","coord","extend","LngLatBounds","_popupRef$current","prevWells","offsetWellIds","wellsById","coords","isWellSubject","isWellOffset","r","color","opacity","properties","wellId","hoveredWellId","handleMouseMove","e","getCanvas","cursor","popUpContainer","document","createElement","popUpContent","ReactDOM","render","_jsx","MuiThemeProvider","theme","children","Popup","closeButton","maxWidth","setLngLat","setDOMContent","addTo","handleMouseLeave","setTimeout","fitBounds","padding","off","_jsxs","className","styles","mapMain","ref","mapFooter","mapFooterItem","mapFooterItemSquare","backgroundColor","mapFooterItemLabel","propTypes","PropTypes","shape","number","string","arrayOf","isRequired","func","defaultProps","memo"],"mappings":"o3EAcA,IAAQA,EAAuBC,EAAvBD,mBAOFE,EAAS,CACb,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAGIC,EAAiB,CAAC,WAAY,WAI9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAElEC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,EAAI,EAe3C,SAASC,EASNC,GAAA,IARDC,IAAAA,YACAC,IAAAA,MACAC,IAAAA,YACAC,IAAAA,OACAC,IAAAA,sBACAC,IAAAA,eACAC,IAAAA,eACAC,IAAAA,eAEMC,EAAkBC,EAAO,MACzBC,EAASD,EAAO,MAChBE,EAAwBF,EAAO,MAC/BG,EAAmBH,EAAO,MAC1BI,EAAWJ,EAAO,MAClBK,EAAeL,IACeM,EAAAA,GAAS,GAAMC,EAAApB,EAAAqB,EAAA,GAA5CC,EAAUF,EAAA,GAAEG,EAAaH,EAAA,GAE1BI,EAAYC,GAAQ,WACxB,OAAOpB,EAAMqB,QAAO,SAAAC,GAAI,OAAKvB,GAAeA,EAAYwB,KAAOD,EAAKC,KACtE,GAAG,CAACxB,EAAaC,IAEXwB,EAAoBJ,GAAQ,WAChC,OAAOrB,GAAe0B,EAAI1B,EAAaO,EACzC,GAAG,CAACP,EAAaO,IAGec,EAAAA,GAAQ,WAEtC,IAAMM,EAAiB,GACnBC,GAAmB,EAEvBR,EAAUS,SAAQ,SAAAN,GACO,SAAnBA,EAAKO,UACPF,GAAmB,EAEjB5B,GAAeA,EAAY8B,YAAcP,EAAKO,WAC/CH,EAAeI,SAASR,EAAKO,YAE9BH,EAAeK,KAAKT,EAAKO,UAE7B,IAEA,IAAMG,EAAmBjC,EACrB,CAACA,EAAY8B,WAAWI,OAAOC,EAAOR,IACtCQ,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AA3B,GAAI,OAClB0F,EAAA,MAAA,CAAKC,UAAWC,EAAOI,cAAclB,SACnC,CAAAH,EAAA,MAAA,CACEgB,UAAWC,EAAOK,oBAClBpF,MAAO,CAAEqF,gBAAiB5F,EAAUN,MAEtC2E,EAAA,MAAA,CAAKgB,UAAWC,EAAOO,mBAAmBrB,SAAE9E,MALHA,EAMrC,SAKhB,CAEAzC,EAAS6I,UAAY,CACnB3I,YAAa4I,EAAUC,MAAM,CAC3BrH,GAAIoH,EAAUE,OACdhH,UAAW8G,EAAUG,SAEvB9I,MAAO2I,EAAUI,QAAQJ,EAAUC,MAAM,CAAA,IAAKI,WAC9C/I,YAAa0I,EAAUI,QAAQJ,EAAUC,MAAM,CAAE,IACjD1I,OAAQyI,EAAUE,OAAOG,WACzB7I,sBAAuBwI,EAAUE,OACjCzI,eAAgBuI,EAAUE,OAC1BxI,eAAgBsI,EAAUM,KAC1B3I,eAAgBqI,EAAUG,QAG5BjJ,EAASqJ,aAAe,CACtBnJ,YAAa,KACbI,sBA/UuC,GAgVvCC,eA/U+B,EAgV/BC,eAAgB,KAChBC,eAAgB,gCAChBL,YAAa,MAGf,IAAekJ,EAAAA,EAAKtJ"}
|
package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Map.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js"],"names":[],"mappings":";;AAwCA;;;;;;;;;;;gBAmPC;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAzRqB,YAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/slicedToArray";import{memo as r,useRef as t,useState as o,useMemo as n,useEffect as u,createElement as
|
|
1
|
+
import e from"@babel/runtime/helpers/slicedToArray";import{memo as r,useRef as t,useState as o,useMemo as n,useEffect as u,createElement as i}from"react";import l from"react-dom";import c from"prop-types";import{get as a,sortBy as s}from"lodash";import d from"./Map.css.js";import{mapbox as f}from"../../../../../../utils/index.js";import"../../../../../../config/mapboxGl/index.js";import{IS_MAPBOX_ENABLED as p}from"../../../../../../config/mapbox/index.js";import"mapbox-gl/dist/mapbox-gl.css";import{jsx as m,Fragment as v}from"react/jsx-runtime";import y from"mapbox-gl";var g=f.isValidCoordinates,h=[29.749907,-95.358421],w={type:"FeatureCollection",features:[]},b=function(r){var t=e(r,2),o=t[0];return[t[1],o]};function D(r){var c=r.open,f=r.subjectWell,D=r.wells,x=r.offsetWells,B=r.radius,C=r.formationColors,F=r.popUpFormatter,W=r.coordsDataPath,j=r.onAddOffsetWell,M=r.onDeleteOffsetWell,P=t(null),L=t(),O=t(null),q=t(null),R=t(null),I=t(),S=o(!1),T=e(S,2),k=T[0],A=T[1],N=n((function(){return f&&a(f,W)}),[f,W]);return u((function(){p&&c&&!L.current&&(L.current=new y.Map({container:P.current,style:"mapbox://styles/mapbox/dark-v9",center:b(h),zoom:1,attributionControl:!1,scrollZoom:!1}),L.current.addControl(new y.NavigationControl({showCompass:!1}),"bottom-right"),L.current.on("load",(function(){L.current.addSource("radius-circle",{type:"geojson",data:w}),L.current.addLayer({id:"radius-circle",type:"fill",source:"radius-circle",paint:{"fill-color":"#03BCD4","fill-opacity":.2}}),L.current.addSource("wells",{type:"geojson",data:w}),L.current.addLayer({id:"wells",type:"circle",source:"wells",layout:{"circle-sort-key":["get","sortKey"]},paint:{"circle-radius":["get","radius"],"circle-color":["get","color"],"circle-opacity":["get","opacity"]}}),A(!0)})))}),[c]),u((function(){return function(){L.current&&(L.current.remove(),L.current=null,O.current=null,q.current=null)}}),[]),u((function(){if(L.current&&k&&c){if(!N)return L.current.getSource("radius-circle").setData(w),void(O.current=null);var r=function(r,t){for(var o=e(r,2),n=o[0],u=o[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,l=[],c=t/(111320*Math.cos(n*Math.PI/180)),a=t/110574,s=0;s<=i;s+=1){var d=s/i*(2*Math.PI);l.push([u+c*Math.cos(d),n+a*Math.sin(d)])}return l}(N,1609.34*B);L.current.getSource("radius-circle").setData({type:"Feature",geometry:{type:"Polygon",coordinates:[r]}}),O.current=r.reduce((function(e,r){return e.extend(r)}),new y.LngLatBounds)}}),[B,N,c,k]),u((function(){if(L.current&&k&&c){var e=I.current;I.current=D;var r=x.map((function(e){return e.id})),t=s(D,(function(e){return r.includes(e.id)})),o=[],n={},u=new y.LngLatBounds;t.forEach((function(e){var t=a(e,W);if(t&&g(t)){var i=f&&f.id===e.id,l=r.includes(e.id),c=i?10:5,s=i||l?"#00FFFF":a(C,e.formation,"#BDBDBD"),d=i||l?1:.3;n[e.id]=e,u.extend(b(t)),o.push({type:"Feature",geometry:{type:"Point",coordinates:b(t)},properties:{wellId:e.id,radius:c,color:s,opacity:d,sortKey:l?1:0}})}})),L.current.getSource("wells").setData({type:"FeatureCollection",features:o}),q.current=o.length?u:null;var d=L.current,p=null,h=function(e){d.getCanvas().style.cursor="pointer";var r=n[e.features[0].properties.wellId];if(r&&r.id!==p&&(p=r.id,F)){var t=document.createElement("div"),o=i(F,{well:r,color:a(C,r.formation,"#BDBDBD")});l.render(m(v,{children:o}),t),R.current||(R.current=new y.Popup({closeButton:!1,maxWidth:"none"})),R.current.setLngLat(b(a(r,W))).setDOMContent(t).addTo(d)}},w=function(){var e;p=null,d.getCanvas().style.cursor="",null===(e=R.current)||void 0===e||e.remove()},B=function(e){var t=e.features[0].properties.wellId,o=f&&f.id===t;r.includes(t)&&!o?M(t):j(t)};return d.on("mousemove","wells",h),d.on("mouseleave","wells",w),d.on("click","wells",B),setTimeout((function(){L.current&&O.current&&D!==e&&L.current.fitBounds(O.current,{padding:5})}),500),function(){d.off("mousemove","wells",h),d.off("mouseleave","wells",w),d.off("click","wells",B)}}}),[f,D,x,c,k]),u((function(){c&&setTimeout((function(){f?L.current&&O.current&&L.current.fitBounds(O.current,{padding:5}):L.current&&q.current&&L.current.fitBounds(q.current)}),500)}),[B,f,c,k]),m("div",{className:d.map,children:m("div",{className:d.mapMain,ref:P})})}D.propTypes={open:c.bool.isRequired,subjectWell:c.shape({id:c.number,formation:c.string}),wells:c.arrayOf(c.shape({})).isRequired,offsetWells:c.arrayOf(c.shape({})),radius:c.number.isRequired,formationColors:c.shape({}).isRequired,popUpFormatter:c.func,coordsDataPath:c.string,onAddOffsetWell:c.func.isRequired,onDeleteOffsetWell:c.func.isRequired},D.defaultProps={subjectWell:null,popUpFormatter:null,coordsDataPath:"settings.top_hole.coordinates",offsetWells:null};var x=r(D);export{x as default};
|
|
2
2
|
//# sourceMappingURL=Map.js.map
|
package/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sources":["../../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { get, sortBy } from 'lodash';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\nimport mapboxgl from '~/config/mapboxGl';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nconst { isValidCoordinates } = mapbox;\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 10;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#00FFFF';\n\nconst RADIUS_CIRCLE_ID = 'radius-circle';\nconst WELLS_ID = 'wells';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\n\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl has no geographic-radius circle primitive, so approximate it with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const ring = [];\n const distanceX = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const distanceY = radiusMeters / 110574;\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * (2 * Math.PI);\n ring.push([lng + distanceX * Math.cos(theta), lat + distanceY * Math.sin(theta)]);\n }\n return ring;\n};\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n open,\n subjectWell,\n wells,\n offsetWells,\n radius,\n formationColors,\n popUpFormatter,\n coordsDataPath,\n onAddOffsetWell,\n onDeleteOffsetWell,\n}) {\n const mapContainerRef = useRef(null);\n const mapRef = useRef();\n const radiusCircleBoundsRef = useRef(null);\n const markersBoundsRef = useRef(null);\n const popupRef = useRef(null);\n const prevWellsRef = useRef();\n const [isMapReady, setIsMapReady] = useState(false);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Initialize map\n useEffect(() => {\n if (!open || mapRef.current) return;\n\n mapRef.current = new mapboxgl.Map({\n container: mapContainerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: 1,\n attributionControl: false,\n scrollZoom: false,\n });\n\n mapRef.current.addControl(\n new mapboxgl.NavigationControl({ showCompass: false }),\n 'bottom-right'\n );\n\n // NOTE: Sources/layers can only be added once the style has loaded.\n // The radius circle layer is added first so well markers render above it (was bringToBack)\n mapRef.current.on('load', () => {\n mapRef.current.addSource(RADIUS_CIRCLE_ID, {\n type: 'geojson',\n data: EMPTY_FEATURE_COLLECTION,\n });\n mapRef.current.addLayer({\n id: RADIUS_CIRCLE_ID,\n type: 'fill',\n source: RADIUS_CIRCLE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n mapRef.current.addSource(WELLS_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: WELLS_ID,\n type: 'circle',\n source: WELLS_ID,\n layout: {\n 'circle-sort-key': ['get', 'sortKey'],\n },\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n\n setIsMapReady(true);\n });\n }, [open]);\n\n useEffect(\n () => () => {\n if (mapRef.current) {\n mapRef.current.remove();\n mapRef.current = null;\n radiusCircleBoundsRef.current = null;\n markersBoundsRef.current = null;\n }\n },\n []\n );\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return;\n }\n\n if (!subjectWellCoords) {\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData(EMPTY_FEATURE_COLLECTION);\n radiusCircleBoundsRef.current = null;\n return;\n }\n\n const ring = makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE);\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData({\n type: 'Feature',\n geometry: { type: 'Polygon', coordinates: [ring] },\n });\n radiusCircleBoundsRef.current = ring.reduce(\n (bounds, coord) => bounds.extend(coord),\n new mapboxgl.LngLatBounds()\n );\n }, [radius, subjectWellCoords, open, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return undefined;\n }\n\n const prevWells = prevWellsRef.current;\n prevWellsRef.current = wells;\n\n const offsetWellIds = offsetWells.map(well => well.id);\n const sortedWells = sortBy(wells, well => offsetWellIds.includes(well.id));\n\n const features = [];\n const wellsById = {};\n const bounds = new mapboxgl.LngLatBounds();\n sortedWells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? DEFAULT_SUBJECT_WELL_MARKER_SIZE : DEFAULT_WELL_MARKER_SIZE;\n const color =\n isWellSubject || isWellOffset\n ? OFFSET_WELL_COLOR\n : get(formationColors, well.formation, '#BDBDBD');\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n wellsById[well.id] = well;\n bounds.extend(toLngLat(coords));\n features.push({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n // NOTE: sortKey keeps offset wells rendered on top (was sortedWells insertion order)\n properties: { wellId: well.id, radius: r, color, opacity, sortKey: isWellOffset ? 1 : 0 },\n });\n }\n });\n\n mapRef.current.getSource(WELLS_ID).setData({ type: 'FeatureCollection', features });\n markersBoundsRef.current = features.length ? bounds : null;\n\n const map = mapRef.current;\n let hoveredWellId = null;\n\n const handleMouseMove = e => {\n map.getCanvas().style.cursor = 'pointer';\n\n const well = wellsById[e.features[0].properties.wellId];\n if (!well || well.id === hoveredWellId) {\n return;\n }\n hoveredWellId = well.id;\n\n if (popUpFormatter) {\n // Container to put React generated content in.\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(popUpFormatter, {\n well,\n color: get(formationColors, well.formation, '#BDBDBD'),\n });\n // NOTE: Custom popup may have buttons\n ReactDOM.render(<>{popUpContent}</>, popUpContainer);\n\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({ closeButton: false, maxWidth: 'none' });\n }\n popupRef.current\n .setLngLat(toLngLat(get(well, coordsDataPath)))\n .setDOMContent(popUpContainer)\n .addTo(map);\n }\n };\n\n const handleMouseLeave = () => {\n hoveredWellId = null;\n map.getCanvas().style.cursor = '';\n popupRef.current?.remove();\n };\n\n const handleClick = e => {\n const { wellId } = e.features[0].properties;\n const isWellSubject = subjectWell && subjectWell.id === wellId;\n const isWellOffset = offsetWellIds.includes(wellId);\n\n if (isWellOffset && !isWellSubject) {\n onDeleteOffsetWell(wellId);\n } else {\n onAddOffsetWell(wellId);\n }\n };\n\n map.on('mousemove', WELLS_ID, handleMouseMove);\n map.on('mouseleave', WELLS_ID, handleMouseLeave);\n map.on('click', WELLS_ID, handleClick);\n\n setTimeout(() => {\n if (mapRef.current && radiusCircleBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_ID, handleMouseMove);\n map.off('mouseleave', WELLS_ID, handleMouseLeave);\n map.off('click', WELLS_ID, handleClick);\n };\n }, [subjectWell, wells, offsetWells, open, isMapReady]);\n\n useEffect(() => {\n if (!open) return;\n\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusCircleBoundsRef.current) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, {\n padding: 5,\n });\n }\n } else if (mapRef.current && markersBoundsRef.current) {\n mapRef.current.fitBounds(markersBoundsRef.current);\n }\n }, 500);\n }, [radius, subjectWell, open, isMapReady]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n </div>\n );\n}\n\nWellsMap.propTypes = {\n open: PropTypes.bool.isRequired,\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n formationColors: PropTypes.shape({}).isRequired,\n popUpFormatter: PropTypes.func,\n coordsDataPath: PropTypes.string,\n onAddOffsetWell: PropTypes.func.isRequired,\n onDeleteOffsetWell: PropTypes.func.isRequired,\n};\n\nWellsMap.defaultProps = {\n subjectWell: null,\n popUpFormatter: null,\n coordsDataPath: 'settings.top_hole.coordinates',\n offsetWells: null,\n};\n\nexport default memo(WellsMap);\n"],"names":["isValidCoordinates","mapbox","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","toLngLat","_ref","_ref2","_slicedToArray","lat","WellsMap","_ref5","open","subjectWell","wells","offsetWells","radius","formationColors","popUpFormatter","coordsDataPath","onAddOffsetWell","onDeleteOffsetWell","mapContainerRef","useRef","mapRef","radiusCircleBoundsRef","markersBoundsRef","popupRef","prevWellsRef","useState","_useState2","_useState","isMapReady","setIsMapReady","subjectWellCoords","useMemo","get","useEffect","current","mapboxgl","Map","container","style","center","zoom","attributionControl","scrollZoom","addControl","NavigationControl","showCompass","on","addSource","data","addLayer","id","source","paint","layout","remove","getSource","setData","ring","_ref3","radiusMeters","_ref4","lng","points","distanceX","Math","cos","PI","distanceY","i","theta","push","sin","makeCirclePolygon","geometry","coordinates","reduce","bounds","coord","extend","LngLatBounds","prevWells","offsetWellIds","map","well","sortedWells","sortBy","includes","wellsById","forEach","coords","isWellSubject","isWellOffset","r","color","formation","opacity","properties","wellId","sortKey","length","hoveredWellId","handleMouseMove","e","getCanvas","cursor","popUpContainer","document","createElement","popUpContent","ReactDOM","render","_jsx","_Fragment","children","Popup","closeButton","maxWidth","setLngLat","setDOMContent","addTo","handleMouseLeave","_popupRef$current","handleClick","setTimeout","fitBounds","padding","off","className","styles","mapMain","ref","propTypes","PropTypes","bool","isRequired","shape","number","string","arrayOf","func","defaultProps","memo"],"mappings":"mfAWA,IAAQA,EAAuBC,EAAvBD,mBAEFE,EAAiB,CAAC,WAAY,WAS9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAElEC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,EAAI,EAe3C,SAASC,EAWNC,GAAA,IAVDC,IAAAA,KACAC,IAAAA,YACAC,IAAAA,MACAC,IAAAA,YACAC,IAAAA,OACAC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,eACAC,IAAAA,gBACAC,IAAAA,mBAEMC,EAAkBC,EAAO,MACzBC,EAASD,IACTE,EAAwBF,EAAO,MAC/BG,EAAmBH,EAAO,MAC1BI,EAAWJ,EAAO,MAClBK,EAAeL,IACeM,EAAAA,GAAS,GAAMC,EA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d1C,UAAWsC,EAAUK,SAEvB/H,MAAO0H,EAAUM,QAAQN,EAAUG,MAAM,CAAA,IAAKD,WAC9C3H,YAAayH,EAAUM,QAAQN,EAAUG,MAAM,CAAE,IACjD3H,OAAQwH,EAAUI,OAAOF,WACzBzH,gBAAiBuH,EAAUG,MAAM,CAAA,GAAID,WACrCxH,eAAgBsH,EAAUO,KAC1B5H,eAAgBqH,EAAUK,OAC1BzH,gBAAiBoH,EAAUO,KAAKL,WAChCrH,mBAAoBmH,EAAUO,KAAKL,YAGrChI,EAASsI,aAAe,CACtBnI,YAAa,KACbK,eAAgB,KAChBC,eAAgB,gCAChBJ,YAAa,MAGf,IAAekI,EAAAA,EAAKvI"}
|
|
1
|
+
{"version":3,"file":"Map.js","sources":["../../../../../../../src/components/OffsetWellPickerV3/components/CustomSelectionView/components/Map/Map.js"],"sourcesContent":["import { createElement, memo, useRef, useEffect, useMemo, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { get, sortBy } from 'lodash';\n\nimport styles from './Map.css';\n\nimport { mapbox } from '~/utils';\nimport mapboxgl from '~/config/mapboxGl';\nimport { IS_MAPBOX_ENABLED } from '~/config/mapbox';\nimport 'mapbox-gl/dist/mapbox-gl.css';\n\nconst { isValidCoordinates } = mapbox;\n\nconst DEFAULT_COORDS = [29.749907, -95.358421]; // TX coordinates\nconst RADIUS_CIRCLE_COLOR = '#03BCD4';\nconst METERS_IN_MILE = 1609.34;\nconst DEFAULT_SUBJECT_WELL_MARKER_SIZE = 10;\nconst DEFAULT_WELL_MARKER_SIZE = 5;\nconst OFFSET_WELL_COLOR = '#00FFFF';\n\nconst RADIUS_CIRCLE_ID = 'radius-circle';\nconst WELLS_ID = 'wells';\nconst EMPTY_FEATURE_COLLECTION = { type: 'FeatureCollection', features: [] };\n\nconst toLngLat = ([lat, lng]) => [lng, lat];\n\n// NOTE: mapbox-gl has no geographic-radius circle primitive, so approximate it with a polygon\nconst makeCirclePolygon = ([lat, lng], radiusMeters, points = 64) => {\n const ring = [];\n const distanceX = radiusMeters / (111320 * Math.cos((lat * Math.PI) / 180));\n const distanceY = radiusMeters / 110574;\n for (let i = 0; i <= points; i += 1) {\n const theta = (i / points) * (2 * Math.PI);\n ring.push([lng + distanceX * Math.cos(theta), lat + distanceY * Math.sin(theta)]);\n }\n return ring;\n};\n\n// eslint-disable-next-line no-unused-vars\nfunction WellsMap({\n open,\n subjectWell,\n wells,\n offsetWells,\n radius,\n formationColors,\n popUpFormatter,\n coordsDataPath,\n onAddOffsetWell,\n onDeleteOffsetWell,\n}) {\n const mapContainerRef = useRef(null);\n const mapRef = useRef();\n const radiusCircleBoundsRef = useRef(null);\n const markersBoundsRef = useRef(null);\n const popupRef = useRef(null);\n const prevWellsRef = useRef();\n const [isMapReady, setIsMapReady] = useState(false);\n\n const subjectWellCoords = useMemo(() => {\n return subjectWell && get(subjectWell, coordsDataPath);\n }, [subjectWell, coordsDataPath]);\n\n // NOTE: Initialize map\n useEffect(() => {\n if (!IS_MAPBOX_ENABLED || !open || mapRef.current) return;\n\n mapRef.current = new mapboxgl.Map({\n container: mapContainerRef.current,\n style: 'mapbox://styles/mapbox/dark-v9',\n center: toLngLat(DEFAULT_COORDS),\n zoom: 1,\n attributionControl: false,\n scrollZoom: false,\n });\n\n mapRef.current.addControl(\n new mapboxgl.NavigationControl({ showCompass: false }),\n 'bottom-right'\n );\n\n // NOTE: Sources/layers can only be added once the style has loaded.\n // The radius circle layer is added first so well markers render above it (was bringToBack)\n mapRef.current.on('load', () => {\n mapRef.current.addSource(RADIUS_CIRCLE_ID, {\n type: 'geojson',\n data: EMPTY_FEATURE_COLLECTION,\n });\n mapRef.current.addLayer({\n id: RADIUS_CIRCLE_ID,\n type: 'fill',\n source: RADIUS_CIRCLE_ID,\n paint: {\n 'fill-color': RADIUS_CIRCLE_COLOR,\n 'fill-opacity': 0.2,\n },\n });\n\n mapRef.current.addSource(WELLS_ID, { type: 'geojson', data: EMPTY_FEATURE_COLLECTION });\n mapRef.current.addLayer({\n id: WELLS_ID,\n type: 'circle',\n source: WELLS_ID,\n layout: {\n 'circle-sort-key': ['get', 'sortKey'],\n },\n paint: {\n 'circle-radius': ['get', 'radius'],\n 'circle-color': ['get', 'color'],\n 'circle-opacity': ['get', 'opacity'],\n },\n });\n\n setIsMapReady(true);\n });\n }, [open]);\n\n useEffect(\n () => () => {\n if (mapRef.current) {\n mapRef.current.remove();\n mapRef.current = null;\n radiusCircleBoundsRef.current = null;\n markersBoundsRef.current = null;\n }\n },\n []\n );\n\n // NOTE: Radius circle\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return;\n }\n\n if (!subjectWellCoords) {\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData(EMPTY_FEATURE_COLLECTION);\n radiusCircleBoundsRef.current = null;\n return;\n }\n\n const ring = makeCirclePolygon(subjectWellCoords, radius * METERS_IN_MILE);\n mapRef.current.getSource(RADIUS_CIRCLE_ID).setData({\n type: 'Feature',\n geometry: { type: 'Polygon', coordinates: [ring] },\n });\n radiusCircleBoundsRef.current = ring.reduce(\n (bounds, coord) => bounds.extend(coord),\n new mapboxgl.LngLatBounds()\n );\n }, [radius, subjectWellCoords, open, isMapReady]);\n\n // NOTE: Well markers\n useEffect(() => {\n if (!mapRef.current || !isMapReady || !open) {\n return undefined;\n }\n\n const prevWells = prevWellsRef.current;\n prevWellsRef.current = wells;\n\n const offsetWellIds = offsetWells.map(well => well.id);\n const sortedWells = sortBy(wells, well => offsetWellIds.includes(well.id));\n\n const features = [];\n const wellsById = {};\n const bounds = new mapboxgl.LngLatBounds();\n sortedWells.forEach(well => {\n const coords = get(well, coordsDataPath);\n\n if (coords && isValidCoordinates(coords)) {\n const isWellSubject = subjectWell && subjectWell.id === well.id;\n const isWellOffset = offsetWellIds.includes(well.id);\n const r = isWellSubject ? DEFAULT_SUBJECT_WELL_MARKER_SIZE : DEFAULT_WELL_MARKER_SIZE;\n const color =\n isWellSubject || isWellOffset\n ? OFFSET_WELL_COLOR\n : get(formationColors, well.formation, '#BDBDBD');\n const opacity = isWellSubject || isWellOffset ? 1 : 0.3;\n\n wellsById[well.id] = well;\n bounds.extend(toLngLat(coords));\n features.push({\n type: 'Feature',\n geometry: { type: 'Point', coordinates: toLngLat(coords) },\n // NOTE: sortKey keeps offset wells rendered on top (was sortedWells insertion order)\n properties: { wellId: well.id, radius: r, color, opacity, sortKey: isWellOffset ? 1 : 0 },\n });\n }\n });\n\n mapRef.current.getSource(WELLS_ID).setData({ type: 'FeatureCollection', features });\n markersBoundsRef.current = features.length ? bounds : null;\n\n const map = mapRef.current;\n let hoveredWellId = null;\n\n const handleMouseMove = e => {\n map.getCanvas().style.cursor = 'pointer';\n\n const well = wellsById[e.features[0].properties.wellId];\n if (!well || well.id === hoveredWellId) {\n return;\n }\n hoveredWellId = well.id;\n\n if (popUpFormatter) {\n // Container to put React generated content in.\n const popUpContainer = document.createElement('div');\n const popUpContent = createElement(popUpFormatter, {\n well,\n color: get(formationColors, well.formation, '#BDBDBD'),\n });\n // NOTE: Custom popup may have buttons\n ReactDOM.render(<>{popUpContent}</>, popUpContainer);\n\n if (!popupRef.current) {\n popupRef.current = new mapboxgl.Popup({ closeButton: false, maxWidth: 'none' });\n }\n popupRef.current\n .setLngLat(toLngLat(get(well, coordsDataPath)))\n .setDOMContent(popUpContainer)\n .addTo(map);\n }\n };\n\n const handleMouseLeave = () => {\n hoveredWellId = null;\n map.getCanvas().style.cursor = '';\n popupRef.current?.remove();\n };\n\n const handleClick = e => {\n const { wellId } = e.features[0].properties;\n const isWellSubject = subjectWell && subjectWell.id === wellId;\n const isWellOffset = offsetWellIds.includes(wellId);\n\n if (isWellOffset && !isWellSubject) {\n onDeleteOffsetWell(wellId);\n } else {\n onAddOffsetWell(wellId);\n }\n };\n\n map.on('mousemove', WELLS_ID, handleMouseMove);\n map.on('mouseleave', WELLS_ID, handleMouseLeave);\n map.on('click', WELLS_ID, handleClick);\n\n setTimeout(() => {\n if (mapRef.current && radiusCircleBoundsRef.current && wells !== prevWells) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, { padding: 5 });\n }\n }, 500);\n\n return () => {\n map.off('mousemove', WELLS_ID, handleMouseMove);\n map.off('mouseleave', WELLS_ID, handleMouseLeave);\n map.off('click', WELLS_ID, handleClick);\n };\n }, [subjectWell, wells, offsetWells, open, isMapReady]);\n\n useEffect(() => {\n if (!open) return;\n\n setTimeout(() => {\n if (subjectWell) {\n if (mapRef.current && radiusCircleBoundsRef.current) {\n mapRef.current.fitBounds(radiusCircleBoundsRef.current, {\n padding: 5,\n });\n }\n } else if (mapRef.current && markersBoundsRef.current) {\n mapRef.current.fitBounds(markersBoundsRef.current);\n }\n }, 500);\n }, [radius, subjectWell, open, isMapReady]);\n\n return (\n <div className={styles.map}>\n <div className={styles.mapMain} ref={mapContainerRef} />\n </div>\n );\n}\n\nWellsMap.propTypes = {\n open: PropTypes.bool.isRequired,\n subjectWell: PropTypes.shape({\n id: PropTypes.number,\n formation: PropTypes.string,\n }),\n wells: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n offsetWells: PropTypes.arrayOf(PropTypes.shape({})),\n radius: PropTypes.number.isRequired,\n formationColors: PropTypes.shape({}).isRequired,\n popUpFormatter: PropTypes.func,\n coordsDataPath: PropTypes.string,\n onAddOffsetWell: PropTypes.func.isRequired,\n onDeleteOffsetWell: PropTypes.func.isRequired,\n};\n\nWellsMap.defaultProps = {\n subjectWell: null,\n popUpFormatter: null,\n coordsDataPath: 'settings.top_hole.coordinates',\n offsetWells: null,\n};\n\nexport default memo(WellsMap);\n"],"names":["isValidCoordinates","mapbox","DEFAULT_COORDS","EMPTY_FEATURE_COLLECTION","type","features","toLngLat","_ref","_ref2","_slicedToArray","lat","WellsMap","_ref5","open","subjectWell","wells","offsetWells","radius","formationColors","popUpFormatter","coordsDataPath","onAddOffsetWell","onDeleteOffsetWell","mapContainerRef","useRef","mapRef","radiusCircleBoundsRef","markersBoundsRef","popupRef","prevWellsRef","useState","_useState2","_useState","isMapReady","setIsMapReady","subjectWellCoords","useMemo","get","useEffect","IS_MAPBOX_ENABLED","current","mapboxgl","Map","container","style","center","zoom","attributionControl","scrollZoom","addControl","NavigationControl","showCompass","on","addSource","data","addLayer","id","source","paint","layout","remove","getSource","setData","ring","_ref3","radiusMeters","_ref4","lng","points","distanceX","Math","cos","PI","distanceY","i","theta","push","sin","makeCirclePolygon","geometry","coordinates","reduce","bounds","coord","extend","LngLatBounds","prevWells","offsetWellIds","map","well","sortedWells","sortBy","includes","wellsById","forEach","coords","isWellSubject","isWellOffset","r","color","formation","opacity","properties","wellId","sortKey","length","hoveredWellId","handleMouseMove","e","getCanvas","cursor","popUpContainer","document","createElement","popUpContent","ReactDOM","render","_jsx","_Fragment","children","Popup","closeButton","maxWidth","setLngLat","setDOMContent","addTo","handleMouseLeave","_popupRef$current","handleClick","setTimeout","fitBounds","padding","off","className","styles","mapMain","ref","propTypes","PropTypes","bool","isRequired","shape","number","string","arrayOf","func","defaultProps","memo"],"mappings":"gkBAYA,IAAQA,EAAuBC,EAAvBD,mBAEFE,EAAiB,CAAC,WAAY,WAS9BC,EAA2B,CAAEC,KAAM,oBAAqBC,SAAU,IAElEC,EAAW,SAAHC,GAAA,IAAAC,EAAAC,EAAAF,EAAA,GAAKG,EAAGF,EAAA,GAAK,MAAM,CAANA,EAAA,GAAYE,EAAI,EAe3C,SAASC,EAWNC,GAAA,IAVDC,IAAAA,KACAC,IAAAA,YACAC,IAAAA,MACAC,IAAAA,YACAC,IAAAA,OACAC,IAAAA,gBACAC,IAAAA,eACAC,IAAAA,eACAC,IAAAA,gBACAC,IAAAA,mBAEMC,EAAkBC,EAAO,MACzBC,EAASD,IACTE,EAAwBF,EAAO,MAC/BG,EAAmBH,EAAO,MAC1BI,EAAWJ,EAAO,MAClBK,EAAeL,IACeM,EAAAA,GAAS,GAAMC,EAAAtB,EAAAuB,EAAA,GAA5CC,EAAUF,EAAA,GAAEG,EAAaH,EAAA,GAE1BI,E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,EAAUG,MAAM,CAAA,IAAKD,WAC9C5H,YAAa0H,EAAUM,QAAQN,EAAUG,MAAM,CAAE,IACjD5H,OAAQyH,EAAUI,OAAOF,WACzB1H,gBAAiBwH,EAAUG,MAAM,CAAA,GAAID,WACrCzH,eAAgBuH,EAAUO,KAC1B7H,eAAgBsH,EAAUK,OAC1B1H,gBAAiBqH,EAAUO,KAAKL,WAChCtH,mBAAoBoH,EAAUO,KAAKL,YAGrCjI,EAASuI,aAAe,CACtBpI,YAAa,KACbK,eAAgB,KAChBC,eAAgB,gCAChBJ,YAAa,MAGf,IAAemI,EAAAA,EAAKxI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffsetWellMap.d.ts","sourceRoot":"","sources":["../../../../../../src/components/OffsetWellPickerV5/components/Map/OffsetWellMap/OffsetWellMap.tsx"],"names":[],"mappings":"AAGA,OAAO,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AASlE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAS1D,KAAK,iBAAiB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,sBAAsB,EAAE,CAAC,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,UAAU,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9E,kBAAkB,EAAE,CAClB,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,EACvB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,KAC7C,IAAI,CAAC;IACV,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACrC,sBAAsB,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACvD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,kEAAkE;IAClE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAAE,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CAAC;AAE1E,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"OffsetWellMap.d.ts","sourceRoot":"","sources":["../../../../../../src/components/OffsetWellPickerV5/components/Map/OffsetWellMap/OffsetWellMap.tsx"],"names":[],"mappings":"AAGA,OAAO,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AASlE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAS1D,KAAK,iBAAiB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,sBAAsB,EAAE,CAAC,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,UAAU,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9E,kBAAkB,EAAE,CAClB,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,EACvB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,KAC7C,IAAI,CAAC;IACV,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACrC,sBAAsB,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACvD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,kEAAkE;IAClE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAAE,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CAAC;AAE1E,eAAO,MAAM,aAAa,oHAmKxB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import{
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{forwardRef as l,useCallback as i}from"react";import t from"@vis.gl/react-mapbox";import a from"classnames";import"mapbox-gl/dist/mapbox-gl.css";import{MapLayers as n}from"./components/MapLayers/MapLayers.js";import{MapOverlayControls as r}from"./components/MapOverlayControls/MapOverlayControls.js";import{MapResizeVeil as d}from"./components/MapResizeVeil/MapResizeVeil.js";import{useFlyToWell as c}from"./hooks/useFlyToWell.js";import{useIsMapCompact as p}from"./hooks/useIsMapCompact.js";import{useMapResizeOnContainer as m}from"./hooks/useMapResizeOnContainer.js";import{useOffsetWellMapState as u}from"./hooks/useOffsetWellMapState.js";import{MapConfig as h}from"./constants.js";import g from"./OffsetWellMap.module.css.js";import{LoaderLinear as f}from"../../../../../componentsV2/LoaderLinear/LoaderLinear.js";import{IS_MAPBOX_ENABLED as v,MAP_BOX_ACCESS_TOKEN as S}from"../../../../../config/mapbox/index.js";import"../../../../../config/mapboxGl/index.js";import y from"mapbox-gl";function O(e,o){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);o&&(l=l.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),s.push.apply(s,l)}return s}function w(o){for(var s=1;s<arguments.length;s++){var l=null!=arguments[s]?arguments[s]:{};s%2?O(Object(l),!0).forEach((function(s){e(o,s,l[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(l)):O(Object(l)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(l,e))}))}return o}var b=l((function(e,l){var O=e.subjectWell,b=void 0===O?null:O,M=e.wells,R=e.offsetWellIds,C=e.handleChangeOffsetWell,W=e.onBatchSelectWells,j=e.activeWellId,D=e.isClickable,L=void 0===D||D,Z=e.selectionZone,I=e.onSelectionZoneConfirm,x=e.shouldRecenter,P=e.onRecenterComplete,A=e.isResizing,E=void 0!==A&&A,T=e.classes,k=void 0===T?{}:T,N=u({subjectWell:b,wells:M,offsetWellIds:R,handleChangeOffsetWell:C,onBatchSelectWells:W,activeWellId:null!=j?j:null,isClickable:L,selectionZone:Z,onSelectionZoneConfirm:I,shouldRecenter:x,onRecenterComplete:P});c(l,N.mapRef,M,N.isMapReady);var V=N.showRadiusInput&&null!==N.drawingRadiusMiles,G=p(),z=G.ref,J=G.isCompact&&V,H=m(N.mapRef,E),B=i((function(e){z(e),H(e)}),[z,H]),U=a(g.mapView,k.root);return v?s("div",{ref:B,className:U,children:[s(t,w(w({ref:N.mapRef},N.viewState),{},{onMove:N.handleMove,onMoveStart:N.handleMoveStart,onMoveEnd:N.handleMoveEnd,onResize:N.tileSafeOnResize,onLoad:N.handleMapLoad,mapboxAccessToken:S,mapLib:y,mapStyle:h.Styles[N.mapStyle],style:{borderRadius:"8px"},scrollZoom:!0,doubleClickZoom:!0,boxZoom:!1,attributionControl:!1,interactiveLayerIds:[h.LayerIds.WellsClusters,h.LayerIds.WellsUnclustered],onClick:N.handleMapClick,onMouseMove:N.handleMouseMove,onMouseLeave:N.handleMouseLeave,onDblClick:N.handleZoomInWithSync,onDragStart:N.handleDragStart,onDragEnd:N.handleDragEnd,onMouseDown:N.handleMouseDown,cursor:N.cursor,children:[(N.isTileLoading&&!N.isTooZoomedOut||N.isAllWellsLoading)&&o(f,{type:"fancy",size:"medium",className:g.mapLoader}),o(n,{wellsGeoJSON:N.wellsGeoJSON,highlightGeoJSON:N.highlightGeoJSON,activeHighlightGeoJSON:N.activeHighlightGeoJSON,loadingTilesGeoJSON:N.loadingTilesGeoJSON,hoveredWell:N.hoveredWell,mapStyle:N.mapStyle,isSatellite:N.isSatellite,clusterColorExpression:N.clusterColorExpression,isRadiusToolActive:N.isRadiusToolActive,radiusState:N.radiusState,radiusDrawingPreviewCircle:N.radiusDrawingPreviewCircle,isRadiusHoveringEdge:N.isRadiusHoveringEdge,isRadiusDrawingDragging:N.isRadiusDrawingDragging,showGhostZone:N.showGhostZone,selectionZone:Z,isTooZoomedOut:N.isTooZoomedOut,isLoadAllWells:N.isLoadAllWells,isActiveWellIsSubjectWell:N.isActiveWellIsSubjectWell,isLassoActive:N.isLassoActive,isMapReady:N.isMapReady,polygonCoords:N.polygonCoords,drawRef:N.drawRef,handleDrawCreate:N.handleDrawCreate,handleDrawUpdate:N.handleDrawUpdate,handleDrawDelete:N.handleDrawDelete,handleModeChange:N.handleModeChange,handleSelectionChange:N.handleSelectionChange,subjectWellCoords:N.subjectWellCoords,subjectWell:b,handleSubjectWellMouseEnter:N.handleSubjectWellMouseEnter,handleSubjectWellMouseLeave:N.handleSubjectWellMouseLeave,hoveredCluster:N.hoveredCluster,tooltipAnchor:N.tooltipAnchor,tooltipOffset:N.tooltipOffset,isViewOnly:N.isViewOnly,isClickable:L})]})),o(d,{isResizing:E}),o(r,{showRadiusInput:N.showRadiusInput,drawingRadiusMiles:N.drawingRadiusMiles,setDrawingRadiusMiles:N.setDrawingRadiusMiles,isSatellite:N.isSatellite,handleZoomInWithSync:N.handleZoomInWithSync,handleZoomOutWithSync:N.handleZoomOutWithSync,handleResetZoom:N.handleResetZoom,canZoomIn:N.canZoomIn,canZoomOut:N.canZoomOut,isZoomReset:N.isZoomReset,isRadiusToolActive:N.isRadiusToolActive,handleRadiusToggle:N.handleRadiusToggle,isLassoActive:N.isLassoActive,handleLassoToggle:N.handleLassoToggle,distance:N.distance,mapStyle:N.mapStyle,setMapStyle:N.setMapStyle,isViewOnly:N.isViewOnly,hintsRef:N.hintsRef,hintsMode:N.hintsMode,areHintsCompact:J,boxState:N.boxState,isDrawing:N.isDrawing,drawingPointCount:N.drawingPointCount,isEditingPolygon:N.isEditingPolygon,isEditingVertices:N.isEditingVertices,hasValidPolygon:!!N.hasValidPolygon,effectiveZoomedOut:N.effectiveZoomedOut,isLoadAllWells:N.isLoadAllWells,lassoPhase:N.lassoState.phase,radiusPhase:N.radiusState.phase,wellsInBoxCount:N.wellsInBoxCount,toast:N.toast})]}):o("div",{className:U})}));b.displayName="OffsetWellMap";export{b as OffsetWellMap};
|
|
2
2
|
//# sourceMappingURL=OffsetWellMap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapPreloader.d.ts","sourceRoot":"","sources":["../../../../../src/components/OffsetWellPickerV5/components/MapPreloader/MapPreloader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAQ,MAAM,OAAO,CAAC;AAEjC,OAAO,8BAA8B,CAAC;AAUtC;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"MapPreloader.d.ts","sourceRoot":"","sources":["../../../../../src/components/OffsetWellPickerV5/components/MapPreloader/MapPreloader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAQ,MAAM,OAAO,CAAC;AAEjC,OAAO,8BAA8B,CAAC;AAUtC;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,EAmBzB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{memo as o}from"react";import e from"@vis.gl/react-mapbox";import"mapbox-gl/dist/mapbox-gl.css";import{MapConfig as r}from"../Map/OffsetWellMap/constants.js";import"../../stores/user-settings-store/UserSettingsStoreProvider.js";import{useUserSettingsStore as s}from"../../stores/user-settings-store/useUserSettingsStore.js";import"../../stores/user-settings-store/UserSettingsStoreContext.js";import i from"./MapPreloader.module.css.js";import{MAP_BOX_ACCESS_TOKEN as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{memo as o}from"react";import e from"@vis.gl/react-mapbox";import"mapbox-gl/dist/mapbox-gl.css";import{MapConfig as r}from"../Map/OffsetWellMap/constants.js";import"../../stores/user-settings-store/UserSettingsStoreProvider.js";import{useUserSettingsStore as s}from"../../stores/user-settings-store/useUserSettingsStore.js";import"../../stores/user-settings-store/UserSettingsStoreContext.js";import i from"./MapPreloader.module.css.js";import{IS_MAPBOX_ENABLED as m,MAP_BOX_ACCESS_TOKEN as a}from"../../../../config/mapbox/index.js";import"../../../../config/mapboxGl/index.js";import n from"mapbox-gl";var l=o((function(){var o,l=null!==(o=s((function(t){return t.settings.mapStyle})))&&void 0!==o?o:"satellite";return m?t("div",{className:i.container,children:t(e,{mapboxAccessToken:a,mapLib:n,mapStyle:r.Styles[l],longitude:r.DefaultCoords.longitude,latitude:r.DefaultCoords.latitude,zoom:r.Zoom.Initial,interactive:!1,attributionControl:!1})}):null}));l.displayName="MapPreloader";export{l as MapPreloader};
|
|
2
2
|
//# sourceMappingURL=MapPreloader.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/slicedToArray";import{useState as t,useEffect as i,useRef as o}from"react";import n from"react-dom";import{isEqual as s}from"lodash";import{MuiThemeProvider as l}from"@material-ui/core/styles";import m from"../components/FiltersToggler.js";import{getStartComponent as u,getMiddleComponent as a,getEndComponents as p}from"../utils.js";import{LARGE_SIZE_LAYOUT as c,MEDIUM_SIZE_LAYOUT as h,SMALL_SIZE_LAYOUT as d}from"../constants.js";import{darkTheme as f}from"../../../config/theme/index.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/helpers/typeof";import"@babel/runtime/regenerator";import"highcharts";import"highcharts/highcharts-more";import"highcharts/modules/solid-gauge";import"highcharts/modules/heatmap";import"highcharts/modules/boost";import"highcharts/modules/exporting";import"highcharts/modules/xrange";import"highcharts/modules/dumbbell";import"highcharts/modules/pattern-fill";import"highcharts/modules/annotations";import"highcharts-multicolor-series";import"dompurify";import"@babel/runtime/helpers/createClass";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/assertThisInitialized";import"@babel/runtime/helpers/inherits";import"@babel/runtime/helpers/possibleConstructorReturn";import"@babel/runtime/helpers/getPrototypeOf";import"@babel/runtime/helpers/toArray";import"@babel/runtime/helpers/toConsumableArray";import"../../../clients/subscriptions/constants.js";import"../../../clients/subscriptions.v1.js";import"../../../clients/subscriptions/subscriptions-client.factory.js";import"../../../config/extendNative.js";import{jsx as b}from"react/jsx-runtime";function
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/slicedToArray";import{useState as t,useEffect as i,useRef as o}from"react";import n from"react-dom";import{isEqual as s}from"lodash";import{MuiThemeProvider as l}from"@material-ui/core/styles";import m from"../components/FiltersToggler.js";import{getStartComponent as u,getMiddleComponent as a,getEndComponents as p}from"../utils.js";import{LARGE_SIZE_LAYOUT as c,MEDIUM_SIZE_LAYOUT as h,SMALL_SIZE_LAYOUT as d}from"../constants.js";import{darkTheme as f}from"../../../config/theme/index.js";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/helpers/typeof";import"@babel/runtime/regenerator";import"highcharts";import"highcharts/highcharts-more";import"highcharts/modules/solid-gauge";import"highcharts/modules/heatmap";import"highcharts/modules/boost";import"highcharts/modules/exporting";import"highcharts/modules/xrange";import"highcharts/modules/dumbbell";import"highcharts/modules/pattern-fill";import"highcharts/modules/annotations";import"highcharts-multicolor-series";import"dompurify";import"../../../config/mapbox/index.js";import"@babel/runtime/helpers/createClass";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/assertThisInitialized";import"@babel/runtime/helpers/inherits";import"@babel/runtime/helpers/possibleConstructorReturn";import"@babel/runtime/helpers/getPrototypeOf";import"@babel/runtime/helpers/toArray";import"@babel/runtime/helpers/toConsumableArray";import"../../../clients/subscriptions/constants.js";import"../../../clients/subscriptions.v1.js";import"../../../clients/subscriptions/subscriptions-client.factory.js";import"../../../config/extendNative.js";import{jsx as b}from"react/jsx-runtime";function g(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function v(r){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?g(Object(i),!0).forEach((function(t){e(r,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):g(Object(i)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))}))}return r}function y(e,o,n,s){var l=t(null),m=r(l,2),f=m[0],b=m[1];return i((function(){if(s&&o){var r=u(e),t=a(e),i=p(e),l=r&&t&&!i,m=r&&!t&&i,f=r&&t&&i;if(r&&!t&&!i){var g=o[r.key];if(g<=s)return void b(c);if(g<=s/2)return void b(h)}else if(l||m){var v=o[r.key],y=l?o[t.key]:o[i.key];if(v+y<=s)return void b(c);if(n+y<=s)return void b(h)}else if(f){var j=o[r.key],O=o[t.key],k=o[i.key];if(j+O+k<=s)return void b(c);if(n+O+k<=s)return void b(h);if(n+k<=s)return void b(d)}b(d)}}),[o,s]),f}function j(n){var l=o(),m=t(null),u=r(m,2),a=u[0],p=u[1],c=o({}),h=n.filter((function(e){return!!e})),d=b("div",{ref:l,style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:h.map((function(e,r){return b("div",{"data-key":null==e?void 0:e.key,style:{position:"absolute"},children:e},r)}))});return i((function(){var r;if(!s(h,c.current)){var t=Array.from(null===(r=l.current)||void 0===r?void 0:r.childNodes).reduce((function(r,t){var i,o=null==t||null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"data-key"),n=null==t?void 0:t.getBoundingClientRect().width;return v(v({},r),{},e({},o,n))}),{});Object.values(t).length===h.length&&(s(a,t)||p(t)),c.current=h}})),{componentsWidth:a,hiddenElements:d}}function O(){var e=t(null),o=r(e,2),s=o[0],u=o[1];return i((function(){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",document.body.appendChild(e),n.render(b(l,{theme:f,children:b(m,{})}),e,(function(){var r=e.getBoundingClientRect();e.remove(),u(r.width)}))}),[]),s}export{O as useAppFilterTogglerWidth,j as useComonentsWidth,y as useFilterLayout};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|