Feature Request: Port `turf-bezier-spline` to Mapbox Java (Android)
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 438
- 派生
- 117
- PR 合并指标
- 30 天内没有已合并 PR
描述
Description
Currently, the Mapbox Java SDK's Turf implementation lacks the turf-bezier-spline module. This feature is readily available in both Turf.js (Web) and Turf for Swift (iOS), but Android developers are left without a native way to generate smooth Bézier curves from a LineString.
When building cross-platform applications that rely on consistent map rendering, the absence of TurfMisc.bezier() in Java forces Android developers to write custom mathematical utilities to calculate intermediate curve coordinates, rather than relying on the official Turf ecosystem.
Expected Behavior
Port the turf-bezier-spline algorithm to mapbox-java so that Android developers can pass a straight LineString with control points and receive a curved LineString or Feature in return, matching the behavior of the Web and iOS SDKs.
Example of Desired API usage (Java)
List<Point> points = Arrays.asList(
Point.fromLngLat(-122.414, 37.776),
Point.fromLngLat(-122.420, 37.780), // Control point
Point.fromLngLat(-122.425, 37.776)
);
LineString straightLine = LineString.fromLngLats(points);
// This is currently missing:
Feature curvedFeature = TurfMisc.bezier(straightLine);
Current Workaround
Manually calculating the Quadratic/Cubic Bézier mathematical formulas in a custom Java utility class, generating a dense list of Point objects, and then passing those to a standard LineString. This is inefficient and prone to projection errors compared to a dedicated Turf module.
Context
This missing feature was also noted internally by the Mapbox team in the navigation-android SDK (Issue #3018) back in 2020. Adding this would greatly improve feature parity between Mapbox's Web, iOS, and Android ecosystems.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
比较 Turf.js 和 Turf for Swift 中现有的 turf-bezier-spline 实现,然后检查 Java SDK 的 TurfMisc 入口点。为 LineString 输入实现缺失的 TurfMisc.bezier API,并验证其曲线输出与 Web 和 iOS 的行为一致。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- android, java
- 领域
- mobile-dev
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100