Class NetworkPortrayal2D

All Implemented Interfaces:
Portrayal, Portrayal2D

public class NetworkPortrayal2D extends FieldPortrayal2D
Portrays network fields. Only draws the edges. To draw the nodes, use a ContinuousPortrayal2D or SparseGridPortrayal2D. The 'location' passed into the DrawInfo2D handed to the SimplePortryal2D is the Edge itself, while the 'object' passed to the SimplePortryal2D is the Edge's info object.
  • Constructor Details

    • NetworkPortrayal2D

      public NetworkPortrayal2D()
  • Method Details

    • getDefaultPortrayal

      public Portrayal getDefaultPortrayal()
      Description copied from class: FieldPortrayal
      Should return a portrayal which can portray any object regardless of whether it's valid or not
      Overrides:
      getDefaultPortrayal in class FieldPortrayal2D
    • setField

      public void setField(Object field)
      Description copied from class: FieldPortrayal
      Sets the field, and sets the dirtyField flag to true. May throw an exception if the field is inappropriate. The default version just sets the field and sets the dirtyField flag.
      Overrides:
      setField in class FieldPortrayal
    • hitOrDraw

      protected void hitOrDraw(Graphics2D graphics, DrawInfo2D info, Bag putInHere)
      Description copied from class: FieldPortrayal2D
      Instead of overriding the draw and hitObjects methods, you can optionally override this method to provide both the draw(...) and hitObjects(...) functionality in a single method, as it's common that these two methods have nearly identical code. You should test which operation to do based on whether or not graphics is null (if it is, you're hitting, else you're drawing).
      Overrides:
      hitOrDraw in class FieldPortrayal2D
    • getWrapper

      public LocationWrapper getWrapper(Edge edge)