Package org.eclipse.graphiti.ui.internal.util.draw2d

## Class GFChopboxAnchor

- java.lang.Object
- - org.eclipse.draw2d.ConnectionAnchorBase
  - - org.eclipse.draw2d.AbstractConnectionAnchor
    - - org.eclipse.draw2d.ChopboxAnchor
      - - org.eclipse.graphiti.ui.internal.util.draw2d.ChopboxAnchorFixed
        - - org.eclipse.graphiti.ui.internal.util.draw2d.GFChopboxAnchor

All Implemented Interfaces:
  `org.eclipse.draw2d.AncestorListener`, `org.eclipse.draw2d.ConnectionAnchor`

    public class GFChopboxAnchor
    extends ChopboxAnchorFixed

A chopbox anchor supporting insets

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.eclipse.draw2d.AncestorListener

`org.eclipse.draw2d.AncestorListener.Stub`

### Field Summary

### Fields inherited from class org.eclipse.draw2d.ConnectionAnchorBase

`listeners`

### Constructor Summary

Constructors
`GFChopboxAnchor​(org.eclipse.draw2d.IFigure figure)`
`GFChopboxAnchor​(org.eclipse.draw2d.IFigure figure, AdvancedAnchor advancedAnchor)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static org.eclipse.draw2d.geometry.PrecisionPoint` `getAnchorRelativeLocation​(org.eclipse.draw2d.geometry.Point p, org.eclipse.draw2d.geometry.Rectangle bounds)` Calculates the relative location of the reference point with respect to the bounds of the figure.
`protected org.eclipse.draw2d.geometry.Rectangle` `getBox()` Gets the anchors associated figure's bounding box in absolute coordinates.
`protected org.eclipse.draw2d.geometry.PointList` `getClosedPointListOfPointListShape()` Returns the list of all the vertices of the figure.
`protected org.eclipse.draw2d.geometry.PointList` `getIntersectionPoints​(org.eclipse.draw2d.geometry.Point ownReference, org.eclipse.draw2d.geometry.Point foreignReference)` Calculates intersection points of the figure and the line that passes through ownReference and foreignReference points
`org.eclipse.draw2d.geometry.Point` `getLocation​(org.eclipse.draw2d.geometry.Point reference)` CHANGED: if the reference is in the center of the figure, the result was not correct.
`protected org.eclipse.draw2d.geometry.Point` `getLocation​(org.eclipse.draw2d.geometry.Point ownReference, org.eclipse.draw2d.geometry.Point foreignReference)` Calculates the location of the anchor depending on the anchors own reference and foreign reference points
`static org.eclipse.draw2d.geometry.Point` `pickClosestPoint​(org.eclipse.draw2d.geometry.PointList points, org.eclipse.draw2d.geometry.Point p)` Assumption: Points in the `PointList` and `Point` p lie on the same line.

### Methods inherited from class org.eclipse.graphiti.ui.internal.util.draw2d.ChopboxAnchorFixed

`getAdvancedAnchor`

### Methods inherited from class org.eclipse.draw2d.ChopboxAnchor

`equals, getReferencePoint, hashCode`

### Methods inherited from class org.eclipse.draw2d.AbstractConnectionAnchor

`addAnchorListener, ancestorAdded, ancestorMoved, ancestorRemoved, getOwner, removeAnchorListener, setOwner`

### Methods inherited from class org.eclipse.draw2d.ConnectionAnchorBase

`fireAnchorMoved`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### GFChopboxAnchor

    public GFChopboxAnchor​(org.eclipse.draw2d.IFigure figure)

#### GFChopboxAnchor

    public GFChopboxAnchor​(org.eclipse.draw2d.IFigure figure,
                           AdvancedAnchor advancedAnchor)

### Method Detail

#### getBox

    protected org.eclipse.draw2d.geometry.Rectangle getBox()

Gets the anchors associated figure's bounding box in absolute coordinates.

Overrides:
  `getBox` in class `org.eclipse.draw2d.ChopboxAnchor`
Returns:
  a `Rectangle` that is the bounding box of the owner figure in absolute coordinates. also regards the indents

#### getLocation

    public org.eclipse.draw2d.geometry.Point getLocation​(org.eclipse.draw2d.geometry.Point reference)

Description copied from class: `ChopboxAnchorFixed`
CHANGED: if the reference is in the center of the figure, the result was not correct. This method has to be kept in sync with `GefService.getChopboxLocationOnBox(Point, Rectangle)`.

Specified by:
  `getLocation` in interface `org.eclipse.draw2d.ConnectionAnchor`
Overrides:
  `getLocation` in class `ChopboxAnchorFixed`

#### getLocation

    protected org.eclipse.draw2d.geometry.Point getLocation​(org.eclipse.draw2d.geometry.Point ownReference,
                                                            org.eclipse.draw2d.geometry.Point foreignReference)

Calculates the location of the anchor depending on the anchors own reference and foreign reference points

Parameters:
  `ownReference` - - the own reference of the anchor
  `foreignReference` - - foreign reference that comes in
Returns:
  the location of the anchor depending on the anchors own reference and foreign reference points

#### pickClosestPoint

    public static org.eclipse.draw2d.geometry.Point pickClosestPoint​(org.eclipse.draw2d.geometry.PointList points,
                                                                     org.eclipse.draw2d.geometry.Point p)

Assumption: Points in the `PointList` and `Point` p lie on the same line. Returns the `Point` from the `PointList` closest to

Parameters:
  `p` -
  `points` - - the list of points to select the result from
  `p` - - the point to which the closest point must be found
  `p` -
Returns:
  the `Point` from the `PointList` closest to

#### getIntersectionPoints

    protected org.eclipse.draw2d.geometry.PointList getIntersectionPoints​(org.eclipse.draw2d.geometry.Point ownReference,
                                                                          org.eclipse.draw2d.geometry.Point foreignReference)

Calculates intersection points of the figure and the line that passes through ownReference and foreignReference points

Parameters:
  `ownReference` - the reference `Point` on or inside the shape that is being anchored to.
  `foreignReference` - the outside reference `Point` point that is the terminal end of the line formed by the two parameters.
Returns:
  intersection points of the figure and the line that passes through ownReference and foreignReference points

#### getClosedPointListOfPointListShape

    protected org.eclipse.draw2d.geometry.PointList getClosedPointListOfPointListShape()

Returns the list of all the vertices of the figure. The created list must form a polygon, i.e. closed polyline, for figures hence the starting and ending points must be the same

Returns:
  the `PointList` list of all the vertices of the figure.

#### getAnchorRelativeLocation

    public static org.eclipse.draw2d.geometry.PrecisionPoint getAnchorRelativeLocation​(org.eclipse.draw2d.geometry.Point p,
                                                                                       org.eclipse.draw2d.geometry.Rectangle bounds)

Calculates the relative location of the reference point with respect to the bounds of the figure. If point p is not inside of the figure's bounds then the point is mapped on the bounds and the point relative location is calculated

Parameters:
  `p` - the `Point` that is relative coordinates of the point
Returns:
  `PrecisionPoint`, i.e. the relative reference for `SlidableAnchor`