if (portFigure == null) {
continue;
}
Rectangle2D portBounds = portFigure.getShape().getBounds2D();
PortSite site = new PortSite(background, port, number, count,
direction);
number++;
// NOTE: previous expression for port location was:
// 100.0 * number / (count+1)
// But this leads to squished ports with uneven spacing.
// Note that we don't use CanvasUtilities.translateTo because
// we want to only get the bounds of the background of the
// port figure.
double x = site.getX() - portBounds.getCenterX();
double y = site.getY() - portBounds.getCenterY();
portFigure.translate(x, y);
// If the actor contains a variable named "_showRate",
// with value true, then visualize the rate information.
// NOTE: Showing rates only makes sense for IOPorts.