Skip to content

Layout graph refactor

Zuotian Tatum requested to merge layout-graph-refactor into master

Although not perfect, but I think this is stable enough to merge now.

Refactored classes

Member => Vertex  
Pregnancy => VertexGroup  
Nest => HyperEdge  
Pedigree => HyperGraph  

Refactored layout engines

  • LevelsEngine will walk through the graph clockwise (left, up, right, down) to determine the level of each hyper edge and vertex. This translates directly to y coordinate in the drawing. This step also determines the order of vertcies (from left to right) in each level.
  • PositionEngine will walk throught the graph top-down and counter-clockwise (left, down, right, up) to determine the position of each hyper edge and vertex. This translates directly to x coordinate in the drawing. It uses the order within the each level to help detect overlapping objects.

After this refactor, we can handle more complex cases within layout (for example, 2 spouses).

TODO

  • Create shadow objects (when a vertex cannot be drawn in place).
  • LevelEngine in some cornor cases does not calculate the vertex order correctly.
  • Improve PositionEngine heuristics.

Other changes

  • Removed lodash dependency.
  • Removed title as a required field for pedigree schema. Otherwise, json file created by JsonWriter cannot be opened by JsonReader.
  • Show member ids in the drawing for easy debugging. As a result, I removed the id_ prefix to make it easier to read. For the long term, we may want to have a button to toggle this.

Merge request reports