@aibee/crc-bmap 0.0.79 → 0.0.80
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.
- package/lib/bmap.cjs.min.js +1 -1
- package/lib/bmap.cjs.min.js.map +1 -1
- package/lib/bmap.esm.js +1 -1
- package/lib/bmap.esm.js.map +1 -1
- package/lib/bmap.esm.min.js +1 -1
- package/lib/bmap.esm.min.js.map +1 -1
- package/lib/bmap.min.js +1 -1
- package/lib/bmap.min.js.map +1 -1
- package/package.json +2 -2
package/lib/bmap.min.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/bmap.ts", "../src/utils/timer.ts", "../src/utils/init-helper.ts", "../src/utils/dispose.ts", "../src/utils/rules.ts", "../src/utils/texture.ts", "../src/utils/coordinate.ts", "../src/utils/proxy.ts", "../src/utils/promise.ts", "../src/utils/svg.ts", "../src/utils/sleep.ts", "../src/utils/color.ts", "../src/utils/model.ts", "../src/utils/os.ts", "../src/utils/keyboard.ts", "../src/context.ts", "../src/operations/selection/selection.ts", "../src/elements/graphic.ts", "../src/elements/shadow.ts", "../src/elements/poi.ts", "../src/elements/overlay.ts", "../src/elements/floor.ts", "../src/layer/graphic-layer.ts", "../src/layer/layer.ts", "../src/layer/poi-layer.ts", "../src/elements/heatmap.ts", "../src/elements/model.ts", "../src/elements/base-svg.ts", "../src/elements/svg-line.ts", "../src/elements/svg-polygon.ts", "../src/elements/select-box.ts", "../src/operations/selection/box-selection.ts", "../src/operations/hover/hover-helper.ts", "../src/factory/material.ts", "../src/utils/camera-bound.ts", "../src/config.ts"],
|
|
4
|
-
"sourcesContent": ["import { EventDispatcher, Object3D, Vector3 } from \"three\";\r\nimport { Context } from \"./context\";\r\nimport { clearTextTexture, clearCanvas, vector3ToDevice, getCenter, getLongestSideDir } from \"./utils\";\r\nimport { Config, getConfig } from './config'\r\nimport {Floor, Graphic, HeatmapDataParam, Model, ModelOptions, PoiOptionsParam} from \"./elements\";\r\nimport { SvgLine, SvgPolygon } from \"./elements\";\r\nimport { GraphicInfo, GraphicOptions, PolygonGeometry, ResGraphicInfo } from \"./types\";\r\nimport { debounce } from \"lodash\";\r\nimport { disposeLoader } from \"./utils/model\";\r\n\r\nexport interface LoadQuery {\r\n brand: string;\r\n project: string;\r\n phase: string;\r\n building: string;\r\n floor: string;\r\n ts: string;\r\n resource_type_list: string;\r\n}\r\n\r\ninterface BmapEventMap {\r\n \"zoom-change\": {\r\n basicZoom: number;\r\n cameraZoom: number;\r\n }\r\n}\r\n\r\nexport type MapType = \"2d\" | \"3d\"\r\n\r\nexport enum MapTypePolar {\r\n D2 = 0,\r\n D3 = 0.9\r\n}\r\n\r\nexport class BMap extends EventDispatcher<BmapEventMap> {\r\n config: Config;\r\n\r\n public context: Context;\r\n\r\n private polarKeys: string[] = [];\r\n\r\n private azimuthalKeys: string[] = [];\r\n\r\n private svgLine?: SvgLine;\r\n\r\n private svgPolygon?: SvgPolygon;\r\n\r\n public basicZoom = 1;\r\n\r\n private prevCameraZoom = 1;\r\n\r\n type: MapType = \"2d\"\r\n\r\n floorDataMap: Map<string, GraphicInfo[]> = new Map()\r\n\r\n buildingGroundMap = new Map<string, GraphicInfo | null>()\r\n\r\n currentBuildGround: GraphicInfo | null = null\r\n\r\n private observe: ResizeObserver | null = null;\r\n\r\n constructor(private container: HTMLElement, config: Partial<Config> = {}) {\r\n super();\r\n this.config = getConfig(config)\r\n this.context = new Context(container, this.config);\r\n this.registryEvent();\r\n this.context.render();\r\n }\r\n\r\n private async loadGraphics({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery): Promise<GraphicInfo[]> {\r\n const { apiDomain, apiPath: { floorGraphic }, apiInfo } = this.config\r\n const url = `${apiDomain}${floorGraphic}?brand=${brand}&project=${project}&phase=${phase}&building=${building}&floor=${floor}&ts=${ts}&resource_type_list=${resource_type_list}`\r\n const data = await fetch(url, apiInfo)\r\n .then((res) => res.json())\r\n .then(res => res.data)\r\n .then((res: ResGraphicInfo[]): GraphicInfo[] => {\r\n (res || []).map(item => item.info = (JSON.parse(item.info)))\r\n return (res || []) as unknown as GraphicInfo[]\r\n })\r\n return data\r\n }\r\n\r\n getBuildingKey({ brand, project, phase, building }: Omit<LoadQuery, \"floor\" | \"ts\" | \"resource_type_list\">) {\r\n const key = `${brand}-${project}-${phase}-${building}`\r\n return key\r\n }\r\n\r\n private async loadBuildingGround({ brand, project, phase, building }: Omit<LoadQuery, \"floor\" | \"ts\" | \"resource_type_list\">): Promise<GraphicInfo | null>{ \r\n const key = this.getBuildingKey({ brand, project, phase, building })\r\n if (this.buildingGroundMap.get(key)) { \r\n return this.buildingGroundMap.get(key) || null\r\n }\r\n const { apiDomain, apiPath: { floorRange }, apiInfo } = this.config\r\n const url = `${apiDomain}${floorRange}?brand=${brand}&project=${project}&phase=${phase}&building=${building}`\r\n const data = await fetch(url, apiInfo)\r\n .then((res) => res.json())\r\n .then(res => res.data)\r\n .then((res: ResGraphicInfo[]): GraphicInfo | null => {\r\n const data = (res || [])[0]\r\n if (data) {\r\n data.info = JSON.parse(data.info)\r\n }\r\n return data as unknown as GraphicInfo | null\r\n })\r\n this.buildingGroundMap.set(key, data)\r\n return data\r\n }\r\n \r\n getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery) { \r\n const floorKey = `${brand}-${project}-${phase}-${building}-${floor}-${ts}-${resource_type_list}`\r\n return floorKey\r\n }\r\n\r\n async load({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery) {\r\n const floorKey = this.getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list })\r\n if (this.floorDataMap.get(floorKey)) { return }\r\n const [data, buildGround] = await Promise.all([\r\n this.loadGraphics({ brand, project, phase, building, floor, ts, resource_type_list }),\r\n this.loadBuildingGround({ brand, project, phase, building })\r\n ])\r\n if (buildGround) {\r\n const center = getCenter((buildGround.info.geometry as PolygonGeometry).cds[0])\r\n data.forEach(item => {\r\n if (item.info.geometry.type === \"polygon\") { \r\n item.info.geometry.cds.map(cds => {\r\n if (Array.isArray(cds)) {\r\n cds.forEach(coord => {\r\n coord[0] -= center[0]\r\n coord[1] -= center[1]\r\n })\r\n }\r\n })\r\n } else {\r\n // point\r\n const [x, y] = item.info.geometry.cds\r\n item.info.geometry.cds = [x - center[0], y - center[1]]\r\n }\r\n item.info.transformToBuildingGround = true\r\n })\r\n }\r\n const { ground, markGraphic, graphic } = this.config\r\n for (let i = 0; i < data.length; i++) {\r\n const item = data[i]\r\n item.info.deltaHeight = 0.00001 * (i + 1)\r\n if (item.info.group === \"ground\") {\r\n item.info.fillColor = ground.color\r\n item.info.fillOpacity = ground.opacity\r\n item.info.height = ground.height\r\n item.info.stroke = ground.stroke\r\n item.info.strokeColor = ground.strokeColor\r\n item.info.strokeOpacity = ground.strokeOpacity\r\n } else if (item.info.userData.mark) {\r\n item.info.height = markGraphic.height;\r\n item.info.fillColor = markGraphic.color;\r\n item.info.fillOpacity = markGraphic.opacity;\r\n item.info.stroke = markGraphic.stroke;\r\n item.info.strokeColor = markGraphic.strokeColor;\r\n item.info.strokeOpacity = markGraphic.strokeOpacity;\r\n } else {\r\n item.info.fillOpacity = graphic.fillOpacity;\r\n if (this.config.initTransToMark) { \r\n item.info.height = markGraphic.height;\r\n item.info.fillColor = markGraphic.color;\r\n item.info.stroke = markGraphic.stroke;\r\n item.info.strokeColor = markGraphic.strokeColor;\r\n item.info.strokeOpacity = markGraphic.strokeOpacity;\r\n }\r\n }\r\n }\r\n if (!this.config.useFloorCache) {\r\n this.floorDataMap.clear()\r\n }\r\n this.floorDataMap.set(floorKey, data)\r\n return data\r\n }\r\n\r\n private createFloor(data: GraphicInfo[]) { \r\n const curFloor = new Floor(this.context)\r\n if (!data.length) { return { curFloor, graphics: [] } }\r\n const legacyToGraphicMap = new Map<string, Graphic>()\r\n const graphics = []\r\n for (const item of data) {\r\n if (item.info.group === \"ground\") {\r\n curFloor.createGround(item.info)\r\n } else {\r\n const graphic = curFloor.addGraphic(item.info)\r\n graphic.userData.data = item\r\n legacyToGraphicMap.set(item.legacy_id, graphic)\r\n graphics.push(graphic)\r\n }\r\n }\r\n curFloor.addShadow()\r\n curFloor.userData.legacyToGraphicMap = legacyToGraphicMap\r\n return { curFloor, graphics }\r\n }\r\n\r\n switchFloor({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery) {\r\n const floorKey = this.getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list })\r\n const curFloorData = this.floorDataMap.get(floorKey)\r\n this.context.control.removeEventListener(\"change\", this.onControlChange)\r\n if (curFloorData) {\r\n const buildingKey = this.getBuildingKey({ brand, project, phase, building })\r\n this.currentBuildGround = this.buildingGroundMap.get(buildingKey) || null\r\n const createdFloor = this.createFloor(curFloorData)\r\n if (createdFloor) {\r\n this.context.cameraBound.setEnable(false)\r\n this.context.switchFloor(createdFloor.curFloor)\r\n // \u8BBE\u7F6Ezoom\r\n this.context.control.minZoom = 0;\r\n this.context.control.maxZoom = Infinity;\r\n this.context.camera.zoom = 1;\r\n this.context.setAzimuthalAngle(0, 0);\r\n this.context.fitCameraToGround(undefined, 0);\r\n this.basicZoom = this.context.camera.zoom;\r\n // \u8BBE\u7F6Ezoom\r\n this.context.control.minZoom = this.basicZoom;\r\n this.context.control.maxZoom = this.basicZoom * 25;\r\n this.context.control.addEventListener(\"change\", this.onControlChange)\r\n if (this.type === \"3d\") {\r\n this.context.fitCameraToGround([80, 20, 80, 20], 0, false)\r\n }\r\n this.onControlChange()\r\n this.context.cameraBound.setEnable(true)\r\n } else {\r\n console.warn(\"[switchFloor error] [\"+ floor +\"] \u697C\u5C42\u6CA1\u6709\u6570\u636E\")\r\n }\r\n } else {\r\n console.warn(\"[switchFloor error] \u6CA1\u6709\u8FD9\u4E2A\u697C\u5C42\uFF0C\u8BF7\u5148\u8C03\u7528load\u65B9\u6CD5\u52A0\u8F7D\u697C\u5C42\")\r\n }\r\n }\r\n\r\n onControlChange = () => {\r\n const { camera: { zoom } } = this.context\r\n if (zoom !== this.prevCameraZoom) {\r\n this.dispatchEvent({\r\n type: \"zoom-change\",\r\n basicZoom: this.basicZoom,\r\n cameraZoom: this.context.camera.zoom\r\n })\r\n this.prevCameraZoom = zoom\r\n }\r\n }\r\n\r\n // \u6276\u68AF\r\n addModel(graphic: Graphic, options: ModelOptions) { \r\n // \u6839\u636E\u6700\u957F\u8FB9\uFF0C\u83B7\u53D6\u6276\u68AF\u7684\u65B9\u5411\r\n if (graphic.options.geometry.type === \"polygon\") {\r\n // \u6839\u636E\u65B9\u5411\u6E32\u67D3\u6A21\u578B\r\n const model = this.context.currentFloor?.addModel({\r\n ...options,\r\n position: graphic.getPosition().setZ(0.1)\r\n })\r\n if (model) {\r\n const { facilityAngle = 0, facilityXScale = 1, facilityYScale = 1 } = graphic.options.userData\r\n model.rotateZ((180 - facilityAngle) / 180 * Math.PI)\r\n model.scale.set(facilityXScale, facilityYScale, 1)\r\n }\r\n }\r\n }\r\n\r\n addHeatmap(data: HeatmapDataParam) {\r\n return this.context.currentFloor?.addHeatmap(data)\r\n }\r\n\r\n getLegacyToGraphicMap(): Map<string, Graphic> {\r\n return this.context.currentFloor?.userData.legacyToGraphicMap || new Map()\r\n }\r\n\r\n /**\r\n * \u83B7\u53D6\u5F53\u524D\u697C\u5C42\u5168\u90E8\u7684graphic\r\n * @returns \r\n */\r\n getFloorAllGraphics(): Graphic[] {\r\n return this.context.currentFloor?.graphicLayer.children.filter(item => item instanceof Graphic) as Graphic[] || []\r\n }\r\n\r\n createGraphicPoi(graphic: Graphic, options: PoiOptionsParam) { \r\n if (this.context.currentFloor) {\r\n if (options.id === undefined) {\r\n options.id = graphic.options.id\r\n }\r\n const position = graphic.getCenter()\r\n const poi = this.context.currentFloor.addPoi({\r\n ...options,\r\n position: { ...position, z: position.z + graphic.options.height / 2 }\r\n })\r\n return poi\r\n }\r\n return null\r\n }\r\n\r\n removeHeatMap() {\r\n this.context.currentFloor?.removeHeatMap()\r\n }\r\n\r\n /**\r\n * \u79FB\u52A8\u76F8\u673A\u4F4D\u7F6E\u8BA9\u9009\u4E2D\u7684\u5143\u7D20\u5C45\u4E2D\u663E\u793A\r\n * @param ele { Graphic | Poi }\r\n * @param duration\r\n */\r\n translateElementToCenter(ele: { getPosition: () => Vector3 }, duration: number = 500) {\r\n const position = ele.getPosition()\r\n return this.context.setCameraPosition(position, duration);\r\n }\r\n\r\n /**\r\n * \u79FB\u52A8\u76F8\u673A\u4F4D\u7F6E\u8BA9\u9009\u4E2D\u7684\u5143\u7D20\u5C45\u4E2D\u663E\u793A\r\n * @param ele { Graphic | Poi }\r\n * @param duration\r\n */\r\n async translateElementToCenterX(ele: { getPosition: () => Vector3 }, duration: number = 500) {\r\n const { y, z } = this.context.control.target\r\n const position = ele.getPosition()\r\n position.setY(y)\r\n position.setZ(z)\r\n await this.context.setCameraPosition(position, duration);\r\n }\r\n\r\n /**\r\n * \u83B7\u53D6\u7269\u4F53\u7684\u5C4F\u5E55\u5750\u6807\r\n */\r\n getElementDeviceCoordinate(ele: Object3D) {\r\n const vector = ele.position.clone();\r\n const { clientWidth, clientHeight } = this.container;\r\n return vector3ToDevice(\r\n vector,\r\n this.context.camera,\r\n clientWidth,\r\n clientHeight\r\n );\r\n }\r\n\r\n /**\r\n * \u5207\u63622d\u30013d\u89C6\u89D2\r\n * @param type\r\n * @param duration\r\n */\r\n changeMapType(type: MapType, duration = 500) {\r\n this.type = type;\r\n if (type === \"2d\") {\r\n return this.context.setPolarAngle(MapTypePolar.D2, duration);\r\n } else {\r\n return this.context.setPolarAngle(MapTypePolar.D3, duration);\r\n }\r\n }\r\n\r\n async resetView(duration = 300) { \r\n const time = duration / 3\r\n await this.context.setAzimuthalAngle(0, time)\r\n await this.changeMapType(this.type, time)\r\n await this.context.fitCameraToGround(undefined, time)\r\n }\r\n\r\n /**\r\n * \u7F29\u5C0F\u5730\u56FE\r\n * @param zoom\r\n * @param duration\r\n * @returns\r\n */\r\n reduceMap(zoom = 0.5, duration = 500) {\r\n const cameraZoom = this.context.camera.zoom;\r\n return this.context.setZoom(\r\n cameraZoom - zoom,\r\n this.context.control.target,\r\n duration\r\n );\r\n }\r\n\r\n /**\r\n * \u653E\u5927\u5730\u56FE\r\n * @param zoom\r\n * @param duration\r\n * @returns\r\n */\r\n enlargeMap(zoom = 0.5, duration = 500) {\r\n const cameraZoom = this.context.camera.zoom;\r\n return this.context.setZoom(\r\n cameraZoom + zoom,\r\n this.context.control.target,\r\n duration\r\n );\r\n }\r\n\r\n onKeydown = (e: KeyboardEvent) => {\r\n if (this.polarKeys.includes(e.code)) {\r\n this.context.control.maxPolarAngle = this.config.control.maxPolar;\r\n this.context.control.minPolarAngle = 0;\r\n }\r\n if (this.azimuthalKeys.includes(e.code)) {\r\n this.context.control.maxAzimuthAngle = Infinity;\r\n this.context.control.minAzimuthAngle = Infinity;\r\n }\r\n };\r\n\r\n onKeyUp = (e: KeyboardEvent) => {\r\n if (this.polarKeys.includes(e.code)) {\r\n const polar = this.context.control.getPolarAngle();\r\n this.context.control.maxPolarAngle = polar;\r\n this.context.control.minPolarAngle = polar;\r\n }\r\n if (this.azimuthalKeys.includes(e.code)) {\r\n const azimuthal = this.context.control.getAzimuthalAngle();\r\n this.context.control.maxAzimuthAngle = azimuthal;\r\n this.context.control.minAzimuthAngle = azimuthal;\r\n }\r\n };\r\n\r\n registryEvent() {\r\n window.addEventListener(\"keydown\", this.onKeydown);\r\n window.addEventListener(\"keyup\", this.onKeyUp);\r\n if (this.config.resizeObserver) {\r\n const observe = new ResizeObserver(debounce(this.resize, 5))\r\n observe.observe(this.container)\r\n this.observe = observe\r\n }\r\n }\r\n\r\n unRegistryEvent() {\r\n window.removeEventListener(\"keydown\", this.onKeydown);\r\n window.removeEventListener(\"keyup\", this.onKeyUp);\r\n this.observe?.disconnect()\r\n this.observe = null;\r\n }\r\n\r\n /**\r\n * \u914D\u7F6E\u5750\u6807\u5B9A\u70B9 2D/3D\u7EBF\u6027\u5207\u6362\u7684\u5FEB\u6377\u952E\r\n * @param key\r\n */\r\n configurePolarShortcutKeys(keys: string[]) {\r\n this.polarKeys = keys;\r\n }\r\n\r\n configureAzimuthalShortcutKeys(keys: string[]) {\r\n this.azimuthalKeys = keys;\r\n }\r\n\r\n rotateMap(radius = 0.1) {\r\n const azimuthal = this.context.control.getAzimuthalAngle();\r\n this.context.control.maxAzimuthAngle = azimuthal + radius;\r\n this.context.control.minAzimuthAngle = azimuthal + radius;\r\n this.context.control.update()\r\n }\r\n\r\n /**\r\n * \u6D4B\u91CF\u8DDD\u79BB\r\n * @returns \r\n */\r\n async measureDistance() { \r\n this.cancelDistance()\r\n return new Promise((resolve, reject) => { \r\n this.changeMapType('2d', 0)\r\n this.context.control.enableRotate = false; // \u6D4B\u91CF\u53EA\u80FD\u57282d\u4E2D\u8FDB\u884C\r\n this.svgLine = new SvgLine(this.context)\r\n const dispose = this.svgLine.dispose.bind(this.svgLine)\r\n this.svgLine.dispose = function () {\r\n dispose();\r\n reject(\"cancel\")\r\n }\r\n this.svgLine.addEventListener(\"distance\", ({ distance }) => {\r\n resolve(distance)\r\n })\r\n }) \r\n }\r\n\r\n /**\r\n * \u53D6\u6D88\u6D4B\u91CF\u957F\u5EA6\r\n */\r\n cancelDistance() {\r\n if (this.svgLine) {\r\n this.svgLine.dispose()\r\n this.svgLine = undefined;\r\n this.context.control.enableRotate = true;\r\n }\r\n }\r\n\r\n /**\r\n * \u6D4B\u91CF\u9762\u79EF\r\n */\r\n measureArea() { \r\n this.cancelArea()\r\n return new Promise((resolve, reject) => {\r\n this.changeMapType('2d', 0)\r\n this.context.control.enableRotate = false; // \u6D4B\u91CF\u53EA\u80FD\u57282d\u4E2D\u8FDB\u884C\r\n this.svgPolygon = new SvgPolygon(this.context)\r\n const dispose = this.svgPolygon.dispose.bind(this.svgPolygon)\r\n this.svgPolygon.dispose = function () {\r\n dispose();\r\n reject(\"cancel\")\r\n }\r\n this.svgPolygon.addEventListener(\"area\", ({ area }) => {\r\n resolve(area)\r\n })\r\n })\r\n }\r\n\r\n /**\r\n * \u53D6\u6D88\u6D4B\u91CF\u9762\u79EF\r\n */\r\n cancelArea() {\r\n if (this.svgPolygon) {\r\n this.svgPolygon.dispose()\r\n this.svgPolygon = undefined\r\n this.context.control.enableRotate = true;\r\n }\r\n }\r\n\r\n /**\r\n * \u6839\u636EnodeId \u83B7\u53D6graphic\r\n */\r\n getGraphicByNodeId(nodeId: string) {\r\n return this.context.currentFloor?.graphicLayer.getGraphicByNodeId(nodeId) || null\r\n }\r\n\r\n deleteGraphic(graphic: Graphic) {\r\n this.context.currentFloor?.graphicLayer.removeGraphic(graphic)\r\n }\r\n\r\n createGraphicByOptions(options: GraphicOptions) {\r\n if (!options.transformToBuildingGround) {\r\n if (this.currentBuildGround) {\r\n const center = getCenter((this.currentBuildGround.info.geometry as PolygonGeometry).cds[0])\r\n if (options.geometry.type === \"polygon\") {\r\n options.geometry.cds.map(cds => {\r\n if (Array.isArray(cds)) {\r\n cds.forEach(coord => {\r\n coord[0] -= center[0]\r\n coord[1] -= center[1]\r\n })\r\n }\r\n })\r\n } else {\r\n // point\r\n const [x, y] = options.geometry.cds\r\n options.geometry.cds = [x - center[0], y - center[1]]\r\n }\r\n }\r\n }\r\n return this.context.currentFloor?.graphicLayer.createGraphic(options)\r\n }\r\n\r\n removePoiById(id: string) { \r\n return this.context.currentFloor?.poiLayer.removePoiById(id)\r\n }\r\n\r\n getPoiById(id: string) { \r\n return this.context.currentFloor?.poiLayer.getPoiById(id)\r\n }\r\n\r\n getPois() { \r\n return (this.context.currentFloor?.poiLayer.pois || []).filter(item => !item.options.built_in)\r\n }\r\n\r\n clearPoi() {\r\n if (this.context.currentFloor) { \r\n this.context.currentFloor.poiLayer.clear()\r\n }\r\n }\r\n\r\n removeSelectGraphic(graphic: Graphic) { \r\n this.context.selection.remove(graphic)\r\n }\r\n\r\n resize = () => { \r\n this.context.cameraBound.setEnable(false)\r\n this.context.onWindowResize();\r\n const azimuthal = this.context.control.getAzimuthalAngle();\r\n const zoom = this.context.camera.zoom;\r\n // \u8BBE\u7F6Ezoom\r\n this.context.control.minZoom = 0;\r\n this.context.control.maxZoom = Infinity;\r\n this.context.camera.zoom = 1;\r\n this.context.setAzimuthalAngle(0, 0);\r\n const basicZoom = this.context.getFitCameraToGroundZoom(undefined, 0);\r\n this.basicZoom = basicZoom || 0;\r\n // \u8BBE\u7F6Ezoom\r\n this.context.control.minZoom = this.basicZoom;\r\n this.context.control.maxZoom = this.basicZoom * 25;\r\n this.context.camera.zoom = zoom;\r\n this.context.control.addEventListener(\"change\", this.onControlChange)\r\n this.context.setAzimuthalAngle(azimuthal, 0);\r\n this.context.cameraBound.setEnable(true)\r\n }\r\n\r\n dispose() {\r\n this.context.dispose();\r\n this.floorDataMap.clear();\r\n this.buildingGroundMap.clear();\r\n clearTextTexture();\r\n clearCanvas();\r\n disposeLoader();\r\n this.unRegistryEvent();\r\n }\r\n}\r\n", "type Fn = (...arg: any) => any\r\n\r\n/**\r\n * \u4EFB\u52A1\u7BA1\u7406\u5668\r\n * \u5728\u7C7B\u9500\u6BC1\u7684\u65F6\u5019\uFF0C\u8981\u6E05\u9664\u6240\u6709\u7684\u5F02\u6B65\u5B9A\u65F6\u5668\r\n */\r\nexport class Timer { \r\n tasks = {\r\n requestAnimation: new Set<number>(),\r\n timeout: new Set<number>(),\r\n interval: new Set<number>()\r\n }\r\n\r\n requestAnimationFrame(fn: Fn): number { \r\n const timer = window.requestAnimationFrame(() => {\r\n this.tasks.requestAnimation.delete(timer)\r\n fn()\r\n })\r\n this.tasks.requestAnimation.add(timer)\r\n return timer\r\n }\r\n\r\n cancelAnimationFrame(timer: number) { \r\n this.tasks.requestAnimation.delete(timer)\r\n window.cancelAnimationFrame(timer)\r\n }\r\n\r\n setTimeout(fn: Fn, wait: number): number { \r\n const timer = window.setTimeout(() => {\r\n this.tasks.timeout.delete(timer)\r\n fn()\r\n }, wait)\r\n this.tasks.timeout.add(timer)\r\n return timer\r\n }\r\n\r\n clearTimeout(timer: number) {\r\n this.tasks.timeout.delete(timer)\r\n window.clearTimeout(timer)\r\n }\r\n\r\n setInterval(fn: Fn, wait: number): number { \r\n const timer = window.setInterval(() => {\r\n this.tasks.interval.delete(timer)\r\n fn()\r\n }, wait)\r\n this.tasks.interval.add(timer)\r\n return timer\r\n }\r\n\r\n clearInterval(timer: number) {\r\n this.tasks.interval.delete(timer)\r\n window.clearInterval(timer)\r\n }\r\n\r\n dispose() { \r\n this.tasks.requestAnimation.forEach(timer => {\r\n window.cancelAnimationFrame(timer)\r\n })\r\n this.tasks.requestAnimation.clear()\r\n this.tasks.timeout.forEach(timer => {\r\n window.clearTimeout(timer)\r\n })\r\n this.tasks.timeout.clear()\r\n this.tasks.interval.forEach(timer => {\r\n window.clearInterval(timer)\r\n }) \r\n this.tasks.interval.clear()\r\n }\r\n}", "import { Coordinate } from 'src/types'\r\nimport {\r\n Scene, WebGLRenderer, OrthographicCamera, HemisphereLight, Shape, \r\n PCFSoftShadowMap, Group, Color, DirectionalLight, AmbientLight, Path, Vector2\r\n} from 'three'\r\nimport { MapControls } from 'three/examples/jsm/controls/MapControls'\r\n\r\nexport function initScene() {\r\n const scene = new Scene()\r\n scene.background = new Color(0xffffff)\r\n return scene\r\n}\r\n\r\nexport function initRenderer() {\r\n const renderer = new WebGLRenderer({\r\n antialias: true,\r\n // logarithmicDepthBuffer: true,\r\n // alpha: false,\r\n // premultipliedAlpha: false\r\n })\r\n renderer.autoClear = true\r\n renderer.setClearAlpha(1);\r\n renderer.setClearColor(0xffffff);\r\n renderer.setPixelRatio(window.devicePixelRatio);\r\n renderer.shadowMap.enabled = true;\r\n renderer.shadowMap.autoUpdate = true;\r\n renderer.shadowMap.type = PCFSoftShadowMap;\r\n return renderer\r\n}\r\n\r\nexport function initCamera(width: number, height: number): OrthographicCamera {\r\n const camera = new OrthographicCamera(-width / 2, width / 2, height / 2, -height / 2, -1000, 5000)\r\n camera.up.set(0, 0, 1);\r\n camera.position.set(0, 0, 100);\r\n camera.lookAt(0, 0, 0);\r\n return camera\r\n}\r\n\r\nexport function initLight() {\r\n const lights = new Group()\r\n // \u534A\u7403\u5149\r\n // const hemisphereLight = new HemisphereLight(0xffffff, 0xffffff, 1);\r\n // hemisphereLight.intensity = 1;\r\n // hemisphereLight.position.set(0, 0, 10);\r\n // hemisphereLight.up.set(0, 0, 1);\r\n // lights.add(hemisphereLight)\r\n const ambientLight = new AmbientLight(0xffffff, 2.6);\r\n lights.add(ambientLight)\r\n return lights\r\n}\r\n\r\nexport function initControl(camera: OrthographicCamera, domElement: HTMLCanvasElement) {\r\n const control = new MapControls(camera, domElement)\r\n // \u7981\u7528\u963B\u5C3C\r\n control.enableDamping = false\r\n // \u8BBE\u7F6E2.5D\r\n // control.maxPolarAngle = 0\r\n // control.minPolarAngle = 0\r\n // \u7981\u7528\u6C34\u5E73\u65CB\u8F6C\r\n // control.maxAzimuthAngle = 0\r\n // control.minAzimuthAngle = 0\r\n control.zoomSpeed = 2\r\n return control\r\n}\r\n\r\nexport function initShape(path: Coordinate[], holePath: Coordinate[][] = []) { \r\n const shape = new Shape(path.map(item => new Vector2(...item)));\r\n if (holePath.length) {\r\n holePath.forEach(cur => {\r\n var hole = new Path(cur.map(item => new Vector2(...item)));\r\n shape.holes.push(hole);\r\n })\r\n }\r\n return shape\r\n}\r\n\r\nexport function initDirectionalLight(color = 0xffffff, intensity = 1) {\r\n const directionalLight = new DirectionalLight(color, intensity);\r\n directionalLight.castShadow = true;\r\n directionalLight.shadow.radius = 8;\r\n directionalLight.shadow.bias = -0.001;\r\n directionalLight.shadow.mapSize.set(256, 256);\r\n directionalLight.shadow.camera.left = -200;\r\n directionalLight.shadow.camera.right = 200;\r\n directionalLight.shadow.camera.top = 200;\r\n directionalLight.shadow.camera.bottom = -200;\r\n return directionalLight\r\n}", "import { Object3D, Mesh, Light } from 'three'\r\n\r\nexport function dispose(o: Object3D, recursive?: boolean): void {\r\n if (recursive && o.children && o.children.length) {\r\n o.children.forEach((child) => {\r\n dispose(child, recursive);\r\n });\r\n }\r\n if ((o as Mesh).isMesh) {\r\n const m = o as Mesh;\r\n if (m.geometry) m.geometry.dispose();\r\n if (m.material) {\r\n if (Array.isArray(m.material)) {\r\n m.material.forEach((mat) => {\r\n mat.dispose();\r\n });\r\n } else {\r\n m.material.dispose();\r\n }\r\n }\r\n }\r\n if ((o as Light).isLight) {\r\n (o as Light).dispose?.()\r\n }\r\n}", "export function hasChinese(str:string) {\r\n return /[\\u4E00-\\u9FA5]+/g.test(str);\r\n}", "import { hasChinese } from './rules'\r\nimport { DataTexture, RGBAFormat, LinearFilter } from 'three'\r\n\r\nconst urlTextureMap = new Map()\r\nconst textTextureMap = new Map<string, DataTexture>()\r\n\r\nexport function initCanvas() {\r\n const canvas = document.createElement('canvas');\r\n canvas.width = 1024;\r\n canvas.height = 64;\r\n const ctx = canvas.getContext('2d', {\r\n willReadFrequently: true,\r\n }) as CanvasRenderingContext2D;\r\n ctx.font = '54px sans-serif';\r\n ctx.textBaseline = 'hanging';\r\n ctx.lineWidth = 12;\r\n ctx.fillStyle = 'rgba(0,0,0,1)';\r\n ctx.strokeStyle = 'white';\r\n return { canvas, ctx }\r\n}\r\n\r\nlet canvas: HTMLCanvasElement;\r\nlet ctx: CanvasRenderingContext2D;\r\n\r\nexport function createCanvas() {\r\n if (!canvas) {\r\n const { canvas: c, ctx: t } = initCanvas()\r\n canvas = c;\r\n ctx = t;\r\n }\r\n}\r\n\r\nexport function getTextureByText(text: string): DataTexture {\r\n if (textTextureMap.has(text)) {\r\n return textTextureMap.get(text)!\r\n }\r\n createCanvas()\r\n\r\n ctx.clearRect(0, 0, 1024, 64);\r\n const y = hasChinese(text) ? 4 : 8;\r\n ctx.strokeText(text, 2, y);\r\n ctx.fillText(text, 2, y);\r\n\r\n let width = Math.ceil(ctx.measureText(text).width);\r\n width = width % 2 === 0 ? width : width + 1;\r\n width += 2;\r\n const imageData = ctx.getImageData(0, 0, width, 64);\r\n const texture = new DataTexture(\r\n Uint8Array.from(imageData.data),\r\n width,\r\n 64,\r\n RGBAFormat,\r\n );\r\n texture.flipY = true;\r\n texture.minFilter = LinearFilter;\r\n texture.magFilter = LinearFilter;\r\n\r\n textTextureMap.set(text, texture);\r\n return texture;\r\n}\r\n\r\nexport function clearTextTexture() {\r\n textTextureMap.clear()\r\n}\r\n\r\nexport function clearCanvas() {\r\n ctx = null as unknown as CanvasRenderingContext2D;\r\n canvas = null as unknown as HTMLCanvasElement;\r\n}", "import { Coordinate } from 'src/types';\r\nimport { Vector3, Camera } from 'three';\r\nimport { point, featureCollection, center } from '@turf/turf'\r\n\r\n/**\r\n * 3D\u5750\u6807\u8F6C\u5C4F\u5E55\u5750\u6807\r\n * @param vector \r\n * @param camera \r\n * @param w container\u7684\u5BBD\r\n * @param h container\u7684\u9AD8\r\n * @returns \r\n */\r\nexport function vector3ToDevice(vector: Vector3, camera: Camera, w: number, h: number) {\r\n const _vector = vector.clone().project(camera);//\u901A\u8FC7\u4E16\u754C\u5750\u6807\u83B7\u53D6\u8F6C\u6807\u51C6\u8BBE\u5907\u5750\u6807\r\n const _w = w / 2;\r\n const _h = h / 2;\r\n const x = Math.round(_vector.x * _w + _w);//\u6807\u51C6\u8BBE\u5907\u5750\u6807\u8F6C\u5C4F\u5E55\u5750\u6807\r\n const y = Math.round(-_vector.y * _h + _h);\r\n return { x, y }\r\n}\r\n\r\n\r\n/**\r\n * \u83B7\u53D6\u591A\u53D8\u5F62\u7684\u4E2D\u5FC3\u70B9\r\n * @param coordinates \r\n */\r\nexport function getCenter(coordinates: Coordinate[]) {\r\n const features = featureCollection(coordinates.map(item => point(item)))\r\n const cent = center(features)\r\n return cent.geometry.coordinates\r\n}\r\n\r\ntype Position = {\r\n x: number,\r\n y: number\r\n}\r\nexport function isContain(point: Position, start: Position, end: Position) {\r\n // \u5224\u65AD point\u662F\u5426\u5728 start \u548Cend\u5F62\u6210\u7684\u77E9\u5F62\u4E2D\r\n return point.x >= start.x &&\r\n point.x <= end.x &&\r\n point.y >= start.y &&\r\n point.y <= end.y \r\n}\r\n\r\n/**\r\n * \u83B7\u53D6\u6700\u957F\u8FB9\u7684\u65B9\u5411\r\n * @param cds \r\n */\r\nexport function getLongestSideDir(cds: Coordinate[]) { \r\n let maxDistance = 0;\r\n let dir = new Vector3();\r\n for (let i = 1; i < cds.length; i++) { \r\n const point_0 = new Vector3(cds[i - 1][0], cds[i - 1][1], 0);\r\n const point_1 = new Vector3(cds[i][0], cds[i][1], 0);\r\n const distance = point_1.distanceTo(point_0)\r\n if (distance > maxDistance) {\r\n maxDistance = distance;\r\n dir = point_1.clone().sub(point_0).normalize();\r\n }\r\n }\r\n return dir;\r\n}", "import { EventDispatcher } from 'three'\r\n\r\nexport function proxyOptions\r\n <T extends Record<string, any>, M extends { [K in keyof T as `change-${Extract<K, string>}`]: { value: T[K] } }>\r\n (target: T, master: EventDispatcher<M>): T\r\n{ \r\n return new Proxy<T>(target, {\r\n get: (target, p, receiver) => {\r\n return Reflect.get(target, p, receiver)\r\n },\r\n set: (target, p, newValue, receiver) => {\r\n const oldValue = Reflect.get(target, p, receiver)\r\n const res = Reflect.set(target, p, newValue, receiver)\r\n if (oldValue !== newValue) {\r\n master.dispatchEvent({ type: `change-${p as Extract<keyof T, string>}`, value: newValue } as any)\r\n }\r\n return res\r\n }\r\n })\r\n}", "/**\r\n * \u53EF\u4EE5\u8BBE\u7F6E\u8D85\u65F6\u65F6\u95F4\u7684promise\r\n * @param promise \r\n * @param timeout \r\n * @returns \r\n */\r\nexport function timeoutPromise<T>(promise: Promise<T>, timeout: number): Promise<T> {\r\n return Promise.race([\r\n promise,\r\n new Promise<T>((resolve, reject) => {\r\n setTimeout(() => reject(new Error(\"Promise timeout\")), timeout);\r\n })\r\n ]);\r\n}", "export function createSvgElement(tag: string) {\r\n return document.createElementNS('http://www.w3.org/2000/svg', tag); \r\n}\r\n\r\n/**\r\n * \u521B\u5EFAsvg\r\n */\r\nexport function createSvg(w: string, h: string) {\r\n const svg = createSvgElement(\"svg\");\r\n svg.setAttribute(\"width\", w)\r\n svg.setAttribute(\"height\", h)\r\n svg.style.cssText = \"position: absolute; left: 0; top: 0; pointer-events: none;\"\r\n return svg;\r\n}\r\n\r\n/**\r\n * \u521B\u5EFA\u5706\u70B9\r\n * @param radius \r\n */\r\nexport function createCircle(radius = \"2\", fill: string) {\r\n const circle = createSvgElement(\"circle\");\r\n circle.setAttribute(\"r\", radius)\r\n circle.setAttribute(\"fill\", fill)\r\n return circle\r\n}\r\n\r\n/**\r\n * \u521B\u5EFA\u7EBF\r\n * @param stroke \r\n */\r\nexport function createLine(stroke: string) {\r\n const line = createSvgElement(\"line\")\r\n line.setAttribute(\"stroke\", stroke)\r\n return line\r\n}\r\n\r\n/**\r\n * \u521B\u5EFA\u77E9\u5F62\r\n * @param stroke \r\n * @returns \r\n */\r\nexport function createRect(stroke: string, fill: string) {\r\n const rect = createSvgElement(\"rect\")\r\n rect.setAttribute(\"stroke\", stroke)\r\n rect.setAttribute(\"fill\", fill)\r\n return rect\r\n}\r\n\r\nexport function setCirclePosition(circle: SVGElement, x: number, y: number) {\r\n circle.setAttribute('cx', `${x}`)\r\n circle.setAttribute('cy', `${y}`)\r\n}\r\n\r\ntype Position = { x: number; y: number }\r\n\r\nexport function setLineStartEnd(line: SVGElement, start?: Position, end?: Position) {\r\n if (start) { \r\n line.setAttribute(\"x1\", `${start.x}`)\r\n line.setAttribute(\"y1\", `${start.y}`)\r\n }\r\n if (end) {\r\n line.setAttribute(\"x2\", `${end.x}`)\r\n line.setAttribute(\"y2\", `${end.y}`)\r\n }\r\n}\r\n\r\nexport function setRectPosition(rect: SVGElement, x: number, y: number, w: number, h: number) {\r\n rect.setAttribute('x', `${x}`)\r\n rect.setAttribute('y', `${y}`)\r\n rect.setAttribute('width', `${w}`)\r\n rect.setAttribute('height', `${h}`)\r\n}", "export function sleepOnePromise() {\r\n return Promise.resolve()\r\n}\r\n\r\nexport function sleepOneRf() { \r\n return new Promise(resolve => {\r\n requestAnimationFrame(resolve)\r\n })\r\n}", "export function strToNumber(str: string) {\r\n return parseInt(str.replace(\"#\", \"0x\"), 16);\r\n}\r\n\r\n/**\r\n * \u7ED9\u989C\u8272\u52A0\u4E0A\u900F\u660E\u5EA6\r\n * @param hexColor\r\n * @param alpha\r\n * @returns\r\n */\r\nexport function addAlphaToHexColor(hexColor: string, alpha: number) {\r\n // \u5C0616\u8FDB\u5236\u989C\u8272\u503C\u8F6C\u6362\u4E3ARGB\u6570\u503C\r\n let r = parseInt(hexColor.substring(1, 3), 16);\r\n let g = parseInt(hexColor.substring(3, 5), 16);\r\n let b = parseInt(hexColor.substring(5, 7), 16);\r\n\r\n // \u8BA1\u7B97\u65B0\u7684RGB\u6570\u503C\r\n let newR = Math.round(r * alpha);\r\n let newG = Math.round(g * alpha);\r\n let newB = Math.round(b * alpha);\r\n\r\n // \u5C06\u65B0\u7684RGB\u6570\u503C\u8F6C\u6362\u4E3A16\u8FDB\u5236\u683C\u5F0F\r\n let newHexColor = `#${(1 << 24 | newR << 16 | newG << 8 | newB).toString(16).slice(1)}`;\r\n\r\n return newHexColor;\r\n}\r\n\r\nexport function darkenColor(hexColor: string) {\r\n // \u5C06\u5341\u516D\u8FDB\u5236\u989C\u8272\u8F6C\u6362\u4E3ARGB\r\n let r = parseInt(hexColor.substring(1, 3), 16);\r\n let g = parseInt(hexColor.substring(3, 5), 16);\r\n let b = parseInt(hexColor.substring(5, 7), 16);\r\n\r\n const factor = 0.7\r\n // \u8BA1\u7B97\u6697\u70B9\u989C\u8272\r\n r = Math.floor(r * factor);\r\n g = Math.floor(g * factor);\r\n b = Math.floor(b * factor);\r\n\r\n // \u5C06RGB\u989C\u8272\u8F6C\u6362\u56DE\u5341\u516D\u8FDB\u5236\r\n let darkHexColor = \"#\" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);\r\n\r\n return darkHexColor;\r\n}\r\n", "import { Object3D, Scene, Mesh, MeshBasicMaterial } from 'three'\r\nimport { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'\r\n\r\nfunction createLoader() { \r\n const loader = new GLTFLoader()\r\n return loader\r\n}\r\n\r\nlet loader: GLTFLoader | null = null\r\nlet modelMap = new Map<string, Promise<GLTF>>()\r\n\r\n/**\r\n * \u52A0\u8F7D\u6A21\u578B\r\n * @param url \r\n * @returns \r\n */\r\nexport function loadModel(url: string): Promise<GLTF> { \r\n if (modelMap.has(url)) {\r\n const gltf = modelMap.get(url)!.then(gltf => { \r\n gltf.scene = gltf.scene.clone()\r\n return gltf\r\n })\r\n }\r\n if (!loader) {\r\n loader = createLoader()\r\n }\r\n const p = new Promise<GLTF>((resolve, reject) => { \r\n loader!.load(url, gltf => {\r\n resolve(gltf)\r\n }, undefined, reject)\r\n })\r\n modelMap.set(url, p)\r\n return p.then(gltf => { \r\n gltf.scene = gltf.scene.clone()\r\n return gltf\r\n })\r\n}\r\n\r\nexport function disposeLoader() { \r\n loader = null\r\n modelMap.clear()\r\n}", "export const isMac = navigator.userAgent.toUpperCase().indexOf('MAC') >= 0;\r\n", "import { isMac } from \"./os\";\r\n\r\nexport function isControl(key: string) { \r\n if (isMac) {\r\n return key === \"Meta\"\r\n }\r\n return key === \"Control\"\r\n}", "import { MapControls } from \"three/examples/jsm/controls/MapControls\";\r\nimport {\r\n Timer,\r\n initCamera,\r\n initRenderer,\r\n initScene,\r\n initLight,\r\n initControl,\r\n dispose,\r\n vector3ToDevice,\r\n timeoutPromise,\r\n} from \"./utils\";\r\nimport {\r\n EventDispatcher,\r\n OrthographicCamera,\r\n Light,\r\n Box2,\r\n Vector3,\r\n Vector2,\r\n Raycaster,\r\n Object3D,\r\n Box3,\r\n Color,\r\n AmbientLight,\r\n} from \"three\";\r\nimport { Graphic, Poi, Floor } from \"./elements\";\r\nimport { Group as TweenGroup, Tween } from \"@tweenjs/tween.js\";\r\nimport { Config } from \"./config\";\r\nimport { Selection } from \"./operations/selection/selection\";\r\nimport { HoverHelper } from \"./operations\";\r\nimport { MaterialFactory } from \"./factory\";\r\nimport { CameraBound } from \"./utils/camera-bound\";\r\n\r\nexport interface ContextEventMap {\r\n update: {};\r\n \"graphic-click\": {\r\n graphics: Graphic[];\r\n position: Vector3 | null\r\n };\r\n \"poi-click\": {\r\n pois: Poi[];\r\n };\r\n 'pointer-level': {};\r\n 'pointer-over': {\r\n e: PointerEvent;\r\n graphics: Graphic[];\r\n pois: Poi[];\r\n position: Vector3 | null;\r\n };\r\n 'pointer-move': {\r\n e: PointerEvent;\r\n graphics: Graphic[];\r\n pois: Poi[];\r\n position: Vector3 | null;\r\n },\r\n 'change-ratio': {\r\n px: number;\r\n },\r\n \"select-graphic\": {\r\n graphics: Graphic[],\r\n isMultipleSelect: boolean,\r\n },\r\n \"hover\": {\r\n graphics: Graphic[];\r\n },\r\n \"control-change\": {},\r\n \"resize\": {\r\n width: number;\r\n height: number;\r\n }\r\n}\r\n\r\nexport class Context extends EventDispatcher<ContextEventMap> {\r\n scene = initScene();\r\n\r\n renderer = initRenderer();\r\n\r\n camera!: OrthographicCamera;\r\n\r\n control!: MapControls;\r\n\r\n lights = initLight();\r\n\r\n // \u7BA1\u7406\u4EFB\u52A1\uFF0C\u9632\u6B62\u5185\u5B58\u6CC4\u6F0F\r\n timer = new Timer();\r\n \r\n tweenGroup = new TweenGroup();\r\n \r\n currentFloor?: Floor;\r\n\r\n selection: Selection;\r\n\r\n hoverHelper: HoverHelper;\r\n \r\n private basicRatio?: number; // zoom=1\u7684\u65F6\u5019\uFF0C100M\u5BF9\u5E94\u7684\u50CF\u7D20\u4E2A\u6570\r\n\r\n public materialFactory!: MaterialFactory;\r\n\r\n cameraBound!: CameraBound;\r\n\r\n clientSize = {\r\n width: 0,\r\n height: 0,\r\n x: 0,\r\n y: 0\r\n }\r\n\r\n constructor(public container: HTMLElement, public config: Config) {\r\n super();\r\n this.container.style.position = \"relative\";\r\n this.container.style.overflow = \"hidden\";\r\n this.init();\r\n this.selection = new Selection(this);\r\n this.hoverHelper = new HoverHelper(this);\r\n this.materialFactory = new MaterialFactory(this);\r\n this.resizeClientSize()\r\n this.registryEvent();\r\n }\r\n\r\n resizeClientSize() { \r\n const { x, y, width, height } = this.container.getBoundingClientRect()\r\n this.clientSize = {\r\n width: width || this.container.clientWidth,\r\n height: height || this.container.clientHeight,\r\n x,\r\n y\r\n }\r\n }\r\n\r\n init() {\r\n const { clientWidth: w, clientHeight: h } = this.container;\r\n this.camera = initCamera(w, h);\r\n this.renderer.setSize(w, h);\r\n this.control = initControl(this.camera, this.renderer.domElement);\r\n this.control.maxPolarAngle = this.config.control.maxPolar;\r\n this.container.appendChild(this.renderer.domElement);\r\n this.scene.add(this.lights);\r\n this.basicRatio = this.getRatio()\r\n // \u65CB\u8F6C\u89C6\u89D2\u7684\u65F6\u5019\uFF0C\u9690\u85CF\u548C\u663E\u793A\u9634\u5F71\r\n this.control.addEventListener(\"change\", () => {\r\n const polarAngle = this.control.getPolarAngle();\r\n this.currentFloor?.setShadowOpacity(polarAngle / this.config.control.maxPolar)\r\n this.dispatchEvent({ type: 'change-ratio', px: (this.basicRatio || 0) * this.camera.zoom })\r\n this.dispatchEvent({ type: 'control-change' })\r\n });\r\n this.cameraBound = new CameraBound(this);\r\n }\r\n\r\n /**\r\n * \u83B7\u53D6\u4E24\u4E2A\u70B9\u4E4B\u95F4\u7684\u50CF\u7D20\u6570\r\n */\r\n getRatio(point1 = new Vector3(0, 0, 0), point2 = new Vector3(100, 0, 0)) {\r\n const { clientWidth, clientHeight } = this.container\r\n const device1 = vector3ToDevice(point1, this.camera, clientWidth, clientHeight)\r\n const device2 = vector3ToDevice(point2, this.camera, clientWidth, clientHeight)\r\n return Math.ceil(Math.sqrt((device2.x - device1.x) ** 2 + (device2.y - device1.y) ** 2))\r\n }\r\n\r\n changeAmbientLightColor(color: string | number) {\r\n this.lights.children.forEach((item) => {\r\n if (item instanceof AmbientLight) {\r\n item.color = new Color(color);\r\n }\r\n });\r\n }\r\n\r\n switchFloor(floor: Floor) {\r\n if (this.currentFloor) {\r\n this.scene.remove(this.currentFloor)\r\n this.currentFloor.dispose()\r\n }\r\n this.currentFloor = floor\r\n this.scene.add(floor)\r\n // \u4FEE\u6539\u706F\u5149\u7684\u4F4D\u7F6E\r\n const position = floor.getCenter()\r\n if (position) {\r\n this.lights.position.x = position.x\r\n this.lights.position.y = position.y\r\n }\r\n }\r\n\r\n onWindowResize = () => {\r\n const { container, camera, renderer } = this;\r\n let { clientWidth: w, clientHeight: h } = container;\r\n w = Math.max(1, w);\r\n h = Math.max(1, h);\r\n camera.left = -w / 2;\r\n camera.right = w / 2;\r\n camera.top = h / 2;\r\n camera.bottom = -h / 2;\r\n camera.updateProjectionMatrix();\r\n renderer.setSize(w, h);\r\n this.resizeClientSize()\r\n this.dispatchEvent({ type:'resize', width: w, height: h })\r\n };\r\n\r\n onClick = (e: MouseEvent) => {\r\n const { graphics, position } = this.getGraphicsByDeviceXy(e.offsetX, e.offsetY);\r\n if (graphics.length) {\r\n this.dispatchEvent({\r\n type: \"graphic-click\",\r\n graphics: graphics,\r\n position\r\n });\r\n }\r\n const pois = this.getPoisByDeviceXy(e.offsetX, e.offsetY);\r\n if (pois.length) {\r\n this.dispatchEvent({ type: \"poi-click\", pois: pois as Poi[] });\r\n }\r\n };\r\n\r\n /**\r\n * \u83B7\u53D6\u5C4F\u5E55\u5750\u6807\u5BF9\u5E94\u7684graphic\r\n * @param x\r\n * @param y\r\n * @returns\r\n */\r\n getGraphicsByDeviceXy(x: number, y: number): { graphics: Graphic[], position: Vector3 | null } {\r\n const point = new Vector2();\r\n point.x = (x / this.clientSize.width) * 2 - 1;\r\n point.y = (y / this.clientSize.height) * -2 + 1;\r\n const raycaster = new Raycaster();\r\n raycaster.setFromCamera(point, this.camera);\r\n const res = this.currentFloor?.graphicLayer.getGraphicByRaycaster(raycaster)\r\n return res || { graphics: [], position: null }\r\n }\r\n\r\n /**\r\n * \u83B7\u53D6\u5C4F\u5E55\u5750\u6807\u5BF9\u5E94\u7684poi\r\n * @param x\r\n * @param y\r\n * @returns\r\n */\r\n getPoisByDeviceXy(x: number, y: number) {\r\n const pois = this.currentFloor?.poiLayer.getPoiByDeviceXy(x, y)\r\n return pois || [];\r\n }\r\n\r\n onPointerover = (e: PointerEvent) => { \r\n const { graphics, position } = this.getGraphicsByDeviceXy(e.offsetX, e.offsetY);\r\n const pois = this.getPoisByDeviceXy(e.offsetX, e.offsetY) as Poi[];\r\n this.dispatchEvent({ type: 'pointer-over', e, graphics, pois, position })\r\n }\r\n\r\n onPointermove = (e: PointerEvent) => { \r\n const { graphics, position } = this.getGraphicsByDeviceXy(e.offsetX, e.offsetY)\r\n const pois = this.getPoisByDeviceXy(e.offsetX, e.offsetY) as Poi[];\r\n // console.log(graphics, position, e.offsetX, e.offsetY)\r\n this.dispatchEvent({ type: 'pointer-move', e, graphics, pois, position })\r\n }\r\n\r\n onPointerleave = () => { \r\n this.dispatchEvent({ type: \"pointer-level\" })\r\n }\r\n\r\n onSelectionSelect = ({ graphics, isMultipleSelect }: {graphics: Graphic[], isMultipleSelect: boolean}) => { \r\n this.dispatchEvent({ type: \"select-graphic\", graphics, isMultipleSelect })\r\n }\r\n\r\n onHoverChange = ({ graphics }: { graphics: Graphic[] }) => { \r\n this.dispatchEvent({ type: \"hover\", graphics })\r\n }\r\n\r\n registryEvent() {\r\n window.addEventListener(\"resize\", this.onWindowResize);\r\n this.container.addEventListener(\"click\", this.onClick);\r\n this.container.addEventListener(\"pointerover\", this.onPointerover)\r\n this.container.addEventListener(\"pointermove\", this.onPointermove)\r\n this.container.addEventListener(\"pointerleave\", this.onPointerleave)\r\n this.selection.addEventListener(\"select\", this.onSelectionSelect)\r\n this.hoverHelper.addEventListener(\"hover-change\", this.onHoverChange)\r\n }\r\n\r\n unRegistryEvent() {\r\n window.removeEventListener(\"resize\", this.onWindowResize);\r\n this.container.removeEventListener(\"click\", this.onClick);\r\n this.container.removeEventListener(\"pointerover\", this.onPointerover)\r\n this.container.removeEventListener(\"pointermove\", this.onPointermove)\r\n this.container.removeEventListener(\"pointerleave\", this.onPointerleave)\r\n this.selection.removeEventListener(\"select\", this.onSelectionSelect)\r\n this.hoverHelper.removeEventListener(\"hover-change\", this.onHoverChange)\r\n }\r\n\r\n /**\r\n * \u8BBE\u7F6E\u7EB5\u5411\u65CB\u8F6C\u89D2\u5EA6\r\n * @param polar \u5F27\u5EA6\r\n */\r\n public setPolarAngle(polar: number, duration = 500) {\r\n if (duration === 0) {\r\n this.control.maxPolarAngle = polar;\r\n this.control.minPolarAngle = polar;\r\n this.control.update();\r\n this.control.maxPolarAngle = this.config.control.maxPolar;\r\n this.control.minPolarAngle = 0;\r\n return Promise.resolve();\r\n }\r\n return timeoutPromise(\r\n new Promise((resolve) => {\r\n const start = { polar: this.control.getPolarAngle() };\r\n const end = { polar };\r\n const tween = new Tween(start, this.tweenGroup)\r\n .to(end, duration)\r\n .onUpdate(() => {\r\n this.control.maxPolarAngle = start.polar;\r\n this.control.minPolarAngle = start.polar;\r\n this.control.update();\r\n })\r\n .onComplete(() => {\r\n this.control.enabled = true;\r\n this.control.maxPolarAngle = this.config.control.maxPolar;\r\n this.control.minPolarAngle = 0;\r\n this.tweenGroup.remove(tween);\r\n resolve(true);\r\n })\r\n .onStart(() => {\r\n this.control.enabled = false;\r\n })\r\n .start();\r\n }),\r\n duration + 500\r\n );\r\n }\r\n\r\n /**\r\n * \u8BBE\u7F6E\u6A2A\u5411\u65CB\u8F6C\u89D2\u5EA6\r\n * @param azimuthal \u5F27\u5EA6\r\n */\r\n public setAzimuthalAngle(azimuthal: number, duration = 500) {\r\n if (duration === 0) {\r\n this.control.maxAzimuthAngle = azimuthal;\r\n this.control.minAzimuthAngle = azimuthal;\r\n this.control.update();\r\n this.control.maxAzimuthAngle = Infinity;\r\n this.control.minAzimuthAngle = Infinity;\r\n return\r\n }\r\n return timeoutPromise(\r\n new Promise((resolve) => {\r\n const start = { azimuthal: this.control.getAzimuthalAngle() };\r\n const end = { azimuthal };\r\n const tween = new Tween(start, this.tweenGroup)\r\n .to(end, duration)\r\n .onUpdate(() => {\r\n this.control.maxAzimuthAngle = start.azimuthal;\r\n this.control.minAzimuthAngle = start.azimuthal;\r\n this.control.update();\r\n })\r\n .onComplete(() => {\r\n this.control.enabled = true;\r\n this.control.maxAzimuthAngle = Infinity;\r\n this.control.minAzimuthAngle = Infinity;\r\n this.tweenGroup.remove(tween);\r\n resolve(true);\r\n })\r\n .onStart(() => {\r\n this.control.enabled = false;\r\n })\r\n .start();\r\n }),\r\n duration + 500\r\n );\r\n }\r\n\r\n getCameraLookAt() {\r\n return new Vector3().subVectors(this.control.target, this.camera.position);\r\n }\r\n\r\n /**\r\n * \u6309\u7167\u4E00\u4E2A\u4E2D\u5FC3\u70B9\u8BBE\u7F6E\u76F8\u673A\u7684\u653E\u5927\u7F29\u5C0F\r\n * @param zoom\r\n * @param center\r\n * @returns\r\n */\r\n public setZoom(zoom: number, center: Vector3, duration = 500) {\r\n const lookAtVector = this.getCameraLookAt();\r\n const start = {\r\n zoom: this.camera.zoom,\r\n target: this.control.target.clone(),\r\n };\r\n if (!duration) { \r\n this.camera.position.copy(center.clone().sub(lookAtVector));\r\n this.control.target.copy(center);\r\n this.camera.zoom = zoom;\r\n this.control.update()\r\n return\r\n }\r\n return timeoutPromise(\r\n new Promise((resolve) => {\r\n const tween = new Tween(start, this.tweenGroup)\r\n .to(\r\n {\r\n zoom,\r\n target: center,\r\n },\r\n duration\r\n )\r\n .onUpdate(() => {\r\n this.camera.position.copy(start.target.clone().sub(lookAtVector));\r\n this.control.target.copy(start.target);\r\n this.camera.zoom = start.zoom;\r\n this.control.update();\r\n })\r\n .onComplete(() => {\r\n this.tweenGroup.remove(tween);\r\n this.control.enabled = true;\r\n resolve(true)\r\n })\r\n .onStart(() => {\r\n this.control.enabled = false;\r\n })\r\n .start();\r\n }),\r\n duration + 500\r\n );\r\n }\r\n\r\n getFitCameraToObjectZoom(\r\n object: Object3D,\r\n padding: [number, number, number, number] = [20, 20, 20, 20],\r\n duration = 500,\r\n force2DView = true, // \u5F3A\u5236\u8BA1\u7B972d\u89C6\u89D2\u7684\u5927\u5C0F\r\n ) { \r\n const [top, right, bottom, left] = padding;\r\n const { clientSize: { width, height } } = this;\r\n const polar = this.control.getPolarAngle()\r\n if (force2DView) {\r\n // \u83B7\u53D6\u57282D\u89C6\u56FE\u4E0B\u7684\u5927\u5C0F\r\n this.setPolarAngle(0, 0)\r\n }\r\n // \u83B7\u53D6\u7269\u4F53\u7684\u4E09\u7EF4\u76D2\u5B50\u5750\u6807\r\n const boundingBox = new Box3().setFromObject(object);\r\n this.setPolarAngle(polar, 0)\r\n const { max, min } = boundingBox;\r\n // \u5750\u6807\u8F6C\u6210\u5C4F\u5E55\u5750\u6807\u5E76\u8BA1\u7B97\u51FA\u5360\u7528\u5C4F\u5E55\u5750\u6807\u7684\u5927\u5C0F\r\n const max2d = vector3ToDevice(max, this.camera, width, height);\r\n const min2d = vector3ToDevice(min, this.camera, width, height);\r\n const boundingBox2d = new Box2().setFromPoints([\r\n new Vector2(max2d.x, max2d.y),\r\n new Vector2(min2d.x, min2d.y),\r\n ]);\r\n const size = boundingBox2d.getSize(new Vector2());\r\n // \u8BA1\u7B97\u5728\u5C4F\u5E55\u4E0Ax,y\u65B9\u5411\u4E0A\u9700\u8981\u8C03\u6574\u7684\u500D\u6570\r\n const xScale = (width - right - left) / size.x;\r\n const yScale = (height - top - bottom) / size.y;\r\n const scale = Math.min(xScale, yScale);\r\n const center = new Vector3((max.x + min.x) / 2, (max.y + min.y) / 2, max.z);\r\n return { zoom: scale * this.camera.zoom, center };\r\n }\r\n\r\n /**\r\n * \u653E\u5927\u76F8\u673A\u5230\u7269\u4F53\u5360\u5168\u5C4F\r\n * @param object\r\n * @param padding\r\n * @param duration\r\n * @returns\r\n */\r\n fitCameraToObject(\r\n object: Object3D,\r\n padding: [number, number, number, number] = [20, 20, 20, 20],\r\n duration = 500,\r\n force2DView = true, // \u5F3A\u5236\u8BA1\u7B972d\u89C6\u89D2\u7684\u5927\u5C0F\r\n ) {\r\n const { zoom, center } = this.getFitCameraToObjectZoom(object, padding, duration, force2DView)\r\n return this.setZoom(zoom, center, duration);\r\n }\r\n\r\n getFitCameraToGroundZoom(padding: [number, number, number, number] = [20, 20, 20, 20], duration = 500, force2DView = true) {\r\n if (this.currentFloor && this.currentFloor.hasElement) {\r\n return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper, padding, duration, force2DView).zoom;\r\n }\r\n }\r\n\r\n fitCameraToGround(padding: [number, number, number, number] = [20, 20, 20, 20], duration = 500, force2DView = true) { \r\n if (this.currentFloor && this.currentFloor.hasElement) {\r\n return this.fitCameraToObject(this.currentFloor.groundUpper, padding, duration, force2DView);\r\n } else {\r\n return Promise.resolve(false);\r\n }\r\n }\r\n\r\n /**\r\n * \u4FEE\u6539\u76F8\u673A\u4F4D\u7F6E\r\n * @param position \u4FEE\u6539\u540E\u7684\u76F8\u673A\u7684\u4F4D\u7F6E\r\n * @param duration \u52A8\u753B\u6301\u7EED\u65F6\u95F4\r\n */\r\n public setCameraPosition(position: Vector3, duration: number) {\r\n return timeoutPromise(\r\n new Promise((resolve) => {\r\n const start = this.camera.position.clone();\r\n const lookAtVector = this.getCameraLookAt();\r\n const tween = new Tween(start, this.tweenGroup)\r\n .to(position, duration)\r\n .onUpdate(() => {\r\n this.camera.position.copy(start.clone().sub(lookAtVector));\r\n this.control.target.copy(start.clone());\r\n this.control.update();\r\n })\r\n .onComplete(() => {\r\n this.tweenGroup.remove(tween);\r\n this.camera.position.copy(start.clone().sub(lookAtVector));\r\n this.control.target.copy(position.clone());\r\n this.control.update();\r\n this.control.enabled = true;\r\n resolve(true);\r\n })\r\n .onStart(() => {\r\n this.control.enabled = false;\r\n })\r\n .start();\r\n }),\r\n duration + 500\r\n );\r\n }\r\n\r\n render() {\r\n this.renderer.render(this.scene, this.camera);\r\n this.dispatchEvent({ type: \"update\" });\r\n this.timer.requestAnimationFrame(() => {\r\n this.render();\r\n });\r\n this.tweenGroup.update();\r\n }\r\n\r\n dispose() {\r\n this.cameraBound.dispose()\r\n this.selection.dispose()\r\n this.hoverHelper.dispose()\r\n this.tweenGroup.getAll().forEach((item) => item.stop());\r\n this.tweenGroup.removeAll();\r\n this.unRegistryEvent();\r\n this.container.removeChild(this.renderer.domElement);\r\n this.timer.dispose();\r\n this.renderer.dispose();\r\n (this.lights.children as Light[]).forEach((light: Light) =>\r\n light.dispose()\r\n );\r\n this.materialFactory.dispose();\r\n dispose(this.scene);\r\n }\r\n}\r\n", "import { EventDispatcher } from \"three\";\r\nimport { Context } from \"../../context\";\r\nimport { Graphic, Poi } from \"../../elements\";\r\nimport { BoxSelection } from \"./box-selection\";\r\nimport { isControl, isMac } from \"../../utils\";\r\n\r\ninterface SelectionEventMap {\r\n \"select\": {\r\n graphics: Graphic[],\r\n isMultipleSelect: boolean,\r\n }\r\n}\r\n\r\nexport class Selection extends EventDispatcher<SelectionEventMap> {\r\n private _list = new Set<Graphic>()\r\n\r\n private boxSelection: BoxSelection;\r\n private prevPanStatus?: boolean;\r\n private prevRotateStatus?: boolean;\r\n private downPoint: { x: number, y: number } | null = null\r\n\r\n private isMultipleSelect = false;\r\n\r\n constructor(private context: Context) {\r\n super()\r\n this.boxSelection = new BoxSelection(context)\r\n this.boxSelection.setEnable(false)\r\n this.registryEvent()\r\n }\r\n\r\n get list() {\r\n return this._list\r\n }\r\n\r\n enableBoxSelection() { \r\n if (this.isMultipleSelect) { return }\r\n this.isMultipleSelect = true;\r\n this.boxSelection.setEnable(true)\r\n this.prevPanStatus = this.context.control.enablePan\r\n this.prevRotateStatus = this.context.control.enableRotate\r\n this.context.control.enablePan = false\r\n this.context.control.enableRotate = false\r\n }\r\n\r\n disableBoxSelection() { \r\n if (this.isMultipleSelect) { \r\n this.isMultipleSelect = false;\r\n this.boxSelection.setEnable(false)\r\n this.context.control.enablePan = !!this.prevPanStatus\r\n this.context.control.enableRotate = !!this.prevRotateStatus\r\n }\r\n }\r\n\r\n onPointerDown = (e: PointerEvent) => {\r\n this.downPoint = { x: e.offsetX, y: e.offsetY }\r\n }\r\n\r\n onPointerUp = (e: PointerEvent) => {\r\n if (!this.downPoint) { return }\r\n const { offsetX, offsetY } = e\r\n const { x, y } = this.downPoint\r\n if (Math.sqrt((x - offsetX) ** 2 + (y - offsetY) ** 2) > 3) {\r\n return\r\n }\r\n const { graphics } = this.context.getGraphicsByDeviceXy(offsetX, offsetY)\r\n const graphicIdSet = new Set(graphics.map(item => item.options.id))\r\n const pois = this.context.getPoisByDeviceXy(offsetX, offsetY) as Poi[];\r\n pois.forEach(item => { \r\n if (!graphicIdSet.has(item.options.id)) {\r\n const graphic = this.context.currentFloor?.graphicLayer.graphicMap.get(item.options.id) || null\r\n if (graphic && graphic.options.geometry.type === 'point') { \r\n graphics.push(graphic)\r\n graphicIdSet.add(item.options.id)\r\n }\r\n }\r\n })\r\n if (!(isMac ? e.metaKey : e.ctrlKey)) {\r\n this._list.clear()\r\n }\r\n graphics.forEach(item => this._list.add(item))\r\n this.selectEnd()\r\n this.downPoint = null\r\n }\r\n\r\n onPointerOut = (e: PointerEvent) => { \r\n this.disableBoxSelection()\r\n }\r\n\r\n onKeyDown = (e: KeyboardEvent) => {\r\n if (isControl(e.key)) {\r\n this.enableBoxSelection()\r\n }\r\n }\r\n\r\n onKeyUp = (e: KeyboardEvent) => {\r\n if (isControl(e.key)) {\r\n this.disableBoxSelection()\r\n }\r\n }\r\n\r\n onBoxSelected = ({ list }: { list: Graphic[] }) => { \r\n this._list.clear()\r\n list.forEach(item => {\r\n this._list.add(item)\r\n })\r\n this.selectEnd()\r\n }\r\n\r\n selectEnd() {\r\n this.dispatchEvent({type: \"select\", graphics: [...this._list], isMultipleSelect: this.isMultipleSelect})\r\n }\r\n\r\n registryEvent() {\r\n this.context.container.addEventListener(\"pointerdown\", this.onPointerDown)\r\n this.context.container.addEventListener(\"pointerup\", this.onPointerUp)\r\n this.context.container.addEventListener(\"pointerout\", this.onPointerOut)\r\n this.context.container.addEventListener(\"pointercancel\", this.onPointerOut)\r\n window.addEventListener(\"keydown\", this.onKeyDown)\r\n window.addEventListener(\"keyup\", this.onKeyUp)\r\n this.boxSelection.addEventListener(\"selected\", this.onBoxSelected)\r\n }\r\n\r\n unRegistryEvent() {\r\n this.context.container.removeEventListener(\"pointerdown\", this.onPointerDown)\r\n this.context.container.removeEventListener(\"pointerup\", this.onPointerUp)\r\n this.context.container.removeEventListener(\"pointerout\", this.onPointerOut)\r\n this.context.container.removeEventListener(\"pointercancel\", this.onPointerOut)\r\n window.removeEventListener(\"keydown\", this.onKeyDown)\r\n window.removeEventListener(\"keyup\", this.onKeyUp)\r\n this.boxSelection.removeEventListener(\"selected\", this.onBoxSelected)\r\n }\r\n\r\n clear() {\r\n this._list.clear()\r\n }\r\n\r\n remove(graphic: Graphic) { \r\n this._list.delete(graphic)\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent()\r\n }\r\n}", "import {\r\n Object3D, ExtrudeGeometry, Mesh, Box3, MeshBasicMaterial,\r\n Raycaster, Object3DEventMap, Vector3, BufferGeometry, LineBasicMaterial, LineSegments\r\n} from 'three';\r\nimport { initShape, proxyOptions, darkenColor } from '../utils'\r\nimport { GraphicOptions, PolygonGeometry } from 'src/types';\r\nimport { Context } from '../context'\r\n\r\n// \u95E8\u7684\u7C7B\u578B\r\nconst DoorType = {\r\n single: \"\u5355\u5F00\u95E8\",\r\n double: \"\u53CC\u5F00\u95E8\",\r\n move: \"\u79FB\u52A8\u95E8\",\r\n};\r\n\r\n// \u95E8\u7684\u6750\u8D28\r\nconst DoorMaterial = {\r\n wood: \"\u6728\u95E8\",\r\n glass: \"\u73BB\u7483\u95E8\",\r\n aluminum: \"\u94DD\u5408\u91D1\u95E8\",\r\n}\r\n\r\n// \u5355\u4E2A\u95E8\u7684\u914D\u7F6E\r\nexport interface Door {\r\n // \u540D\u79F0\r\n name: string;\r\n id: string;\r\n width: number;\r\n // \u5185\u5F00/\u5916\u5F00\r\n open: boolean;\r\n // \u7C7B\u578B \u5355\u5F00\u95E8 \u53CC\u5F00\u95E8 \u79FB\u52A8\u95E8\r\n type: keyof typeof DoorType;\r\n // \u6750\u8D28\r\n material: keyof typeof DoorMaterial;\r\n}\r\n\r\nexport type GraphicOptionsParam = Partial<GraphicOptions>\r\n\r\ntype GraphicEventMap = {\r\n [K in keyof GraphicOptions as `change-${K}`]: { value: GraphicOptions[K] };\r\n} & Object3DEventMap;\r\n\r\n\r\nconst defaultOptions: GraphicOptions = {\r\n id: \"\", // \u56FE\u5F62id\r\n height: 0.1, // \u56FE\u5F62\u9AD8\u5EA6\r\n airHeight: 0, // \u60AC\u7A7A\u9AD8\u5EA6\r\n area: 0, // \u9762\u79EF\r\n group: \"\", // \u5206\u7EC4\r\n fillColor: \"#EFF4FB\", // \u989C\u8272\r\n strokeColor: \"#ffffff\", // \u8FB9\u6846\r\n fillOpacity: 1, // \u900F\u660E\u5EA6\r\n strokeOpacity: 1, // \u63CF\u8FB9\u900F\u660E\u5EA6\r\n strokeWidth: 1, // \u63CF\u8FB9\u5BBD\u5EA6 \r\n doors: [], // \u95E8\u914D\u7F6E\r\n locked: false,\r\n visible: true,\r\n geometry: {\r\n type: 'polygon',\r\n cds: [],\r\n curveCpt: [],\r\n curveIndex: []\r\n },\r\n layerType: \"\",\r\n zIndex: 0,\r\n stroke: true,\r\n deltaHeight: 0,\r\n userData: {}\r\n}\r\n\r\nexport class Graphic extends Object3D<GraphicEventMap> {\r\n\r\n private geometry!: ExtrudeGeometry;\r\n\r\n private material!: MeshBasicMaterial | MeshBasicMaterial[];\r\n\r\n public mesh!: Mesh;\r\n\r\n private line!: LineSegments;\r\n\r\n private lineMaterial?: LineBasicMaterial;\r\n\r\n private lineGeometry?: BufferGeometry;\r\n \r\n public options: GraphicOptions\r\n \r\n constructor(private context: Context, options: GraphicOptionsParam) {\r\n super()\r\n this.options = proxyOptions<GraphicOptions, GraphicEventMap>({...defaultOptions, ...options}, this)\r\n if (this.options.geometry.type === \"point\") { \r\n const [x, y] = this.options.geometry.cds\r\n this.position.set(x, y, this.options.height + this.options.airHeight)\r\n return this\r\n }\r\n this.init()\r\n this.visible = this.options.visible\r\n this.addEventListener('change-fillColor', ({ value }) => {\r\n this.initMaterial()\r\n this.initMesh()\r\n })\r\n this.addEventListener('change-fillOpacity', ({ value }) => {\r\n this.initMaterial()\r\n this.initMesh()\r\n })\r\n this.addEventListener('change-height', ({ value }) => {\r\n this.dispose()\r\n this.init()\r\n })\r\n this.addEventListener('change-strokeColor', ({ value }) => {\r\n if (!this.options.stroke) { return }\r\n this.initLineMaterial();\r\n this.createBorder();\r\n })\r\n this.addEventListener('change-strokeOpacity', ({ value }) => {\r\n if (!this.options.stroke) { return }\r\n this.initLineMaterial();\r\n this.createBorder();\r\n })\r\n // this.addEventListener('change-strokeWidth', ({ value }) => {\r\n // this.initLineMaterial();\r\n // this.createBorder();\r\n // })\r\n this.addEventListener('change-airHeight', ({ value }) => {\r\n this.position.z = value\r\n })\r\n this.addEventListener('change-visible', ({ value }) => {\r\n this.visible = value\r\n })\r\n this.addEventListener('change-stroke', ({ value }) => {\r\n if (value) {\r\n if (this.line) { return }\r\n this.initLineGeometry()\r\n this.initLineMaterial()\r\n this.createBorder()\r\n } else if (this.line) {\r\n this.remove(this.line);\r\n this.lineGeometry?.dispose()\r\n }\r\n })\r\n }\r\n\r\n getCenter() { \r\n if (this.options.geometry.type === \"point\") { \r\n return this.position.clone()\r\n }\r\n const center = new Vector3()\r\n const box = new Box3()\r\n box.setFromObject(this)\r\n box.getCenter(center)\r\n return center\r\n }\r\n\r\n getSize() {\r\n if (this.options.geometry.type === \"point\") { \r\n return new Vector3(0, 0, 0)\r\n }\r\n const box = new Box3()\r\n const size = new Vector3()\r\n box.setFromObject(this)\r\n box.getSize(size)\r\n return size\r\n }\r\n\r\n getPosition() {\r\n const center = this.getCenter()\r\n center.setZ(center.z + this.options.height)\r\n return center\r\n }\r\n\r\n init() {\r\n this.geometry = this.initGeometry()\r\n this.initMaterial()\r\n this.initMesh()\r\n this.mesh.position.z = this.options.airHeight + this.options.deltaHeight;\r\n if (this.options.stroke) {\r\n // \u521B\u5EFA\u8FB9\u6846\r\n this.initLineMaterial()\r\n this.initLineGeometry()\r\n this.createBorder()\r\n }\r\n }\r\n\r\n initGeometry() {\r\n const shape = initShape(\r\n (this.options.geometry as PolygonGeometry).cds[0],\r\n (this.options.geometry as PolygonGeometry).cds.slice(1)\r\n )\r\n const geometry = new ExtrudeGeometry(shape, {\r\n steps: 1,\r\n bevelEnabled: false,\r\n depth: this.options.height,\r\n curveSegments: 4,\r\n });\r\n return geometry\r\n }\r\n\r\n initMaterial() {\r\n const material = this.context.materialFactory.createMeshBasicMaterial({\r\n color: this.options.fillColor,\r\n opacity: this.options.fillOpacity\r\n })\r\n if (this.options.height <= 0.001) {\r\n this.material = material\r\n return material\r\n }\r\n const material1 = this.context.materialFactory.createMeshBasicMaterial({\r\n color: darkenColor(this.options.fillColor),\r\n opacity: this.options.fillOpacity,\r\n })\r\n this.material = [material, material1]\r\n return [material, material1]\r\n }\r\n\r\n initLineMaterial() { \r\n const lineMaterial = this.context.materialFactory.createLineMaterial({\r\n color: this.options.strokeColor,\r\n opacity: this.options.strokeOpacity,\r\n })\r\n this.lineMaterial = lineMaterial;\r\n return lineMaterial\r\n }\r\n\r\n initMesh() {\r\n if (this.mesh) { \r\n this.remove(this.mesh)\r\n }\r\n this.mesh = new Mesh(this.geometry, this.material)\r\n this.add(this.mesh)\r\n }\r\n\r\n getBorderPoints() {\r\n const points = [];\r\n const height = this.options.height + this.options.deltaHeight\r\n // \u70B9\u7684\u5750\u6807\u8981\u81EA\u5DF1\u7B97\uFF0C\u53EA\u753B\u5173\u952E\u8282\u70B9\u7684\u5782\u76F4\u7EBFcurveIndex\u662F\u5173\u952E\u8282\u70B9,\u5982\u679C\u662F\u66F2\u7EBF\u6709\u8FD9\u4E2A\u503C\uFF0C\u4E0D\u662F\u66F2\u7EBF\u4E0D\u4E00\u5B9A\u6709\r\n const { cds } = this.options.geometry as PolygonGeometry\r\n for (let j = 0; j < cds.length; j++) { \r\n const curCds = cds[j]\r\n for (let i = 0; i < curCds.length; i++) {\r\n const cur = curCds[i];\r\n const next = i + 1 === curCds.length ? curCds[0] : curCds[i + 1];\r\n // \u628A\u62C9\u5347\u4E0A\u53BB\u7684\u70B9\u653E\u8FDB\u53BB\r\n points.push(new Vector3(cur[0], cur[1], height))\r\n points.push(new Vector3(next[0], next[1], height))\r\n }\r\n }\r\n return points\r\n }\r\n\r\n initLineGeometry() { \r\n if (this.lineGeometry) { \r\n this.lineGeometry.dispose()\r\n }\r\n const points = this.getBorderPoints()\r\n const lineGeometry = new BufferGeometry()\r\n .setFromPoints(points)\r\n this.lineGeometry = lineGeometry;\r\n }\r\n\r\n createBorder() {\r\n if (this.line) { \r\n this.remove(this.line)\r\n }\r\n const line = new LineSegments(this.lineGeometry, this.lineMaterial)\r\n line.position.z = this.options.airHeight + 0.01\r\n this.line = line;\r\n this.add(line)\r\n return line\r\n }\r\n\r\n raycast(raycaster: Raycaster) {\r\n if (!this.visible) { return false }\r\n if (this.options.geometry.type === \"point\") { return false }\r\n const intersects = raycaster.intersectObject(this.mesh)\r\n if (intersects[0]) {\r\n const {point: position, distance} = intersects[0]\r\n return { position, distance }\r\n }\r\n return false\r\n }\r\n \r\n dispose() {\r\n this.geometry.dispose()\r\n this.line?.geometry.dispose()\r\n this.clear()\r\n }\r\n\r\n}", "import {\r\n Object3D, PlaneGeometry, DirectionalLight,\r\n Mesh, MeshStandardMaterial, ShadowMaterial, Color, Vector3, DoubleSide\r\n} from 'three';\r\nimport { dispose, initDirectionalLight } from '../utils'\r\n\r\nexport class Shadow extends Object3D {\r\n\r\n private directionalLight: DirectionalLight\r\n\r\n private plane!: Mesh\r\n\r\n public basicOpacity = 0.07\r\n\r\n constructor() {\r\n super()\r\n this.directionalLight = this.initLight()\r\n this.initPlane()\r\n }\r\n\r\n // \u521B\u5EFA\u5149\u6E90\r\n initLight() { \r\n const directionalLight = initDirectionalLight(0xffffff, 0.5)\r\n directionalLight.position.set(0, 0, 100);\r\n this.add(directionalLight);\r\n return directionalLight\r\n }\r\n \r\n changeLightCamera(size: Vector3) {\r\n const x = size.x\r\n const y = size.y\r\n this.directionalLight.shadow.camera.left = -x;\r\n this.directionalLight.shadow.camera.right = x;\r\n this.directionalLight.shadow.camera.top = y;\r\n this.directionalLight.shadow.camera.bottom = -y;\r\n this.directionalLight.shadow.camera.near = 0.5;\r\n this.directionalLight.shadow.camera.far = Math.max(x, y);\r\n }\r\n\r\n changeLightColor(color: number | string) {\r\n this.directionalLight.color = new Color(color)\r\n }\r\n\r\n setPosition(position: Vector3) {\r\n this.position.copy(position)\r\n this.directionalLight.position.set(-position.x / 2, -position.y / 2, 100)\r\n }\r\n\r\n // \u521B\u5EFA\u5E73\u9762\u767D\u8272\r\n initPlane(width = 1000, height = 1000) { \r\n const geometry = new PlaneGeometry(width, height)\r\n const material = new ShadowMaterial({\r\n transparent: true,\r\n opacity: 0,\r\n side: DoubleSide\r\n })\r\n const mesh = new Mesh(geometry, material)\r\n mesh.receiveShadow = true\r\n mesh.position.z = -10\r\n this.add(mesh)\r\n this.plane = mesh\r\n return mesh\r\n }\r\n\r\n setTarget(target: Object3D) {\r\n this.directionalLight.target = target\r\n }\r\n\r\n transformOpacity(opacity: number): number {\r\n return opacity * this.basicOpacity\r\n }\r\n\r\n setOpacity(opacity: number) { \r\n (this.plane.material as MeshStandardMaterial).opacity = this.transformOpacity(opacity);\r\n }\r\n \r\n dispose() {\r\n dispose(this, true)\r\n }\r\n\r\n}", "import { proxyOptions, sleepOnePromise } from '../utils';\r\nimport { EventDispatcher, Object3D, Object3DEventMap, Vector3 } from 'three';\r\nimport { Context } from '../context'\r\nimport { Overlay } from './overlay';\r\n\r\nexport interface PoiOptions {\r\n texts: { text: string, styles?: { [key: string]: string }; }[];\r\n icon?: string;\r\n icon_size?: [number, number]; // \u5BBD \u9AD8\r\n level: number; // \u6E32\u67D3\u4F18\u5148\u7EA7\r\n collision_enable: boolean; // \u662F\u5426\u53C2\u4E0E\u78B0\u649E\u68C0\u6D4B\r\n opacity: number;\r\n id: string; // poi\u7684key\r\n position: { x: number; y: number; z: number };\r\n icon_opacity: number;\r\n icon_border: { color: string, width: number };\r\n background: string;\r\n collision_hide_icon: boolean;\r\n built_in: boolean; // \u662F\u5426\u662F\u5185\u7F6E\u7684poi\r\n}\r\n\r\ntype PoiEventMap = {\r\n [K in keyof PoiOptions as `change-${K}`]: { value: PoiOptions[K] };\r\n} & Object3DEventMap;\r\n\r\nconst defaultOptions: PoiOptions = {\r\n texts: [{ text: \"\" }],\r\n level: 1,\r\n collision_enable: true,\r\n opacity: 1,\r\n id: \"\",\r\n position: { x: 0, y: 0, z: 0 },\r\n icon_opacity: 1,\r\n icon_border: { color: \"#586EE0\", width: 0 },\r\n background: \"\",\r\n collision_hide_icon: true,\r\n built_in: false\r\n}\r\n\r\nexport type PoiOptionsParam = Partial<PoiOptions>\r\n\r\nexport class Poi extends EventDispatcher<PoiEventMap> {\r\n\r\n private div!: HTMLDivElement\r\n\r\n private textDiv!: HTMLDivElement\r\n\r\n private img?: HTMLImageElement\r\n\r\n private overlay: Overlay\r\n\r\n public options: PoiOptions\r\n\r\n public visible = true\r\n\r\n size = { width: 0, height: 0 }\r\n\r\n position = new Vector3()\r\n\r\n userData = {};\r\n\r\n showTextStatus = true\r\n\r\n constructor(private context: Context, options: PoiOptionsParam) {\r\n super()\r\n this.options = proxyOptions<PoiOptions, PoiEventMap>({...defaultOptions, ...options}, this)\r\n this.position.set(options.position?.x || 0, options.position?.y || 0, options.position?.z || 0)\r\n this.overlay = new Overlay(this.context, { autoUpdate: false })\r\n this.overlay.addEventListener(\"update-position\", ({x, y, height}) => { \r\n this.overlay.div.style.transform = `translate3d(calc(${x}px - 50%), calc(${-height + y}px - ${this.options.icon ? '100%' : '50%'}), 0)`;\r\n })\r\n this.overlay.bindElement(this as unknown as Object3D)\r\n this.registryEvent()\r\n this.initDiv()\r\n this.addEventListener(\"change-icon\", ({ value }) => {\r\n if (value) {\r\n if (!this.img) {\r\n this.div.appendChild(this.initIcon())\r\n } else {\r\n this.img.setAttribute('src', value)\r\n }\r\n } else {\r\n this.img && this.div.removeChild(this.img)\r\n this.img = undefined\r\n this._changePosition()\r\n this.resetSize()\r\n }\r\n })\r\n this.addEventListener(\"change-texts\", ({ value }) => {\r\n this.div.removeChild(this.textDiv)\r\n this.div.appendChild(this.initText())\r\n this.resetSize()\r\n })\r\n this.addEventListener(\"change-opacity\", ({ value }) => {\r\n this.overlay.setOpacity(value)\r\n })\r\n this.addEventListener(\"change-icon_size\", ({ value }) => {\r\n if (this.img) {\r\n this.img.style.width = `${value?.[0] || 32}px`\r\n this.img.style.height = `${value?.[1] || 32}px`\r\n this.resetSize()\r\n }\r\n })\r\n this.addEventListener(\"change-icon_opacity\", ({ value }) => {\r\n if (this.img) {\r\n this.img.style.opacity = `${value}`\r\n }\r\n })\r\n this.addEventListener(\"change-icon_border\", ({ value }) => {\r\n if (this.img) {\r\n this.img.style.border = `${value.width}px solid ${value.color}`\r\n }\r\n })\r\n this.addEventListener(\"change-background\", ({ value }) => {\r\n this.div.style.background = value;\r\n })\r\n }\r\n\r\n get withinDisplayRange() {\r\n return this.overlay.withinDisplayRange\r\n }\r\n\r\n async resetSize() {\r\n await sleepOnePromise()\r\n const { width, height } = this.div.getBoundingClientRect()\r\n this.size = {\r\n width: width + 2, \r\n height: height + 2\r\n }\r\n }\r\n\r\n renderHelperBox() {\r\n // let div = this.helperDiv\r\n // if (!div) {\r\n // div = document.createElement('div')\r\n // this.context.container.appendChild(div)\r\n // }\r\n // const box = this.getBox()\r\n // div.style.cssText = `position: absolute; top: ${box.top}px;left: ${box.left}px;width: ${box.right - box.left}px;height: ${box.bottom - box.top}px;border: 1px solid red;`\r\n // this.helperDiv = div;\r\n }\r\n\r\n get clientPos() {\r\n return this.overlay.clientPos\r\n }\r\n\r\n initDiv() {\r\n const div = document.createElement(\"div\");\r\n div.appendChild(this.initText())\r\n if (this.options.icon) { \r\n div.appendChild(this.initIcon())\r\n }\r\n div.style.fontSize = `12px`;\r\n div.style.textShadow = `#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0`;\r\n div.style.display = `flex`;\r\n div.style.flexDirection = `column`;\r\n div.style.justifyContent = `center`;\r\n div.style.alignItems = `center`;\r\n div.style.padding = \"4px\";\r\n this.overlay.setOpacity(this.options.opacity);\r\n this.overlay.div.style.pointerEvents = `none`;\r\n this.overlay.div.style.userSelect = `none`;\r\n this.overlay.div.appendChild(div)\r\n this.div = div;\r\n// this._changePosition()\r\n this.resetSize()\r\n return div\r\n }\r\n\r\n getPosition() {\r\n return this.position\r\n }\r\n\r\n initText() {\r\n const textDiv = document.createElement(\"div\")\r\n textDiv.appendChild(this.createTextFragment())\r\n textDiv.style.textAlign = \"center\"\r\n this.textDiv = textDiv\r\n return textDiv\r\n }\r\n\r\n createTextFragment() { \r\n const f = document.createDocumentFragment()\r\n this.options.texts.forEach(item => { \r\n const div = document.createElement(\"div\")\r\n div.style.whiteSpace = 'nowrap';\r\n if (item.styles) { \r\n for (let [key, value] of Object.entries(item.styles)) { \r\n div.style[key as any] = value;\r\n }\r\n }\r\n div.textContent = item.text;\r\n f.appendChild(div)\r\n })\r\n return f\r\n }\r\n\r\n initIcon() {\r\n const img = document.createElement(\"img\")\r\n img.setAttribute(\"src\", this.options.icon!)\r\n img.style.width = `${this.options.icon_size?.[0] || 32}px`\r\n img.style.height = `${this.options.icon_size?.[1] || 32}px`\r\n img.style.opacity = `${this.options.icon_opacity}px`\r\n img.style.borderRadius = '50%';\r\n if (this.options.icon_border.width) {\r\n img.style.border = `${this.options.icon_border.width}px solid ${this.options.icon_border.color}`\r\n }\r\n img.onload = () => {\r\n // this._changePosition()\r\n this.resetSize()\r\n }\r\n this.img = img\r\n return img\r\n }\r\n\r\n private _changePosition = () => {\r\n // this.div.style.transform = `translate3d(-50%, ${this.options.icon ? '-100%' : '-50%'}, 0)`;\r\n }\r\n\r\n registryEvent() {\r\n // this.context.addEventListener('update', this._changePosition)\r\n }\r\n\r\n unRegistryEvent() {\r\n // this.context.removeEventListener('update', this._changePosition)\r\n }\r\n\r\n setVisible(visible: boolean) {\r\n if (visible === this.visible) { return }\r\n this.visible = visible\r\n this.changeOverlayVisible(visible)\r\n }\r\n\r\n changeOverlayVisible(visible: boolean) {\r\n if (visible === this.overlay.visible && this.options.collision_hide_icon) { return }\r\n if (this.options.collision_hide_icon) {\r\n this.overlay.visible = visible;\r\n this.overlay.div.style.visibility = visible ? \"visible\" : \"hidden\"\r\n } else {\r\n if (this.showTextStatus === visible) { return }\r\n this.textDiv.style.visibility = visible ? \"visible\" : \"hidden\"\r\n this.showTextStatus = visible\r\n }\r\n }\r\n\r\n parentSetVisible(visible: boolean) { \r\n if (!this.visible) { \r\n return\r\n }\r\n this.changeOverlayVisible(visible)\r\n // if (visible) {\r\n // this.renderHelperBox()\r\n // } else {\r\n // this.helperDiv?.remove()\r\n // this.helperDiv = null\r\n // }\r\n }\r\n\r\n getBox(boxScale = this.context.config.poi.boxScale) {\r\n const { width, height } = this.size\r\n const w = width * boxScale;\r\n const h = height * boxScale;\r\n const { x, y } = this.overlay.clientPos\r\n return {\r\n left: x - w / 2,\r\n right: x + w / 2,\r\n top: this.options.icon ? y - h : y - h / 2,\r\n bottom: this.options.icon ? y : y + h / 2,\r\n }\r\n }\r\n\r\n getOriginBox() { \r\n return this.getBox(1)\r\n }\r\n\r\n isContain(x: number, y: number) {\r\n if (!this.overlay.visible) { return false }\r\n if (!this.visible) {return false}\r\n const box = this.getOriginBox()\r\n return x >= box.left && x <= box.right && y >= box.top && y <= box.bottom\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent();\r\n this.div = null as unknown as HTMLDivElement;\r\n this.textDiv = null as unknown as HTMLDivElement;\r\n this.img = undefined\r\n this.overlay.dispose();\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Box3, EventDispatcher, Object3D, Vector3 } from \"three\";\r\nimport { vector3ToDevice } from '../utils'\r\n\r\ninterface OverlayOptions {\r\n autoUpdate: boolean;\r\n appendToBody: boolean;\r\n}\r\n\r\nconst defaultOptions: OverlayOptions = {\r\n autoUpdate: true,\r\n appendToBody: false\r\n}\r\n\r\ninterface OverlayEventMap {\r\n \"update-position\": {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n }\r\n}\r\n\r\nexport class Overlay extends EventDispatcher<OverlayEventMap> {\r\n\r\n public div: HTMLDivElement\r\n\r\n private element?: Object3D & { getPosition?: () => Vector3 }\r\n\r\n public position = new Vector3()\r\n\r\n clientPos = { x: 0, y: 0 }\r\n\r\n visible = true\r\n\r\n private options: OverlayOptions\r\n\r\n constructor(private context: Context, options: Partial<OverlayOptions> = {}) {\r\n super()\r\n this.options = { ...defaultOptions, ...options };\r\n this.registryEvent()\r\n this.div = this.initDiv()\r\n if (this.options.appendToBody) {\r\n document.body.appendChild(this.div)\r\n } else {\r\n this.context.container.appendChild(this.div)\r\n }\r\n }\r\n\r\n initDiv() {\r\n const div = document.createElement(\"div\")\r\n div.style.position = \"absolute\";\r\n return div\r\n }\r\n\r\n bindElement(element: Object3D) {\r\n this.element = element\r\n this.onUpdate() \r\n }\r\n\r\n unBindElement() {\r\n this.element = undefined;\r\n }\r\n\r\n setVisible(visible: boolean, display = 'block') {\r\n if (visible === this.visible) { return }\r\n this.div.style.display = visible ? display : 'none'\r\n this.visible = visible\r\n }\r\n\r\n setOpacity(opacity: number) {\r\n this.div.style.opacity = `${opacity}`\r\n }\r\n\r\n getPosition() {\r\n if (this.element) {\r\n if (typeof this.element.getPosition === \"function\") {\r\n return this.element.getPosition()\r\n }\r\n const box = new Box3().setFromObject(this.element)\r\n const center = box.getCenter(new Vector3())\r\n return center\r\n } else {\r\n return this.position\r\n }\r\n }\r\n\r\n get withinDisplayRange() { \r\n const { x, y } = this.clientPos\r\n const { width, height } = this.context.clientSize\r\n return x >=0 && x <= width && y >= 0 && y <= height\r\n }\r\n\r\n onUpdate = () => {\r\n const vector = this.getPosition()\r\n const { width, height, x: clientX, y: clientY } = this.context.clientSize\r\n const { x, y } = vector3ToDevice(vector, this.context.camera, width, height)\r\n if (this.clientPos.x === x && this.clientPos.y === y) { return }\r\n this.clientPos = { x, y }\r\n if (this.options.appendToBody) {\r\n this.div.style.left = `${clientX}px`\r\n this.div.style.top = `${clientY + height}px`\r\n }\r\n if (this.options.autoUpdate) { \r\n this.div.style.transform = `translate3d(${x}px, ${-height+y}px, 0)`\r\n } else {\r\n this.dispatchEvent({ type: \"update-position\", x, y, width, height })\r\n }\r\n }\r\n\r\n registryEvent() {\r\n this.context.addEventListener('update', this.onUpdate)\r\n }\r\n\r\n unRegistryEvent() {\r\n this.context.removeEventListener('update', this.onUpdate)\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent()\r\n this.unBindElement()\r\n this.div?.remove();\r\n this.div = null as unknown as HTMLDivElement\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Box3, Object3D, Vector3 } from \"three\";\r\nimport { GraphicLayer } from '../layer/graphic-layer'\r\nimport { PoiLayer } from '../layer/poi-layer'\r\nimport { Graphic, GraphicOptionsParam } from \"./graphic\";\r\nimport { Shadow } from \"./shadow\";\r\nimport { PoiOptionsParam } from \"./poi\";\r\nimport { HeatmapDataParam, HeatmapElement } from './heatmap'\r\nimport { Model, ModelOptions } from \"./model\";\r\n\r\nexport class Floor extends Object3D {\r\n \r\n graphicLayer: GraphicLayer;\r\n\r\n poiLayer: PoiLayer;\r\n\r\n grounds: Set<Graphic> = new Set();\r\n\r\n shadow = new Shadow();\r\n\r\n heatmap?: HeatmapElement;\r\n\r\n groundUpper = new Object3D();\r\n\r\n models = new Object3D()\r\n\r\n private groundMaxHeight = 0;\r\n\r\n constructor(public context: Context) {\r\n super()\r\n this.graphicLayer = new GraphicLayer(this.context);\r\n this.poiLayer = new PoiLayer(this.context);\r\n this.groundUpper.add(this.graphicLayer)\r\n this.groundUpper.add(this.poiLayer)\r\n this.add(this.groundUpper)\r\n this.add(this.models)\r\n }\r\n\r\n createGround(options: GraphicOptionsParam) {\r\n // options.deltaHeight = 0.00001 * this.grounds.size\r\n const ground = new Graphic(this.context, options)\r\n this.addGrounds([ground])\r\n }\r\n\r\n addGrounds(grounds: Graphic[]) {\r\n grounds.forEach(ground => { \r\n if (!this.grounds.has(ground)) {\r\n ground.mesh.castShadow = true;\r\n this.grounds.add(ground)\r\n this.groundUpper.add(ground)\r\n }\r\n })\r\n this.changeGroundMaxHeight()\r\n }\r\n\r\n changeGroundMaxHeight() { \r\n const grounds = Array.from(this.grounds)\r\n this.groundMaxHeight = this.grounds.size > 0 ? Math.max(...grounds.map(ground => ground.options.height + ground.options.airHeight + ground.options.deltaHeight)) : 0\r\n this.graphicLayer.position.z = this.groundMaxHeight\r\n this.models.position.z = this.groundMaxHeight\r\n }\r\n\r\n get hasElement() { \r\n return !!(this.grounds.size || this.graphicLayer.children.length)\r\n }\r\n\r\n getCenter() { \r\n return new Box3().setFromObject(this.groundUpper).getCenter(new Vector3())\r\n }\r\n \r\n addModel(options: ModelOptions) { \r\n const model = new Model(this.context, options)\r\n this.models.add(model)\r\n return model\r\n }\r\n\r\n addShadow() { \r\n const box = new Box3().setFromObject(this.groundUpper)\r\n const center = box.getCenter(new Vector3())\r\n const size = box.getSize(new Vector3())\r\n this.shadow.setPosition(center)\r\n this.shadow.changeLightCamera(size)\r\n this.add(this.shadow)\r\n }\r\n\r\n addGraphic(graphicOptions: GraphicOptionsParam) {\r\n return this.graphicLayer.createGraphic(graphicOptions)\r\n }\r\n\r\n addPoi(poiOptions: PoiOptionsParam) {\r\n return this.poiLayer.createPoi(poiOptions)\r\n }\r\n\r\n addHeatmap(data: HeatmapDataParam) {\r\n if (!this.heatmap) {\r\n this.heatmap = new HeatmapElement(this.context)\r\n this.add(this.heatmap)\r\n }\r\n this.heatmap.loadData(data)\r\n const box = new Box3().setFromObject(this.graphicLayer)\r\n this.heatmap.position.setZ(box.max.z)\r\n return this.heatmap\r\n }\r\n\r\n removeHeatMap() {\r\n if (this.heatmap) {\r\n this.remove(this.heatmap)\r\n this.heatmap.dispose()\r\n this.heatmap = undefined\r\n }\r\n }\r\n\r\n setShadowOpacity(opacity: number) {\r\n this.shadow.setOpacity(opacity)\r\n }\r\n\r\n setShadowVisible(visible: boolean) {\r\n this.shadow.visible = visible;\r\n }\r\n\r\n dispose() {\r\n this.shadow.dispose();\r\n this.graphicLayer.dispose()\r\n this.poiLayer.dispose()\r\n this.grounds.forEach(ground => ground.dispose())\r\n this.heatmap?.dispose()\r\n this.groundUpper.clear()\r\n this.models.children.forEach((model) => (model as unknown as Model).dispose())\r\n this.models.clear()\r\n this.clear()\r\n }\r\n\r\n}", "import { Graphic, GraphicOptionsParam } from \"../elements\";\r\nimport { Box3, Raycaster, Vector3 } from \"three\";\r\nimport { Layer } from \"./layer\";\r\nimport { Context } from \"../context\";\r\n\r\nexport class GraphicLayer extends Layer {\r\n\r\n graphicMap = new Map<string, Graphic>()\r\n\r\n constructor(context: Context) {\r\n super(context)\r\n }\r\n\r\n getCenter(): Vector3 { \r\n const box = new Box3().setFromObject(this)\r\n return box.getCenter(new Vector3())\r\n }\r\n\r\n createGraphic(options: GraphicOptionsParam) {\r\n // options.deltaHeight = 0.00001 * this.graphicMap.size;\r\n const graphic = new Graphic(this.context, options)\r\n this.add(graphic)\r\n this.graphicMap.set(options.id!, graphic)\r\n return graphic\r\n }\r\n\r\n removeGraphic(graphic: Graphic) { \r\n this.remove(graphic)\r\n this.graphicMap.delete(graphic.options.id!)\r\n graphic.dispose()\r\n }\r\n\r\n removeGraphicById(id: string) {\r\n if (this.graphicMap.has(id)) {\r\n this.removeGraphic(this.graphicMap.get(id)!)\r\n }\r\n }\r\n\r\n getGraphicByNodeId(id: string) {\r\n return this.graphicMap.get(id) || null\r\n }\r\n\r\n /**\r\n * \u83B7\u53D6\u5C04\u7EBF\u76F8\u4EA4\u7684\u5143\u7D20\r\n * @param raycaster \r\n */\r\n getGraphicByRaycaster(raycaster: Raycaster): { graphics: Graphic[], position: Vector3 | null } {\r\n const initData: {\r\n position: Vector3 | null,\r\n graphic: Graphic | null,\r\n distance: number\r\n } = { distance: 10000, graphic: null, position: null }\r\n const data = this.children.reduce((res, item) => {\r\n if (item instanceof Graphic) {\r\n const pos = item.raycast(raycaster)\r\n if (pos) {\r\n const { distance } = pos\r\n if (distance < res.distance) {\r\n return {\r\n distance: res.distance,\r\n position: res.position,\r\n graphic: item\r\n }\r\n }\r\n }\r\n return res\r\n } else {\r\n return res\r\n }\r\n }, initData)\r\n if (data === initData) {\r\n return { graphics: [], position: null }\r\n }\r\n return { graphics: [data.graphic!], position: data.position }\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Object3D } from \"three\";\r\nimport { dispose } from '../utils'\r\n\r\nexport class Layer extends Object3D {\r\n constructor(public context: Context) {\r\n super();\r\n }\r\n\r\n dispose() {\r\n dispose(this)\r\n this.clear()\r\n }\r\n}", "import { Poi, PoiOptionsParam } from \"../elements\";\r\nimport { Layer } from \"./layer\";\r\nimport { Context } from '../context'\r\nimport { debounce } from 'lodash'\r\nimport { Timer } from \"../utils\";\r\n\r\nexport class PoiLayer extends Layer {\r\n pois: Poi[] = []\r\n debounceCollisionDetection: () => void\r\n\r\n timer = new Timer()\r\n \r\n constructor(context: Context) {\r\n super(context)\r\n this.registryEvent()\r\n this.debounceCollisionDetection = debounce(this.collisionDetection, 10)\r\n }\r\n\r\n clear(force = false) {\r\n this.pois.forEach(item => {\r\n if (item.options.built_in && !force) { \r\n return\r\n }\r\n item.dispose()\r\n })\r\n this.pois = force ? [] : this.pois.filter(item => item.options.built_in)\r\n return this\r\n }\r\n\r\n createPoi(options: PoiOptionsParam) {\r\n const poi = new Poi(this.context, options)\r\n this.pushPoi(poi)\r\n poi.addEventListener(\"change-level\", () => this.changePoiLevelOrCollisionEnable(poi))\r\n poi.addEventListener(\"change-collision_enable\", () => this.changePoiLevelOrCollisionEnable(poi))\r\n Promise.resolve().then(() => { \r\n this.debounceCollisionDetection()\r\n })\r\n return poi\r\n }\r\n\r\n changePoiLevelOrCollisionEnable(poi: Poi) {\r\n const index = this.pois.findIndex(item => item === poi)\r\n if (index === -1) { return }\r\n this.pois.splice(index, 1)\r\n this.pushPoi(poi)\r\n }\r\n\r\n removePoi(poi: Poi) {\r\n const index = this.pois.findIndex(item => item === poi)\r\n if (index === -1) { return }\r\n this.pois.splice(index, 1)\r\n poi.dispose()\r\n }\r\n\r\n removePoiById(id: string) {\r\n const poi = this.pois.find(item => item.options.id === id)\r\n if (poi) {\r\n this.removePoi(poi)\r\n }\r\n }\r\n\r\n getPoiById(id: string) { \r\n const poi = this.pois.find(item => item.options.id === id)\r\n return poi || null\r\n }\r\n\r\n /**\r\n * \u4FDD\u5B58poi\u6309\u7167level\u6392\u5E8F\r\n * @param poi \r\n */\r\n pushPoi(poi: Poi) {\r\n // \u4E0D\u53C2\u4E0E\u78B0\u649E\u68C0\u6D4B\u7684\u5728\u6700\u524D\u9762\r\n if (!poi.options.collision_enable) {\r\n this.pois.unshift(poi)\r\n return\r\n }\r\n // level\u6700\u5C0F\u7684\u5728\u6700\u540E\u9762\r\n if (poi.options.level === 0) {\r\n this.pois.push(poi)\r\n return\r\n }\r\n for (let i = 0; i < this.pois.length; i++) {\r\n const item = this.pois[i]\r\n // \u4E0D\u53C2\u4E0E\u78B0\u649E\u68C0\u6D4B\u7684\u5728\u524D\u9762\r\n if (!item.options.collision_enable) { \r\n continue\r\n }\r\n if (item.options.level <= poi.options.level) {\r\n this.pois.splice(i, 0, poi)\r\n return\r\n }\r\n }\r\n // \u63D2\u5165\u5230\u6700\u540E\r\n this.pois.push(poi) \r\n }\r\n\r\n getPoiByDeviceXy(x: number, y: number) {\r\n const pois = this.pois.filter(item => {\r\n return (item instanceof Poi) && item.isContain(x, y)\r\n })\r\n return pois\r\n }\r\n\r\n onUpdate = () => { \r\n this.timer.requestAnimationFrame(() => { \r\n this.collisionDetection()\r\n })\r\n }\r\n\r\n /**\r\n * \u78B0\u649E\u68C0\u6D4B\r\n */\r\n collisionDetection() {\r\n const range: { left: number; right: number; top: number; bottom: number; }[] = []\r\n // \u6392\u9664\u5728\u5C4F\u5E55\u5916\u7684poi\r\n const pois = this.pois.filter(item => item.visible && item.withinDisplayRange)\r\n pois.forEach((item, index) => {\r\n const { left, right, top, bottom } = item.getBox()\r\n if (index === 0) {\r\n range.push({ left, right, top, bottom })\r\n return\r\n }\r\n // valid boolean \u8868\u793A\u53D1\u751F\u4E86\u78B0\u649E\r\n const valid = range.some((box) => { \r\n // \u5224\u65AD\u56DB\u4E2A\u70B9\u662F\u4E0D\u662F\u90FD\u4E0D\u5728box\u7684\u8303\u56F4\u5185\r\n return box.left < right && box.right > left && box.top < bottom && box.bottom > top;\r\n })\r\n item.parentSetVisible(!valid)\r\n if (!valid) { \r\n range.push({ left, right, top, bottom })\r\n }\r\n })\r\n }\r\n\r\n registryEvent() {\r\n this.context.addEventListener('update', this.onUpdate)\r\n }\r\n\r\n unRegistryEvent() { \r\n this.context.removeEventListener('update', this.onUpdate)\r\n }\r\n \r\n dispose() {\r\n this.timer.dispose()\r\n this.pois.forEach(item => item.dispose())\r\n this.pois.length = 0;\r\n this.debounceCollisionDetection = () => { }\r\n super.dispose()\r\n this.unRegistryEvent()\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport {\r\n MeshBasicMaterial, Object3D, PlaneGeometry,\r\n Texture, DoubleSide, Mesh, Matrix3, Vector2\r\n} from \"three\";\r\nimport { create, Heatmap, HeatmapData, DataPoint } from '@mars3d/heatmap.js'\r\nimport { featureCollection, point, bbox, center as getCenter } from '@turf/turf'\r\n\r\ntype V = 'value'\r\ntype X = 'x'\r\ntype Y = 'y'\r\n\r\nexport type HeatmapDataParam = HeatmapData<DataPoint<V, X, Y>>\r\n\r\nexport class HeatmapElement extends Object3D {\r\n\r\n private heatmap?: Heatmap<V, X, Y>;\r\n\r\n private div: HTMLDivElement\r\n\r\n private plane?: Mesh;\r\n\r\n constructor(private context: Context) {\r\n super()\r\n this.div = document.createElement(\"div\")\r\n }\r\n\r\n clearHeatmap() {\r\n if (this.div.firstChild) {\r\n this.div.removeChild(this.div.firstChild)\r\n }\r\n this.heatmap = undefined;\r\n }\r\n\r\n loadData(data: HeatmapDataParam) {\r\n this.clearHeatmap()\r\n const { width, height, leftTop, center } = this.getBox(data)\r\n this.heatmap = create({\r\n width: width,\r\n height: height,\r\n container: this.div,\r\n ...this.context.config.heatMap,\r\n } as any);\r\n this.heatmap.setData(this.transformData(data, leftTop))\r\n this.initPlane(width, height)\r\n this.position.set(center[0], center[1], this.position.z)\r\n }\r\n\r\n initPlane(width: number, height: number) {\r\n if (this.plane) { this.remove(this.plane) }\r\n const geometry = new PlaneGeometry(width, height)\r\n const texture = new Texture(this.div.firstChild as HTMLCanvasElement);\r\n texture.needsUpdate = true;\r\n const material = new MeshBasicMaterial({\r\n transparent: true,\r\n side: DoubleSide,\r\n map: texture,\r\n });\r\n material.needsUpdate = true;\r\n this.plane = new Mesh(geometry, material)\r\n this.add(this.plane)\r\n }\r\n\r\n getTransMatrix({ x, y }: { x: number, y: number }) {\r\n // \u5148\u628A\u5DE6\u4E0A\u89D2\u5E73\u79FB\u523000\u70B9\uFF0C\u7136\u540E\u5BF9y\u8F74\u53D6\u53CD\r\n return new Matrix3().makeScale(1, -1).multiply(new Matrix3().makeTranslation(0 - x, 0 - y))\r\n }\r\n\r\n /**\r\n * \u6240\u6709\u70B9\u7684\u5750\u6807\u51CF\u53BB\u5DE6\u4E0A\u89D2\u4ECE00\u70B9\u5F00\u59CB\u753Bcanvas\r\n * @param data \r\n * @param leftTop \r\n * @returns \r\n */\r\n transformData(data: HeatmapDataParam, leftTop: { x: number, y: number }): HeatmapDataParam {\r\n const matrix = this.getTransMatrix(leftTop)\r\n const $data = data.data.map(item => { \r\n const vector = new Vector2(item.x, item.y).applyMatrix3(matrix)\r\n return {\r\n x: vector.x,\r\n y: vector.y,\r\n value: item.value\r\n }\r\n })\r\n return {\r\n data: $data,\r\n max: data.max,\r\n min: data.min\r\n }\r\n }\r\n\r\n getBox(data: HeatmapDataParam) {\r\n const features = featureCollection(data.data.map(item => point([item.x, item.y])))\r\n // \u8FD4\u56DE\u4E00\u4E2A\u77E9\u5F62\u8FB9\u6846\u5750\u6807\r\n const box = bbox(features);\r\n const width = box[2] - box[0]\r\n const height = box[3] - box[1]\r\n const leftTop = { x: box[0], y: box[3] }\r\n const center = getCenter(features)\r\n return { width, height, leftTop, center: center.geometry.coordinates }\r\n }\r\n\r\n dispose() {\r\n this.div = null as unknown as HTMLDivElement\r\n this.heatmap = undefined\r\n }\r\n}", "import { Box3, Object3D, Vector3 } from \"three\";\r\nimport { Context } from \"../context\";\r\nimport { loadModel, dispose } from \"../utils\";\r\nimport { Poi } from \"./poi\";\r\nimport { GLTF } from \"three/examples/jsm/loaders/GLTFLoader\";\r\n\r\nexport interface ModelOptions {\r\n modelUrl: string;\r\n icon?: string;\r\n icon_size?: [number, number];\r\n position?: Vector3;\r\n}\r\n\r\nexport class Model extends Object3D {\r\n poi: Poi | null = null;\r\n\r\n model: GLTF | null = null\r\n\r\n constructor(public context: Context, private options: ModelOptions) {\r\n super()\r\n this.position.copy(options.position || new Vector3(0, 0, 0))\r\n this.loadModel()\r\n }\r\n \r\n async loadModel() { \r\n const object = await loadModel(this.options.modelUrl);\r\n object.scene.rotation.set(Math.PI / 2, Math.PI / 2, 0)\r\n this.add(object.scene)\r\n this.model = object\r\n this.initPoi()\r\n }\r\n\r\n initPoi() {\r\n if (!this.options.icon) {\r\n return\r\n }\r\n const poi = this.context.currentFloor?.addPoi({\r\n icon: this.options.icon,\r\n icon_size: this.options.icon_size,\r\n built_in: true,\r\n level: 0\r\n })\r\n this.poi = poi || null\r\n if (this.model && poi) {\r\n poi.position = (new Box3().setFromObject(this)).getCenter(new Vector3())\r\n }\r\n }\r\n\r\n dispose() {\r\n dispose(this)\r\n this.model = null\r\n if (this.poi) {\r\n this.context.currentFloor?.poiLayer.removePoi(this.poi)\r\n this.poi = null;\r\n }\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { EventDispatcher, Vector3 } from \"three\";\r\nimport { createSvg, vector3ToDevice } from '../utils'\r\n\r\nexport class BaseSvg<T extends {} = {}> extends EventDispatcher<T> {\r\n protected points: Vector3[] = [];\r\n\r\n protected svg: SVGElement;\r\n\r\n protected enable = true;\r\n\r\n constructor(public context: Context) {\r\n super()\r\n this.svg = createSvg(`${context.container.clientWidth}`, `${context.container.clientHeight}`)\r\n context.container.appendChild(this.svg)\r\n this._registryEvent()\r\n }\r\n\r\n private _onResize = ({ width, height }: { width: number; height: number }) => {\r\n if (this.svg) {\r\n this.svg.setAttribute(\"width\", `${width}`)\r\n this.svg.setAttribute(\"height\", `${height}`)\r\n }\r\n }\r\n\r\n private _registryEvent() {\r\n this.context.addEventListener(\"resize\", this._onResize)\r\n }\r\n\r\n private _unRegistryEvent() { \r\n this.context.removeEventListener(\"resize\", this._onResize)\r\n }\r\n\r\n setEnable(enable: boolean) {\r\n this.enable = enable;\r\n if (enable) {\r\n this.svg.style.display = 'block';\r\n } else {\r\n this.svg.style.display = 'none';\r\n }\r\n }\r\n\r\n getIntersectByPointerEvent(e: PointerEvent) {\r\n const { camera, renderer } = this.context\r\n const { offsetX: x, offsetY: y } = e\r\n const { clientWidth, clientHeight } = renderer.domElement;\r\n const nx = x / clientWidth * 2 - 1;\r\n const ny = 1 - y / clientHeight * 2;\r\n\r\n const v = new Vector3(nx, ny, 0);\r\n\r\n return v.unproject(camera);\r\n }\r\n\r\n getSvgCoordinate(vector: Vector3) {\r\n const { camera, container } = this.context\r\n const coord = vector3ToDevice(vector, camera, container.clientWidth, container.clientHeight)\r\n return coord\r\n }\r\n \r\n dispose() {\r\n this._unRegistryEvent()\r\n this.context.container.removeChild(this.svg)\r\n this.svg = null as unknown as SVGElement\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Vector3 } from \"three\";\r\nimport { setCirclePosition, createCircle, createLine, setLineStartEnd } from '../utils'\r\nimport { BaseSvg } from './base-svg'\r\n\r\ninterface SvgLineEventMap {\r\n 'distance': { distance: number }\r\n}\r\n\r\nexport class SvgLine extends BaseSvg<SvgLineEventMap> {\r\n\r\n private circles: SVGElement[] \r\n \r\n private line: SVGElement\r\n\r\n constructor(public context: Context) {\r\n super(context)\r\n const { config: { svg: { circle, line } } } = context\r\n this.circles = [createCircle(circle.radius, circle.fill), createCircle(circle.radius, circle.fill)]\r\n this.line = createLine(line.stroke)\r\n this.svg.appendChild(this.circles[0]);\r\n this.svg.appendChild(this.circles[1]);\r\n this.svg.appendChild(this.line);\r\n this.registryEvent()\r\n }\r\n\r\n setEnable(enable: boolean) {\r\n super.setEnable(enable)\r\n if (enable) {\r\n this.registryEvent()\r\n } else {\r\n this.unRegistryEvent()\r\n }\r\n }\r\n\r\n registryEvent() { \r\n this.context.container.addEventListener(\"pointerenter\", this.onPointermove)\r\n this.context.container.addEventListener(\"pointermove\", this.onPointermove)\r\n this.context.container.addEventListener(\"pointerleave\", this.onPointerleave)\r\n this.context.container.addEventListener(\"pointerdown\", this.onPointerdown)\r\n this.context.addEventListener(\"update\", this.onUpdate)\r\n }\r\n \r\n unRegistryEvent() { \r\n this.context.container.removeEventListener(\"pointerenter\", this.onPointermove)\r\n this.context.container.removeEventListener(\"pointermove\", this.onPointermove)\r\n this.context.container.removeEventListener(\"pointerleave\", this.onPointerleave)\r\n this.context.container.removeEventListener(\"pointerdown\", this.onPointerdown)\r\n this.context.removeEventListener(\"update\", this.onUpdate)\r\n }\r\n\r\n onUpdate = () => {\r\n if (this.points[0]) {\r\n const point1 = this.getSvgCoordinate(this.points[0])\r\n setCirclePosition(this.circles[0], point1.x, point1.y)\r\n setLineStartEnd(this.line, point1)\r\n }\r\n if (this.points[1]) {\r\n const point2 = this.getSvgCoordinate(this.points[1])\r\n setCirclePosition(this.circles[1], point2.x, point2.y)\r\n setLineStartEnd(this.line, undefined, point2)\r\n }\r\n }\r\n \r\n \r\n onPointermove = (e: PointerEvent) => { \r\n // \u53EA\u5728\u6709\u7B2C\u4E00\u4E2A\u70B9\u7684\u65F6\u5019\u9700\u8981\r\n if (this.points.length !== 1) { return }\r\n this.line.style.display = \"block\";\r\n setLineStartEnd(this.line, undefined, { x: e.offsetX, y: e.offsetY })\r\n }\r\n \r\n onPointerleave = () => { \r\n if (this.points[1]) { return } // \u5982\u679C\u5DF2\u7ECF\u6709\u4E24\u4E2A\u70B9\u4E86\u5C31\u4E0D\u505A\u5904\u7406\r\n this.line.style.display = \"none\";\r\n }\r\n \r\n onPointerdown = (e: PointerEvent) => {\r\n if (this.points[1]) { return } // \u5982\u679C\u5DF2\u7ECF\u6709\u4E24\u4E2A\u70B9\u4E86\u5C31\u4E0D\u505A\u5904\u7406\r\n const point = this.getIntersectByPointerEvent(e)\r\n if (point) {\r\n const { offsetX: x, offsetY: y } = e\r\n // \u4FEE\u6539\u70B9\r\n const circle = this.circles[this.points.length]\r\n setCirclePosition(circle, x, y)\r\n if (!this.points.length) { \r\n // \u8BBE\u7F6E\u7EBF\u7684\u8D77\u59CB\u70B9\r\n setLineStartEnd(this.line, { x, y }, { x, y })\r\n }\r\n this.addPoint(point)\r\n }\r\n }\r\n\r\n addPoint(vector: Vector3) {\r\n this.points.push(vector)\r\n if (this.points.length >= 2) {\r\n const distance = this.calculatedDistance()\r\n this.dispatchEvent({ type: 'distance', distance })\r\n }\r\n }\r\n\r\n /**\r\n * \u8BA1\u7B97\u4E24\u4E2A\u70B9\u4E4B\u95F4\u7684\u8DDD\u79BB\r\n */\r\n calculatedDistance() { \r\n const [{ x: x1, y: y1 }, { x: x2, y: y2 }] = this.points\r\n return Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)\r\n }\r\n \r\n dispose() {\r\n super.dispose()\r\n this.unRegistryEvent()\r\n this.line = null as unknown as SVGElement\r\n this.circles = []\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { BaseSvg } from \"./base-svg\";\r\nimport { setCirclePosition, setLineStartEnd, createLine, createCircle } from '../utils'\r\nimport { Vector3 } from \"three\";\r\n\r\ninterface SvgPolygonEventMap {\r\n 'area': { area: number }\r\n}\r\n\r\nexport class SvgPolygon extends BaseSvg<SvgPolygonEventMap> {\r\n\r\n private circles: SVGElement[] = []\r\n\r\n private lines: SVGElement[] = []\r\n\r\n private isClose = false\r\n\r\n constructor(context: Context) {\r\n super(context)\r\n this.registryEvent()\r\n }\r\n\r\n setEnable(enable: boolean) {\r\n super.setEnable(enable)\r\n if (enable) {\r\n this.registryEvent()\r\n } else {\r\n this.unRegistryEvent()\r\n }\r\n }\r\n\r\n private get lastLine() {\r\n return this.lines.slice(-1)[0]\r\n }\r\n\r\n private addCircle(circle: SVGElement) {\r\n this.circles.push(circle)\r\n this.svg.appendChild(circle)\r\n }\r\n\r\n private addLine(line: SVGElement) {\r\n this.lines.push(line)\r\n this.svg.appendChild(line)\r\n }\r\n\r\n registryEvent() { \r\n this.context.container.addEventListener(\"pointerenter\", this.onPointermove)\r\n this.context.container.addEventListener(\"pointermove\", this.onPointermove)\r\n this.context.container.addEventListener(\"pointerleave\", this.onPointerleave)\r\n this.context.container.addEventListener(\"pointerdown\", this.onPointerdown)\r\n this.context.addEventListener(\"update\", this.onUpdate)\r\n }\r\n \r\n unRegistryEvent() { \r\n this.context.container.removeEventListener(\"pointerenter\", this.onPointermove)\r\n this.context.container.removeEventListener(\"pointermove\", this.onPointermove)\r\n this.context.container.removeEventListener(\"pointerleave\", this.onPointerleave)\r\n this.context.container.removeEventListener(\"pointerdown\", this.onPointerdown)\r\n this.context.removeEventListener(\"update\", this.onUpdate)\r\n }\r\n\r\n onUpdate = () => {\r\n if (this.points.length) {\r\n this.points.forEach((point, index) => {\r\n const devicePoint = this.getSvgCoordinate(point)\r\n if (this.circles[index]) {\r\n setCirclePosition(this.circles[index], devicePoint.x, devicePoint.y)\r\n }\r\n if (index !== 0) {\r\n setLineStartEnd(this.lines[index - 1], undefined, devicePoint)\r\n }\r\n if (this.lines[index]) {\r\n setLineStartEnd(this.lines[index], devicePoint)\r\n }\r\n }) \r\n }\r\n }\r\n \r\n \r\n onPointermove = (e: PointerEvent) => { \r\n // \u5FC5\u987B\u8981\u6709\u4E00\u4E2A\u70B9\u5E76\u4E14\u8FD8\u6CA1\u6709\u95ED\u5408\u624D\u9700\u8981\u5904\u7406\r\n if (!this.lastLine || this.isClose) { return }\r\n this.lastLine.style.display = \"block\";\r\n setLineStartEnd(this.lastLine, undefined, { x: e.offsetX, y: e.offsetY })\r\n }\r\n \r\n onPointerleave = () => { \r\n // \u5982\u679C\u5DF2\u7ECF\u95ED\u5408\u4E86\u5C31\u4E0D\u9700\u8981\u5904\u7406\u4E86\r\n if (this.isClose) { return } \r\n this.lastLine.style.display = \"none\";\r\n }\r\n \r\n onPointerdown = (e: PointerEvent) => {\r\n // \u5982\u679C\u5DF2\u7ECF\u95ED\u5408\u4E86\r\n if (this.isClose) { return }\r\n const point = this.getIntersectByPointerEvent(e)\r\n if (point) {\r\n const { offsetX: x, offsetY: y } = e\r\n if (this.checkAdsorb(x, y)) {\r\n this.isClose = true\r\n this.addPoint(this.points[0])\r\n } else {\r\n this.addPoint(point)\r\n }\r\n const { circle: { fill, radius }, line: { stroke } } = this.context.config.svg\r\n if (!this.isClose) {\r\n // \u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u70B9\r\n const circle = createCircle(radius, fill)\r\n setCirclePosition(circle, x, y)\r\n this.addCircle(circle)\r\n }\r\n if (this.lines.length) {\r\n // \u5982\u679C\u5DF2\u7ECF\u6709\u4E00\u6761\u7EBF\u4E86 \u8981\u95ED\u5408\u8FD9\u6761\u7EBF\r\n setLineStartEnd(this.lastLine, undefined, { x, y })\r\n }\r\n // \u5982\u679C\u8FD9\u4E2A\u591A\u8FB9\u5F62\u8FD8\u6CA1\u6709\u95ED\u5408 \u5C31\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u7EBF \u5305\u62EC\u521B\u5EFA\u7B2C\u4E00\u6761\u7EBF\r\n if (!this.isClose) {\r\n const line = createLine(stroke)\r\n // \u8BBE\u7F6E\u7EBF\u7684\u8D77\u59CB\u70B9\r\n setLineStartEnd(line, { x, y }, { x, y })\r\n this.addLine(line)\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * \u68C0\u6D4B\u662F\u5426\u53EF\u4EE5\u5438\u9644\r\n * \u5750\u6807\u70B9\u6700\u5C113\u4E2A \u4F20\u5165\u7684\u5750\u6807\u70B9\u548C\u7B2C\u4E00\u4E2A\u5750\u6807\u7684\u50CF\u7D20\u76F8\u5DEE\u4E0D\u8D85\u8FC75\u4E2A\u50CF\u7D20\r\n */\r\n checkAdsorb(x: number, y: number) {\r\n if (this.points.length < 3) { return false }\r\n const circle = this.circles[0]\r\n const cx = +circle.getAttribute(\"cx\")!\r\n const cy = +circle.getAttribute(\"cy\")!\r\n return Math.sqrt((x - cx) ** 2 + (y - cy) ** 2) <= 5\r\n }\r\n\r\n addPoint(vector: Vector3) {\r\n this.points.push(vector)\r\n if (this.isClose) {\r\n const area = this.calculatedArea()\r\n this.dispatchEvent({ type: 'area', area })\r\n }\r\n }\r\n // \u8BA1\u7B97\u9762\u79EF\r\n calculatedArea() {\r\n const cds = this.points.map(item => [item.x, item.y])\r\n let area = 0\r\n const numPoints = cds.length\r\n for (let i = 0; i < numPoints; i++) {\r\n const j = (i + 1) % numPoints\r\n area += (cds[i][0] * cds[j][1] - cds[j][0] * cds[i][1])\r\n }\r\n return Math.abs(area / 2)\r\n }\r\n\r\n dispose() {\r\n super.dispose()\r\n this.unRegistryEvent()\r\n this.lines = []\r\n this.circles = []\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Box3 } from \"three\";\r\nimport { vector3ToDevice, createRect, setRectPosition } from '../utils'\r\nimport { BaseSvg } from './base-svg'\r\nimport { Graphic } from \"./graphic\";\r\n\r\ninterface SvgLineEventMap {\r\n 'distance': { distance: number }\r\n}\r\n\r\nexport class SelectBox extends BaseSvg<SvgLineEventMap> {\r\n\r\n private rect!: SVGElement\r\n\r\n private cornerRect: SVGElement[] = [] // \u56DB\u4E2A\u89D2\u4E0A\u7684\u65B9\u5757\r\n\r\n private centerRect: SVGElement[] = [] // \u56DB\u4E2A\u7EBF\u4E2D\u95F4\u7684\u65B9\u5757\r\n\r\n private graphic?: Graphic\r\n\r\n constructor(public context: Context) {\r\n super(context)\r\n const { config: { svg: { line } } } = context\r\n this.rect = createRect(line.stroke, \"transparent\")\r\n this.svg.appendChild(this.rect)\r\n for (let i = 0; i < 4; i++) {\r\n this.cornerRect[i] = createRect(line.stroke, \"#ffffff\")\r\n this.centerRect[i] = createRect(line.stroke, \"#ffffff\")\r\n this.svg.appendChild(this.cornerRect[i])\r\n this.svg.appendChild(this.centerRect[i])\r\n }\r\n this.registryEvent()\r\n }\r\n\r\n setEnable(enable: boolean) {\r\n super.setEnable(enable)\r\n if (enable) {\r\n this.registryEvent()\r\n } else {\r\n this.unRegistryEvent()\r\n }\r\n }\r\n\r\n registryEvent() { \r\n this.context.addEventListener(\"update\", this.onUpdate)\r\n }\r\n \r\n unRegistryEvent() { \r\n this.context.removeEventListener(\"update\", this.onUpdate)\r\n }\r\n\r\n onUpdate = () => {\r\n if (!this.graphic) {\r\n setRectPosition(this.rect, 0, 0, 0, 0)\r\n for (let i = 0; i < this.cornerRect.length; i++) {\r\n setRectPosition(this.cornerRect[i], 0, 0, 0, 0)\r\n setRectPosition(this.centerRect[i], 0, 0, 0, 0)\r\n }\r\n } else {\r\n const box = new Box3().setFromObject(this.graphic)\r\n const { camera, container: { clientWidth: w, clientHeight: h } } = this.context\r\n const { min, max } = box\r\n const leftBottom = vector3ToDevice(min, camera, w, h)\r\n const rightTop = vector3ToDevice(max, camera, w, h)\r\n // \u753B\u51FA\u4E00\u4E2A\u6846\u6765\r\n setRectPosition(this.rect, leftBottom.x, rightTop.y, Math.abs(rightTop.x - leftBottom.x), Math.abs(rightTop.y - leftBottom.y))\r\n // \u56DB\u4E2A\u89D2\u7684\u4F4D\u7F6E\r\n const { x: left, y: bottom } = leftBottom\r\n const { x: right, y: top } = rightTop\r\n const halfWidth = 5;\r\n const corners = [\r\n { x: left - halfWidth, y: top - halfWidth }, // \u5DE6\u4E0A\u89D2\r\n { x: right - halfWidth, y: top - halfWidth }, // \u53F3\u4E0A\u89D2\r\n { x: left - halfWidth, y: bottom - halfWidth }, // \u5DE6\u4E0B\u89D2\r\n { x: right - halfWidth, y: bottom - halfWidth }, // \u53F3\u4E0B\u89D2 \r\n ]\r\n for (let i = 0; i < corners.length; i++) {\r\n setRectPosition(this.cornerRect[i], corners[i].x, corners[i].y, halfWidth * 2, halfWidth * 2)\r\n }\r\n // \u56DB\u4E2A\u4E2D\u95F4\u7684\u4F4D\u7F6E\r\n const centerHalfWidth = 4;\r\n const centerX = (left + right) / 2\r\n const centerY = (bottom + top) / 2\r\n const centers = [\r\n { x: centerX - centerHalfWidth, y: top - centerHalfWidth }, // \u4E0A\r\n { x: left - centerHalfWidth, y: centerY - centerHalfWidth }, // \u5DE6\r\n { x: right - centerHalfWidth, y: centerY - centerHalfWidth }, // \u53F3\r\n { x: centerX - centerHalfWidth, y: bottom - centerHalfWidth }, // \u4E0B\r\n ]\r\n for (let i = 0; i < centers.length; i++) {\r\n setRectPosition(this.centerRect[i], centers[i].x, centers[i].y, centerHalfWidth * 2, centerHalfWidth * 2)\r\n }\r\n }\r\n }\r\n \r\n selectGraphic(graphic: Graphic) { \r\n this.graphic = graphic\r\n }\r\n\r\n dispose() {\r\n super.dispose()\r\n this.unRegistryEvent()\r\n this.rect = null as unknown as SVGElement\r\n this.cornerRect = []\r\n this.centerRect = []\r\n }\r\n}", "import { createRect, isContain, setRectPosition, vector3ToDevice } from \"../../utils\";\r\nimport { Context } from \"../../context\";\r\nimport { BaseSvg, Graphic } from \"../../elements\";\r\nimport { Frustum, Vector3 } from \"three\";\r\n\r\ninterface BoxSelectionEventMap { \r\n \"selected\": {\r\n list: Graphic[]\r\n }\r\n}\r\n\r\nexport class BoxSelection extends BaseSvg<BoxSelectionEventMap> {\r\n\r\n private startPoint?: Vector3;\r\n\r\n private endPoint?: Vector3;\r\n\r\n rect: SVGElement;\r\n\r\n frustum = new Frustum();\r\n\r\n constructor(context: Context) { \r\n super(context);\r\n const { config: { selectBox: { fill, stroke } } } = context\r\n this.rect = createRect(stroke, fill)\r\n this.svg.appendChild(this.rect)\r\n this.registryEvent()\r\n }\r\n\r\n setEnable(enable: boolean): void {\r\n super.setEnable(enable)\r\n setRectPosition(this.rect, 0, 0, 0, 0)\r\n if (enable) {\r\n this.registryEvent()\r\n } else {\r\n this.startPoint = undefined\r\n this.unRegistryEvent()\r\n }\r\n }\r\n\r\n onPointerDown = (e: PointerEvent) => { \r\n if (!this.enable) { return }\r\n const point = this.getIntersectByPointerEvent(e)\r\n if (point) { \r\n this.startPoint = point\r\n }\r\n this.endPoint = undefined;\r\n }\r\n\r\n onPointerMove = (e: PointerEvent) => { \r\n if (!this.enable || !this.startPoint) { return }\r\n const point = this.getIntersectByPointerEvent(e)\r\n if (point) { \r\n this.endPoint = point\r\n }\r\n }\r\n\r\n onPointerUp = (e: PointerEvent) => { \r\n if (!this.enable) { return }\r\n const point = this.getIntersectByPointerEvent(e)\r\n if (point) { \r\n this.endPoint = point\r\n }\r\n this.doSelect()\r\n this.startPoint = undefined\r\n }\r\n\r\n onUpdate = () => {\r\n if (this.startPoint) {\r\n const startPoint = this.getSvgCoordinate(this.startPoint)\r\n let endPoint = { ...startPoint }\r\n if (this.endPoint) {\r\n endPoint = this.getSvgCoordinate(this.endPoint)\r\n }\r\n const leftTop = { x: Math.min(startPoint.x, endPoint.x), y: Math.min(startPoint.y, endPoint.y) }\r\n const width = Math.abs(endPoint.x - startPoint.x)\r\n const height = Math.abs(endPoint.y - startPoint.y)\r\n setRectPosition(this.rect, leftTop.x, leftTop.y, width, height)\r\n } else {\r\n setRectPosition(this.rect, 0, 0, 0, 0)\r\n }\r\n }\r\n\r\n registryEvent() { \r\n this.context.container.addEventListener(\"pointerdown\", this.onPointerDown)\r\n this.context.container.addEventListener(\"pointermove\", this.onPointerMove)\r\n this.context.container.addEventListener(\"pointerup\", this.onPointerUp)\r\n this.context.addEventListener(\"update\", this.onUpdate)\r\n }\r\n \r\n unRegistryEvent() { \r\n this.context.container.removeEventListener(\"pointerdown\", this.onPointerDown)\r\n this.context.container.removeEventListener(\"pointermove\", this.onPointerMove)\r\n this.context.container.removeEventListener(\"pointerup\", this.onPointerUp)\r\n this.context.removeEventListener(\"update\", this.onUpdate)\r\n }\r\n\r\n doSelect() { \r\n if (this.startPoint && this.endPoint) {\r\n const dis = this.startPoint.distanceTo(this.endPoint);\r\n if (dis < 0.1) { return }\r\n const { context: { camera, container: { clientWidth: w, clientHeight: h } } } = this\r\n const startDevice = vector3ToDevice(this.startPoint!, camera, w, h)\r\n const endDevice = vector3ToDevice(this.endPoint!, camera, w, h)\r\n const leftTop = { x: Math.min(startDevice.x, endDevice.x), y: Math.min(startDevice.y, endDevice.y) }\r\n const rightBottom = { x: Math.max(startDevice.x, endDevice.x), y: Math.max(startDevice.y, endDevice.y) }\r\n const list = this.searchMapInFrustum(leftTop, rightBottom);\r\n this.dispatchEvent({ type: \"selected\", list })\r\n }\r\n }\r\n\r\n searchMapInFrustum(leftTop: { x: number, y: number }, rightBottom: { x: number, y: number }): Graphic[] {\r\n const { context } = this\r\n return context.currentFloor?.graphicLayer.children.filter(item => {\r\n return item instanceof Graphic && this.searchChildInFrustum(item, leftTop, rightBottom)\r\n }) as Graphic[] || []\r\n }\r\n\r\n searchChildInFrustum(object: Graphic, leftTop: { x: number, y: number }, rightBottom: { x: number, y: number }): boolean {\r\n const { context: { camera, container: { clientWidth: w, clientHeight: h } } } = this\r\n if (!object) return false;\r\n if (!object.mesh) { \r\n // \u70B9\r\n const position = object.getPosition()\r\n if (position) {\r\n const position2d = vector3ToDevice(position, camera, w, h)\r\n return isContain(position2d, leftTop, rightBottom)\r\n }\r\n return false\r\n }\r\n if (!object.mesh.geometry.boundingBox) {\r\n object.mesh.geometry.computeBoundingBox();\r\n }\r\n const box = object.mesh.geometry.boundingBox;\r\n if (!box) { return false }\r\n const { min, max } = box\r\n const minDevice = vector3ToDevice(min, camera, w, h)\r\n const maxDevice = vector3ToDevice(max, camera, w, h)\r\n \r\n if (!isContain(minDevice, leftTop, rightBottom)) { return false }\r\n if (!isContain(maxDevice, leftTop, rightBottom)) { return false; }\r\n return true;\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent()\r\n }\r\n}\r\n\r\n", "import { Graphic, Poi } from \"../../elements\";\r\nimport { Context } from \"../../context\";\r\nimport { EventDispatcher } from \"three\";\r\nimport { Timer } from \"../../utils\";\r\n\r\ninterface HoverHelperEventMap {\r\n \"hover-change\": {\r\n graphics: Graphic[]\r\n },\r\n}\r\n\r\nexport class HoverHelper extends EventDispatcher<HoverHelperEventMap> { \r\n\r\n curGraphics = new Set<Graphic>()\r\n\r\n timer = new Timer()\r\n\r\n graphicTimerMap = new Map<Graphic, number>()\r\n \r\n constructor(private context: Context) {\r\n super()\r\n this.registryEvent()\r\n }\r\n\r\n onPointerMove = ({ graphics, pois, e }: { graphics: Graphic[], pois: Poi[], e: PointerEvent }) => {\r\n const poiGraphics = pois\r\n .map(item => this.context.currentFloor?.graphicLayer.graphicMap.get(item.options.id))\r\n .filter(graphic => graphic && graphic.options.geometry.type === \"point\") as Graphic[]\r\n if (!graphics.length && !poiGraphics.length && this.curGraphics.size) {\r\n this.curGraphics.clear()\r\n this.handleHoverGraphicsChange()\r\n return\r\n }\r\n const { time } = this.context.config.hover\r\n const allGraphics = new Set<Graphic>()\r\n if (poiGraphics.length) { \r\n // \u627E\u79BB\u4E2D\u5FC3\u70B9\u6700\u65B0\u7684\u90A3\u4E2A\r\n let resGraphic: Graphic;\r\n let distance = 10000;\r\n poiGraphics.forEach(graphic => { \r\n const poi = pois.find(poi => poi.options.id === graphic.options.id)!\r\n const { x, y } = poi.clientPos\r\n let curDistance = Math.sqrt((x - e.offsetX) ** 2 + (y - e.offsetY) ** 2)\r\n if (curDistance < distance) {\r\n distance = curDistance\r\n resGraphic = graphic\r\n }\r\n })\r\n allGraphics.add(resGraphic!)\r\n }\r\n if (!allGraphics.size) { \r\n graphics.forEach(graphic => allGraphics.add(graphic))\r\n }\r\n allGraphics.forEach((graphic) => {\r\n // \u5982\u679C\u5DF2\u7ECF\u6709hover\u7684\u5B9A\u65F6\u5668\u5728\u6267\u884C\u4E86\u5C31\u8FD4\u56DE\r\n if (this.graphicTimerMap.get(graphic)) { \r\n return\r\n }\r\n // \u5982\u679C\u8FD9\u4E2A\u5143\u7D20\u7684hover\u5DF2\u7ECF\u89E6\u53D1\u8FC7\u4E86\u5C31\u8FD4\u56DE\r\n if (this.curGraphics.has(graphic)) { \r\n return\r\n }\r\n // \u8FD9\u4E2A\u5143\u7D20\u6CA1\u6709\u89E6\u53D1\u8FC7\u4E5F\u6CA1\u6709\u5B9A\u65F6\u5668\u5C31\u6DFB\u52A0\u4E00\u4E2A\u5B9A\u65F6\u5668\r\n const timer = this.timer.setTimeout(() => {\r\n this.curGraphics.add(graphic)\r\n this.graphicTimerMap.delete(graphic)\r\n this.timer.clearTimeout(timer)\r\n this.handleHoverGraphicsChange()\r\n }, time)\r\n this.graphicTimerMap.set(graphic, timer)\r\n })\r\n // \u5982\u679C\u5B9A\u65F6\u5668\u7684\u5143\u7D20\u4E0D\u5B58\u5728\u5728\u5F53\u524Dgraphics\u4E2D\u4E86\u5C31\u5220\u9664\r\n this.graphicTimerMap.forEach((timer, graphic) => { \r\n if (!allGraphics.has(graphic)) { \r\n this.timer.clearTimeout(timer)\r\n this.graphicTimerMap.delete(graphic)\r\n }\r\n })\r\n // \u5982\u679C\u5DF2\u7ECFhover\u7684\u5143\u7D20\u4E0D\u5B58\u5728\u5728\u5F53\u524D\u7684graphics\u4E86\u5C31\u5220\u9664\r\n const size = this.curGraphics.size\r\n this.curGraphics.forEach((graphic) => { \r\n if (!allGraphics.has(graphic)) { \r\n this.curGraphics.delete(graphic)\r\n }\r\n })\r\n // \u5982\u679C\u6709\u5220\u9664\u5C31\u89E6\u53D1\u4E8B\u4EF6\r\n if (size !== this.curGraphics.size) {\r\n this.handleHoverGraphicsChange()\r\n }\r\n }\r\n\r\n onPointerLevel = () => {\r\n this.curGraphics.clear()\r\n this.handleHoverGraphicsChange()\r\n }\r\n\r\n handleHoverGraphicsChange(graphics = this.curGraphics) { \r\n this.dispatchEvent({ type: 'hover-change', graphics: Array.from(graphics) })\r\n }\r\n\r\n registryEvent() {\r\n this.context.addEventListener(\"pointer-over\", this.onPointerMove)\r\n this.context.addEventListener(\"pointer-move\", this.onPointerMove)\r\n this.context.addEventListener(\"pointer-level\", this.onPointerLevel)\r\n }\r\n\r\n unRegistryEvent() {\r\n this.context.removeEventListener(\"pointer-over\", this.onPointerMove)\r\n this.context.removeEventListener(\"pointer-move\", this.onPointerMove)\r\n this.context.removeEventListener(\"pointer-level\", this.onPointerLevel)\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent()\r\n this.timer.dispose()\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Color, LineBasicMaterial, MeshStandardMaterial, MeshBasicMaterial } from \"three\";\r\n\r\ninterface LineMaterialOptions {\r\n color: string;\r\n opacity: number;\r\n}\r\n\r\ninterface MeshStandardMaterialOptions {\r\n color: string,\r\n opacity: number,\r\n}\r\n\r\ninterface MeshBasicMaterialOptions {\r\n color: string,\r\n opacity: number,\r\n}\r\n\r\nexport class MaterialFactory {\r\n\r\n private lineMaterialMap = new Map<string, LineBasicMaterial>()\r\n\r\n private meshStandardMaterialMap = new Map<string, MeshStandardMaterial>()\r\n\r\n private meshBasicMaterialMap = new Map<string, MeshBasicMaterial>()\r\n\r\n constructor(private context: Context) {\r\n\r\n }\r\n\r\n generateLineMaterialKey({ color, opacity }: LineMaterialOptions) { \r\n return `${color}-${opacity}`;\r\n }\r\n\r\n createLineMaterial({ color, opacity }: LineMaterialOptions) {\r\n const key = this.generateLineMaterialKey({ color, opacity })\r\n if (this.lineMaterialMap.has(key)) {\r\n return this.lineMaterialMap.get(key)!\r\n }\r\n const lineMaterial = new LineBasicMaterial({\r\n color: color,\r\n transparent: true,\r\n opacity: opacity\r\n })\r\n this.lineMaterialMap.set(key, lineMaterial);\r\n return lineMaterial\r\n }\r\n\r\n createMeshStandardMaterial({ color, opacity }: MeshStandardMaterialOptions) {\r\n const key = `${color}-${opacity}`;\r\n if (this.meshStandardMaterialMap.has(key)) {\r\n return this.meshStandardMaterialMap.get(key)!\r\n }\r\n const material = new MeshStandardMaterial({\r\n color: color,\r\n roughness: 1,\r\n transparent: true,\r\n opacity: opacity,\r\n depthWrite: true,\r\n })\r\n this.meshStandardMaterialMap.set(key, material);\r\n return material;\r\n }\r\n\r\n createMeshBasicMaterial({ color, opacity }: MeshBasicMaterialOptions) {\r\n const key = `${color}-${opacity}`;\r\n if (this.meshBasicMaterialMap.has(key)) {\r\n return this.meshBasicMaterialMap.get(key)!\r\n }\r\n const material = new MeshBasicMaterial({\r\n color: color,\r\n transparent: true,\r\n opacity: opacity,\r\n depthWrite: true,\r\n })\r\n this.meshBasicMaterialMap.set(key, material);\r\n return material;\r\n }\r\n\r\n dispose() { \r\n this.lineMaterialMap.forEach((val, _) => { \r\n val.dispose()\r\n })\r\n this.lineMaterialMap.clear()\r\n this.meshStandardMaterialMap.forEach((val, _) => { \r\n val.dispose()\r\n })\r\n this.meshStandardMaterialMap.clear();\r\n this.meshBasicMaterialMap.forEach((val, _) => { \r\n val.dispose()\r\n })\r\n this.meshBasicMaterialMap.clear()\r\n }\r\n \r\n}", "import { Box3, Vector3 } from \"three\";\r\nimport { Context } from \"../context\";\r\nimport { vector3ToDevice } from \"./coordinate\";\r\n\r\nexport class CameraBound {\r\n private prevCamera = {\r\n position: new Vector3(),\r\n zoom: 1,\r\n target: new Vector3()\r\n }\r\n\r\n private enable = true;\r\n\r\n constructor(private context: Context) {\r\n this.registryEvent()\r\n this.changePrevCamera()\r\n }\r\n\r\n setEnable(enable: boolean) {\r\n this.enable = enable;\r\n if (enable) {\r\n this.registryEvent()\r\n } else {\r\n this.unRegistryEvent()\r\n }\r\n }\r\n\r\n changePrevCamera() {\r\n this.prevCamera = {\r\n position: this.context.camera.position.clone(),\r\n zoom: this.context.camera.zoom,\r\n target: this.context.control.target.clone()\r\n }\r\n }\r\n\r\n backToPrevCamera() {\r\n this.setEnable(false)\r\n this.context.camera.position.copy(this.prevCamera.position)\r\n this.context.camera.zoom = this.prevCamera.zoom;\r\n this.context.control.target.copy(this.prevCamera.target)\r\n this.context.control.update()\r\n this.setEnable(true)\r\n }\r\n\r\n registryEvent() { \r\n this.context.addEventListener(\"control-change\", this.onCameraChange)\r\n }\r\n\r\n unRegistryEvent() {\r\n this.context.removeEventListener(\"control-change\", this.onCameraChange)\r\n }\r\n\r\n getCurFloorScreenPosition() {\r\n if (!this.context.currentFloor) {\r\n return null\r\n }\r\n const box = new Box3().setFromObject(this.context.currentFloor.groundUpper);\r\n const { camera, container: { clientWidth: w, clientHeight: h } } = this.context\r\n const { min, max } = box\r\n const lb = vector3ToDevice(min, camera, w, h)\r\n const rt = vector3ToDevice(max, camera, w, h)\r\n const lt = vector3ToDevice(new Vector3(min.x, max.y, max.z), camera, w, h)\r\n const rb = vector3ToDevice(new Vector3(max.x, min.y, min.z), camera, w, h)\r\n const left = Math.min(lb.x, rt.x, lt.x, rb.x)\r\n const right = Math.max(lb.x, rt.x, lt.x, rb.x)\r\n const top = Math.min(lb.y, rt.y, lt.y, rb.y)\r\n const bottom = Math.max(lb.y, rt.y, lt.y, rb.y)\r\n return { left, right, top, bottom }\r\n }\r\n\r\n /**\r\n * \u68C0\u6D4B\u5730\u56FE\u662F\u4E0D\u662F\u5728\u663E\u793A\u8303\u56F4\r\n * @param param0 \r\n * @returns \r\n */\r\n checkDistanceToScreenEdge({ left, right, top, bottom }: { left: number, right: number, top: number, bottom: number }) { \r\n const { width, height } = this.context.clientSize\r\n const [pt, pr, pb, pl] = this.context.config.cameraBound.padding\r\n // console.log(left, left <= pl , width - right, width - right <= pr , top <= pt , height - bottom <= pb)\r\n // \u6240\u6709\u7684\u8FB9\u90FD\u4E0D\u8D85\u51FA\r\n return (left <= pl && width - right <= pr && top <= pt && height - bottom <= pb)\r\n }\r\n\r\n onCameraChange = () => {\r\n // \u5224\u65AD\u5982\u679C\u8D85\u51FA\u5C31\u7528\u4E4B\u524D\u7684prevCamera\r\n // \u83B7\u53D6\u5730\u56FE\u7684\u5C4F\u5E55\u4F4D\u7F6E\r\n // \u5148\u4E0D\u505A\u8FB9\u754C\u5224\u65AD\r\n // const bound = this.getCurFloorScreenPosition();\r\n // if (bound) {\r\n // const { left, right, top, bottom } = bound\r\n // const isInBound = this.checkDistanceToScreenEdge({ left, right, top, bottom });\r\n // console.log(\"isInBound\", isInBound)\r\n // if (isInBound) {\r\n // this.changePrevCamera()\r\n // } else {\r\n // this.backToPrevCamera()\r\n // }\r\n // }\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent()\r\n }\r\n}", "import { merge } from 'lodash'\r\nimport { HeatmapConfiguration } from '@mars3d/heatmap.js'\r\n\r\nexport interface Config {\r\n apiDomain: string,\r\n apiInfo: RequestInit,\r\n apiPath: {\r\n floorGraphic: string,\r\n floorRange: string\r\n },\r\n resizeObserver: boolean;\r\n heatMap: Partial<HeatmapConfiguration>,\r\n useFloorCache: boolean;\r\n control: {\r\n maxPolar: number;\r\n defaultPolar: number;\r\n },\r\n initTransToMark: boolean;\r\n svg: {\r\n circle: {\r\n radius: string;\r\n fill: string;\r\n },\r\n line: {\r\n stroke: string;\r\n }\r\n },\r\n selectBox: {\r\n stroke: string;\r\n fill: string;\r\n },\r\n hover: {\r\n time: number;\r\n },\r\n ground: {\r\n color: string;\r\n opacity: number;\r\n height: number;\r\n stroke: boolean,\r\n strokeColor: string,\r\n strokeOpacity: number\r\n },\r\n markGraphic: {\r\n color: string;\r\n opacity: number;\r\n height: number;\r\n stroke: boolean;\r\n strokeColor: string;\r\n strokeOpacity: number;\r\n },\r\n graphic: {\r\n fillOpacity: number,\r\n },\r\n cameraBound: {\r\n padding: [number, number, number, number]\r\n },\r\n poi: {\r\n boxScale: number;\r\n }\r\n}\r\n\r\nexport const defaultConfig: Config = {\r\n apiDomain: \"\",\r\n apiInfo: {},\r\n apiPath: {\r\n floorGraphic: \"/api/inception-map/floor/get\",\r\n floorRange: \"/api/inception-map/range/get\"\r\n },\r\n resizeObserver: false,\r\n initTransToMark: false,\r\n heatMap: {\r\n radius: 50,\r\n gradient: {\r\n 0: '#8F9FCD',\r\n 0.5: '#6284FF',\r\n 1: '#F95D5D',\r\n },\r\n },\r\n useFloorCache: true,\r\n control: {\r\n maxPolar: 1.2,\r\n defaultPolar: 0.9\r\n },\r\n svg: {\r\n circle: {\r\n radius: \"2\",\r\n fill: \"#1CADFF\"\r\n },\r\n line: {\r\n stroke: \"#1CADFF\"\r\n }\r\n },\r\n selectBox: {\r\n stroke: \"#1CADFF\",\r\n fill: \"rgba(28, 173, 255, 0.3)\"\r\n },\r\n hover: {\r\n time: 100\r\n },\r\n ground: {\r\n color: \"#FAFAFA\",\r\n opacity: 1,\r\n height: 3,\r\n stroke: true,\r\n strokeColor: \"#E6E6E6\",\r\n strokeOpacity: 1\r\n },\r\n markGraphic: {\r\n color: \"#EEF0F3\",\r\n opacity: 1,\r\n height: 0.001,\r\n stroke: false,\r\n strokeColor: \"#000\",\r\n strokeOpacity: 1\r\n },\r\n graphic: {\r\n fillOpacity: 1,\r\n },\r\n cameraBound: {\r\n padding: [150, 150, 150, 150]\r\n },\r\n poi: {\r\n boxScale: 1.0\r\n }\r\n}\r\n\r\nexport function getConfig(config: Partial<Config>): Config {\r\n return merge({}, defaultConfig, config);\r\n}"],
|
|
4
|
+
"sourcesContent": ["import { EventDispatcher, Object3D, Vector3 } from \"three\";\r\nimport { Context } from \"./context\";\r\nimport { clearTextTexture, clearCanvas, vector3ToDevice, getCenter, getLongestSideDir } from \"./utils\";\r\nimport { Config, getConfig } from './config'\r\nimport {Floor, Graphic, HeatmapDataParam, Model, ModelOptions, PoiOptionsParam} from \"./elements\";\r\nimport { SvgLine, SvgPolygon } from \"./elements\";\r\nimport { GraphicInfo, GraphicOptions, PolygonGeometry, ResGraphicInfo } from \"./types\";\r\nimport { debounce } from \"lodash\";\r\nimport { disposeLoader } from \"./utils/model\";\r\n\r\nexport interface LoadQuery {\r\n brand: string;\r\n project: string;\r\n phase: string;\r\n building: string;\r\n floor: string;\r\n ts: string;\r\n resource_type_list: string;\r\n}\r\n\r\ninterface BmapEventMap {\r\n \"zoom-change\": {\r\n basicZoom: number;\r\n cameraZoom: number;\r\n }\r\n}\r\n\r\nexport type MapType = \"2d\" | \"3d\"\r\n\r\nexport enum MapTypePolar {\r\n D2 = 0,\r\n D3 = 0.9\r\n}\r\n\r\nexport class BMap extends EventDispatcher<BmapEventMap> {\r\n config: Config;\r\n\r\n public context: Context;\r\n\r\n private polarKeys: string[] = [];\r\n\r\n private azimuthalKeys: string[] = [];\r\n\r\n private svgLine?: SvgLine;\r\n\r\n private svgPolygon?: SvgPolygon;\r\n\r\n public basicZoom = 1;\r\n\r\n private prevCameraZoom = 1;\r\n\r\n type: MapType = \"2d\"\r\n\r\n floorDataMap: Map<string, GraphicInfo[]> = new Map()\r\n\r\n buildingGroundMap = new Map<string, GraphicInfo | null>()\r\n\r\n currentBuildGround: GraphicInfo | null = null\r\n\r\n private observe: ResizeObserver | null = null;\r\n\r\n constructor(private container: HTMLElement, config: Partial<Config> = {}) {\r\n super();\r\n this.config = getConfig(config)\r\n this.context = new Context(container, this.config);\r\n this.registryEvent();\r\n this.context.render();\r\n }\r\n\r\n private async loadGraphics({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery): Promise<GraphicInfo[]> {\r\n const { apiDomain, apiPath: { floorGraphic }, apiInfo } = this.config\r\n const url = `${apiDomain}${floorGraphic}?brand=${brand}&project=${project}&phase=${phase}&building=${building}&floor=${floor}&ts=${ts}&resource_type_list=${resource_type_list}`\r\n const data = await fetch(url, apiInfo)\r\n .then((res) => res.json())\r\n .then(res => res.data)\r\n .then((res: ResGraphicInfo[]): GraphicInfo[] => {\r\n (res || []).map(item => item.info = (JSON.parse(item.info)))\r\n return (res || []) as unknown as GraphicInfo[]\r\n })\r\n return data\r\n }\r\n\r\n getBuildingKey({ brand, project, phase, building }: Omit<LoadQuery, \"floor\" | \"ts\" | \"resource_type_list\">) {\r\n const key = `${brand}-${project}-${phase}-${building}`\r\n return key\r\n }\r\n\r\n private async loadBuildingGround({ brand, project, phase, building }: Omit<LoadQuery, \"floor\" | \"ts\" | \"resource_type_list\">): Promise<GraphicInfo | null>{ \r\n const key = this.getBuildingKey({ brand, project, phase, building })\r\n if (this.buildingGroundMap.get(key)) { \r\n return this.buildingGroundMap.get(key) || null\r\n }\r\n const { apiDomain, apiPath: { floorRange }, apiInfo } = this.config\r\n const url = `${apiDomain}${floorRange}?brand=${brand}&project=${project}&phase=${phase}&building=${building}`\r\n const data = await fetch(url, apiInfo)\r\n .then((res) => res.json())\r\n .then(res => res.data)\r\n .then((res: ResGraphicInfo[]): GraphicInfo | null => {\r\n const data = (res || [])[0]\r\n if (data) {\r\n data.info = JSON.parse(data.info)\r\n }\r\n return data as unknown as GraphicInfo | null\r\n })\r\n this.buildingGroundMap.set(key, data)\r\n return data\r\n }\r\n \r\n getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery) { \r\n const floorKey = `${brand}-${project}-${phase}-${building}-${floor}-${ts}-${resource_type_list}`\r\n return floorKey\r\n }\r\n\r\n async load({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery) {\r\n const floorKey = this.getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list })\r\n if (this.floorDataMap.get(floorKey)) { return }\r\n const [data, buildGround] = await Promise.all([\r\n this.loadGraphics({ brand, project, phase, building, floor, ts, resource_type_list }),\r\n this.loadBuildingGround({ brand, project, phase, building })\r\n ])\r\n if (buildGround) {\r\n const center = getCenter((buildGround.info.geometry as PolygonGeometry).cds[0])\r\n data.forEach(item => {\r\n if (item.info.geometry.type === \"polygon\") { \r\n item.info.geometry.cds.map(cds => {\r\n if (Array.isArray(cds)) {\r\n cds.forEach(coord => {\r\n coord[0] -= center[0]\r\n coord[1] -= center[1]\r\n })\r\n }\r\n })\r\n } else {\r\n // point\r\n const [x, y] = item.info.geometry.cds\r\n item.info.geometry.cds = [x - center[0], y - center[1]]\r\n }\r\n item.info.transformToBuildingGround = true\r\n })\r\n }\r\n const { ground, markGraphic, graphic } = this.config\r\n for (let i = 0; i < data.length; i++) {\r\n const item = data[i]\r\n item.info.deltaHeight = 0.00001 * (i + 1)\r\n if (item.info.group === \"ground\") {\r\n item.info.fillColor = ground.color\r\n item.info.fillOpacity = ground.opacity\r\n item.info.height = ground.height\r\n item.info.stroke = ground.stroke\r\n item.info.strokeColor = ground.strokeColor\r\n item.info.strokeOpacity = ground.strokeOpacity\r\n } else if (item.info.userData.mark) {\r\n item.info.height = markGraphic.height;\r\n item.info.fillColor = markGraphic.color;\r\n item.info.fillOpacity = markGraphic.opacity;\r\n item.info.stroke = markGraphic.stroke;\r\n item.info.strokeColor = markGraphic.strokeColor;\r\n item.info.strokeOpacity = markGraphic.strokeOpacity;\r\n } else {\r\n item.info.fillOpacity = graphic.fillOpacity;\r\n if (this.config.initTransToMark) { \r\n item.info.height = markGraphic.height;\r\n item.info.fillColor = markGraphic.color;\r\n item.info.stroke = markGraphic.stroke;\r\n item.info.strokeColor = markGraphic.strokeColor;\r\n item.info.strokeOpacity = markGraphic.strokeOpacity;\r\n }\r\n }\r\n }\r\n if (!this.config.useFloorCache) {\r\n this.floorDataMap.clear()\r\n }\r\n this.floorDataMap.set(floorKey, data)\r\n return data\r\n }\r\n\r\n private createFloor(data: GraphicInfo[]) { \r\n const curFloor = new Floor(this.context)\r\n if (!data.length) { return { curFloor, graphics: [] } }\r\n const legacyToGraphicMap = new Map<string, Graphic>()\r\n const graphics = []\r\n for (const item of data) {\r\n if (item.info.group === \"ground\") {\r\n curFloor.createGround(item.info)\r\n } else {\r\n const graphic = curFloor.addGraphic(item.info)\r\n graphic.userData.data = item\r\n legacyToGraphicMap.set(item.legacy_id, graphic)\r\n graphics.push(graphic)\r\n }\r\n }\r\n curFloor.addShadow()\r\n curFloor.userData.legacyToGraphicMap = legacyToGraphicMap\r\n return { curFloor, graphics }\r\n }\r\n\r\n switchFloor({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery) {\r\n const floorKey = this.getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list })\r\n const curFloorData = this.floorDataMap.get(floorKey)\r\n this.context.control.removeEventListener(\"change\", this.onControlChange)\r\n if (curFloorData) {\r\n const buildingKey = this.getBuildingKey({ brand, project, phase, building })\r\n this.currentBuildGround = this.buildingGroundMap.get(buildingKey) || null\r\n const createdFloor = this.createFloor(curFloorData)\r\n if (createdFloor) {\r\n this.context.cameraBound.setEnable(false)\r\n this.context.switchFloor(createdFloor.curFloor)\r\n // \u8BBE\u7F6Ezoom\r\n this.context.control.minZoom = 0;\r\n this.context.control.maxZoom = Infinity;\r\n this.context.camera.zoom = 1;\r\n this.context.setAzimuthalAngle(0, 0);\r\n this.context.fitCameraToGround(undefined, 0);\r\n this.basicZoom = this.context.camera.zoom;\r\n // \u8BBE\u7F6Ezoom\r\n this.context.control.minZoom = this.basicZoom;\r\n this.context.control.maxZoom = this.basicZoom * 25;\r\n this.context.control.addEventListener(\"change\", this.onControlChange)\r\n if (this.type === \"3d\") {\r\n this.context.fitCameraToGround([80, 20, 80, 20], 0, false)\r\n }\r\n this.onControlChange()\r\n this.context.cameraBound.setEnable(true)\r\n } else {\r\n console.warn(\"[switchFloor error] [\"+ floor +\"] \u697C\u5C42\u6CA1\u6709\u6570\u636E\")\r\n }\r\n } else {\r\n console.warn(\"[switchFloor error] \u6CA1\u6709\u8FD9\u4E2A\u697C\u5C42\uFF0C\u8BF7\u5148\u8C03\u7528load\u65B9\u6CD5\u52A0\u8F7D\u697C\u5C42\")\r\n }\r\n }\r\n\r\n onControlChange = () => {\r\n const { camera: { zoom } } = this.context\r\n if (zoom !== this.prevCameraZoom) {\r\n this.dispatchEvent({\r\n type: \"zoom-change\",\r\n basicZoom: this.basicZoom,\r\n cameraZoom: this.context.camera.zoom\r\n })\r\n this.prevCameraZoom = zoom\r\n }\r\n }\r\n\r\n // \u6276\u68AF\r\n addModel(graphic: Graphic, options: ModelOptions) { \r\n // \u6839\u636E\u6700\u957F\u8FB9\uFF0C\u83B7\u53D6\u6276\u68AF\u7684\u65B9\u5411\r\n if (graphic.options.geometry.type === \"polygon\") {\r\n // \u6839\u636E\u65B9\u5411\u6E32\u67D3\u6A21\u578B\r\n const model = this.context.currentFloor?.addModel({\r\n ...options,\r\n position: graphic.getPosition().setZ(0.1)\r\n })\r\n if (model) {\r\n const { facilityAngle = 0, facilityXScale = 1, facilityYScale = 1 } = graphic.options.userData\r\n model.rotateZ((180 - facilityAngle) / 180 * Math.PI)\r\n model.scale.set(facilityXScale, facilityYScale, 1)\r\n }\r\n }\r\n }\r\n\r\n addHeatmap(data: HeatmapDataParam) {\r\n return this.context.currentFloor?.addHeatmap(data)\r\n }\r\n\r\n getLegacyToGraphicMap(): Map<string, Graphic> {\r\n return this.context.currentFloor?.userData.legacyToGraphicMap || new Map()\r\n }\r\n\r\n /**\r\n * \u83B7\u53D6\u5F53\u524D\u697C\u5C42\u5168\u90E8\u7684graphic\r\n * @returns \r\n */\r\n getFloorAllGraphics(): Graphic[] {\r\n return this.context.currentFloor?.graphicLayer.children.filter(item => item instanceof Graphic) as Graphic[] || []\r\n }\r\n\r\n createGraphicPoi(graphic: Graphic, options: PoiOptionsParam) { \r\n if (this.context.currentFloor) {\r\n if (options.id === undefined) {\r\n options.id = graphic.options.id\r\n }\r\n const position = graphic.getCenter()\r\n const poi = this.context.currentFloor.addPoi({\r\n ...options,\r\n position: { ...position, z: position.z + graphic.options.height / 2 }\r\n })\r\n return poi\r\n }\r\n return null\r\n }\r\n\r\n removeHeatMap() {\r\n this.context.currentFloor?.removeHeatMap()\r\n }\r\n\r\n /**\r\n * \u79FB\u52A8\u76F8\u673A\u4F4D\u7F6E\u8BA9\u9009\u4E2D\u7684\u5143\u7D20\u5C45\u4E2D\u663E\u793A\r\n * @param ele { Graphic | Poi }\r\n * @param duration\r\n */\r\n translateElementToCenter(ele: { getPosition: () => Vector3 }, duration: number = 500) {\r\n const position = ele.getPosition()\r\n return this.context.setCameraPosition(position, duration);\r\n }\r\n\r\n /**\r\n * \u79FB\u52A8\u76F8\u673A\u4F4D\u7F6E\u8BA9\u9009\u4E2D\u7684\u5143\u7D20\u5C45\u4E2D\u663E\u793A\r\n * @param ele { Graphic | Poi }\r\n * @param duration\r\n */\r\n async translateElementToCenterX(ele: { getPosition: () => Vector3 }, duration: number = 500) {\r\n const { y, z } = this.context.control.target\r\n const position = ele.getPosition()\r\n position.setY(y)\r\n position.setZ(z)\r\n await this.context.setCameraPosition(position, duration);\r\n }\r\n\r\n /**\r\n * \u83B7\u53D6\u7269\u4F53\u7684\u5C4F\u5E55\u5750\u6807\r\n */\r\n getElementDeviceCoordinate(ele: Object3D) {\r\n const vector = ele.position.clone();\r\n const { clientWidth, clientHeight } = this.container;\r\n return vector3ToDevice(\r\n vector,\r\n this.context.camera,\r\n clientWidth,\r\n clientHeight\r\n );\r\n }\r\n\r\n /**\r\n * \u5207\u63622d\u30013d\u89C6\u89D2\r\n * @param type\r\n * @param duration\r\n */\r\n changeMapType(type: MapType, duration = 500) {\r\n this.type = type;\r\n if (type === \"2d\") {\r\n return this.context.setPolarAngle(MapTypePolar.D2, duration);\r\n } else {\r\n return this.context.setPolarAngle(MapTypePolar.D3, duration);\r\n }\r\n }\r\n\r\n async resetView(duration = 300) { \r\n const time = duration / 3\r\n await this.context.setAzimuthalAngle(0, time)\r\n await this.changeMapType(this.type, time)\r\n await this.context.fitCameraToGround(undefined, time)\r\n }\r\n\r\n /**\r\n * \u7F29\u5C0F\u5730\u56FE\r\n * @param zoom\r\n * @param duration\r\n * @returns\r\n */\r\n reduceMap(zoom = 0.5, duration = 500) {\r\n const cameraZoom = this.context.camera.zoom;\r\n return this.context.setZoom(\r\n cameraZoom - zoom,\r\n this.context.control.target,\r\n duration\r\n );\r\n }\r\n\r\n /**\r\n * \u653E\u5927\u5730\u56FE\r\n * @param zoom\r\n * @param duration\r\n * @returns\r\n */\r\n enlargeMap(zoom = 0.5, duration = 500) {\r\n const cameraZoom = this.context.camera.zoom;\r\n return this.context.setZoom(\r\n cameraZoom + zoom,\r\n this.context.control.target,\r\n duration\r\n );\r\n }\r\n\r\n onKeydown = (e: KeyboardEvent) => {\r\n if (this.polarKeys.includes(e.code)) {\r\n this.context.control.maxPolarAngle = this.config.control.maxPolar;\r\n this.context.control.minPolarAngle = 0;\r\n }\r\n if (this.azimuthalKeys.includes(e.code)) {\r\n this.context.control.maxAzimuthAngle = Infinity;\r\n this.context.control.minAzimuthAngle = Infinity;\r\n }\r\n };\r\n\r\n onKeyUp = (e: KeyboardEvent) => {\r\n if (this.polarKeys.includes(e.code)) {\r\n const polar = this.context.control.getPolarAngle();\r\n this.context.control.maxPolarAngle = polar;\r\n this.context.control.minPolarAngle = polar;\r\n }\r\n if (this.azimuthalKeys.includes(e.code)) {\r\n const azimuthal = this.context.control.getAzimuthalAngle();\r\n this.context.control.maxAzimuthAngle = azimuthal;\r\n this.context.control.minAzimuthAngle = azimuthal;\r\n }\r\n };\r\n\r\n registryEvent() {\r\n window.addEventListener(\"keydown\", this.onKeydown);\r\n window.addEventListener(\"keyup\", this.onKeyUp);\r\n if (this.config.resizeObserver) {\r\n const observe = new ResizeObserver(debounce(this.resize, 5))\r\n observe.observe(this.container)\r\n this.observe = observe\r\n }\r\n }\r\n\r\n unRegistryEvent() {\r\n window.removeEventListener(\"keydown\", this.onKeydown);\r\n window.removeEventListener(\"keyup\", this.onKeyUp);\r\n this.observe?.disconnect()\r\n this.observe = null;\r\n }\r\n\r\n /**\r\n * \u914D\u7F6E\u5750\u6807\u5B9A\u70B9 2D/3D\u7EBF\u6027\u5207\u6362\u7684\u5FEB\u6377\u952E\r\n * @param key\r\n */\r\n configurePolarShortcutKeys(keys: string[]) {\r\n this.polarKeys = keys;\r\n }\r\n\r\n configureAzimuthalShortcutKeys(keys: string[]) {\r\n this.azimuthalKeys = keys;\r\n }\r\n\r\n rotateMap(radius = 0.1) {\r\n const azimuthal = this.context.control.getAzimuthalAngle();\r\n this.context.control.maxAzimuthAngle = azimuthal + radius;\r\n this.context.control.minAzimuthAngle = azimuthal + radius;\r\n this.context.control.update()\r\n }\r\n\r\n /**\r\n * \u6D4B\u91CF\u8DDD\u79BB\r\n * @returns \r\n */\r\n async measureDistance() { \r\n this.cancelDistance()\r\n return new Promise((resolve, reject) => { \r\n this.changeMapType('2d', 0)\r\n this.context.control.enableRotate = false; // \u6D4B\u91CF\u53EA\u80FD\u57282d\u4E2D\u8FDB\u884C\r\n this.svgLine = new SvgLine(this.context)\r\n const dispose = this.svgLine.dispose.bind(this.svgLine)\r\n this.svgLine.dispose = function () {\r\n dispose();\r\n reject(\"cancel\")\r\n }\r\n this.svgLine.addEventListener(\"distance\", ({ distance }) => {\r\n resolve(distance)\r\n })\r\n }) \r\n }\r\n\r\n /**\r\n * \u53D6\u6D88\u6D4B\u91CF\u957F\u5EA6\r\n */\r\n cancelDistance() {\r\n if (this.svgLine) {\r\n this.svgLine.dispose()\r\n this.svgLine = undefined;\r\n this.context.control.enableRotate = true;\r\n }\r\n }\r\n\r\n /**\r\n * \u6D4B\u91CF\u9762\u79EF\r\n */\r\n measureArea() { \r\n this.cancelArea()\r\n return new Promise((resolve, reject) => {\r\n this.changeMapType('2d', 0)\r\n this.context.control.enableRotate = false; // \u6D4B\u91CF\u53EA\u80FD\u57282d\u4E2D\u8FDB\u884C\r\n this.svgPolygon = new SvgPolygon(this.context)\r\n const dispose = this.svgPolygon.dispose.bind(this.svgPolygon)\r\n this.svgPolygon.dispose = function () {\r\n dispose();\r\n reject(\"cancel\")\r\n }\r\n this.svgPolygon.addEventListener(\"area\", ({ area }) => {\r\n resolve(area)\r\n })\r\n })\r\n }\r\n\r\n /**\r\n * \u53D6\u6D88\u6D4B\u91CF\u9762\u79EF\r\n */\r\n cancelArea() {\r\n if (this.svgPolygon) {\r\n this.svgPolygon.dispose()\r\n this.svgPolygon = undefined\r\n this.context.control.enableRotate = true;\r\n }\r\n }\r\n\r\n /**\r\n * \u6839\u636EnodeId \u83B7\u53D6graphic\r\n */\r\n getGraphicByNodeId(nodeId: string) {\r\n return this.context.currentFloor?.graphicLayer.getGraphicByNodeId(nodeId) || null\r\n }\r\n\r\n deleteGraphic(graphic: Graphic) {\r\n this.context.currentFloor?.graphicLayer.removeGraphic(graphic)\r\n }\r\n\r\n createGraphicByOptions(options: GraphicOptions) {\r\n if (!options.transformToBuildingGround) {\r\n if (this.currentBuildGround) {\r\n const center = getCenter((this.currentBuildGround.info.geometry as PolygonGeometry).cds[0])\r\n if (options.geometry.type === \"polygon\") {\r\n options.geometry.cds.map(cds => {\r\n if (Array.isArray(cds)) {\r\n cds.forEach(coord => {\r\n coord[0] -= center[0]\r\n coord[1] -= center[1]\r\n })\r\n }\r\n })\r\n } else {\r\n // point\r\n const [x, y] = options.geometry.cds\r\n options.geometry.cds = [x - center[0], y - center[1]]\r\n }\r\n }\r\n }\r\n return this.context.currentFloor?.graphicLayer.createGraphic(options)\r\n }\r\n\r\n removePoiById(id: string) { \r\n return this.context.currentFloor?.poiLayer.removePoiById(id)\r\n }\r\n\r\n getPoiById(id: string) { \r\n return this.context.currentFloor?.poiLayer.getPoiById(id)\r\n }\r\n\r\n getPois() { \r\n return (this.context.currentFloor?.poiLayer.pois || []).filter(item => !item.options.built_in)\r\n }\r\n\r\n clearPoi() {\r\n if (this.context.currentFloor) { \r\n this.context.currentFloor.poiLayer.clear()\r\n }\r\n }\r\n\r\n removeSelectGraphic(graphic: Graphic) { \r\n this.context.selection.remove(graphic)\r\n }\r\n\r\n resize = () => { \r\n this.context.cameraBound.setEnable(false)\r\n this.context.onWindowResize();\r\n const azimuthal = this.context.control.getAzimuthalAngle();\r\n const zoom = this.context.camera.zoom;\r\n // \u8BBE\u7F6Ezoom\r\n this.context.control.minZoom = 0;\r\n this.context.control.maxZoom = Infinity;\r\n this.context.camera.zoom = 1;\r\n this.context.setAzimuthalAngle(0, 0);\r\n const basicZoom = this.context.getFitCameraToGroundZoom(undefined, 0);\r\n this.basicZoom = basicZoom || 0;\r\n // \u8BBE\u7F6Ezoom\r\n this.context.control.minZoom = this.basicZoom;\r\n this.context.control.maxZoom = this.basicZoom * 25;\r\n this.context.camera.zoom = zoom;\r\n this.context.control.addEventListener(\"change\", this.onControlChange)\r\n this.context.setAzimuthalAngle(azimuthal, 0);\r\n this.context.cameraBound.setEnable(true)\r\n }\r\n\r\n dispose() {\r\n this.context.dispose();\r\n this.floorDataMap.clear();\r\n this.buildingGroundMap.clear();\r\n clearTextTexture();\r\n clearCanvas();\r\n disposeLoader();\r\n this.unRegistryEvent();\r\n }\r\n}\r\n", "type Fn = (...arg: any) => any\r\n\r\n/**\r\n * \u4EFB\u52A1\u7BA1\u7406\u5668\r\n * \u5728\u7C7B\u9500\u6BC1\u7684\u65F6\u5019\uFF0C\u8981\u6E05\u9664\u6240\u6709\u7684\u5F02\u6B65\u5B9A\u65F6\u5668\r\n */\r\nexport class Timer { \r\n tasks = {\r\n requestAnimation: new Set<number>(),\r\n timeout: new Set<number>(),\r\n interval: new Set<number>()\r\n }\r\n\r\n requestAnimationFrame(fn: Fn): number { \r\n const timer = window.requestAnimationFrame(() => {\r\n this.tasks.requestAnimation.delete(timer)\r\n fn()\r\n })\r\n this.tasks.requestAnimation.add(timer)\r\n return timer\r\n }\r\n\r\n cancelAnimationFrame(timer: number) { \r\n this.tasks.requestAnimation.delete(timer)\r\n window.cancelAnimationFrame(timer)\r\n }\r\n\r\n setTimeout(fn: Fn, wait: number): number { \r\n const timer = window.setTimeout(() => {\r\n this.tasks.timeout.delete(timer)\r\n fn()\r\n }, wait)\r\n this.tasks.timeout.add(timer)\r\n return timer\r\n }\r\n\r\n clearTimeout(timer: number) {\r\n this.tasks.timeout.delete(timer)\r\n window.clearTimeout(timer)\r\n }\r\n\r\n setInterval(fn: Fn, wait: number): number { \r\n const timer = window.setInterval(() => {\r\n this.tasks.interval.delete(timer)\r\n fn()\r\n }, wait)\r\n this.tasks.interval.add(timer)\r\n return timer\r\n }\r\n\r\n clearInterval(timer: number) {\r\n this.tasks.interval.delete(timer)\r\n window.clearInterval(timer)\r\n }\r\n\r\n dispose() { \r\n this.tasks.requestAnimation.forEach(timer => {\r\n window.cancelAnimationFrame(timer)\r\n })\r\n this.tasks.requestAnimation.clear()\r\n this.tasks.timeout.forEach(timer => {\r\n window.clearTimeout(timer)\r\n })\r\n this.tasks.timeout.clear()\r\n this.tasks.interval.forEach(timer => {\r\n window.clearInterval(timer)\r\n }) \r\n this.tasks.interval.clear()\r\n }\r\n}", "import { Coordinate } from 'src/types'\r\nimport {\r\n Scene, WebGLRenderer, OrthographicCamera, HemisphereLight, Shape, \r\n PCFSoftShadowMap, Group, Color, DirectionalLight, AmbientLight, Path, Vector2\r\n} from 'three'\r\nimport { MapControls } from 'three/examples/jsm/controls/MapControls'\r\n\r\nexport function initScene() {\r\n const scene = new Scene()\r\n scene.background = new Color(0xffffff)\r\n return scene\r\n}\r\n\r\nexport function initRenderer() {\r\n const renderer = new WebGLRenderer({\r\n antialias: true,\r\n // logarithmicDepthBuffer: true,\r\n // alpha: false,\r\n // premultipliedAlpha: false\r\n })\r\n renderer.autoClear = true\r\n renderer.setClearAlpha(1);\r\n renderer.setClearColor(0xffffff);\r\n renderer.setPixelRatio(window.devicePixelRatio);\r\n renderer.shadowMap.enabled = true;\r\n renderer.shadowMap.autoUpdate = true;\r\n renderer.shadowMap.type = PCFSoftShadowMap;\r\n return renderer\r\n}\r\n\r\nexport function initCamera(width: number, height: number): OrthographicCamera {\r\n const camera = new OrthographicCamera(-width / 2, width / 2, height / 2, -height / 2, -1000, 5000)\r\n camera.up.set(0, 0, 1);\r\n camera.position.set(0, 0, 100);\r\n camera.lookAt(0, 0, 0);\r\n return camera\r\n}\r\n\r\nexport function initLight() {\r\n const lights = new Group()\r\n // \u534A\u7403\u5149\r\n // const hemisphereLight = new HemisphereLight(0xffffff, 0xffffff, 1);\r\n // hemisphereLight.intensity = 1;\r\n // hemisphereLight.position.set(0, 0, 10);\r\n // hemisphereLight.up.set(0, 0, 1);\r\n // lights.add(hemisphereLight)\r\n const ambientLight = new AmbientLight(0xffffff, 2.6);\r\n lights.add(ambientLight)\r\n return lights\r\n}\r\n\r\nexport function initControl(camera: OrthographicCamera, domElement: HTMLCanvasElement) {\r\n const control = new MapControls(camera, domElement)\r\n // \u7981\u7528\u963B\u5C3C\r\n control.enableDamping = false\r\n // \u8BBE\u7F6E2.5D\r\n // control.maxPolarAngle = 0\r\n // control.minPolarAngle = 0\r\n // \u7981\u7528\u6C34\u5E73\u65CB\u8F6C\r\n // control.maxAzimuthAngle = 0\r\n // control.minAzimuthAngle = 0\r\n control.zoomSpeed = 2\r\n return control\r\n}\r\n\r\nexport function initShape(path: Coordinate[], holePath: Coordinate[][] = []) { \r\n const shape = new Shape(path.map(item => new Vector2(...item)));\r\n if (holePath.length) {\r\n holePath.forEach(cur => {\r\n var hole = new Path(cur.map(item => new Vector2(...item)));\r\n shape.holes.push(hole);\r\n })\r\n }\r\n return shape\r\n}\r\n\r\nexport function initDirectionalLight(color = 0xffffff, intensity = 1) {\r\n const directionalLight = new DirectionalLight(color, intensity);\r\n directionalLight.castShadow = true;\r\n directionalLight.shadow.radius = 8;\r\n directionalLight.shadow.bias = -0.001;\r\n directionalLight.shadow.mapSize.set(256, 256);\r\n directionalLight.shadow.camera.left = -200;\r\n directionalLight.shadow.camera.right = 200;\r\n directionalLight.shadow.camera.top = 200;\r\n directionalLight.shadow.camera.bottom = -200;\r\n return directionalLight\r\n}", "import { Object3D, Mesh, Light } from 'three'\r\n\r\nexport function dispose(o: Object3D, recursive?: boolean): void {\r\n if (recursive && o.children && o.children.length) {\r\n o.children.forEach((child) => {\r\n dispose(child, recursive);\r\n });\r\n }\r\n if ((o as Mesh).isMesh) {\r\n const m = o as Mesh;\r\n if (m.geometry) m.geometry.dispose();\r\n if (m.material) {\r\n if (Array.isArray(m.material)) {\r\n m.material.forEach((mat) => {\r\n mat.dispose();\r\n });\r\n } else {\r\n m.material.dispose();\r\n }\r\n }\r\n }\r\n if ((o as Light).isLight) {\r\n (o as Light).dispose?.()\r\n }\r\n}", "export function hasChinese(str:string) {\r\n return /[\\u4E00-\\u9FA5]+/g.test(str);\r\n}", "import { hasChinese } from './rules'\r\nimport { DataTexture, RGBAFormat, LinearFilter } from 'three'\r\n\r\nconst urlTextureMap = new Map()\r\nconst textTextureMap = new Map<string, DataTexture>()\r\n\r\nexport function initCanvas() {\r\n const canvas = document.createElement('canvas');\r\n canvas.width = 1024;\r\n canvas.height = 64;\r\n const ctx = canvas.getContext('2d', {\r\n willReadFrequently: true,\r\n }) as CanvasRenderingContext2D;\r\n ctx.font = '54px sans-serif';\r\n ctx.textBaseline = 'hanging';\r\n ctx.lineWidth = 12;\r\n ctx.fillStyle = 'rgba(0,0,0,1)';\r\n ctx.strokeStyle = 'white';\r\n return { canvas, ctx }\r\n}\r\n\r\nlet canvas: HTMLCanvasElement;\r\nlet ctx: CanvasRenderingContext2D;\r\n\r\nexport function createCanvas() {\r\n if (!canvas) {\r\n const { canvas: c, ctx: t } = initCanvas()\r\n canvas = c;\r\n ctx = t;\r\n }\r\n}\r\n\r\nexport function getTextureByText(text: string): DataTexture {\r\n if (textTextureMap.has(text)) {\r\n return textTextureMap.get(text)!\r\n }\r\n createCanvas()\r\n\r\n ctx.clearRect(0, 0, 1024, 64);\r\n const y = hasChinese(text) ? 4 : 8;\r\n ctx.strokeText(text, 2, y);\r\n ctx.fillText(text, 2, y);\r\n\r\n let width = Math.ceil(ctx.measureText(text).width);\r\n width = width % 2 === 0 ? width : width + 1;\r\n width += 2;\r\n const imageData = ctx.getImageData(0, 0, width, 64);\r\n const texture = new DataTexture(\r\n Uint8Array.from(imageData.data),\r\n width,\r\n 64,\r\n RGBAFormat,\r\n );\r\n texture.flipY = true;\r\n texture.minFilter = LinearFilter;\r\n texture.magFilter = LinearFilter;\r\n\r\n textTextureMap.set(text, texture);\r\n return texture;\r\n}\r\n\r\nexport function clearTextTexture() {\r\n textTextureMap.clear()\r\n}\r\n\r\nexport function clearCanvas() {\r\n ctx = null as unknown as CanvasRenderingContext2D;\r\n canvas = null as unknown as HTMLCanvasElement;\r\n}", "import { Coordinate } from 'src/types';\r\nimport { Vector3, Camera } from 'three';\r\nimport { point, featureCollection, center } from '@turf/turf'\r\n\r\n/**\r\n * 3D\u5750\u6807\u8F6C\u5C4F\u5E55\u5750\u6807\r\n * @param vector \r\n * @param camera \r\n * @param w container\u7684\u5BBD\r\n * @param h container\u7684\u9AD8\r\n * @returns \r\n */\r\nexport function vector3ToDevice(vector: Vector3, camera: Camera, w: number, h: number) {\r\n const _vector = vector.clone().project(camera);//\u901A\u8FC7\u4E16\u754C\u5750\u6807\u83B7\u53D6\u8F6C\u6807\u51C6\u8BBE\u5907\u5750\u6807\r\n const _w = w / 2;\r\n const _h = h / 2;\r\n const x = Math.round(_vector.x * _w + _w);//\u6807\u51C6\u8BBE\u5907\u5750\u6807\u8F6C\u5C4F\u5E55\u5750\u6807\r\n const y = Math.round(-_vector.y * _h + _h);\r\n return { x, y }\r\n}\r\n\r\n\r\n/**\r\n * \u83B7\u53D6\u591A\u53D8\u5F62\u7684\u4E2D\u5FC3\u70B9\r\n * @param coordinates \r\n */\r\nexport function getCenter(coordinates: Coordinate[]) {\r\n const features = featureCollection(coordinates.map(item => point(item)))\r\n const cent = center(features)\r\n return cent.geometry.coordinates\r\n}\r\n\r\ntype Position = {\r\n x: number,\r\n y: number\r\n}\r\nexport function isContain(point: Position, start: Position, end: Position) {\r\n // \u5224\u65AD point\u662F\u5426\u5728 start \u548Cend\u5F62\u6210\u7684\u77E9\u5F62\u4E2D\r\n return point.x >= start.x &&\r\n point.x <= end.x &&\r\n point.y >= start.y &&\r\n point.y <= end.y \r\n}\r\n\r\n/**\r\n * \u83B7\u53D6\u6700\u957F\u8FB9\u7684\u65B9\u5411\r\n * @param cds \r\n */\r\nexport function getLongestSideDir(cds: Coordinate[]) { \r\n let maxDistance = 0;\r\n let dir = new Vector3();\r\n for (let i = 1; i < cds.length; i++) { \r\n const point_0 = new Vector3(cds[i - 1][0], cds[i - 1][1], 0);\r\n const point_1 = new Vector3(cds[i][0], cds[i][1], 0);\r\n const distance = point_1.distanceTo(point_0)\r\n if (distance > maxDistance) {\r\n maxDistance = distance;\r\n dir = point_1.clone().sub(point_0).normalize();\r\n }\r\n }\r\n return dir;\r\n}", "import { EventDispatcher } from 'three'\r\n\r\nexport function proxyOptions\r\n <T extends Record<string, any>, M extends { [K in keyof T as `change-${Extract<K, string>}`]: { value: T[K] } }>\r\n (target: T, master: EventDispatcher<M>): T\r\n{ \r\n return new Proxy<T>(target, {\r\n get: (target, p, receiver) => {\r\n return Reflect.get(target, p, receiver)\r\n },\r\n set: (target, p, newValue, receiver) => {\r\n const oldValue = Reflect.get(target, p, receiver)\r\n const res = Reflect.set(target, p, newValue, receiver)\r\n if (oldValue !== newValue) {\r\n master.dispatchEvent({ type: `change-${p as Extract<keyof T, string>}`, value: newValue } as any)\r\n }\r\n return res\r\n }\r\n })\r\n}", "/**\r\n * \u53EF\u4EE5\u8BBE\u7F6E\u8D85\u65F6\u65F6\u95F4\u7684promise\r\n * @param promise \r\n * @param timeout \r\n * @returns \r\n */\r\nexport function timeoutPromise<T>(promise: Promise<T>, timeout: number): Promise<T> {\r\n return Promise.race([\r\n promise,\r\n new Promise<T>((resolve, reject) => {\r\n setTimeout(() => reject(new Error(\"Promise timeout\")), timeout);\r\n })\r\n ]);\r\n}", "export function createSvgElement(tag: string) {\r\n return document.createElementNS('http://www.w3.org/2000/svg', tag); \r\n}\r\n\r\n/**\r\n * \u521B\u5EFAsvg\r\n */\r\nexport function createSvg(w: string, h: string) {\r\n const svg = createSvgElement(\"svg\");\r\n svg.setAttribute(\"width\", w)\r\n svg.setAttribute(\"height\", h)\r\n svg.style.cssText = \"position: absolute; left: 0; top: 0; pointer-events: none;\"\r\n return svg;\r\n}\r\n\r\n/**\r\n * \u521B\u5EFA\u5706\u70B9\r\n * @param radius \r\n */\r\nexport function createCircle(radius = \"2\", fill: string) {\r\n const circle = createSvgElement(\"circle\");\r\n circle.setAttribute(\"r\", radius)\r\n circle.setAttribute(\"fill\", fill)\r\n return circle\r\n}\r\n\r\n/**\r\n * \u521B\u5EFA\u7EBF\r\n * @param stroke \r\n */\r\nexport function createLine(stroke: string) {\r\n const line = createSvgElement(\"line\")\r\n line.setAttribute(\"stroke\", stroke)\r\n return line\r\n}\r\n\r\n/**\r\n * \u521B\u5EFA\u77E9\u5F62\r\n * @param stroke \r\n * @returns \r\n */\r\nexport function createRect(stroke: string, fill: string) {\r\n const rect = createSvgElement(\"rect\")\r\n rect.setAttribute(\"stroke\", stroke)\r\n rect.setAttribute(\"fill\", fill)\r\n return rect\r\n}\r\n\r\nexport function setCirclePosition(circle: SVGElement, x: number, y: number) {\r\n circle.setAttribute('cx', `${x}`)\r\n circle.setAttribute('cy', `${y}`)\r\n}\r\n\r\ntype Position = { x: number; y: number }\r\n\r\nexport function setLineStartEnd(line: SVGElement, start?: Position, end?: Position) {\r\n if (start) { \r\n line.setAttribute(\"x1\", `${start.x}`)\r\n line.setAttribute(\"y1\", `${start.y}`)\r\n }\r\n if (end) {\r\n line.setAttribute(\"x2\", `${end.x}`)\r\n line.setAttribute(\"y2\", `${end.y}`)\r\n }\r\n}\r\n\r\nexport function setRectPosition(rect: SVGElement, x: number, y: number, w: number, h: number) {\r\n rect.setAttribute('x', `${x}`)\r\n rect.setAttribute('y', `${y}`)\r\n rect.setAttribute('width', `${w}`)\r\n rect.setAttribute('height', `${h}`)\r\n}", "export function sleepOnePromise() {\r\n return Promise.resolve()\r\n}\r\n\r\nexport function sleepOneRf() { \r\n return new Promise(resolve => {\r\n requestAnimationFrame(resolve)\r\n })\r\n}", "export function strToNumber(str: string) {\r\n return parseInt(str.replace(\"#\", \"0x\"), 16);\r\n}\r\n\r\n/**\r\n * \u7ED9\u989C\u8272\u52A0\u4E0A\u900F\u660E\u5EA6\r\n * @param hexColor\r\n * @param alpha\r\n * @returns\r\n */\r\nexport function addAlphaToHexColor(hexColor: string, alpha: number) {\r\n // \u5C0616\u8FDB\u5236\u989C\u8272\u503C\u8F6C\u6362\u4E3ARGB\u6570\u503C\r\n let r = parseInt(hexColor.substring(1, 3), 16);\r\n let g = parseInt(hexColor.substring(3, 5), 16);\r\n let b = parseInt(hexColor.substring(5, 7), 16);\r\n\r\n // \u8BA1\u7B97\u65B0\u7684RGB\u6570\u503C\r\n let newR = Math.round(r * alpha);\r\n let newG = Math.round(g * alpha);\r\n let newB = Math.round(b * alpha);\r\n\r\n // \u5C06\u65B0\u7684RGB\u6570\u503C\u8F6C\u6362\u4E3A16\u8FDB\u5236\u683C\u5F0F\r\n let newHexColor = `#${(1 << 24 | newR << 16 | newG << 8 | newB).toString(16).slice(1)}`;\r\n\r\n return newHexColor;\r\n}\r\n\r\nexport function darkenColor(hexColor: string) {\r\n // \u5C06\u5341\u516D\u8FDB\u5236\u989C\u8272\u8F6C\u6362\u4E3ARGB\r\n let r = parseInt(hexColor.substring(1, 3), 16);\r\n let g = parseInt(hexColor.substring(3, 5), 16);\r\n let b = parseInt(hexColor.substring(5, 7), 16);\r\n\r\n const factor = 0.8\r\n // \u8BA1\u7B97\u6697\u70B9\u989C\u8272\r\n r = Math.floor(r * factor);\r\n g = Math.floor(g * factor);\r\n b = Math.floor(b * factor);\r\n\r\n // \u5C06RGB\u989C\u8272\u8F6C\u6362\u56DE\u5341\u516D\u8FDB\u5236\r\n let darkHexColor = \"#\" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);\r\n\r\n return darkHexColor;\r\n}\r\n", "import { Object3D, Scene, Mesh, MeshBasicMaterial } from 'three'\r\nimport { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'\r\n\r\nfunction createLoader() { \r\n const loader = new GLTFLoader()\r\n return loader\r\n}\r\n\r\nlet loader: GLTFLoader | null = null\r\nlet modelMap = new Map<string, Promise<GLTF>>()\r\n\r\n/**\r\n * \u52A0\u8F7D\u6A21\u578B\r\n * @param url \r\n * @returns \r\n */\r\nexport function loadModel(url: string): Promise<GLTF> { \r\n if (modelMap.has(url)) {\r\n const gltf = modelMap.get(url)!.then(gltf => { \r\n gltf.scene = gltf.scene.clone()\r\n return gltf\r\n })\r\n }\r\n if (!loader) {\r\n loader = createLoader()\r\n }\r\n const p = new Promise<GLTF>((resolve, reject) => { \r\n loader!.load(url, gltf => {\r\n resolve(gltf)\r\n }, undefined, reject)\r\n })\r\n modelMap.set(url, p)\r\n return p.then(gltf => { \r\n gltf.scene = gltf.scene.clone()\r\n return gltf\r\n })\r\n}\r\n\r\nexport function disposeLoader() { \r\n loader = null\r\n modelMap.clear()\r\n}", "export const isMac = navigator.userAgent.toUpperCase().indexOf('MAC') >= 0;\r\n", "import { isMac } from \"./os\";\r\n\r\nexport function isControl(key: string) { \r\n if (isMac) {\r\n return key === \"Meta\"\r\n }\r\n return key === \"Control\"\r\n}", "import { MapControls } from \"three/examples/jsm/controls/MapControls\";\r\nimport {\r\n Timer,\r\n initCamera,\r\n initRenderer,\r\n initScene,\r\n initLight,\r\n initControl,\r\n dispose,\r\n vector3ToDevice,\r\n timeoutPromise,\r\n} from \"./utils\";\r\nimport {\r\n EventDispatcher,\r\n OrthographicCamera,\r\n Light,\r\n Box2,\r\n Vector3,\r\n Vector2,\r\n Raycaster,\r\n Object3D,\r\n Box3,\r\n Color,\r\n AmbientLight,\r\n} from \"three\";\r\nimport { Graphic, Poi, Floor } from \"./elements\";\r\nimport { Group as TweenGroup, Tween } from \"@tweenjs/tween.js\";\r\nimport { Config } from \"./config\";\r\nimport { Selection } from \"./operations/selection/selection\";\r\nimport { HoverHelper } from \"./operations\";\r\nimport { MaterialFactory } from \"./factory\";\r\nimport { CameraBound } from \"./utils/camera-bound\";\r\n\r\nexport interface ContextEventMap {\r\n update: {};\r\n \"graphic-click\": {\r\n graphics: Graphic[];\r\n position: Vector3 | null\r\n };\r\n \"poi-click\": {\r\n pois: Poi[];\r\n };\r\n 'pointer-level': {};\r\n 'pointer-over': {\r\n e: PointerEvent;\r\n graphics: Graphic[];\r\n pois: Poi[];\r\n position: Vector3 | null;\r\n };\r\n 'pointer-move': {\r\n e: PointerEvent;\r\n graphics: Graphic[];\r\n pois: Poi[];\r\n position: Vector3 | null;\r\n },\r\n 'change-ratio': {\r\n px: number;\r\n },\r\n \"select-graphic\": {\r\n graphics: Graphic[],\r\n isMultipleSelect: boolean,\r\n },\r\n \"hover\": {\r\n graphics: Graphic[];\r\n },\r\n \"control-change\": {},\r\n \"resize\": {\r\n width: number;\r\n height: number;\r\n }\r\n}\r\n\r\nexport class Context extends EventDispatcher<ContextEventMap> {\r\n scene = initScene();\r\n\r\n renderer = initRenderer();\r\n\r\n camera!: OrthographicCamera;\r\n\r\n control!: MapControls;\r\n\r\n lights = initLight();\r\n\r\n // \u7BA1\u7406\u4EFB\u52A1\uFF0C\u9632\u6B62\u5185\u5B58\u6CC4\u6F0F\r\n timer = new Timer();\r\n \r\n tweenGroup = new TweenGroup();\r\n \r\n currentFloor?: Floor;\r\n\r\n selection: Selection;\r\n\r\n hoverHelper: HoverHelper;\r\n \r\n private basicRatio?: number; // zoom=1\u7684\u65F6\u5019\uFF0C100M\u5BF9\u5E94\u7684\u50CF\u7D20\u4E2A\u6570\r\n\r\n public materialFactory!: MaterialFactory;\r\n\r\n cameraBound!: CameraBound;\r\n\r\n clientSize = {\r\n width: 0,\r\n height: 0,\r\n x: 0,\r\n y: 0\r\n }\r\n\r\n constructor(public container: HTMLElement, public config: Config) {\r\n super();\r\n this.container.style.position = \"relative\";\r\n this.container.style.overflow = \"hidden\";\r\n this.init();\r\n this.selection = new Selection(this);\r\n this.hoverHelper = new HoverHelper(this);\r\n this.materialFactory = new MaterialFactory(this);\r\n this.resizeClientSize()\r\n this.registryEvent();\r\n }\r\n\r\n resizeClientSize() { \r\n const { x, y, width, height } = this.container.getBoundingClientRect()\r\n this.clientSize = {\r\n width: width || this.container.clientWidth,\r\n height: height || this.container.clientHeight,\r\n x,\r\n y\r\n }\r\n }\r\n\r\n init() {\r\n const { clientWidth: w, clientHeight: h } = this.container;\r\n this.camera = initCamera(w, h);\r\n this.renderer.setSize(w, h);\r\n this.control = initControl(this.camera, this.renderer.domElement);\r\n this.control.maxPolarAngle = this.config.control.maxPolar;\r\n this.container.appendChild(this.renderer.domElement);\r\n this.scene.add(this.lights);\r\n this.basicRatio = this.getRatio()\r\n // \u65CB\u8F6C\u89C6\u89D2\u7684\u65F6\u5019\uFF0C\u9690\u85CF\u548C\u663E\u793A\u9634\u5F71\r\n this.control.addEventListener(\"change\", () => {\r\n const polarAngle = this.control.getPolarAngle();\r\n this.currentFloor?.setShadowOpacity(polarAngle / this.config.control.maxPolar)\r\n this.dispatchEvent({ type: 'change-ratio', px: (this.basicRatio || 0) * this.camera.zoom })\r\n this.dispatchEvent({ type: 'control-change' })\r\n });\r\n this.cameraBound = new CameraBound(this);\r\n }\r\n\r\n /**\r\n * \u83B7\u53D6\u4E24\u4E2A\u70B9\u4E4B\u95F4\u7684\u50CF\u7D20\u6570\r\n */\r\n getRatio(point1 = new Vector3(0, 0, 0), point2 = new Vector3(100, 0, 0)) {\r\n const { clientWidth, clientHeight } = this.container\r\n const device1 = vector3ToDevice(point1, this.camera, clientWidth, clientHeight)\r\n const device2 = vector3ToDevice(point2, this.camera, clientWidth, clientHeight)\r\n return Math.ceil(Math.sqrt((device2.x - device1.x) ** 2 + (device2.y - device1.y) ** 2))\r\n }\r\n\r\n changeAmbientLightColor(color: string | number) {\r\n this.lights.children.forEach((item) => {\r\n if (item instanceof AmbientLight) {\r\n item.color = new Color(color);\r\n }\r\n });\r\n }\r\n\r\n switchFloor(floor: Floor) {\r\n if (this.currentFloor) {\r\n this.scene.remove(this.currentFloor)\r\n this.currentFloor.dispose()\r\n }\r\n this.currentFloor = floor\r\n this.scene.add(floor)\r\n // \u4FEE\u6539\u706F\u5149\u7684\u4F4D\u7F6E\r\n const position = floor.getCenter()\r\n if (position) {\r\n this.lights.position.x = position.x\r\n this.lights.position.y = position.y\r\n }\r\n }\r\n\r\n onWindowResize = () => {\r\n const { container, camera, renderer } = this;\r\n let { clientWidth: w, clientHeight: h } = container;\r\n w = Math.max(1, w);\r\n h = Math.max(1, h);\r\n camera.left = -w / 2;\r\n camera.right = w / 2;\r\n camera.top = h / 2;\r\n camera.bottom = -h / 2;\r\n camera.updateProjectionMatrix();\r\n renderer.setSize(w, h);\r\n this.resizeClientSize()\r\n this.dispatchEvent({ type:'resize', width: w, height: h })\r\n };\r\n\r\n onClick = (e: MouseEvent) => {\r\n const { graphics, position } = this.getGraphicsByDeviceXy(e.offsetX, e.offsetY);\r\n if (graphics.length) {\r\n this.dispatchEvent({\r\n type: \"graphic-click\",\r\n graphics: graphics,\r\n position\r\n });\r\n }\r\n const pois = this.getPoisByDeviceXy(e.offsetX, e.offsetY);\r\n if (pois.length) {\r\n this.dispatchEvent({ type: \"poi-click\", pois: pois as Poi[] });\r\n }\r\n };\r\n\r\n /**\r\n * \u83B7\u53D6\u5C4F\u5E55\u5750\u6807\u5BF9\u5E94\u7684graphic\r\n * @param x\r\n * @param y\r\n * @returns\r\n */\r\n getGraphicsByDeviceXy(x: number, y: number): { graphics: Graphic[], position: Vector3 | null } {\r\n const point = new Vector2();\r\n point.x = (x / this.clientSize.width) * 2 - 1;\r\n point.y = (y / this.clientSize.height) * -2 + 1;\r\n const raycaster = new Raycaster();\r\n raycaster.setFromCamera(point, this.camera);\r\n const res = this.currentFloor?.graphicLayer.getGraphicByRaycaster(raycaster)\r\n return res || { graphics: [], position: null }\r\n }\r\n\r\n /**\r\n * \u83B7\u53D6\u5C4F\u5E55\u5750\u6807\u5BF9\u5E94\u7684poi\r\n * @param x\r\n * @param y\r\n * @returns\r\n */\r\n getPoisByDeviceXy(x: number, y: number) {\r\n const pois = this.currentFloor?.poiLayer.getPoiByDeviceXy(x, y)\r\n return pois || [];\r\n }\r\n\r\n onPointerover = (e: PointerEvent) => { \r\n const { graphics, position } = this.getGraphicsByDeviceXy(e.offsetX, e.offsetY);\r\n const pois = this.getPoisByDeviceXy(e.offsetX, e.offsetY) as Poi[];\r\n this.dispatchEvent({ type: 'pointer-over', e, graphics, pois, position })\r\n }\r\n\r\n onPointermove = (e: PointerEvent) => { \r\n const { graphics, position } = this.getGraphicsByDeviceXy(e.offsetX, e.offsetY)\r\n const pois = this.getPoisByDeviceXy(e.offsetX, e.offsetY) as Poi[];\r\n // console.log(graphics, position, e.offsetX, e.offsetY)\r\n this.dispatchEvent({ type: 'pointer-move', e, graphics, pois, position })\r\n }\r\n\r\n onPointerleave = () => { \r\n this.dispatchEvent({ type: \"pointer-level\" })\r\n }\r\n\r\n onSelectionSelect = ({ graphics, isMultipleSelect }: {graphics: Graphic[], isMultipleSelect: boolean}) => { \r\n this.dispatchEvent({ type: \"select-graphic\", graphics, isMultipleSelect })\r\n }\r\n\r\n onHoverChange = ({ graphics }: { graphics: Graphic[] }) => { \r\n this.dispatchEvent({ type: \"hover\", graphics })\r\n }\r\n\r\n registryEvent() {\r\n window.addEventListener(\"resize\", this.onWindowResize);\r\n this.container.addEventListener(\"click\", this.onClick);\r\n this.container.addEventListener(\"pointerover\", this.onPointerover)\r\n this.container.addEventListener(\"pointermove\", this.onPointermove)\r\n this.container.addEventListener(\"pointerleave\", this.onPointerleave)\r\n this.selection.addEventListener(\"select\", this.onSelectionSelect)\r\n this.hoverHelper.addEventListener(\"hover-change\", this.onHoverChange)\r\n }\r\n\r\n unRegistryEvent() {\r\n window.removeEventListener(\"resize\", this.onWindowResize);\r\n this.container.removeEventListener(\"click\", this.onClick);\r\n this.container.removeEventListener(\"pointerover\", this.onPointerover)\r\n this.container.removeEventListener(\"pointermove\", this.onPointermove)\r\n this.container.removeEventListener(\"pointerleave\", this.onPointerleave)\r\n this.selection.removeEventListener(\"select\", this.onSelectionSelect)\r\n this.hoverHelper.removeEventListener(\"hover-change\", this.onHoverChange)\r\n }\r\n\r\n /**\r\n * \u8BBE\u7F6E\u7EB5\u5411\u65CB\u8F6C\u89D2\u5EA6\r\n * @param polar \u5F27\u5EA6\r\n */\r\n public setPolarAngle(polar: number, duration = 500) {\r\n if (duration === 0) {\r\n this.control.maxPolarAngle = polar;\r\n this.control.minPolarAngle = polar;\r\n this.control.update();\r\n this.control.maxPolarAngle = this.config.control.maxPolar;\r\n this.control.minPolarAngle = 0;\r\n return Promise.resolve();\r\n }\r\n return timeoutPromise(\r\n new Promise((resolve) => {\r\n const start = { polar: this.control.getPolarAngle() };\r\n const end = { polar };\r\n const tween = new Tween(start, this.tweenGroup)\r\n .to(end, duration)\r\n .onUpdate(() => {\r\n this.control.maxPolarAngle = start.polar;\r\n this.control.minPolarAngle = start.polar;\r\n this.control.update();\r\n })\r\n .onComplete(() => {\r\n this.control.enabled = true;\r\n this.control.maxPolarAngle = this.config.control.maxPolar;\r\n this.control.minPolarAngle = 0;\r\n this.tweenGroup.remove(tween);\r\n resolve(true);\r\n })\r\n .onStart(() => {\r\n this.control.enabled = false;\r\n })\r\n .start();\r\n }),\r\n duration + 500\r\n );\r\n }\r\n\r\n /**\r\n * \u8BBE\u7F6E\u6A2A\u5411\u65CB\u8F6C\u89D2\u5EA6\r\n * @param azimuthal \u5F27\u5EA6\r\n */\r\n public setAzimuthalAngle(azimuthal: number, duration = 500) {\r\n if (duration === 0) {\r\n this.control.maxAzimuthAngle = azimuthal;\r\n this.control.minAzimuthAngle = azimuthal;\r\n this.control.update();\r\n this.control.maxAzimuthAngle = Infinity;\r\n this.control.minAzimuthAngle = Infinity;\r\n return\r\n }\r\n return timeoutPromise(\r\n new Promise((resolve) => {\r\n const start = { azimuthal: this.control.getAzimuthalAngle() };\r\n const end = { azimuthal };\r\n const tween = new Tween(start, this.tweenGroup)\r\n .to(end, duration)\r\n .onUpdate(() => {\r\n this.control.maxAzimuthAngle = start.azimuthal;\r\n this.control.minAzimuthAngle = start.azimuthal;\r\n this.control.update();\r\n })\r\n .onComplete(() => {\r\n this.control.enabled = true;\r\n this.control.maxAzimuthAngle = Infinity;\r\n this.control.minAzimuthAngle = Infinity;\r\n this.tweenGroup.remove(tween);\r\n resolve(true);\r\n })\r\n .onStart(() => {\r\n this.control.enabled = false;\r\n })\r\n .start();\r\n }),\r\n duration + 500\r\n );\r\n }\r\n\r\n getCameraLookAt() {\r\n return new Vector3().subVectors(this.control.target, this.camera.position);\r\n }\r\n\r\n /**\r\n * \u6309\u7167\u4E00\u4E2A\u4E2D\u5FC3\u70B9\u8BBE\u7F6E\u76F8\u673A\u7684\u653E\u5927\u7F29\u5C0F\r\n * @param zoom\r\n * @param center\r\n * @returns\r\n */\r\n public setZoom(zoom: number, center: Vector3, duration = 500) {\r\n const lookAtVector = this.getCameraLookAt();\r\n const start = {\r\n zoom: this.camera.zoom,\r\n target: this.control.target.clone(),\r\n };\r\n if (!duration) { \r\n this.camera.position.copy(center.clone().sub(lookAtVector));\r\n this.control.target.copy(center);\r\n this.camera.zoom = zoom;\r\n this.control.update()\r\n return\r\n }\r\n return timeoutPromise(\r\n new Promise((resolve) => {\r\n const tween = new Tween(start, this.tweenGroup)\r\n .to(\r\n {\r\n zoom,\r\n target: center,\r\n },\r\n duration\r\n )\r\n .onUpdate(() => {\r\n this.camera.position.copy(start.target.clone().sub(lookAtVector));\r\n this.control.target.copy(start.target);\r\n this.camera.zoom = start.zoom;\r\n this.control.update();\r\n })\r\n .onComplete(() => {\r\n this.tweenGroup.remove(tween);\r\n this.control.enabled = true;\r\n resolve(true)\r\n })\r\n .onStart(() => {\r\n this.control.enabled = false;\r\n })\r\n .start();\r\n }),\r\n duration + 500\r\n );\r\n }\r\n\r\n getFitCameraToObjectZoom(\r\n object: Object3D,\r\n padding: [number, number, number, number] = [20, 20, 20, 20],\r\n duration = 500,\r\n force2DView = true, // \u5F3A\u5236\u8BA1\u7B972d\u89C6\u89D2\u7684\u5927\u5C0F\r\n ) { \r\n const [top, right, bottom, left] = padding;\r\n const { clientSize: { width, height } } = this;\r\n const polar = this.control.getPolarAngle()\r\n if (force2DView) {\r\n // \u83B7\u53D6\u57282D\u89C6\u56FE\u4E0B\u7684\u5927\u5C0F\r\n this.setPolarAngle(0, 0)\r\n }\r\n // \u83B7\u53D6\u7269\u4F53\u7684\u4E09\u7EF4\u76D2\u5B50\u5750\u6807\r\n const boundingBox = new Box3().setFromObject(object);\r\n this.setPolarAngle(polar, 0)\r\n const { max, min } = boundingBox;\r\n // \u5750\u6807\u8F6C\u6210\u5C4F\u5E55\u5750\u6807\u5E76\u8BA1\u7B97\u51FA\u5360\u7528\u5C4F\u5E55\u5750\u6807\u7684\u5927\u5C0F\r\n const max2d = vector3ToDevice(max, this.camera, width, height);\r\n const min2d = vector3ToDevice(min, this.camera, width, height);\r\n const boundingBox2d = new Box2().setFromPoints([\r\n new Vector2(max2d.x, max2d.y),\r\n new Vector2(min2d.x, min2d.y),\r\n ]);\r\n const size = boundingBox2d.getSize(new Vector2());\r\n // \u8BA1\u7B97\u5728\u5C4F\u5E55\u4E0Ax,y\u65B9\u5411\u4E0A\u9700\u8981\u8C03\u6574\u7684\u500D\u6570\r\n const xScale = (width - right - left) / size.x;\r\n const yScale = (height - top - bottom) / size.y;\r\n const scale = Math.min(xScale, yScale);\r\n const center = new Vector3((max.x + min.x) / 2, (max.y + min.y) / 2, max.z);\r\n return { zoom: scale * this.camera.zoom, center };\r\n }\r\n\r\n /**\r\n * \u653E\u5927\u76F8\u673A\u5230\u7269\u4F53\u5360\u5168\u5C4F\r\n * @param object\r\n * @param padding\r\n * @param duration\r\n * @returns\r\n */\r\n fitCameraToObject(\r\n object: Object3D,\r\n padding: [number, number, number, number] = [20, 20, 20, 20],\r\n duration = 500,\r\n force2DView = true, // \u5F3A\u5236\u8BA1\u7B972d\u89C6\u89D2\u7684\u5927\u5C0F\r\n ) {\r\n const { zoom, center } = this.getFitCameraToObjectZoom(object, padding, duration, force2DView)\r\n return this.setZoom(zoom, center, duration);\r\n }\r\n\r\n getFitCameraToGroundZoom(padding: [number, number, number, number] = [20, 20, 20, 20], duration = 500, force2DView = true) {\r\n if (this.currentFloor && this.currentFloor.hasElement) {\r\n return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper, padding, duration, force2DView).zoom;\r\n }\r\n }\r\n\r\n fitCameraToGround(padding: [number, number, number, number] = [20, 20, 20, 20], duration = 500, force2DView = true) { \r\n if (this.currentFloor && this.currentFloor.hasElement) {\r\n return this.fitCameraToObject(this.currentFloor.groundUpper, padding, duration, force2DView);\r\n } else {\r\n return Promise.resolve(false);\r\n }\r\n }\r\n\r\n /**\r\n * \u4FEE\u6539\u76F8\u673A\u4F4D\u7F6E\r\n * @param position \u4FEE\u6539\u540E\u7684\u76F8\u673A\u7684\u4F4D\u7F6E\r\n * @param duration \u52A8\u753B\u6301\u7EED\u65F6\u95F4\r\n */\r\n public setCameraPosition(position: Vector3, duration: number) {\r\n return timeoutPromise(\r\n new Promise((resolve) => {\r\n const start = this.camera.position.clone();\r\n const lookAtVector = this.getCameraLookAt();\r\n const tween = new Tween(start, this.tweenGroup)\r\n .to(position, duration)\r\n .onUpdate(() => {\r\n this.camera.position.copy(start.clone().sub(lookAtVector));\r\n this.control.target.copy(start.clone());\r\n this.control.update();\r\n })\r\n .onComplete(() => {\r\n this.tweenGroup.remove(tween);\r\n this.camera.position.copy(start.clone().sub(lookAtVector));\r\n this.control.target.copy(position.clone());\r\n this.control.update();\r\n this.control.enabled = true;\r\n resolve(true);\r\n })\r\n .onStart(() => {\r\n this.control.enabled = false;\r\n })\r\n .start();\r\n }),\r\n duration + 500\r\n );\r\n }\r\n\r\n render() {\r\n this.renderer.render(this.scene, this.camera);\r\n this.dispatchEvent({ type: \"update\" });\r\n this.timer.requestAnimationFrame(() => {\r\n this.render();\r\n });\r\n this.tweenGroup.update();\r\n }\r\n\r\n dispose() {\r\n this.cameraBound.dispose()\r\n this.selection.dispose()\r\n this.hoverHelper.dispose()\r\n this.tweenGroup.getAll().forEach((item) => item.stop());\r\n this.tweenGroup.removeAll();\r\n this.unRegistryEvent();\r\n this.container.removeChild(this.renderer.domElement);\r\n this.timer.dispose();\r\n this.renderer.dispose();\r\n (this.lights.children as Light[]).forEach((light: Light) =>\r\n light.dispose()\r\n );\r\n this.materialFactory.dispose();\r\n dispose(this.scene);\r\n }\r\n}\r\n", "import { EventDispatcher } from \"three\";\r\nimport { Context } from \"../../context\";\r\nimport { Graphic, Poi } from \"../../elements\";\r\nimport { BoxSelection } from \"./box-selection\";\r\nimport { isControl, isMac } from \"../../utils\";\r\n\r\ninterface SelectionEventMap {\r\n \"select\": {\r\n graphics: Graphic[],\r\n isMultipleSelect: boolean,\r\n }\r\n}\r\n\r\nexport class Selection extends EventDispatcher<SelectionEventMap> {\r\n private _list = new Set<Graphic>()\r\n\r\n private boxSelection: BoxSelection;\r\n private prevPanStatus?: boolean;\r\n private prevRotateStatus?: boolean;\r\n private downPoint: { x: number, y: number } | null = null\r\n\r\n private isMultipleSelect = false;\r\n\r\n constructor(private context: Context) {\r\n super()\r\n this.boxSelection = new BoxSelection(context)\r\n this.boxSelection.setEnable(false)\r\n this.registryEvent()\r\n }\r\n\r\n get list() {\r\n return this._list\r\n }\r\n\r\n enableBoxSelection() { \r\n if (this.isMultipleSelect) { return }\r\n this.isMultipleSelect = true;\r\n this.boxSelection.setEnable(true)\r\n this.prevPanStatus = this.context.control.enablePan\r\n this.prevRotateStatus = this.context.control.enableRotate\r\n this.context.control.enablePan = false\r\n this.context.control.enableRotate = false\r\n }\r\n\r\n disableBoxSelection() { \r\n if (this.isMultipleSelect) { \r\n this.isMultipleSelect = false;\r\n this.boxSelection.setEnable(false)\r\n this.context.control.enablePan = !!this.prevPanStatus\r\n this.context.control.enableRotate = !!this.prevRotateStatus\r\n }\r\n }\r\n\r\n onPointerDown = (e: PointerEvent) => {\r\n this.downPoint = { x: e.offsetX, y: e.offsetY }\r\n }\r\n\r\n onPointerUp = (e: PointerEvent) => {\r\n if (!this.downPoint) { return }\r\n const { offsetX, offsetY } = e\r\n const { x, y } = this.downPoint\r\n if (Math.sqrt((x - offsetX) ** 2 + (y - offsetY) ** 2) > 3) {\r\n return\r\n }\r\n const { graphics } = this.context.getGraphicsByDeviceXy(offsetX, offsetY)\r\n const graphicIdSet = new Set(graphics.map(item => item.options.id))\r\n const pois = this.context.getPoisByDeviceXy(offsetX, offsetY) as Poi[];\r\n pois.forEach(item => { \r\n if (!graphicIdSet.has(item.options.id)) {\r\n const graphic = this.context.currentFloor?.graphicLayer.graphicMap.get(item.options.id) || null\r\n if (graphic && graphic.options.geometry.type === 'point') { \r\n graphics.push(graphic)\r\n graphicIdSet.add(item.options.id)\r\n }\r\n }\r\n })\r\n if (!(isMac ? e.metaKey : e.ctrlKey)) {\r\n this._list.clear()\r\n }\r\n graphics.forEach(item => this._list.add(item))\r\n this.selectEnd()\r\n this.downPoint = null\r\n }\r\n\r\n onPointerOut = (e: PointerEvent) => { \r\n this.disableBoxSelection()\r\n }\r\n\r\n onKeyDown = (e: KeyboardEvent) => {\r\n if (isControl(e.key)) {\r\n this.enableBoxSelection()\r\n }\r\n }\r\n\r\n onKeyUp = (e: KeyboardEvent) => {\r\n if (isControl(e.key)) {\r\n this.disableBoxSelection()\r\n }\r\n }\r\n\r\n onBoxSelected = ({ list }: { list: Graphic[] }) => { \r\n this._list.clear()\r\n list.forEach(item => {\r\n this._list.add(item)\r\n })\r\n this.selectEnd()\r\n }\r\n\r\n selectEnd() {\r\n this.dispatchEvent({type: \"select\", graphics: [...this._list], isMultipleSelect: this.isMultipleSelect})\r\n }\r\n\r\n registryEvent() {\r\n this.context.container.addEventListener(\"pointerdown\", this.onPointerDown)\r\n this.context.container.addEventListener(\"pointerup\", this.onPointerUp)\r\n this.context.container.addEventListener(\"pointerout\", this.onPointerOut)\r\n this.context.container.addEventListener(\"pointercancel\", this.onPointerOut)\r\n window.addEventListener(\"keydown\", this.onKeyDown)\r\n window.addEventListener(\"keyup\", this.onKeyUp)\r\n this.boxSelection.addEventListener(\"selected\", this.onBoxSelected)\r\n }\r\n\r\n unRegistryEvent() {\r\n this.context.container.removeEventListener(\"pointerdown\", this.onPointerDown)\r\n this.context.container.removeEventListener(\"pointerup\", this.onPointerUp)\r\n this.context.container.removeEventListener(\"pointerout\", this.onPointerOut)\r\n this.context.container.removeEventListener(\"pointercancel\", this.onPointerOut)\r\n window.removeEventListener(\"keydown\", this.onKeyDown)\r\n window.removeEventListener(\"keyup\", this.onKeyUp)\r\n this.boxSelection.removeEventListener(\"selected\", this.onBoxSelected)\r\n }\r\n\r\n clear() {\r\n this._list.clear()\r\n }\r\n\r\n remove(graphic: Graphic) { \r\n this._list.delete(graphic)\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent()\r\n }\r\n}", "import {\r\n Object3D, ExtrudeGeometry, Mesh, Box3, MeshBasicMaterial,\r\n Raycaster, Object3DEventMap, Vector3, BufferGeometry, LineBasicMaterial, LineSegments\r\n} from 'three';\r\nimport { initShape, proxyOptions, darkenColor } from '../utils'\r\nimport { GraphicOptions, PolygonGeometry } from 'src/types';\r\nimport { Context } from '../context'\r\n\r\n// \u95E8\u7684\u7C7B\u578B\r\nconst DoorType = {\r\n single: \"\u5355\u5F00\u95E8\",\r\n double: \"\u53CC\u5F00\u95E8\",\r\n move: \"\u79FB\u52A8\u95E8\",\r\n};\r\n\r\n// \u95E8\u7684\u6750\u8D28\r\nconst DoorMaterial = {\r\n wood: \"\u6728\u95E8\",\r\n glass: \"\u73BB\u7483\u95E8\",\r\n aluminum: \"\u94DD\u5408\u91D1\u95E8\",\r\n}\r\n\r\n// \u5355\u4E2A\u95E8\u7684\u914D\u7F6E\r\nexport interface Door {\r\n // \u540D\u79F0\r\n name: string;\r\n id: string;\r\n width: number;\r\n // \u5185\u5F00/\u5916\u5F00\r\n open: boolean;\r\n // \u7C7B\u578B \u5355\u5F00\u95E8 \u53CC\u5F00\u95E8 \u79FB\u52A8\u95E8\r\n type: keyof typeof DoorType;\r\n // \u6750\u8D28\r\n material: keyof typeof DoorMaterial;\r\n}\r\n\r\nexport type GraphicOptionsParam = Partial<GraphicOptions>\r\n\r\ntype GraphicEventMap = {\r\n [K in keyof GraphicOptions as `change-${K}`]: { value: GraphicOptions[K] };\r\n} & Object3DEventMap;\r\n\r\n\r\nconst defaultOptions: GraphicOptions = {\r\n id: \"\", // \u56FE\u5F62id\r\n height: 0.1, // \u56FE\u5F62\u9AD8\u5EA6\r\n airHeight: 0, // \u60AC\u7A7A\u9AD8\u5EA6\r\n area: 0, // \u9762\u79EF\r\n group: \"\", // \u5206\u7EC4\r\n fillColor: \"#EFF4FB\", // \u989C\u8272\r\n strokeColor: \"#ffffff\", // \u8FB9\u6846\r\n fillOpacity: 1, // \u900F\u660E\u5EA6\r\n strokeOpacity: 1, // \u63CF\u8FB9\u900F\u660E\u5EA6\r\n strokeWidth: 1, // \u63CF\u8FB9\u5BBD\u5EA6 \r\n doors: [], // \u95E8\u914D\u7F6E\r\n locked: false,\r\n visible: true,\r\n geometry: {\r\n type: 'polygon',\r\n cds: [],\r\n curveCpt: [],\r\n curveIndex: []\r\n },\r\n layerType: \"\",\r\n zIndex: 0,\r\n stroke: true,\r\n deltaHeight: 0,\r\n userData: {}\r\n}\r\n\r\nexport class Graphic extends Object3D<GraphicEventMap> {\r\n\r\n private geometry!: ExtrudeGeometry;\r\n\r\n private material!: MeshBasicMaterial | MeshBasicMaterial[];\r\n\r\n public mesh!: Mesh;\r\n\r\n private line!: LineSegments;\r\n\r\n private lineMaterial?: LineBasicMaterial;\r\n\r\n private lineGeometry?: BufferGeometry;\r\n \r\n public options: GraphicOptions\r\n \r\n constructor(private context: Context, options: GraphicOptionsParam) {\r\n super()\r\n this.options = proxyOptions<GraphicOptions, GraphicEventMap>({...defaultOptions, ...options}, this)\r\n if (this.options.geometry.type === \"point\") { \r\n const [x, y] = this.options.geometry.cds\r\n this.position.set(x, y, this.options.height + this.options.airHeight)\r\n return this\r\n }\r\n this.init()\r\n this.visible = this.options.visible\r\n this.addEventListener('change-fillColor', ({ value }) => {\r\n this.initMaterial()\r\n this.initMesh()\r\n })\r\n this.addEventListener('change-fillOpacity', ({ value }) => {\r\n this.initMaterial()\r\n this.initMesh()\r\n })\r\n this.addEventListener('change-height', ({ value }) => {\r\n this.dispose()\r\n this.init()\r\n })\r\n this.addEventListener('change-strokeColor', ({ value }) => {\r\n if (!this.options.stroke) { return }\r\n this.initLineMaterial();\r\n this.createBorder();\r\n })\r\n this.addEventListener('change-strokeOpacity', ({ value }) => {\r\n if (!this.options.stroke) { return }\r\n this.initLineMaterial();\r\n this.createBorder();\r\n })\r\n // this.addEventListener('change-strokeWidth', ({ value }) => {\r\n // this.initLineMaterial();\r\n // this.createBorder();\r\n // })\r\n this.addEventListener('change-airHeight', ({ value }) => {\r\n this.position.z = value\r\n })\r\n this.addEventListener('change-visible', ({ value }) => {\r\n this.visible = value\r\n })\r\n this.addEventListener('change-stroke', ({ value }) => {\r\n if (value) {\r\n if (this.line) { return }\r\n this.initLineGeometry()\r\n this.initLineMaterial()\r\n this.createBorder()\r\n } else if (this.line) {\r\n this.remove(this.line);\r\n this.lineGeometry?.dispose()\r\n }\r\n })\r\n }\r\n\r\n getCenter() { \r\n if (this.options.geometry.type === \"point\") { \r\n return this.position.clone()\r\n }\r\n const center = new Vector3()\r\n const box = new Box3()\r\n box.setFromObject(this)\r\n box.getCenter(center)\r\n return center\r\n }\r\n\r\n getSize() {\r\n if (this.options.geometry.type === \"point\") { \r\n return new Vector3(0, 0, 0)\r\n }\r\n const box = new Box3()\r\n const size = new Vector3()\r\n box.setFromObject(this)\r\n box.getSize(size)\r\n return size\r\n }\r\n\r\n getPosition() {\r\n const center = this.getCenter()\r\n center.setZ(center.z + this.options.height)\r\n return center\r\n }\r\n\r\n init() {\r\n this.geometry = this.initGeometry()\r\n this.initMaterial()\r\n this.initMesh()\r\n this.mesh.position.z = this.options.airHeight + this.options.deltaHeight;\r\n if (this.options.stroke) {\r\n // \u521B\u5EFA\u8FB9\u6846\r\n this.initLineMaterial()\r\n this.initLineGeometry()\r\n this.createBorder()\r\n }\r\n }\r\n\r\n initGeometry() {\r\n const shape = initShape(\r\n (this.options.geometry as PolygonGeometry).cds[0],\r\n (this.options.geometry as PolygonGeometry).cds.slice(1)\r\n )\r\n const geometry = new ExtrudeGeometry(shape, {\r\n steps: 1,\r\n bevelEnabled: false,\r\n depth: this.options.height,\r\n curveSegments: 4,\r\n });\r\n return geometry\r\n }\r\n\r\n initMaterial() {\r\n const material = this.context.materialFactory.createMeshBasicMaterial({\r\n color: this.options.fillColor,\r\n opacity: this.options.fillOpacity\r\n })\r\n if (this.options.height <= 0.001) {\r\n this.material = material\r\n return material\r\n }\r\n const material1 = this.context.materialFactory.createMeshBasicMaterial({\r\n color: darkenColor(this.options.fillColor),\r\n opacity: this.options.fillOpacity,\r\n })\r\n this.material = [material, material1]\r\n return [material, material1]\r\n }\r\n\r\n initLineMaterial() { \r\n const lineMaterial = this.context.materialFactory.createLineMaterial({\r\n color: this.options.strokeColor,\r\n opacity: this.options.strokeOpacity,\r\n })\r\n this.lineMaterial = lineMaterial;\r\n return lineMaterial\r\n }\r\n\r\n initMesh() {\r\n if (this.mesh) { \r\n this.remove(this.mesh)\r\n }\r\n this.mesh = new Mesh(this.geometry, this.material)\r\n this.add(this.mesh)\r\n }\r\n\r\n getBorderPoints() {\r\n const points = [];\r\n const height = this.options.height + this.options.deltaHeight\r\n // \u70B9\u7684\u5750\u6807\u8981\u81EA\u5DF1\u7B97\uFF0C\u53EA\u753B\u5173\u952E\u8282\u70B9\u7684\u5782\u76F4\u7EBFcurveIndex\u662F\u5173\u952E\u8282\u70B9,\u5982\u679C\u662F\u66F2\u7EBF\u6709\u8FD9\u4E2A\u503C\uFF0C\u4E0D\u662F\u66F2\u7EBF\u4E0D\u4E00\u5B9A\u6709\r\n const { cds } = this.options.geometry as PolygonGeometry\r\n for (let j = 0; j < cds.length; j++) { \r\n const curCds = cds[j]\r\n for (let i = 0; i < curCds.length; i++) {\r\n const cur = curCds[i];\r\n const next = i + 1 === curCds.length ? curCds[0] : curCds[i + 1];\r\n // \u628A\u62C9\u5347\u4E0A\u53BB\u7684\u70B9\u653E\u8FDB\u53BB\r\n points.push(new Vector3(cur[0], cur[1], height))\r\n points.push(new Vector3(next[0], next[1], height))\r\n }\r\n }\r\n return points\r\n }\r\n\r\n initLineGeometry() { \r\n if (this.lineGeometry) { \r\n this.lineGeometry.dispose()\r\n }\r\n const points = this.getBorderPoints()\r\n const lineGeometry = new BufferGeometry()\r\n .setFromPoints(points)\r\n this.lineGeometry = lineGeometry;\r\n }\r\n\r\n createBorder() {\r\n if (this.line) { \r\n this.remove(this.line)\r\n }\r\n const line = new LineSegments(this.lineGeometry, this.lineMaterial)\r\n line.position.z = this.options.airHeight + 0.01\r\n this.line = line;\r\n this.add(line)\r\n return line\r\n }\r\n\r\n raycast(raycaster: Raycaster) {\r\n if (!this.visible) { return false }\r\n if (this.options.geometry.type === \"point\") { return false }\r\n const intersects = raycaster.intersectObject(this.mesh)\r\n if (intersects[0]) {\r\n const {point: position, distance} = intersects[0]\r\n return { position, distance }\r\n }\r\n return false\r\n }\r\n \r\n dispose() {\r\n this.geometry.dispose()\r\n this.line?.geometry.dispose()\r\n this.clear()\r\n }\r\n\r\n}", "import {\r\n Object3D, PlaneGeometry, DirectionalLight,\r\n Mesh, MeshStandardMaterial, ShadowMaterial, Color, Vector3, DoubleSide\r\n} from 'three';\r\nimport { dispose, initDirectionalLight } from '../utils'\r\n\r\nexport class Shadow extends Object3D {\r\n\r\n private directionalLight: DirectionalLight\r\n\r\n private plane!: Mesh\r\n\r\n public basicOpacity = 0.07\r\n\r\n constructor() {\r\n super()\r\n this.directionalLight = this.initLight()\r\n this.initPlane()\r\n }\r\n\r\n // \u521B\u5EFA\u5149\u6E90\r\n initLight() { \r\n const directionalLight = initDirectionalLight(0xffffff, 0.5)\r\n directionalLight.position.set(0, 0, 100);\r\n this.add(directionalLight);\r\n return directionalLight\r\n }\r\n \r\n changeLightCamera(size: Vector3) {\r\n const x = size.x\r\n const y = size.y\r\n this.directionalLight.shadow.camera.left = -x;\r\n this.directionalLight.shadow.camera.right = x;\r\n this.directionalLight.shadow.camera.top = y;\r\n this.directionalLight.shadow.camera.bottom = -y;\r\n this.directionalLight.shadow.camera.near = 0.5;\r\n this.directionalLight.shadow.camera.far = Math.max(x, y);\r\n }\r\n\r\n changeLightColor(color: number | string) {\r\n this.directionalLight.color = new Color(color)\r\n }\r\n\r\n setPosition(position: Vector3) {\r\n this.position.copy(position)\r\n this.directionalLight.position.set(-position.x / 2, -position.y / 2, 100)\r\n }\r\n\r\n // \u521B\u5EFA\u5E73\u9762\u767D\u8272\r\n initPlane(width = 1000, height = 1000) { \r\n const geometry = new PlaneGeometry(width, height)\r\n const material = new ShadowMaterial({\r\n transparent: true,\r\n opacity: 0,\r\n side: DoubleSide\r\n })\r\n const mesh = new Mesh(geometry, material)\r\n mesh.receiveShadow = true\r\n mesh.position.z = -10\r\n this.add(mesh)\r\n this.plane = mesh\r\n return mesh\r\n }\r\n\r\n setTarget(target: Object3D) {\r\n this.directionalLight.target = target\r\n }\r\n\r\n transformOpacity(opacity: number): number {\r\n return opacity * this.basicOpacity\r\n }\r\n\r\n setOpacity(opacity: number) { \r\n (this.plane.material as MeshStandardMaterial).opacity = this.transformOpacity(opacity);\r\n }\r\n \r\n dispose() {\r\n dispose(this, true)\r\n }\r\n\r\n}", "import { proxyOptions, sleepOnePromise } from '../utils';\r\nimport { EventDispatcher, Object3D, Object3DEventMap, Vector3 } from 'three';\r\nimport { Context } from '../context'\r\nimport { Overlay } from './overlay';\r\n\r\nexport interface PoiOptions {\r\n texts: { text: string, styles?: { [key: string]: string }; }[];\r\n icon?: string;\r\n icon_size?: [number, number]; // \u5BBD \u9AD8\r\n level: number; // \u6E32\u67D3\u4F18\u5148\u7EA7\r\n collision_enable: boolean; // \u662F\u5426\u53C2\u4E0E\u78B0\u649E\u68C0\u6D4B\r\n opacity: number;\r\n id: string; // poi\u7684key\r\n position: { x: number; y: number; z: number };\r\n icon_opacity: number;\r\n icon_border: { color: string, width: number };\r\n background: string;\r\n collision_hide_icon: boolean;\r\n built_in: boolean; // \u662F\u5426\u662F\u5185\u7F6E\u7684poi\r\n}\r\n\r\ntype PoiEventMap = {\r\n [K in keyof PoiOptions as `change-${K}`]: { value: PoiOptions[K] };\r\n} & Object3DEventMap;\r\n\r\nconst defaultOptions: PoiOptions = {\r\n texts: [{ text: \"\" }],\r\n level: 1,\r\n collision_enable: true,\r\n opacity: 1,\r\n id: \"\",\r\n position: { x: 0, y: 0, z: 0 },\r\n icon_opacity: 1,\r\n icon_border: { color: \"#586EE0\", width: 0 },\r\n background: \"\",\r\n collision_hide_icon: true,\r\n built_in: false\r\n}\r\n\r\nexport type PoiOptionsParam = Partial<PoiOptions>\r\n\r\nexport class Poi extends EventDispatcher<PoiEventMap> {\r\n\r\n private div!: HTMLDivElement\r\n\r\n private textDiv!: HTMLDivElement\r\n\r\n private img?: HTMLImageElement\r\n\r\n private overlay: Overlay\r\n\r\n public options: PoiOptions\r\n\r\n public visible = true\r\n\r\n size = { width: 0, height: 0 }\r\n\r\n position = new Vector3()\r\n\r\n userData = {};\r\n\r\n showTextStatus = true\r\n\r\n constructor(private context: Context, options: PoiOptionsParam) {\r\n super()\r\n this.options = proxyOptions<PoiOptions, PoiEventMap>({...defaultOptions, ...options}, this)\r\n this.position.set(options.position?.x || 0, options.position?.y || 0, options.position?.z || 0)\r\n this.overlay = new Overlay(this.context, { autoUpdate: false })\r\n this.overlay.addEventListener(\"update-position\", ({x, y, height}) => { \r\n this.overlay.div.style.transform = `translate3d(calc(${x}px - 50%), calc(${-height + y}px - ${this.options.icon ? '100%' : '50%'}), 0)`;\r\n })\r\n this.overlay.bindElement(this as unknown as Object3D)\r\n this.registryEvent()\r\n this.initDiv()\r\n this.addEventListener(\"change-icon\", ({ value }) => {\r\n if (value) {\r\n if (!this.img) {\r\n this.div.appendChild(this.initIcon())\r\n } else {\r\n this.img.setAttribute('src', value)\r\n }\r\n } else {\r\n this.img && this.div.removeChild(this.img)\r\n this.img = undefined\r\n this._changePosition()\r\n this.resetSize()\r\n }\r\n })\r\n this.addEventListener(\"change-texts\", ({ value }) => {\r\n this.div.removeChild(this.textDiv)\r\n this.div.appendChild(this.initText())\r\n this.resetSize()\r\n })\r\n this.addEventListener(\"change-opacity\", ({ value }) => {\r\n this.overlay.setOpacity(value)\r\n })\r\n this.addEventListener(\"change-icon_size\", ({ value }) => {\r\n if (this.img) {\r\n this.img.style.width = `${value?.[0] || 32}px`\r\n this.img.style.height = `${value?.[1] || 32}px`\r\n this.resetSize()\r\n }\r\n })\r\n this.addEventListener(\"change-icon_opacity\", ({ value }) => {\r\n if (this.img) {\r\n this.img.style.opacity = `${value}`\r\n }\r\n })\r\n this.addEventListener(\"change-icon_border\", ({ value }) => {\r\n if (this.img) {\r\n this.img.style.border = `${value.width}px solid ${value.color}`\r\n }\r\n })\r\n this.addEventListener(\"change-background\", ({ value }) => {\r\n this.div.style.background = value;\r\n })\r\n }\r\n\r\n get withinDisplayRange() {\r\n return this.overlay.withinDisplayRange\r\n }\r\n\r\n async resetSize() {\r\n await sleepOnePromise()\r\n const { width, height } = this.div.getBoundingClientRect()\r\n this.size = {\r\n width: width + 2, \r\n height: height + 2\r\n }\r\n }\r\n\r\n renderHelperBox() {\r\n // let div = this.helperDiv\r\n // if (!div) {\r\n // div = document.createElement('div')\r\n // this.context.container.appendChild(div)\r\n // }\r\n // const box = this.getBox()\r\n // div.style.cssText = `position: absolute; top: ${box.top}px;left: ${box.left}px;width: ${box.right - box.left}px;height: ${box.bottom - box.top}px;border: 1px solid red;`\r\n // this.helperDiv = div;\r\n }\r\n\r\n get clientPos() {\r\n return this.overlay.clientPos\r\n }\r\n\r\n initDiv() {\r\n const div = document.createElement(\"div\");\r\n div.appendChild(this.initText())\r\n if (this.options.icon) { \r\n div.appendChild(this.initIcon())\r\n }\r\n div.style.fontSize = `12px`;\r\n div.style.textShadow = `#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0`;\r\n div.style.display = `flex`;\r\n div.style.flexDirection = `column`;\r\n div.style.justifyContent = `center`;\r\n div.style.alignItems = `center`;\r\n div.style.padding = \"4px\";\r\n this.overlay.setOpacity(this.options.opacity);\r\n this.overlay.div.style.pointerEvents = `none`;\r\n this.overlay.div.style.userSelect = `none`;\r\n this.overlay.div.appendChild(div)\r\n this.div = div;\r\n// this._changePosition()\r\n this.resetSize()\r\n return div\r\n }\r\n\r\n getPosition() {\r\n return this.position\r\n }\r\n\r\n initText() {\r\n const textDiv = document.createElement(\"div\")\r\n textDiv.appendChild(this.createTextFragment())\r\n textDiv.style.textAlign = \"center\"\r\n this.textDiv = textDiv\r\n return textDiv\r\n }\r\n\r\n createTextFragment() { \r\n const f = document.createDocumentFragment()\r\n this.options.texts.forEach(item => { \r\n const div = document.createElement(\"div\")\r\n div.style.whiteSpace = 'nowrap';\r\n if (item.styles) { \r\n for (let [key, value] of Object.entries(item.styles)) { \r\n div.style[key as any] = value;\r\n }\r\n }\r\n div.textContent = item.text;\r\n f.appendChild(div)\r\n })\r\n return f\r\n }\r\n\r\n initIcon() {\r\n const img = document.createElement(\"img\")\r\n img.setAttribute(\"src\", this.options.icon!)\r\n img.style.width = `${this.options.icon_size?.[0] || 32}px`\r\n img.style.height = `${this.options.icon_size?.[1] || 32}px`\r\n img.style.opacity = `${this.options.icon_opacity}px`\r\n img.style.borderRadius = '50%';\r\n if (this.options.icon_border.width) {\r\n img.style.border = `${this.options.icon_border.width}px solid ${this.options.icon_border.color}`\r\n }\r\n img.onload = () => {\r\n // this._changePosition()\r\n this.resetSize()\r\n }\r\n this.img = img\r\n return img\r\n }\r\n\r\n private _changePosition = () => {\r\n // this.div.style.transform = `translate3d(-50%, ${this.options.icon ? '-100%' : '-50%'}, 0)`;\r\n }\r\n\r\n registryEvent() {\r\n // this.context.addEventListener('update', this._changePosition)\r\n }\r\n\r\n unRegistryEvent() {\r\n // this.context.removeEventListener('update', this._changePosition)\r\n }\r\n\r\n setVisible(visible: boolean) {\r\n if (visible === this.visible) { return }\r\n this.visible = visible\r\n this.changeOverlayVisible(visible)\r\n }\r\n\r\n changeOverlayVisible(visible: boolean) {\r\n if (visible === this.overlay.visible && this.options.collision_hide_icon) { return }\r\n if (this.options.collision_hide_icon) {\r\n this.overlay.visible = visible;\r\n this.overlay.div.style.visibility = visible ? \"visible\" : \"hidden\"\r\n } else {\r\n if (this.showTextStatus === visible) { return }\r\n this.textDiv.style.visibility = visible ? \"visible\" : \"hidden\"\r\n this.showTextStatus = visible\r\n }\r\n }\r\n\r\n parentSetVisible(visible: boolean) { \r\n if (!this.visible) { \r\n return\r\n }\r\n this.changeOverlayVisible(visible)\r\n // if (visible) {\r\n // this.renderHelperBox()\r\n // } else {\r\n // this.helperDiv?.remove()\r\n // this.helperDiv = null\r\n // }\r\n }\r\n\r\n getBox(boxScale = this.context.config.poi.boxScale) {\r\n const { width, height } = this.size\r\n const w = width * boxScale;\r\n const h = height * boxScale;\r\n const { x, y } = this.overlay.clientPos\r\n return {\r\n left: x - w / 2,\r\n right: x + w / 2,\r\n top: this.options.icon ? y - h : y - h / 2,\r\n bottom: this.options.icon ? y : y + h / 2,\r\n }\r\n }\r\n\r\n getOriginBox() { \r\n return this.getBox(1)\r\n }\r\n\r\n isContain(x: number, y: number) {\r\n if (!this.overlay.visible) { return false }\r\n if (!this.visible) {return false}\r\n const box = this.getOriginBox()\r\n return x >= box.left && x <= box.right && y >= box.top && y <= box.bottom\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent();\r\n this.div = null as unknown as HTMLDivElement;\r\n this.textDiv = null as unknown as HTMLDivElement;\r\n this.img = undefined\r\n this.overlay.dispose();\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Box3, EventDispatcher, Object3D, Vector3 } from \"three\";\r\nimport { vector3ToDevice } from '../utils'\r\n\r\ninterface OverlayOptions {\r\n autoUpdate: boolean;\r\n appendToBody: boolean;\r\n}\r\n\r\nconst defaultOptions: OverlayOptions = {\r\n autoUpdate: true,\r\n appendToBody: false\r\n}\r\n\r\ninterface OverlayEventMap {\r\n \"update-position\": {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n }\r\n}\r\n\r\nexport class Overlay extends EventDispatcher<OverlayEventMap> {\r\n\r\n public div: HTMLDivElement\r\n\r\n private element?: Object3D & { getPosition?: () => Vector3 }\r\n\r\n public position = new Vector3()\r\n\r\n clientPos = { x: 0, y: 0 }\r\n\r\n visible = true\r\n\r\n private options: OverlayOptions\r\n\r\n constructor(private context: Context, options: Partial<OverlayOptions> = {}) {\r\n super()\r\n this.options = { ...defaultOptions, ...options };\r\n this.registryEvent()\r\n this.div = this.initDiv()\r\n if (this.options.appendToBody) {\r\n document.body.appendChild(this.div)\r\n } else {\r\n this.context.container.appendChild(this.div)\r\n }\r\n }\r\n\r\n initDiv() {\r\n const div = document.createElement(\"div\")\r\n div.style.position = \"absolute\";\r\n return div\r\n }\r\n\r\n bindElement(element: Object3D) {\r\n this.element = element\r\n this.onUpdate() \r\n }\r\n\r\n unBindElement() {\r\n this.element = undefined;\r\n }\r\n\r\n setVisible(visible: boolean, display = 'block') {\r\n if (visible === this.visible) { return }\r\n this.div.style.display = visible ? display : 'none'\r\n this.visible = visible\r\n }\r\n\r\n setOpacity(opacity: number) {\r\n this.div.style.opacity = `${opacity}`\r\n }\r\n\r\n getPosition() {\r\n if (this.element) {\r\n if (typeof this.element.getPosition === \"function\") {\r\n return this.element.getPosition()\r\n }\r\n const box = new Box3().setFromObject(this.element)\r\n const center = box.getCenter(new Vector3())\r\n return center\r\n } else {\r\n return this.position\r\n }\r\n }\r\n\r\n get withinDisplayRange() { \r\n const { x, y } = this.clientPos\r\n const { width, height } = this.context.clientSize\r\n return x >=0 && x <= width && y >= 0 && y <= height\r\n }\r\n\r\n onUpdate = () => {\r\n const vector = this.getPosition()\r\n const { width, height, x: clientX, y: clientY } = this.context.clientSize\r\n const { x, y } = vector3ToDevice(vector, this.context.camera, width, height)\r\n if (this.clientPos.x === x && this.clientPos.y === y) { return }\r\n this.clientPos = { x, y }\r\n if (this.options.appendToBody) {\r\n this.div.style.left = `${clientX}px`\r\n this.div.style.top = `${clientY + height}px`\r\n }\r\n if (this.options.autoUpdate) { \r\n this.div.style.transform = `translate3d(${x}px, ${-height+y}px, 0)`\r\n } else {\r\n this.dispatchEvent({ type: \"update-position\", x, y, width, height })\r\n }\r\n }\r\n\r\n registryEvent() {\r\n this.context.addEventListener('update', this.onUpdate)\r\n }\r\n\r\n unRegistryEvent() {\r\n this.context.removeEventListener('update', this.onUpdate)\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent()\r\n this.unBindElement()\r\n this.div?.remove();\r\n this.div = null as unknown as HTMLDivElement\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Box3, Object3D, Vector3 } from \"three\";\r\nimport { GraphicLayer } from '../layer/graphic-layer'\r\nimport { PoiLayer } from '../layer/poi-layer'\r\nimport { Graphic, GraphicOptionsParam } from \"./graphic\";\r\nimport { Shadow } from \"./shadow\";\r\nimport { PoiOptionsParam } from \"./poi\";\r\nimport { HeatmapDataParam, HeatmapElement } from './heatmap'\r\nimport { Model, ModelOptions } from \"./model\";\r\n\r\nexport class Floor extends Object3D {\r\n \r\n graphicLayer: GraphicLayer;\r\n\r\n poiLayer: PoiLayer;\r\n\r\n grounds: Set<Graphic> = new Set();\r\n\r\n shadow = new Shadow();\r\n\r\n heatmap?: HeatmapElement;\r\n\r\n groundUpper = new Object3D();\r\n\r\n models = new Object3D()\r\n\r\n private groundMaxHeight = 0;\r\n\r\n constructor(public context: Context) {\r\n super()\r\n this.graphicLayer = new GraphicLayer(this.context);\r\n this.poiLayer = new PoiLayer(this.context);\r\n this.groundUpper.add(this.graphicLayer)\r\n this.groundUpper.add(this.poiLayer)\r\n this.add(this.groundUpper)\r\n this.add(this.models)\r\n }\r\n\r\n createGround(options: GraphicOptionsParam) {\r\n // options.deltaHeight = 0.00001 * this.grounds.size\r\n const ground = new Graphic(this.context, options)\r\n this.addGrounds([ground])\r\n }\r\n\r\n addGrounds(grounds: Graphic[]) {\r\n grounds.forEach(ground => { \r\n if (!this.grounds.has(ground)) {\r\n ground.mesh.castShadow = true;\r\n this.grounds.add(ground)\r\n this.groundUpper.add(ground)\r\n }\r\n })\r\n this.changeGroundMaxHeight()\r\n }\r\n\r\n changeGroundMaxHeight() { \r\n const grounds = Array.from(this.grounds)\r\n this.groundMaxHeight = this.grounds.size > 0 ? Math.max(...grounds.map(ground => ground.options.height + ground.options.airHeight + ground.options.deltaHeight)) : 0\r\n this.graphicLayer.position.z = this.groundMaxHeight\r\n this.models.position.z = this.groundMaxHeight\r\n }\r\n\r\n get hasElement() { \r\n return !!(this.grounds.size || this.graphicLayer.children.length)\r\n }\r\n\r\n getCenter() { \r\n return new Box3().setFromObject(this.groundUpper).getCenter(new Vector3())\r\n }\r\n \r\n addModel(options: ModelOptions) { \r\n const model = new Model(this.context, options)\r\n this.models.add(model)\r\n return model\r\n }\r\n\r\n addShadow() { \r\n const box = new Box3().setFromObject(this.groundUpper)\r\n const center = box.getCenter(new Vector3())\r\n const size = box.getSize(new Vector3())\r\n this.shadow.setPosition(center)\r\n this.shadow.changeLightCamera(size)\r\n this.add(this.shadow)\r\n }\r\n\r\n addGraphic(graphicOptions: GraphicOptionsParam) {\r\n return this.graphicLayer.createGraphic(graphicOptions)\r\n }\r\n\r\n addPoi(poiOptions: PoiOptionsParam) {\r\n return this.poiLayer.createPoi(poiOptions)\r\n }\r\n\r\n addHeatmap(data: HeatmapDataParam) {\r\n if (!this.heatmap) {\r\n this.heatmap = new HeatmapElement(this.context)\r\n this.add(this.heatmap)\r\n }\r\n this.heatmap.loadData(data)\r\n const box = new Box3().setFromObject(this.graphicLayer)\r\n this.heatmap.position.setZ(box.max.z)\r\n return this.heatmap\r\n }\r\n\r\n removeHeatMap() {\r\n if (this.heatmap) {\r\n this.remove(this.heatmap)\r\n this.heatmap.dispose()\r\n this.heatmap = undefined\r\n }\r\n }\r\n\r\n setShadowOpacity(opacity: number) {\r\n this.shadow.setOpacity(opacity)\r\n }\r\n\r\n setShadowVisible(visible: boolean) {\r\n this.shadow.visible = visible;\r\n }\r\n\r\n dispose() {\r\n this.shadow.dispose();\r\n this.graphicLayer.dispose()\r\n this.poiLayer.dispose()\r\n this.grounds.forEach(ground => ground.dispose())\r\n this.heatmap?.dispose()\r\n this.groundUpper.clear()\r\n this.models.children.forEach((model) => (model as unknown as Model).dispose())\r\n this.models.clear()\r\n this.clear()\r\n }\r\n\r\n}", "import { Graphic, GraphicOptionsParam } from \"../elements\";\r\nimport { Box3, Raycaster, Vector3 } from \"three\";\r\nimport { Layer } from \"./layer\";\r\nimport { Context } from \"../context\";\r\n\r\nexport class GraphicLayer extends Layer {\r\n\r\n graphicMap = new Map<string, Graphic>()\r\n\r\n constructor(context: Context) {\r\n super(context)\r\n }\r\n\r\n getCenter(): Vector3 { \r\n const box = new Box3().setFromObject(this)\r\n return box.getCenter(new Vector3())\r\n }\r\n\r\n createGraphic(options: GraphicOptionsParam) {\r\n // options.deltaHeight = 0.00001 * this.graphicMap.size;\r\n const graphic = new Graphic(this.context, options)\r\n this.add(graphic)\r\n this.graphicMap.set(options.id!, graphic)\r\n return graphic\r\n }\r\n\r\n removeGraphic(graphic: Graphic) { \r\n this.remove(graphic)\r\n this.graphicMap.delete(graphic.options.id!)\r\n graphic.dispose()\r\n }\r\n\r\n removeGraphicById(id: string) {\r\n if (this.graphicMap.has(id)) {\r\n this.removeGraphic(this.graphicMap.get(id)!)\r\n }\r\n }\r\n\r\n getGraphicByNodeId(id: string) {\r\n return this.graphicMap.get(id) || null\r\n }\r\n\r\n /**\r\n * \u83B7\u53D6\u5C04\u7EBF\u76F8\u4EA4\u7684\u5143\u7D20\r\n * @param raycaster \r\n */\r\n getGraphicByRaycaster(raycaster: Raycaster): { graphics: Graphic[], position: Vector3 | null } {\r\n const initData: {\r\n position: Vector3 | null,\r\n graphic: Graphic | null,\r\n distance: number\r\n } = { distance: 10000, graphic: null, position: null }\r\n const data = this.children.reduce((res, item) => {\r\n if (item instanceof Graphic) {\r\n const pos = item.raycast(raycaster)\r\n if (pos) {\r\n const { distance } = pos\r\n if (distance < res.distance) {\r\n return {\r\n distance: res.distance,\r\n position: res.position,\r\n graphic: item\r\n }\r\n }\r\n }\r\n return res\r\n } else {\r\n return res\r\n }\r\n }, initData)\r\n if (data === initData) {\r\n return { graphics: [], position: null }\r\n }\r\n return { graphics: [data.graphic!], position: data.position }\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Object3D } from \"three\";\r\nimport { dispose } from '../utils'\r\n\r\nexport class Layer extends Object3D {\r\n constructor(public context: Context) {\r\n super();\r\n }\r\n\r\n dispose() {\r\n dispose(this)\r\n this.clear()\r\n }\r\n}", "import { Poi, PoiOptionsParam } from \"../elements\";\r\nimport { Layer } from \"./layer\";\r\nimport { Context } from '../context'\r\nimport { debounce } from 'lodash'\r\nimport { Timer } from \"../utils\";\r\n\r\nexport class PoiLayer extends Layer {\r\n pois: Poi[] = []\r\n debounceCollisionDetection: () => void\r\n\r\n timer = new Timer()\r\n \r\n constructor(context: Context) {\r\n super(context)\r\n this.registryEvent()\r\n this.debounceCollisionDetection = debounce(this.collisionDetection, 10)\r\n }\r\n\r\n clear(force = false) {\r\n this.pois.forEach(item => {\r\n if (item.options.built_in && !force) { \r\n return\r\n }\r\n item.dispose()\r\n })\r\n this.pois = force ? [] : this.pois.filter(item => item.options.built_in)\r\n return this\r\n }\r\n\r\n createPoi(options: PoiOptionsParam) {\r\n const poi = new Poi(this.context, options)\r\n this.pushPoi(poi)\r\n poi.addEventListener(\"change-level\", () => this.changePoiLevelOrCollisionEnable(poi))\r\n poi.addEventListener(\"change-collision_enable\", () => this.changePoiLevelOrCollisionEnable(poi))\r\n Promise.resolve().then(() => { \r\n this.debounceCollisionDetection()\r\n })\r\n return poi\r\n }\r\n\r\n changePoiLevelOrCollisionEnable(poi: Poi) {\r\n const index = this.pois.findIndex(item => item === poi)\r\n if (index === -1) { return }\r\n this.pois.splice(index, 1)\r\n this.pushPoi(poi)\r\n }\r\n\r\n removePoi(poi: Poi) {\r\n const index = this.pois.findIndex(item => item === poi)\r\n if (index === -1) { return }\r\n this.pois.splice(index, 1)\r\n poi.dispose()\r\n }\r\n\r\n removePoiById(id: string) {\r\n const poi = this.pois.find(item => item.options.id === id)\r\n if (poi) {\r\n this.removePoi(poi)\r\n }\r\n }\r\n\r\n getPoiById(id: string) { \r\n const poi = this.pois.find(item => item.options.id === id)\r\n return poi || null\r\n }\r\n\r\n /**\r\n * \u4FDD\u5B58poi\u6309\u7167level\u6392\u5E8F\r\n * @param poi \r\n */\r\n pushPoi(poi: Poi) {\r\n // \u4E0D\u53C2\u4E0E\u78B0\u649E\u68C0\u6D4B\u7684\u5728\u6700\u524D\u9762\r\n if (!poi.options.collision_enable) {\r\n this.pois.unshift(poi)\r\n return\r\n }\r\n // level\u6700\u5C0F\u7684\u5728\u6700\u540E\u9762\r\n if (poi.options.level === 0) {\r\n this.pois.push(poi)\r\n return\r\n }\r\n for (let i = 0; i < this.pois.length; i++) {\r\n const item = this.pois[i]\r\n // \u4E0D\u53C2\u4E0E\u78B0\u649E\u68C0\u6D4B\u7684\u5728\u524D\u9762\r\n if (!item.options.collision_enable) { \r\n continue\r\n }\r\n if (item.options.level <= poi.options.level) {\r\n this.pois.splice(i, 0, poi)\r\n return\r\n }\r\n }\r\n // \u63D2\u5165\u5230\u6700\u540E\r\n this.pois.push(poi) \r\n }\r\n\r\n getPoiByDeviceXy(x: number, y: number) {\r\n const pois = this.pois.filter(item => {\r\n return (item instanceof Poi) && item.isContain(x, y)\r\n })\r\n return pois\r\n }\r\n\r\n onUpdate = () => { \r\n this.timer.requestAnimationFrame(() => { \r\n this.collisionDetection()\r\n })\r\n }\r\n\r\n /**\r\n * \u78B0\u649E\u68C0\u6D4B\r\n */\r\n collisionDetection() {\r\n const range: { left: number; right: number; top: number; bottom: number; }[] = []\r\n // \u6392\u9664\u5728\u5C4F\u5E55\u5916\u7684poi\r\n const pois = this.pois.filter(item => item.visible && item.withinDisplayRange)\r\n pois.forEach((item, index) => {\r\n const { left, right, top, bottom } = item.getBox()\r\n if (index === 0) {\r\n range.push({ left, right, top, bottom })\r\n return\r\n }\r\n // valid boolean \u8868\u793A\u53D1\u751F\u4E86\u78B0\u649E\r\n const valid = range.some((box) => { \r\n // \u5224\u65AD\u56DB\u4E2A\u70B9\u662F\u4E0D\u662F\u90FD\u4E0D\u5728box\u7684\u8303\u56F4\u5185\r\n return box.left < right && box.right > left && box.top < bottom && box.bottom > top;\r\n })\r\n item.parentSetVisible(!valid)\r\n if (!valid) { \r\n range.push({ left, right, top, bottom })\r\n }\r\n })\r\n }\r\n\r\n registryEvent() {\r\n this.context.addEventListener('update', this.onUpdate)\r\n }\r\n\r\n unRegistryEvent() { \r\n this.context.removeEventListener('update', this.onUpdate)\r\n }\r\n \r\n dispose() {\r\n this.timer.dispose()\r\n this.pois.forEach(item => item.dispose())\r\n this.pois.length = 0;\r\n this.debounceCollisionDetection = () => { }\r\n super.dispose()\r\n this.unRegistryEvent()\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport {\r\n MeshBasicMaterial, Object3D, PlaneGeometry,\r\n Texture, DoubleSide, Mesh, Matrix3, Vector2\r\n} from \"three\";\r\nimport { create, Heatmap, HeatmapData, DataPoint } from '@mars3d/heatmap.js'\r\nimport { featureCollection, point, bbox, center as getCenter } from '@turf/turf'\r\n\r\ntype V = 'value'\r\ntype X = 'x'\r\ntype Y = 'y'\r\n\r\nexport type HeatmapDataParam = HeatmapData<DataPoint<V, X, Y>>\r\n\r\nexport class HeatmapElement extends Object3D {\r\n\r\n private heatmap?: Heatmap<V, X, Y>;\r\n\r\n private div: HTMLDivElement\r\n\r\n private plane?: Mesh;\r\n\r\n constructor(private context: Context) {\r\n super()\r\n this.div = document.createElement(\"div\")\r\n }\r\n\r\n clearHeatmap() {\r\n if (this.div.firstChild) {\r\n this.div.removeChild(this.div.firstChild)\r\n }\r\n this.heatmap = undefined;\r\n }\r\n\r\n loadData(data: HeatmapDataParam) {\r\n this.clearHeatmap()\r\n const { width, height, leftTop, center } = this.getBox(data)\r\n this.heatmap = create({\r\n width: width,\r\n height: height,\r\n container: this.div,\r\n ...this.context.config.heatMap,\r\n } as any);\r\n this.heatmap.setData(this.transformData(data, leftTop))\r\n this.initPlane(width, height)\r\n this.position.set(center[0], center[1], this.position.z)\r\n }\r\n\r\n initPlane(width: number, height: number) {\r\n if (this.plane) { this.remove(this.plane) }\r\n const geometry = new PlaneGeometry(width, height)\r\n const texture = new Texture(this.div.firstChild as HTMLCanvasElement);\r\n texture.needsUpdate = true;\r\n const material = new MeshBasicMaterial({\r\n transparent: true,\r\n side: DoubleSide,\r\n map: texture,\r\n });\r\n material.needsUpdate = true;\r\n this.plane = new Mesh(geometry, material)\r\n this.add(this.plane)\r\n }\r\n\r\n getTransMatrix({ x, y }: { x: number, y: number }) {\r\n // \u5148\u628A\u5DE6\u4E0A\u89D2\u5E73\u79FB\u523000\u70B9\uFF0C\u7136\u540E\u5BF9y\u8F74\u53D6\u53CD\r\n return new Matrix3().makeScale(1, -1).multiply(new Matrix3().makeTranslation(0 - x, 0 - y))\r\n }\r\n\r\n /**\r\n * \u6240\u6709\u70B9\u7684\u5750\u6807\u51CF\u53BB\u5DE6\u4E0A\u89D2\u4ECE00\u70B9\u5F00\u59CB\u753Bcanvas\r\n * @param data \r\n * @param leftTop \r\n * @returns \r\n */\r\n transformData(data: HeatmapDataParam, leftTop: { x: number, y: number }): HeatmapDataParam {\r\n const matrix = this.getTransMatrix(leftTop)\r\n const $data = data.data.map(item => { \r\n const vector = new Vector2(item.x, item.y).applyMatrix3(matrix)\r\n return {\r\n x: vector.x,\r\n y: vector.y,\r\n value: item.value\r\n }\r\n })\r\n return {\r\n data: $data,\r\n max: data.max,\r\n min: data.min\r\n }\r\n }\r\n\r\n getBox(data: HeatmapDataParam) {\r\n const features = featureCollection(data.data.map(item => point([item.x, item.y])))\r\n // \u8FD4\u56DE\u4E00\u4E2A\u77E9\u5F62\u8FB9\u6846\u5750\u6807\r\n const box = bbox(features);\r\n const width = box[2] - box[0]\r\n const height = box[3] - box[1]\r\n const leftTop = { x: box[0], y: box[3] }\r\n const center = getCenter(features)\r\n return { width, height, leftTop, center: center.geometry.coordinates }\r\n }\r\n\r\n dispose() {\r\n this.div = null as unknown as HTMLDivElement\r\n this.heatmap = undefined\r\n }\r\n}", "import { Box3, Object3D, Vector3 } from \"three\";\r\nimport { Context } from \"../context\";\r\nimport { loadModel, dispose } from \"../utils\";\r\nimport { Poi } from \"./poi\";\r\nimport { GLTF } from \"three/examples/jsm/loaders/GLTFLoader\";\r\n\r\nexport interface ModelOptions {\r\n modelUrl: string;\r\n icon?: string;\r\n icon_size?: [number, number];\r\n position?: Vector3;\r\n}\r\n\r\nexport class Model extends Object3D {\r\n poi: Poi | null = null;\r\n\r\n model: GLTF | null = null\r\n\r\n constructor(public context: Context, private options: ModelOptions) {\r\n super()\r\n this.position.copy(options.position || new Vector3(0, 0, 0))\r\n this.loadModel()\r\n }\r\n \r\n async loadModel() { \r\n const object = await loadModel(this.options.modelUrl);\r\n object.scene.rotation.set(Math.PI / 2, Math.PI / 2, 0)\r\n this.add(object.scene)\r\n this.model = object\r\n this.initPoi()\r\n }\r\n\r\n initPoi() {\r\n if (!this.options.icon) {\r\n return\r\n }\r\n const poi = this.context.currentFloor?.addPoi({\r\n icon: this.options.icon,\r\n icon_size: this.options.icon_size,\r\n built_in: true,\r\n level: 0\r\n })\r\n this.poi = poi || null\r\n if (this.model && poi) {\r\n poi.position = (new Box3().setFromObject(this)).getCenter(new Vector3())\r\n }\r\n }\r\n\r\n dispose() {\r\n dispose(this)\r\n this.model = null\r\n if (this.poi) {\r\n this.context.currentFloor?.poiLayer.removePoi(this.poi)\r\n this.poi = null;\r\n }\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { EventDispatcher, Vector3 } from \"three\";\r\nimport { createSvg, vector3ToDevice } from '../utils'\r\n\r\nexport class BaseSvg<T extends {} = {}> extends EventDispatcher<T> {\r\n protected points: Vector3[] = [];\r\n\r\n protected svg: SVGElement;\r\n\r\n protected enable = true;\r\n\r\n constructor(public context: Context) {\r\n super()\r\n this.svg = createSvg(`${context.container.clientWidth}`, `${context.container.clientHeight}`)\r\n context.container.appendChild(this.svg)\r\n this._registryEvent()\r\n }\r\n\r\n private _onResize = ({ width, height }: { width: number; height: number }) => {\r\n if (this.svg) {\r\n this.svg.setAttribute(\"width\", `${width}`)\r\n this.svg.setAttribute(\"height\", `${height}`)\r\n }\r\n }\r\n\r\n private _registryEvent() {\r\n this.context.addEventListener(\"resize\", this._onResize)\r\n }\r\n\r\n private _unRegistryEvent() { \r\n this.context.removeEventListener(\"resize\", this._onResize)\r\n }\r\n\r\n setEnable(enable: boolean) {\r\n this.enable = enable;\r\n if (enable) {\r\n this.svg.style.display = 'block';\r\n } else {\r\n this.svg.style.display = 'none';\r\n }\r\n }\r\n\r\n getIntersectByPointerEvent(e: PointerEvent) {\r\n const { camera, renderer } = this.context\r\n const { offsetX: x, offsetY: y } = e\r\n const { clientWidth, clientHeight } = renderer.domElement;\r\n const nx = x / clientWidth * 2 - 1;\r\n const ny = 1 - y / clientHeight * 2;\r\n\r\n const v = new Vector3(nx, ny, 0);\r\n\r\n return v.unproject(camera);\r\n }\r\n\r\n getSvgCoordinate(vector: Vector3) {\r\n const { camera, container } = this.context\r\n const coord = vector3ToDevice(vector, camera, container.clientWidth, container.clientHeight)\r\n return coord\r\n }\r\n \r\n dispose() {\r\n this._unRegistryEvent()\r\n this.context.container.removeChild(this.svg)\r\n this.svg = null as unknown as SVGElement\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Vector3 } from \"three\";\r\nimport { setCirclePosition, createCircle, createLine, setLineStartEnd } from '../utils'\r\nimport { BaseSvg } from './base-svg'\r\n\r\ninterface SvgLineEventMap {\r\n 'distance': { distance: number }\r\n}\r\n\r\nexport class SvgLine extends BaseSvg<SvgLineEventMap> {\r\n\r\n private circles: SVGElement[] \r\n \r\n private line: SVGElement\r\n\r\n constructor(public context: Context) {\r\n super(context)\r\n const { config: { svg: { circle, line } } } = context\r\n this.circles = [createCircle(circle.radius, circle.fill), createCircle(circle.radius, circle.fill)]\r\n this.line = createLine(line.stroke)\r\n this.svg.appendChild(this.circles[0]);\r\n this.svg.appendChild(this.circles[1]);\r\n this.svg.appendChild(this.line);\r\n this.registryEvent()\r\n }\r\n\r\n setEnable(enable: boolean) {\r\n super.setEnable(enable)\r\n if (enable) {\r\n this.registryEvent()\r\n } else {\r\n this.unRegistryEvent()\r\n }\r\n }\r\n\r\n registryEvent() { \r\n this.context.container.addEventListener(\"pointerenter\", this.onPointermove)\r\n this.context.container.addEventListener(\"pointermove\", this.onPointermove)\r\n this.context.container.addEventListener(\"pointerleave\", this.onPointerleave)\r\n this.context.container.addEventListener(\"pointerdown\", this.onPointerdown)\r\n this.context.addEventListener(\"update\", this.onUpdate)\r\n }\r\n \r\n unRegistryEvent() { \r\n this.context.container.removeEventListener(\"pointerenter\", this.onPointermove)\r\n this.context.container.removeEventListener(\"pointermove\", this.onPointermove)\r\n this.context.container.removeEventListener(\"pointerleave\", this.onPointerleave)\r\n this.context.container.removeEventListener(\"pointerdown\", this.onPointerdown)\r\n this.context.removeEventListener(\"update\", this.onUpdate)\r\n }\r\n\r\n onUpdate = () => {\r\n if (this.points[0]) {\r\n const point1 = this.getSvgCoordinate(this.points[0])\r\n setCirclePosition(this.circles[0], point1.x, point1.y)\r\n setLineStartEnd(this.line, point1)\r\n }\r\n if (this.points[1]) {\r\n const point2 = this.getSvgCoordinate(this.points[1])\r\n setCirclePosition(this.circles[1], point2.x, point2.y)\r\n setLineStartEnd(this.line, undefined, point2)\r\n }\r\n }\r\n \r\n \r\n onPointermove = (e: PointerEvent) => { \r\n // \u53EA\u5728\u6709\u7B2C\u4E00\u4E2A\u70B9\u7684\u65F6\u5019\u9700\u8981\r\n if (this.points.length !== 1) { return }\r\n this.line.style.display = \"block\";\r\n setLineStartEnd(this.line, undefined, { x: e.offsetX, y: e.offsetY })\r\n }\r\n \r\n onPointerleave = () => { \r\n if (this.points[1]) { return } // \u5982\u679C\u5DF2\u7ECF\u6709\u4E24\u4E2A\u70B9\u4E86\u5C31\u4E0D\u505A\u5904\u7406\r\n this.line.style.display = \"none\";\r\n }\r\n \r\n onPointerdown = (e: PointerEvent) => {\r\n if (this.points[1]) { return } // \u5982\u679C\u5DF2\u7ECF\u6709\u4E24\u4E2A\u70B9\u4E86\u5C31\u4E0D\u505A\u5904\u7406\r\n const point = this.getIntersectByPointerEvent(e)\r\n if (point) {\r\n const { offsetX: x, offsetY: y } = e\r\n // \u4FEE\u6539\u70B9\r\n const circle = this.circles[this.points.length]\r\n setCirclePosition(circle, x, y)\r\n if (!this.points.length) { \r\n // \u8BBE\u7F6E\u7EBF\u7684\u8D77\u59CB\u70B9\r\n setLineStartEnd(this.line, { x, y }, { x, y })\r\n }\r\n this.addPoint(point)\r\n }\r\n }\r\n\r\n addPoint(vector: Vector3) {\r\n this.points.push(vector)\r\n if (this.points.length >= 2) {\r\n const distance = this.calculatedDistance()\r\n this.dispatchEvent({ type: 'distance', distance })\r\n }\r\n }\r\n\r\n /**\r\n * \u8BA1\u7B97\u4E24\u4E2A\u70B9\u4E4B\u95F4\u7684\u8DDD\u79BB\r\n */\r\n calculatedDistance() { \r\n const [{ x: x1, y: y1 }, { x: x2, y: y2 }] = this.points\r\n return Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)\r\n }\r\n \r\n dispose() {\r\n super.dispose()\r\n this.unRegistryEvent()\r\n this.line = null as unknown as SVGElement\r\n this.circles = []\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { BaseSvg } from \"./base-svg\";\r\nimport { setCirclePosition, setLineStartEnd, createLine, createCircle } from '../utils'\r\nimport { Vector3 } from \"three\";\r\n\r\ninterface SvgPolygonEventMap {\r\n 'area': { area: number }\r\n}\r\n\r\nexport class SvgPolygon extends BaseSvg<SvgPolygonEventMap> {\r\n\r\n private circles: SVGElement[] = []\r\n\r\n private lines: SVGElement[] = []\r\n\r\n private isClose = false\r\n\r\n constructor(context: Context) {\r\n super(context)\r\n this.registryEvent()\r\n }\r\n\r\n setEnable(enable: boolean) {\r\n super.setEnable(enable)\r\n if (enable) {\r\n this.registryEvent()\r\n } else {\r\n this.unRegistryEvent()\r\n }\r\n }\r\n\r\n private get lastLine() {\r\n return this.lines.slice(-1)[0]\r\n }\r\n\r\n private addCircle(circle: SVGElement) {\r\n this.circles.push(circle)\r\n this.svg.appendChild(circle)\r\n }\r\n\r\n private addLine(line: SVGElement) {\r\n this.lines.push(line)\r\n this.svg.appendChild(line)\r\n }\r\n\r\n registryEvent() { \r\n this.context.container.addEventListener(\"pointerenter\", this.onPointermove)\r\n this.context.container.addEventListener(\"pointermove\", this.onPointermove)\r\n this.context.container.addEventListener(\"pointerleave\", this.onPointerleave)\r\n this.context.container.addEventListener(\"pointerdown\", this.onPointerdown)\r\n this.context.addEventListener(\"update\", this.onUpdate)\r\n }\r\n \r\n unRegistryEvent() { \r\n this.context.container.removeEventListener(\"pointerenter\", this.onPointermove)\r\n this.context.container.removeEventListener(\"pointermove\", this.onPointermove)\r\n this.context.container.removeEventListener(\"pointerleave\", this.onPointerleave)\r\n this.context.container.removeEventListener(\"pointerdown\", this.onPointerdown)\r\n this.context.removeEventListener(\"update\", this.onUpdate)\r\n }\r\n\r\n onUpdate = () => {\r\n if (this.points.length) {\r\n this.points.forEach((point, index) => {\r\n const devicePoint = this.getSvgCoordinate(point)\r\n if (this.circles[index]) {\r\n setCirclePosition(this.circles[index], devicePoint.x, devicePoint.y)\r\n }\r\n if (index !== 0) {\r\n setLineStartEnd(this.lines[index - 1], undefined, devicePoint)\r\n }\r\n if (this.lines[index]) {\r\n setLineStartEnd(this.lines[index], devicePoint)\r\n }\r\n }) \r\n }\r\n }\r\n \r\n \r\n onPointermove = (e: PointerEvent) => { \r\n // \u5FC5\u987B\u8981\u6709\u4E00\u4E2A\u70B9\u5E76\u4E14\u8FD8\u6CA1\u6709\u95ED\u5408\u624D\u9700\u8981\u5904\u7406\r\n if (!this.lastLine || this.isClose) { return }\r\n this.lastLine.style.display = \"block\";\r\n setLineStartEnd(this.lastLine, undefined, { x: e.offsetX, y: e.offsetY })\r\n }\r\n \r\n onPointerleave = () => { \r\n // \u5982\u679C\u5DF2\u7ECF\u95ED\u5408\u4E86\u5C31\u4E0D\u9700\u8981\u5904\u7406\u4E86\r\n if (this.isClose) { return } \r\n this.lastLine.style.display = \"none\";\r\n }\r\n \r\n onPointerdown = (e: PointerEvent) => {\r\n // \u5982\u679C\u5DF2\u7ECF\u95ED\u5408\u4E86\r\n if (this.isClose) { return }\r\n const point = this.getIntersectByPointerEvent(e)\r\n if (point) {\r\n const { offsetX: x, offsetY: y } = e\r\n if (this.checkAdsorb(x, y)) {\r\n this.isClose = true\r\n this.addPoint(this.points[0])\r\n } else {\r\n this.addPoint(point)\r\n }\r\n const { circle: { fill, radius }, line: { stroke } } = this.context.config.svg\r\n if (!this.isClose) {\r\n // \u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u70B9\r\n const circle = createCircle(radius, fill)\r\n setCirclePosition(circle, x, y)\r\n this.addCircle(circle)\r\n }\r\n if (this.lines.length) {\r\n // \u5982\u679C\u5DF2\u7ECF\u6709\u4E00\u6761\u7EBF\u4E86 \u8981\u95ED\u5408\u8FD9\u6761\u7EBF\r\n setLineStartEnd(this.lastLine, undefined, { x, y })\r\n }\r\n // \u5982\u679C\u8FD9\u4E2A\u591A\u8FB9\u5F62\u8FD8\u6CA1\u6709\u95ED\u5408 \u5C31\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684\u7EBF \u5305\u62EC\u521B\u5EFA\u7B2C\u4E00\u6761\u7EBF\r\n if (!this.isClose) {\r\n const line = createLine(stroke)\r\n // \u8BBE\u7F6E\u7EBF\u7684\u8D77\u59CB\u70B9\r\n setLineStartEnd(line, { x, y }, { x, y })\r\n this.addLine(line)\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * \u68C0\u6D4B\u662F\u5426\u53EF\u4EE5\u5438\u9644\r\n * \u5750\u6807\u70B9\u6700\u5C113\u4E2A \u4F20\u5165\u7684\u5750\u6807\u70B9\u548C\u7B2C\u4E00\u4E2A\u5750\u6807\u7684\u50CF\u7D20\u76F8\u5DEE\u4E0D\u8D85\u8FC75\u4E2A\u50CF\u7D20\r\n */\r\n checkAdsorb(x: number, y: number) {\r\n if (this.points.length < 3) { return false }\r\n const circle = this.circles[0]\r\n const cx = +circle.getAttribute(\"cx\")!\r\n const cy = +circle.getAttribute(\"cy\")!\r\n return Math.sqrt((x - cx) ** 2 + (y - cy) ** 2) <= 5\r\n }\r\n\r\n addPoint(vector: Vector3) {\r\n this.points.push(vector)\r\n if (this.isClose) {\r\n const area = this.calculatedArea()\r\n this.dispatchEvent({ type: 'area', area })\r\n }\r\n }\r\n // \u8BA1\u7B97\u9762\u79EF\r\n calculatedArea() {\r\n const cds = this.points.map(item => [item.x, item.y])\r\n let area = 0\r\n const numPoints = cds.length\r\n for (let i = 0; i < numPoints; i++) {\r\n const j = (i + 1) % numPoints\r\n area += (cds[i][0] * cds[j][1] - cds[j][0] * cds[i][1])\r\n }\r\n return Math.abs(area / 2)\r\n }\r\n\r\n dispose() {\r\n super.dispose()\r\n this.unRegistryEvent()\r\n this.lines = []\r\n this.circles = []\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Box3 } from \"three\";\r\nimport { vector3ToDevice, createRect, setRectPosition } from '../utils'\r\nimport { BaseSvg } from './base-svg'\r\nimport { Graphic } from \"./graphic\";\r\n\r\ninterface SvgLineEventMap {\r\n 'distance': { distance: number }\r\n}\r\n\r\nexport class SelectBox extends BaseSvg<SvgLineEventMap> {\r\n\r\n private rect!: SVGElement\r\n\r\n private cornerRect: SVGElement[] = [] // \u56DB\u4E2A\u89D2\u4E0A\u7684\u65B9\u5757\r\n\r\n private centerRect: SVGElement[] = [] // \u56DB\u4E2A\u7EBF\u4E2D\u95F4\u7684\u65B9\u5757\r\n\r\n private graphic?: Graphic\r\n\r\n constructor(public context: Context) {\r\n super(context)\r\n const { config: { svg: { line } } } = context\r\n this.rect = createRect(line.stroke, \"transparent\")\r\n this.svg.appendChild(this.rect)\r\n for (let i = 0; i < 4; i++) {\r\n this.cornerRect[i] = createRect(line.stroke, \"#ffffff\")\r\n this.centerRect[i] = createRect(line.stroke, \"#ffffff\")\r\n this.svg.appendChild(this.cornerRect[i])\r\n this.svg.appendChild(this.centerRect[i])\r\n }\r\n this.registryEvent()\r\n }\r\n\r\n setEnable(enable: boolean) {\r\n super.setEnable(enable)\r\n if (enable) {\r\n this.registryEvent()\r\n } else {\r\n this.unRegistryEvent()\r\n }\r\n }\r\n\r\n registryEvent() { \r\n this.context.addEventListener(\"update\", this.onUpdate)\r\n }\r\n \r\n unRegistryEvent() { \r\n this.context.removeEventListener(\"update\", this.onUpdate)\r\n }\r\n\r\n onUpdate = () => {\r\n if (!this.graphic) {\r\n setRectPosition(this.rect, 0, 0, 0, 0)\r\n for (let i = 0; i < this.cornerRect.length; i++) {\r\n setRectPosition(this.cornerRect[i], 0, 0, 0, 0)\r\n setRectPosition(this.centerRect[i], 0, 0, 0, 0)\r\n }\r\n } else {\r\n const box = new Box3().setFromObject(this.graphic)\r\n const { camera, container: { clientWidth: w, clientHeight: h } } = this.context\r\n const { min, max } = box\r\n const leftBottom = vector3ToDevice(min, camera, w, h)\r\n const rightTop = vector3ToDevice(max, camera, w, h)\r\n // \u753B\u51FA\u4E00\u4E2A\u6846\u6765\r\n setRectPosition(this.rect, leftBottom.x, rightTop.y, Math.abs(rightTop.x - leftBottom.x), Math.abs(rightTop.y - leftBottom.y))\r\n // \u56DB\u4E2A\u89D2\u7684\u4F4D\u7F6E\r\n const { x: left, y: bottom } = leftBottom\r\n const { x: right, y: top } = rightTop\r\n const halfWidth = 5;\r\n const corners = [\r\n { x: left - halfWidth, y: top - halfWidth }, // \u5DE6\u4E0A\u89D2\r\n { x: right - halfWidth, y: top - halfWidth }, // \u53F3\u4E0A\u89D2\r\n { x: left - halfWidth, y: bottom - halfWidth }, // \u5DE6\u4E0B\u89D2\r\n { x: right - halfWidth, y: bottom - halfWidth }, // \u53F3\u4E0B\u89D2 \r\n ]\r\n for (let i = 0; i < corners.length; i++) {\r\n setRectPosition(this.cornerRect[i], corners[i].x, corners[i].y, halfWidth * 2, halfWidth * 2)\r\n }\r\n // \u56DB\u4E2A\u4E2D\u95F4\u7684\u4F4D\u7F6E\r\n const centerHalfWidth = 4;\r\n const centerX = (left + right) / 2\r\n const centerY = (bottom + top) / 2\r\n const centers = [\r\n { x: centerX - centerHalfWidth, y: top - centerHalfWidth }, // \u4E0A\r\n { x: left - centerHalfWidth, y: centerY - centerHalfWidth }, // \u5DE6\r\n { x: right - centerHalfWidth, y: centerY - centerHalfWidth }, // \u53F3\r\n { x: centerX - centerHalfWidth, y: bottom - centerHalfWidth }, // \u4E0B\r\n ]\r\n for (let i = 0; i < centers.length; i++) {\r\n setRectPosition(this.centerRect[i], centers[i].x, centers[i].y, centerHalfWidth * 2, centerHalfWidth * 2)\r\n }\r\n }\r\n }\r\n \r\n selectGraphic(graphic: Graphic) { \r\n this.graphic = graphic\r\n }\r\n\r\n dispose() {\r\n super.dispose()\r\n this.unRegistryEvent()\r\n this.rect = null as unknown as SVGElement\r\n this.cornerRect = []\r\n this.centerRect = []\r\n }\r\n}", "import { createRect, isContain, setRectPosition, vector3ToDevice } from \"../../utils\";\r\nimport { Context } from \"../../context\";\r\nimport { BaseSvg, Graphic } from \"../../elements\";\r\nimport { Frustum, Vector3 } from \"three\";\r\n\r\ninterface BoxSelectionEventMap { \r\n \"selected\": {\r\n list: Graphic[]\r\n }\r\n}\r\n\r\nexport class BoxSelection extends BaseSvg<BoxSelectionEventMap> {\r\n\r\n private startPoint?: Vector3;\r\n\r\n private endPoint?: Vector3;\r\n\r\n rect: SVGElement;\r\n\r\n frustum = new Frustum();\r\n\r\n constructor(context: Context) { \r\n super(context);\r\n const { config: { selectBox: { fill, stroke } } } = context\r\n this.rect = createRect(stroke, fill)\r\n this.svg.appendChild(this.rect)\r\n this.registryEvent()\r\n }\r\n\r\n setEnable(enable: boolean): void {\r\n super.setEnable(enable)\r\n setRectPosition(this.rect, 0, 0, 0, 0)\r\n if (enable) {\r\n this.registryEvent()\r\n } else {\r\n this.startPoint = undefined\r\n this.unRegistryEvent()\r\n }\r\n }\r\n\r\n onPointerDown = (e: PointerEvent) => { \r\n if (!this.enable) { return }\r\n const point = this.getIntersectByPointerEvent(e)\r\n if (point) { \r\n this.startPoint = point\r\n }\r\n this.endPoint = undefined;\r\n }\r\n\r\n onPointerMove = (e: PointerEvent) => { \r\n if (!this.enable || !this.startPoint) { return }\r\n const point = this.getIntersectByPointerEvent(e)\r\n if (point) { \r\n this.endPoint = point\r\n }\r\n }\r\n\r\n onPointerUp = (e: PointerEvent) => { \r\n if (!this.enable) { return }\r\n const point = this.getIntersectByPointerEvent(e)\r\n if (point) { \r\n this.endPoint = point\r\n }\r\n this.doSelect()\r\n this.startPoint = undefined\r\n }\r\n\r\n onUpdate = () => {\r\n if (this.startPoint) {\r\n const startPoint = this.getSvgCoordinate(this.startPoint)\r\n let endPoint = { ...startPoint }\r\n if (this.endPoint) {\r\n endPoint = this.getSvgCoordinate(this.endPoint)\r\n }\r\n const leftTop = { x: Math.min(startPoint.x, endPoint.x), y: Math.min(startPoint.y, endPoint.y) }\r\n const width = Math.abs(endPoint.x - startPoint.x)\r\n const height = Math.abs(endPoint.y - startPoint.y)\r\n setRectPosition(this.rect, leftTop.x, leftTop.y, width, height)\r\n } else {\r\n setRectPosition(this.rect, 0, 0, 0, 0)\r\n }\r\n }\r\n\r\n registryEvent() { \r\n this.context.container.addEventListener(\"pointerdown\", this.onPointerDown)\r\n this.context.container.addEventListener(\"pointermove\", this.onPointerMove)\r\n this.context.container.addEventListener(\"pointerup\", this.onPointerUp)\r\n this.context.addEventListener(\"update\", this.onUpdate)\r\n }\r\n \r\n unRegistryEvent() { \r\n this.context.container.removeEventListener(\"pointerdown\", this.onPointerDown)\r\n this.context.container.removeEventListener(\"pointermove\", this.onPointerMove)\r\n this.context.container.removeEventListener(\"pointerup\", this.onPointerUp)\r\n this.context.removeEventListener(\"update\", this.onUpdate)\r\n }\r\n\r\n doSelect() { \r\n if (this.startPoint && this.endPoint) {\r\n const dis = this.startPoint.distanceTo(this.endPoint);\r\n if (dis < 0.1) { return }\r\n const { context: { camera, container: { clientWidth: w, clientHeight: h } } } = this\r\n const startDevice = vector3ToDevice(this.startPoint!, camera, w, h)\r\n const endDevice = vector3ToDevice(this.endPoint!, camera, w, h)\r\n const leftTop = { x: Math.min(startDevice.x, endDevice.x), y: Math.min(startDevice.y, endDevice.y) }\r\n const rightBottom = { x: Math.max(startDevice.x, endDevice.x), y: Math.max(startDevice.y, endDevice.y) }\r\n const list = this.searchMapInFrustum(leftTop, rightBottom);\r\n this.dispatchEvent({ type: \"selected\", list })\r\n }\r\n }\r\n\r\n searchMapInFrustum(leftTop: { x: number, y: number }, rightBottom: { x: number, y: number }): Graphic[] {\r\n const { context } = this\r\n return context.currentFloor?.graphicLayer.children.filter(item => {\r\n return item instanceof Graphic && this.searchChildInFrustum(item, leftTop, rightBottom)\r\n }) as Graphic[] || []\r\n }\r\n\r\n searchChildInFrustum(object: Graphic, leftTop: { x: number, y: number }, rightBottom: { x: number, y: number }): boolean {\r\n const { context: { camera, container: { clientWidth: w, clientHeight: h } } } = this\r\n if (!object) return false;\r\n if (!object.mesh) { \r\n // \u70B9\r\n const position = object.getPosition()\r\n if (position) {\r\n const position2d = vector3ToDevice(position, camera, w, h)\r\n return isContain(position2d, leftTop, rightBottom)\r\n }\r\n return false\r\n }\r\n if (!object.mesh.geometry.boundingBox) {\r\n object.mesh.geometry.computeBoundingBox();\r\n }\r\n const box = object.mesh.geometry.boundingBox;\r\n if (!box) { return false }\r\n const { min, max } = box\r\n const minDevice = vector3ToDevice(min, camera, w, h)\r\n const maxDevice = vector3ToDevice(max, camera, w, h)\r\n \r\n if (!isContain(minDevice, leftTop, rightBottom)) { return false }\r\n if (!isContain(maxDevice, leftTop, rightBottom)) { return false; }\r\n return true;\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent()\r\n }\r\n}\r\n\r\n", "import { Graphic, Poi } from \"../../elements\";\r\nimport { Context } from \"../../context\";\r\nimport { EventDispatcher } from \"three\";\r\nimport { Timer } from \"../../utils\";\r\n\r\ninterface HoverHelperEventMap {\r\n \"hover-change\": {\r\n graphics: Graphic[]\r\n },\r\n}\r\n\r\nexport class HoverHelper extends EventDispatcher<HoverHelperEventMap> { \r\n\r\n curGraphics = new Set<Graphic>()\r\n\r\n timer = new Timer()\r\n\r\n graphicTimerMap = new Map<Graphic, number>()\r\n \r\n constructor(private context: Context) {\r\n super()\r\n this.registryEvent()\r\n }\r\n\r\n onPointerMove = ({ graphics, pois, e }: { graphics: Graphic[], pois: Poi[], e: PointerEvent }) => {\r\n const poiGraphics = pois\r\n .map(item => this.context.currentFloor?.graphicLayer.graphicMap.get(item.options.id))\r\n .filter(graphic => graphic && graphic.options.geometry.type === \"point\") as Graphic[]\r\n if (!graphics.length && !poiGraphics.length && this.curGraphics.size) {\r\n this.curGraphics.clear()\r\n this.handleHoverGraphicsChange()\r\n return\r\n }\r\n const { time } = this.context.config.hover\r\n const allGraphics = new Set<Graphic>()\r\n if (poiGraphics.length) { \r\n // \u627E\u79BB\u4E2D\u5FC3\u70B9\u6700\u65B0\u7684\u90A3\u4E2A\r\n let resGraphic: Graphic;\r\n let distance = 10000;\r\n poiGraphics.forEach(graphic => { \r\n const poi = pois.find(poi => poi.options.id === graphic.options.id)!\r\n const { x, y } = poi.clientPos\r\n let curDistance = Math.sqrt((x - e.offsetX) ** 2 + (y - e.offsetY) ** 2)\r\n if (curDistance < distance) {\r\n distance = curDistance\r\n resGraphic = graphic\r\n }\r\n })\r\n allGraphics.add(resGraphic!)\r\n }\r\n if (!allGraphics.size) { \r\n graphics.forEach(graphic => allGraphics.add(graphic))\r\n }\r\n allGraphics.forEach((graphic) => {\r\n // \u5982\u679C\u5DF2\u7ECF\u6709hover\u7684\u5B9A\u65F6\u5668\u5728\u6267\u884C\u4E86\u5C31\u8FD4\u56DE\r\n if (this.graphicTimerMap.get(graphic)) { \r\n return\r\n }\r\n // \u5982\u679C\u8FD9\u4E2A\u5143\u7D20\u7684hover\u5DF2\u7ECF\u89E6\u53D1\u8FC7\u4E86\u5C31\u8FD4\u56DE\r\n if (this.curGraphics.has(graphic)) { \r\n return\r\n }\r\n // \u8FD9\u4E2A\u5143\u7D20\u6CA1\u6709\u89E6\u53D1\u8FC7\u4E5F\u6CA1\u6709\u5B9A\u65F6\u5668\u5C31\u6DFB\u52A0\u4E00\u4E2A\u5B9A\u65F6\u5668\r\n const timer = this.timer.setTimeout(() => {\r\n this.curGraphics.add(graphic)\r\n this.graphicTimerMap.delete(graphic)\r\n this.timer.clearTimeout(timer)\r\n this.handleHoverGraphicsChange()\r\n }, time)\r\n this.graphicTimerMap.set(graphic, timer)\r\n })\r\n // \u5982\u679C\u5B9A\u65F6\u5668\u7684\u5143\u7D20\u4E0D\u5B58\u5728\u5728\u5F53\u524Dgraphics\u4E2D\u4E86\u5C31\u5220\u9664\r\n this.graphicTimerMap.forEach((timer, graphic) => { \r\n if (!allGraphics.has(graphic)) { \r\n this.timer.clearTimeout(timer)\r\n this.graphicTimerMap.delete(graphic)\r\n }\r\n })\r\n // \u5982\u679C\u5DF2\u7ECFhover\u7684\u5143\u7D20\u4E0D\u5B58\u5728\u5728\u5F53\u524D\u7684graphics\u4E86\u5C31\u5220\u9664\r\n const size = this.curGraphics.size\r\n this.curGraphics.forEach((graphic) => { \r\n if (!allGraphics.has(graphic)) { \r\n this.curGraphics.delete(graphic)\r\n }\r\n })\r\n // \u5982\u679C\u6709\u5220\u9664\u5C31\u89E6\u53D1\u4E8B\u4EF6\r\n if (size !== this.curGraphics.size) {\r\n this.handleHoverGraphicsChange()\r\n }\r\n }\r\n\r\n onPointerLevel = () => {\r\n this.curGraphics.clear()\r\n this.handleHoverGraphicsChange()\r\n }\r\n\r\n handleHoverGraphicsChange(graphics = this.curGraphics) { \r\n this.dispatchEvent({ type: 'hover-change', graphics: Array.from(graphics) })\r\n }\r\n\r\n registryEvent() {\r\n this.context.addEventListener(\"pointer-over\", this.onPointerMove)\r\n this.context.addEventListener(\"pointer-move\", this.onPointerMove)\r\n this.context.addEventListener(\"pointer-level\", this.onPointerLevel)\r\n }\r\n\r\n unRegistryEvent() {\r\n this.context.removeEventListener(\"pointer-over\", this.onPointerMove)\r\n this.context.removeEventListener(\"pointer-move\", this.onPointerMove)\r\n this.context.removeEventListener(\"pointer-level\", this.onPointerLevel)\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent()\r\n this.timer.dispose()\r\n }\r\n}", "import { Context } from \"../context\";\r\nimport { Color, LineBasicMaterial, MeshStandardMaterial, MeshBasicMaterial } from \"three\";\r\n\r\ninterface LineMaterialOptions {\r\n color: string;\r\n opacity: number;\r\n}\r\n\r\ninterface MeshStandardMaterialOptions {\r\n color: string,\r\n opacity: number,\r\n}\r\n\r\ninterface MeshBasicMaterialOptions {\r\n color: string,\r\n opacity: number,\r\n}\r\n\r\nexport class MaterialFactory {\r\n\r\n private lineMaterialMap = new Map<string, LineBasicMaterial>()\r\n\r\n private meshStandardMaterialMap = new Map<string, MeshStandardMaterial>()\r\n\r\n private meshBasicMaterialMap = new Map<string, MeshBasicMaterial>()\r\n\r\n constructor(private context: Context) {\r\n\r\n }\r\n\r\n generateLineMaterialKey({ color, opacity }: LineMaterialOptions) { \r\n return `${color}-${opacity}`;\r\n }\r\n\r\n createLineMaterial({ color, opacity }: LineMaterialOptions) {\r\n const key = this.generateLineMaterialKey({ color, opacity })\r\n if (this.lineMaterialMap.has(key)) {\r\n return this.lineMaterialMap.get(key)!\r\n }\r\n const lineMaterial = new LineBasicMaterial({\r\n color: color,\r\n transparent: true,\r\n opacity: opacity\r\n })\r\n this.lineMaterialMap.set(key, lineMaterial);\r\n return lineMaterial\r\n }\r\n\r\n createMeshStandardMaterial({ color, opacity }: MeshStandardMaterialOptions) {\r\n const key = `${color}-${opacity}`;\r\n if (this.meshStandardMaterialMap.has(key)) {\r\n return this.meshStandardMaterialMap.get(key)!\r\n }\r\n const material = new MeshStandardMaterial({\r\n color: color,\r\n roughness: 1,\r\n transparent: true,\r\n opacity: opacity,\r\n depthWrite: true,\r\n })\r\n this.meshStandardMaterialMap.set(key, material);\r\n return material;\r\n }\r\n\r\n createMeshBasicMaterial({ color, opacity }: MeshBasicMaterialOptions) {\r\n const key = `${color}-${opacity}`;\r\n if (this.meshBasicMaterialMap.has(key)) {\r\n return this.meshBasicMaterialMap.get(key)!\r\n }\r\n const material = new MeshBasicMaterial({\r\n color: color,\r\n transparent: true,\r\n opacity: opacity,\r\n depthWrite: true,\r\n })\r\n this.meshBasicMaterialMap.set(key, material);\r\n return material;\r\n }\r\n\r\n dispose() { \r\n this.lineMaterialMap.forEach((val, _) => { \r\n val.dispose()\r\n })\r\n this.lineMaterialMap.clear()\r\n this.meshStandardMaterialMap.forEach((val, _) => { \r\n val.dispose()\r\n })\r\n this.meshStandardMaterialMap.clear();\r\n this.meshBasicMaterialMap.forEach((val, _) => { \r\n val.dispose()\r\n })\r\n this.meshBasicMaterialMap.clear()\r\n }\r\n \r\n}", "import { Box3, Vector3 } from \"three\";\r\nimport { Context } from \"../context\";\r\nimport { vector3ToDevice } from \"./coordinate\";\r\n\r\nexport class CameraBound {\r\n private prevCamera = {\r\n position: new Vector3(),\r\n zoom: 1,\r\n target: new Vector3()\r\n }\r\n\r\n private enable = true;\r\n\r\n constructor(private context: Context) {\r\n this.registryEvent()\r\n this.changePrevCamera()\r\n }\r\n\r\n setEnable(enable: boolean) {\r\n this.enable = enable;\r\n if (enable) {\r\n this.registryEvent()\r\n } else {\r\n this.unRegistryEvent()\r\n }\r\n }\r\n\r\n changePrevCamera() {\r\n this.prevCamera = {\r\n position: this.context.camera.position.clone(),\r\n zoom: this.context.camera.zoom,\r\n target: this.context.control.target.clone()\r\n }\r\n }\r\n\r\n backToPrevCamera() {\r\n this.setEnable(false)\r\n this.context.camera.position.copy(this.prevCamera.position)\r\n this.context.camera.zoom = this.prevCamera.zoom;\r\n this.context.control.target.copy(this.prevCamera.target)\r\n this.context.control.update()\r\n this.setEnable(true)\r\n }\r\n\r\n registryEvent() { \r\n this.context.addEventListener(\"control-change\", this.onCameraChange)\r\n }\r\n\r\n unRegistryEvent() {\r\n this.context.removeEventListener(\"control-change\", this.onCameraChange)\r\n }\r\n\r\n getCurFloorScreenPosition() {\r\n if (!this.context.currentFloor) {\r\n return null\r\n }\r\n const box = new Box3().setFromObject(this.context.currentFloor.groundUpper);\r\n const { camera, container: { clientWidth: w, clientHeight: h } } = this.context\r\n const { min, max } = box\r\n const lb = vector3ToDevice(min, camera, w, h)\r\n const rt = vector3ToDevice(max, camera, w, h)\r\n const lt = vector3ToDevice(new Vector3(min.x, max.y, max.z), camera, w, h)\r\n const rb = vector3ToDevice(new Vector3(max.x, min.y, min.z), camera, w, h)\r\n const left = Math.min(lb.x, rt.x, lt.x, rb.x)\r\n const right = Math.max(lb.x, rt.x, lt.x, rb.x)\r\n const top = Math.min(lb.y, rt.y, lt.y, rb.y)\r\n const bottom = Math.max(lb.y, rt.y, lt.y, rb.y)\r\n return { left, right, top, bottom }\r\n }\r\n\r\n /**\r\n * \u68C0\u6D4B\u5730\u56FE\u662F\u4E0D\u662F\u5728\u663E\u793A\u8303\u56F4\r\n * @param param0 \r\n * @returns \r\n */\r\n checkDistanceToScreenEdge({ left, right, top, bottom }: { left: number, right: number, top: number, bottom: number }) { \r\n const { width, height } = this.context.clientSize\r\n const [pt, pr, pb, pl] = this.context.config.cameraBound.padding\r\n // console.log(left, left <= pl , width - right, width - right <= pr , top <= pt , height - bottom <= pb)\r\n // \u6240\u6709\u7684\u8FB9\u90FD\u4E0D\u8D85\u51FA\r\n return (left <= pl && width - right <= pr && top <= pt && height - bottom <= pb)\r\n }\r\n\r\n onCameraChange = () => {\r\n // \u5224\u65AD\u5982\u679C\u8D85\u51FA\u5C31\u7528\u4E4B\u524D\u7684prevCamera\r\n // \u83B7\u53D6\u5730\u56FE\u7684\u5C4F\u5E55\u4F4D\u7F6E\r\n // \u5148\u4E0D\u505A\u8FB9\u754C\u5224\u65AD\r\n // const bound = this.getCurFloorScreenPosition();\r\n // if (bound) {\r\n // const { left, right, top, bottom } = bound\r\n // const isInBound = this.checkDistanceToScreenEdge({ left, right, top, bottom });\r\n // console.log(\"isInBound\", isInBound)\r\n // if (isInBound) {\r\n // this.changePrevCamera()\r\n // } else {\r\n // this.backToPrevCamera()\r\n // }\r\n // }\r\n }\r\n\r\n dispose() {\r\n this.unRegistryEvent()\r\n }\r\n}", "import { merge } from 'lodash'\r\nimport { HeatmapConfiguration } from '@mars3d/heatmap.js'\r\n\r\nexport interface Config {\r\n apiDomain: string,\r\n apiInfo: RequestInit,\r\n apiPath: {\r\n floorGraphic: string,\r\n floorRange: string\r\n },\r\n resizeObserver: boolean;\r\n heatMap: Partial<HeatmapConfiguration>,\r\n useFloorCache: boolean;\r\n control: {\r\n maxPolar: number;\r\n defaultPolar: number;\r\n },\r\n initTransToMark: boolean;\r\n svg: {\r\n circle: {\r\n radius: string;\r\n fill: string;\r\n },\r\n line: {\r\n stroke: string;\r\n }\r\n },\r\n selectBox: {\r\n stroke: string;\r\n fill: string;\r\n },\r\n hover: {\r\n time: number;\r\n },\r\n ground: {\r\n color: string;\r\n opacity: number;\r\n height: number;\r\n stroke: boolean,\r\n strokeColor: string,\r\n strokeOpacity: number\r\n },\r\n markGraphic: {\r\n color: string;\r\n opacity: number;\r\n height: number;\r\n stroke: boolean;\r\n strokeColor: string;\r\n strokeOpacity: number;\r\n },\r\n graphic: {\r\n fillOpacity: number,\r\n },\r\n cameraBound: {\r\n padding: [number, number, number, number]\r\n },\r\n poi: {\r\n boxScale: number;\r\n }\r\n}\r\n\r\nexport const defaultConfig: Config = {\r\n apiDomain: \"\",\r\n apiInfo: {},\r\n apiPath: {\r\n floorGraphic: \"/api/inception-map/floor/get\",\r\n floorRange: \"/api/inception-map/range/get\"\r\n },\r\n resizeObserver: false,\r\n initTransToMark: false,\r\n heatMap: {\r\n radius: 50,\r\n gradient: {\r\n 0: '#8F9FCD',\r\n 0.5: '#6284FF',\r\n 1: '#F95D5D',\r\n },\r\n },\r\n useFloorCache: true,\r\n control: {\r\n maxPolar: 1.2,\r\n defaultPolar: 0.9\r\n },\r\n svg: {\r\n circle: {\r\n radius: \"2\",\r\n fill: \"#1CADFF\"\r\n },\r\n line: {\r\n stroke: \"#1CADFF\"\r\n }\r\n },\r\n selectBox: {\r\n stroke: \"#1CADFF\",\r\n fill: \"rgba(28, 173, 255, 0.3)\"\r\n },\r\n hover: {\r\n time: 100\r\n },\r\n ground: {\r\n color: \"#FAFAFA\",\r\n opacity: 1,\r\n height: 3,\r\n stroke: true,\r\n strokeColor: \"#E6E6E6\",\r\n strokeOpacity: 1\r\n },\r\n markGraphic: {\r\n color: \"#EEF0F3\",\r\n opacity: 1,\r\n height: 0.001,\r\n stroke: false,\r\n strokeColor: \"#000\",\r\n strokeOpacity: 1\r\n },\r\n graphic: {\r\n fillOpacity: 1,\r\n },\r\n cameraBound: {\r\n padding: [150, 150, 150, 150]\r\n },\r\n poi: {\r\n boxScale: 1.0\r\n }\r\n}\r\n\r\nexport function getConfig(config: Partial<Config>): Config {\r\n return merge({}, defaultConfig, config);\r\n}"],
|
|
5
5
|
"mappings": "2/BAAA,IAAAA,GAAmD,WCM5C,IAAMC,EAAN,KAAY,CAAZ,cACLC,EAAA,aAAQ,CACN,iBAAkB,IAAI,IACtB,QAAS,IAAI,IACb,SAAU,IAAI,GAChB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AAY,CAhiBzB,IAAA9B,EAiiBI,OAAOA,EAAA,KAAK,QAAQ,eAAb,YAAAA,EAA2B,SAAS,WAAW8B,EACxD,CAEA,SAAU,CApiBZ,IAAA9B,EAqiBI,SAAQA,EAAA,KAAK,QAAQ,eAAb,YAAAA,EAA2B,SAAS,OAAQ,CAAC,GAAG,OAAOxB,GAAQ,CAACA,EAAK,QAAQ,QAAQ,CAC/F,CAEA,UAAW,CACL,KAAK,QAAQ,cACf,KAAK,QAAQ,aAAa,SAAS,MAAM,CAE7C,CAEA,oBAAoBc,EAAkB,CACpC,KAAK,QAAQ,UAAU,OAAOA,CAAO,CACvC,CAuBA,SAAU,CACR,KAAK,QAAQ,QAAQ,EACrB,KAAK,aAAa,MAAM,EACxB,KAAK,kBAAkB,MAAM,EAC7ByC,GAAiB,EACjBC,GAAY,EACZC,GAAc,EACd,KAAK,gBAAgB,CACvB,CACF",
|
|
6
6
|
"names": ["import_three", "Timer", "__publicField", "fn", "timer", "wait", "import_three", "import_MapControls", "initScene", "scene", "initRenderer", "renderer", "initCamera", "width", "height", "camera", "initLight", "lights", "ambientLight", "initControl", "domElement", "control", "initShape", "path", "holePath", "shape", "item", "cur", "hole", "initDirectionalLight", "color", "intensity", "directionalLight", "dispose", "o", "recursive", "_a", "child", "m", "mat", "hasChinese", "str", "import_three", "textTextureMap", "initCanvas", "canvas", "ctx", "createCanvas", "c", "t", "getTextureByText", "text", "y", "hasChinese", "width", "imageData", "texture", "clearTextTexture", "clearCanvas", "import_three", "import_turf", "vector3ToDevice", "vector", "camera", "w", "h", "_vector", "_w", "_h", "x", "y", "getCenter", "coordinates", "features", "item", "isContain", "point", "start", "end", "getLongestSideDir", "cds", "maxDistance", "dir", "i", "point_0", "point_1", "distance", "proxyOptions", "target", "master", "p", "receiver", "newValue", "oldValue", "res", "timeoutPromise", "promise", "timeout", "resolve", "reject", "createSvgElement", "tag", "createSvg", "w", "h", "svg", "createCircle", "radius", "fill", "circle", "createLine", "stroke", "line", "createRect", "rect", "setCirclePosition", "x", "y", "setLineStartEnd", "start", "end", "setRectPosition", "sleepOnePromise", "sleepOneRf", "resolve", "strToNumber", "str", "addAlphaToHexColor", "hexColor", "alpha", "r", "g", "b", "newR", "newG", "newB", "darkenColor", "factor", "import_GLTFLoader", "createLoader", "loader", "modelMap", "loadModel", "url", "gltf", "p", "resolve", "reject", "disposeLoader", "isMac", "isControl", "key", "isMac", "import_three", "import_tween", "import_three", "import_three", "defaultOptions", "Graphic", "context", "options", "__publicField", "proxyOptions", "__spreadValues", "x", "y", "value", "_a", "center", "box", "size", "shape", "initShape", "material", "material1", "darkenColor", "lineMaterial", "points", "height", "cds", "j", "curCds", "i", "cur", "next", "lineGeometry", "line", "raycaster", "intersects", "position", "distance", "import_three", "Shadow", "__publicField", "directionalLight", "initDirectionalLight", "size", "x", "y", "color", "position", "width", "height", "geometry", "material", "mesh", "target", "opacity", "dispose", "import_three", "import_three", "defaultOptions", "Overlay", "context", "options", "__publicField", "vector", "width", "height", "clientX", "clientY", "x", "y", "vector3ToDevice", "__spreadValues", "div", "element", "visible", "display", "opacity", "_a", "defaultOptions", "Poi", "context", "options", "_a", "_b", "_c", "__publicField", "proxyOptions", "__spreadValues", "Overlay", "x", "y", "height", "value", "__async", "sleepOnePromise", "width", "div", "textDiv", "f", "item", "key", "img", "visible", "boxScale", "w", "h", "box", "import_three", "import_three", "import_three", "Layer", "context", "dispose", "GraphicLayer", "Layer", "context", "__publicField", "options", "graphic", "Graphic", "id", "raycaster", "initData", "data", "res", "item", "pos", "distance", "import_lodash", "PoiLayer", "Layer", "context", "__publicField", "Timer", "force", "item", "options", "poi", "Poi", "index", "id", "i", "x", "y", "range", "left", "right", "top", "bottom", "valid", "box", "import_three", "import_heatmap", "import_turf", "HeatmapElement", "context", "__publicField", "data", "width", "height", "leftTop", "center", "__spreadValues", "geometry", "texture", "material", "x", "y", "matrix", "item", "vector", "features", "box", "getCenter", "import_three", "Model", "context", "options", "__publicField", "__async", "object", "loadModel", "_a", "poi", "dispose", "Floor", "context", "__publicField", "Shadow", "GraphicLayer", "PoiLayer", "options", "ground", "Graphic", "grounds", "model", "Model", "box", "center", "size", "graphicOptions", "poiOptions", "data", "HeatmapElement", "opacity", "visible", "_a", "import_three", "BaseSvg", "context", "__publicField", "width", "height", "createSvg", "enable", "e", "camera", "renderer", "x", "y", "clientWidth", "clientHeight", "nx", "ny", "vector", "container", "vector3ToDevice", "SvgLine", "BaseSvg", "context", "__publicField", "point1", "setCirclePosition", "setLineStartEnd", "point2", "e", "point", "x", "y", "circle", "line", "createCircle", "createLine", "enable", "vector", "distance", "x1", "y1", "x2", "y2", "__pow", "SvgPolygon", "BaseSvg", "context", "__publicField", "point", "index", "devicePoint", "setCirclePosition", "setLineStartEnd", "e", "x", "y", "fill", "radius", "stroke", "circle", "createCircle", "line", "createLine", "enable", "cx", "cy", "__pow", "vector", "area", "cds", "item", "numPoints", "i", "j", "import_three", "SelectBox", "BaseSvg", "context", "__publicField", "box", "camera", "w", "h", "min", "max", "leftBottom", "vector3ToDevice", "rightTop", "setRectPosition", "left", "bottom", "right", "top", "halfWidth", "corners", "i", "centerHalfWidth", "centerX", "centerY", "centers", "line", "createRect", "enable", "graphic", "import_three", "BoxSelection", "BaseSvg", "context", "__publicField", "e", "point", "startPoint", "endPoint", "__spreadValues", "leftTop", "width", "height", "setRectPosition", "fill", "stroke", "createRect", "enable", "camera", "w", "h", "startDevice", "vector3ToDevice", "endDevice", "rightBottom", "list", "_a", "item", "Graphic", "object", "position", "position2d", "isContain", "box", "min", "max", "minDevice", "maxDevice", "Selection", "context", "__publicField", "e", "offsetX", "offsetY", "x", "y", "__pow", "graphics", "graphicIdSet", "item", "_a", "graphic", "isMac", "isControl", "list", "BoxSelection", "import_three", "HoverHelper", "context", "__publicField", "Timer", "graphics", "pois", "e", "poiGraphics", "item", "_a", "graphic", "time", "allGraphics", "resGraphic", "distance", "poi", "x", "y", "curDistance", "__pow", "timer", "size", "import_three", "MaterialFactory", "context", "__publicField", "color", "opacity", "key", "lineMaterial", "material", "val", "_", "import_three", "CameraBound", "context", "__publicField", "enable", "box", "camera", "w", "h", "min", "max", "lb", "vector3ToDevice", "rt", "lt", "rb", "left", "right", "top", "bottom", "width", "height", "pt", "pr", "pb", "pl", "Context", "container", "config", "__publicField", "initScene", "initRenderer", "initLight", "Timer", "TweenGroup", "camera", "renderer", "w", "h", "e", "graphics", "position", "pois", "isMultipleSelect", "Selection", "HoverHelper", "MaterialFactory", "x", "y", "width", "height", "initCamera", "initControl", "_a", "polarAngle", "CameraBound", "point1", "point2", "clientWidth", "clientHeight", "device1", "vector3ToDevice", "device2", "__pow", "color", "item", "floor", "point", "raycaster", "polar", "duration", "timeoutPromise", "resolve", "start", "end", "tween", "azimuthal", "zoom", "center", "lookAtVector", "object", "padding", "force2DView", "top", "right", "bottom", "left", "boundingBox", "max", "min", "max2d", "min2d", "size", "xScale", "yScale", "scale", "light", "dispose", "import_lodash", "defaultConfig", "getConfig", "config", "import_lodash", "MapTypePolar", "BMap", "container", "config", "__publicField", "zoom", "e", "polar", "azimuthal", "basicZoom", "getConfig", "Context", "_0", "__async", "brand", "project", "phase", "building", "floor", "ts", "resource_type_list", "apiDomain", "floorGraphic", "apiInfo", "url", "res", "item", "key", "floorRange", "data", "floorKey", "buildGround", "center", "getCenter", "cds", "coord", "x", "y", "ground", "markGraphic", "graphic", "i", "curFloor", "Floor", "legacyToGraphicMap", "graphics", "curFloorData", "buildingKey", "createdFloor", "options", "_a", "model", "__spreadProps", "__spreadValues", "facilityAngle", "facilityXScale", "facilityYScale", "Graphic", "position", "ele", "duration", "z", "vector", "clientWidth", "clientHeight", "vector3ToDevice", "type", "time", "cameraZoom", "observe", "keys", "radius", "resolve", "reject", "SvgLine", "dispose", "distance", "SvgPolygon", "area", "nodeId", "id", "clearTextTexture", "clearCanvas", "disposeLoader"]
|
|
7
7
|
}
|