powsybl / powsybl-diagram-viewer

Other
2 stars 1 forks source link

[sld-viewer] Simplify computations for navigation arrow #34

Open flo-dup opened 4 months ago

flo-dup commented 4 months ago

Please check if the PR fulfills these requirements

Does this PR already have an issue describing the problem? No

What kind of change does this PR introduce? Refactor / simplification

What is the current behavior?

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change or deprecate an API?

flo-dup commented 1 month ago

Indeed! I missed the fact that the map was indexed by the voltage level id...

The SVG constructed by powsybl-single-line-diagram has always y position equals for all the feeder nodes within the same voltage level: it corresponds to the top extern cell height or the bottom extern cell heigh which are both constant within a voltage level. So we could keep this simplification anyway

CBiasuzzi commented 1 month ago

It's not always the case, apparently. In the SVG created with this code, the two bottom elements have different y:

Network network = Importer.find("CGMES")
        .importData(CgmesConformity1Catalog.microGridBaseCaseBE().dataSource(), new NetworkFactoryImpl(), null);
//let's create an SLD for the 4th VL
SingleLineDiagram.draw(network, "b10b171b-3bc5-4849-bb1f-61ed9ea1ec7c", "/tmp/sld-example.svg");

with the new logic for the diagram-viewer, the bottom arrows are not aligned:

sld1_new_logic