Skip to content

Commit

Permalink
feat: move layers file to features directory
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeperrault committed Oct 30, 2024
1 parent 5b56090 commit 741905c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import type { BaseMapChildrenProps } from '@features/map/BaseMap'
import type { VectorLayerWithName } from 'domain/types/layer'
import type { Geometry } from 'ol/geom'

export function DashboardLayer({ map }: BaseMapChildrenProps) {
export function ActiveDashboardLayer({ map }: BaseMapChildrenProps) {
const displayDashboardLayer = useAppSelector(state => state.global.displayDashboardLayer)

const activeDashboardId = useAppSelector(state => state.dashboard.activeDashboardId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { useGetDashboardsQuery } from '@api/dashboardsAPI'
import { selectDashboardOnMap } from '@features/Dashboard/useCases/selectDashboardOnMap'
import { useAppDispatch } from '@hooks/useAppDispatch'
import { useAppSelector } from '@hooks/useAppSelector'
import { OPENLAYERS_PROJECTION, THEME, WSG84_PROJECTION } from '@mtes-mct/monitor-ui'
import { Layers } from 'domain/entities/layers/constants'
import { convertToFeature } from 'domain/types/map'
import { Feature } from 'ol'
import { getCenter } from 'ol/extent'
Expand All @@ -11,11 +14,7 @@ import VectorSource from 'ol/source/Vector'
import { Icon, Style } from 'ol/style'
import { useEffect, useRef, type MutableRefObject } from 'react'

import { Layers } from '../../../../domain/entities/layers/constants'
import { useAppDispatch } from '../../../../hooks/useAppDispatch'
import { useAppSelector } from '../../../../hooks/useAppSelector'

import type { BaseMapChildrenProps } from '../../BaseMap'
import type { BaseMapChildrenProps } from '@features/map/BaseMap'
import type { VectorLayerWithName } from 'domain/types/layer'

export function DashboardsLayer({ map, mapClickEvent }: BaseMapChildrenProps) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import { Dashboard } from '@features/Dashboard/types'
import { getAMPFeature } from '@features/map/layers/AMP/AMPGeometryHelpers'
import { getAMPLayerStyle } from '@features/map/layers/AMP/AMPLayers.style'
import { getRegulatoryFeature } from '@features/map/layers/Regulatory/regulatoryGeometryHelpers'
import { getRegulatoryLayerStyle } from '@features/map/layers/styles/administrativeAndRegulatoryLayers.style'
import { measurementStyle, measurementStyleWithCenter } from '@features/map/layers/styles/measurement.style'
import { overlayStroke } from '@features/map/overlays/style'
import { getReportingZoneFeature } from '@features/Reportings/components/ReportingLayer/Reporting/reportingsGeometryHelpers'
import { editingReportingStyleFn } from '@features/Reportings/components/ReportingLayer/Reporting/style'
import { getVigilanceAreaLayerStyle } from '@features/VigilanceArea/components/VigilanceAreaLayer/style'
import { getVigilanceAreaZoneFeature } from '@features/VigilanceArea/components/VigilanceAreaLayer/vigilanceAreaGeometryHelper'
import { OPENLAYERS_PROJECTION, WSG84_PROJECTION } from '@mtes-mct/monitor-ui'
import { useAppDispatch } from '@hooks/useAppDispatch'
import { useAppSelector } from '@hooks/useAppSelector'
import { WSG84_PROJECTION, OPENLAYERS_PROJECTION } from '@mtes-mct/monitor-ui'
import { Layers } from 'domain/entities/layers/constants'
import { getOverlayCoordinates } from 'domain/shared_slices/Global'
import { Feature } from 'ol'
import { GeoJSON as OLGeoJSON } from 'ol/format'
import { type Geometry } from 'ol/geom'
import { GeoJSON } from 'ol/format'
import VectorLayer from 'ol/layer/Vector'
import VectorSource from 'ol/source/Vector'
import { useEffect, useRef, type MutableRefObject } from 'react'

import { Layers } from '../../../../domain/entities/layers/constants'
import { useAppDispatch } from '../../../../hooks/useAppDispatch'
import { useAppSelector } from '../../../../hooks/useAppSelector'
import { getAMPFeature } from '../AMP/AMPGeometryHelpers'
import { getAMPLayerStyle } from '../AMP/AMPLayers.style'
import { getRegulatoryFeature } from '../Regulatory/regulatoryGeometryHelpers'
import { getRegulatoryLayerStyle } from '../styles/administrativeAndRegulatoryLayers.style'
import { measurementStyle, measurementStyleWithCenter } from '../styles/measurement.style'

import type { BaseMapChildrenProps } from '../../BaseMap'
import { useRef, type MutableRefObject, useEffect } from 'react'

import type { BaseMapChildrenProps } from '@features/map/BaseMap'
import type { VectorLayerWithName } from 'domain/types/layer'
import type { Geometry } from 'ol/geom'

export function SelectedDashboardLayer({ map }: BaseMapChildrenProps) {
const dispatch = useAppDispatch()
Expand Down Expand Up @@ -72,7 +71,7 @@ export function SelectedDashboardLayer({ map }: BaseMapChildrenProps) {
useEffect(() => {
dashboardDatasVectorSourceRef.current.clear(true)
if (selectedDashboardOnMap) {
const geoJSON = new OLGeoJSON()
const geoJSON = new GeoJSON()

const geometry = geoJSON.readGeometry(selectedDashboardOnMap.geom, {
dataProjection: WSG84_PROJECTION,
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/features/map/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { DashboardLayer } from '@features/Dashboard/components/Layers'
import { ActiveDashboardLayer } from '@features/Dashboard/components/Layers/ActiveDashboardLayer'
import { DashboardsLayer } from '@features/Dashboard/components/Layers/DashboardsLayer'
import { DrawDashboardLayer } from '@features/Dashboard/components/Layers/DrawDashboardLayer'
import { DashboardPreviewLayer } from '@features/Dashboard/components/Layers/PreviewDashboardLayer'
import { DashboardReportingOverlay } from '@features/Dashboard/components/Layers/ReportingOverlay'
import { SelectedDashboardLayer } from '@features/Dashboard/components/Layers/SelectedDashboardLayer'
import { LayersOverlay } from '@features/layersSelector/overlays'
import { LayerEvents } from '@features/layersSelector/overlays/LayerEvents'
import { VigilanceAreasLayer } from '@features/VigilanceArea/components/VigilanceAreaLayer'
Expand All @@ -16,8 +18,6 @@ import { MapCoordinatesBox } from './controls/MapCoordinatesBox'
import { AdministrativeLayers } from './layers/AdministrativeLayers'
import { AMPLayers } from './layers/AMP'
import { AMPPreviewLayer } from './layers/AMP/AMPPreviewLayer'
import { DashboardsLayer } from './layers/Dashboards'
import { SelectedDashboardLayer } from './layers/Dashboards/SelectedDashboardLayer'
import { DrawLayer } from './layers/DrawLayer'
import { MapLayer } from './layers/MapLayer'
import { MeasurementLayer } from './layers/MeasurementLayer'
Expand Down Expand Up @@ -218,7 +218,7 @@ export function Map({ isSuperUser }) {
{/* @ts-ignore */}
<DrawDashboardLayer />
{/* @ts-ignore */}
<DashboardLayer />
<ActiveDashboardLayer />
{/* @ts-ignore */}
<DashboardPreviewLayer />
{/* @ts-ignore */}
Expand Down

0 comments on commit 741905c

Please sign in to comment.