Package ptolemy.vergil.actor
Class KielerLayoutUtil
- java.lang.Object
-
- ptolemy.vergil.actor.KielerLayoutUtil
-
public final class KielerLayoutUtil extends java.lang.Object
Static helper class for the KIELER classes implementing connector behavior, i.e. special edge routing mechanisms.- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Ulf Rueegg
-
-
Constructor Summary
Constructors Constructor Description KielerLayoutUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.geom.Point2D
getCenterPoint(Site site)
Get the center point of a Perimeter Site.static java.awt.geom.Point2D[]
getHeadTailPoints(Connector connector, java.util.List<java.awt.geom.Point2D> bendPoints)
Get the starting and ending points of a connector.static Locatable
getLocation(NamedObj namedObj)
Find a location for the given object.static java.awt.geom.Point2D
getLocationPoint(Locatable locatable)
Retrieve the actual position from a locatable instance.static java.awt.geom.Point2D
getLocationPoint(NamedObj namedObj)
Get the location given by the location attribute of the given input object.static double
getNormal(java.awt.geom.Point2D origin, java.awt.geom.Point2D other)
Get the angle in radians from the origin to the other point.
-
-
-
Method Detail
-
getCenterPoint
public static java.awt.geom.Point2D getCenterPoint(Site site)
Get the center point of a Perimeter Site. Copied the idea fromPerimeterSite.getPoint(double)
.- Parameters:
site
- the site- Returns:
- the center point of the shape that corresponds to the site
-
getHeadTailPoints
public static java.awt.geom.Point2D[] getHeadTailPoints(Connector connector, java.util.List<java.awt.geom.Point2D> bendPoints)
Get the starting and ending points of a connector. Copied some code fromBasicManhattanRouter.routeManhattan(diva.canvas.connector.ManhattanConnector)
.- Parameters:
connector
- The connector.bendPoints
- a list of bendpoints to determine the anchor point on the site- Returns:
- the anchor points at the start and end of the connection, i.e. a Point2D array of size 2
-
getNormal
public static double getNormal(java.awt.geom.Point2D origin, java.awt.geom.Point2D other)
Get the angle in radians from the origin to the other point.- Parameters:
origin
- the original pointother
- the other point- Returns:
- angle in radians
-
getLocation
public static Locatable getLocation(NamedObj namedObj)
Find a location for the given object.- Parameters:
namedObj
- a model object- Returns:
- the object's location, or
null
if there is no location
-
getLocationPoint
public static java.awt.geom.Point2D getLocationPoint(NamedObj namedObj)
Get the location given by the location attribute of the given input object. If the Ptolemy object has no location attribute, return double zero.- Parameters:
namedObj
- The Ptolemy object for which the location should be retrieved.- Returns:
- A vector corresponding to the location (x and y) of the object. Will return a zero vector if no location attribute is set for the object.
-
getLocationPoint
public static java.awt.geom.Point2D getLocationPoint(Locatable locatable)
Retrieve the actual position from a locatable instance.- Parameters:
locatable
- a locatable- Returns:
- the actual position, or null if none is found
-
-