Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## sim.portrayal.network
Class SimpleEdgePortrayal2D

    java.lang.Object
      sim.portrayal.SimplePortrayal2D
          sim.portrayal.network.SimpleEdgePortrayal2D

All Implemented Interfaces:
  java.io.Serializable, Portrayal, Portrayal2D

    public class SimpleEdgePortrayal2D

extends SimplePortrayal2D

See Also:
  Serialized Form

Field Summary
`static int` | `ALWAYS_SCALE`
`double` | `baseWidth`
`java.awt.Paint` | `fromPaint`
`java.awt.Font` | `labelFont`
`java.awt.Paint` | `labelPaint`
`static int` | `NEVER_SCALE`
`static int` | `SCALE_WHEN_SMALLER`
`int` | `shape`
`static int` | `SHAPE_LINE`
`static int` | `SHAPE_TRIANGLE`
`java.awt.Paint` | `toPaint`

Constructor Summary
`SimpleEdgePortrayal2D()` Draws a single-color, undirected black line (or triangle) with no label.
`SimpleEdgePortrayal2D(java.awt.Paint edgePaint, java.awt.Paint labelPaint)` One single color line will be drawn, and if labelPaint is null, no label is drawn.
`SimpleEdgePortrayal2D(java.awt.Paint fromPaint, java.awt.Paint toPaint, java.awt.Paint labelPaint)` If fromPaint == toPaint, one single color line will be drawn, and if labelPaint is null, no label is drawn.
`SimpleEdgePortrayal2D(java.awt.Paint fromPaint, java.awt.Paint toPaint, java.awt.Paint labelPaint, java.awt.Font labelFont)` If fromPaint == toPaint, one single color line will be drawn, and if labelPaint is null, no label is drawn.

Method Summary
`void` | `draw(java.lang.Object object, java.awt.Graphics2D graphics, DrawInfo2D info)` Draw a portrayed object centered at the origin in info, and with the given scaling factors.
`double` | `getBaseWidth()`
`java.lang.String` | `getLabel(Edge edge, EdgeDrawInfo2D info)` Returns a name appropriate for the edge.
`int` | `getLabelScaling()`
`java.lang.String` | `getName(LocationWrapper wrapper)` Returns a static, one-line name for the given object that is useful for a human to distinguish it from other objects.
`int` | `getScaling()`
`int` | `getShape()` Returns the shape of the edge.
`boolean` | `hitObject(java.lang.Object object, DrawInfo2D range)` If drawing area intersects selected area, return true.
`void` | `setBaseWidth(double val)` Sets the width of the base of the triangle used in drawing the directed edge -- by default, this is 0 (a simple line is drawn).
`void` | `setLabelScaling(int val)`
`void` | `setScaling(int val)`
`void` | `setShape(int shape)` Sets the shape of the edge.

Methods inherited from class sim.portrayal.SimplePortrayal2D
`getInspector, getStatus, move, setSelected`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### fromPaint

    public java.awt.Paint fromPaint

### toPaint

    public java.awt.Paint toPaint

### labelPaint

    public java.awt.Paint labelPaint

### labelFont

    public java.awt.Font labelFont

### NEVER_SCALE

    public static final int NEVER_SCALE

See Also:
  Constant Field Values

### SCALE_WHEN_SMALLER

    public static final int SCALE_WHEN_SMALLER

See Also:
  Constant Field Values

### ALWAYS_SCALE

    public static final int ALWAYS_SCALE

See Also:
  Constant Field Values

### baseWidth

    public double baseWidth

### SHAPE_LINE

    public static final int SHAPE_LINE

See Also:
  Constant Field Values

### SHAPE_TRIANGLE

    public static final int SHAPE_TRIANGLE

See Also:
  Constant Field Values

### shape

    public int shape

Constructor Detail

### SimpleEdgePortrayal2D

    public SimpleEdgePortrayal2D()

  Draws a single-color, undirected black line (or triangle) with no label.

### SimpleEdgePortrayal2D

    public SimpleEdgePortrayal2D(java.awt.Paint edgePaint,
                                 java.awt.Paint labelPaint)

  One single color line will be drawn, and if labelPaint is null, no label is drawn.

### SimpleEdgePortrayal2D

    public SimpleEdgePortrayal2D(java.awt.Paint fromPaint,
                                 java.awt.Paint toPaint,
                                 java.awt.Paint labelPaint)

  If fromPaint == toPaint, one single color line will be drawn, and if labelPaint is null, no label is drawn.

### SimpleEdgePortrayal2D

    public SimpleEdgePortrayal2D(java.awt.Paint fromPaint,
                                 java.awt.Paint toPaint,
                                 java.awt.Paint labelPaint,
                                 java.awt.Font labelFont)

  If fromPaint == toPaint, one single color line will be drawn, and if labelPaint is null, no label is drawn.

Method Detail

### getShape

    public int getShape()

  Returns the shape of the edge. At present there are two shapes: a straight line (SHAPE_LINE) and a triangle (SHAPE_TRIANGLE).

### setShape

    public void setShape(int shape)

  Sets the shape of the edge. At present there are two shapes: a straight line (SHAPE_LINE) and a triangle (SHAPE_TRIANGLE)

### getBaseWidth

    public double getBaseWidth()

### setBaseWidth

    public void setBaseWidth(double val)

  Sets the width of the base of the triangle used in drawing the directed edge -- by default, this is 0 (a simple line is drawn). The triangle is drawn with its base at the "from" node and its point at the "to" node.

### getScaling

    public int getScaling()

### setScaling

    public void setScaling(int val)

### getLabelScaling

    public int getLabelScaling()

### setLabelScaling

    public void setLabelScaling(int val)

### getLabel

    public java.lang.String getLabel(Edge edge,
                                     EdgeDrawInfo2D info)

  Returns a name appropriate for the edge. By default, this returns (edge.info == null ? "" : "" + edge.info). Override this to make a more customized label to display for the edge on-screen.

### draw

    public void draw(java.lang.Object object,
                     java.awt.Graphics2D graphics,
                     DrawInfo2D info)

  Description copied from interface: `Portrayal2D`
  Draw a portrayed object centered at the origin in info, and with the given scaling factors. It is possible that object is null.

  Specified by:
    `draw` in interface `Portrayal2D`
  Overrides:
    `draw` in class `SimplePortrayal2D`

### hitObject

    public boolean hitObject(java.lang.Object object,
                             DrawInfo2D range)

  Description copied from class: `SimplePortrayal2D`
  If drawing area intersects selected area, return true. The default computes the intersection with the (-0.5,-0.5) to (0.5,0.5) rectangle.

  Overrides:
    `hitObject` in class `SimplePortrayal2D`

### getName

    public java.lang.String getName(LocationWrapper wrapper)

  Description copied from interface: `Portrayal`
  Returns a static, one-line name for the given object that is useful for a human to distinguish it from other objects. A simple default would be just to return "" + object.

  Specified by:
    `getName` in interface `Portrayal`
  Overrides:
    `getName` in class `SimplePortrayal2D`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD