Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Optionally?) exit vertically stacked blocks at the lowest level, not the highest #11

Open
birkenfeld opened this issue Oct 17, 2018 · 2 comments

Comments

@birkenfeld
Copy link
Contributor

In the example 12_select-stmt_diagram.txt, a lot of line length and tracing work for the eye can be saved if the box exit is not forced to be at the same y level as the entry. For example, the marked "extra loop" here could be omitted:

image

@lukaslueg
Copy link
Owner

Yes, this is unfortunate. The reason for this behavior is that all RailroadNode-implementors are in fact just boxes that are stacked into bigger boxes. The connector always returns to the same height it entered from, making the lego-blocks always fit. This also results in "lets go all the way up to exit my box" and the wrapping box "lets go all the way down to go around the box I just wrapped". I see three options here:

  1. Do nothing. The implementation is simple and the visual justification is that you can anticipate the logical connections between entering and exiting connectors by just looking at their hight. In the example above, I don't need to search all (!) the paths entering Compounded SELECT to figure out where the syntax continues.
  2. There is a exit_height() method defined on RailroadNode, which is currently not used. While I thought this might make it possible to relax the "looping", this is probably just wrong: The wrapped Elements just can't have control over where the connector should go, as the wrapping and the wrapped elements have to negotiate what the best solution is ("It seem desireable to return downwards now, but this will cause bigger problems somewhere else").
  3. Have RailroadNode-implementors just leave the connector dangling somewhere and make it the job of each wrapping Element to return the connector to the desired height. This change of contract is probably the right solution.
  4. Forgo the entire fixed connector drawing and use A* under some waypoint-constraints. This is too complex to justify.

@lukaslueg
Copy link
Owner

The A*-solution would also solve the Limiting-case in the example above: The Optional connector runs all the way to the right before reconnecting to the main line, while it could reconnect right after EXPR. Again, I think this is something to be done in a re-implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants