Closed uliw closed 1 year ago
you can try adjusting with the direction keyword, here is the layout with direction:up
:
thx!
Here a variation on this problem. There is probably no way to decide algorythmically whether the photosynthesis box should be on top or on the side of the nitrogen fixation box (except that this solution would use less space). When I was thinking of a layout grammar (for another project), I though of having syntax along the following lines:
Ocean.Surface.Nitrogen Fixation -> Ocean.Surface.Photosynthesis: NH4: right
i.e. each connection would have an optional direction keyword. Is that a feature that could be considered in the future?
direction: up
# Atmosphere -> Ocean.Surface.Nitrogen Fixation: N2
Ocean.Surface.Nitrogen Fixation -> Ocean.Surface.Photosynthesis: NH4
Ocean.Surface.Photosynthesis -> Ocean.Deep.Nitrification: Org. N
Ocean.Deep.Nitrification -> Ocean.Deep.Denitrification/Anammox: NH3
# Ocean.Deep.Denitrification/Anammox -> Atmosphere: N2
Ocean.Deep.Nitrification -> Ocean.Surface.Photosynthesis: NH3
oh this is very interesting. with direction
per container, we can't actually force everything to be to that direction. You just may have cycles, so it's just a hint.
However, direction
per edge we can force.
What if there's a cycle though? E.g.
a -> b: { direction: right }
b -> c: { direction: right }
c -> a: { direction: right }
It wouldn't be possible to enforce this. This kind of thing feels hard to detect algorithmically, since there's 4 values here (top, left, right, bottom).
I suppose TALA can just search to try to satisfy the constraints, and if it can't, it returns an error that a layout could not be found while trying to satisfy a direction constraint. The downside is that the error msg lacks clear action. We can say exactly which constraint caused the failure, but it could be that changing a constraint somewhere else fixes things.
In any case, I really like this and we've done like 80% of the work towards this already.
hmmh, the error could simply state the name of last element that fails (output the box in red?) The user can then try to untangle the chain. This is not too different from getting weird output if there are typos in one of the box names.
you can now specify it precisely with positions:
the direction per connection idea is still worth exploring through, i'll close this and move that here: https://github.com/terrastruct/TALA/issues/35
Is it possible to get the surface ocean container on top of the deep ocean container? The following code results in a good layout, but since the top and bottom are reversed, it could be more physical. Is there a way to get in the 'correct' order?