org.eclipse.gmf.runtime.draw2d.ui.figures
Class BaseSlidableAnchor
java.lang.Object
org.eclipse.draw2d.ConnectionAnchorBase
org.eclipse.draw2d.AbstractConnectionAnchor
org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor
-
All Implemented Interfaces:
-
AncestorListener,
ConnectionAnchor,
OrthogonalConnectionAnchor
-
Direct Known Subclasses:
-
SlidableAnchor
-
public class BaseSlidableAnchor
- extends
AbstractConnectionAnchor
- implements
OrthogonalConnectionAnchor
Provides the implementation of Slidable anchor
Methods inherited from class java.lang.Object
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
|
BaseSlidableAnchor
public BaseSlidableAnchor()
- Empty constructor
BaseSlidableAnchor
public BaseSlidableAnchor(
IFigure f)
- Default constructor. The anchor will have the center of the figure as the
reference point
-
Parameters:
-
f
- IFigure
that this anchor is associated with.
BaseSlidableAnchor
public BaseSlidableAnchor(
IFigure f,
PrecisionPoint p)
- Constructor. Takes point p to store the reference point
-
Parameters:
-
f
- IFigure
that this anchor is associated with. -
p
- the PrecisionPoint
that the anchor will initially attach to.
getTerminal
public java.lang.String getTerminal()
- Creates terminal string for slidable anchor
-
-
-
Returns:
-
String
terminal for slidable anchor
getReferencePoint
public
Point getReferencePoint()
-
-
Specified by:
-
getReferencePoint
in interface
ConnectionAnchor
-
Overrides:
-
getReferencePoint
in class
AbstractConnectionAnchor
-
equals
public boolean equals(java.lang.Object obj)
-
-
Overrides:
-
equals
in class java.lang.Object
-
hashCode
public int hashCode()
-
-
Overrides:
-
hashCode
in class java.lang.Object
-
getLocation
protected
Point getLocation(
Point ownReference,
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
getLocation
public
Point getLocation(
Point reference)
-
-
Specified by:
-
getLocation
in interface
ConnectionAnchor
-
normalizeToStraightlineTolerance
protected
Point normalizeToStraightlineTolerance(
Point foreignReference,
Point ownReference,
int tolerance)
- Returns a new owned reference point that is normalized to be with-in a straight-line
tolerance value.
-
-
-
Parameters:
-
foreignReference
- Point
that is the foreign reference point used to calculate
the interfection anchor point on the shape in absolute coordinates. -
ownReference
- Point
that is the reference point with-in the shape in
absolute coordinates -
tolerance
- int
value that is the difference in absolute coordinates where the
two points would be considered straight and then adjusted.
-
Returns:
-
Point
that is the normalized owned reference to be with-in a given
straight-line tolerance value of the foreign reference point.
getIntersectionPoints
protected
PointList getIntersectionPoints(
Point ownReference,
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
getPolygonPoints
protected
PointList getPolygonPoints()
- 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
PrecisionPoint getAnchorRelativeLocation(
Point p,
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
getBox
protected
Rectangle getBox()
- Gets the anchors associated figure's bounding box in absolute coordinates.
-
-
-
Returns:
- a
Rectangle
that is the bounding box of the owner figure
in absolute coordinates
isDefaultAnchor
public boolean isDefaultAnchor()
- Returns true if the
SlidableAnchor
is default one with a reference at the center
-
-
-
Returns:
-
boolean
true
is the SlidableAnchor
is default one, false
otherwise
parseTerminalString
public static
PrecisionPoint parseTerminalString(java.lang.String terminal)
- Parses anchors terminal string and returns the relative reference icorporated
in the terminal string
-
-
-
Parameters:
-
terminal
- - the terminal string containing relative reference
-
Returns:
- returns the relative reference incorporated in the terminal string
getOrthogonalLocation
public
Point getOrthogonalLocation(
Point orthoReference)
-
Description copied from interface:
OrthogonalConnectionAnchor
- Determines connection anchor point for Orthogonal connection.
Generally, the anchor point would the intersection of perpendicular
line drawn from the
orthoReference
point to the shape and
shape's edge.
-
-
Specified by:
-
getOrthogonalLocation
in interface
OrthogonalConnectionAnchor
-
-
Parameters:
-
orthoReference
- the reference point
-
Returns:
- The location of the orthogonal connection anchor.
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.