@dp_unity/dpu-gis-viewer
Version:
DPU GIS Viewer version Beta
135 lines (134 loc) • 5.93 kB
TypeScript
import { BoundingSphere, Cartographic, Cesium3DTileset, KmlDataSource, Viewer, Color, Entity } from "cesium";
import { IInputObjs3DTile } from "src/interfaces/sceneManager.interface";
import { InputDataPrimitive } from "./styleElement";
import { EdgeRenderingOptions } from "./scene/tileEdgeRenderer";
export declare class SceneManager {
viewer: Viewer;
private _urlApi;
private _token;
private _inputDataPrimitive;
/** Quản lý hiển thị cạnh (edge/wireframe) cho 3D tiles */
private _edgeRenderer;
private _tilesetsLoadedByUrl;
private _savemaximumScreenSpaceErrors;
private _kmzClickHandler?;
constructor(containerId: string, viewer: any, token: string, inputDataPrimitive: InputDataPrimitive);
/**
* Hàm load model từ url JSON
* @param {string} url URL Json model
* @param {number} maximumScreen
*/
load3DTileUrl: (url: string, inputObjs?: IInputObjs3DTile) => Promise<any>;
setPositionModel: (tileset: any, inputObjs?: IInputObjs3DTile) => void;
/**
* Hàm load file KMZ
* @param {string} url URL KMZ
*/
loadKmz: (path: string, inputObjs?: IInputObjs3DTile) => Promise<import("cesium").DataSource>;
removeKmz: (kmz: any) => void;
load3DTileById: (idData: string, urlConnect?: string, inputObjs?: IInputObjs3DTile) => Promise<{
tileSet: any;
url: any;
dataConnect: import("../interfaces/styleElement.interface").ObjDataPrimitiveModel | undefined;
}>;
showHideTile: (tile: any, show: boolean) => void;
/**
* Điều hướng camera đến tileset khi tileset đã được tải
* @param {any} tileset tile được load
*/
zoomTo: (tileset: any) => void;
/**
* Hàm bay đến bounding Box
* @param {BoundingSphere} bouding bounding Box
*/
cameraFlyToBouding: (bouding: BoundingSphere, duration?: number) => void;
removeTileSet: (tileset: any) => void;
transformZ: (tileset: any, heightOffset: number, cartographic?: any) => void;
getCurrentCartographic: (tileset: any) => Cartographic | undefined;
setModelMatrix: (tileset: any, longitude?: number, latitude?: number, height?: number, cartographic?: any) => void;
setModelMatrixForKmz: (dataSource: any, targetLongitude?: number, targetLatitude?: number, targetHeight?: number) => void;
private _computeCenterOfEntities;
private _moveEntitiesByDelta;
getBoundingBoxFromKMZ: (kmlDataSource: any) => BoundingSphere;
handleZoomEarth: (zoom: boolean) => void;
onChangeMap: (layer: number, mapUrls?: {
id: string;
url: string;
}[]) => void;
flyToYourLocation: (zDistance?: number, duration?: number) => Promise<unknown>;
enableKmzClickPicking: (callback: (entity: Entity | undefined, dataSource: KmlDataSource | undefined) => void) => void;
/**
* Hủy lắng nghe sự kiện click KMZ.
*/
disableKmzClickPicking: () => void;
/**
* Bật hiển thị cạnh toàn scene bằng **Depth + Normal Sobel Post-Processing**.
*
* - **Normal Sobel**: phát hiện cạnh giữa các mặt phẳng (cạnh của box, tường–sàn, v.v.)
* - **Depth Sobel** : phát hiện viền silhouette bên ngoài vật thể
*
* @param options Tùy chọn:
* - `strength` (2–10): độ nhạy normal (cạnh mặt phẳng) – mặc định 4
* - `depthStrength` (10–60): độ nhạy silhouette – mặc định 20
* - `thickness` (1–3): độ dày pixel
* - `color`, `opacity`
*
* @example
* ```ts
* sceneManager.enableEdgeRendering({
* color: Color.BLACK,
* strength: 4,
* depthStrength: 20
* });
* ```
*/
enableEdgeRendering: (options?: EdgeRenderingOptions) => void;
/**
* Tắt lớp hiển thị cạnh post-process.
*/
disableEdgeRendering: () => void;
/**
* Bật/Tắt hiển thị cạnh toàn scene.
*/
toggleEdgeRendering: (options?: EdgeRenderingOptions) => void;
/**
* Bật hiển thị cạnh trực tiếp **trên một tileset** cụ thể.
*
* - `mode: 'shader'` : Phát hiện cạnh qua `fwidth(normal)` — hoạt động tốt
* với BIM/IFC tiles có flat-shading.
* - `mode: 'wireframe'` : Hiển thị toàn bộ lưới tam giác (debugWireframe native).
*
* @example
* ```ts
* // Cạnh bên trong từng face (BIM/IFC models)
* sceneManager.enableTileEdge(tileset, { mode: 'shader', strength: 18 });
*
* // Wireframe toàn bộ tam giác
* sceneManager.enableTileEdge(tileset, { mode: 'wireframe' });
* ```
*/
enableTileEdge: (tileset: Cesium3DTileset, options?: EdgeRenderingOptions) => void;
/**
* Tắt hiển thị cạnh trên tileset và khôi phục shader gốc.
*/
disableTileEdge: (tileset: Cesium3DTileset) => void;
/**
* Tắt tất cả chế độ edge rendering (toàn scene + từng tileset).
*/
disableAllEdgeRendering: () => void;
private updateEdgeRendererSelected;
/** Cập nhật màu cạnh đang hiển thị */
setEdgeColor: (color: Color) => void;
/** Cập nhật độ nhạy normal-based edge (phát hiện cạnh mặt phẳng, 2–10) */
setEdgeStrength: (strength: number) => void;
/** Cập nhật độ nhạy depth/silhouette edge (10–60) */
setEdgeDepthStrength: (depthStrength: number) => void;
/** Cập nhật độ trong suốt lớp cạnh post-process (0–1) */
setEdgeOpacity: (opacity: number) => void;
/** Cập nhật độ dày pixel của cạnh post-process */
setEdgeThickness: (thickness: number) => void;
/** Trạng thái: đang hiển thị cạnh hay không */
get isEdgeRenderingEnabled(): boolean;
private _handleCameraMoveStart;
private _handleCameraMoveEnd;
}