java.lang.Object
com.portingdeadmods.researchd.client.screens.research.graph.GraphLayoutManager

public class GraphLayoutManager extends Object
Handles layout calculations for research graphs with parents centered over children.
  • Field Details

  • Constructor Details

    • GraphLayoutManager

      public GraphLayoutManager()
  • Method Details

    • applyLayout

      public static void applyLayout(ResearchGraph graph, int offsetX, int offsetY)
      Apply layout to a research graph
      Parameters:
      graph - The research graph to layout
      offsetX - Top-left X coordinate for the layout
      offsetY - Top-left Y coordinate for the layout
    • calculateDepth

      public static int calculateDepth(ResearchNode node)
    • centerOf2Nodes

      public static Point centerOf2Nodes(ResearchNode node1, ResearchNode node2)
    • centerOf2Nodes

      public static Point centerOf2Nodes(List<ResearchNode> nodes)
      Utility method to stop the [0] and [size() - 1] spam
      Parameters:
      nodes -
      Returns:
    • widthOf

      public static int widthOf(List<ResearchNode> nodes)