From f2ced327e58343ecc4ed91f7a48fd107a398a250 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mi=C5=82osz=20Grocholewski?= <m.grocholewski@atcomp.pl>
Date: Fri, 11 Oct 2024 08:29:37 +0200
Subject: [PATCH] chore: delete duplicated file getMutliPolygons

---
 .../utils/shapes/getMultiPolygons.test.ts     | 235 ------------------
 .../utils/shapes/getMultiPolygons.ts          |  40 ---
 2 files changed, 275 deletions(-)
 delete mode 100644 src/components/Map/MapViewer/MapViewerVector/utils/shapes/getMultiPolygons.test.ts
 delete mode 100644 src/components/Map/MapViewer/MapViewerVector/utils/shapes/getMultiPolygons.ts

diff --git a/src/components/Map/MapViewer/MapViewerVector/utils/shapes/getMultiPolygons.test.ts b/src/components/Map/MapViewer/MapViewerVector/utils/shapes/getMultiPolygons.test.ts
deleted file mode 100644
index e83f8e1a..00000000
--- a/src/components/Map/MapViewer/MapViewerVector/utils/shapes/getMultiPolygons.test.ts
+++ /dev/null
@@ -1,235 +0,0 @@
-/* eslint-disable no-magic-numbers */
-import getPolygonCoords from '@/components/Map/MapViewer/MapViewerVector/utils/shapes/getPolygonCoords';
-import getEllipseCoords from '@/components/Map/MapViewer/MapViewerVector/utils/shapes/getEllipseCoords';
-import Polygon from 'ol/geom/Polygon';
-import { Shape } from '@/types/models';
-import getMultiPolygons from './getMultiPolygons';
-
-jest.mock('./getPolygonCoords');
-jest.mock('./getEllipseCoords');
-
-describe('getMultiPolygons', () => {
-  const mockPointToProjection = jest.fn(point => [point.x, point.y]);
-
-  beforeEach(() => {
-    jest.clearAllMocks();
-  });
-
-  it('should return an array of Polygons for POLYGON shapes', () => {
-    const x = 10;
-    const y = 20;
-    const width = 100;
-    const height = 200;
-
-    const shapes: Shape[] = [
-      {
-        type: 'POLYGON',
-        points: [
-          {
-            type: 'REL_ABS_POINT',
-            absoluteX: 0.0,
-            absoluteY: 0.0,
-            relativeX: 0.0,
-            relativeY: 0.0,
-            relativeHeightForX: null,
-            relativeWidthForY: null,
-          },
-          {
-            type: 'REL_ABS_POINT',
-            absoluteX: 0.0,
-            absoluteY: 0.0,
-            relativeX: 75.0,
-            relativeY: 0.0,
-            relativeHeightForX: null,
-            relativeWidthForY: null,
-          },
-          {
-            type: 'REL_ABS_POINT',
-            absoluteX: 0.0,
-            absoluteY: 0.0,
-            relativeX: 100.0,
-            relativeY: 100.0,
-            relativeHeightForX: null,
-            relativeWidthForY: null,
-          },
-          {
-            type: 'REL_ABS_POINT',
-            absoluteX: 0.0,
-            absoluteY: 0.0,
-            relativeX: 25.0,
-            relativeY: 100.0,
-            relativeHeightForX: null,
-            relativeWidthForY: null,
-          },
-        ],
-      },
-    ];
-
-    const mockPolygonCoords = [
-      [
-        [0, 0],
-        [2, 0],
-        [2, 2],
-        [0, 2],
-      ],
-    ];
-    (getPolygonCoords as jest.Mock).mockReturnValue(mockPolygonCoords);
-
-    const result = getMultiPolygons({
-      x,
-      y,
-      width,
-      height,
-      shapes,
-      pointToProjection: mockPointToProjection,
-    });
-
-    expect(result).toHaveLength(1);
-    expect(result[0]).toBeInstanceOf(Polygon);
-    expect(result[0].getCoordinates()).toEqual([mockPolygonCoords]);
-
-    expect(getPolygonCoords).toHaveBeenCalledTimes(1);
-  });
-
-  it('should return an array of Polygons for ELLIPSE shapes', () => {
-    const x = 30;
-    const y = 40;
-    const width = 100;
-    const height = 200;
-
-    const shapes: Shape[] = [
-      {
-        type: 'ELLIPSE',
-        center: {
-          type: 'REL_ABS_POINT',
-          absoluteX: 0.0,
-          absoluteY: 0.0,
-          relativeX: 50.0,
-          relativeY: 50.0,
-          relativeHeightForX: null,
-          relativeWidthForY: null,
-        },
-        radius: {
-          type: 'REL_ABS_RADIUS',
-          absoluteX: -7.0,
-          absoluteY: -7.0,
-          relativeX: 50.0,
-          relativeY: 50.0,
-        },
-      },
-    ];
-
-    const mockEllipseCoords = [
-      [
-        [0, 0],
-        [30, 0],
-        [45, 60],
-        [30, 120],
-        [0, 120],
-        [-15, 60],
-      ],
-    ];
-    (getEllipseCoords as jest.Mock).mockReturnValue(mockEllipseCoords);
-
-    const result = getMultiPolygons({
-      x,
-      y,
-      width,
-      height,
-      shapes,
-      pointToProjection: mockPointToProjection,
-    });
-
-    expect(result).toHaveLength(1);
-    expect(result[0]).toBeInstanceOf(Polygon);
-    expect(result[0].getCoordinates()).toEqual([mockEllipseCoords]);
-
-    expect(getEllipseCoords).toHaveBeenCalledTimes(1);
-  });
-
-  it('should handle multiple shapes (POLYGON and ELLIPSE)', () => {
-    const x = 10;
-    const y = 20;
-    const width = 100;
-    const height = 200;
-
-    const shapes: Shape[] = [
-      {
-        type: 'ELLIPSE',
-        center: {
-          type: 'REL_ABS_POINT',
-          absoluteX: 0.0,
-          absoluteY: 0.0,
-          relativeX: 50.0,
-          relativeY: 50.0,
-          relativeHeightForX: null,
-          relativeWidthForY: null,
-        },
-        radius: {
-          type: 'REL_ABS_RADIUS',
-          absoluteX: -7.0,
-          absoluteY: -7.0,
-          relativeX: 50.0,
-          relativeY: 50.0,
-        },
-      },
-      {
-        type: 'POLYGON',
-        points: [
-          {
-            type: 'REL_ABS_POINT',
-            absoluteX: 7.0,
-            absoluteY: 0.0,
-            relativeX: 50.0,
-            relativeY: 0.0,
-            relativeHeightForX: null,
-            relativeWidthForY: null,
-          },
-          {
-            type: 'REL_ABS_POINT',
-            absoluteX: -7.0,
-            absoluteY: 0.0,
-            relativeX: 50.0,
-            relativeY: 100.0,
-            relativeHeightForX: null,
-            relativeWidthForY: null,
-          },
-        ],
-      },
-    ];
-
-    const mockPolygonCoords = [
-      [
-        [0, 0],
-        [2, 0],
-        [2, 2],
-        [0, 2],
-      ],
-    ];
-    const mockEllipseCoords = [
-      [
-        [0, 0],
-        [30, 0],
-        [45, 60],
-        [30, 120],
-        [0, 120],
-        [-15, 60],
-      ],
-    ];
-    (getPolygonCoords as jest.Mock).mockReturnValue(mockPolygonCoords);
-    (getEllipseCoords as jest.Mock).mockReturnValue(mockEllipseCoords);
-
-    const result = getMultiPolygons({
-      x,
-      y,
-      width,
-      height,
-      shapes,
-      pointToProjection: mockPointToProjection,
-    });
-
-    expect(result).toHaveLength(2);
-    expect(getPolygonCoords).toHaveBeenCalledTimes(1);
-    expect(getEllipseCoords).toHaveBeenCalledTimes(1);
-  });
-});
diff --git a/src/components/Map/MapViewer/MapViewerVector/utils/shapes/getMultiPolygons.ts b/src/components/Map/MapViewer/MapViewerVector/utils/shapes/getMultiPolygons.ts
deleted file mode 100644
index ef22d7b3..00000000
--- a/src/components/Map/MapViewer/MapViewerVector/utils/shapes/getMultiPolygons.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import getPolygonCoords from '@/components/Map/MapViewer/MapViewerVector/utils/shapes/getPolygonCoords';
-import getEllipseCoords from '@/components/Map/MapViewer/MapViewerVector/utils/shapes/getEllipseCoords';
-import { UsePointToProjectionResult } from '@/utils/map/usePointToProjection';
-import Polygon from 'ol/geom/Polygon';
-import { Coordinate } from 'ol/coordinate';
-import { Shape } from '@/types/models';
-
-export default function getMultiPolygons({
-  x,
-  y,
-  width,
-  height,
-  shapes,
-  pointToProjection,
-}: {
-  x: number;
-  y: number;
-  width: number;
-  height: number;
-  shapes: Array<Shape>;
-  pointToProjection: UsePointToProjectionResult;
-}): Array<Polygon> {
-  return shapes.map(shape => {
-    let coords: Array<Coordinate> = [];
-    if (shape.type === 'POLYGON') {
-      coords = getPolygonCoords({ points: shape.points, x, y, height, width, pointToProjection });
-    } else if (shape.type === 'ELLIPSE') {
-      coords = getEllipseCoords({
-        x,
-        y,
-        center: shape.center,
-        radius: shape.radius,
-        height,
-        width,
-        pointToProjection,
-      });
-    }
-    return new Polygon([coords]);
-  });
-}
-- 
GitLab