修复 SGS SDK 导览数据源与模型加载
升级 SDK API 数据契约,补齐 guideStops、业务 POI、诊断与路线数据接口。 修复 SDK 模式下 POI/模型/楼层混用静态数据的问题,并为 ThreeMap 模型加载增加短退避重试。
This commit is contained in:
141
static/sgs-map-sdk/index.d.ts
vendored
141
static/sgs-map-sdk/index.d.ts
vendored
@@ -240,6 +240,16 @@ interface SgsLayerTreeNode {
|
||||
/** 包含的 3D 节点数量 */
|
||||
nodeCount?: number;
|
||||
}
|
||||
type SgsPoiGroup = "SERVICE" | "BUSINESS" | "OTHER";
|
||||
type SgsBusinessPoiType = "shop" | "restaurant" | "cafe" | "vending" | "bookstore" | "cultural_shop" | "photo_spot";
|
||||
interface SgsPoiQueryParams {
|
||||
mapId?: string | number;
|
||||
floorId?: string | number;
|
||||
group?: SgsPoiGroup;
|
||||
types?: string[];
|
||||
keyword?: string;
|
||||
limit?: number;
|
||||
}
|
||||
/** SDK 消费的 POI — 对应 GET /app-api/gis/sdk/floors/{floorId}/pois */
|
||||
interface SgsPoi {
|
||||
/** POI ID(雪花 ID,字符串或数字均可) */
|
||||
@@ -266,6 +276,15 @@ interface SgsPoi {
|
||||
description?: string;
|
||||
/** 图标 URL */
|
||||
iconUrl?: string;
|
||||
floorId?: string | number;
|
||||
poiGroup?: SgsPoiGroup;
|
||||
businessType?: SgsBusinessPoiType | string;
|
||||
coverImageUrl?: string | null;
|
||||
phone?: string | null;
|
||||
businessHours?: string | null;
|
||||
sortOrder?: number | null;
|
||||
spatialAreaId?: string | number | null;
|
||||
spatialAreaName?: string | null;
|
||||
}
|
||||
/** 路径规划结果 — 对应 POST /app-api/gis/sdk/routes/plan */
|
||||
interface SgsRoutePlanV2 {
|
||||
@@ -369,6 +388,10 @@ interface SgsSdkManifest {
|
||||
highlight?: boolean;
|
||||
/** 是否支持诊断接口 */
|
||||
diagnostics?: boolean;
|
||||
businessPoi?: boolean;
|
||||
poiSearch?: boolean;
|
||||
featuredRoutes?: boolean;
|
||||
flowlinePreview?: boolean;
|
||||
};
|
||||
}
|
||||
/** v2.2.0 楼层摘要(manifest 内嵌) */
|
||||
@@ -651,6 +674,80 @@ interface SgsFloorDiagnostics {
|
||||
/** 警告信息列表 */
|
||||
warnings: string[];
|
||||
}
|
||||
interface SgsFeaturedRouteSummary {
|
||||
id: string | number;
|
||||
mapId: string | number;
|
||||
routeName: string;
|
||||
routeNameEn?: string | null;
|
||||
description?: string | null;
|
||||
descriptionEn?: string | null;
|
||||
coverImageUrl?: string | null;
|
||||
routeColor?: string | null;
|
||||
estimatedMinutes?: number | null;
|
||||
displayOrder?: number | null;
|
||||
waypointCount: number;
|
||||
startEntranceId?: string | number | null;
|
||||
endEntranceId?: string | number | null;
|
||||
updatedAt?: string | null;
|
||||
}
|
||||
interface SgsRouteEndpoint {
|
||||
id: string | number;
|
||||
name: string;
|
||||
floorId: string | number;
|
||||
floorCode?: string | null;
|
||||
position?: {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
} | null;
|
||||
}
|
||||
interface SgsFeaturedRouteWaypoint {
|
||||
order: number;
|
||||
spaceId: string | number;
|
||||
spaceName?: string | null;
|
||||
floorId?: string | number | null;
|
||||
floorCode?: string | null;
|
||||
position: {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
};
|
||||
title?: string | null;
|
||||
subtitle?: string | null;
|
||||
description?: string | null;
|
||||
imageUrl?: string | null;
|
||||
audioUrl?: string | null;
|
||||
staySeconds?: number | null;
|
||||
tags?: string[];
|
||||
highlight?: boolean;
|
||||
}
|
||||
interface SgsFeaturedRouteDetail extends SgsFeaturedRouteSummary {
|
||||
startEntrance?: SgsRouteEndpoint | null;
|
||||
endEntrance?: SgsRouteEndpoint | null;
|
||||
waypoints: SgsFeaturedRouteWaypoint[];
|
||||
}
|
||||
interface SgsFlowlineOptions {
|
||||
autoFit?: boolean;
|
||||
showLabels?: boolean;
|
||||
animate?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤 EXTERIOR 楼层,检查楼层是否是室内可导航楼层
|
||||
*/
|
||||
declare function isIndoorNavigableFloor(floorCode: string): boolean;
|
||||
/**
|
||||
* 物理楼层顺序由低到高排序
|
||||
*/
|
||||
declare function sortIndoorFloors<T extends {
|
||||
floorCode: string;
|
||||
}>(floors: T[]): T[];
|
||||
|
||||
declare const utils_isIndoorNavigableFloor: typeof isIndoorNavigableFloor;
|
||||
declare const utils_sortIndoorFloors: typeof sortIndoorFloors;
|
||||
declare namespace utils {
|
||||
export { utils_isIndoorNavigableFloor as isIndoorNavigableFloor, utils_sortIndoorFloors as sortIndoorFloors };
|
||||
}
|
||||
|
||||
/**
|
||||
* SGS 3D 地图 H5 SDK 入口类
|
||||
@@ -659,9 +756,10 @@ interface SgsFloorDiagnostics {
|
||||
* <p>所有需要后端数据的操作均通过 postMessage 指令由底座代理,
|
||||
* Demo / 宿主不允许直连后端 API。
|
||||
*
|
||||
* @version 2.3.0
|
||||
* @version 2.4.0
|
||||
*/
|
||||
declare class SGSMapSDK extends EventEmitter<SGSMapEvents> {
|
||||
static utils: typeof utils;
|
||||
private container;
|
||||
private sdkUrl;
|
||||
private floorId;
|
||||
@@ -685,6 +783,8 @@ declare class SGSMapSDK extends EventEmitter<SGSMapEvents> {
|
||||
private _messageListener;
|
||||
/** ready 超时计时器 */
|
||||
private _readyTimer;
|
||||
/** 🔧 P0: HELLO 重试定时器 — 解决 iframe onload 与 React useEffect 时序竞争 */
|
||||
private _helloInterval;
|
||||
/** ENGINE_READY 返回的 payload(供外部读取) */
|
||||
readyPayload: any;
|
||||
/** ready Promise 的 resolve/reject,保证 whenReady() 返回同一个 Promise */
|
||||
@@ -769,7 +869,7 @@ declare class SGSMapSDK extends EventEmitter<SGSMapEvents> {
|
||||
/** 清空所有业务图钉 */
|
||||
clearMarkers(): void;
|
||||
/** 高亮多边形轮廓 */
|
||||
highlightPolygon(nodeName: string): void;
|
||||
highlightPolygon(payload: string | object): void;
|
||||
/** 寻路规划(v1 兼容) */
|
||||
planRoute(from: SgsMapNode | string, to: SgsMapNode | string, options?: any, timeout?: number): Promise<RouteResult>;
|
||||
/** 寻路规划 V2(结构化参数) */
|
||||
@@ -779,9 +879,14 @@ declare class SGSMapSDK extends EventEmitter<SGSMapEvents> {
|
||||
/** 获取引擎状态 */
|
||||
getState(): Promise<any>;
|
||||
/** 重置视角 */
|
||||
resetView(): void;
|
||||
resetView(timeout?: number): Promise<{
|
||||
success: boolean;
|
||||
}>;
|
||||
/** 设置 2D/3D 视图模式 */
|
||||
setViewMode(mode: '2d' | '3d'): void;
|
||||
setViewMode(mode: '2d' | '3d', timeout?: number): Promise<{
|
||||
success: boolean;
|
||||
mode: string;
|
||||
}>;
|
||||
/** 切换图层可见性 */
|
||||
toggleLayer(types: string[], visible: boolean, timeout?: number): Promise<{
|
||||
success: boolean;
|
||||
@@ -792,6 +897,11 @@ declare class SGSMapSDK extends EventEmitter<SGSMapEvents> {
|
||||
success: boolean;
|
||||
visibleTypes: string[];
|
||||
}>;
|
||||
/** 设置路线展示视图是否活跃 */
|
||||
setRouteViewActive(active: boolean, timeout?: number): Promise<{
|
||||
success: boolean;
|
||||
active: boolean;
|
||||
}>;
|
||||
/** 获取地图 Manifest 清单 */
|
||||
getManifest(timeout?: number): Promise<SgsSdkManifest>;
|
||||
/** 加载指定楼层的完整 Bundle 数据(含 POI/空间面/讲解点/路网) */
|
||||
@@ -820,6 +930,27 @@ declare class SGSMapSDK extends EventEmitter<SGSMapEvents> {
|
||||
getFloorDiagnostics(floorId: string | number, timeout?: number): Promise<SgsFloorDiagnostics>;
|
||||
/** 清空客户端模型缓存 */
|
||||
clearModelCache(): void;
|
||||
/** 获取指定楼层的业务 POI 列表 */
|
||||
getBusinessPois(floorId: string | number, options?: {
|
||||
types?: string[];
|
||||
keyword?: string;
|
||||
limit?: number;
|
||||
}, timeout?: number): Promise<SgsPoi[]>;
|
||||
/** 查询 POI 列表 */
|
||||
queryPois(params: SgsPoiQueryParams, timeout?: number): Promise<SgsPoi[]>;
|
||||
/** 获取特色路线列表 */
|
||||
getFeaturedRoutes(mapId?: string | number, options?: {
|
||||
limit?: number;
|
||||
}, timeout?: number): Promise<SgsFeaturedRouteSummary[]>;
|
||||
/** 获取特色路线详情 */
|
||||
getFeaturedRoute(routeId: string | number, timeout?: number): Promise<SgsFeaturedRouteDetail>;
|
||||
/** 显示动线 */
|
||||
showFlowline(routeId: string | number, options?: SgsFlowlineOptions, timeout?: number): Promise<{
|
||||
success: boolean;
|
||||
routeId: string | number;
|
||||
}>;
|
||||
/** 清除动线 */
|
||||
clearFlowline(): void;
|
||||
/** @deprecated 使用 getManifest() 替代 */
|
||||
getReleaseManifest(timeout?: number): Promise<any>;
|
||||
/** @deprecated 已废弃,无替代方法 */
|
||||
@@ -837,4 +968,4 @@ declare class SGSMapSDK extends EventEmitter<SGSMapEvents> {
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
export { type MarkerConfig, type RouteOptions, type RouteResult, type SGSErrorCode, type SGSMapEvents, type SGSMapSDKOptions, type SgsFloorBundle, type SgsFloorDiagnostics, type SgsFloorDiagnosticsSummary, type SgsFloorResource, type SgsGuideStop, type SgsLayerTreeNode, type SgsMapDiagnostics, type SgsMapManifest, type SgsMapNode, type SgsModelResource, type SgsNavigablePlace, type SgsPerformanceStats, type SgsPoi, type SgsRoutePlanV2, type SgsRouteSegment, type SgsRouteSegmentType, type SgsRouteTransferType, type SgsSdkError, type SgsSdkFloorSummary, type SgsSdkManifest, type SgsSpaceArea, type SnapDetail, SGSMapSDK as default };
|
||||
export { type MarkerConfig, type RouteOptions, type RouteResult, type SGSErrorCode, type SGSMapEvents, type SGSMapSDKOptions, type SgsBusinessPoiType, type SgsFeaturedRouteDetail, type SgsFeaturedRouteSummary, type SgsFeaturedRouteWaypoint, type SgsFloorBundle, type SgsFloorDiagnostics, type SgsFloorDiagnosticsSummary, type SgsFloorResource, type SgsFlowlineOptions, type SgsGuideStop, type SgsLayerTreeNode, type SgsMapDiagnostics, type SgsMapManifest, type SgsMapNode, type SgsModelResource, type SgsNavigablePlace, type SgsPerformanceStats, type SgsPoi, type SgsPoiGroup, type SgsPoiQueryParams, type SgsRouteEndpoint, type SgsRoutePlanV2, type SgsRouteSegment, type SgsRouteSegmentType, type SgsRouteTransferType, type SgsSdkError, type SgsSdkFloorSummary, type SgsSdkManifest, type SgsSpaceArea, type SnapDetail, SGSMapSDK as default };
|
||||
|
||||
Reference in New Issue
Block a user