@vesium/plot 1.0.1-beta.25
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/dist/index.cjs +1177 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +424 -0
- package/dist/index.js +1174 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.cjs +2 -0
- package/dist/index.min.cjs.map +1 -0
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/dist/index.min.mjs +2 -0
- package/dist/index.min.mjs.map +1 -0
- package/dist/index.mjs +1177 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +25 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../usePlot/PlotSkeleton.ts","../skeleton/control.ts","../skeleton/interval.ts","../skeleton/intervalNonclosed.ts","../skeleton/moved.ts","../scheme/Billboard.ts","../scheme/Label.ts","../scheme/LineString.ts","../scheme/Polygon.ts","../usePlot/PlotScheme.ts","../usePlot/SampledPlotProperty.ts","../usePlot/Plot.ts","../usePlot/useRender.ts","../usePlot/useSampled.ts","../usePlot/PlotSkeletonEntity.ts","../usePlot/useSkeleton.ts","../usePlot/usePlot.ts"],"sourcesContent":["import type { Nullable } from '@vesium/shared';\nimport type { Cartesian3, Entity, ScreenSpaceEventHandler, Viewer } from 'cesium';\nimport type { CSSProperties, MaybeRef, VNode } from 'vue';\nimport type { SampledPlotPackable, SampledPlotProperty } from './SampledPlotProperty';\n\nexport interface SkeletonDisabledOptions {\n\n /**\n * 当前标绘是否是否正在激活,即正在编辑状态\n */\n active: boolean;\n\n /**\n * 当前标绘是否还在定义态,即还未完成采集\n */\n defining: boolean;\n}\n\nexport interface OnSkeletonClickOptions {\n viewer: Viewer;\n\n /**\n * 当前标绘属性数据\n */\n sample: SampledPlotProperty;\n\n /**\n * 标绘采集到的数据,通过该数据可以获取到当前标绘的所有点位信息\n */\n packable: SampledPlotPackable<any>;\n\n /**\n * 当前标绘是否是否正在激活,即正在编辑状态\n */\n active: boolean;\n\n /**\n * 当前标绘是否还在定义态,即还未完成采集\n */\n defining: boolean;\n\n /**\n * 当前被点击的控制点索引\n */\n index: number;\n\n /**\n * 鼠标点击事件上下文信息\n */\n context: ScreenSpaceEventHandler.PositionedEvent;\n}\n\nexport interface OnSkeletonDragOptions {\n viewer: Viewer;\n\n /***\n * 当前标绘属性数据\n */\n sample: SampledPlotProperty;\n\n /**\n * 标绘采集到的数据,通过该数据可以获取到当前标绘的所有点位信息\n */\n packable: SampledPlotPackable<any>;\n\n /**\n * 当前标绘是否是否正在激活,即正在编辑状态\n */\n active: boolean;\n\n /**\n * 当前被拖拽的控制点索引\n */\n index: number;\n\n /**\n * 鼠标拖拽事件上下文信息\n */\n context: ScreenSpaceEventHandler.MotionEvent;\n\n /**\n * 当前的拖拽状态\n */\n dragging: boolean;\n\n /**\n * 执行是否锁定相机视角\n */\n lockCamera: () => void;\n}\n\nexport interface OnKeyPressedOptions {\n viewer: Viewer;\n\n /**\n * 当前标绘属性数据\n */\n sample: SampledPlotProperty;\n\n /**\n * 标绘采集到的数据,通过该数据可以获取到当前标绘的所有点位信息\n */\n packable: SampledPlotPackable<any>;\n\n /**\n * 当前被点击的控制点索引\n */\n index: number;\n\n /**\n * 被按压的按键事件回调\n */\n keyEvent: KeyboardEvent;\n}\n\n/**\n * 框架点执行状态枚举\n * - IDLE 空闲状态\n * - HOVER 悬停状态\n * - ACTIVE 激活状态\n */\nexport enum PlotAction {\n IDLE = 0,\n HOVER = 1,\n ACTIVE = 2,\n}\n\nexport interface SkeletonRenderOptions {\n /**\n * 标绘采集到的数据,通过该数据可以获取到当前标绘的所有点位信息\n */\n packable: SampledPlotPackable;\n\n /**\n * 所有框架点位集合\n */\n positions: Cartesian3[];\n\n /**\n * 当前渲染的框架点索引\n */\n index: number;\n /**\n * 当前应当渲染的位置\n */\n position: Cartesian3;\n\n /**\n * 当前标绘是否是否正在激活,即正在编辑状态\n */\n active: boolean;\n\n /**\n * 当前标绘是否还在定义态,即还未完成采集\n */\n defining: boolean;\n\n /**\n * 当前框架点执行状态\n */\n action: PlotAction;\n}\n\n/**\n * 控制点配置项\n */\nexport interface PlotSkeleton {\n /**\n * 是否禁用控制点\n */\n diabled?: boolean | ((options: SkeletonDisabledOptions) => boolean);\n /**\n * 实际情况中,并非所有采集都都要渲染对应框架点,通过`format`函数可以过滤掉不需要渲染的点位,另外还可以自定义点位的偏移、增加框架点\n * @param packable 标绘采集到的数据\n */\n format?: (packable: SampledPlotPackable<any>) => Cartesian3[];\n\n /**\n * 点位渲染函数,返回Entity的构造参数,如果不返回任何值则不渲染该点位\n */\n render?: (options: SkeletonRenderOptions) => Entity.ConstructorOptions | undefined;\n\n /**\n * Cursor style when hovering.\n */\n cursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((pick: any) => Nullable<CSSProperties['cursor']>);\n\n /**\n * Cursor style when dragging.\n */\n dragCursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((pick: any) => Nullable<CSSProperties['cursor']>);\n\n /**\n * 鼠标悬停在框架点时显示的提示信息\n */\n tip?: (options: SkeletonRenderOptions) => string | VNode | string | undefined;\n\n /**\n * 框架点鼠标左键点击时的处理逻辑\n */\n onLeftClick?: (options: OnSkeletonClickOptions) => void;\n\n /**\n * 框架点被拖拽时的处理逻辑\n */\n onDrag?: (options: OnSkeletonDragOptions) => void;\n\n /**\n * 键盘按键按下时的处理逻辑\n */\n onKeyPressed?: (options: OnKeyPressedOptions) => void;\n}\n","import type { PlotSkeleton } from '../usePlot/PlotSkeleton';\nimport { canvasCoordToCartesian, toCartesian3, toCartographic } from '@vesium/shared';\nimport { Color } from 'cesium';\nimport { PlotAction } from '../usePlot/PlotSkeleton';\n\n/**\n * 绘制控制的框架点,拖拽时,将更新该控制点的实时位置\n */\nexport function control(): PlotSkeleton {\n return {\n diabled: ({ active }) => !active,\n cursor: 'pointer',\n dragCursor: 'crosshair',\n onDrag({ viewer, sample, packable, context, index, lockCamera }) {\n lockCamera();\n const position = canvasCoordToCartesian(context.endPosition, viewer.scene);\n if (position) {\n const positions = [...packable.positions ?? []];\n positions[index] = position;\n sample.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions,\n });\n }\n },\n\n onKeyPressed({ viewer, keyEvent, sample, packable, index }) {\n const height = toCartographic(viewer!.camera.position)?.height;\n if (!height || !['ArrowUp', 'ArrowRight', 'ArrowDown', 'ArrowLeft'].includes(keyEvent.key))\n return;\n\n keyEvent.preventDefault();\n let headingAdjust = 0;\n switch (keyEvent.key) {\n case 'ArrowRight':\n headingAdjust = Math.PI / 2;\n break;\n case 'ArrowDown':\n headingAdjust = Math.PI;\n break;\n case 'ArrowLeft':\n headingAdjust = -Math.PI / 2;\n break;\n case 'ArrowUp':\n headingAdjust = 0;\n break;\n }\n const newHeading = (viewer.camera.heading + headingAdjust) % (2 * Math.PI);\n const positions = [...packable.positions ?? []];\n const cartographic = toCartographic(positions[index])!;\n const r = height / 100000;\n const distance = r * Math.PI / 180 / 1000;\n\n cartographic.latitude += distance * Math.cos(newHeading);\n cartographic.longitude += distance * Math.sin(newHeading);\n\n positions[index] = toCartesian3(cartographic)!;\n sample.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions,\n });\n },\n render: ({ position, action }) => {\n const colors = {\n [PlotAction.IDLE]: Color.BLUE.withAlpha(0.4),\n [PlotAction.HOVER]: Color.BLUE.withAlpha(0.6),\n [PlotAction.ACTIVE]: Color.AQUA.withAlpha(1),\n };\n return {\n position,\n point: {\n pixelSize: 8,\n color: colors[action],\n disableDepthTestDistance: Number.POSITIVE_INFINITY,\n outlineWidth: 1,\n outlineColor: Color.WHITE.withAlpha(0.4),\n },\n };\n },\n };\n}\n","import type { PlotSkeleton } from '../usePlot/PlotSkeleton';\nimport { canvasCoordToCartesian } from '@vesium/shared';\nimport { Cartesian3, Color } from 'cesium';\nimport { PlotAction } from '../usePlot/PlotSkeleton';\n\n/**\n * 绘制封闭的间隔框架点,如多边形。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。\n */\nexport function interval(): PlotSkeleton {\n let dragIndex = -1;\n return {\n diabled: ({ active, defining }) => !active || defining,\n cursor: 'pointer',\n dragCursor: 'crosshair',\n format(packable) {\n const _positions = packable.positions ?? [];\n if (_positions.length < 2) {\n return [];\n }\n return _positions.map((position, i) => {\n const next = i === _positions.length - 1 ? _positions[0] : _positions[i + 1];\n return Cartesian3.midpoint(position, next, new Cartesian3());\n });\n },\n onDrag({ viewer, sample, packable, context, index, lockCamera, dragging }) {\n lockCamera();\n\n const position = canvasCoordToCartesian(context.endPosition, viewer.scene);\n if (!position) {\n return;\n }\n const positions = [...packable.positions ?? []];\n if (dragIndex === -1) {\n dragIndex = index;\n positions.splice(index + 1, 0, position);\n }\n else {\n positions[dragIndex + 1] = position;\n }\n if (!dragging) {\n dragIndex = -1;\n }\n sample.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions,\n });\n },\n render: ({ position, action, active }) => {\n if (!active) {\n return;\n }\n const colors = {\n [PlotAction.IDLE]: Color.GREEN.withAlpha(0.4),\n [PlotAction.HOVER]: Color.GREEN.withAlpha(0.6),\n [PlotAction.ACTIVE]: Color.GREEN.withAlpha(1.0),\n };\n return {\n position,\n point: {\n pixelSize: 6,\n color: colors[action],\n disableDepthTestDistance: Number.POSITIVE_INFINITY,\n outlineWidth: 1,\n outlineColor: Color.WHITE.withAlpha(0.4),\n },\n };\n },\n };\n}\n","import type { PlotSkeleton } from '../usePlot/PlotSkeleton';\nimport { canvasCoordToCartesian } from '@vesium/shared';\nimport { Cartesian3, Color } from 'cesium';\nimport { PlotAction } from '../usePlot/PlotSkeleton';\n\n/**\n * 绘制非封闭的间隔框架点,如线段。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。\n */\nexport function intervalNonclosed(): PlotSkeleton {\n let dragIndex = -1;\n return {\n diabled: ({ active, defining }) => !active || defining,\n cursor: 'pointer',\n dragCursor: 'crosshair',\n format(packable) {\n const _positions = packable.positions ?? [];\n if (_positions.length < 2) {\n return [];\n }\n return _positions.slice(0, _positions.length - 1).map((position, i) => {\n return Cartesian3.midpoint(position, _positions[i + 1], new Cartesian3());\n });\n },\n onDrag({ viewer, sample, packable, context, index, lockCamera, dragging }) {\n lockCamera();\n const position = canvasCoordToCartesian(context.endPosition, viewer.scene);\n if (!position) {\n return;\n }\n const positions = [...packable.positions ?? []];\n if (dragIndex === -1) {\n dragIndex = index;\n positions.splice(index + 1, 0, position);\n }\n else {\n positions[dragIndex + 1] = position;\n }\n if (!dragging) {\n dragIndex = -1;\n }\n sample.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions,\n });\n },\n render: ({ position, action }) => {\n const colors = {\n [PlotAction.IDLE]: Color.GREEN.withAlpha(0.4),\n [PlotAction.HOVER]: Color.GREEN.withAlpha(0.6),\n [PlotAction.ACTIVE]: Color.GREEN.withAlpha(1.0),\n };\n return {\n position,\n point: {\n pixelSize: 6,\n color: colors[action],\n disableDepthTestDistance: Number.POSITIVE_INFINITY,\n outlineWidth: 1,\n outlineColor: Color.WHITE.withAlpha(0.4),\n },\n };\n },\n };\n}\n","import type { PlotSkeleton } from '../usePlot/PlotSkeleton';\nimport { canvasCoordToCartesian, toCartesian3 } from '@vesium/shared';\nimport { Cartesian3, Color, HorizontalOrigin, Rectangle, VerticalOrigin } from 'cesium';\nimport { PlotAction } from '../usePlot/PlotSkeleton';\n\n// see https://icones.js.org/collection/tabler?s=move&icon=tabler:arrows-move\nconst svg = `data:image/svg+xml;utf8,${encodeURIComponent(\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 24 24\"><path stroke=\"#ffffff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m18 9l3 3l-3 3m-3-3h6M6 9l-3 3l3 3m-3-3h6m0 6l3 3l3-3m-3-3v6m3-15l-3-3l-3 3m3-3v6\"/></svg>',\n)}`;\n\n/**\n * 绘制非封闭的间隔框架点,如线段。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。\n */\nexport function moved(): PlotSkeleton {\n return {\n diabled: ({ active, defining }) => !active || defining,\n cursor: 'pointer',\n dragCursor: 'crosshair',\n format(packable) {\n const positions = packable.positions ?? [];\n if (positions.length === 0) {\n return [];\n }\n else if (positions.length === 1) {\n return [positions[0]];\n }\n else {\n const center = Rectangle.center(Rectangle.fromCartesianArray(positions));\n return [toCartesian3(center)!];\n }\n },\n onDrag({ viewer, sample, packable, context, lockCamera, dragging }) {\n dragging && lockCamera();\n const startPosition = canvasCoordToCartesian(context.startPosition, viewer.scene);\n const endPosition = canvasCoordToCartesian(context.endPosition, viewer.scene);\n\n if (!startPosition || !endPosition) {\n return;\n }\n const offset = Cartesian3.subtract(endPosition, startPosition, new Cartesian3());\n const positions = [...packable.positions ?? []];\n\n sample.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions: positions.map(position => Cartesian3.add(position, offset, new Cartesian3())),\n });\n },\n render: ({ position, action }) => {\n const colors = {\n [PlotAction.IDLE]: Color.WHITE,\n [PlotAction.HOVER]: Color.WHITE,\n [PlotAction.ACTIVE]: Color.AQUA.withAlpha(1.0),\n };\n return {\n position,\n billboard: {\n image: svg,\n width: 20,\n height: 20,\n color: colors[action],\n pixelOffset: new Cartesian3(0, -20),\n horizontalOrigin: HorizontalOrigin.CENTER,\n verticalOrigin: VerticalOrigin.BOTTOM,\n disableDepthTestDistance: Number.POSITIVE_INFINITY,\n },\n };\n },\n };\n}\n","import type { PlotConstructorOptions } from '../usePlot/Plot';\nimport { CallbackPositionProperty, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * 广告牌标绘方案\n */\nexport const PLOT_BILLBOARD_SCHEME: PlotConstructorOptions = {\n scheme: {\n type: 'Billboard',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities?.[0]\n ?? new Entity({\n billboard: { },\n });\n const position = packable.positions?.[0] ?? mouse;\n entity.position = new CallbackPositionProperty(() => position, true);\n\n return {\n entities: [entity],\n };\n },\n },\n};\n","import type { PlotConstructorOptions } from '../usePlot/Plot';\nimport { CallbackPositionProperty, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * 标签文字标绘方案\n */\nexport const PLOT_LABEL_SCHEME: PlotConstructorOptions = {\n scheme: {\n type: 'Label',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities?.[0]\n ?? new Entity({\n label: {\n text: 'Label',\n },\n });\n const position = packable.positions?.[0] ?? mouse;\n entity.position = new CallbackPositionProperty(() => position, true);\n\n return {\n entities: [entity],\n };\n },\n },\n};\n","import type { PlotConstructorOptions } from '../usePlot/Plot';\nimport { CallbackProperty, Entity } from 'cesium';\nimport { control } from '../skeleton/control';\nimport { intervalNonclosed } from '../skeleton/intervalNonclosed';\nimport { moved } from '../skeleton/moved';\n\n/**\n * 内置的线段标绘方案\n */\nexport const PLOT_LINE_STRING_SCHEME: PlotConstructorOptions = {\n scheme: {\n type: 'LineString',\n forceComplete: packable => packable.positions!.length >= 2,\n skeletons: [\n control,\n intervalNonclosed,\n moved,\n ],\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities?.[0]\n ?? new Entity({\n polyline: {\n width: 1,\n },\n });\n entity.polyline!.positions = new CallbackProperty(() => {\n const positions = [...packable.positions ?? []].concat(mouse ? [mouse] : []);\n return positions.length >= 2 ? positions : [];\n }, false);\n\n return {\n entities: [entity],\n };\n },\n },\n};\n","import type { PlotConstructorOptions } from '../usePlot/Plot';\nimport { CallbackProperty, Color, Entity, PolygonHierarchy } from 'cesium';\nimport { control, interval, moved } from '../skeleton';\n\n/**\n * 内置的多边形标绘方案\n */\nexport const PLOT_POLYGON_SCHEME: PlotConstructorOptions = {\n scheme: {\n type: 'Polygon',\n forceComplete: packable => packable.positions!.length >= 3,\n skeletons: [\n control,\n interval,\n moved,\n ],\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities?.[0]\n ?? new Entity({\n polyline: {\n material: Color.YELLOW.withAlpha(0.5),\n },\n polygon: {\n material: Color.YELLOW.withAlpha(0.5),\n },\n });\n\n const positions = [...packable.positions ?? []];\n mouse && positions.push(mouse);\n\n if (positions.length === 2) {\n entity.polygon!.hierarchy = undefined;\n entity.polyline!.positions = new CallbackProperty(() => positions, false);\n }\n else if (positions.length >= 3) {\n entity.polyline!.positions = undefined;\n entity.polygon!.hierarchy = new CallbackProperty(() => {\n positions.push(positions[0]);\n return positions.length >= 3 ? new PolygonHierarchy([...positions]) : undefined;\n }, false);\n }\n else {\n entity.polygon!.hierarchy = undefined;\n entity.polyline!.positions = undefined;\n }\n\n return {\n entities: [entity],\n };\n },\n },\n};\n","import type { Nullable } from '@vesium/shared';\nimport type { MaybeRef } from '@vueuse/core';\nimport type { Cartesian3, Entity } from 'cesium';\nimport type { CSSProperties } from 'vue';\nimport type { PlotSkeleton } from './PlotSkeleton';\nimport type { SampledPlotPackable } from './SampledPlotProperty';\nimport { assertError, isFunction } from '@vesium/shared';\nimport { assert } from '@vueuse/core';\n\nexport interface PlotRenderResult {\n entities?: Entity[];\n primitives?: any[];\n groundPrimitives?: any[];\n}\n\nexport interface PlotRenderOptions<D = any> {\n packable: SampledPlotPackable<D>;\n defining: boolean;\n mouse?: Cartesian3;\n previous: PlotRenderResult;\n}\n\nexport interface PlotSchemeConstructorOptions {\n type: string;\n\n /**\n * 是否立即执行完成标绘操作\n * 每次控制点发生变变化时,执行该回调函数,如果返回`true`则标绘完成\n */\n complete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 双击时,是否执行完成标绘操作\n * 每次控制点发生变变化时,执行该回调函数,如果返回 true 则下一次双击事件执行完成\n */\n forceComplete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 处于定义态时的鼠标样式\n * @default 'crosshair'\n */\n definingCursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);\n\n /**\n * 框架点渲染配置\n */\n skeletons?: ((() => PlotSkeleton) | PlotSkeleton) [];\n\n /**\n */\n render?: (options: PlotRenderOptions) => PlotRenderResult | Promise<PlotRenderResult>;\n\n}\n\nexport class PlotScheme {\n constructor(options: PlotSchemeConstructorOptions) {\n this.type = options.type;\n this.complete = options.complete;\n this.forceComplete = options.forceComplete;\n this.definingCursor = options.definingCursor ?? 'crosshair';\n this.skeletons = options.skeletons?.map(item => isFunction(item) ? item() : item) ?? [];\n this.render = options.render;\n }\n\n type: string;\n\n /**\n * 是否立即执行完成标绘操作\n *\n * 每次控制点发生变变化时,执行该回调函数,如果返回`true`则标绘完成\n */\n complete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 双击时,是否执行完成标绘操作\n */\n forceComplete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 处于定义态时的鼠标样式\n * @default 'crosshair'\n */\n definingCursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);\n\n /**\n * 框架点渲染配置\n */\n skeletons: PlotSkeleton [];\n\n /**\n */\n render?: (options: PlotRenderOptions) => PlotRenderResult | Promise<PlotRenderResult>;\n\n /**\n * @internal\n */\n private static _record = new Map<string, PlotScheme>();\n\n static getRecordTypes(): string[] {\n return [...this._record.keys()];\n }\n\n static getRecord(type: string): PlotScheme | undefined {\n return PlotScheme._record.get(type);\n }\n\n static setRecord(scheme: PlotScheme): void {\n assertError(!scheme.type, '`scheme.type` is required');\n PlotScheme._record.set(scheme.type, scheme);\n }\n\n /**\n * 解析传入的 scheme,并返回 PlotScheme 实例\n */\n static resolve(maybeScheme: string | PlotScheme | PlotSchemeConstructorOptions): PlotScheme {\n if (typeof maybeScheme === 'string') {\n const _scheme = PlotScheme.getRecord(maybeScheme);\n assert(!!_scheme, `scheme ${maybeScheme} not found`);\n return _scheme!;\n }\n else if (!(maybeScheme instanceof PlotScheme)) {\n return new PlotScheme(maybeScheme);\n }\n else {\n return maybeScheme;\n }\n }\n}\n","import type { Property } from 'cesium';\nimport { Cartesian3, Event, JulianDate, TimeInterval } from 'cesium';\n\n/**\n * 标绘采集到的数据\n */\nexport interface SampledPlotPackable<D = any> {\n time: JulianDate;\n positions?: Cartesian3[];\n derivative?: D;\n}\n\nexport enum SampledPlotStrategy {\n NEAR = 0,\n CYCLE = 1,\n STRICT = 2,\n}\n\nexport type SampledPlotInterpolationAlgorithm<D = any> = (\n time: JulianDate,\n previous: SampledPlotPackable<D>,\n next: SampledPlotPackable<D>,\n proportion: number\n) => SampledPlotPackable;\n\n/**\n * 默认插值算法\n *\n * @param time 时间\n * @param previous 前一个数据点\n * @param next 后一个数据点\n * @param proportion 比例\n * @returns 插值结果\n */\nconst defaultInterpolationAlgorithm: SampledPlotInterpolationAlgorithm = (time, previous, next, proportion) => {\n if (proportion === 0) {\n return {\n time,\n positions: previous.positions?.map(item => item.clone()),\n derivative: previous.derivative,\n };\n }\n else if (proportion === 1) {\n return {\n time,\n positions: next.positions?.map(item => item.clone()),\n derivative: previous.derivative,\n };\n }\n\n return {\n time,\n positions: next.positions?.map((right, index) => {\n const left = previous.positions?.[index];\n return !left ? right : Cartesian3.lerp(left, right, proportion, new Cartesian3());\n }),\n derivative: previous.derivative,\n };\n};\n\nexport interface SampledPlotPropertyConstructorOptions<D = any> {\n interpolationAlgorithm?: SampledPlotInterpolationAlgorithm<D>;\n strategy?: SampledPlotStrategy;\n packables?: SampledPlotPackable<D>[];\n}\n\n/**\n * 标绘属性数据\n */\nexport class SampledPlotProperty<D = any> {\n constructor(options?: SampledPlotPropertyConstructorOptions<D>) {\n this.interpolationAlgorithm = options?.interpolationAlgorithm;\n this.strategy = options?.strategy ?? SampledPlotStrategy.NEAR;\n options?.packables?.forEach(packable => this.setSample(packable));\n // 默认将初始化一项数据\n if (!this._times.length) {\n this.setSample({\n time: JulianDate.now(),\n positions: [],\n derivative: undefined,\n });\n }\n }\n\n static defaultInterpolationAlgorithm: SampledPlotInterpolationAlgorithm<any> = defaultInterpolationAlgorithm;\n\n strategy: SampledPlotStrategy;\n\n interpolationAlgorithm?: SampledPlotInterpolationAlgorithm;\n\n /**\n * @internal\n */\n private _times: JulianDate[] = [];\n\n /**\n * @internal\n */\n private _sampleds: Cartesian3[][] = [];\n\n /**\n * @internal\n */\n private _derivatives: (D | undefined)[] = [];\n\n get isConstant(): boolean {\n return this._times.length === 0;\n };\n\n /**\n * @internal\n */\n private _definitionChanged = new Event<(...args: any[]) => void>();\n\n get definitionChanged(): Event<(...args: any[]) => void> {\n return this._definitionChanged;\n };\n\n /**\n * 获取时间数组\n *\n * @returns 返回包含所有时间的 JulianDate 数组\n */\n getTimes(): JulianDate[] {\n return this._times.map(t => t.clone());\n }\n\n /**\n * 根据给定的儒略日期获取时间索引范围及比例\n *\n * @param time 给定的儒略日期\n * @returns 返回包含前一个索引、后一个索引及时间比例的对象,若不符合条件则返回undefined\n * @internal\n */\n private getIndexScope(time: JulianDate): { prevIndex: number; nextIndex: number; proportion: number } | undefined {\n if (!this._times.length) {\n return;\n }\n const start = this._times[0];\n const end = this._times[this._times.length - 1];\n if (JulianDate.lessThan(time, start) || JulianDate.greaterThan(time, end)) {\n switch (this.strategy) {\n case SampledPlotStrategy.STRICT: {\n return;\n }\n case SampledPlotStrategy.NEAR: {\n time = JulianDate.lessThan(time, this._times[0])\n ? this._times[0].clone()\n : this._times[this._times.length - 1].clone();\n break;\n }\n case SampledPlotStrategy.CYCLE: {\n const startMS = JulianDate.toDate(this._times[0]).getTime();\n const endMS = JulianDate.toDate(this._times[this._times.length - 1]).getTime();\n const duration = endMS - startMS;\n const timeMS = JulianDate.toDate(time).getTime();\n const diff = (timeMS - startMS) % duration;\n const dete = new Date(startMS + diff);\n time = JulianDate.fromDate(dete);\n break;\n }\n }\n }\n\n const prevIndex = this._times.findIndex(t => JulianDate.lessThanOrEquals(time, t));\n const nextIndex = Math.min(prevIndex, this._times.length - 1);\n const prevMs = JulianDate.toDate(this._times[prevIndex]).getTime();\n const nextMs = JulianDate.toDate(this._times[nextIndex]).getTime();\n const ms = JulianDate.toDate(time).getTime();\n\n return {\n prevIndex,\n nextIndex,\n proportion: ((ms - prevMs) / (nextMs - prevMs)) || 0,\n };\n }\n\n /**\n * 根据给定的儒略日期(JulianDate)获取插值后的样本点数据。\n *\n * @param time 指定的儒略日期(JulianDate)。\n * @param result 可选参数,用于存储结果的容器。如果未提供,则创建一个新的容器。\n * @returns 插值后的样本点数据,存储在提供的或新创建的result容器中。\n * @template D 数据类型。\n */\n getValue(time: JulianDate, result?: SampledPlotPackable): SampledPlotPackable<D> {\n result ??= { time };\n Object.assign(result, {\n time: time.clone(),\n positions: undefined,\n derivative: undefined,\n });\n\n if (!time) {\n result.time = this._times[0]?.clone();\n result.positions = this._sampleds[0]?.map(c => c.clone(c));\n result.derivative = this._derivatives[0];\n return result;\n }\n const scope = this.getIndexScope(time);\n if (!scope) {\n return result;\n }\n\n result.time = time;\n const { prevIndex, nextIndex, proportion } = scope;\n const previous: SampledPlotPackable<D> = {\n time: this._times[prevIndex],\n positions: this._sampleds[prevIndex],\n derivative: this._derivatives[prevIndex],\n };\n const next: SampledPlotPackable<D> = {\n time: this._times[nextIndex],\n positions: this._sampleds[nextIndex],\n derivative: this._derivatives[nextIndex],\n };\n const packable = (this.interpolationAlgorithm || SampledPlotProperty.defaultInterpolationAlgorithm)(time, previous, next, proportion);\n Object.assign(result, packable);\n return result;\n }\n\n /**\n * 设置样本数据\n *\n * @param value 样本数据对象,包含时间、位置和导数信息\n */\n setSample(value: SampledPlotPackable<D>): void {\n const time = value.time.clone();\n const positions = value.positions?.map(item => item.clone()) ?? [];\n const derivative = value.derivative;\n const index = this._times.findIndex(t => JulianDate.equals(time, t));\n\n if (index !== -1) {\n this._times[index] = time;\n this._sampleds[index] = positions;\n this._derivatives[index] = value.derivative;\n }\n else if (this._times.length === 0) {\n this._times[0] = time;\n this._sampleds[0] = positions;\n this._derivatives[0] = value.derivative;\n }\n else if (JulianDate.lessThan(time, this._times[0])) {\n this._times.splice(0, 0, time);\n this._sampleds.splice(0, 0, positions);\n this._derivatives.splice(0, 0, derivative);\n }\n else if (JulianDate.greaterThan(time, this._times[this._times.length - 1])) {\n this._times.push(time);\n this._sampleds.push(positions);\n this._derivatives.push(derivative);\n }\n\n this.definitionChanged.raiseEvent(this);\n }\n\n /**\n * 设置样本数据\n *\n * @param values 样本数据数组,每个元素都是类型为SampledPlotPackable<D>的对象\n */\n setSamples(values: SampledPlotPackable<D>[]): void {\n values.forEach(value => this.setSample(value));\n }\n\n /**\n * 从样本中移除指定时间点的数据\n *\n * @param time 需要移除的时间点,使用儒略日期表示\n * @returns 如果成功移除,则返回 true;否则返回 false\n */\n removeSample(time: JulianDate): boolean {\n const index = this._times.findIndex(t => t.equals(time));\n if (index !== -1) {\n this._sampleds.splice(index, 1);\n this._derivatives.splice(index, 1);\n const removed = this._times.splice(index, 1);\n if (removed.length) {\n this._definitionChanged.raiseEvent(this);\n return true;\n }\n }\n return false;\n }\n\n /**\n * 从样本中移除指定时间间隔内的样本。\n *\n * @param interval 要移除样本的时间间隔\n */\n removeSamples(interval: TimeInterval): void {\n for (let i = 0; i < this._times.length; i++) {\n const time = this._times[i];\n TimeInterval.contains(interval, time) && this.removeSample(time);\n }\n }\n\n equals(other?: Property): boolean {\n return other === this;\n }\n}\n","import type { Entity, JulianDate } from 'cesium';\nimport type { PlotSchemeConstructorOptions } from './PlotScheme';\nimport type { PlotSkeletonEntity } from './PlotSkeletonEntity';\nimport type { SampledPlotPropertyConstructorOptions } from './SampledPlotProperty';\nimport { assertError, createCesiumAttribute, createCesiumProperty } from '@vesium/shared';\nimport { notNullish } from '@vueuse/core';\nimport { createGuid, Event } from 'cesium';\nimport { PlotScheme } from './PlotScheme';\nimport { SampledPlotProperty } from './SampledPlotProperty';\n\nexport interface PlotConstructorOptions {\n id?: string;\n disabled?: boolean;\n scheme: string | PlotScheme | PlotSchemeConstructorOptions;\n sample?: SampledPlotProperty | SampledPlotPropertyConstructorOptions;\n}\n\nexport class Plot {\n constructor(options: PlotConstructorOptions) {\n assertError(!notNullish(options.scheme), 'options.scheme is required');\n\n this.id = options.id || createGuid();\n createCesiumAttribute(this, 'disabled', !!options.disabled);\n createCesiumAttribute(this, 'defining', true);\n createCesiumAttribute(this, 'scheme', PlotScheme.resolve(options.scheme), { readonly: true });\n const sample = options.sample instanceof SampledPlotProperty ? options.sample : new SampledPlotProperty(options.sample);\n createCesiumProperty(this, 'sample', sample);\n createCesiumAttribute(this, 'entities', []);\n createCesiumAttribute(this, 'primitives', []);\n createCesiumAttribute(this, 'groundPrimitives', []);\n createCesiumAttribute(this, 'skeletonEntities', []);\n }\n\n /**\n * @internal\n */\n private _definitionChanged = new Event();\n\n get definitionChanged(): Event<(scope: Plot, key: keyof Plot, newValue: Plot[typeof key], oldValue: Plot[typeof key]) => void> {\n return this._definitionChanged;\n }\n\n time?: JulianDate;\n\n declare id: string;\n\n declare disabled: boolean;\n\n declare readonly scheme: PlotScheme;\n\n declare sample: SampledPlotProperty;\n\n /**\n * @internal\n */\n declare defining: boolean;\n\n isDefining(): boolean {\n return this.defining;\n }\n\n /**\n * @internal\n */\n declare entities: Entity[];\n\n getEntities(): Entity[] {\n return [...this.entities];\n }\n\n /**\n * @internal\n */\n declare primitives: any[];\n\n getPrimitives(): any[] {\n return [...this.primitives];\n }\n\n /**\n * @internal\n */\n declare groundPrimitives: any[];\n\n getGroundPrimitives(): any[] {\n return [...this.groundPrimitives];\n }\n\n /**\n * @internal\n */\n declare skeletonEntities: PlotSkeletonEntity[];\n\n /**\n * 获取该标绘的骨架点entity数组\n *\n */\n getSkeletonEntities(): PlotSkeletonEntity[] {\n return [...this.skeletonEntities];\n }\n}\n","import type { Cartesian3, Entity, JulianDate } from 'cesium';\nimport type { ComputedRef, ShallowRef } from 'vue';\nimport type { Plot } from './Plot';\nimport { useCesiumEventListener, useDataSource, useEntityScope, usePrimitive, usePrimitiveScope, useScreenSpaceEventHandler, useViewer } from '@vesium/core';\nimport { arrayDifference, canvasCoordToCartesian, throttle } from '@vesium/shared';\nimport { watchArray } from '@vueuse/core';\nimport { CustomDataSource, PrimitiveCollection, ScreenSpaceEventType } from 'cesium';\nimport { computed, shallowRef, watch } from 'vue';\n\nexport interface UseProductRetrun {\n primitives: ComputedRef<any[]>;\n entities: ComputedRef<Entity[]>;\n groundPrimitives: ComputedRef<any[]>;\n}\n\nexport function useRender(\n plots: ComputedRef<Plot[]>,\n current: ShallowRef<Plot | undefined>,\n getCurrentTime: () => JulianDate,\n): UseProductRetrun {\n const viewer = useViewer();\n\n const primitiveCollection = usePrimitive(new PrimitiveCollection())!;\n const groundPrimitiveCollection = usePrimitive(new PrimitiveCollection(), { collection: 'ground' })!;\n const dataSource = useDataSource(new CustomDataSource());\n\n const entityScope = useEntityScope({ collection: () => dataSource.value!.entities });\n const primitiveScope = usePrimitiveScope({ collection: () => primitiveCollection.value! });\n const groundPrimitiveScope = usePrimitiveScope({ collection: () => groundPrimitiveCollection.value! });\n\n const mouseCartesian = shallowRef<Cartesian3>();\n\n useScreenSpaceEventHandler(\n ScreenSpaceEventType.MOUSE_MOVE,\n throttle((context) => {\n mouseCartesian.value = canvasCoordToCartesian(context?.endPosition, viewer.value!.scene);\n }, 10),\n );\n\n watchArray(plots, (_value, _oldValue, added, removed = []) => {\n removed.forEach((plot) => {\n entityScope.removeWhere(item => plot.entities.includes(item));\n primitiveScope.removeWhere(item => plot.primitives.includes(item));\n groundPrimitiveScope.removeWhere(item => plot.groundPrimitives.includes(item));\n });\n\n added.forEach((plot) => {\n plot.entities.forEach(item => entityScope.add(item));\n plot.primitives.forEach(item => primitiveScope.add(item));\n plot.groundPrimitives.forEach(item => groundPrimitiveScope.add(item));\n });\n }, {\n immediate: true,\n });\n\n useCesiumEventListener(\n () => plots.value.map(item => item.definitionChanged),\n (_scope, key, newValue, oldValue) => {\n if (key === 'entities') {\n const { added, removed } = arrayDifference(newValue as Entity[], oldValue as Entity[]);\n added.forEach(item => entityScope.add(item));\n removed.forEach(item => entityScope.remove(item));\n }\n else if (key === 'primitives') {\n const { added, removed } = arrayDifference(newValue as Entity[], oldValue as Entity[]);\n added.forEach(item => primitiveScope.add(item));\n removed.forEach(item => primitiveScope.remove(item));\n }\n else if (key === 'groundPrimitives') {\n const { added, removed } = arrayDifference(newValue as Entity[], oldValue as Entity[]);\n added.forEach(item => groundPrimitiveScope.add(item));\n removed.forEach(item => groundPrimitiveScope.remove(item));\n }\n },\n );\n\n const update = throttle(async (plot: Plot) => {\n const reslut = await plot.scheme.render?.({\n packable: plot.sample.getValue(getCurrentTime()),\n mouse: plot.defining ? mouseCartesian.value : undefined,\n defining: plot.defining,\n previous: {\n entities: plot.entities,\n primitives: plot.primitives,\n groundPrimitives: plot.groundPrimitives,\n },\n });\n\n plot.entities = reslut?.entities ?? [];\n plot.primitives = reslut?.primitives ?? [];\n plot.groundPrimitives = reslut?.groundPrimitives ?? [];\n }, 1);\n\n watch(current, (plot, previous) => {\n previous && update(previous);\n });\n\n useCesiumEventListener(\n () => plots.value.map(item => item.definitionChanged),\n (plot, key) => {\n if (['disabled', 'defining', 'scheme', 'sample', 'time'].includes(key)) {\n update(plot);\n }\n },\n );\n\n watch(mouseCartesian, () => {\n plots.value.forEach(plot => plot.defining && update(plot));\n });\n\n return {\n primitives: computed(() => Array.from(primitiveScope.scope)),\n groundPrimitives: computed(() => Array.from(primitiveScope.scope)),\n entities: computed(() => Array.from(entityScope.scope)),\n };\n}\n","import type { Nullable } from '@vesium/shared';\nimport type { JulianDate } from 'cesium';\nimport type { CSSProperties, ShallowRef } from 'vue';\nimport type { Plot } from './Plot';\nimport { useCesiumEventListener, useScreenSpaceEventHandler, useViewer } from '@vesium/core';\nimport { canvasCoordToCartesian, isFunction } from '@vesium/shared';\nimport { promiseTimeout } from '@vueuse/core';\nimport { ScreenSpaceEventType } from 'cesium';\nimport { computed, ref, toValue, watch } from 'vue';\n\nexport function useSampled(\n current: ShallowRef<Plot | undefined>,\n getCurrentTime: () => JulianDate,\n): void {\n const viewer = useViewer();\n const doubleClicking = ref(false);\n\n const packable = computed(() => {\n return current.value?.sample.getValue(getCurrentTime());\n });\n\n // 左键点击添加点\n useScreenSpaceEventHandler(\n ScreenSpaceEventType.LEFT_CLICK,\n async (ctx) => {\n await promiseTimeout(1);\n if (!current.value || !packable.value) {\n return;\n }\n // 双击会触发两次事件, 这里做一个防抖处理,只需触发一次事件\n if (doubleClicking.value) {\n return;\n }\n const { scheme, defining, sample } = current.value;\n if (!defining) {\n return;\n }\n const position = canvasCoordToCartesian(ctx.position, viewer.value!.scene);\n if (!position) {\n return;\n }\n packable.value.positions ??= [];\n packable.value.positions.push(position);\n sample.setSample(packable.value);\n const completed = scheme.complete?.(packable.value);\n completed && (current.value.defining = false);\n },\n );\n\n // 双击结束定义态,进入激活态\n useScreenSpaceEventHandler(\n ScreenSpaceEventType.LEFT_DOUBLE_CLICK,\n async (ctx) => {\n if (!current.value || !packable.value) {\n return;\n }\n doubleClicking.value = true;\n await promiseTimeout(2);\n doubleClicking.value = false;\n\n const { scheme, defining } = current.value;\n if (!defining) {\n return;\n }\n const position = canvasCoordToCartesian(ctx.position, viewer.value!.scene);\n if (!position) {\n return;\n }\n\n const completed = scheme.forceComplete?.(packable.value);\n completed && (current.value.defining = false);\n },\n );\n\n // 右键回退到上一个点\n useScreenSpaceEventHandler(\n ScreenSpaceEventType.RIGHT_CLICK,\n async () => {\n if (!current.value || !packable.value) {\n return;\n }\n const { defining, sample } = current.value;\n\n if (!defining) {\n return;\n }\n packable.value.positions ??= [];\n if (packable.value.positions.length === 0) {\n return;\n }\n packable.value.positions.splice(packable.value.positions.length - 1, 1);\n sample.setSample(packable.value);\n },\n );\n\n // 定义态时的鼠标样式\n const definingCursorCss = ref<Nullable<CSSProperties['cursor']>>();\n\n const setDefiningCursorCss = () => {\n if (!current.value?.defining) {\n if (definingCursorCss.value) {\n definingCursorCss.value = undefined;\n viewer.value!.container.parentElement!.style.removeProperty('cursor');\n }\n }\n else {\n const definingCursor = current.value!.scheme.definingCursor;\n definingCursorCss.value = isFunction(definingCursor) ? definingCursor(packable.value!) : toValue(definingCursor);\n if (definingCursorCss.value) {\n viewer.value?.container.parentElement!.style.setProperty('cursor', definingCursorCss.value);\n }\n }\n };\n\n useCesiumEventListener(() => current.value?.definitionChanged, (plot, key) => {\n if (key === 'defining' || key === 'sample') {\n setDefiningCursorCss();\n }\n });\n watch(current, () => setDefiningCursorCss());\n}\n","import type { Plot } from '..';\nimport type { PlotSkeleton } from './PlotSkeleton';\nimport { Entity } from 'cesium';\n\n/**\n * 标绘框架点 Entity\n */\nexport class PlotSkeletonEntity extends Entity {\n constructor(options: Entity.ConstructorOptions) {\n super(options);\n }\n\n /**\n * @internal\n */\n declare plot: Plot;\n\n /**\n * @internal\n */\n declare skeleton: PlotSkeleton;\n\n /**\n * @internal\n */\n declare index: number;\n}\n","import type { JulianDate } from 'cesium';\nimport type { ComputedRef, ShallowRef } from 'vue';\nimport type { Plot } from './Plot';\nimport type { PlotSkeleton } from './PlotSkeleton';\nimport { useCesiumEventListener, useDataSource, useEntityScope, useGraphicDrag, useGraphicHover, useGraphicLeftClick, useViewer } from '@vesium/core';\nimport { arrayDifference, isFunction, throttle } from '@vesium/shared';\nimport { onKeyStroke, watchArray } from '@vueuse/core';\nimport { CustomDataSource } from 'cesium';\nimport { shallowRef, toValue, watch } from 'vue';\nimport { PlotAction } from './PlotSkeleton';\nimport { PlotSkeletonEntity } from './PlotSkeletonEntity';\n\nexport function useSkeleton(\n plots: ComputedRef<Plot[]>,\n current: ShallowRef<Plot | undefined>,\n getCurrentTime: () => JulianDate,\n) {\n const viewer = useViewer();\n\n const dataSource = useDataSource(new CustomDataSource());\n const entityScope = useEntityScope({ collection: () => dataSource.value!.entities });\n\n const hoverEntity = shallowRef<PlotSkeletonEntity>();\n const activeEntity = shallowRef<PlotSkeletonEntity>();\n\n // 获取当前点位的状态\n const getPointAction = (entity?: PlotSkeletonEntity) => {\n if (!entity) {\n return PlotAction.IDLE;\n }\n return activeEntity.value?.id === entity.id\n ? PlotAction.ACTIVE\n : hoverEntity.value?.id === entity.id\n ? PlotAction.HOVER\n : PlotAction.IDLE;\n };\n\n const update = throttle((plot: Plot, destroyed?: boolean) => {\n const oldEntities = plot.getSkeletonEntities();\n const entities: PlotSkeletonEntity[] = [];\n\n if (destroyed || plot.disabled) {\n plot.skeletonEntities = [];\n }\n else {\n const packable = plot.sample.getValue(getCurrentTime());\n const defining = plot.defining;\n const active = current.value === plot;\n const skeletons = plot.scheme.skeletons;\n\n skeletons.forEach((skeleton) => {\n const diabled = isFunction(skeleton.diabled) ? skeleton.diabled({ active, defining }) : skeleton.diabled;\n if (diabled) {\n return;\n }\n const positions = skeleton.format?.(packable!) ?? packable?.positions ?? [];\n\n positions.forEach((position, index) => {\n let entity = oldEntities.find(item => item.index === index && item.skeleton === skeleton);\n const options = skeleton.render?.({\n defining,\n active,\n index,\n packable,\n positions,\n position,\n action: getPointAction(entity),\n });\n\n const merge = new PlotSkeletonEntity(options ?? {});\n if (entity) {\n merge.propertyNames.forEach((key) => {\n if (key !== 'id') {\n // @ts-expect-error ignore\n entity[key] = merge[key];\n }\n });\n }\n else {\n entity = merge;\n }\n entity.plot = plot;\n entity.skeleton = skeleton;\n entity.index = index;\n entities.push(entity);\n });\n });\n }\n plot.skeletonEntities = entities;\n }, 1);\n\n // cursor 仅在不存在定义态的标绘时才生效\n useGraphicDrag({\n cursor: (pick) => {\n if (!current.value?.defining && entityScope.scope.has(pick.id)) {\n const skeleton = pick.id.skeleton as PlotSkeleton;\n return isFunction(skeleton?.cursor) ? skeleton.cursor(pick) : toValue(skeleton?.cursor);\n }\n },\n dragCursor: (pick) => {\n if (!current.value?.defining && entityScope.scope.has(pick.id)) {\n const skeleton = pick.id.skeleton as PlotSkeleton;\n return isFunction(skeleton?.dragCursor) ? skeleton.dragCursor(pick) : toValue(skeleton?.dragCursor);\n }\n },\n listener: (params) => {\n if (params.pick.id instanceof PlotSkeletonEntity && entityScope.scope.has(params.pick.id)) {\n const entity = params.pick.id as PlotSkeletonEntity;\n\n const plot = entity.plot as Plot;\n // 仅在非定义态时才可拖拽\n if (plot.defining) {\n return;\n }\n activeEntity.value = entity;\n const skeleton = entity.skeleton as PlotSkeleton;\n const index = entity.index as number;\n const packable = plot.sample.getValue(getCurrentTime());\n skeleton.onDrag?.({\n viewer: viewer.value!,\n sample: plot.sample,\n packable,\n active: current.value === plot,\n index,\n context: params.context,\n dragging: params.dragging,\n lockCamera: params.lockCamera,\n });\n }\n else {\n activeEntity.value = undefined;\n }\n },\n });\n\n // 键盘控制当前激活的点位\n onKeyStroke((keyEvent) => {\n if (activeEntity.value) {\n const entity = activeEntity.value;\n const plot = entity.plot as Plot;\n const skeleton = entity.skeleton as PlotSkeleton;\n const index = entity.index as number;\n const packable = plot.sample.getValue(getCurrentTime());\n\n skeleton.onKeyPressed?.({\n viewer: viewer.value!,\n sample: plot.sample,\n packable,\n index,\n keyEvent,\n });\n }\n });\n\n useGraphicHover({\n listener: ({ hovering, pick }) => {\n if (hovering && pick.id instanceof PlotSkeletonEntity && entityScope.scope.has(pick.id)) {\n const entity = pick.id as PlotSkeletonEntity;\n hoverEntity.value = entity;\n }\n else {\n hoverEntity.value = undefined;\n }\n },\n });\n\n // 左键点击,令点位处于激活\n useGraphicLeftClick({\n listener: ({ context, pick }) => {\n if (pick.id instanceof PlotSkeletonEntity && entityScope.scope.has(pick.id)) {\n const entity = pick.id as PlotSkeletonEntity;\n activeEntity.value = entity;\n const plot = entity.plot as Plot;\n const skeleton = entity.skeleton as PlotSkeleton;\n const index = entity.index as number;\n\n const packable = plot.sample.getValue(getCurrentTime());\n\n skeleton.onLeftClick?.({\n viewer: viewer.value!,\n sample: plot.sample,\n packable: packable!,\n active: current.value === plot,\n defining: plot.defining,\n index,\n context,\n });\n }\n else {\n activeEntity.value = undefined;\n }\n },\n });\n\n watchArray(plots, (value, oldValue, added, removed = []) => {\n added.forEach(plot => update(plot));\n removed.forEach(plot => update(plot, true));\n });\n\n useCesiumEventListener(() => plots.value.map(plot => plot.definitionChanged), (plot, key, newValue, oldValue) => {\n if (['disabled', 'defining', 'scheme', 'sample', 'time'].includes(key)) {\n update(plot);\n }\n if (key === 'skeletonEntities') {\n const { added, removed } = arrayDifference(newValue as PlotSkeletonEntity[], oldValue as PlotSkeletonEntity[]);\n added.forEach(item => entityScope.add(item));\n removed.forEach(item => entityScope.remove(item));\n }\n });\n\n // 当前激活的标绘变化时,更新渲染\n watch(current, (plot, previous) => {\n plot && update(plot);\n setTimeout(() => {\n previous && update(previous);\n }, 2);\n });\n\n return {\n dataSource,\n };\n}\n","import type { ShallowRef } from 'vue';\nimport type { PlotConstructorOptions } from './Plot';\nimport type { SampledPlotPackable } from './SampledPlotProperty';\nimport { useCesiumEventListener, useScreenSpaceEventHandler } from '@vesium/core';\nimport { useViewer } from '@vesium/core/useViewer';\nimport { pickHitGraphic } from '@vesium/shared';\nimport { JulianDate, ScreenSpaceEventType } from 'cesium';\nimport { computed, shallowReactive, shallowRef, watch } from 'vue';\nimport { Plot } from './Plot';\nimport { useRender } from './useRender';\nimport { useSampled } from './useSampled';\nimport { useSkeleton } from './useSkeleton';\n\nexport interface UsePlotOptions {\n time?: ShallowRef<JulianDate | undefined>;\n}\n\nexport type UsePlotOperate = (plot: Plot | PlotConstructorOptions) => Promise<Plot>;\n\nexport interface UsePlotRetrun {\n\n time: ShallowRef<JulianDate | undefined>;\n\n data?: ShallowRef<Plot[]>;\n\n current?: ShallowRef<Plot | undefined>;\n /**\n * 触发标绘\n */\n operate: UsePlotOperate;\n\n /**\n * 强制终止当前进行中的标绘\n */\n cancel: VoidFunction;\n}\n\nexport function usePlot(options?: UsePlotOptions) {\n const time = options?.time || shallowRef<JulianDate>();\n\n const viewer = useViewer();\n\n const getCurrentTime = () => {\n return time.value?.clone() || viewer.value?.clock.currentTime?.clone() || JulianDate.now();\n };\n\n const collection = shallowReactive(new Set<Plot>());\n const plots = computed(() => Array.from(collection));\n const current = shallowRef<Plot>();\n const packable = shallowRef<SampledPlotPackable>();\n\n useCesiumEventListener([\n () => current.value?.sample.definitionChanged,\n ], () => {\n packable.value = current.value?.sample.getValue(getCurrentTime());\n });\n\n useSampled(current, getCurrentTime);\n useRender(plots, current, getCurrentTime);\n useSkeleton(plots, current, getCurrentTime);\n\n // 单击激活\n useScreenSpaceEventHandler(ScreenSpaceEventType.LEFT_CLICK, (data) => {\n if (current.value?.defining) {\n return;\n }\n const pick = viewer.value?.scene.pick(data.position.clone());\n // 点击到了骨架点则不处理\n if (pick?.id?.plot instanceof Plot) {\n return;\n }\n if (!pick) {\n current.value = undefined;\n return;\n }\n current.value = plots.value.find(plot => pickHitGraphic(pick, [...plot.entities, ...plot.primitives, ...plot.groundPrimitives]));\n });\n\n let operateResolve: ((plot: Plot) => void) | undefined;\n let operateReject: (() => void) | undefined;\n\n watch(current, (plot, previous) => {\n if (previous) {\n if (previous.defining) {\n const packable = previous.sample.getValue(getCurrentTime());\n const completed = previous.scheme.forceComplete?.(packable);\n if (completed) {\n previous.defining = false;\n operateResolve?.(previous);\n }\n else {\n collection.delete(previous);\n }\n }\n }\n });\n\n const operate: UsePlotOperate = async (plot) => {\n return new Promise((resolve, reject) => {\n operateResolve = resolve;\n operateReject = reject;\n const _plot = plot instanceof Plot ? plot : new Plot(plot);\n\n if (!collection.has(_plot)) {\n collection.add(_plot);\n }\n current.value = _plot;\n return resolve(_plot);\n });\n };\n\n const remove = (plot: Plot): boolean => {\n if (plot === current.value) {\n current.value = undefined;\n }\n if (collection.has(plot)) {\n collection.delete(plot);\n return true;\n }\n return false;\n };\n\n return {\n plots,\n time,\n operate,\n remove,\n cancel: operateReject,\n };\n}\n"],"names":["PlotAction","canvasCoordToCartesian","toCartographic","toCartesian3","Color","Cartesian3","Rectangle","HorizontalOrigin","VerticalOrigin","Entity","CallbackPositionProperty","CallbackProperty","PolygonHierarchy","isFunction","assertError","assert","SampledPlotStrategy","_a","Event","JulianDate","interval","TimeInterval","notNullish","createGuid","createCesiumAttribute","createCesiumProperty","useViewer","usePrimitive","PrimitiveCollection","useDataSource","CustomDataSource","useEntityScope","usePrimitiveScope","shallowRef","useScreenSpaceEventHandler","ScreenSpaceEventType","throttle","watchArray","useCesiumEventListener","arrayDifference","watch","computed","ref","promiseTimeout","toValue","useGraphicDrag","onKeyStroke","useGraphicHover","useGraphicLeftClick","shallowReactive","pickHitGraphic","packable"],"mappings":";;;;;AAyHY,MAAA,+BAAAA,gBAAL;AACLA,gBAAAA,YAAA,UAAO,CAAP,IAAA;AACAA,gBAAAA,YAAA,WAAQ,CAAR,IAAA;AACAA,gBAAAA,YAAA,YAAS,CAAT,IAAA;AAHUA,WAAAA;AAAAA,EAAA,GAAA,cAAA,CAAA,CAAA;ACjHL,WAAS,UAAwB;AAC/B,WAAA;AAAA,MACL,SAAS,CAAC,EAAE,aAAa,CAAC;AAAA,MAC1B,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,OAAO,EAAE,QAAQ,QAAQ,UAAU,SAAS,OAAO,cAAc;AACpD,mBAAA;AACX,cAAM,WAAWC,OAAAA,uBAAuB,QAAQ,aAAa,OAAO,KAAK;AACzE,YAAI,UAAU;AACZ,gBAAM,YAAY,CAAC,GAAG,SAAS,aAAa,CAAA,CAAE;AAC9C,oBAAU,KAAK,IAAI;AACnB,iBAAO,UAAU;AAAA,YACf,MAAM,SAAS;AAAA,YACf,YAAY,SAAS;AAAA,YACrB;AAAA,UAAA,CACD;AAAA,QAAA;AAAA,MAEL;AAAA,MAEA,aAAa,EAAE,QAAQ,UAAU,QAAQ,UAAU,SAAS;;AAC1D,cAAM,UAASC,YAAAA,eAAe,OAAQ,OAAO,QAAQ,MAAtCA,mBAAyC;AACpD,YAAA,CAAC,UAAU,CAAC,CAAC,WAAW,cAAc,aAAa,WAAW,EAAE,SAAS,SAAS,GAAG;AACvF;AAEF,iBAAS,eAAe;AACxB,YAAI,gBAAgB;AACpB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QAAQ;AAAA,MAAA;AAEd,UAAA,WAAW,IAAI,IAAI,GAAG;AACxB,mBAAW,OAAO,IAAI;AACf,eAAA;AAAA,MAAA;AAEF,aAAA;AAAA,IACT;AAEO,WAAA;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,IACV;AAAA,EACF;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var U=Object.defineProperty,K=(t,e,i)=>e in t?U(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,P=(t,e,i)=>K(t,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("cesium"),g=require("@vesium/shared"),I=require("@vueuse/core"),E=require("@vesium/core"),j=require("@vesium/core/useViewer"),w=require("vue");var y=(t=>(t[t.IDLE=0]="IDLE",t[t.HOVER=1]="HOVER",t[t.ACTIVE=2]="ACTIVE",t))(y||{});function M(){return{diabled:({active:t})=>!t,cursor:"pointer",dragCursor:"crosshair",onDrag({viewer:t,sample:e,packable:i,context:s,index:o,lockCamera:a}){a();const u=g.canvasCoordToCartesian(s.endPosition,t.scene);if(u){const l=[...i.positions??[]];l[o]=u,e.setSample({time:i.time,derivative:i.derivative,positions:l})}},onKeyPressed({viewer:t,keyEvent:e,sample:i,packable:s,index:o}){var a;const u=(a=g.toCartographic(t.camera.position))==null?void 0:a.height;if(!u||!["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(e.key))return;e.preventDefault();let l=0;switch(e.key){case"ArrowRight":l=Math.PI/2;break;case"ArrowDown":l=Math.PI;break;case"ArrowLeft":l=-Math.PI/2;break;case"ArrowUp":l=0;break}const h=(t.camera.heading+l)%(2*Math.PI),v=[...s.positions??[]],c=g.toCartographic(v[o]),n=u/1e5*Math.PI/180/1e3;c.latitude+=n*Math.cos(h),c.longitude+=n*Math.sin(h),v[o]=g.toCartesian3(c),i.setSample({time:s.time,derivative:s.derivative,positions:v})},render:({position:t,action:e})=>{const i={[y.IDLE]:r.Color.BLUE.withAlpha(.4),[y.HOVER]:r.Color.BLUE.withAlpha(.6),[y.ACTIVE]:r.Color.AQUA.withAlpha(1)};return{position:t,point:{pixelSize:8,color:i[e],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:r.Color.WHITE.withAlpha(.4)}}}}}function z(){let t=-1;return{diabled:({active:e,defining:i})=>!e||i,cursor:"pointer",dragCursor:"crosshair",format(e){const i=e.positions??[];return i.length<2?[]:i.map((s,o)=>{const a=o===i.length-1?i[0]:i[o+1];return r.Cartesian3.midpoint(s,a,new r.Cartesian3)})},onDrag({viewer:e,sample:i,packable:s,context:o,index:a,lockCamera:u,dragging:l}){u();const h=g.canvasCoordToCartesian(o.endPosition,e.scene);if(!h)return;const v=[...s.positions??[]];t===-1?(t=a,v.splice(a+1,0,h)):v[t+1]=h,l||(t=-1),i.setSample({time:s.time,derivative:s.derivative,positions:v})},render:({position:e,action:i,active:s})=>{if(!s)return;const o={[y.IDLE]:r.Color.GREEN.withAlpha(.4),[y.HOVER]:r.Color.GREEN.withAlpha(.6),[y.ACTIVE]:r.Color.GREEN.withAlpha(1)};return{position:e,point:{pixelSize:6,color:o[i],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:r.Color.WHITE.withAlpha(.4)}}}}}function $(){let t=-1;return{diabled:({active:e,defining:i})=>!e||i,cursor:"pointer",dragCursor:"crosshair",format(e){const i=e.positions??[];return i.length<2?[]:i.slice(0,i.length-1).map((s,o)=>r.Cartesian3.midpoint(s,i[o+1],new r.Cartesian3))},onDrag({viewer:e,sample:i,packable:s,context:o,index:a,lockCamera:u,dragging:l}){u();const h=g.canvasCoordToCartesian(o.endPosition,e.scene);if(!h)return;const v=[...s.positions??[]];t===-1?(t=a,v.splice(a+1,0,h)):v[t+1]=h,l||(t=-1),i.setSample({time:s.time,derivative:s.derivative,positions:v})},render:({position:e,action:i})=>{const s={[y.IDLE]:r.Color.GREEN.withAlpha(.4),[y.HOVER]:r.Color.GREEN.withAlpha(.6),[y.ACTIVE]:r.Color.GREEN.withAlpha(1)};return{position:e,point:{pixelSize:6,color:s[i],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:r.Color.WHITE.withAlpha(.4)}}}}}const Q=`data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m18 9l3 3l-3 3m-3-3h6M6 9l-3 3l3 3m-3-3h6m0 6l3 3l3-3m-3-3v6m3-15l-3-3l-3 3m3-3v6"/></svg>')}`;function A(){return{diabled:({active:t,defining:e})=>!t||e,cursor:"pointer",dragCursor:"crosshair",format(t){const e=t.positions??[];if(e.length===0)return[];if(e.length===1)return[e[0]];{const i=r.Rectangle.center(r.Rectangle.fromCartesianArray(e));return[g.toCartesian3(i)]}},onDrag({viewer:t,sample:e,packable:i,context:s,lockCamera:o,dragging:a}){a&&o();const u=g.canvasCoordToCartesian(s.startPosition,t.scene),l=g.canvasCoordToCartesian(s.endPosition,t.scene);if(!u||!l)return;const h=r.Cartesian3.subtract(l,u,new r.Cartesian3),v=[...i.positions??[]];e.setSample({time:i.time,derivative:i.derivative,positions:v.map(c=>r.Cartesian3.add(c,h,new r.Cartesian3))})},render:({position:t,action:e})=>{const i={[y.IDLE]:r.Color.WHITE,[y.HOVER]:r.Color.WHITE,[y.ACTIVE]:r.Color.AQUA.withAlpha(1)};return{position:t,billboard:{image:Q,width:20,height:20,color:i[e],pixelOffset:new r.Cartesian3(0,-20),horizontalOrigin:r.HorizontalOrigin.CENTER,verticalOrigin:r.VerticalOrigin.BOTTOM,disableDepthTestDistance:Number.POSITIVE_INFINITY}}}}}const X={scheme:{type:"Billboard",complete:t=>t.positions.length>=1,skeletons:[A],render(t){var e,i;const{mouse:s,packable:o}=t,a=((e=t.previous.entities)==null?void 0:e[0])??new r.Entity({billboard:{}}),u=((i=o.positions)==null?void 0:i[0])??s;return a.position=new r.CallbackPositionProperty(()=>u,!0),{entities:[a]}}}},Z={scheme:{type:"Label",complete:t=>t.positions.length>=1,skeletons:[A],render(t){var e,i;const{mouse:s,packable:o}=t,a=((e=t.previous.entities)==null?void 0:e[0])??new r.Entity({label:{text:"Label"}}),u=((i=o.positions)==null?void 0:i[0])??s;return a.position=new r.CallbackPositionProperty(()=>u,!0),{entities:[a]}}}},ee={scheme:{type:"LineString",forceComplete:t=>t.positions.length>=2,skeletons:[M,$,A],render(t){var e;const{mouse:i,packable:s}=t,o=((e=t.previous.entities)==null?void 0:e[0])??new r.Entity({polyline:{width:1}});return o.polyline.positions=new r.CallbackProperty(()=>{const a=[...s.positions??[]].concat(i?[i]:[]);return a.length>=2?a:[]},!1),{entities:[o]}}}},ie={scheme:{type:"Polygon",forceComplete:t=>t.positions.length>=3,skeletons:[M,z,A],render(t){var e;const{mouse:i,packable:s}=t,o=((e=t.previous.entities)==null?void 0:e[0])??new r.Entity({polyline:{material:r.Color.YELLOW.withAlpha(.5)},polygon:{material:r.Color.YELLOW.withAlpha(.5)}}),a=[...s.positions??[]];return i&&a.push(i),a.length===2?(o.polygon.hierarchy=void 0,o.polyline.positions=new r.CallbackProperty(()=>a,!1)):a.length>=3?(o.polyline.positions=void 0,o.polygon.hierarchy=new r.CallbackProperty(()=>(a.push(a[0]),a.length>=3?new r.PolygonHierarchy([...a]):void 0),!1)):(o.polygon.hierarchy=void 0,o.polyline.positions=void 0),{entities:[o]}}}},G=class D{constructor(e){P(this,"type"),P(this,"complete"),P(this,"forceComplete"),P(this,"definingCursor"),P(this,"skeletons"),P(this,"render");var i;this.type=e.type,this.complete=e.complete,this.forceComplete=e.forceComplete,this.definingCursor=e.definingCursor??"crosshair",this.skeletons=((i=e.skeletons)==null?void 0:i.map(s=>g.isFunction(s)?s():s))??[],this.render=e.render}static getRecordTypes(){return[...this._record.keys()]}static getRecord(e){return D._record.get(e)}static setRecord(e){g.assertError(!e.type,"`scheme.type` is required"),D._record.set(e.type,e)}static resolve(e){if(typeof e=="string"){const i=D.getRecord(e);return I.assert(!!i,`scheme ${e} not found`),i}else return e instanceof D?e:new D(e)}};P(G,"_record",new Map);let J=G;var F=(t=>(t[t.NEAR=0]="NEAR",t[t.CYCLE=1]="CYCLE",t[t.STRICT=2]="STRICT",t))(F||{});const te=(t,e,i,s)=>{var o,a,u;return s===0?{time:t,positions:(o=e.positions)==null?void 0:o.map(l=>l.clone()),derivative:e.derivative}:s===1?{time:t,positions:(a=i.positions)==null?void 0:a.map(l=>l.clone()),derivative:e.derivative}:{time:t,positions:(u=i.positions)==null?void 0:u.map((l,h)=>{var v;const c=(v=e.positions)==null?void 0:v[h];return c?r.Cartesian3.lerp(c,l,s,new r.Cartesian3):l}),derivative:e.derivative}},W=class q{constructor(e){P(this,"strategy"),P(this,"interpolationAlgorithm"),P(this,"_times",[]),P(this,"_sampleds",[]),P(this,"_derivatives",[]),P(this,"_definitionChanged",new r.Event);var i;this.interpolationAlgorithm=e?.interpolationAlgorithm,this.strategy=e?.strategy??0,(i=e?.packables)==null||i.forEach(s=>this.setSample(s)),this._times.length||this.setSample({time:r.JulianDate.now(),positions:[],derivative:void 0})}get isConstant(){return this._times.length===0}get definitionChanged(){return this._definitionChanged}getTimes(){return this._times.map(e=>e.clone())}getIndexScope(e){if(!this._times.length)return;const i=this._times[0],s=this._times[this._times.length-1];if(r.JulianDate.lessThan(e,i)||r.JulianDate.greaterThan(e,s))switch(this.strategy){case 2:return;case 0:{e=r.JulianDate.lessThan(e,this._times[0])?this._times[0].clone():this._times[this._times.length-1].clone();break}case 1:{const v=r.JulianDate.toDate(this._times[0]).getTime(),p=r.JulianDate.toDate(this._times[this._times.length-1]).getTime()-v,d=(r.JulianDate.toDate(e).getTime()-v)%p,m=new Date(v+d);e=r.JulianDate.fromDate(m);break}}const o=this._times.findIndex(v=>r.JulianDate.lessThanOrEquals(e,v)),a=Math.min(o,this._times.length-1),u=r.JulianDate.toDate(this._times[o]).getTime(),l=r.JulianDate.toDate(this._times[a]).getTime(),h=r.JulianDate.toDate(e).getTime();return{prevIndex:o,nextIndex:a,proportion:(h-u)/(l-u)||0}}getValue(e,i){var s,o;if(i??(i={time:e}),Object.assign(i,{time:e.clone(),positions:void 0,derivative:void 0}),!e)return i.time=(s=this._times[0])==null?void 0:s.clone(),i.positions=(o=this._sampleds[0])==null?void 0:o.map(n=>n.clone(n)),i.derivative=this._derivatives[0],i;const a=this.getIndexScope(e);if(!a)return i;i.time=e;const{prevIndex:u,nextIndex:l,proportion:h}=a,v={time:this._times[u],positions:this._sampleds[u],derivative:this._derivatives[u]},c={time:this._times[l],positions:this._sampleds[l],derivative:this._derivatives[l]},p=(this.interpolationAlgorithm||q.defaultInterpolationAlgorithm)(e,v,c,h);return Object.assign(i,p),i}setSample(e){var i;const s=e.time.clone(),o=((i=e.positions)==null?void 0:i.map(l=>l.clone()))??[],a=e.derivative,u=this._times.findIndex(l=>r.JulianDate.equals(s,l));u!==-1?(this._times[u]=s,this._sampleds[u]=o,this._derivatives[u]=e.derivative):this._times.length===0?(this._times[0]=s,this._sampleds[0]=o,this._derivatives[0]=e.derivative):r.JulianDate.lessThan(s,this._times[0])?(this._times.splice(0,0,s),this._sampleds.splice(0,0,o),this._derivatives.splice(0,0,a)):r.JulianDate.greaterThan(s,this._times[this._times.length-1])&&(this._times.push(s),this._sampleds.push(o),this._derivatives.push(a)),this.definitionChanged.raiseEvent(this)}setSamples(e){e.forEach(i=>this.setSample(i))}removeSample(e){const i=this._times.findIndex(s=>s.equals(e));return i!==-1&&(this._sampleds.splice(i,1),this._derivatives.splice(i,1),this._times.splice(i,1).length)?(this._definitionChanged.raiseEvent(this),!0):!1}removeSamples(e){for(let i=0;i<this._times.length;i++){const s=this._times[i];r.TimeInterval.contains(e,s)&&this.removeSample(s)}}equals(e){return e===this}};P(W,"defaultInterpolationAlgorithm",te);let V=W;class L{constructor(e){P(this,"_definitionChanged",new r.Event),P(this,"time"),g.assertError(!I.notNullish(e.scheme),"options.scheme is required"),this.id=e.id||r.createGuid(),g.createCesiumAttribute(this,"disabled",!!e.disabled),g.createCesiumAttribute(this,"defining",!0),g.createCesiumAttribute(this,"scheme",J.resolve(e.scheme),{readonly:!0});const i=e.sample instanceof V?e.sample:new V(e.sample);g.createCesiumProperty(this,"sample",i),g.createCesiumAttribute(this,"entities",[]),g.createCesiumAttribute(this,"primitives",[]),g.createCesiumAttribute(this,"groundPrimitives",[]),g.createCesiumAttribute(this,"skeletonEntities",[])}get definitionChanged(){return this._definitionChanged}isDefining(){return this.defining}getEntities(){return[...this.entities]}getPrimitives(){return[...this.primitives]}getGroundPrimitives(){return[...this.groundPrimitives]}getSkeletonEntities(){return[...this.skeletonEntities]}}function ne(t,e,i){const s=E.useViewer(),o=E.usePrimitive(new r.PrimitiveCollection),a=E.usePrimitive(new r.PrimitiveCollection,{collection:"ground"}),u=E.useDataSource(new r.CustomDataSource),l=E.useEntityScope({collection:()=>u.value.entities}),h=E.usePrimitiveScope({collection:()=>o.value}),v=E.usePrimitiveScope({collection:()=>a.value}),c=w.shallowRef();E.useScreenSpaceEventHandler(r.ScreenSpaceEventType.MOUSE_MOVE,g.throttle(n=>{c.value=g.canvasCoordToCartesian(n?.endPosition,s.value.scene)},10)),I.watchArray(t,(n,d,m,f=[])=>{f.forEach(C=>{l.removeWhere(_=>C.entities.includes(_)),h.removeWhere(_=>C.primitives.includes(_)),v.removeWhere(_=>C.groundPrimitives.includes(_))}),m.forEach(C=>{C.entities.forEach(_=>l.add(_)),C.primitives.forEach(_=>h.add(_)),C.groundPrimitives.forEach(_=>v.add(_))})},{immediate:!0}),E.useCesiumEventListener(()=>t.value.map(n=>n.definitionChanged),(n,d,m,f)=>{if(d==="entities"){const{added:C,removed:_}=g.arrayDifference(m,f);C.forEach(S=>l.add(S)),_.forEach(S=>l.remove(S))}else if(d==="primitives"){const{added:C,removed:_}=g.arrayDifference(m,f);C.forEach(S=>h.add(S)),_.forEach(S=>h.remove(S))}else if(d==="groundPrimitives"){const{added:C,removed:_}=g.arrayDifference(m,f);C.forEach(S=>v.add(S)),_.forEach(S=>v.remove(S))}});const p=g.throttle(async n=>{var d,m;const f=await((m=(d=n.scheme).render)==null?void 0:m.call(d,{packable:n.sample.getValue(i()),mouse:n.defining?c.value:void 0,defining:n.defining,previous:{entities:n.entities,primitives:n.primitives,groundPrimitives:n.groundPrimitives}}));n.entities=f?.entities??[],n.primitives=f?.primitives??[],n.groundPrimitives=f?.groundPrimitives??[]},1);return w.watch(e,(n,d)=>{d&&p(d)}),E.useCesiumEventListener(()=>t.value.map(n=>n.definitionChanged),(n,d)=>{["disabled","defining","scheme","sample","time"].includes(d)&&p(n)}),w.watch(c,()=>{t.value.forEach(n=>n.defining&&p(n))}),{primitives:w.computed(()=>Array.from(h.scope)),groundPrimitives:w.computed(()=>Array.from(h.scope)),entities:w.computed(()=>Array.from(l.scope))}}function se(t,e){const i=E.useViewer(),s=w.ref(!1),o=w.computed(()=>{var l;return(l=t.value)==null?void 0:l.sample.getValue(e())});E.useScreenSpaceEventHandler(r.ScreenSpaceEventType.LEFT_CLICK,async l=>{var h,v;if(await I.promiseTimeout(1),!t.value||!o.value||s.value)return;const{scheme:c,defining:p,sample:n}=t.value;if(!p)return;const d=g.canvasCoordToCartesian(l.position,i.value.scene);if(!d)return;(h=o.value).positions??(h.positions=[]),o.value.positions.push(d),n.setSample(o.value),((v=c.complete)==null?void 0:v.call(c,o.value))&&(t.value.defining=!1)}),E.useScreenSpaceEventHandler(r.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,async l=>{var h;if(!t.value||!o.value)return;s.value=!0,await I.promiseTimeout(2),s.value=!1;const{scheme:v,defining:c}=t.value;if(!c||!g.canvasCoordToCartesian(l.position,i.value.scene))return;((h=v.forceComplete)==null?void 0:h.call(v,o.value))&&(t.value.defining=!1)}),E.useScreenSpaceEventHandler(r.ScreenSpaceEventType.RIGHT_CLICK,async()=>{var l;if(!t.value||!o.value)return;const{defining:h,sample:v}=t.value;h&&((l=o.value).positions??(l.positions=[]),o.value.positions.length!==0&&(o.value.positions.splice(o.value.positions.length-1,1),v.setSample(o.value)))});const a=w.ref(),u=()=>{var l,h;if(!((l=t.value)!=null&&l.defining))a.value&&(a.value=void 0,i.value.container.parentElement.style.removeProperty("cursor"));else{const v=t.value.scheme.definingCursor;a.value=g.isFunction(v)?v(o.value):w.toValue(v),a.value&&((h=i.value)==null||h.container.parentElement.style.setProperty("cursor",a.value))}};E.useCesiumEventListener(()=>{var l;return(l=t.value)==null?void 0:l.definitionChanged},(l,h)=>{(h==="defining"||h==="sample")&&u()}),w.watch(t,()=>u())}class O extends r.Entity{constructor(e){super(e)}}function oe(t,e,i){const s=E.useViewer(),o=E.useDataSource(new r.CustomDataSource),a=E.useEntityScope({collection:()=>o.value.entities}),u=w.shallowRef(),l=w.shallowRef(),h=c=>{var p,n;return c?((p=l.value)==null?void 0:p.id)===c.id?y.ACTIVE:((n=u.value)==null?void 0:n.id)===c.id?y.HOVER:y.IDLE:y.IDLE},v=g.throttle((c,p)=>{const n=c.getSkeletonEntities(),d=[];if(p||c.disabled)c.skeletonEntities=[];else{const m=c.sample.getValue(i()),f=c.defining,C=e.value===c;c.scheme.skeletons.forEach(S=>{var H;if(g.isFunction(S.diabled)?S.diabled({active:C,defining:f}):S.diabled)return;const N=((H=S.format)==null?void 0:H.call(S,m))??m?.positions??[];N.forEach((B,R)=>{var x;let T=n.find(b=>b.index===R&&b.skeleton===S);const Y=(x=S.render)==null?void 0:x.call(S,{defining:f,active:C,index:R,packable:m,positions:N,position:B,action:h(T)}),k=new O(Y??{});T?k.propertyNames.forEach(b=>{b!=="id"&&(T[b]=k[b])}):T=k,T.plot=c,T.skeleton=S,T.index=R,d.push(T)})})}c.skeletonEntities=d},1);return E.useGraphicDrag({cursor:c=>{var p;if(!((p=e.value)!=null&&p.defining)&&a.scope.has(c.id)){const n=c.id.skeleton;return g.isFunction(n?.cursor)?n.cursor(c):w.toValue(n?.cursor)}},dragCursor:c=>{var p;if(!((p=e.value)!=null&&p.defining)&&a.scope.has(c.id)){const n=c.id.skeleton;return g.isFunction(n?.dragCursor)?n.dragCursor(c):w.toValue(n?.dragCursor)}},listener:c=>{var p;if(c.pick.id instanceof O&&a.scope.has(c.pick.id)){const n=c.pick.id,d=n.plot;if(d.defining)return;l.value=n;const m=n.skeleton,f=n.index,C=d.sample.getValue(i());(p=m.onDrag)==null||p.call(m,{viewer:s.value,sample:d.sample,packable:C,active:e.value===d,index:f,context:c.context,dragging:c.dragging,lockCamera:c.lockCamera})}else l.value=void 0}}),I.onKeyStroke(c=>{var p;if(l.value){const n=l.value,d=n.plot,m=n.skeleton,f=n.index,C=d.sample.getValue(i());(p=m.onKeyPressed)==null||p.call(m,{viewer:s.value,sample:d.sample,packable:C,index:f,keyEvent:c})}}),E.useGraphicHover({listener:({hovering:c,pick:p})=>{if(c&&p.id instanceof O&&a.scope.has(p.id)){const n=p.id;u.value=n}else u.value=void 0}}),E.useGraphicLeftClick({listener:({context:c,pick:p})=>{var n;if(p.id instanceof O&&a.scope.has(p.id)){const d=p.id;l.value=d;const m=d.plot,f=d.skeleton,C=d.index,_=m.sample.getValue(i());(n=f.onLeftClick)==null||n.call(f,{viewer:s.value,sample:m.sample,packable:_,active:e.value===m,defining:m.defining,index:C,context:c})}else l.value=void 0}}),I.watchArray(t,(c,p,n,d=[])=>{n.forEach(m=>v(m)),d.forEach(m=>v(m,!0))}),E.useCesiumEventListener(()=>t.value.map(c=>c.definitionChanged),(c,p,n,d)=>{if(["disabled","defining","scheme","sample","time"].includes(p)&&v(c),p==="skeletonEntities"){const{added:m,removed:f}=g.arrayDifference(n,d);m.forEach(C=>a.add(C)),f.forEach(C=>a.remove(C))}}),w.watch(e,(c,p)=>{c&&v(c),setTimeout(()=>{p&&v(p)},2)}),{dataSource:o}}function re(t){const e=t?.time||w.shallowRef(),i=j.useViewer(),s=()=>{var n,d,m;return((n=e.value)==null?void 0:n.clone())||((m=(d=i.value)==null?void 0:d.clock.currentTime)==null?void 0:m.clone())||r.JulianDate.now()},o=w.shallowReactive(new Set),a=w.computed(()=>Array.from(o)),u=w.shallowRef(),l=w.shallowRef();E.useCesiumEventListener([()=>{var n;return(n=u.value)==null?void 0:n.sample.definitionChanged}],()=>{var n;l.value=(n=u.value)==null?void 0:n.sample.getValue(s())}),se(u,s),ne(a,u,s),oe(a,u,s),E.useScreenSpaceEventHandler(r.ScreenSpaceEventType.LEFT_CLICK,n=>{var d,m,f;if((d=u.value)!=null&&d.defining)return;const C=(m=i.value)==null?void 0:m.scene.pick(n.position.clone());if(!(((f=C?.id)==null?void 0:f.plot)instanceof L)){if(!C){u.value=void 0;return}u.value=a.value.find(_=>g.pickHitGraphic(C,[..._.entities,..._.primitives,..._.groundPrimitives]))}});let h,v;return w.watch(u,(n,d)=>{var m,f;if(d&&d.defining){const C=d.sample.getValue(s());((f=(m=d.scheme).forceComplete)==null?void 0:f.call(m,C))?(d.defining=!1,h?.(d)):o.delete(d)}}),{plots:a,time:e,operate:async n=>new Promise((d,m)=>{h=d,v=m;const f=n instanceof L?n:new L(n);return o.has(f)||o.add(f),u.value=f,d(f)}),remove:n=>(n===u.value&&(u.value=void 0),o.has(n)?(o.delete(n),!0):!1),cancel:v}}exports.PLOT_BILLBOARD_SCHEME=X,exports.PLOT_LABEL_SCHEME=Z,exports.PLOT_LINE_STRING_SCHEME=ee,exports.PLOT_POLYGON_SCHEME=ie,exports.Plot=L,exports.PlotScheme=J,exports.SampledPlotProperty=V,exports.SampledPlotStrategy=F,exports.usePlot=re;
|
|
2
|
+
//# sourceMappingURL=index.min.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.min.cjs","sources":["../usePlot/PlotSkeleton.ts","../skeleton/control.ts","../skeleton/interval.ts","../skeleton/intervalNonclosed.ts","../skeleton/moved.ts","../scheme/Billboard.ts","../scheme/Label.ts","../scheme/LineString.ts","../scheme/Polygon.ts","../usePlot/PlotScheme.ts","../usePlot/SampledPlotProperty.ts","../usePlot/Plot.ts","../usePlot/useRender.ts","../usePlot/useSampled.ts","../usePlot/PlotSkeletonEntity.ts","../usePlot/useSkeleton.ts","../usePlot/usePlot.ts"],"sourcesContent":["import type { Nullable } from '@vesium/shared';\nimport type { Cartesian3, Entity, ScreenSpaceEventHandler, Viewer } from 'cesium';\nimport type { CSSProperties, MaybeRef, VNode } from 'vue';\nimport type { SampledPlotPackable, SampledPlotProperty } from './SampledPlotProperty';\n\nexport interface SkeletonDisabledOptions {\n\n /**\n * 当前标绘是否是否正在激活,即正在编辑状态\n */\n active: boolean;\n\n /**\n * 当前标绘是否还在定义态,即还未完成采集\n */\n defining: boolean;\n}\n\nexport interface OnSkeletonClickOptions {\n viewer: Viewer;\n\n /**\n * 当前标绘属性数据\n */\n sample: SampledPlotProperty;\n\n /**\n * 标绘采集到的数据,通过该数据可以获取到当前标绘的所有点位信息\n */\n packable: SampledPlotPackable<any>;\n\n /**\n * 当前标绘是否是否正在激活,即正在编辑状态\n */\n active: boolean;\n\n /**\n * 当前标绘是否还在定义态,即还未完成采集\n */\n defining: boolean;\n\n /**\n * 当前被点击的控制点索引\n */\n index: number;\n\n /**\n * 鼠标点击事件上下文信息\n */\n context: ScreenSpaceEventHandler.PositionedEvent;\n}\n\nexport interface OnSkeletonDragOptions {\n viewer: Viewer;\n\n /***\n * 当前标绘属性数据\n */\n sample: SampledPlotProperty;\n\n /**\n * 标绘采集到的数据,通过该数据可以获取到当前标绘的所有点位信息\n */\n packable: SampledPlotPackable<any>;\n\n /**\n * 当前标绘是否是否正在激活,即正在编辑状态\n */\n active: boolean;\n\n /**\n * 当前被拖拽的控制点索引\n */\n index: number;\n\n /**\n * 鼠标拖拽事件上下文信息\n */\n context: ScreenSpaceEventHandler.MotionEvent;\n\n /**\n * 当前的拖拽状态\n */\n dragging: boolean;\n\n /**\n * 执行是否锁定相机视角\n */\n lockCamera: () => void;\n}\n\nexport interface OnKeyPressedOptions {\n viewer: Viewer;\n\n /**\n * 当前标绘属性数据\n */\n sample: SampledPlotProperty;\n\n /**\n * 标绘采集到的数据,通过该数据可以获取到当前标绘的所有点位信息\n */\n packable: SampledPlotPackable<any>;\n\n /**\n * 当前被点击的控制点索引\n */\n index: number;\n\n /**\n * 被按压的按键事件回调\n */\n keyEvent: KeyboardEvent;\n}\n\n/**\n * 框架点执行状态枚举\n * - IDLE 空闲状态\n * - HOVER 悬停状态\n * - ACTIVE 激活状态\n */\nexport enum PlotAction {\n IDLE = 0,\n HOVER = 1,\n ACTIVE = 2,\n}\n\nexport interface SkeletonRenderOptions {\n /**\n * 标绘采集到的数据,通过该数据可以获取到当前标绘的所有点位信息\n */\n packable: SampledPlotPackable;\n\n /**\n * 所有框架点位集合\n */\n positions: Cartesian3[];\n\n /**\n * 当前渲染的框架点索引\n */\n index: number;\n /**\n * 当前应当渲染的位置\n */\n position: Cartesian3;\n\n /**\n * 当前标绘是否是否正在激活,即正在编辑状态\n */\n active: boolean;\n\n /**\n * 当前标绘是否还在定义态,即还未完成采集\n */\n defining: boolean;\n\n /**\n * 当前框架点执行状态\n */\n action: PlotAction;\n}\n\n/**\n * 控制点配置项\n */\nexport interface PlotSkeleton {\n /**\n * 是否禁用控制点\n */\n diabled?: boolean | ((options: SkeletonDisabledOptions) => boolean);\n /**\n * 实际情况中,并非所有采集都都要渲染对应框架点,通过`format`函数可以过滤掉不需要渲染的点位,另外还可以自定义点位的偏移、增加框架点\n * @param packable 标绘采集到的数据\n */\n format?: (packable: SampledPlotPackable<any>) => Cartesian3[];\n\n /**\n * 点位渲染函数,返回Entity的构造参数,如果不返回任何值则不渲染该点位\n */\n render?: (options: SkeletonRenderOptions) => Entity.ConstructorOptions | undefined;\n\n /**\n * Cursor style when hovering.\n */\n cursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((pick: any) => Nullable<CSSProperties['cursor']>);\n\n /**\n * Cursor style when dragging.\n */\n dragCursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((pick: any) => Nullable<CSSProperties['cursor']>);\n\n /**\n * 鼠标悬停在框架点时显示的提示信息\n */\n tip?: (options: SkeletonRenderOptions) => string | VNode | string | undefined;\n\n /**\n * 框架点鼠标左键点击时的处理逻辑\n */\n onLeftClick?: (options: OnSkeletonClickOptions) => void;\n\n /**\n * 框架点被拖拽时的处理逻辑\n */\n onDrag?: (options: OnSkeletonDragOptions) => void;\n\n /**\n * 键盘按键按下时的处理逻辑\n */\n onKeyPressed?: (options: OnKeyPressedOptions) => void;\n}\n","import type { PlotSkeleton } from '../usePlot/PlotSkeleton';\nimport { canvasCoordToCartesian, toCartesian3, toCartographic } from '@vesium/shared';\nimport { Color } from 'cesium';\nimport { PlotAction } from '../usePlot/PlotSkeleton';\n\n/**\n * 绘制控制的框架点,拖拽时,将更新该控制点的实时位置\n */\nexport function control(): PlotSkeleton {\n return {\n diabled: ({ active }) => !active,\n cursor: 'pointer',\n dragCursor: 'crosshair',\n onDrag({ viewer, sample, packable, context, index, lockCamera }) {\n lockCamera();\n const position = canvasCoordToCartesian(context.endPosition, viewer.scene);\n if (position) {\n const positions = [...packable.positions ?? []];\n positions[index] = position;\n sample.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions,\n });\n }\n },\n\n onKeyPressed({ viewer, keyEvent, sample, packable, index }) {\n const height = toCartographic(viewer!.camera.position)?.height;\n if (!height || !['ArrowUp', 'ArrowRight', 'ArrowDown', 'ArrowLeft'].includes(keyEvent.key))\n return;\n\n keyEvent.preventDefault();\n let headingAdjust = 0;\n switch (keyEvent.key) {\n case 'ArrowRight':\n headingAdjust = Math.PI / 2;\n break;\n case 'ArrowDown':\n headingAdjust = Math.PI;\n break;\n case 'ArrowLeft':\n headingAdjust = -Math.PI / 2;\n break;\n case 'ArrowUp':\n headingAdjust = 0;\n break;\n }\n const newHeading = (viewer.camera.heading + headingAdjust) % (2 * Math.PI);\n const positions = [...packable.positions ?? []];\n const cartographic = toCartographic(positions[index])!;\n const r = height / 100000;\n const distance = r * Math.PI / 180 / 1000;\n\n cartographic.latitude += distance * Math.cos(newHeading);\n cartographic.longitude += distance * Math.sin(newHeading);\n\n positions[index] = toCartesian3(cartographic)!;\n sample.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions,\n });\n },\n render: ({ position, action }) => {\n const colors = {\n [PlotAction.IDLE]: Color.BLUE.withAlpha(0.4),\n [PlotAction.HOVER]: Color.BLUE.withAlpha(0.6),\n [PlotAction.ACTIVE]: Color.AQUA.withAlpha(1),\n };\n return {\n position,\n point: {\n pixelSize: 8,\n color: colors[action],\n disableDepthTestDistance: Number.POSITIVE_INFINITY,\n outlineWidth: 1,\n outlineColor: Color.WHITE.withAlpha(0.4),\n },\n };\n },\n };\n}\n","import type { PlotSkeleton } from '../usePlot/PlotSkeleton';\nimport { canvasCoordToCartesian } from '@vesium/shared';\nimport { Cartesian3, Color } from 'cesium';\nimport { PlotAction } from '../usePlot/PlotSkeleton';\n\n/**\n * 绘制封闭的间隔框架点,如多边形。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。\n */\nexport function interval(): PlotSkeleton {\n let dragIndex = -1;\n return {\n diabled: ({ active, defining }) => !active || defining,\n cursor: 'pointer',\n dragCursor: 'crosshair',\n format(packable) {\n const _positions = packable.positions ?? [];\n if (_positions.length < 2) {\n return [];\n }\n return _positions.map((position, i) => {\n const next = i === _positions.length - 1 ? _positions[0] : _positions[i + 1];\n return Cartesian3.midpoint(position, next, new Cartesian3());\n });\n },\n onDrag({ viewer, sample, packable, context, index, lockCamera, dragging }) {\n lockCamera();\n\n const position = canvasCoordToCartesian(context.endPosition, viewer.scene);\n if (!position) {\n return;\n }\n const positions = [...packable.positions ?? []];\n if (dragIndex === -1) {\n dragIndex = index;\n positions.splice(index + 1, 0, position);\n }\n else {\n positions[dragIndex + 1] = position;\n }\n if (!dragging) {\n dragIndex = -1;\n }\n sample.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions,\n });\n },\n render: ({ position, action, active }) => {\n if (!active) {\n return;\n }\n const colors = {\n [PlotAction.IDLE]: Color.GREEN.withAlpha(0.4),\n [PlotAction.HOVER]: Color.GREEN.withAlpha(0.6),\n [PlotAction.ACTIVE]: Color.GREEN.withAlpha(1.0),\n };\n return {\n position,\n point: {\n pixelSize: 6,\n color: colors[action],\n disableDepthTestDistance: Number.POSITIVE_INFINITY,\n outlineWidth: 1,\n outlineColor: Color.WHITE.withAlpha(0.4),\n },\n };\n },\n };\n}\n","import type { PlotSkeleton } from '../usePlot/PlotSkeleton';\nimport { canvasCoordToCartesian } from '@vesium/shared';\nimport { Cartesian3, Color } from 'cesium';\nimport { PlotAction } from '../usePlot/PlotSkeleton';\n\n/**\n * 绘制非封闭的间隔框架点,如线段。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。\n */\nexport function intervalNonclosed(): PlotSkeleton {\n let dragIndex = -1;\n return {\n diabled: ({ active, defining }) => !active || defining,\n cursor: 'pointer',\n dragCursor: 'crosshair',\n format(packable) {\n const _positions = packable.positions ?? [];\n if (_positions.length < 2) {\n return [];\n }\n return _positions.slice(0, _positions.length - 1).map((position, i) => {\n return Cartesian3.midpoint(position, _positions[i + 1], new Cartesian3());\n });\n },\n onDrag({ viewer, sample, packable, context, index, lockCamera, dragging }) {\n lockCamera();\n const position = canvasCoordToCartesian(context.endPosition, viewer.scene);\n if (!position) {\n return;\n }\n const positions = [...packable.positions ?? []];\n if (dragIndex === -1) {\n dragIndex = index;\n positions.splice(index + 1, 0, position);\n }\n else {\n positions[dragIndex + 1] = position;\n }\n if (!dragging) {\n dragIndex = -1;\n }\n sample.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions,\n });\n },\n render: ({ position, action }) => {\n const colors = {\n [PlotAction.IDLE]: Color.GREEN.withAlpha(0.4),\n [PlotAction.HOVER]: Color.GREEN.withAlpha(0.6),\n [PlotAction.ACTIVE]: Color.GREEN.withAlpha(1.0),\n };\n return {\n position,\n point: {\n pixelSize: 6,\n color: colors[action],\n disableDepthTestDistance: Number.POSITIVE_INFINITY,\n outlineWidth: 1,\n outlineColor: Color.WHITE.withAlpha(0.4),\n },\n };\n },\n };\n}\n","import type { PlotSkeleton } from '../usePlot/PlotSkeleton';\nimport { canvasCoordToCartesian, toCartesian3 } from '@vesium/shared';\nimport { Cartesian3, Color, HorizontalOrigin, Rectangle, VerticalOrigin } from 'cesium';\nimport { PlotAction } from '../usePlot/PlotSkeleton';\n\n// see https://icones.js.org/collection/tabler?s=move&icon=tabler:arrows-move\nconst svg = `data:image/svg+xml;utf8,${encodeURIComponent(\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 24 24\"><path stroke=\"#ffffff\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m18 9l3 3l-3 3m-3-3h6M6 9l-3 3l3 3m-3-3h6m0 6l3 3l3-3m-3-3v6m3-15l-3-3l-3 3m3-3v6\"/></svg>',\n)}`;\n\n/**\n * 绘制非封闭的间隔框架点,如线段。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。\n */\nexport function moved(): PlotSkeleton {\n return {\n diabled: ({ active, defining }) => !active || defining,\n cursor: 'pointer',\n dragCursor: 'crosshair',\n format(packable) {\n const positions = packable.positions ?? [];\n if (positions.length === 0) {\n return [];\n }\n else if (positions.length === 1) {\n return [positions[0]];\n }\n else {\n const center = Rectangle.center(Rectangle.fromCartesianArray(positions));\n return [toCartesian3(center)!];\n }\n },\n onDrag({ viewer, sample, packable, context, lockCamera, dragging }) {\n dragging && lockCamera();\n const startPosition = canvasCoordToCartesian(context.startPosition, viewer.scene);\n const endPosition = canvasCoordToCartesian(context.endPosition, viewer.scene);\n\n if (!startPosition || !endPosition) {\n return;\n }\n const offset = Cartesian3.subtract(endPosition, startPosition, new Cartesian3());\n const positions = [...packable.positions ?? []];\n\n sample.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions: positions.map(position => Cartesian3.add(position, offset, new Cartesian3())),\n });\n },\n render: ({ position, action }) => {\n const colors = {\n [PlotAction.IDLE]: Color.WHITE,\n [PlotAction.HOVER]: Color.WHITE,\n [PlotAction.ACTIVE]: Color.AQUA.withAlpha(1.0),\n };\n return {\n position,\n billboard: {\n image: svg,\n width: 20,\n height: 20,\n color: colors[action],\n pixelOffset: new Cartesian3(0, -20),\n horizontalOrigin: HorizontalOrigin.CENTER,\n verticalOrigin: VerticalOrigin.BOTTOM,\n disableDepthTestDistance: Number.POSITIVE_INFINITY,\n },\n };\n },\n };\n}\n","import type { PlotConstructorOptions } from '../usePlot/Plot';\nimport { CallbackPositionProperty, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * 广告牌标绘方案\n */\nexport const PLOT_BILLBOARD_SCHEME: PlotConstructorOptions = {\n scheme: {\n type: 'Billboard',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities?.[0]\n ?? new Entity({\n billboard: { },\n });\n const position = packable.positions?.[0] ?? mouse;\n entity.position = new CallbackPositionProperty(() => position, true);\n\n return {\n entities: [entity],\n };\n },\n },\n};\n","import type { PlotConstructorOptions } from '../usePlot/Plot';\nimport { CallbackPositionProperty, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * 标签文字标绘方案\n */\nexport const PLOT_LABEL_SCHEME: PlotConstructorOptions = {\n scheme: {\n type: 'Label',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities?.[0]\n ?? new Entity({\n label: {\n text: 'Label',\n },\n });\n const position = packable.positions?.[0] ?? mouse;\n entity.position = new CallbackPositionProperty(() => position, true);\n\n return {\n entities: [entity],\n };\n },\n },\n};\n","import type { PlotConstructorOptions } from '../usePlot/Plot';\nimport { CallbackProperty, Entity } from 'cesium';\nimport { control } from '../skeleton/control';\nimport { intervalNonclosed } from '../skeleton/intervalNonclosed';\nimport { moved } from '../skeleton/moved';\n\n/**\n * 内置的线段标绘方案\n */\nexport const PLOT_LINE_STRING_SCHEME: PlotConstructorOptions = {\n scheme: {\n type: 'LineString',\n forceComplete: packable => packable.positions!.length >= 2,\n skeletons: [\n control,\n intervalNonclosed,\n moved,\n ],\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities?.[0]\n ?? new Entity({\n polyline: {\n width: 1,\n },\n });\n entity.polyline!.positions = new CallbackProperty(() => {\n const positions = [...packable.positions ?? []].concat(mouse ? [mouse] : []);\n return positions.length >= 2 ? positions : [];\n }, false);\n\n return {\n entities: [entity],\n };\n },\n },\n};\n","import type { PlotConstructorOptions } from '../usePlot/Plot';\nimport { CallbackProperty, Color, Entity, PolygonHierarchy } from 'cesium';\nimport { control, interval, moved } from '../skeleton';\n\n/**\n * 内置的多边形标绘方案\n */\nexport const PLOT_POLYGON_SCHEME: PlotConstructorOptions = {\n scheme: {\n type: 'Polygon',\n forceComplete: packable => packable.positions!.length >= 3,\n skeletons: [\n control,\n interval,\n moved,\n ],\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities?.[0]\n ?? new Entity({\n polyline: {\n material: Color.YELLOW.withAlpha(0.5),\n },\n polygon: {\n material: Color.YELLOW.withAlpha(0.5),\n },\n });\n\n const positions = [...packable.positions ?? []];\n mouse && positions.push(mouse);\n\n if (positions.length === 2) {\n entity.polygon!.hierarchy = undefined;\n entity.polyline!.positions = new CallbackProperty(() => positions, false);\n }\n else if (positions.length >= 3) {\n entity.polyline!.positions = undefined;\n entity.polygon!.hierarchy = new CallbackProperty(() => {\n positions.push(positions[0]);\n return positions.length >= 3 ? new PolygonHierarchy([...positions]) : undefined;\n }, false);\n }\n else {\n entity.polygon!.hierarchy = undefined;\n entity.polyline!.positions = undefined;\n }\n\n return {\n entities: [entity],\n };\n },\n },\n};\n","import type { Nullable } from '@vesium/shared';\nimport type { MaybeRef } from '@vueuse/core';\nimport type { Cartesian3, Entity } from 'cesium';\nimport type { CSSProperties } from 'vue';\nimport type { PlotSkeleton } from './PlotSkeleton';\nimport type { SampledPlotPackable } from './SampledPlotProperty';\nimport { assertError, isFunction } from '@vesium/shared';\nimport { assert } from '@vueuse/core';\n\nexport interface PlotRenderResult {\n entities?: Entity[];\n primitives?: any[];\n groundPrimitives?: any[];\n}\n\nexport interface PlotRenderOptions<D = any> {\n packable: SampledPlotPackable<D>;\n defining: boolean;\n mouse?: Cartesian3;\n previous: PlotRenderResult;\n}\n\nexport interface PlotSchemeConstructorOptions {\n type: string;\n\n /**\n * 是否立即执行完成标绘操作\n * 每次控制点发生变变化时,执行该回调函数,如果返回`true`则标绘完成\n */\n complete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 双击时,是否执行完成标绘操作\n * 每次控制点发生变变化时,执行该回调函数,如果返回 true 则下一次双击事件执行完成\n */\n forceComplete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 处于定义态时的鼠标样式\n * @default 'crosshair'\n */\n definingCursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);\n\n /**\n * 框架点渲染配置\n */\n skeletons?: ((() => PlotSkeleton) | PlotSkeleton) [];\n\n /**\n */\n render?: (options: PlotRenderOptions) => PlotRenderResult | Promise<PlotRenderResult>;\n\n}\n\nexport class PlotScheme {\n constructor(options: PlotSchemeConstructorOptions) {\n this.type = options.type;\n this.complete = options.complete;\n this.forceComplete = options.forceComplete;\n this.definingCursor = options.definingCursor ?? 'crosshair';\n this.skeletons = options.skeletons?.map(item => isFunction(item) ? item() : item) ?? [];\n this.render = options.render;\n }\n\n type: string;\n\n /**\n * 是否立即执行完成标绘操作\n *\n * 每次控制点发生变变化时,执行该回调函数,如果返回`true`则标绘完成\n */\n complete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 双击时,是否执行完成标绘操作\n */\n forceComplete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 处于定义态时的鼠标样式\n * @default 'crosshair'\n */\n definingCursor?: MaybeRef<Nullable<CSSProperties['cursor']>> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);\n\n /**\n * 框架点渲染配置\n */\n skeletons: PlotSkeleton [];\n\n /**\n */\n render?: (options: PlotRenderOptions) => PlotRenderResult | Promise<PlotRenderResult>;\n\n /**\n * @internal\n */\n private static _record = new Map<string, PlotScheme>();\n\n static getRecordTypes(): string[] {\n return [...this._record.keys()];\n }\n\n static getRecord(type: string): PlotScheme | undefined {\n return PlotScheme._record.get(type);\n }\n\n static setRecord(scheme: PlotScheme): void {\n assertError(!scheme.type, '`scheme.type` is required');\n PlotScheme._record.set(scheme.type, scheme);\n }\n\n /**\n * 解析传入的 scheme,并返回 PlotScheme 实例\n */\n static resolve(maybeScheme: string | PlotScheme | PlotSchemeConstructorOptions): PlotScheme {\n if (typeof maybeScheme === 'string') {\n const _scheme = PlotScheme.getRecord(maybeScheme);\n assert(!!_scheme, `scheme ${maybeScheme} not found`);\n return _scheme!;\n }\n else if (!(maybeScheme instanceof PlotScheme)) {\n return new PlotScheme(maybeScheme);\n }\n else {\n return maybeScheme;\n }\n }\n}\n","import type { Property } from 'cesium';\nimport { Cartesian3, Event, JulianDate, TimeInterval } from 'cesium';\n\n/**\n * 标绘采集到的数据\n */\nexport interface SampledPlotPackable<D = any> {\n time: JulianDate;\n positions?: Cartesian3[];\n derivative?: D;\n}\n\nexport enum SampledPlotStrategy {\n NEAR = 0,\n CYCLE = 1,\n STRICT = 2,\n}\n\nexport type SampledPlotInterpolationAlgorithm<D = any> = (\n time: JulianDate,\n previous: SampledPlotPackable<D>,\n next: SampledPlotPackable<D>,\n proportion: number\n) => SampledPlotPackable;\n\n/**\n * 默认插值算法\n *\n * @param time 时间\n * @param previous 前一个数据点\n * @param next 后一个数据点\n * @param proportion 比例\n * @returns 插值结果\n */\nconst defaultInterpolationAlgorithm: SampledPlotInterpolationAlgorithm = (time, previous, next, proportion) => {\n if (proportion === 0) {\n return {\n time,\n positions: previous.positions?.map(item => item.clone()),\n derivative: previous.derivative,\n };\n }\n else if (proportion === 1) {\n return {\n time,\n positions: next.positions?.map(item => item.clone()),\n derivative: previous.derivative,\n };\n }\n\n return {\n time,\n positions: next.positions?.map((right, index) => {\n const left = previous.positions?.[index];\n return !left ? right : Cartesian3.lerp(left, right, proportion, new Cartesian3());\n }),\n derivative: previous.derivative,\n };\n};\n\nexport interface SampledPlotPropertyConstructorOptions<D = any> {\n interpolationAlgorithm?: SampledPlotInterpolationAlgorithm<D>;\n strategy?: SampledPlotStrategy;\n packables?: SampledPlotPackable<D>[];\n}\n\n/**\n * 标绘属性数据\n */\nexport class SampledPlotProperty<D = any> {\n constructor(options?: SampledPlotPropertyConstructorOptions<D>) {\n this.interpolationAlgorithm = options?.interpolationAlgorithm;\n this.strategy = options?.strategy ?? SampledPlotStrategy.NEAR;\n options?.packables?.forEach(packable => this.setSample(packable));\n // 默认将初始化一项数据\n if (!this._times.length) {\n this.setSample({\n time: JulianDate.now(),\n positions: [],\n derivative: undefined,\n });\n }\n }\n\n static defaultInterpolationAlgorithm: SampledPlotInterpolationAlgorithm<any> = defaultInterpolationAlgorithm;\n\n strategy: SampledPlotStrategy;\n\n interpolationAlgorithm?: SampledPlotInterpolationAlgorithm;\n\n /**\n * @internal\n */\n private _times: JulianDate[] = [];\n\n /**\n * @internal\n */\n private _sampleds: Cartesian3[][] = [];\n\n /**\n * @internal\n */\n private _derivatives: (D | undefined)[] = [];\n\n get isConstant(): boolean {\n return this._times.length === 0;\n };\n\n /**\n * @internal\n */\n private _definitionChanged = new Event<(...args: any[]) => void>();\n\n get definitionChanged(): Event<(...args: any[]) => void> {\n return this._definitionChanged;\n };\n\n /**\n * 获取时间数组\n *\n * @returns 返回包含所有时间的 JulianDate 数组\n */\n getTimes(): JulianDate[] {\n return this._times.map(t => t.clone());\n }\n\n /**\n * 根据给定的儒略日期获取时间索引范围及比例\n *\n * @param time 给定的儒略日期\n * @returns 返回包含前一个索引、后一个索引及时间比例的对象,若不符合条件则返回undefined\n * @internal\n */\n private getIndexScope(time: JulianDate): { prevIndex: number; nextIndex: number; proportion: number } | undefined {\n if (!this._times.length) {\n return;\n }\n const start = this._times[0];\n const end = this._times[this._times.length - 1];\n if (JulianDate.lessThan(time, start) || JulianDate.greaterThan(time, end)) {\n switch (this.strategy) {\n case SampledPlotStrategy.STRICT: {\n return;\n }\n case SampledPlotStrategy.NEAR: {\n time = JulianDate.lessThan(time, this._times[0])\n ? this._times[0].clone()\n : this._times[this._times.length - 1].clone();\n break;\n }\n case SampledPlotStrategy.CYCLE: {\n const startMS = JulianDate.toDate(this._times[0]).getTime();\n const endMS = JulianDate.toDate(this._times[this._times.length - 1]).getTime();\n const duration = endMS - startMS;\n const timeMS = JulianDate.toDate(time).getTime();\n const diff = (timeMS - startMS) % duration;\n const dete = new Date(startMS + diff);\n time = JulianDate.fromDate(dete);\n break;\n }\n }\n }\n\n const prevIndex = this._times.findIndex(t => JulianDate.lessThanOrEquals(time, t));\n const nextIndex = Math.min(prevIndex, this._times.length - 1);\n const prevMs = JulianDate.toDate(this._times[prevIndex]).getTime();\n const nextMs = JulianDate.toDate(this._times[nextIndex]).getTime();\n const ms = JulianDate.toDate(time).getTime();\n\n return {\n prevIndex,\n nextIndex,\n proportion: ((ms - prevMs) / (nextMs - prevMs)) || 0,\n };\n }\n\n /**\n * 根据给定的儒略日期(JulianDate)获取插值后的样本点数据。\n *\n * @param time 指定的儒略日期(JulianDate)。\n * @param result 可选参数,用于存储结果的容器。如果未提供,则创建一个新的容器。\n * @returns 插值后的样本点数据,存储在提供的或新创建的result容器中。\n * @template D 数据类型。\n */\n getValue(time: JulianDate, result?: SampledPlotPackable): SampledPlotPackable<D> {\n result ??= { time };\n Object.assign(result, {\n time: time.clone(),\n positions: undefined,\n derivative: undefined,\n });\n\n if (!time) {\n result.time = this._times[0]?.clone();\n result.positions = this._sampleds[0]?.map(c => c.clone(c));\n result.derivative = this._derivatives[0];\n return result;\n }\n const scope = this.getIndexScope(time);\n if (!scope) {\n return result;\n }\n\n result.time = time;\n const { prevIndex, nextIndex, proportion } = scope;\n const previous: SampledPlotPackable<D> = {\n time: this._times[prevIndex],\n positions: this._sampleds[prevIndex],\n derivative: this._derivatives[prevIndex],\n };\n const next: SampledPlotPackable<D> = {\n time: this._times[nextIndex],\n positions: this._sampleds[nextIndex],\n derivative: this._derivatives[nextIndex],\n };\n const packable = (this.interpolationAlgorithm || SampledPlotProperty.defaultInterpolationAlgorithm)(time, previous, next, proportion);\n Object.assign(result, packable);\n return result;\n }\n\n /**\n * 设置样本数据\n *\n * @param value 样本数据对象,包含时间、位置和导数信息\n */\n setSample(value: SampledPlotPackable<D>): void {\n const time = value.time.clone();\n const positions = value.positions?.map(item => item.clone()) ?? [];\n const derivative = value.derivative;\n const index = this._times.findIndex(t => JulianDate.equals(time, t));\n\n if (index !== -1) {\n this._times[index] = time;\n this._sampleds[index] = positions;\n this._derivatives[index] = value.derivative;\n }\n else if (this._times.length === 0) {\n this._times[0] = time;\n this._sampleds[0] = positions;\n this._derivatives[0] = value.derivative;\n }\n else if (JulianDate.lessThan(time, this._times[0])) {\n this._times.splice(0, 0, time);\n this._sampleds.splice(0, 0, positions);\n this._derivatives.splice(0, 0, derivative);\n }\n else if (JulianDate.greaterThan(time, this._times[this._times.length - 1])) {\n this._times.push(time);\n this._sampleds.push(positions);\n this._derivatives.push(derivative);\n }\n\n this.definitionChanged.raiseEvent(this);\n }\n\n /**\n * 设置样本数据\n *\n * @param values 样本数据数组,每个元素都是类型为SampledPlotPackable<D>的对象\n */\n setSamples(values: SampledPlotPackable<D>[]): void {\n values.forEach(value => this.setSample(value));\n }\n\n /**\n * 从样本中移除指定时间点的数据\n *\n * @param time 需要移除的时间点,使用儒略日期表示\n * @returns 如果成功移除,则返回 true;否则返回 false\n */\n removeSample(time: JulianDate): boolean {\n const index = this._times.findIndex(t => t.equals(time));\n if (index !== -1) {\n this._sampleds.splice(index, 1);\n this._derivatives.splice(index, 1);\n const removed = this._times.splice(index, 1);\n if (removed.length) {\n this._definitionChanged.raiseEvent(this);\n return true;\n }\n }\n return false;\n }\n\n /**\n * 从样本中移除指定时间间隔内的样本。\n *\n * @param interval 要移除样本的时间间隔\n */\n removeSamples(interval: TimeInterval): void {\n for (let i = 0; i < this._times.length; i++) {\n const time = this._times[i];\n TimeInterval.contains(interval, time) && this.removeSample(time);\n }\n }\n\n equals(other?: Property): boolean {\n return other === this;\n }\n}\n","import type { Entity, JulianDate } from 'cesium';\nimport type { PlotSchemeConstructorOptions } from './PlotScheme';\nimport type { PlotSkeletonEntity } from './PlotSkeletonEntity';\nimport type { SampledPlotPropertyConstructorOptions } from './SampledPlotProperty';\nimport { assertError, createCesiumAttribute, createCesiumProperty } from '@vesium/shared';\nimport { notNullish } from '@vueuse/core';\nimport { createGuid, Event } from 'cesium';\nimport { PlotScheme } from './PlotScheme';\nimport { SampledPlotProperty } from './SampledPlotProperty';\n\nexport interface PlotConstructorOptions {\n id?: string;\n disabled?: boolean;\n scheme: string | PlotScheme | PlotSchemeConstructorOptions;\n sample?: SampledPlotProperty | SampledPlotPropertyConstructorOptions;\n}\n\nexport class Plot {\n constructor(options: PlotConstructorOptions) {\n assertError(!notNullish(options.scheme), 'options.scheme is required');\n\n this.id = options.id || createGuid();\n createCesiumAttribute(this, 'disabled', !!options.disabled);\n createCesiumAttribute(this, 'defining', true);\n createCesiumAttribute(this, 'scheme', PlotScheme.resolve(options.scheme), { readonly: true });\n const sample = options.sample instanceof SampledPlotProperty ? options.sample : new SampledPlotProperty(options.sample);\n createCesiumProperty(this, 'sample', sample);\n createCesiumAttribute(this, 'entities', []);\n createCesiumAttribute(this, 'primitives', []);\n createCesiumAttribute(this, 'groundPrimitives', []);\n createCesiumAttribute(this, 'skeletonEntities', []);\n }\n\n /**\n * @internal\n */\n private _definitionChanged = new Event();\n\n get definitionChanged(): Event<(scope: Plot, key: keyof Plot, newValue: Plot[typeof key], oldValue: Plot[typeof key]) => void> {\n return this._definitionChanged;\n }\n\n time?: JulianDate;\n\n declare id: string;\n\n declare disabled: boolean;\n\n declare readonly scheme: PlotScheme;\n\n declare sample: SampledPlotProperty;\n\n /**\n * @internal\n */\n declare defining: boolean;\n\n isDefining(): boolean {\n return this.defining;\n }\n\n /**\n * @internal\n */\n declare entities: Entity[];\n\n getEntities(): Entity[] {\n return [...this.entities];\n }\n\n /**\n * @internal\n */\n declare primitives: any[];\n\n getPrimitives(): any[] {\n return [...this.primitives];\n }\n\n /**\n * @internal\n */\n declare groundPrimitives: any[];\n\n getGroundPrimitives(): any[] {\n return [...this.groundPrimitives];\n }\n\n /**\n * @internal\n */\n declare skeletonEntities: PlotSkeletonEntity[];\n\n /**\n * 获取该标绘的骨架点entity数组\n *\n */\n getSkeletonEntities(): PlotSkeletonEntity[] {\n return [...this.skeletonEntities];\n }\n}\n","import type { Cartesian3, Entity, JulianDate } from 'cesium';\nimport type { ComputedRef, ShallowRef } from 'vue';\nimport type { Plot } from './Plot';\nimport { useCesiumEventListener, useDataSource, useEntityScope, usePrimitive, usePrimitiveScope, useScreenSpaceEventHandler, useViewer } from '@vesium/core';\nimport { arrayDifference, canvasCoordToCartesian, throttle } from '@vesium/shared';\nimport { watchArray } from '@vueuse/core';\nimport { CustomDataSource, PrimitiveCollection, ScreenSpaceEventType } from 'cesium';\nimport { computed, shallowRef, watch } from 'vue';\n\nexport interface UseProductRetrun {\n primitives: ComputedRef<any[]>;\n entities: ComputedRef<Entity[]>;\n groundPrimitives: ComputedRef<any[]>;\n}\n\nexport function useRender(\n plots: ComputedRef<Plot[]>,\n current: ShallowRef<Plot | undefined>,\n getCurrentTime: () => JulianDate,\n): UseProductRetrun {\n const viewer = useViewer();\n\n const primitiveCollection = usePrimitive(new PrimitiveCollection())!;\n const groundPrimitiveCollection = usePrimitive(new PrimitiveCollection(), { collection: 'ground' })!;\n const dataSource = useDataSource(new CustomDataSource());\n\n const entityScope = useEntityScope({ collection: () => dataSource.value!.entities });\n const primitiveScope = usePrimitiveScope({ collection: () => primitiveCollection.value! });\n const groundPrimitiveScope = usePrimitiveScope({ collection: () => groundPrimitiveCollection.value! });\n\n const mouseCartesian = shallowRef<Cartesian3>();\n\n useScreenSpaceEventHandler(\n ScreenSpaceEventType.MOUSE_MOVE,\n throttle((context) => {\n mouseCartesian.value = canvasCoordToCartesian(context?.endPosition, viewer.value!.scene);\n }, 10),\n );\n\n watchArray(plots, (_value, _oldValue, added, removed = []) => {\n removed.forEach((plot) => {\n entityScope.removeWhere(item => plot.entities.includes(item));\n primitiveScope.removeWhere(item => plot.primitives.includes(item));\n groundPrimitiveScope.removeWhere(item => plot.groundPrimitives.includes(item));\n });\n\n added.forEach((plot) => {\n plot.entities.forEach(item => entityScope.add(item));\n plot.primitives.forEach(item => primitiveScope.add(item));\n plot.groundPrimitives.forEach(item => groundPrimitiveScope.add(item));\n });\n }, {\n immediate: true,\n });\n\n useCesiumEventListener(\n () => plots.value.map(item => item.definitionChanged),\n (_scope, key, newValue, oldValue) => {\n if (key === 'entities') {\n const { added, removed } = arrayDifference(newValue as Entity[], oldValue as Entity[]);\n added.forEach(item => entityScope.add(item));\n removed.forEach(item => entityScope.remove(item));\n }\n else if (key === 'primitives') {\n const { added, removed } = arrayDifference(newValue as Entity[], oldValue as Entity[]);\n added.forEach(item => primitiveScope.add(item));\n removed.forEach(item => primitiveScope.remove(item));\n }\n else if (key === 'groundPrimitives') {\n const { added, removed } = arrayDifference(newValue as Entity[], oldValue as Entity[]);\n added.forEach(item => groundPrimitiveScope.add(item));\n removed.forEach(item => groundPrimitiveScope.remove(item));\n }\n },\n );\n\n const update = throttle(async (plot: Plot) => {\n const reslut = await plot.scheme.render?.({\n packable: plot.sample.getValue(getCurrentTime()),\n mouse: plot.defining ? mouseCartesian.value : undefined,\n defining: plot.defining,\n previous: {\n entities: plot.entities,\n primitives: plot.primitives,\n groundPrimitives: plot.groundPrimitives,\n },\n });\n\n plot.entities = reslut?.entities ?? [];\n plot.primitives = reslut?.primitives ?? [];\n plot.groundPrimitives = reslut?.groundPrimitives ?? [];\n }, 1);\n\n watch(current, (plot, previous) => {\n previous && update(previous);\n });\n\n useCesiumEventListener(\n () => plots.value.map(item => item.definitionChanged),\n (plot, key) => {\n if (['disabled', 'defining', 'scheme', 'sample', 'time'].includes(key)) {\n update(plot);\n }\n },\n );\n\n watch(mouseCartesian, () => {\n plots.value.forEach(plot => plot.defining && update(plot));\n });\n\n return {\n primitives: computed(() => Array.from(primitiveScope.scope)),\n groundPrimitives: computed(() => Array.from(primitiveScope.scope)),\n entities: computed(() => Array.from(entityScope.scope)),\n };\n}\n","import type { Nullable } from '@vesium/shared';\nimport type { JulianDate } from 'cesium';\nimport type { CSSProperties, ShallowRef } from 'vue';\nimport type { Plot } from './Plot';\nimport { useCesiumEventListener, useScreenSpaceEventHandler, useViewer } from '@vesium/core';\nimport { canvasCoordToCartesian, isFunction } from '@vesium/shared';\nimport { promiseTimeout } from '@vueuse/core';\nimport { ScreenSpaceEventType } from 'cesium';\nimport { computed, ref, toValue, watch } from 'vue';\n\nexport function useSampled(\n current: ShallowRef<Plot | undefined>,\n getCurrentTime: () => JulianDate,\n): void {\n const viewer = useViewer();\n const doubleClicking = ref(false);\n\n const packable = computed(() => {\n return current.value?.sample.getValue(getCurrentTime());\n });\n\n // 左键点击添加点\n useScreenSpaceEventHandler(\n ScreenSpaceEventType.LEFT_CLICK,\n async (ctx) => {\n await promiseTimeout(1);\n if (!current.value || !packable.value) {\n return;\n }\n // 双击会触发两次事件, 这里做一个防抖处理,只需触发一次事件\n if (doubleClicking.value) {\n return;\n }\n const { scheme, defining, sample } = current.value;\n if (!defining) {\n return;\n }\n const position = canvasCoordToCartesian(ctx.position, viewer.value!.scene);\n if (!position) {\n return;\n }\n packable.value.positions ??= [];\n packable.value.positions.push(position);\n sample.setSample(packable.value);\n const completed = scheme.complete?.(packable.value);\n completed && (current.value.defining = false);\n },\n );\n\n // 双击结束定义态,进入激活态\n useScreenSpaceEventHandler(\n ScreenSpaceEventType.LEFT_DOUBLE_CLICK,\n async (ctx) => {\n if (!current.value || !packable.value) {\n return;\n }\n doubleClicking.value = true;\n await promiseTimeout(2);\n doubleClicking.value = false;\n\n const { scheme, defining } = current.value;\n if (!defining) {\n return;\n }\n const position = canvasCoordToCartesian(ctx.position, viewer.value!.scene);\n if (!position) {\n return;\n }\n\n const completed = scheme.forceComplete?.(packable.value);\n completed && (current.value.defining = false);\n },\n );\n\n // 右键回退到上一个点\n useScreenSpaceEventHandler(\n ScreenSpaceEventType.RIGHT_CLICK,\n async () => {\n if (!current.value || !packable.value) {\n return;\n }\n const { defining, sample } = current.value;\n\n if (!defining) {\n return;\n }\n packable.value.positions ??= [];\n if (packable.value.positions.length === 0) {\n return;\n }\n packable.value.positions.splice(packable.value.positions.length - 1, 1);\n sample.setSample(packable.value);\n },\n );\n\n // 定义态时的鼠标样式\n const definingCursorCss = ref<Nullable<CSSProperties['cursor']>>();\n\n const setDefiningCursorCss = () => {\n if (!current.value?.defining) {\n if (definingCursorCss.value) {\n definingCursorCss.value = undefined;\n viewer.value!.container.parentElement!.style.removeProperty('cursor');\n }\n }\n else {\n const definingCursor = current.value!.scheme.definingCursor;\n definingCursorCss.value = isFunction(definingCursor) ? definingCursor(packable.value!) : toValue(definingCursor);\n if (definingCursorCss.value) {\n viewer.value?.container.parentElement!.style.setProperty('cursor', definingCursorCss.value);\n }\n }\n };\n\n useCesiumEventListener(() => current.value?.definitionChanged, (plot, key) => {\n if (key === 'defining' || key === 'sample') {\n setDefiningCursorCss();\n }\n });\n watch(current, () => setDefiningCursorCss());\n}\n","import type { Plot } from '..';\nimport type { PlotSkeleton } from './PlotSkeleton';\nimport { Entity } from 'cesium';\n\n/**\n * 标绘框架点 Entity\n */\nexport class PlotSkeletonEntity extends Entity {\n constructor(options: Entity.ConstructorOptions) {\n super(options);\n }\n\n /**\n * @internal\n */\n declare plot: Plot;\n\n /**\n * @internal\n */\n declare skeleton: PlotSkeleton;\n\n /**\n * @internal\n */\n declare index: number;\n}\n","import type { JulianDate } from 'cesium';\nimport type { ComputedRef, ShallowRef } from 'vue';\nimport type { Plot } from './Plot';\nimport type { PlotSkeleton } from './PlotSkeleton';\nimport { useCesiumEventListener, useDataSource, useEntityScope, useGraphicDrag, useGraphicHover, useGraphicLeftClick, useViewer } from '@vesium/core';\nimport { arrayDifference, isFunction, throttle } from '@vesium/shared';\nimport { onKeyStroke, watchArray } from '@vueuse/core';\nimport { CustomDataSource } from 'cesium';\nimport { shallowRef, toValue, watch } from 'vue';\nimport { PlotAction } from './PlotSkeleton';\nimport { PlotSkeletonEntity } from './PlotSkeletonEntity';\n\nexport function useSkeleton(\n plots: ComputedRef<Plot[]>,\n current: ShallowRef<Plot | undefined>,\n getCurrentTime: () => JulianDate,\n) {\n const viewer = useViewer();\n\n const dataSource = useDataSource(new CustomDataSource());\n const entityScope = useEntityScope({ collection: () => dataSource.value!.entities });\n\n const hoverEntity = shallowRef<PlotSkeletonEntity>();\n const activeEntity = shallowRef<PlotSkeletonEntity>();\n\n // 获取当前点位的状态\n const getPointAction = (entity?: PlotSkeletonEntity) => {\n if (!entity) {\n return PlotAction.IDLE;\n }\n return activeEntity.value?.id === entity.id\n ? PlotAction.ACTIVE\n : hoverEntity.value?.id === entity.id\n ? PlotAction.HOVER\n : PlotAction.IDLE;\n };\n\n const update = throttle((plot: Plot, destroyed?: boolean) => {\n const oldEntities = plot.getSkeletonEntities();\n const entities: PlotSkeletonEntity[] = [];\n\n if (destroyed || plot.disabled) {\n plot.skeletonEntities = [];\n }\n else {\n const packable = plot.sample.getValue(getCurrentTime());\n const defining = plot.defining;\n const active = current.value === plot;\n const skeletons = plot.scheme.skeletons;\n\n skeletons.forEach((skeleton) => {\n const diabled = isFunction(skeleton.diabled) ? skeleton.diabled({ active, defining }) : skeleton.diabled;\n if (diabled) {\n return;\n }\n const positions = skeleton.format?.(packable!) ?? packable?.positions ?? [];\n\n positions.forEach((position, index) => {\n let entity = oldEntities.find(item => item.index === index && item.skeleton === skeleton);\n const options = skeleton.render?.({\n defining,\n active,\n index,\n packable,\n positions,\n position,\n action: getPointAction(entity),\n });\n\n const merge = new PlotSkeletonEntity(options ?? {});\n if (entity) {\n merge.propertyNames.forEach((key) => {\n if (key !== 'id') {\n // @ts-expect-error ignore\n entity[key] = merge[key];\n }\n });\n }\n else {\n entity = merge;\n }\n entity.plot = plot;\n entity.skeleton = skeleton;\n entity.index = index;\n entities.push(entity);\n });\n });\n }\n plot.skeletonEntities = entities;\n }, 1);\n\n // cursor 仅在不存在定义态的标绘时才生效\n useGraphicDrag({\n cursor: (pick) => {\n if (!current.value?.defining && entityScope.scope.has(pick.id)) {\n const skeleton = pick.id.skeleton as PlotSkeleton;\n return isFunction(skeleton?.cursor) ? skeleton.cursor(pick) : toValue(skeleton?.cursor);\n }\n },\n dragCursor: (pick) => {\n if (!current.value?.defining && entityScope.scope.has(pick.id)) {\n const skeleton = pick.id.skeleton as PlotSkeleton;\n return isFunction(skeleton?.dragCursor) ? skeleton.dragCursor(pick) : toValue(skeleton?.dragCursor);\n }\n },\n listener: (params) => {\n if (params.pick.id instanceof PlotSkeletonEntity && entityScope.scope.has(params.pick.id)) {\n const entity = params.pick.id as PlotSkeletonEntity;\n\n const plot = entity.plot as Plot;\n // 仅在非定义态时才可拖拽\n if (plot.defining) {\n return;\n }\n activeEntity.value = entity;\n const skeleton = entity.skeleton as PlotSkeleton;\n const index = entity.index as number;\n const packable = plot.sample.getValue(getCurrentTime());\n skeleton.onDrag?.({\n viewer: viewer.value!,\n sample: plot.sample,\n packable,\n active: current.value === plot,\n index,\n context: params.context,\n dragging: params.dragging,\n lockCamera: params.lockCamera,\n });\n }\n else {\n activeEntity.value = undefined;\n }\n },\n });\n\n // 键盘控制当前激活的点位\n onKeyStroke((keyEvent) => {\n if (activeEntity.value) {\n const entity = activeEntity.value;\n const plot = entity.plot as Plot;\n const skeleton = entity.skeleton as PlotSkeleton;\n const index = entity.index as number;\n const packable = plot.sample.getValue(getCurrentTime());\n\n skeleton.onKeyPressed?.({\n viewer: viewer.value!,\n sample: plot.sample,\n packable,\n index,\n keyEvent,\n });\n }\n });\n\n useGraphicHover({\n listener: ({ hovering, pick }) => {\n if (hovering && pick.id instanceof PlotSkeletonEntity && entityScope.scope.has(pick.id)) {\n const entity = pick.id as PlotSkeletonEntity;\n hoverEntity.value = entity;\n }\n else {\n hoverEntity.value = undefined;\n }\n },\n });\n\n // 左键点击,令点位处于激活\n useGraphicLeftClick({\n listener: ({ context, pick }) => {\n if (pick.id instanceof PlotSkeletonEntity && entityScope.scope.has(pick.id)) {\n const entity = pick.id as PlotSkeletonEntity;\n activeEntity.value = entity;\n const plot = entity.plot as Plot;\n const skeleton = entity.skeleton as PlotSkeleton;\n const index = entity.index as number;\n\n const packable = plot.sample.getValue(getCurrentTime());\n\n skeleton.onLeftClick?.({\n viewer: viewer.value!,\n sample: plot.sample,\n packable: packable!,\n active: current.value === plot,\n defining: plot.defining,\n index,\n context,\n });\n }\n else {\n activeEntity.value = undefined;\n }\n },\n });\n\n watchArray(plots, (value, oldValue, added, removed = []) => {\n added.forEach(plot => update(plot));\n removed.forEach(plot => update(plot, true));\n });\n\n useCesiumEventListener(() => plots.value.map(plot => plot.definitionChanged), (plot, key, newValue, oldValue) => {\n if (['disabled', 'defining', 'scheme', 'sample', 'time'].includes(key)) {\n update(plot);\n }\n if (key === 'skeletonEntities') {\n const { added, removed } = arrayDifference(newValue as PlotSkeletonEntity[], oldValue as PlotSkeletonEntity[]);\n added.forEach(item => entityScope.add(item));\n removed.forEach(item => entityScope.remove(item));\n }\n });\n\n // 当前激活的标绘变化时,更新渲染\n watch(current, (plot, previous) => {\n plot && update(plot);\n setTimeout(() => {\n previous && update(previous);\n }, 2);\n });\n\n return {\n dataSource,\n };\n}\n","import type { ShallowRef } from 'vue';\nimport type { PlotConstructorOptions } from './Plot';\nimport type { SampledPlotPackable } from './SampledPlotProperty';\nimport { useCesiumEventListener, useScreenSpaceEventHandler } from '@vesium/core';\nimport { useViewer } from '@vesium/core/useViewer';\nimport { pickHitGraphic } from '@vesium/shared';\nimport { JulianDate, ScreenSpaceEventType } from 'cesium';\nimport { computed, shallowReactive, shallowRef, watch } from 'vue';\nimport { Plot } from './Plot';\nimport { useRender } from './useRender';\nimport { useSampled } from './useSampled';\nimport { useSkeleton } from './useSkeleton';\n\nexport interface UsePlotOptions {\n time?: ShallowRef<JulianDate | undefined>;\n}\n\nexport type UsePlotOperate = (plot: Plot | PlotConstructorOptions) => Promise<Plot>;\n\nexport interface UsePlotRetrun {\n\n time: ShallowRef<JulianDate | undefined>;\n\n data?: ShallowRef<Plot[]>;\n\n current?: ShallowRef<Plot | undefined>;\n /**\n * 触发标绘\n */\n operate: UsePlotOperate;\n\n /**\n * 强制终止当前进行中的标绘\n */\n cancel: VoidFunction;\n}\n\nexport function usePlot(options?: UsePlotOptions) {\n const time = options?.time || shallowRef<JulianDate>();\n\n const viewer = useViewer();\n\n const getCurrentTime = () => {\n return time.value?.clone() || viewer.value?.clock.currentTime?.clone() || JulianDate.now();\n };\n\n const collection = shallowReactive(new Set<Plot>());\n const plots = computed(() => Array.from(collection));\n const current = shallowRef<Plot>();\n const packable = shallowRef<SampledPlotPackable>();\n\n useCesiumEventListener([\n () => current.value?.sample.definitionChanged,\n ], () => {\n packable.value = current.value?.sample.getValue(getCurrentTime());\n });\n\n useSampled(current, getCurrentTime);\n useRender(plots, current, getCurrentTime);\n useSkeleton(plots, current, getCurrentTime);\n\n // 单击激活\n useScreenSpaceEventHandler(ScreenSpaceEventType.LEFT_CLICK, (data) => {\n if (current.value?.defining) {\n return;\n }\n const pick = viewer.value?.scene.pick(data.position.clone());\n // 点击到了骨架点则不处理\n if (pick?.id?.plot instanceof Plot) {\n return;\n }\n if (!pick) {\n current.value = undefined;\n return;\n }\n current.value = plots.value.find(plot => pickHitGraphic(pick, [...plot.entities, ...plot.primitives, ...plot.groundPrimitives]));\n });\n\n let operateResolve: ((plot: Plot) => void) | undefined;\n let operateReject: (() => void) | undefined;\n\n watch(current, (plot, previous) => {\n if (previous) {\n if (previous.defining) {\n const packable = previous.sample.getValue(getCurrentTime());\n const completed = previous.scheme.forceComplete?.(packable);\n if (completed) {\n previous.defining = false;\n operateResolve?.(previous);\n }\n else {\n collection.delete(previous);\n }\n }\n }\n });\n\n const operate: UsePlotOperate = async (plot) => {\n return new Promise((resolve, reject) => {\n operateResolve = resolve;\n operateReject = reject;\n const _plot = plot instanceof Plot ? plot : new Plot(plot);\n\n if (!collection.has(_plot)) {\n collection.add(_plot);\n }\n current.value = _plot;\n return resolve(_plot);\n });\n };\n\n const remove = (plot: Plot): boolean => {\n if (plot === current.value) {\n current.value = undefined;\n }\n if (collection.has(plot)) {\n collection.delete(plot);\n return true;\n }\n return false;\n };\n\n return {\n plots,\n time,\n operate,\n remove,\n cancel: operateReject,\n };\n}\n"],"names":["cesium","shared","core","core$1","useViewer","vue","PlotAction","control","active","viewer","sample","packable","context","index","lockCamera","position","canvasCoordToCartesian","positions","keyEvent","_a","height","toCartographic","headingAdjust","newHeading","cartographic","distance","toCartesian3","action","colors","Color","interval","dragIndex","defining","_positions","i","next","Cartesian3","dragging","intervalNonclosed","svg","moved","center","Rectangle","startPosition","endPosition","offset","HorizontalOrigin","VerticalOrigin","PLOT_BILLBOARD_SCHEME","options","_b","mouse","entity","Entity","CallbackPositionProperty","PLOT_LABEL_SCHEME","PLOT_LINE_STRING_SCHEME","CallbackProperty","PLOT_POLYGON_SCHEME","PolygonHierarchy","_PlotScheme","__publicField","item","isFunction","type","scheme","assertError","maybeScheme","_scheme","assert","PlotScheme","SampledPlotStrategy","defaultInterpolationAlgorithm","time","previous","proportion","_c","right","left","_SampledPlotProperty","Event","JulianDate","t","start","end","startMS","duration","diff","dete","prevIndex","nextIndex","prevMs","nextMs","ms","result","c","scope","value","derivative","values","TimeInterval","other","SampledPlotProperty","Plot","notNullish","createGuid","createCesiumAttribute","useRender","plots","current","getCurrentTime","primitiveCollection","usePrimitive","PrimitiveCollection","groundPrimitiveCollection","dataSource","useDataSource","CustomDataSource","entityScope","useEntityScope","primitiveScope","usePrimitiveScope","groundPrimitiveScope","mouseCartesian","shallowRef","ScreenSpaceEventType","throttle","_value","_oldValue","added","removed","plot","_scope","key","newValue","oldValue","arrayDifference","update","reslut","watch","computed","useSampled","doubleClicking","ref","ctx","promiseTimeout","definingCursorCss","setDefiningCursorCss","definingCursor","toValue","useCesiumEventListener","PlotSkeletonEntity","useSkeleton","hoverEntity","activeEntity","getPointAction","destroyed","oldEntities","entities","skeleton","merge","useGraphicDrag","pick","params","useGraphicHover","hovering","useGraphicLeftClick","usePlot","collection","shallowReactive","useScreenSpaceEventHandler","data","pickHitGraphic","operateResolve","operateReject","resolve","reject","_plot"],"mappings":"yKAyHY,OAAA,eAAA,QAAA,OAAA,YAAA,CAAA,MAAA,QAAA,CAAA,EAAA,MAAAA,EAAA,QAAA,QAAA,EAAAC,EAAA,QAAA,gBAAA,EAAAC,EAAA,QAAA,cAAA,EAAAC,EAAA,QAAA,cAAA,EAAAC,EAAA,QAAA,wBAAA,EAAAC,EAAA,QAAA,KAAA,EAAA,IAAAC,GAAAA,IACVA,EAAAA,EAAA,KAAO,CAAP,EAAA,OACAA,EAAAA,EAAA,MAAQ,CAAR,EAAA,QACAA,EAAAA,EAAA,OAAS,CAAT,EAAA,SAHUA,IAAAA,GAAA,CAAA,CAAA,ECjHL,SAASC,GAAwB,CAC/B,MAAA,CACL,QAAS,CAAC,CAAE,OAAAC,KAAa,CAACA,EAC1B,OAAQ,UACR,WAAY,YACZ,OAAO,CAAE,OAAAC,EAAQ,OAAAC,EAAQ,SAAAC,EAAU,QAAAC,EAAS,MAAAC,EAAO,WAAAC,GAAc,CACpDA,EAAA,EACX,MAAMC,EAAWC,EAAAA,uBAAuBJ,EAAQ,YAAaH,EAAO,KAAK,EACzE,GAAIM,EAAU,CACZ,MAAME,EAAY,CAAC,GAAGN,EAAS,WAAa,CAAA,CAAE,EAC9CM,EAAUJ,CAAK,EAAIE,EACnBL,EAAO,UAAU,CACf,KAAMC,E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,MAAQoE,EACTF,EAAQE,CAAK,CAAA,CACrB,EAkBD,OAfc9C,IACVA,IAAStB,EAAQ,QACnBA,EAAQ,MAAQ,QAEd2D,EAAW,IAAIrC,CAAI,GACrBqC,EAAW,OAAOrC,CAAI,EACf,IAEF,IAQP,OAAQ2C,CACV,CACF,CAAA,QAAA,sBAAA9H,EAAA,QAAA,kBAAAO,EAAA,QAAA,wBAAAC,GAAA,QAAA,oBAAAE,GAAA,QAAA,KAAA6C,EAAA,QAAA,WAAAjC,EAAA,QAAA,oBAAAgC,EAAA,QAAA,oBAAA/B,EAAA,QAAA,QAAAgG"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var VesiumPlot=function(T,r,m,b,E,Y,w){"use strict";var K=Object.defineProperty,q=(i,e,t)=>e in i?K(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,P=(i,e,t)=>q(i,typeof e!="symbol"?e+"":e,t),y=(i=>(i[i.IDLE=0]="IDLE",i[i.HOVER=1]="HOVER",i[i.ACTIVE=2]="ACTIVE",i))(y||{});function N(){return{diabled:({active:i})=>!i,cursor:"pointer",dragCursor:"crosshair",onDrag({viewer:i,sample:e,packable:t,context:o,index:s,lockCamera:a}){a();const v=m.canvasCoordToCartesian(o.endPosition,i.scene);if(v){const l=[...t.positions??[]];l[s]=v,e.setSample({time:t.time,derivative:t.derivative,positions:l})}},onKeyPressed({viewer:i,keyEvent:e,sample:t,packable:o,index:s}){var a;const v=(a=m.toCartographic(i.camera.position))==null?void 0:a.height;if(!v||!["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(e.key))return;e.preventDefault();let l=0;switch(e.key){case"ArrowRight":l=Math.PI/2;break;case"ArrowDown":l=Math.PI;break;case"ArrowLeft":l=-Math.PI/2;break;case"ArrowUp":l=0;break}const h=(i.camera.heading+l)%(2*Math.PI),u=[...o.positions??[]],d=m.toCartographic(u[s]),n=v/1e5*Math.PI/180/1e3;d.latitude+=n*Math.cos(h),d.longitude+=n*Math.sin(h),u[s]=m.toCartesian3(d),t.setSample({time:o.time,derivative:o.derivative,positions:u})},render:({position:i,action:e})=>{const t={[y.IDLE]:r.Color.BLUE.withAlpha(.4),[y.HOVER]:r.Color.BLUE.withAlpha(.6),[y.ACTIVE]:r.Color.AQUA.withAlpha(1)};return{position:i,point:{pixelSize:8,color:t[e],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:r.Color.WHITE.withAlpha(.4)}}}}}function j(){let i=-1;return{diabled:({active:e,defining:t})=>!e||t,cursor:"pointer",dragCursor:"crosshair",format(e){const t=e.positions??[];return t.length<2?[]:t.map((o,s)=>{const a=s===t.length-1?t[0]:t[s+1];return r.Cartesian3.midpoint(o,a,new r.Cartesian3)})},onDrag({viewer:e,sample:t,packable:o,context:s,index:a,lockCamera:v,dragging:l}){v();const h=m.canvasCoordToCartesian(s.endPosition,e.scene);if(!h)return;const u=[...o.positions??[]];i===-1?(i=a,u.splice(a+1,0,h)):u[i+1]=h,l||(i=-1),t.setSample({time:o.time,derivative:o.derivative,positions:u})},render:({position:e,action:t,active:o})=>{if(!o)return;const s={[y.IDLE]:r.Color.GREEN.withAlpha(.4),[y.HOVER]:r.Color.GREEN.withAlpha(.6),[y.ACTIVE]:r.Color.GREEN.withAlpha(1)};return{position:e,point:{pixelSize:6,color:s[t],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:r.Color.WHITE.withAlpha(.4)}}}}}function z(){let i=-1;return{diabled:({active:e,defining:t})=>!e||t,cursor:"pointer",dragCursor:"crosshair",format(e){const t=e.positions??[];return t.length<2?[]:t.slice(0,t.length-1).map((o,s)=>r.Cartesian3.midpoint(o,t[s+1],new r.Cartesian3))},onDrag({viewer:e,sample:t,packable:o,context:s,index:a,lockCamera:v,dragging:l}){v();const h=m.canvasCoordToCartesian(s.endPosition,e.scene);if(!h)return;const u=[...o.positions??[]];i===-1?(i=a,u.splice(a+1,0,h)):u[i+1]=h,l||(i=-1),t.setSample({time:o.time,derivative:o.derivative,positions:u})},render:({position:e,action:t})=>{const o={[y.IDLE]:r.Color.GREEN.withAlpha(.4),[y.HOVER]:r.Color.GREEN.withAlpha(.6),[y.ACTIVE]:r.Color.GREEN.withAlpha(1)};return{position:e,point:{pixelSize:6,color:o[t],disableDepthTestDistance:Number.POSITIVE_INFINITY,outlineWidth:1,outlineColor:r.Color.WHITE.withAlpha(.4)}}}}}const Q=`data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m18 9l3 3l-3 3m-3-3h6M6 9l-3 3l3 3m-3-3h6m0 6l3 3l3-3m-3-3v6m3-15l-3-3l-3 3m3-3v6"/></svg>')}`;function L(){return{diabled:({active:i,defining:e})=>!i||e,cursor:"pointer",dragCursor:"crosshair",format(i){const e=i.positions??[];if(e.length===0)return[];if(e.length===1)return[e[0]];{const t=r.Rectangle.center(r.Rectangle.fromCartesianArray(e));return[m.toCartesian3(t)]}},onDrag({viewer:i,sample:e,packable:t,context:o,lockCamera:s,dragging:a}){a&&s();const v=m.canvasCoordToCartesian(o.startPosition,i.scene),l=m.canvasCoordToCartesian(o.endPosition,i.scene);if(!v||!l)return;const h=r.Cartesian3.subtract(l,v,new r.Cartesian3),u=[...t.positions??[]];e.setSample({time:t.time,derivative:t.derivative,positions:u.map(d=>r.Cartesian3.add(d,h,new r.Cartesian3))})},render:({position:i,action:e})=>{const t={[y.IDLE]:r.Color.WHITE,[y.HOVER]:r.Color.WHITE,[y.ACTIVE]:r.Color.AQUA.withAlpha(1)};return{position:i,billboard:{image:Q,width:20,height:20,color:t[e],pixelOffset:new r.Cartesian3(0,-20),horizontalOrigin:r.HorizontalOrigin.CENTER,verticalOrigin:r.VerticalOrigin.BOTTOM,disableDepthTestDistance:Number.POSITIVE_INFINITY}}}}}const X={scheme:{type:"Billboard",complete:i=>i.positions.length>=1,skeletons:[L],render(i){var e,t;const{mouse:o,packable:s}=i,a=((e=i.previous.entities)==null?void 0:e[0])??new r.Entity({billboard:{}}),v=((t=s.positions)==null?void 0:t[0])??o;return a.position=new r.CallbackPositionProperty(()=>v,!0),{entities:[a]}}}},Z={scheme:{type:"Label",complete:i=>i.positions.length>=1,skeletons:[L],render(i){var e,t;const{mouse:o,packable:s}=i,a=((e=i.previous.entities)==null?void 0:e[0])??new r.Entity({label:{text:"Label"}}),v=((t=s.positions)==null?void 0:t[0])??o;return a.position=new r.CallbackPositionProperty(()=>v,!0),{entities:[a]}}}},$={scheme:{type:"LineString",forceComplete:i=>i.positions.length>=2,skeletons:[N,z,L],render(i){var e;const{mouse:t,packable:o}=i,s=((e=i.previous.entities)==null?void 0:e[0])??new r.Entity({polyline:{width:1}});return s.polyline.positions=new r.CallbackProperty(()=>{const a=[...o.positions??[]].concat(t?[t]:[]);return a.length>=2?a:[]},!1),{entities:[s]}}}},ee={scheme:{type:"Polygon",forceComplete:i=>i.positions.length>=3,skeletons:[N,j,L],render(i){var e;const{mouse:t,packable:o}=i,s=((e=i.previous.entities)==null?void 0:e[0])??new r.Entity({polyline:{material:r.Color.YELLOW.withAlpha(.5)},polygon:{material:r.Color.YELLOW.withAlpha(.5)}}),a=[...o.positions??[]];return t&&a.push(t),a.length===2?(s.polygon.hierarchy=void 0,s.polyline.positions=new r.CallbackProperty(()=>a,!1)):a.length>=3?(s.polyline.positions=void 0,s.polygon.hierarchy=new r.CallbackProperty(()=>(a.push(a[0]),a.length>=3?new r.PolygonHierarchy([...a]):void 0),!1)):(s.polygon.hierarchy=void 0,s.polyline.positions=void 0),{entities:[s]}}}},M=class A{constructor(e){P(this,"type"),P(this,"complete"),P(this,"forceComplete"),P(this,"definingCursor"),P(this,"skeletons"),P(this,"render");var t;this.type=e.type,this.complete=e.complete,this.forceComplete=e.forceComplete,this.definingCursor=e.definingCursor??"crosshair",this.skeletons=((t=e.skeletons)==null?void 0:t.map(o=>m.isFunction(o)?o():o))??[],this.render=e.render}static getRecordTypes(){return[...this._record.keys()]}static getRecord(e){return A._record.get(e)}static setRecord(e){m.assertError(!e.type,"`scheme.type` is required"),A._record.set(e.type,e)}static resolve(e){if(typeof e=="string"){const t=A.getRecord(e);return b.assert(!!t,`scheme ${e} not found`),t}else return e instanceof A?e:new A(e)}};P(M,"_record",new Map);let x=M;var G=(i=>(i[i.NEAR=0]="NEAR",i[i.CYCLE=1]="CYCLE",i[i.STRICT=2]="STRICT",i))(G||{});const te=(i,e,t,o)=>{var s,a,v;return o===0?{time:i,positions:(s=e.positions)==null?void 0:s.map(l=>l.clone()),derivative:e.derivative}:o===1?{time:i,positions:(a=t.positions)==null?void 0:a.map(l=>l.clone()),derivative:e.derivative}:{time:i,positions:(v=t.positions)==null?void 0:v.map((l,h)=>{var u;const d=(u=e.positions)==null?void 0:u[h];return d?r.Cartesian3.lerp(d,l,o,new r.Cartesian3):l}),derivative:e.derivative}},J=class U{constructor(e){P(this,"strategy"),P(this,"interpolationAlgorithm"),P(this,"_times",[]),P(this,"_sampleds",[]),P(this,"_derivatives",[]),P(this,"_definitionChanged",new r.Event);var t;this.interpolationAlgorithm=e?.interpolationAlgorithm,this.strategy=e?.strategy??0,(t=e?.packables)==null||t.forEach(o=>this.setSample(o)),this._times.length||this.setSample({time:r.JulianDate.now(),positions:[],derivative:void 0})}get isConstant(){return this._times.length===0}get definitionChanged(){return this._definitionChanged}getTimes(){return this._times.map(e=>e.clone())}getIndexScope(e){if(!this._times.length)return;const t=this._times[0],o=this._times[this._times.length-1];if(r.JulianDate.lessThan(e,t)||r.JulianDate.greaterThan(e,o))switch(this.strategy){case 2:return;case 0:{e=r.JulianDate.lessThan(e,this._times[0])?this._times[0].clone():this._times[this._times.length-1].clone();break}case 1:{const u=r.JulianDate.toDate(this._times[0]).getTime(),p=r.JulianDate.toDate(this._times[this._times.length-1]).getTime()-u,c=(r.JulianDate.toDate(e).getTime()-u)%p,f=new Date(u+c);e=r.JulianDate.fromDate(f);break}}const s=this._times.findIndex(u=>r.JulianDate.lessThanOrEquals(e,u)),a=Math.min(s,this._times.length-1),v=r.JulianDate.toDate(this._times[s]).getTime(),l=r.JulianDate.toDate(this._times[a]).getTime(),h=r.JulianDate.toDate(e).getTime();return{prevIndex:s,nextIndex:a,proportion:(h-v)/(l-v)||0}}getValue(e,t){var o,s;if(t??(t={time:e}),Object.assign(t,{time:e.clone(),positions:void 0,derivative:void 0}),!e)return t.time=(o=this._times[0])==null?void 0:o.clone(),t.positions=(s=this._sampleds[0])==null?void 0:s.map(n=>n.clone(n)),t.derivative=this._derivatives[0],t;const a=this.getIndexScope(e);if(!a)return t;t.time=e;const{prevIndex:v,nextIndex:l,proportion:h}=a,u={time:this._times[v],positions:this._sampleds[v],derivative:this._derivatives[v]},d={time:this._times[l],positions:this._sampleds[l],derivative:this._derivatives[l]},p=(this.interpolationAlgorithm||U.defaultInterpolationAlgorithm)(e,u,d,h);return Object.assign(t,p),t}setSample(e){var t;const o=e.time.clone(),s=((t=e.positions)==null?void 0:t.map(l=>l.clone()))??[],a=e.derivative,v=this._times.findIndex(l=>r.JulianDate.equals(o,l));v!==-1?(this._times[v]=o,this._sampleds[v]=s,this._derivatives[v]=e.derivative):this._times.length===0?(this._times[0]=o,this._sampleds[0]=s,this._derivatives[0]=e.derivative):r.JulianDate.lessThan(o,this._times[0])?(this._times.splice(0,0,o),this._sampleds.splice(0,0,s),this._derivatives.splice(0,0,a)):r.JulianDate.greaterThan(o,this._times[this._times.length-1])&&(this._times.push(o),this._sampleds.push(s),this._derivatives.push(a)),this.definitionChanged.raiseEvent(this)}setSamples(e){e.forEach(t=>this.setSample(t))}removeSample(e){const t=this._times.findIndex(o=>o.equals(e));return t!==-1&&(this._sampleds.splice(t,1),this._derivatives.splice(t,1),this._times.splice(t,1).length)?(this._definitionChanged.raiseEvent(this),!0):!1}removeSamples(e){for(let t=0;t<this._times.length;t++){const o=this._times[t];r.TimeInterval.contains(e,o)&&this.removeSample(o)}}equals(e){return e===this}};P(J,"defaultInterpolationAlgorithm",te);let V=J;class O{constructor(e){P(this,"_definitionChanged",new r.Event),P(this,"time"),m.assertError(!b.notNullish(e.scheme),"options.scheme is required"),this.id=e.id||r.createGuid(),m.createCesiumAttribute(this,"disabled",!!e.disabled),m.createCesiumAttribute(this,"defining",!0),m.createCesiumAttribute(this,"scheme",x.resolve(e.scheme),{readonly:!0});const t=e.sample instanceof V?e.sample:new V(e.sample);m.createCesiumProperty(this,"sample",t),m.createCesiumAttribute(this,"entities",[]),m.createCesiumAttribute(this,"primitives",[]),m.createCesiumAttribute(this,"groundPrimitives",[]),m.createCesiumAttribute(this,"skeletonEntities",[])}get definitionChanged(){return this._definitionChanged}isDefining(){return this.defining}getEntities(){return[...this.entities]}getPrimitives(){return[...this.primitives]}getGroundPrimitives(){return[...this.groundPrimitives]}getSkeletonEntities(){return[...this.skeletonEntities]}}function ie(i,e,t){const o=E.useViewer(),s=E.usePrimitive(new r.PrimitiveCollection),a=E.usePrimitive(new r.PrimitiveCollection,{collection:"ground"}),v=E.useDataSource(new r.CustomDataSource),l=E.useEntityScope({collection:()=>v.value.entities}),h=E.usePrimitiveScope({collection:()=>s.value}),u=E.usePrimitiveScope({collection:()=>a.value}),d=w.shallowRef();E.useScreenSpaceEventHandler(r.ScreenSpaceEventType.MOUSE_MOVE,m.throttle(n=>{d.value=m.canvasCoordToCartesian(n?.endPosition,o.value.scene)},10)),b.watchArray(i,(n,c,f,g=[])=>{g.forEach(C=>{l.removeWhere(_=>C.entities.includes(_)),h.removeWhere(_=>C.primitives.includes(_)),u.removeWhere(_=>C.groundPrimitives.includes(_))}),f.forEach(C=>{C.entities.forEach(_=>l.add(_)),C.primitives.forEach(_=>h.add(_)),C.groundPrimitives.forEach(_=>u.add(_))})},{immediate:!0}),E.useCesiumEventListener(()=>i.value.map(n=>n.definitionChanged),(n,c,f,g)=>{if(c==="entities"){const{added:C,removed:_}=m.arrayDifference(f,g);C.forEach(S=>l.add(S)),_.forEach(S=>l.remove(S))}else if(c==="primitives"){const{added:C,removed:_}=m.arrayDifference(f,g);C.forEach(S=>h.add(S)),_.forEach(S=>h.remove(S))}else if(c==="groundPrimitives"){const{added:C,removed:_}=m.arrayDifference(f,g);C.forEach(S=>u.add(S)),_.forEach(S=>u.remove(S))}});const p=m.throttle(async n=>{var c,f;const g=await((f=(c=n.scheme).render)==null?void 0:f.call(c,{packable:n.sample.getValue(t()),mouse:n.defining?d.value:void 0,defining:n.defining,previous:{entities:n.entities,primitives:n.primitives,groundPrimitives:n.groundPrimitives}}));n.entities=g?.entities??[],n.primitives=g?.primitives??[],n.groundPrimitives=g?.groundPrimitives??[]},1);return w.watch(e,(n,c)=>{c&&p(c)}),E.useCesiumEventListener(()=>i.value.map(n=>n.definitionChanged),(n,c)=>{["disabled","defining","scheme","sample","time"].includes(c)&&p(n)}),w.watch(d,()=>{i.value.forEach(n=>n.defining&&p(n))}),{primitives:w.computed(()=>Array.from(h.scope)),groundPrimitives:w.computed(()=>Array.from(h.scope)),entities:w.computed(()=>Array.from(l.scope))}}function ne(i,e){const t=E.useViewer(),o=w.ref(!1),s=w.computed(()=>{var l;return(l=i.value)==null?void 0:l.sample.getValue(e())});E.useScreenSpaceEventHandler(r.ScreenSpaceEventType.LEFT_CLICK,async l=>{var h,u;if(await b.promiseTimeout(1),!i.value||!s.value||o.value)return;const{scheme:d,defining:p,sample:n}=i.value;if(!p)return;const c=m.canvasCoordToCartesian(l.position,t.value.scene);if(!c)return;(h=s.value).positions??(h.positions=[]),s.value.positions.push(c),n.setSample(s.value),((u=d.complete)==null?void 0:u.call(d,s.value))&&(i.value.defining=!1)}),E.useScreenSpaceEventHandler(r.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,async l=>{var h;if(!i.value||!s.value)return;o.value=!0,await b.promiseTimeout(2),o.value=!1;const{scheme:u,defining:d}=i.value;if(!d||!m.canvasCoordToCartesian(l.position,t.value.scene))return;((h=u.forceComplete)==null?void 0:h.call(u,s.value))&&(i.value.defining=!1)}),E.useScreenSpaceEventHandler(r.ScreenSpaceEventType.RIGHT_CLICK,async()=>{var l;if(!i.value||!s.value)return;const{defining:h,sample:u}=i.value;h&&((l=s.value).positions??(l.positions=[]),s.value.positions.length!==0&&(s.value.positions.splice(s.value.positions.length-1,1),u.setSample(s.value)))});const a=w.ref(),v=()=>{var l,h;if(!((l=i.value)!=null&&l.defining))a.value&&(a.value=void 0,t.value.container.parentElement.style.removeProperty("cursor"));else{const u=i.value.scheme.definingCursor;a.value=m.isFunction(u)?u(s.value):w.toValue(u),a.value&&((h=t.value)==null||h.container.parentElement.style.setProperty("cursor",a.value))}};E.useCesiumEventListener(()=>{var l;return(l=i.value)==null?void 0:l.definitionChanged},(l,h)=>{(h==="defining"||h==="sample")&&v()}),w.watch(i,()=>v())}class R extends r.Entity{constructor(e){super(e)}}function oe(i,e,t){const o=E.useViewer(),s=E.useDataSource(new r.CustomDataSource),a=E.useEntityScope({collection:()=>s.value.entities}),v=w.shallowRef(),l=w.shallowRef(),h=d=>{var p,n;return d?((p=l.value)==null?void 0:p.id)===d.id?y.ACTIVE:((n=v.value)==null?void 0:n.id)===d.id?y.HOVER:y.IDLE:y.IDLE},u=m.throttle((d,p)=>{const n=d.getSkeletonEntities(),c=[];if(p||d.disabled)d.skeletonEntities=[];else{const f=d.sample.getValue(t()),g=d.defining,C=e.value===d;d.scheme.skeletons.forEach(S=>{var F;if(m.isFunction(S.diabled)?S.diabled({active:C,defining:g}):S.diabled)return;const W=((F=S.format)==null?void 0:F.call(S,f))??f?.positions??[];W.forEach((re,k)=>{var B;let I=n.find(D=>D.index===k&&D.skeleton===S);const ae=(B=S.render)==null?void 0:B.call(S,{defining:g,active:C,index:k,packable:f,positions:W,position:re,action:h(I)}),H=new R(ae??{});I?H.propertyNames.forEach(D=>{D!=="id"&&(I[D]=H[D])}):I=H,I.plot=d,I.skeleton=S,I.index=k,c.push(I)})})}d.skeletonEntities=c},1);return E.useGraphicDrag({cursor:d=>{var p;if(!((p=e.value)!=null&&p.defining)&&a.scope.has(d.id)){const n=d.id.skeleton;return m.isFunction(n?.cursor)?n.cursor(d):w.toValue(n?.cursor)}},dragCursor:d=>{var p;if(!((p=e.value)!=null&&p.defining)&&a.scope.has(d.id)){const n=d.id.skeleton;return m.isFunction(n?.dragCursor)?n.dragCursor(d):w.toValue(n?.dragCursor)}},listener:d=>{var p;if(d.pick.id instanceof R&&a.scope.has(d.pick.id)){const n=d.pick.id,c=n.plot;if(c.defining)return;l.value=n;const f=n.skeleton,g=n.index,C=c.sample.getValue(t());(p=f.onDrag)==null||p.call(f,{viewer:o.value,sample:c.sample,packable:C,active:e.value===c,index:g,context:d.context,dragging:d.dragging,lockCamera:d.lockCamera})}else l.value=void 0}}),b.onKeyStroke(d=>{var p;if(l.value){const n=l.value,c=n.plot,f=n.skeleton,g=n.index,C=c.sample.getValue(t());(p=f.onKeyPressed)==null||p.call(f,{viewer:o.value,sample:c.sample,packable:C,index:g,keyEvent:d})}}),E.useGraphicHover({listener:({hovering:d,pick:p})=>{if(d&&p.id instanceof R&&a.scope.has(p.id)){const n=p.id;v.value=n}else v.value=void 0}}),E.useGraphicLeftClick({listener:({context:d,pick:p})=>{var n;if(p.id instanceof R&&a.scope.has(p.id)){const c=p.id;l.value=c;const f=c.plot,g=c.skeleton,C=c.index,_=f.sample.getValue(t());(n=g.onLeftClick)==null||n.call(g,{viewer:o.value,sample:f.sample,packable:_,active:e.value===f,defining:f.defining,index:C,context:d})}else l.value=void 0}}),b.watchArray(i,(d,p,n,c=[])=>{n.forEach(f=>u(f)),c.forEach(f=>u(f,!0))}),E.useCesiumEventListener(()=>i.value.map(d=>d.definitionChanged),(d,p,n,c)=>{if(["disabled","defining","scheme","sample","time"].includes(p)&&u(d),p==="skeletonEntities"){const{added:f,removed:g}=m.arrayDifference(n,c);f.forEach(C=>a.add(C)),g.forEach(C=>a.remove(C))}}),w.watch(e,(d,p)=>{d&&u(d),setTimeout(()=>{p&&u(p)},2)}),{dataSource:s}}function se(i){const e=i?.time||w.shallowRef(),t=Y.useViewer(),o=()=>{var n,c,f;return((n=e.value)==null?void 0:n.clone())||((f=(c=t.value)==null?void 0:c.clock.currentTime)==null?void 0:f.clone())||r.JulianDate.now()},s=w.shallowReactive(new Set),a=w.computed(()=>Array.from(s)),v=w.shallowRef(),l=w.shallowRef();E.useCesiumEventListener([()=>{var n;return(n=v.value)==null?void 0:n.sample.definitionChanged}],()=>{var n;l.value=(n=v.value)==null?void 0:n.sample.getValue(o())}),ne(v,o),ie(a,v,o),oe(a,v,o),E.useScreenSpaceEventHandler(r.ScreenSpaceEventType.LEFT_CLICK,n=>{var c,f,g;if((c=v.value)!=null&&c.defining)return;const C=(f=t.value)==null?void 0:f.scene.pick(n.position.clone());if(!(((g=C?.id)==null?void 0:g.plot)instanceof O)){if(!C){v.value=void 0;return}v.value=a.value.find(_=>m.pickHitGraphic(C,[..._.entities,..._.primitives,..._.groundPrimitives]))}});let h,u;return w.watch(v,(n,c)=>{var f,g;if(c&&c.defining){const C=c.sample.getValue(o());((g=(f=c.scheme).forceComplete)==null?void 0:g.call(f,C))?(c.defining=!1,h?.(c)):s.delete(c)}}),{plots:a,time:e,operate:async n=>new Promise((c,f)=>{h=c,u=f;const g=n instanceof O?n:new O(n);return s.has(g)||s.add(g),v.value=g,c(g)}),remove:n=>(n===v.value&&(v.value=void 0),s.has(n)?(s.delete(n),!0):!1),cancel:u}}return T.PLOT_BILLBOARD_SCHEME=X,T.PLOT_LABEL_SCHEME=Z,T.PLOT_LINE_STRING_SCHEME=$,T.PLOT_POLYGON_SCHEME=ee,T.Plot=O,T.PlotScheme=x,T.SampledPlotProperty=V,T.SampledPlotStrategy=G,T.usePlot=se,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}),T}({},Cesium,VesiumShared,VueUse,VesiumCore,VesiumCore,Vue);
|
|
2
|
+
//# sourceMappingURL=index.min.js.map
|