Skip to content

Commit

Permalink
revert back to json
Browse files Browse the repository at this point in the history
seem that tsc still check json now?...
Signed-off-by: Tristan Chuine <[email protected]>
  • Loading branch information
Tristan-WorkGH committed Dec 20, 2024
1 parent 718a99a commit 20a0137
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 150 deletions.
17 changes: 8 additions & 9 deletions demo/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<typeof sposdata>);
geoData.setLinePositions(lposdata as WritableDeep<typeof lposdata>);
geoData.setSubstationPositions(sposdata);
geoData.setLinePositions(lposdata);

const mapEquipments = new MapEquipments();
mapEquipments.updateSubstations(smapdata as WritableDeep<typeof smapdata>, true);
mapEquipments.updateLines(lmapdata as WritableDeep<typeof lmapdata>, true);
mapEquipments.updateSubstations(smapdata, true);
mapEquipments.updateLines(lmapdata, true);

useEffect(() => {
const handleContextmenu = (e: MouseEvent) => {
Expand Down
26 changes: 26 additions & 0 deletions demo/src/map-viewer/data/lmap.json
Original file line number Diff line number Diff line change
@@ -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
}
]
33 changes: 0 additions & 33 deletions demo/src/map-viewer/data/lmap.ts

This file was deleted.

32 changes: 32 additions & 0 deletions demo/src/map-viewer/data/lpos.json
Original file line number Diff line number Diff line change
@@ -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
}
]
},
]
39 changes: 0 additions & 39 deletions demo/src/map-viewer/data/lpos.ts

This file was deleted.

39 changes: 39 additions & 0 deletions demo/src/map-viewer/data/smap.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
]
46 changes: 0 additions & 46 deletions demo/src/map-viewer/data/smap.ts

This file was deleted.

16 changes: 16 additions & 0 deletions demo/src/map-viewer/data/spos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"id": "SUB1",
"coordinate": {
"lat": 45.31267,
"lon": 9.49322
}
},
{
"id": "SUB2",
"coordinate": {
"lat": 45.18608,
"lon": 9.15484
}
}
]
23 changes: 0 additions & 23 deletions demo/src/map-viewer/data/spos.ts

This file was deleted.

0 comments on commit 20a0137

Please sign in to comment.