Class GraphPanel.Edge

java.lang.Object
dev.roanh.gmark.util.GraphPanel.Edge
Enclosing class:
GraphPanel<V,E>

private class GraphPanel.Edge extends Object
Object that holds both data on the actual graph edge and data required to properly visualise the edge.
See Also:
  • Field Details

  • Constructor Details

    • Edge

      private Edge(GraphPanel<V,E>.Node source, GraphPanel<V,E>.Node target, UniqueGraph.GraphEdge<V,E> data)
      Constructs a new edge with the given source node, target node and associated graph edge.
      Parameters:
      source - The source node for this edge.
      target - The target node for this edge.
      data - The graph edge this edge visualises.
  • Method Details

    • paint

      private void paint(Graphics2D g)
      Renders this edge using the given graphics context.
      Parameters:
      g - The graphics context to use.
    • drawArrowHead

      private void drawArrowHead(Graphics2D g, double x1, double y1, double x2, double y2)
      Draws the arrow head for a directed edge at the given location and with the given graphics context. Note: the arrow head is automatically offset from the center of the target node based on the radius of the node.
      Parameters:
      g - The graphics context to use.
      x1 - The x-coordinate of the source node of the edge the arrow head belongs to.
      y1 - The y-coordinate of the source node of the edge the arrow head belongs to.
      x2 - The x-coordinate of the target node of the edge the arrow head belongs to.
      y2 - The y-coordinate of the target node of the edge the arrow head belongs to.