From 20a013718480897f37636b95e9d377bd2a66bae3 Mon Sep 17 00:00:00 2001 From: Tristan Chuine Date: Fri, 20 Dec 2024 16:14:03 +0100 Subject: [PATCH] revert back to json seem that tsc still check json now?... Signed-off-by: Tristan Chuine --- demo/src/App.tsx | 17 ++++++----- demo/src/map-viewer/data/lmap.json | 26 +++++++++++++++++ demo/src/map-viewer/data/lmap.ts | 33 --------------------- demo/src/map-viewer/data/lpos.json | 32 +++++++++++++++++++++ demo/src/map-viewer/data/lpos.ts | 39 ------------------------- demo/src/map-viewer/data/smap.json | 39 +++++++++++++++++++++++++ demo/src/map-viewer/data/smap.ts | 46 ------------------------------ demo/src/map-viewer/data/spos.json | 16 +++++++++++ demo/src/map-viewer/data/spos.ts | 23 --------------- 9 files changed, 121 insertions(+), 150 deletions(-) create mode 100644 demo/src/map-viewer/data/lmap.json delete mode 100644 demo/src/map-viewer/data/lmap.ts create mode 100644 demo/src/map-viewer/data/lpos.json delete mode 100644 demo/src/map-viewer/data/lpos.ts create mode 100644 demo/src/map-viewer/data/smap.json delete mode 100644 demo/src/map-viewer/data/smap.ts create mode 100644 demo/src/map-viewer/data/spos.json delete mode 100644 demo/src/map-viewer/data/spos.ts diff --git a/demo/src/App.tsx b/demo/src/App.tsx index 4c724f6c..4e44bc71 100644 --- a/demo/src/App.tsx +++ b/demo/src/App.tsx @@ -5,16 +5,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -import { WritableDeep } from 'type-fest'; import { useEffect, useRef } from 'react'; import { createTheme, StyledEngineProvider, ThemeProvider } from '@mui/material/styles'; import { GeoData, type MapEquipment, MapEquipments, NetworkMap, type NetworkMapRef } from '../../src'; import { addNadToDemo, addSldToDemo } from './diagram-viewers/add-diagrams'; -import sposdata from './map-viewer/data/spos'; -import lposdata from './map-viewer/data/lpos'; -import smapdata from './map-viewer/data/smap'; -import lmapdata from './map-viewer/data/lmap'; +import sposdata from './map-viewer/data/spos.json'; +import lposdata from './map-viewer/data/lpos.json'; +import smapdata from './map-viewer/data/smap.json'; +import lmapdata from './map-viewer/data/lmap.json'; export default function App() { const INITIAL_ZOOM = 9; @@ -54,12 +53,12 @@ export default function App() { //declare data to be displayed: coordinates and network data const geoData = new GeoData(new Map(), new Map()); - geoData.setSubstationPositions(sposdata as WritableDeep); - geoData.setLinePositions(lposdata as WritableDeep); + geoData.setSubstationPositions(sposdata); + geoData.setLinePositions(lposdata); const mapEquipments = new MapEquipments(); - mapEquipments.updateSubstations(smapdata as WritableDeep, true); - mapEquipments.updateLines(lmapdata as WritableDeep, true); + mapEquipments.updateSubstations(smapdata, true); + mapEquipments.updateLines(lmapdata, true); useEffect(() => { const handleContextmenu = (e: MouseEvent) => { diff --git a/demo/src/map-viewer/data/lmap.json b/demo/src/map-viewer/data/lmap.json new file mode 100644 index 00000000..2fd94a9e --- /dev/null +++ b/demo/src/map-viewer/data/lmap.json @@ -0,0 +1,26 @@ +[ + { + "id": "L1", + "voltageLevelId1": "VL2_3", + "voltageLevelId2": "VL1_1", + "name": "Line1", + "terminal1Connected": true, + "terminal2Connected": true, + "p1": -115.0, + "p2": 115.0, + "i1": 290.0, + "i2": 310.0 + }, + { + "id": "L2", + "voltageLevelId1": "VL2_3", + "voltageLevelId2": "VL1_1", + "name": "Line2", + "terminal1Connected": true, + "terminal2Connected": true, + "p1": -55.0, + "p2": 55.0, + "i1": 140.0, + "i2": 155.0 + } +] diff --git a/demo/src/map-viewer/data/lmap.ts b/demo/src/map-viewer/data/lmap.ts deleted file mode 100644 index a0474c4f..00000000 --- a/demo/src/map-viewer/data/lmap.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright © 2024, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -export default [ - { - id: 'L1', - voltageLevelId1: 'VL2_3', - voltageLevelId2: 'VL1_1', - name: 'Line1', - terminal1Connected: true, - terminal2Connected: true, - p1: -115.0, - p2: 115.0, - i1: 290.0, - i2: 310.0, - }, - { - id: 'L2', - voltageLevelId1: 'VL2_3', - voltageLevelId2: 'VL1_1', - name: 'Line2', - terminal1Connected: true, - terminal2Connected: true, - p1: -55.0, - p2: 55.0, - i1: 140.0, - i2: 155.0, - }, -] as const; diff --git a/demo/src/map-viewer/data/lpos.json b/demo/src/map-viewer/data/lpos.json new file mode 100644 index 00000000..d3f65b93 --- /dev/null +++ b/demo/src/map-viewer/data/lpos.json @@ -0,0 +1,32 @@ +[ + { + "id": "L1", + "coordinates": [ + { + "lat": 45.18608, + "lon": 9.15484 + }, + { + "lat": 45.249375, + "lon": 9.35453 + }, + { + "lat": 45.31267, + "lon": 9.49322 + } + ] + }, + { + "id": "L2", + "coordinates": [ + { + "lat": 45.18608, + "lon": 9.15484 + }, + { + "lat": 45.31267, + "lon": 9.49322 + } + ] + }, +] diff --git a/demo/src/map-viewer/data/lpos.ts b/demo/src/map-viewer/data/lpos.ts deleted file mode 100644 index 7ee7c5d6..00000000 --- a/demo/src/map-viewer/data/lpos.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright © 2024, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -export default [ - { - id: 'L1', - coordinates: [ - { - lat: 45.18608, - lon: 9.15484, - }, - { - lat: 45.249375, - lon: 9.35453, - }, - { - lat: 45.31267, - lon: 9.49322, - }, - ], - }, - { - id: 'L2', - coordinates: [ - { - lat: 45.18608, - lon: 9.15484, - }, - { - lat: 45.31267, - lon: 9.49322, - }, - ], - }, -] as const; diff --git a/demo/src/map-viewer/data/smap.json b/demo/src/map-viewer/data/smap.json new file mode 100644 index 00000000..6dba3543 --- /dev/null +++ b/demo/src/map-viewer/data/smap.json @@ -0,0 +1,39 @@ +[ + { + "id": "SUB1", + "name": "Substation1", + "voltageLevels": [ + { + "id": "VL1_1", + "substationId": "SUB1", + "nominalV": 225.0 + }, + { + "id": "VL1_2", + "substationId": "SUB1", + "nominalV": 110.0 + } + ] + }, + { + "id": "SUB2", + "name": "Substation2", + "voltageLevels": [ + { + "id": "VL2_1", + "substationId": "SUB2", + "nominalV": 110.0 + }, + { + "id": "VL2_2", + "substationId": "SUB2", + "nominalV": 380.0 + }, + { + "id": "VL2_3", + "substationId": "SUB2", + "nominalV": 225.0 + } + ] + } +] diff --git a/demo/src/map-viewer/data/smap.ts b/demo/src/map-viewer/data/smap.ts deleted file mode 100644 index dd127028..00000000 --- a/demo/src/map-viewer/data/smap.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright © 2024, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -export default [ - { - id: 'SUB1', - name: 'Substation1', - voltageLevels: [ - { - id: 'VL1_1', - substationId: 'SUB1', - nominalV: 225.0, - }, - { - id: 'VL1_2', - substationId: 'SUB1', - nominalV: 110.0, - }, - ], - }, - { - id: 'SUB2', - name: 'Substation2', - voltageLevels: [ - { - id: 'VL2_1', - substationId: 'SUB2', - nominalV: 110.0, - }, - { - id: 'VL2_2', - substationId: 'SUB2', - nominalV: 380.0, - }, - { - id: 'VL2_3', - substationId: 'SUB2', - nominalV: 225.0, - }, - ], - }, -] as const; diff --git a/demo/src/map-viewer/data/spos.json b/demo/src/map-viewer/data/spos.json new file mode 100644 index 00000000..13a97c4d --- /dev/null +++ b/demo/src/map-viewer/data/spos.json @@ -0,0 +1,16 @@ +[ + { + "id": "SUB1", + "coordinate": { + "lat": 45.31267, + "lon": 9.49322 + } + }, + { + "id": "SUB2", + "coordinate": { + "lat": 45.18608, + "lon": 9.15484 + } + } +] diff --git a/demo/src/map-viewer/data/spos.ts b/demo/src/map-viewer/data/spos.ts deleted file mode 100644 index 52e64595..00000000 --- a/demo/src/map-viewer/data/spos.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright © 2024, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -export default [ - { - id: 'SUB1', - coordinate: { - lat: 45.31267, - lon: 9.49322, - }, - }, - { - id: 'SUB2', - coordinate: { - lat: 45.18608, - lon: 9.15484, - }, - }, -] as const;