From 209f4a8336ae70ac79f37fcb5c87210c8a833b55 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 6 Aug 2024 10:03:26 +0200 Subject: [PATCH] wip --- package.json | 6 +-- pnpm-lock.yaml | 82 ++++++++++++++++++------------- src/components/my-map/drawing.ts | 2 +- src/components/my-map/snapping.ts | 10 ++-- 4 files changed, 58 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index 63dd593..6834fe4 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,9 @@ "govuk-frontend": "^5.4.0", "jspdf": "^2.5.1", "lit": "^3.0.1", - "ol": "^9.1.0", + "ol": "^9.2.4", "ol-ext": "^4.0.21", - "ol-mapbox-style": "^12.3.0", + "ol-mapbox-style": "^12.3.4", "postcode": "^5.1.0", "proj4": "^2.11.0", "rambda": "^9.2.1" @@ -45,7 +45,7 @@ "@testing-library/user-event": "^14.5.2", "@types/file-saver": "^2.0.7", "@types/node": "22.0.3", - "@types/ol-ext": "npm:@siedlerchr/types-ol-ext@^3.3.0", + "@types/ol-ext": "npm:@siedlerchr/types-ol-ext@^3.4.0", "@types/proj4": "^2.5.5", "@vitest/ui": "^0.34.7", "happy-dom": "^9.1.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ff3ff5f..ee75cac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,14 +27,14 @@ dependencies: specifier: ^3.0.1 version: 3.0.1 ol: - specifier: ^9.1.0 - version: 9.1.0 + specifier: ^9.2.4 + version: 9.2.4 ol-ext: specifier: ^4.0.21 - version: 4.0.21(ol@9.1.0) + version: 4.0.21(ol@9.2.4) ol-mapbox-style: - specifier: ^12.3.0 - version: 12.3.0(ol@9.1.0) + specifier: ^12.3.4 + version: 12.3.4(ol@9.2.4) postcode: specifier: ^5.1.0 version: 5.1.0 @@ -48,7 +48,7 @@ dependencies: devDependencies: '@glorious/pitsby': specifier: ^1.37.2 - version: 1.37.2(@uirouter/core@6.1.0)(angular@1.8.3) + version: 1.37.2(@uirouter/core@6.1.1)(angular@1.8.3) '@testing-library/dom': specifier: ^10.4.0 version: 10.4.0 @@ -62,8 +62,8 @@ devDependencies: specifier: 22.0.3 version: 22.0.3 '@types/ol-ext': - specifier: npm:@siedlerchr/types-ol-ext@^3.3.0 - version: /@siedlerchr/types-ol-ext@3.3.0(jspdf@2.5.1) + specifier: npm:@siedlerchr/types-ol-ext@^3.4.0 + version: /@siedlerchr/types-ol-ext@3.4.0(jspdf@2.5.1) '@types/proj4': specifier: ^2.5.5 version: 2.5.5 @@ -225,7 +225,7 @@ packages: '@babel/core': 7.24.7 '@babel/helper-compilation-targets': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 - debug: 4.3.5 + debug: 4.3.6 lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -1582,7 +1582,7 @@ packages: shortid: 2.2.16 dev: true - /@glorious/pitsby@1.37.2(@uirouter/core@6.1.0)(angular@1.8.3): + /@glorious/pitsby@1.37.2(@uirouter/core@6.1.1)(angular@1.8.3): resolution: {integrity: sha512-HJe0UFdBA1Lk43AR1jGV9vF2u22Pwufk2LSd/W/PLM0F7NKBfoKR/gKySY5+dzIaPWHaDlIIfXL28i4g/ezcnA==} hasBin: true dependencies: @@ -1592,7 +1592,7 @@ packages: '@compilorama/staly': 0.4.1 '@glorious/fyzer': 0.1.10 '@glorious/rasket': 0.1.3 - '@uirouter/angularjs': 1.1.0(@uirouter/core@6.1.0)(angular@1.8.3) + '@uirouter/angularjs': 1.1.0(@uirouter/core@6.1.1)(angular@1.8.3) axios: 1.7.2 babel-loader: 8.3.0(@babel/core@7.24.7)(webpack@5.92.1) brace: 0.11.1 @@ -1913,8 +1913,8 @@ packages: dev: true optional: true - /@siedlerchr/types-ol-ext@3.3.0(jspdf@2.5.1): - resolution: {integrity: sha512-DPiiOP6sFbrE38HoLkPE9XxOq7CduQo/qWfDCCMLqzyEENGwimuC6RvDqP3zvC4lM6WNTYskYmoj2e7CVf0nKw==} + /@siedlerchr/types-ol-ext@3.4.0(jspdf@2.5.1): + resolution: {integrity: sha512-LtS9YNitiQ2UZV+RHVOS0Pehlkpcsp6qX9Sa2I33l4ZNqFCRB0T8YefGj0Se4SP8cPr1jc9+q1UU86BjFpg8ww==} peerDependencies: jspdf: ^2.5.1 dependencies: @@ -2172,19 +2172,19 @@ packages: '@types/yargs-parser': 21.0.3 dev: true - /@uirouter/angularjs@1.1.0(@uirouter/core@6.1.0)(angular@1.8.3): + /@uirouter/angularjs@1.1.0(@uirouter/core@6.1.1)(angular@1.8.3): resolution: {integrity: sha512-AhgxXhMfN6FU2HxDQqwDPbzmd6kTgvYCgV/kgoCAXfxAH6cFQrifViToC90Wdg6djBynHwA3L/KYP+iOYHkw6A==} engines: {node: '>=4.0.0'} peerDependencies: '@uirouter/core': ^6.0.8 angular: '>=1.2.0' dependencies: - '@uirouter/core': 6.1.0 + '@uirouter/core': 6.1.1 angular: 1.8.3 dev: true - /@uirouter/core@6.1.0: - resolution: {integrity: sha512-WFYh5NPAqRX4L2qlI4k62tgR6pxoqOBSW1CM1uBWCau4mAmgasYd5etJ9RoSJrSnCpCQ2km2Jltf0n5ql684MQ==} + /@uirouter/core@6.1.1: + resolution: {integrity: sha512-vA+OolBOe0R8dbFk5mgaj30LzYzOoGhMJzj356KVQcx+wKdZHUs0dnMPuuHbKe/CEbErTgFA3MfRAW96qVc2hA==} engines: {node: '>=4.0.0'} dev: true @@ -2906,7 +2906,7 @@ packages: dependencies: '@babel/runtime': 7.24.7 '@types/raf': 3.4.3 - core-js: 3.37.1 + core-js: 3.38.0 raf: 3.4.1 regenerator-runtime: 0.13.11 rgbcolor: 1.0.1 @@ -3258,8 +3258,8 @@ packages: browserslist: 4.23.1 dev: true - /core-js@3.37.1: - resolution: {integrity: sha512-Xn6qmxrQZyB0FFY8E3bgRXei3lWDJHhvI+u0q9TKIYM49G8pAr0FgnnrFRAmsbptZL1yxRADVXn+x5AGsbBfyw==} + /core-js@3.38.0: + resolution: {integrity: sha512-XPpwqEodRljce9KswjZShh95qJ1URisBeKCjUdq27YdenkslVe7OO0ZJhlYXAChW7OhXaRLl8AAba7IBfoIHug==} requiresBuild: true optional: true @@ -3512,6 +3512,18 @@ packages: ms: 2.1.2 dev: true + /debug@4.3.6: + resolution: {integrity: sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + dev: true + /decode-uri-component@0.2.2: resolution: {integrity: sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==} engines: {node: '>=0.10'} @@ -3691,8 +3703,8 @@ packages: domelementtype: 2.3.0 dev: true - /dompurify@2.5.5: - resolution: {integrity: sha512-FgbqnEPiv5Vdtwt6Mxl7XSylttCC03cqP5ldNT2z+Kj0nLxPHJH4+1Cyf5Jasxhw93Rl4Oo11qRoUV72fmya2Q==} + /dompurify@2.5.6: + resolution: {integrity: sha512-zUTaUBO8pY4+iJMPE1B9XlO2tXVYIcEA4SNGtvDELzTSCQO7RzH+j7S180BmhmJId78lqGU2z19vgVx2Sxs/PQ==} requiresBuild: true optional: true @@ -3728,7 +3740,7 @@ packages: dev: false /ee-first@1.1.1: - resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=} dev: true /electron-to-chromium@1.4.812: @@ -4213,7 +4225,7 @@ packages: dev: true /fresh@0.5.2: - resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} + resolution: {integrity: sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=} engines: {node: '>= 0.6'} dev: true @@ -5116,8 +5128,8 @@ packages: fflate: 0.4.8 optionalDependencies: canvg: 3.0.10 - core-js: 3.37.1 - dompurify: 2.5.5 + core-js: 3.38.0 + dompurify: 2.5.6 html2canvas: 1.4.1 /kind-of@3.2.2: @@ -5697,26 +5709,26 @@ packages: resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} dev: true - /ol-ext@4.0.21(ol@9.1.0): + /ol-ext@4.0.21(ol@9.2.4): resolution: {integrity: sha512-xP4oVD5KBvJW6P9UQwmPcgqMDh6nzUrHjle4qhNqzRW7OkP02mObw5UMGAgz+uhIW8doJ3hYCwy2HcpU1JFpig==} peerDependencies: ol: '>= 5.3.0' dependencies: - ol: 9.1.0 + ol: 9.2.4 dev: false - /ol-mapbox-style@12.3.0(ol@9.1.0): - resolution: {integrity: sha512-DPGWcEeC/XNejo0N10DpVOkMr2pRSzxOYWpe9RoOPiC9Ph34jiuyRpFQsLzlnJPrRo7pdQOYSYoM+mL8QF/HBA==} + /ol-mapbox-style@12.3.4(ol@9.2.4): + resolution: {integrity: sha512-TxGJZw4hmvc6n5dHSyAE8ZpgALJ6hVG5Q9yl0j2Q1KmLS9iq4wMpb383TAitWiG86SvJV4oDkWMGkyyMLfVyew==} peerDependencies: ol: '*' dependencies: '@mapbox/mapbox-gl-style-spec': 13.28.0 mapbox-to-css-font: 2.4.4 - ol: 9.1.0 + ol: 9.2.4 dev: false - /ol@9.1.0: - resolution: {integrity: sha512-nDrkJ2tzZNpo/wzN/PpHV5zdxbnXZaFktoMaD2cFLEc6gCwlgLY21Yd8wnt/4FjaVYwLBnbN9USXSwIBGcyksQ==} + /ol@9.2.4: + resolution: {integrity: sha512-bsbu4ObaAlbELMIZWnYEvX4Z9jO+OyCBshtODhDKmqYTPEfnKOX3RieCr97tpJkqWTZvyV4tS9UQDvHoCdxS+A==} dependencies: color-rgba: 3.0.0 color-space: 2.0.1 @@ -7101,7 +7113,7 @@ packages: /spdy-transport@3.0.0: resolution: {integrity: sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==} dependencies: - debug: 4.3.5 + debug: 4.3.6 detect-node: 2.1.0 hpack.js: 2.1.6 obuf: 1.1.2 @@ -7115,7 +7127,7 @@ packages: resolution: {integrity: sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==} engines: {node: '>=6.0.0'} dependencies: - debug: 4.3.5 + debug: 4.3.6 handle-thing: 2.0.1 http-deceiver: 1.2.7 select-hose: 2.0.0 diff --git a/src/components/my-map/drawing.ts b/src/components/my-map/drawing.ts index af75ed3..a705b28 100644 --- a/src/components/my-map/drawing.ts +++ b/src/components/my-map/drawing.ts @@ -1,3 +1,4 @@ +import { FeatureLike } from "ol/Feature"; import { MultiPoint, MultiPolygon, Polygon } from "ol/geom"; import { Type } from "ol/geom/Geometry"; import { Draw, Modify, Snap } from "ol/interaction"; @@ -6,7 +7,6 @@ import { Vector as VectorSource } from "ol/source"; import { Circle, Fill, RegularShape, Stroke, Style, Text } from "ol/style"; import CircleStyle from "ol/style/Circle"; import { pointsSource } from "./snapping"; -import { FeatureLike } from "ol/Feature"; export type DrawTypeEnum = Extract; export type DrawPointerEnum = "crosshair" | "dot"; diff --git a/src/components/my-map/snapping.ts b/src/components/my-map/snapping.ts index 827e6d6..20ebc2f 100644 --- a/src/components/my-map/snapping.ts +++ b/src/components/my-map/snapping.ts @@ -1,4 +1,6 @@ import { Feature } from "ol"; +import { FeatureLike } from "ol/Feature"; +import { Geometry } from "ol/geom"; import Point from "ol/geom/Point"; import { Vector as VectorLayer } from "ol/layer"; import VectorTileLayer from "ol/layer/VectorTile"; @@ -7,7 +9,7 @@ import { Fill, Style } from "ol/style"; import CircleStyle from "ol/style/Circle"; import { splitEvery } from "rambda"; -export const pointsSource = new VectorSource({ +export const pointsSource: VectorSource> = new VectorSource({ features: [], wrapX: false, }); @@ -34,7 +36,7 @@ export const pointsLayer = new VectorLayer({ * @returns - a VectorSource populated with points within the extent */ export function getSnapPointsFromVectorTiles( - basemap: VectorTileLayer, + basemap: VectorTileLayer, extent: number[], ) { const points = @@ -42,7 +44,9 @@ export function getSnapPointsFromVectorTiles( basemap .getSource() ?.getFeaturesInExtent(extent) - ?.filter((feature) => feature.getGeometry()?.getType() !== "Point") + ?.filter( + (feature: FeatureLike) => feature.getGeometry()?.getType() !== "Point", + ) ?.flatMap((feature: any) => feature.flatCoordinates_); if (points) {