增强地图编辑 CAD 能力与反射对象管理体验。

补充对齐/批量建站 API,并优化反射面板、历史栈与字段管理相关交互。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zhaowei.huang
2026-07-26 11:32:30 +08:00
co-authored by Cursor
parent b1dd4f9005
commit 8299c3dc5c
18 changed files with 609 additions and 231 deletions
@@ -122,8 +122,17 @@ export interface AssetUploadResult {
url: string
}
export type SelectTrackMode = 'all' | 'straight' | 'curve'
export interface ViewFilterSnapshot {
selectFilter: { sites: boolean; tracks: boolean; cars: boolean; decor: boolean }
selectFilter: {
sites: boolean
tracks: boolean
cars: boolean
decor: boolean
/** 路径子类型:all=全部;straight=仅 UITrackcurve=贝塞尔/弧/NURBS */
trackMode?: SelectTrackMode
}
alignSnap: { sites: boolean; cars: boolean; tracks: boolean }
showViewport: { sceneLabels: boolean; scenePrimitives: boolean; cars: boolean }
}
@@ -195,11 +204,68 @@ export const mapEditApi = {
batch: (ops: BatchOp[]) =>
unwrap<{ count: number; results: unknown[] }>(http.post(`${BASE}/objects/batch`, { ops })),
/**
* CAD 相对包围盒对齐(SimpleLite CadAlignService)。
* mode: left|right|top|bottom|centerH|centerV|center|distributeH|distributeV
*/
cadAlign: (mode: string, targets: Array<{ kind: string; id: number }>) =>
unwrap<{
mode: string
count: number
previous: Array<{ kind: string; id: number; x: number; y: number }>
updated: Array<{ kind: string; id: number; x: number; y: number }>
}>(http.post(`${BASE}/cad/align`, { mode, targets })),
/** 横向/纵向等距建站(CadBatchGenerateService.PlanLinear)。 */
cadBatchLinear: (p: {
horizontal: boolean
x1: number
y1: number
x2: number
y2: number
count: number
layer?: string
namePrefix?: string
}) =>
unwrap<{ count: number; created: Array<{ kind: string; id: number }> }>(
http.post(`${BASE}/cad/batch-linear`, p)
),
/** 矩阵建站(CadBatchGenerateService.PlanMatrix)。 */
cadBatchMatrix: (p: {
x1: number
y1: number
x2: number
y2: number
rows: number
cols: number
layer?: string
namePrefix?: string
}) =>
unwrap<{ count: number; created: Array<{ kind: string; id: number }> }>(
http.post(`${BASE}/cad/batch-matrix`, p)
),
copyFieldsTo: (kind: MapEditKind | string, id: number, fieldNames: string[], targets: Array<{ kind: string; id: number }>) =>
unwrap<{ copied: number }>(http.post(`${BASE}/objects/${kind}/${id}/fields/copy-to`, { fieldNames, targets })),
// 拾取 / 仪表盘
pick: () => unwrap<PickResult>(http.post(`${BASE}/pick`)),
/** 场景已有自定义字段键(Ctrl+I /「复制字段」弹窗候选)。 */
sceneFieldKeys: () =>
unwrap<{ keys: string[] }>(http.get(`${BASE}/scene-field-keys`)),
/** 对多个目标批量写入同一字段值(对齐桌面 Ctrl+I)。 */
batchSetField: (key: string, value: string, targets: Array<{ kind: string; id: number }>) =>
unwrap<{ affected: number }>(http.post(`${BASE}/batch-set-field`, { key, value, targets })),
/** 端点落在给定站点上的路径(删站点会级联删除;撤销前需一并快照)。 */
tracksTouchingSites: (siteIds: number[]) =>
unwrap<{ tracks: Array<{ id: number; typeName: string; siteA: number; siteB: number }> }>(
http.post(`${BASE}/tracks-touching-sites`, { siteIds })
),
// 拾取 / 仪表盘。snap=false 时落点用原始鼠标坐标(文本/图片/站点);布线取端点默认 true。
pick: (opts?: { snap?: boolean }) =>
unwrap<PickResult>(http.post(`${BASE}/pick`, { snap: opts?.snap ?? true })),
dashboardSummary: () =>
unwrap<DashboardSummary>(http.get(`${BASE}/dashboard/summary`)),