@soonspacejs/plugin-tiles 2.15.4 → 2.15.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { ImageOverlayPlugin, GeoJSONOverlay, CesiumIonOverlay, TMSTilesOverlay, XYZTilesOverlay, WMSTilesOverlay, WMTSTilesOverlay, UrlTemplateTilesOverlay } from 'um-3d-tiles-renderer/plugins';
1
+ import { ImageOverlayPlugin, StyledGeoJSONOverlay, CesiumIonOverlay, TMSTilesOverlay, XYZTilesOverlay, WMSTilesOverlay, WMTSTilesOverlay, UrlTemplateTilesOverlay } from 'um-3d-tiles-renderer/plugins';
2
2
  import { ResourceManager } from './ResourceManager';
3
- import { IGeoJSONOverlayOptions, ICesiumIonOverlayOptions, ITMSTilesOverlayOptions, IXYZTilesOverlayOptions, IWMSTilesOverlayOptions, IWMTSTilesOverlayOptions, IUrlTemplateOverlayOptions } from './types';
3
+ import { IGeoJSONOverlayOptions, IGeoJSONFeatureStyle, GeoJSONOverlayMode, ICesiumIonOverlayOptions, ITMSTilesOverlayOptions, IXYZTilesOverlayOptions, IWMSTilesOverlayOptions, IWMTSTilesOverlayOptions, IUrlTemplateOverlayOptions } from './types';
4
4
  /**
5
5
  * OverlayManager - Overlay 实例管理器
6
6
  *
@@ -15,13 +15,24 @@ export declare class OverlayManager {
15
15
  /** 存储所有 overlay 实例 */
16
16
  private static readonly MAX_OVERLAY_INSTANCES;
17
17
  private _instances;
18
+ private _geoJSONUtilityOverlay;
18
19
  constructor(imageOverlayPlugin: ImageOverlayPlugin | undefined, resourceManager?: ResourceManager | undefined);
19
- addGeoJSONOverlay(options: IGeoJSONOverlayOptions): GeoJSONOverlay | null;
20
+ addGeoJSONOverlay(options: IGeoJSONOverlayOptions): StyledGeoJSONOverlay | null;
20
21
  updateGeoJSONColor(id: string, color: string): boolean;
22
+ updateGeoJSONDefaultStyle(id: string, stylePatch: IGeoJSONFeatureStyle): boolean;
21
23
  updateGeoJSONStrokeStyle(id: string, strokeStyle: string): boolean;
22
24
  updateGeoJSONStrokeWidth(id: string, strokeWidth: number): boolean;
23
25
  updateGeoJSONFillStyle(id: string, fillStyle: string): boolean;
24
- updateGeoJSONMode(id: string, mode: 'overlay' | 'mask' | 'invertMask'): boolean;
26
+ updateGeoJSONMode(id: string, mode: GeoJSONOverlayMode): boolean;
27
+ setGeoJSON(id: string, geojson: object): boolean;
28
+ normalizeGeoJSON(geojson: any): any;
29
+ mergeGeoJSON(geojsonList: ReadonlyArray<any>): any;
30
+ setMergedGeoJSON(id: string, geojsonList: ReadonlyArray<any>, options?: {
31
+ redraw?: boolean;
32
+ }): any | null;
33
+ getGeoJSONFeatureById(id: string, featureId: string | number): any | null;
34
+ updateGeoJSONFeatureStyleById(id: string, featureId: string | number, stylePatch: IGeoJSONFeatureStyle): boolean;
35
+ updateGeoJSONFeatureStylesByIds(id: string, featureIds: Array<string | number>, stylePatch: IGeoJSONFeatureStyle): boolean;
25
36
  addCesiumIonOverlay(options: ICesiumIonOverlayOptions): CesiumIonOverlay | null;
26
37
  addTMSOverlay(options: ITMSTilesOverlayOptions): TMSTilesOverlay | null;
27
38
  addXYZOverlay(options: IXYZTilesOverlayOptions): XYZTilesOverlay | null;
@@ -111,6 +122,10 @@ export declare class OverlayManager {
111
122
  * 获取 overlay 数量
112
123
  */
113
124
  get count(): number;
125
+ private _buildGeoJSONDefaultStyle;
126
+ private _getGeoJSONModeFlags;
127
+ private _getGeoJSONUtilityOverlay;
128
+ private _updateOverlayOptions;
114
129
  private _getImageOverlayPluginForAdd;
115
130
  /**
116
131
  * 获取本地影像数量(不依赖 ResourceManager)
@@ -1,11 +1,11 @@
1
- import { IGeoJSONOverlayOptions, ICesiumIonOverlayOptions, ITMSTilesOverlayOptions, IXYZTilesOverlayOptions, IWMSTilesOverlayOptions, IWMTSTilesOverlayOptions, OverlayType } from './types';
1
+ import { IGeoJSONOverlayOptions, ICesiumIonOverlayOptions, ITMSTilesOverlayOptions, IXYZTilesOverlayOptions, IWMSTilesOverlayOptions, IWMTSTilesOverlayOptions, IUrlTemplateOverlayOptions, OverlayType } from './types';
2
2
  /**
3
3
  * Overlay 资源配置
4
4
  */
5
5
  export interface IOverlayResource {
6
6
  id: string;
7
7
  type: OverlayType;
8
- options: IGeoJSONOverlayOptions | ICesiumIonOverlayOptions | ITMSTilesOverlayOptions | IXYZTilesOverlayOptions | IWMSTilesOverlayOptions | IWMTSTilesOverlayOptions;
8
+ options: IGeoJSONOverlayOptions | ICesiumIonOverlayOptions | ITMSTilesOverlayOptions | IXYZTilesOverlayOptions | IWMSTilesOverlayOptions | IWMTSTilesOverlayOptions | IUrlTemplateOverlayOptions;
9
9
  }
10
10
  /**
11
11
  * ResourceManager 资源管理器
@@ -5,7 +5,7 @@ import { TileCustomMaterialPlugin } from './plugins';
5
5
  import { OverlayManager } from './OverlayManager';
6
6
  import { ResourceManager } from './ResourceManager';
7
7
  import { TerrainManager } from './TerrainManager';
8
- import { ITerrainTilesRendererOptions, IGeoJSONOverlayOptions, ICesiumIonOverlayOptions, ITMSTilesOverlayOptions, IXYZTilesOverlayOptions, IWMSTilesOverlayOptions, IWMTSTilesOverlayOptions, IUrlTemplateOverlayOptions, AlphaClipMode, ITerrainConfig } from './types';
8
+ import { ITerrainTilesRendererOptions, IGeoJSONOverlayOptions, ICesiumIonOverlayOptions, ITMSTilesOverlayOptions, IXYZTilesOverlayOptions, IWMSTilesOverlayOptions, IWMTSTilesOverlayOptions, IUrlTemplateOverlayOptions, IGeoJSONFeatureStyle, GeoJSONOverlayMode, AlphaClipMode, ITerrainConfig } from './types';
9
9
  import { GroundDecalManager } from '../plot/GroundDecalManager';
10
10
  /**
11
11
  * TerrainTilesRenderer 地形渲染器
@@ -118,7 +118,7 @@ export declare class TerrainTilesRenderer {
118
118
  * @param options Overlay 配置选项,必须包含 type 字段
119
119
  * @returns Overlay 实例或 null(如果添加失败)
120
120
  */
121
- addOverlay(options: IGeoJSONOverlayOptions | ICesiumIonOverlayOptions | IGeoJSONOverlayOptions | ITMSTilesOverlayOptions | IXYZTilesOverlayOptions | IWMSTilesOverlayOptions | IWMTSTilesOverlayOptions | IUrlTemplateOverlayOptions): Promise<import('um-3d-tiles-renderer/plugins').XYZTilesOverlay | import('um-3d-tiles-renderer/plugins').GeoJSONOverlay | import('um-3d-tiles-renderer/plugins').CesiumIonOverlay | import('um-3d-tiles-renderer/plugins').TMSTilesOverlay | import('um-3d-tiles-renderer/plugins').UrlTemplateTilesOverlay | import('um-3d-tiles-renderer/plugins').WMSTilesOverlay | import('um-3d-tiles-renderer/plugins').WMTSTilesOverlay | null>;
121
+ addOverlay(options: IGeoJSONOverlayOptions | ICesiumIonOverlayOptions | ITMSTilesOverlayOptions | IXYZTilesOverlayOptions | IWMSTilesOverlayOptions | IWMTSTilesOverlayOptions | IUrlTemplateOverlayOptions): Promise<import('um-3d-tiles-renderer/plugins').XYZTilesOverlay | import('um-3d-tiles-renderer/plugins').StyledGeoJSONOverlay | import('um-3d-tiles-renderer/plugins').CesiumIonOverlay | import('um-3d-tiles-renderer/plugins').TMSTilesOverlay | import('um-3d-tiles-renderer/plugins').UrlTemplateTilesOverlay | import('um-3d-tiles-renderer/plugins').WMSTilesOverlay | import('um-3d-tiles-renderer/plugins').WMTSTilesOverlay | null>;
122
122
  /**
123
123
  * 移除指定 overlay
124
124
  */
@@ -133,7 +133,7 @@ export declare class TerrainTilesRenderer {
133
133
  * - mask: 只显示 GeoJSON 区域内的地形
134
134
  * - invertMask: 只显示 GeoJSON 区域外的地形
135
135
  */
136
- updateGeoJSONMode(id: string, mode: 'overlay' | 'mask' | 'invertMask'): boolean;
136
+ updateGeoJSONMode(id: string, mode: GeoJSONOverlayMode): boolean;
137
137
  /**
138
138
  * 更新 GeoJSON 描边样式
139
139
  */
@@ -146,12 +146,33 @@ export declare class TerrainTilesRenderer {
146
146
  * 更新 GeoJSON 填充样式
147
147
  */
148
148
  updateGeoJSONFillStyle(id: string, fillStyle: string): boolean;
149
+ /**
150
+ * 更新 StyledGeoJSONOverlay 的默认 feature 样式
151
+ */
152
+ updateGeoJSONDefaultStyle(id: string, stylePatch: IGeoJSONFeatureStyle): boolean;
153
+ /**
154
+ * 替换 GeoJSON 数据
155
+ */
156
+ setGeoJSON(id: string, geojson: object): boolean;
157
+ /**
158
+ * 合并多个 GeoJSON 后替换指定 StyledGeoJSONOverlay 的数据
159
+ */
160
+ setMergedGeoJSON(id: string, geojsonList: ReadonlyArray<any>, options?: {
161
+ redraw?: boolean;
162
+ }): any | null;
163
+ getGeoJSONFeatureById(id: string, featureId: string | number): any | null;
164
+ updateGeoJSONFeatureStyleById(id: string, featureId: string | number, stylePatch: IGeoJSONFeatureStyle): boolean;
165
+ updateGeoJSONFeatureStylesByIds(id: string, featureIds: Array<string | number>, stylePatch: IGeoJSONFeatureStyle): boolean;
166
+ /**
167
+ * 将任意 GeoJSON 根对象规范化为 FeatureCollection
168
+ */
169
+ normalizeGeoJSON(geojson: any): any;
149
170
  /**
150
171
  * 合并多个 GeoJSON
151
172
  * @param geojsons 待合并的 GeoJSON 数组
152
173
  * @returns 合并后的 GeoJSON
153
174
  */
154
- mergeGeoJSON(geojsons: any[]): import('geojson-merge-ts').GeoJSONFeatureCollection;
175
+ mergeGeoJSON(geojsons: ReadonlyArray<any>): any;
155
176
  /**
156
177
  * 设置 overlay 层级顺序
157
178
  * @param id overlay ID
@@ -88,16 +88,65 @@ export interface IOverlayBaseOptions {
88
88
  /**
89
89
  * GeoJSON Overlay 配置
90
90
  */
91
+ export interface IGeoJSONFeatureStyle {
92
+ visible?: boolean;
93
+ zIndex?: number;
94
+ opacity?: number;
95
+ fillStyle?: string | null;
96
+ fillOpacity?: number;
97
+ strokeStyle?: string | null;
98
+ strokeWidth?: number;
99
+ strokeOpacity?: number;
100
+ lineDash?: number[];
101
+ lineCap?: CanvasLineCap;
102
+ lineJoin?: CanvasLineJoin;
103
+ pointRadius?: number;
104
+ pointOpacity?: number;
105
+ pointFillStyle?: string | null;
106
+ pointStrokeStyle?: string | null;
107
+ pointStrokeWidth?: number | null;
108
+ }
109
+ export type GeoJSONOverlayMode = 'overlay' | 'mask' | 'invertMask';
91
110
  export interface IGeoJSONOverlayOptions extends IOverlayBaseOptions {
92
111
  /** GeoJSON 文件 URL 或 GeoJSON 数据对象 */
93
112
  url?: string;
94
113
  geojson?: object;
114
+ /** Canvas resolution for each rasterized GeoJSON overlay tile */
115
+ resolution?: number;
116
+ /** Legacy alias for resolution */
117
+ tileDimension?: number;
118
+ /** Default feature style used by StyledGeoJSONOverlay */
119
+ defaultStyle?: IGeoJSONFeatureStyle;
120
+ /** Overlay / terrain mask mode */
121
+ mode?: GeoJSONOverlayMode;
122
+ /** Point radius */
123
+ pointRadius?: number;
95
124
  /** 填充样式 */
96
125
  fillStyle?: string;
126
+ /** Fill opacity */
127
+ fillOpacity?: number;
97
128
  /** 描边样式: 颜色设置参考 https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/strokeStyle*/
98
129
  strokeStyle?: string;
99
130
  /** 描边宽度 */
100
131
  strokeWidth?: number;
132
+ /** Stroke opacity */
133
+ strokeOpacity?: number;
134
+ /** Stroke dash pattern */
135
+ lineDash?: number[];
136
+ /** Stroke line cap */
137
+ lineCap?: CanvasLineCap;
138
+ /** Stroke line join */
139
+ lineJoin?: CanvasLineJoin;
140
+ /** Point fill style */
141
+ pointFillStyle?: string | null;
142
+ /** Point stroke style */
143
+ pointStrokeStyle?: string | null;
144
+ /** Point stroke width */
145
+ pointStrokeWidth?: number | null;
146
+ /** Per-feature default visibility */
147
+ visible?: boolean;
148
+ /** Per-feature default zIndex */
149
+ zIndex?: number;
101
150
  }
102
151
  /**
103
152
  * Cesium Ion Overlay 配置
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soonspacejs/plugin-tiles",
3
3
  "pluginName": "TilesPlugin",
4
- "version": "2.15.4",
4
+ "version": "2.15.6",
5
5
  "description": "3D Tiles plugin for SoonSpace.js",
6
6
  "main": "dist/index.esm.js",
7
7
  "module": "dist/index.esm.js",
@@ -18,9 +18,9 @@
18
18
  "license": "UNLICENSED",
19
19
  "gitHead": "4a87dd85050651088e11c3da777c49fab3db7e5d",
20
20
  "peerDependencies": {
21
- "um-3d-tiles-renderer": "^0.4.46",
21
+ "um-3d-tiles-renderer": "^0.4.48",
22
22
  "three": "^0.183.0",
23
23
  "@mapbox/geojson-merge": "^1.1.1",
24
- "soonspacejs": "2.15.4"
24
+ "soonspacejs": "2.15.5"
25
25
  }
26
26
  }