| | |
| | | import zhangaiwu.Obstacledge; |
| | | import zhangaiwu.yulanzhangaiwu; |
| | | import yaokong.Control03; |
| | | import bianjie.shudongdraw; |
| | | |
| | | /** |
| | | * 地图渲染器 - 负责坐标系绘制、视图变换等功能 |
| | |
| | | private boolean measurementModeActive = false; // 测量模式是否激活 |
| | | private boolean handheldBoundaryPreviewActive; |
| | | private boolean pendingTrackBreak = true; |
| | | private bianjie.shudongdraw manualBoundaryDrawer = new bianjie.shudongdraw(); // 手动绘制边界绘制器 |
| | | private boolean idleTrailSuppressed; |
| | | private Path2D.Double realtimeBoundaryPathCache; |
| | | private String realtimeBoundaryPathLand; |
| | |
| | | dragInProgress = false; |
| | | } |
| | | |
| | | public void mouseExited(MouseEvent e) { |
| | | // 鼠标离开面板时,清除鼠标位置显示 |
| | | if (manualBoundaryDrawer.isManualBoundaryDrawingMode()) { |
| | | manualBoundaryDrawer.clearMousePosition(); |
| | | visualizationPanel.repaint(); |
| | | } |
| | | } |
| | | |
| | | public void mouseClicked(MouseEvent e) { |
| | | if (dragInProgress) { |
| | | dragInProgress = false; |
| | |
| | | if (!SwingUtilities.isLeftMouseButton(e) || e.getClickCount() != 1) { |
| | | return; |
| | | } |
| | | // 优先处理手动绘制边界模式点击 |
| | | if (manualBoundaryDrawer.isManualBoundaryDrawingMode()) { |
| | | Point2D.Double worldPoint = screenToWorld(e.getPoint()); |
| | | if (manualBoundaryDrawer.handleClick(worldPoint)) { |
| | | visualizationPanel.repaint(); |
| | | return; |
| | | } |
| | | } |
| | | // 优先处理测量模式点击 |
| | | if (measurementModeActive && handleMeasurementClick(e.getPoint())) { |
| | | return; |
| | |
| | | visualizationPanel.repaint(); |
| | | } |
| | | } |
| | | |
| | | public void mouseMoved(MouseEvent e) { |
| | | // 在手动绘制边界模式时,更新鼠标位置 |
| | | if (manualBoundaryDrawer.isManualBoundaryDrawingMode()) { |
| | | Point2D.Double worldPoint = screenToWorld(e.getPoint()); |
| | | manualBoundaryDrawer.updateMousePosition(worldPoint); |
| | | visualizationPanel.repaint(); |
| | | } else { |
| | | manualBoundaryDrawer.clearMousePosition(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | |
| | | adddikuaiyulan.drawPreview(g2d, handheldBoundaryPreview, scale, handheldBoundaryPreviewActive, boundaryPreviewMarkerScale); |
| | | |
| | | // 绘制手动绘制的边界 |
| | | manualBoundaryDrawer.drawBoundary(g2d, scale); |
| | | |
| | | // 绘制鼠标实时位置(手动绘制边界模式时) |
| | | manualBoundaryDrawer.drawMousePosition(g2d, scale); |
| | | |
| | | // 绘制导航路径(中层) |
| | | if (hasPlannedPath) { |
| | | drawCurrentPlannedPath(g2d); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设置手动绘制边界模式 |
| | | */ |
| | | public void setManualBoundaryDrawingMode(boolean active) { |
| | | manualBoundaryDrawer.setManualBoundaryDrawingMode(active); |
| | | if (visualizationPanel != null) { |
| | | visualizationPanel.repaint(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取手动绘制的边界点列表 |
| | | */ |
| | | public List<Point2D.Double> getManualBoundaryPoints() { |
| | | return manualBoundaryDrawer.getManualBoundaryPoints(); |
| | | } |
| | | |
| | | /** |
| | | * 清空手动绘制的边界点 |
| | | */ |
| | | public void clearManualBoundaryPoints() { |
| | | manualBoundaryDrawer.clearManualBoundaryPoints(); |
| | | if (visualizationPanel != null) { |
| | | visualizationPanel.repaint(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置测量模式 |
| | | */ |
| | | public void setMeasurementMode(boolean active) { |