Interface VisualEdge<V extends VisualVertex>

  • Type Parameters:
    V - the vertex type
    All Superinterfaces:
    GEdge<V>
    All Known Implementing Classes:
    AbstractVisualEdge

    public interface VisualEdge<V extends VisualVertex>
    extends GEdge<V>
    An edge that contains properties and state related to a user interface.

    An edge can be selected, which means that it has been clicked by the user. Also, an edge can be part of an active path. This allows the UI to paint the edge differently if it is in the active path. The active path concept applies to both hovered and focused vertices separately. A hovered vertex is one that the user moves the mouse over; a focused vertex is one that is selected.

    Articulations - The start and end points are always part of the edge. Any additional points on the edge are considered articulation points. Thus, an edge without articulations will be drawn as a straight line. An edge with articulations will be drawn as a series of straight lines from point-to-point, allowing the layout algorithm to add points to the edge to avoid line crossings; these points are used to make the drawing of the edge cleaner.

    equals() and hashCode() - The graph API allows for cloning of layouts. For this to correctly copy layout locations, each edge must override equals and hashCode in order to properly find edges across graphs.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <E extends VisualEdge<V>>
      E
      cloneEdge​(V start, V end)
      Creates a new edge of this type using the given vertices.
      double getAlpha()
      Get the alpha, which determines how much of the edge is visible/see through.
      java.util.List<java.awt.geom.Point2D> getArticulationPoints()
      Returns the points (in GraphViewerUtils View Space) of the articulation
      double getEmphasis()
      Returns the emphasis value of this edge.
      boolean isInFocusedVertexPath()
      Returns true if this edge is part of an active path for a currently focused/selected vertex (this allows the edge to be differently rendered)
      boolean isInHoveredVertexPath()
      Returns true if this edge is part of an active path for a currently hovered vertex (this allows the edge to be differently rendered)
      boolean isSelected()
      Returns true if this edge is selected
      void setAlpha​(double alpha)
      Set the alpha, which determines how much of the edge is visible/see through.
      void setArticulationPoints​(java.util.List<java.awt.geom.Point2D> points)
      Sets the articulation points for the given edge
      void setEmphasis​(double emphasisLevel)
      Sets the emphasis value for this edge.
      void setInFocusedVertexPath​(boolean inPath)
      Sets this edge to be marked as in the active path of a currently focused/selected vertex
      void setInHoveredVertexPath​(boolean inPath)
      Sets this edge to be marked as in the active path of a currently hovered vertex
      void setSelected​(boolean selected)
      Sets this edge selected.
    • Method Detail

      • setSelected

        void setSelected​(boolean selected)
        Sets this edge selected. This is usually in response to the user selecting the edge.
        Parameters:
        selected - true to select this edge; false to de-select this vertex
      • isSelected

        boolean isSelected()
        Returns true if this edge is selected
        Returns:
        true if this edge is selected
      • setInHoveredVertexPath

        void setInHoveredVertexPath​(boolean inPath)
        Sets this edge to be marked as in the active path of a currently hovered vertex
        Parameters:
        inPath - true to be marked as in the active path; false to be marked as not in the active path
      • isInHoveredVertexPath

        boolean isInHoveredVertexPath()
        Returns true if this edge is part of an active path for a currently hovered vertex (this allows the edge to be differently rendered)
        Returns:
        true if this edge is part of the active path
      • setInFocusedVertexPath

        void setInFocusedVertexPath​(boolean inPath)
        Sets this edge to be marked as in the active path of a currently focused/selected vertex
        Parameters:
        inPath - true to be marked as in the active path; false to be marked as not in the active path
      • isInFocusedVertexPath

        boolean isInFocusedVertexPath()
        Returns true if this edge is part of an active path for a currently focused/selected vertex (this allows the edge to be differently rendered)
        Returns:
        true if this edge is part of the active path
      • getArticulationPoints

        java.util.List<java.awt.geom.Point2D> getArticulationPoints()
        Returns the points (in GraphViewerUtils View Space) of the articulation

        What are articulations?

        Returns:
        the points (in View Space space) of the articulation.
      • setArticulationPoints

        void setArticulationPoints​(java.util.List<java.awt.geom.Point2D> points)
        Sets the articulation points for the given edge

        What are articulations?

        Parameters:
        points - the points
      • cloneEdge

        <E extends VisualEdge<V>> E cloneEdge​(V start,
                                              V end)
        Creates a new edge of this type using the given vertices.

        Implementation Note: the odd type 'E' below is there so that subclasses can return the type of their implementation. Basically, the decision was made to have each subclass suppress the warning that appears, since they know the type is safe. Alternatively, each client would have to cast the return type, which seems less desirable.

        Parameters:
        start - the start vertex
        end - the end vertex
        Returns:
        the new edge
      • setEmphasis

        void setEmphasis​(double emphasisLevel)
        Sets the emphasis value for this edge. A value of 0 indicates no emphasis.
        Parameters:
        emphasisLevel - the emphasis
      • getEmphasis

        double getEmphasis()
        Returns the emphasis value of this edge. 0 if not emphasized.
        Returns:
        the emphasis value of this edge.
      • setAlpha

        void setAlpha​(double alpha)
        Set the alpha, which determines how much of the edge is visible/see through. 0 is completely transparent. This attribute allows transitional for animations.
        Parameters:
        alpha - the alpha value
      • getAlpha

        double getAlpha()
        Get the alpha, which determines how much of the edge is visible/see through. 0 is completely transparent. This attribute allows transitional for animations.
        Returns:
        the alpha value