From 6b2772d16028b561892b5232c42052600e7d4ef9 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Mon, 10 Jul 2023 21:41:10 +0200 Subject: [PATCH] Extend visualisation.ospf to include styles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A concept/idea stage atm, but seems simple enough and nice. The builtin style might want to have a sigil. The default possibly too. The core idea is that everything that is not annotated uses the "default" style, which is user-tweakable and defaults to the "builtin" style, which makes sure everything gets drawn in some sane way. Implementation-wise, a first annotator would lay out the vertices and shortcut them possibly, second one would lay out the unpositioned-but-shown vertices (in a similar way to the random_positioner), third would process the styling graph and annotate with styling directives. The actual visualisation would then just read the annotations and topology¹ and draw that into the QGraphicsScene. ¹ We might need to devise a different representation to make sure thaat the shortcuts work reasonably. For a very broad overview, something akin to: style default hide style important show pen color red could be used. The styling should possibly be in opposite order: object property params. This way, we can quickly ignore the irrelevant properties (like line width for vertices) An extreme but probably workable idea would be to reuse a TopologyV3. While the families and addresses make zero sense, it could represent the reduced graph. However, we would need some way of mapping the new vertices/edges to the old ones (for Dijkstra &c.), so it is probably just better to create an Annotator-driven "overlay" in the existing AnnotatedTopology (reuse a subset of VertexIDs, maybe create own Edges. Those objects can exist without a TopologyV3, so it is fine. Also, at that point we do not need to use too-reasonable objects in the Annotations.) Regarding the "icon router bleg.svg": We will probably want to only allow files from assets in the beginning, so that the visualisation files are portable without any restrictions. In future, we could have a visualisation-relative resolution and/or directives to add other paths. (maybe with prefixes, Pelican style) The styles should possibly be top-level directives, not l2, so that they are reusable between presets (in the same file) --- visualisation.ospf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/visualisation.ospf b/visualisation.ospf index 194f4ec..ff179d9 100644 --- a/visualisation.ospf +++ b/visualisation.ospf @@ -84,6 +84,23 @@ visualisation default network [192.168.15.1-10] position [200 800] + hide network [192.168.15.7-24] position [200 500] + style important + + edge + source router ... + target woo woo' + style important + + style default + inherit builtin + style important + inherit default + pen width 14 + pen color ff0000 + icon router bleh.svg + icon +