int xOffset = (int) (xDisplayOrigin - xModelOrigin * xFactor); int yOffset = (int) (yDisplayOrigin - yModelOrigin * yFactor); component.paint(g2, xOffset, yOffset, xFactor, yFactor, showDistanceValues);
int xOffset = (int) (xDisplayOrigin - xModelOrigin * xFactor); int yOffset = (int) (yDisplayOrigin - yModelOrigin * yFactor); component.paint(g2, xOffset, yOffset, xFactor, yFactor, showDistanceValues);
@Override public void paint(Graphics2D g, int xDisplayOffset, int yDisplayOffset, double xDisplayFactor, double yDisplayFactor, boolean decorated) { int x1, y1, x2, y2; FontMetrics fontMetrics = g.getFontMetrics(); x1 = (int)(initPoint.getX() * xDisplayFactor + xDisplayOffset); y1 = (int)(initPoint.getY() * yDisplayFactor + yDisplayOffset); x2 = (int)(linkPoint.getX() * xDisplayFactor + xDisplayOffset); y2 = y1; g.fillOval(x1-dotRadius, y1-dotRadius, dotRadius * 2, dotRadius * 2); g.drawLine(x1, y1, x2, y2); if (cluster.isLeaf()) { g.drawString(cluster.getName().toString(), x1 + namePadding, y1 + (fontMetrics.getHeight()/2) - 2); } if (decorated && cluster.getDistance() != null && !cluster.getDistance().isNaN() && cluster.getDistance() > 0) { String s = String.format("%.2f", cluster.getDistance()); Rectangle2D rect = fontMetrics.getStringBounds(s, g); g.drawString(s, x1 - (int)rect.getWidth() , y1 - 2); } x1 = x2; y1 = y2; y2 = (int)(linkPoint.getY() * yDisplayFactor + yDisplayOffset); g.drawLine(x1, y1, x2, y2); for (ClusterComponent child : children) { child.paint(g, xDisplayOffset, yDisplayOffset, xDisplayFactor, yDisplayFactor, decorated); } }
int xOffset = (int) (xDisplayOrigin - xModelOrigin * xFactor); int yOffset = (int) (yDisplayOrigin - yModelOrigin * yFactor); component.paint(g2, xOffset, yOffset, xFactor, yFactor, showDistanceValues);
@Override public void paint(Graphics2D g, int xDisplayOffset, int yDisplayOffset, double xDisplayFactor, double yDisplayFactor, boolean decorated) { int x1, y1, x2, y2; FontMetrics fontMetrics = g.getFontMetrics(); x1 = (int)(initPoint.getX() * xDisplayFactor + xDisplayOffset); y1 = (int)(initPoint.getY() * yDisplayFactor + yDisplayOffset); x2 = (int)(linkPoint.getX() * xDisplayFactor + xDisplayOffset); y2 = y1; g.fillOval(x1-dotRadius, y1-dotRadius, dotRadius * 2, dotRadius * 2); g.drawLine(x1, y1, x2, y2); if (cluster.isLeaf()) { g.drawString(cluster.getName(), x1 + namePadding, y1 + (fontMetrics.getHeight()/2) - 2); } if (decorated && cluster.getDistance() != null && !cluster.getDistance().isNaN() && cluster.getDistance().getDistance() > 0) { String s = String.format("%.2f", cluster.getDistance()); Rectangle2D rect = fontMetrics.getStringBounds(s, g); g.drawString(s, x1 - (int)rect.getWidth() , y1 - 2); } x1 = x2; y1 = y2; y2 = (int)(linkPoint.getY() * yDisplayFactor + yDisplayOffset); g.drawLine(x1, y1, x2, y2); for (ClusterComponent child : children) { child.paint(g, xDisplayOffset, yDisplayOffset, xDisplayFactor, yDisplayFactor, decorated); } }
@Override public void paint(Graphics2D g, int xDisplayOffset, int yDisplayOffset, double xDisplayFactor, double yDisplayFactor, boolean decorated) { int x1, y1, x2, y2; FontMetrics fontMetrics = g.getFontMetrics(); x1 = (int)(initPoint.getX() * xDisplayFactor + xDisplayOffset); y1 = (int)(initPoint.getY() * yDisplayFactor + yDisplayOffset); x2 = (int)(linkPoint.getX() * xDisplayFactor + xDisplayOffset); y2 = y1; g.fillOval(x1-dotRadius, y1-dotRadius, dotRadius * 2, dotRadius * 2); g.drawLine(x1, y1, x2, y2); if (cluster.isLeaf()) { g.drawString(cluster.getName(), x1 + namePadding, y1 + (fontMetrics.getHeight()/2) - 2); } if (decorated && cluster.getDistance() != null && !cluster.getDistance().isNaN() && cluster.getDistance().getDistance() > 0) { String s = String.format("%.2f", cluster.getDistance()); Rectangle2D rect = fontMetrics.getStringBounds(s, g); g.drawString(s, x1 - (int)rect.getWidth() , y1 - 2); } x1 = x2; y1 = y2; y2 = (int)(linkPoint.getY() * yDisplayFactor + yDisplayOffset); g.drawLine(x1, y1, x2, y2); for (ClusterComponent child : children) { child.paint(g, xDisplayOffset, yDisplayOffset, xDisplayFactor, yDisplayFactor, decorated); } }