From b16b389b22857e23bbd3229e67346cc2e5dce3a6 Mon Sep 17 00:00:00 2001 From: Maxime Perrault Date: Thu, 16 May 2024 16:41:21 +0200 Subject: [PATCH 01/14] =?UTF-8?q?[feat]=20Suppression=20de=20la=20liste=20?= =?UTF-8?q?des=20types=20de=20points=20d'int=C3=A9r=C3=AAt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/features/InterestPoint/types.ts | 4 +- .../map/layers/InterestPointLayer.tsx | 16 ++-- .../tools/interestPoint/EditInterestPoint.tsx | 80 +++++++++---------- 3 files changed, 48 insertions(+), 52 deletions(-) diff --git a/frontend/src/features/InterestPoint/types.ts b/frontend/src/features/InterestPoint/types.ts index d4cc4be0a..bf6fdd2c5 100644 --- a/frontend/src/features/InterestPoint/types.ts +++ b/frontend/src/features/InterestPoint/types.ts @@ -8,7 +8,7 @@ export type InterestPoint = { feature?: Feature name: string observations: string - type: string + // type: string uuid: string } @@ -17,7 +17,7 @@ export type NewInterestPoint = { feature?: Feature name: string | null observations: string | null - type: string | null + // type: string | null uuid: string } diff --git a/frontend/src/features/map/layers/InterestPointLayer.tsx b/frontend/src/features/map/layers/InterestPointLayer.tsx index a40c40e46..22d1c531f 100644 --- a/frontend/src/features/map/layers/InterestPointLayer.tsx +++ b/frontend/src/features/map/layers/InterestPointLayer.tsx @@ -1,7 +1,7 @@ import { usePrevious } from '@mtes-mct/monitor-ui' import GeoJSON from 'ol/format/GeoJSON' import LineString from 'ol/geom/LineString' -import Draw from 'ol/interaction/Draw' +import Draw, { DrawEvent } from 'ol/interaction/Draw' import VectorLayer from 'ol/layer/Vector' import VectorSource from 'ol/source/Vector' import { getLength } from 'ol/sphere' @@ -10,11 +10,7 @@ import { v4 as uuidv4 } from 'uuid' import { getInterestPointStyle, POIStyle } from './styles/interestPoint.style' import { InterestPointLine } from '../../../domain/entities/interestPointLine' -import { - coordinatesAreModified, - coordinatesOrTypeAreModified, - interestPointType -} from '../../../domain/entities/interestPoints' +import { coordinatesAreModified, coordinatesOrTypeAreModified } from '../../../domain/entities/interestPoints' import { Layers } from '../../../domain/entities/layers/constants' import { MapToolType, OPENLAYERS_PROJECTION } from '../../../domain/entities/map/constants' import { globalActions } from '../../../domain/shared_slices/Global' @@ -164,7 +160,7 @@ export function InterestPointLayer({ map }: BaseMapChildrenProps) { coordinates: null, name: null, observations: null, - type: null, + // type: null, uuid: uuidv4() }) ) @@ -205,20 +201,20 @@ export function InterestPointLayer({ map }: BaseMapChildrenProps) { function handleDrawEvents() { if (drawObject) { drawObject.once(DRAW_START_EVENT, event => { - function startDrawing(e, type) { + function startDrawing(e: DrawEvent) { dispatch( updateInterestPointBeingDrawed({ coordinates: e.feature.getGeometry().getLastCoordinate(), name: null, observations: null, - type, + // type, // TODO Check that. uuid: interestPointBeingDrawed!.uuid }) ) } - startDrawing(event, interestPointBeingDrawed?.type ?? interestPointType.OTHER) + startDrawing(event) }) drawObject.once(DRAW_ABORT_EVENT, () => { diff --git a/frontend/src/features/map/tools/interestPoint/EditInterestPoint.tsx b/frontend/src/features/map/tools/interestPoint/EditInterestPoint.tsx index 77c69e772..c6aafd602 100644 --- a/frontend/src/features/map/tools/interestPoint/EditInterestPoint.tsx +++ b/frontend/src/features/map/tools/interestPoint/EditInterestPoint.tsx @@ -1,10 +1,9 @@ -import { Label, MultiRadio, type Option } from '@mtes-mct/monitor-ui' +import { Label } from '@mtes-mct/monitor-ui' import { boundingExtent } from 'ol/extent' import { transform, transformExtent } from 'ol/proj' import { useCallback, useMemo, useState } from 'react' import styled from 'styled-components' -import { interestPointType } from '../../../../domain/entities/interestPoints' import { CoordinatesFormat, OPENLAYERS_PROJECTION, WSG84_PROJECTION } from '../../../../domain/entities/map/constants' import { addInterestPoint, updateInterestPointKeyBeingDrawed } from '../../../../domain/shared_slices/InterestPoint' import { setFitToExtent } from '../../../../domain/shared_slices/Map' @@ -17,20 +16,20 @@ import { MapToolBox } from '../MapToolBox' import type { Coordinate } from 'ol/coordinate' -const INTEREST_POINT_OPTIONS: Array