RenderStep

渲染步骤接口(最简)

基本信息

属性 值
路径 com.gtnewhorizons.navigator.api.model.steps.RenderStep
行数 14(api/model/steps 包最小)
类型 interface

全部内容

public interface RenderStep {
    default ILocationProvider getLocation() { ... }   // :11
}

只有 1 个 default 方法。

⚠️ 14 行的接口没有 draw 方法 —— 因为「怎么画」完全由实现方决定 (UniversalRenderStep 有 draw、 JMRenderStep 与 XaeroRenderStep 各自的签名)。

⚠️ getLocation() 是 default(返回 null)—— 所以实现方可以完全不管坐标, 适合「不绑定具体数据点的纯装饰步骤」。

三个子接口 / 实现

类型 行 关系
LocationInteractableStep(38 行) :13 extends RenderStep + 交互
InteractableStep(43 行) :15 extends LocationInteractableStep + 路点
UniversalRenderStep(280 行) :23 implements XaeroRenderStep(不是 RenderStep!)

⚠️ UniversalRenderStep 实现的是 XaeroRenderStep 而非 RenderStep —— UniversalRenderStep.java:23 是 public abstract class UniversalRenderStep<T ...> implements XaeroRenderStep。 而 XaeroRenderStep(19 行)自己继承 RenderStep。 所以是间接实现。

为什么要这么多层

层 增加的能力
RenderStep 无(只有坐标)
LocationInteractableStep 点击 + 按键(onKeyPressed)
InteractableStep 路点能力(getLocation 返回 IWaypointAndLocationProvider)
UniversalLocationInteractableStep 地图中立实现 + 命中测试
UniversalInteractableStep 默认双击切换路点

⚠️ LocationInteractableStep 的 javadoc(:26)明写 The default implementation dispatches NavigatorApi#ACTION_KEY —— 所以不覆写 onKeyPressed 时按键会走 NavigatorApi.ACTION_KEY(默认 DELETE)。

⚠️ InteractableStep 的 javadoc(:12-13)明说 This interface remains for source and binary compatibility —— 即它是遗留接口,新图层应用 LocationInteractableStep。 与 README.md 推荐的路径一致。

相关