Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jamal-khey committed Mar 25, 2024
1 parent 7f89189 commit fb88d17
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
14 changes: 7 additions & 7 deletions demo/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ function App() {
}, []);

const networkMapRef = useRef();
const filtredNominalVoltage = [380.0, 225.0, 110.0];
// const filtredNominalVoltage = [500];
const filteredNominalVoltages = [380.0, 225.0, 110.0];
// const filteredNominalVoltages = [500];

return (
<div className="App">
Expand Down Expand Up @@ -129,15 +129,15 @@ function App() {
}}
mapLibrary={'cartonolabel'}
mapTheme={'dark'}
filtredNominalVoltages={filtredNominalVoltage}
filteredNominalVoltages={filtredNominalVoltage}
onFeaturesChanged={() => {
networkMapRef.current.computeSelectedSubstation();
networkMapRef.current.getSelectedSubstation();
networkMapRef.current.getSelectedVoltageLevel();
console.log(
'debug',
'filtredByVoltage',
networkMapRef.current.getSelectedSubstation(
filtredNominalVoltage
)
'getSelectedLine',
networkMapRef.current.getSelectedLines()

// getSelectedSubstation,
// getSelectedVoltageLevel,
Expand Down
26 changes: 10 additions & 16 deletions src/components/network-map-viewer/network/network-map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,11 @@ const NetworkMap = forwardRef((props, ref) => {
const getPolygonFeatures = () => {
return features;
};
const getSelectedSubstation = (filteredNominalVoltages) => {
const getSelectedSubstation = () => {
return (
selectedSubstation.filter((substation) => {
return substation.voltageLevels.some((vl) => {
return filteredNominalVoltages.includes(vl.nominalV);
return props.filteredNominalVoltages.includes(vl.nominalV);
});
}) ?? []
);
Expand All @@ -611,12 +611,12 @@ const NetworkMap = forwardRef((props, ref) => {
setSelectedSubstation(substations);
};

const getSelectedVoltageLevel = (filteredNominalVoltages) => {
const getSelectedVoltageLevel = () => {
const selectedVL = getVoltageLevelFromSubstation(
getSelectedSubstation(filteredNominalVoltages)
getSelectedSubstation()
);
return selectedVL.filter((vl) => {
return filteredNominalVoltages.includes(vl.nominalV);
return props.filteredNominalVoltages.includes(vl.nominalV);
});
};

Expand Down Expand Up @@ -649,7 +649,7 @@ const NetworkMap = forwardRef((props, ref) => {

return selectedLines;
}
const getSelectedLines = (filteredNominalVoltages) => {
const getSelectedLines = () => {
console.log('debug', 'layer', getLayerById(layers, LINE_LAYER_PREFIX));
//check if polygon is defined correctly
const firstPolygonFeatures = Object.values(features)[0];
Expand All @@ -665,22 +665,16 @@ const NetworkMap = forwardRef((props, ref) => {
props.geoData,
polygonCoordinates
);
return filterLinesByNominalVoltages(
selectedLines,
filteredNominalVoltages
);
return filterLinesByNominalVoltages(selectedLines);
};

const filterLinesByNominalVoltages = (
equipements,
filteredNominalVoltages
) => {
const filterLinesByNominalVoltages = (equipements) => {
return equipements.filter((equipement) => {
const isVL1 = filteredNominalVoltages.includes(
const isVL1 = props.filteredNominalVoltages.includes(
props.mapEquipments.getVoltageLevel(equipement.voltageLevelId1)
.nominalV
);
const isVL2 = filteredNominalVoltages.includes(
const isVL2 = props.filteredNominalVoltages.includes(
props.mapEquipments.getVoltageLevel(equipement.voltageLevelId2)
.nominalV
);
Expand Down

0 comments on commit fb88d17

Please sign in to comment.