| | |
| | | |
| | | // 将世界坐标转换为屏幕坐标(用于文字显示) |
| | | Point2D.Double worldMid = new Point2D.Double(midX, midY); |
| | | Point2D.Double screenMid = worldToScreen(worldMid); |
| | | Point2D.Double screenMid = new Point2D.Double(); |
| | | originalTransform.transform(worldMid, screenMid); |
| | | |
| | | // 恢复原始变换以绘制文字(固定大小,不随缩放变化) |
| | | g2d.setTransform(new AffineTransform()); |
| | |
| | | .append(',') |
| | | .append(formatCoordinate(point.y)); |
| | | if (i < boundary.size() - 1) { |
| | | |
| | | builder.append(';'); |
| | | } |
| | | } |
| | |
| | | this.boundaryPreviewUpdateCallback = callback; |
| | | } |
| | | |
| | | /** |
| | | * 将视图中心对准当前边界的几何中心 |
| | | */ |
| | | public void centerViewOnBoundary() { |
| | | if (currentBoundary == null || currentBoundary.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | Rectangle2D.Double bounds = computeBounds(currentBoundary); |
| | | if (bounds != null) { |
| | | fitBoundsToView(bounds); |
| | | } |
| | | } |
| | | } |