@vesium/plot 1.0.1-beta.65 → 1.0.1-beta.68
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 +27 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +27 -27
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +27 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.min.mjs","names":["defaultInterpolationAlgorithm: SampledPlotInterpolationAlgorithm","previous: SampledPlotPackable<D>","next: SampledPlotPackable<D>","interval","entities: PlotSkeletonEntity[]","merge: any","operateResolve: ((plot: PlotFeature) => void) | undefined","operateReject: (() => void) | undefined","packable","operate: UsePlotOperate","distance","midpoints: Cartesian3[]","result: TesselateReturn","results: Cartesian3[]","defaultOptions","cartesian3List: Cartesian3[]","grid: TriangleGridReturn","defaultOptions","result: Cartesian3[]","stages: number[]","distance","density","positions","count","text: string"],"sources":["../usePlot/PlotScheme.ts","../usePlot/SampledPlotProperty.ts","../usePlot/PlotFeature.ts","../usePlot/PlotSkeleton.ts","../usePlot/useRender.ts","../usePlot/useSampled.ts","../usePlot/useSkeleton.ts","../usePlot/usePlot.ts","../skeleton/control.ts","../skeleton/interval.ts","../skeleton/intervalNonclosed.ts","../skeleton/moved.ts","../measure/utils/tesselate.ts","../measure/utils/clampToGround.ts","../measure/utils/triangleGrid.ts","../measure/utils/area.ts","../measure/utils/lerpArray.ts","../measure/utils/distance.ts","../measure/measureArea.ts","../measure/measureDistance.ts","../scheme/Billboard.ts","../scheme/BillboardPinBuilder.ts","../scheme/Cylinder.ts","../scheme/Ellipse.ts","../scheme/Label.ts","../scheme/Point.ts","../scheme/Polygon.ts","../scheme/PolygonArc.ts","../scheme/PolygonArrowAttackDirection.ts","../scheme/PolygonArrowAttackDirectionTailed.ts","../scheme/PolygonArrowClamped.ts","../scheme/PolygonArrowStraight.ts","../scheme/PolygonArrowStraightSharp.ts","../scheme/PolygonArrowUnitCombatOperation.ts","../scheme/PolygonArrowUnitCombatOperationTailed.ts","../scheme/PolygonAssemblingPlace.ts","../scheme/PolygonSmooth.ts","../scheme/Polyline.ts","../scheme/PolylineCurve.ts","../scheme/Rectangle.ts"],"sourcesContent":["import type { Cartesian3, Entity } from 'cesium';\nimport type { Nullable } from 'vesium';\nimport type { CSSProperties } from 'vue';\nimport type { PlotSkeleton } from './PlotSkeleton';\nimport type { SampledPlotPackable } from './SampledPlotProperty';\nimport { assert } from '@vueuse/core';\nimport { assertError } from 'vesium';\n\nexport interface PlotRenderResult {\n entities?: Entity[];\n primitives?: any[];\n groundPrimitives?: any[];\n}\n\nexport interface PlotRenderContext<D = any> {\n /**\n * 当前标绘采集到点位原始数据\n */\n packable: SampledPlotPackable<D>;\n\n /**\n * 当前是否处于定义态\n */\n defining: boolean;\n\n /**\n * 当前鼠标位置,若当前标绘不处于定义态时,`mouse`为`undefined`\n */\n mouse?: Cartesian3;\n\n /**\n * 上一次的渲染结果\n */\n previous: PlotRenderResult;\n\n /**\n * 当前有效的点位数组,若处于定义态时,还会包含鼠标位置\n */\n getPositions: () => Cartesian3[];\n}\n\nexport interface PlotSchemeConstructorOptions {\n /**\n * 标绘类型。应当是全局唯一的字符串,会作为键名缓存\n */\n type: string;\n\n /**\n * 判断是否立即完成标绘.\n * 每次控制点发生变变化时,执行该回调函数,返回`true`则完成标绘\n */\n complete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 判断是否允许手动完成标绘。\n * 每次控制点发生变变化时,执行该回调函数,返回`true`则后续左键双击即完成标绘\n */\n allowManualComplete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 处于定义态时鼠标的样式\n * @default 'crosshair'\n */\n definingCursor?: Nullable<CSSProperties['cursor']> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);\n\n /**\n * 当前标绘的框架点数据\n */\n skeletons?: (() => PlotSkeleton) [];\n\n /**\n * 初始化时创建的render,创建后会作为配置项传入`render`中\n */\n initRender: () => PlotRenderResult;\n\n /**\n * 当标绘数据变化时,会触发`render`回调,返回的数据会被添加到cesium中\n */\n render?: (context: PlotRenderContext) => PlotRenderResult | Promise<PlotRenderResult>;\n}\n\nexport class PlotScheme {\n constructor(options: PlotSchemeConstructorOptions) {\n this.type = options.type;\n this.complete = options.complete;\n this.allowManualComplete = options.allowManualComplete;\n this.definingCursor = options.definingCursor ?? 'crosshair';\n this.skeletons = options.skeletons?.map(item => item()) ?? [];\n this.initRender = options.initRender;\n this.render = options.render;\n }\n\n /**\n * 标绘类型。应当是全局唯一的字符串,会作为键名缓存\n */\n type: string;\n\n /**\n * 判断是否立即完成标绘.\n * 每次控制点发生变变化时,执行该回调函数,返回`true`则完成标绘\n */\n complete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 判断是否允许手动完成标绘。\n * 每次控制点发生变变化时,执行该回调函数,返回`true`则后续左键双击即完成标绘\n */\n allowManualComplete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 处于定义态时鼠标的样式\n * @default 'crosshair'\n */\n definingCursor?: Nullable<CSSProperties['cursor']> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);\n\n /**\n * 当前标绘的框架点数据\n */\n skeletons: PlotSkeleton[];\n\n /**\n * 初始化时创建贴地`Primitive`的函数,创建后的`Primitive`会作为配置项传入`render`中\n */\n initRender?: () => PlotRenderResult;\n\n /**\n * 当标绘数据变化时,会触发`render`回调,返回的数据会被添加到cesium中\n */\n render?: (context: PlotRenderContext) => PlotRenderResult | Promise<PlotRenderResult>;\n\n private static _record = new Map<string, PlotScheme>();\n\n /**\n * 标绘方案缓存。\n * 每次标绘时都会将`PlotScheme.type`作为键名缓存,\n * 后续可用过`PlotScheme.getCache(type)`获取完整的`PlotScheme`配置。\n */\n static getCacheTypes(): string[] {\n return [...this._record.keys()];\n }\n\n /**\n * 通过`PlotScheme.type`获取缓存中的`PlotScheme`配置。\n */\n static getCache(type: string): PlotScheme | undefined {\n return PlotScheme._record.get(type);\n }\n\n /**\n * 缓存标绘方案。\n */\n static setCache(scheme: PlotScheme): void {\n assertError(!scheme.type, '`scheme.type` is required');\n PlotScheme._record.set(scheme.type, scheme);\n }\n\n /**\n * 解析传入的maybeScheme,maybeScheme可能是一个完整的PlotScheme,也可能是缓存中的`PlotScheme.type`,并返回 PlotScheme 实例。\n * 若传入的是`PlotScheme.type`字符串,并且缓存中不存在该标绘方案,则抛出错误。\n */\n static resolve(maybeScheme: string | PlotScheme | PlotSchemeConstructorOptions): PlotScheme {\n if (typeof maybeScheme === 'string') {\n const _scheme = PlotScheme.getCache(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\n /**\n * 当前标绘所属于的时间节点\n */\n time?: JulianDate;\n\n /**\n * 采样点位数据\n */\n positions: Cartesian3[];\n\n /**\n * 附带的额外自定义数据\n */\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 * 标绘采样点数据是一个时间序列数据,包含时间、位置和附带的额外数据。\n * 具体用法可参考 [Cesium.SampledProperty](https://cesium.com/learn/cesiumjs/ref-doc/SampledProperty.html)\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: new JulianDate(0, 0),\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, positions: [] };\n Object.assign(result, {\n time: time?.clone(),\n positions: [],\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 * @param value 样本数据对象,包含时间、位置和导数信息\n */\n setSample(value: SampledPlotPackable<D>): void {\n const time = value.time?.clone() ?? this._times[0]!.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 /**\n * 判断两个property是否相等\n */\n equals(other?: Property): boolean {\n return other === this;\n }\n}\n","import type { Entity } from 'cesium';\nimport type { PlotSchemeConstructorOptions } from './PlotScheme';\nimport type { PlotSkeletonEntity } from './PlotSkeleton';\nimport type { SampledPlotPropertyConstructorOptions } from './SampledPlotProperty';\nimport { createGuid, Event } from 'cesium';\nimport { PlotScheme } from './PlotScheme';\nimport { SampledPlotProperty } from './SampledPlotProperty';\n\nexport type PlotDefinitionChangedCallback = (\n scope: PlotFeature,\n key: keyof PlotFeature,\n newValue: PlotFeature[typeof key],\n oldValue: PlotFeature[typeof key],\n) => void;\n\n/**\n * 标绘实例构造参数\n */\nexport interface PlotFeatureConstructorOptions {\n /**\n * 唯一标识符\n *\n * 未指定时将自动生成GUID\n */\n id?: string;\n\n /**\n * 标绘方案配置\n *\n * 支持直接传入字符串方案名称、方案实例或构造参数\n */\n scheme: string | PlotScheme | PlotSchemeConstructorOptions;\n\n /**\n * 采样属性配置\n *\n * 控制标绘对象的动态属性采样行为\n */\n sampled?: SampledPlotProperty | SampledPlotPropertyConstructorOptions;\n\n /**\n * 禁用状态标志\n *\n * @default false\n */\n disabled?: boolean;\n}\n\n/**\n * 标绘实例\n */\nexport class PlotFeature {\n constructor(options: PlotFeatureConstructorOptions) {\n const { id, disabled = false, sampled } = options;\n this._id = id || createGuid();\n this._scheme = PlotScheme.resolve(options.scheme);\n\n this._definitionChanged = new Event();\n this._defining = true;\n this._disabled = disabled;\n this._sampled = sampled instanceof SampledPlotProperty ? sampled : new SampledPlotProperty(sampled);\n this._sampled.definitionChanged.addEventListener(property => this._definitionChanged.raiseEvent(this, 'sampled', property, property), this);\n\n const init = this._scheme.initRender?.() ?? {};\n this._entities = [...init.entities ?? []];\n this._primitives = [...init.primitives ?? []];\n this._groundPrimitives = [...init.groundPrimitives ?? []];\n this._skeletons = [];\n }\n\n /**\n * @internal\n */\n private _id: string;\n\n get id(): string {\n return this._id;\n }\n\n /**\n * @internal\n */\n private _scheme: PlotScheme;\n\n get scheme(): PlotScheme {\n return this._scheme;\n }\n\n /**\n * @internal\n */\n private _definitionChanged: Event<PlotDefinitionChangedCallback>;\n\n get definitionChanged(): Event<PlotDefinitionChangedCallback> {\n return this._definitionChanged;\n }\n\n /**\n * @internal\n */\n private _defining: boolean;\n\n get defining(): boolean {\n return this._defining;\n }\n\n /**\n * @internal\n */\n static setDefining(plot: PlotFeature, value: boolean): void {\n if (plot._defining !== value) {\n plot._definitionChanged.raiseEvent(plot, 'defining', value, plot._defining);\n plot._defining = value;\n }\n }\n\n /**\n * @internal\n */\n private _disabled: boolean;\n\n /**\n * 获取禁用状态\n *\n * 当为 `true` 时,标绘实例将停止响应交互和更新;\n * 为 `false` 时恢复正常功能。\n */\n get disabled(): boolean {\n return this._disabled;\n }\n\n set disabled(value: string) {\n this.disabled = value;\n }\n\n /**\n * @internal\n */\n private _sampled: SampledPlotProperty;\n\n get sampled(): SampledPlotProperty {\n return this._sampled;\n }\n\n /**\n * @internal\n */\n private _entities: Entity[];\n\n get entities(): Entity[] {\n return this._entities;\n }\n\n set entities(value: Entity[]) {\n this._definitionChanged.raiseEvent(this, 'entities', value, this._entities);\n this._entities = value;\n }\n\n /**\n * @internal\n */\n private _primitives: any[];\n\n get primitives(): any[] {\n return this._primitives;\n }\n\n /**\n * @internal\n */\n set primitives(value: any[]) {\n this._definitionChanged.raiseEvent(this, 'primitives', value, this._primitives);\n this._primitives = value;\n }\n\n /**\n * @internal\n */\n private _groundPrimitives: any[];\n\n get groundPrimitives(): any[] {\n return this._groundPrimitives;\n }\n\n /**\n * @internal\n */\n set groundPrimitives(value: any[]) {\n this._definitionChanged.raiseEvent(this, 'groundPrimitives', value, this._groundPrimitives);\n this._groundPrimitives = value;\n }\n\n /**\n * @internal\n */\n private _skeletons: PlotSkeletonEntity[];\n\n get skeletons(): PlotSkeletonEntity[] {\n return this._skeletons;\n }\n\n /**\n * @internal\n */\n set skeletons(value: PlotSkeletonEntity[]) {\n this._definitionChanged.raiseEvent(this, 'skeletons', value, this._skeletons);\n this._skeletons = value;\n }\n}\n","import type { Cartesian3, ScreenSpaceEventHandler, Viewer } from 'cesium';\nimport type { Nullable } from 'vesium';\nimport type { CSSProperties, MaybeRef, VNode } from 'vue';\nimport type { PlotFeature } from './PlotFeature';\nimport type { SampledPlotPackable, SampledPlotProperty } from './SampledPlotProperty';\nimport { Entity } from 'cesium';\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 sampled: 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 event: ScreenSpaceEventHandler.PositionedEvent;\n}\n\nexport interface OnSkeletonDragOptions {\n viewer: Viewer;\n\n /***\n * 当前标绘属性数据\n */\n sampled: 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 event: 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 sampled: 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 disabled?: 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\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: PlotFeature;\n\n /**\n * @internal\n */\n declare skeleton: PlotSkeleton;\n\n /**\n * @internal\n */\n declare index: number;\n}\n","import type { Cartesian3, Entity, JulianDate } from 'cesium';\nimport type { ComputedRef, ShallowRef } from 'vue';\nimport type { PlotFeature } from './PlotFeature';\nimport { watchArray } from '@vueuse/core';\nimport { CustomDataSource, PrimitiveCollection, ScreenSpaceEventType } from 'cesium';\nimport { arrayDiff, canvasCoordToCartesian, useCesiumEventListener, useDataSource, useEntityScope, usePrimitive, usePrimitiveScope, useScreenSpaceEventHandler, useViewer } from 'vesium';\nimport { computed, nextTick, 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<PlotFeature[]>,\n current: ShallowRef<PlotFeature | 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 (event) => {\n mouseCartesian.value = canvasCoordToCartesian(event?.endPosition, viewer.value!.scene);\n },\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 flush: 'post',\n });\n\n useCesiumEventListener(\n () => plots.value.map(item => item.definitionChanged),\n (_scope, key, newValue, oldValue) => {\n if (key === 'entities') {\n const { added, removed } = arrayDiff(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 } = arrayDiff(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 } = arrayDiff(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 = async (plot: PlotFeature) => {\n await nextTick();\n const packable = plot.sampled.getValue(getCurrentTime());\n const mouse = plot.defining ? mouseCartesian.value : undefined;\n const result = await plot.scheme.render?.({\n packable,\n mouse,\n defining: plot.defining,\n previous: {\n entities: plot.entities,\n primitives: plot.primitives,\n groundPrimitives: plot.groundPrimitives,\n },\n getPositions() {\n const points = packable.positions;\n mouse && points.push(mouse);\n return points;\n },\n });\n\n plot.entities = result?.entities ?? [];\n plot.primitives = result?.primitives ?? [];\n plot.groundPrimitives = result?.groundPrimitives ?? [];\n };\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', 'sampled', '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 { JulianDate } from 'cesium';\nimport type { Nullable } from 'vesium';\nimport type { CSSProperties, ShallowRef } from 'vue';\nimport { promiseTimeout } from '@vueuse/core';\nimport { ScreenSpaceEventType } from 'cesium';\nimport { canvasCoordToCartesian, isFunction, useCesiumEventListener, useScreenSpaceEventHandler, useViewer } from 'vesium';\nimport { computed, ref, watch } from 'vue';\nimport { PlotFeature } from './PlotFeature';\n\nexport function useSampled(\n current: ShallowRef<PlotFeature | undefined>,\n getCurrentTime: () => JulianDate,\n): void {\n const viewer = useViewer();\n const doubleClicking = ref(false);\n\n const packable = computed(() => {\n return current.value?.sampled.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, sampled } = 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 sampled.setSample(packable.value);\n const completed = scheme.complete?.(packable.value);\n completed && PlotFeature.setDefining(current.value, 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.allowManualComplete?.(packable.value);\n completed && PlotFeature.setDefining(current.value, 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, sampled } = 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 sampled.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!) : 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 === 'sampled') {\n setDefiningCursorCss();\n }\n });\n watch(current, () => setDefiningCursorCss());\n}\n","import type { JulianDate } from 'cesium';\nimport type { ComputedRef, ShallowRef } from 'vue';\nimport type { PlotFeature } from './PlotFeature';\nimport type { PlotSkeleton } from './PlotSkeleton';\nimport { onKeyStroke, watchArray } from '@vueuse/core';\nimport { CustomDataSource } from 'cesium';\nimport { arrayDiff, isFunction, useCesiumEventListener, useDataSource, useEntityScope, useGraphicEvent, useViewer } from 'vesium';\nimport { nextTick, shallowRef, toValue, watch, watchEffect } from 'vue';\nimport { PlotAction, PlotSkeletonEntity } from './PlotSkeleton';\n\nexport function useSkeleton(\n plots: ComputedRef<PlotFeature[]>,\n current: ShallowRef<PlotFeature | 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 = (plot: PlotFeature, destroyed?: boolean) => {\n const oldEntities = plot.skeletons;\n const entities: PlotSkeletonEntity[] = [];\n\n if (destroyed || plot.disabled) {\n plot.skeletons = [];\n }\n else {\n const packable = plot.sampled.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 disabled = isFunction(skeleton.disabled) ? skeleton.disabled({ active, defining }) : skeleton.disabled;\n if (disabled) {\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: any = new PlotSkeletonEntity(options ?? {});\n if (entity) {\n merge.propertyNames.forEach((key: string) => {\n if (key !== 'id') {\n (entity as any)[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.skeletons = entities;\n };\n\n const graphicEvent = useGraphicEvent();\n\n watchEffect((onCleanup) => {\n // cursor 仅在不存在定义态的标绘时才生效\n const remove = graphicEvent.add('global', 'DRAG', ({ event, pick, dragging, lockCamera }) => {\n if (pick.id instanceof PlotSkeletonEntity && entityScope.scope.has(pick.id)) {\n const entity = pick.id as PlotSkeletonEntity;\n\n const plot = entity.plot as PlotFeature;\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.sampled.getValue(getCurrentTime());\n skeleton.onDrag?.({\n viewer: viewer.value!,\n sampled: plot.sampled,\n packable,\n active: current.value === plot,\n index,\n event,\n dragging,\n lockCamera,\n });\n }\n else {\n activeEntity.value = undefined;\n }\n }, {\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 });\n onCleanup(remove);\n });\n\n // 键盘控制当前激活的点位\n onKeyStroke((keyEvent) => {\n if (activeEntity.value) {\n const entity = activeEntity.value;\n const plot = entity.plot as PlotFeature;\n const skeleton = entity.skeleton as PlotSkeleton;\n const index = entity.index as number;\n const packable = plot.sampled.getValue(getCurrentTime());\n\n skeleton.onKeyPressed?.({\n viewer: viewer.value!,\n sampled: plot.sampled,\n packable,\n index,\n keyEvent,\n });\n }\n });\n\n watchEffect((onCleanup) => {\n const remove = graphicEvent.add('global', 'HOVER', ({ 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 onCleanup(remove);\n });\n\n watchEffect((onCleanup) => {\n const remove = graphicEvent.add('global', 'LEFT_CLICK', ({ event, 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 PlotFeature;\n const skeleton = entity.skeleton as PlotSkeleton;\n const index = entity.index as number;\n const packable = plot.sampled.getValue(getCurrentTime());\n\n skeleton.onLeftClick?.({\n viewer: viewer.value!,\n sampled: plot.sampled,\n packable: packable!,\n active: current.value === plot,\n defining: plot.defining,\n index,\n event,\n });\n }\n else {\n activeEntity.value = undefined;\n }\n });\n onCleanup(remove);\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(\n () => plots.value.map(plot => plot.definitionChanged),\n (plot, key, newValue, oldValue) => {\n if (['disabled', 'defining', 'scheme', 'sampled', 'time'].includes(key)) {\n nextTick(() => update(plot));\n }\n else if (key === 'skeletons') {\n const { added, removed } = arrayDiff(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 // 当前激活的标绘变化时,更新渲染\n watch(current, (plot, previous) => {\n plot && update(plot);\n previous && update(previous);\n });\n\n return {\n dataSource,\n };\n}\n","import type { ShallowRef } from 'vue';\nimport type { PlotFeatureConstructorOptions } from './PlotFeature';\nimport type { SampledPlotPackable } from './SampledPlotProperty';\nimport { JulianDate, ScreenSpaceEventType } from 'cesium';\nimport { pickHitGraphic, useCesiumEventListener, useScreenSpaceEventHandler, useViewer } from 'vesium';\nimport { computed, shallowReactive, shallowRef, watch } from 'vue';\nimport { PlotFeature } from './PlotFeature';\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: PlotFeature | PlotFeatureConstructorOptions) => Promise<PlotFeature>;\n\nexport interface UsePlotRetrun {\n\n time: ShallowRef<JulianDate | undefined>;\n\n data?: ShallowRef<PlotFeature[]>;\n\n current?: ShallowRef<PlotFeature | 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() || new JulianDate(0, 0);\n };\n\n const collection = shallowReactive(new Set<PlotFeature>());\n const plots = computed(() => Array.from(collection));\n const current = shallowRef<PlotFeature>();\n const packable = shallowRef<SampledPlotPackable>();\n\n useCesiumEventListener([\n () => current.value?.sampled.definitionChanged,\n ], () => {\n packable.value = current.value?.sampled.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\n const pick = viewer.value?.scene.pick(data.position.clone());\n // 点击到了骨架点则不处理\n if (pick?.id?.plot instanceof PlotFeature) {\n return;\n }\n\n if (!pick) {\n current.value = undefined;\n return;\n }\n\n current.value = plots.value.find(plot => pickHitGraphic(pick, [...plot.entities, ...plot.primitives, ...plot.groundPrimitives]));\n });\n\n let operateResolve: ((plot: PlotFeature) => void) | undefined;\n let operateReject: (() => void) | undefined;\n\n // 当前激活的标绘发生变动时,上一个标绘取消激活。若上一标绘仍处于定义态时,应立即强制完成,若无法完成则删除。\n watch(current, (plot, previous) => {\n if (previous) {\n if (previous.defining) {\n const packable = previous.sampled.getValue(getCurrentTime());\n const completed = previous.scheme.allowManualComplete?.(packable);\n if (completed) {\n PlotFeature.setDefining(previous, 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 PlotFeature ? plot : new PlotFeature(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: PlotFeature): 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","import type { PlotSkeleton } from '../usePlot';\nimport { Color } from 'cesium';\nimport { canvasCoordToCartesian, toCartesian3, toCartographic } from 'vesium';\nimport { PlotAction } from '../usePlot';\n\n/**\n * 绘制控制的框架点,拖拽时,将更新该控制点的实时位置\n */\nexport function control(): PlotSkeleton {\n return {\n disabled: ({ active }) => !active,\n cursor: 'pointer',\n dragCursor: 'crosshair',\n onDrag({ viewer, sampled, packable, event, index, lockCamera }) {\n lockCamera();\n const position = canvasCoordToCartesian(event.endPosition, viewer.scene);\n if (position) {\n const positions = [...packable.positions ?? []];\n positions[index] = position;\n sampled.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions,\n });\n }\n },\n\n onKeyPressed({ viewer, keyEvent, sampled, 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 sampled.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';\nimport { Cartesian3, Color } from 'cesium';\nimport { canvasCoordToCartesian } from 'vesium';\nimport { PlotAction } from '../usePlot';\n\n/**\n * 绘制封闭的间隔框架点,如多边形。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。\n */\nexport function interval(): PlotSkeleton {\n let dragIndex = -1;\n return {\n disabled: ({ 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, sampled, packable, event, index, lockCamera, dragging }) {\n lockCamera();\n\n const position = canvasCoordToCartesian(event.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 sampled.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';\nimport { Cartesian3, Color } from 'cesium';\nimport { canvasCoordToCartesian } from 'vesium';\nimport { PlotAction } from '../usePlot';\n\n/**\n * 绘制非封闭的间隔框架点,如线段。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。\n */\nexport function intervalNonclosed(): PlotSkeleton {\n let dragIndex = -1;\n return {\n disabled: ({ 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 const midpoints: Cartesian3[] = [];\n for (let i = 0; i < _positions.length - 1; i++) {\n midpoints.push(Cartesian3.midpoint(_positions[i], _positions[i + 1], new Cartesian3()));\n }\n return midpoints;\n },\n onDrag({ viewer, sampled, packable, event, index, lockCamera, dragging }) {\n lockCamera();\n const position = canvasCoordToCartesian(event.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 sampled.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';\nimport { Cartesian3, Color, HorizontalOrigin, Rectangle, VerticalOrigin } from 'cesium';\nimport { canvasCoordToCartesian, toCartesian3 } from 'vesium';\nimport { PlotAction } from '../usePlot';\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 disabled: ({ 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, sampled, packable, event, lockCamera, dragging }) {\n dragging && lockCamera();\n const startPosition = canvasCoordToCartesian(event.startPosition, viewer.scene);\n const endPosition = canvasCoordToCartesian(event.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 sampled.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 { Cartesian3, CoplanarPolygonGeometry, VertexFormat } from 'cesium';\n\n/**\n * 将多个边界点组成的面切割成多个三角形返回参数,为三角形三点的数组\n */\nexport type TesselateReturn = Array<[p0: Cartesian3, p1: Cartesian3, p2: Cartesian3]>;\n\n/**\n * 将多个边界点组成的面切割成多个三角形\n * @param positions\n */\nexport function tesselate(positions: Cartesian3[]): TesselateReturn {\n if (positions.length < 3) {\n throw new Error('positions must >= 3');\n }\n\n if (positions.length === 3) {\n return [[positions[0].clone(), positions[1].clone(), positions[2].clone()]];\n }\n\n const geometry = CoplanarPolygonGeometry.createGeometry(\n CoplanarPolygonGeometry.fromPositions({\n positions,\n vertexFormat: VertexFormat.POSITION_ONLY,\n }),\n )!;\n\n if (!geometry) {\n throw new Error('positions无法组成有效的geometry,检查点位是否错误');\n }\n const values = geometry.attributes.position!.values as number[];\n const indices = geometry.indices;\n const result: TesselateReturn = [];\n for (let i = 0; i < indices!.length; i += 3) {\n const a = Cartesian3.unpack(values, indices![i] * 3, new Cartesian3());\n const b = Cartesian3.unpack(values, indices![i + 1] * 3, new Cartesian3());\n const c = Cartesian3.unpack(values, indices![i + 2] * 3, new Cartesian3());\n result.push([a, b, c]);\n }\n return result;\n}\n","import type { Cartesian3, Scene, TerrainProvider } from 'cesium';\nimport { Cartographic, ClassificationType, Ellipsoid, sampleTerrainMostDetailed } from 'cesium';\n\nexport interface ClampToHeightMostDetailedByTilesetOrTerrainOptions {\n /**\n * 待贴地的点位\n */\n positions: Cartesian3[];\n\n scene: Scene;\n\n /**\n * 贴地类型\n * @defaultValue ClassificationType.BOTH\n */\n classificationType?: ClassificationType;\n\n /**\n * 地形数据\n * @defaultValue scene.terrainProvider\n */\n terrainProvider?: TerrainProvider;\n}\n\n/**\n * 将传入的点位列表进行贴地处理,若某个点位获取高程失败则将此进行克隆返回\n * @param options - 配置项\n */\nexport async function clampToHeightMostDetailedByTilesetOrTerrain(\n options: ClampToHeightMostDetailedByTilesetOrTerrainOptions,\n): Promise<Cartesian3[]> {\n const {\n positions,\n scene,\n classificationType = ClassificationType.BOTH,\n terrainProvider = scene.terrainProvider,\n } = options;\n\n const tileset = [ClassificationType.BOTH, ClassificationType.CESIUM_3D_TILE].includes(classificationType);\n const terrain = [ClassificationType.BOTH, ClassificationType.TERRAIN].includes(classificationType);\n\n const tilesetPromise = new Promise<Cartesian3[]>((resolve) => {\n if (tileset) {\n scene\n .clampToHeightMostDetailed(positions.map(e => e.clone()))\n .then(resolve)\n .catch((error) => {\n console.warn(error);\n resolve([]);\n });\n }\n else {\n resolve([]);\n }\n });\n const terrainPromise = new Promise<Cartographic[]>((resolve) => {\n if (terrain && terrainProvider) {\n sampleTerrainMostDetailed(\n terrainProvider,\n positions.map(e => Cartographic.fromCartesian(e)),\n )\n .then(e => resolve(e))\n .catch((error) => {\n console.warn(error);\n resolve([]);\n });\n }\n else {\n resolve([]);\n }\n });\n const [tilesetPositions, terrainPositions] = await Promise.all([tilesetPromise, terrainPromise]);\n const results: Cartesian3[] = [];\n\n positions.forEach((item, index) => {\n const position\n = tilesetPositions[index] || terrainPositions[index]\n ? Ellipsoid.WGS84.cartographicToCartesian(terrainPositions[index])\n : item.clone();\n results.push(position);\n });\n\n return results;\n}\n","import type { Scene, TerrainProvider } from 'cesium';\nimport { Cartesian3, ClassificationType, PerInstanceColorAppearance, PolygonGeometry, Rectangle } from 'cesium';\nimport { clampToHeightMostDetailedByTilesetOrTerrain } from './clampToGround';\n\n/**\n * 三角网配置\n */\nexport interface TriangleGridOptions {\n /**\n * 三角网粒度(点位间隔约为边界Rectangle生成的经纬最大值去除以密度)\n * @defaultValue 10\n */\n density: number;\n\n scene?: Scene;\n\n /**\n * 是否贴地\n */\n clampToGround?: boolean;\n\n /**\n * 贴地类型\n * @defaultValue ClassificationType.BOTH\n */\n classificationType?: ClassificationType;\n\n /**\n * 地形数据\n * @defaultValue scene.terrainProvider\n */\n terrainProvider?: TerrainProvider;\n}\n\n/**\n * 生成三角网返回参数,为三角形三点的数组\n */\nexport type TriangleGridReturn = Array<[p0: Cartesian3, p1: Cartesian3, p2: Cartesian3]>;\n\nfunction defaultOptions(original?: TriangleGridOptions): TriangleGridOptions {\n const clampToGround = original?.clampToGround ?? false;\n const classificationType = original?.classificationType ?? ClassificationType.BOTH;\n const density = Math.floor(original?.density ?? 10);\n return {\n scene: original?.scene,\n clampToGround,\n classificationType,\n terrainProvider: original?.terrainProvider,\n density,\n };\n}\n\n/**\n * 生成三角网数组\n * @param positions - 边界点数组\n * @param options - 配置项\n */\nexport async function triangleGrid(\n positions: Cartesian3[],\n options?: TriangleGridOptions,\n): Promise<TriangleGridReturn> {\n if (positions.length < 3) {\n throw new Error('positions must >= 3');\n }\n const { density, scene, clampToGround, classificationType, terrainProvider } = defaultOptions(options);\n\n if (density <= 0) {\n throw new Error('options.density must > 0');\n }\n\n // 取经纬最大值,根据此最大值计算粒度\n const bbox = Rectangle.fromCartesianArray(positions);\n const vertical = bbox.north - bbox.south;\n const horizontal = bbox.east - bbox.west;\n const max = Math.max(horizontal, vertical);\n const granularity = max / density; // 弧度粒度\n\n const polygonGeometry = PolygonGeometry.fromPositions({\n positions,\n vertexFormat: PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,\n granularity,\n });\n\n const geometry = PolygonGeometry.createGeometry(polygonGeometry)!;\n const values = geometry.attributes.position!.values as number[];\n if (!geometry || !values) {\n throw new Error('positions无法组成有效的geometry,检查点位是否错误');\n }\n const indices = geometry.indices;\n\n let cartesian3List: Cartesian3[] = [];\n for (let i = 0; i < indices!.length; i += 3) {\n const a = Cartesian3.unpack(values, indices![i] * 3, new Cartesian3());\n const b = Cartesian3.unpack(values, indices![i + 1] * 3, new Cartesian3());\n const c = Cartesian3.unpack(values, indices![i + 2] * 3, new Cartesian3());\n cartesian3List.push(a, b, c);\n }\n\n if (clampToGround) {\n if (!scene) {\n throw new Error('scene is required on `clampToGround == true`.');\n }\n const detaileds = await clampToHeightMostDetailedByTilesetOrTerrain({\n scene,\n terrainProvider,\n positions: cartesian3List,\n classificationType,\n });\n cartesian3List = detaileds;\n }\n const grid: TriangleGridReturn = [];\n while (cartesian3List?.length) {\n const [a, b, c] = cartesian3List.splice(0, 3);\n grid.push([a, b, c]);\n }\n\n return grid;\n}\n","import type { Scene, TerrainProvider } from 'cesium';\nimport { Cartesian3, ClassificationType } from 'cesium';\nimport { tesselate } from './tesselate';\nimport { triangleGrid } from './triangleGrid';\n\n/**\n * 计算三维坐标系下三角形面积\n * @param p0 - 三角形第一个点\n * @param p1 - 三角形第二个点\n * @param p2 - 三角形第三个点\n */\nfunction triangleArea(p0: Cartesian3, p1: Cartesian3, p2: Cartesian3) {\n const v0 = Cartesian3.subtract(p0, p1, new Cartesian3());\n const v1 = Cartesian3.subtract(p2, p1, new Cartesian3());\n const cross = Cartesian3.cross(v0, v1, v0);\n return Cartesian3.magnitude(cross) * 0.5;\n}\n\nexport interface AreaOptions {\n scene?: Scene;\n\n /**\n * 是否贴地\n */\n clampToGround?: boolean;\n\n /**\n * 贴地类型\n * @defaultValue ClassificationType.BOTH\n */\n classificationType?: ClassificationType;\n\n /**\n * 地形数据\n * @defaultValue scene.terrainProvider\n */\n terrainProvider?: TerrainProvider;\n\n /**\n * 插值密度\n * @defaultValue 10\n */\n density?: number;\n}\n\nfunction defaultOptions(original?: AreaOptions): AreaOptions {\n const clampToGround = original?.clampToGround ?? false;\n const classificationType = original?.classificationType ?? ClassificationType.BOTH;\n const density = Math.floor(original?.density ?? 10);\n return {\n scene: original?.scene,\n clampToGround,\n classificationType,\n terrainProvider: original?.terrainProvider,\n density,\n };\n}\n\n/**\n * 计算三维坐标系下图形面积\n * @param positions - 图形各点的笛卡尔数组\n */\nexport async function area(positions: Cartesian3[], options?: AreaOptions): Promise<number> {\n if (positions.length < 2) {\n throw new Error('positions.length must >= 2');\n }\n\n const { density, scene, clampToGround, classificationType, terrainProvider } = defaultOptions(options);\n if (density! <= 0) {\n throw new Error('options.density must > 0');\n }\n\n if (!clampToGround) {\n const triangles = tesselate(positions);\n return triangles.reduce((count, current) => (count += triangleArea(...current)), 0);\n }\n\n const triangles = await triangleGrid(positions, {\n density: density!,\n scene,\n clampToGround,\n classificationType,\n terrainProvider,\n });\n return triangles.reduce((count, current) => (count += triangleArea(...current)), 0);\n}\n","import type { ClassificationType, Scene, TerrainProvider } from 'cesium';\nimport { Cartesian3 } from 'cesium';\nimport { clampToHeightMostDetailedByTilesetOrTerrain } from './clampToGround';\n\nexport interface LerpArrayOptions {\n /**\n * 起点\n */\n start: Cartesian3;\n /**\n * 终点\n */\n end: Cartesian3;\n\n /**\n * 内插值数量\n */\n count: number;\n\n scene?: Scene;\n\n /**\n * 是否贴地\n */\n clampToGround?: boolean;\n\n /**\n * 贴地类型\n * @defaultValue ClassificationType.BOTH\n */\n classificationType?: ClassificationType;\n\n /**\n * 地形数据\n * @defaultValue scene.terrainProvider\n */\n terrainProvider?: TerrainProvider;\n}\n\n/**\n * 在起点和终点间进行插值, 返回的数组包括起点和终点,数组长度为 count+1\n */\nexport async function lerpArray(options: LerpArrayOptions): Promise<Cartesian3[]> {\n const { start, end, count, scene, clampToGround, classificationType, terrainProvider } = options;\n const result: Cartesian3[] = [];\n\n for (let i = 0; i < count; i++) {\n const position = Cartesian3.lerp(start, end, 1 / count, new Cartesian3());\n result.push(position);\n }\n result.push(end.clone());\n if (!clampToGround) {\n return result;\n }\n if (!scene) {\n throw new Error('scene is required on `clampToGround == true`.');\n }\n const detaileds = await clampToHeightMostDetailedByTilesetOrTerrain({\n scene,\n terrainProvider,\n positions: result,\n classificationType,\n });\n\n return detaileds;\n}\n","import type { Scene, TerrainProvider } from 'cesium';\nimport { Cartesian3, ClassificationType } from 'cesium';\nimport { lerpArray } from './lerpArray';\n\n/**\n * 计算多点位之间的距离入参\n */\nexport interface DistanceOptions {\n scene?: Scene;\n\n /**\n * 是否贴地\n */\n clampToGround?: boolean;\n\n /**\n * 贴地类型\n * @defaultValue ClassificationType.BOTH\n */\n classificationType?: ClassificationType;\n\n /**\n * 地形数据\n * @defaultValue scene.terrainProvider\n */\n terrainProvider?: TerrainProvider;\n\n /**\n * 插值密度\n * @defaultValue 50\n */\n density?: number;\n}\n\n/**\n * 计算多点位之间的距离返回参数\n */\nexport interface DistanceReturn {\n /**\n * 当前点位与下一点位之间的距离(米)\n */\n stages: number[];\n\n /**\n * 所有点位之间相加的总距离(米)\n */\n count: number;\n}\n\nfunction defaultOptions(original?: DistanceOptions): DistanceOptions {\n const clampToGround = original?.clampToGround ?? false;\n const classificationType = original?.classificationType ?? ClassificationType.BOTH;\n const density = Math.floor(original?.density ?? 50);\n return {\n scene: original?.scene,\n clampToGround,\n classificationType,\n terrainProvider: original?.terrainProvider,\n density,\n };\n}\n\n/**\n * 计算多点位之间的距离\n * @param positions\n */\nexport async function distance(positions: Cartesian3[], options?: DistanceOptions): Promise<DistanceReturn> {\n if (positions.length < 2) {\n throw new Error('positions.length must >= 2');\n }\n const _options = defaultOptions(options);\n\n const stages: number[] = [];\n let count = 0;\n positions.forEach((position, index) => {\n if (index !== positions.length - 1) {\n const next = positions[index + 1];\n const distance = Cartesian3.distance(position, next);\n stages.push(distance);\n count += distance;\n }\n });\n\n // 不贴地\n if (!_options.clampToGround) {\n return {\n stages,\n count,\n };\n }\n\n // 贴地\n const density = _options.density!;\n if (density <= 0) {\n throw new Error('options.density must > 0');\n }\n\n // 按每段长度占总长度的比例分配插值数量\n const densities = stages.map((stage) => {\n return Math.floor((stage / count) * density);\n });\n // 出现未分配的插值数量则分配给最后一项\n const diff = density - densities.reduce((count, current) => (count += current), 0);\n if (diff) {\n densities[densities.length - 1] += diff;\n }\n\n const positionListPromises = densities.map((density, i) => {\n return lerpArray({\n scene: _options.scene,\n start: positions[i],\n end: positions[i + 1],\n count: density,\n clampToGround: true,\n classificationType: _options.classificationType,\n terrainProvider: _options.terrainProvider,\n });\n });\n const detaileds = await Promise.all(positionListPromises);\n\n const stagePromises = detaileds.map(async (positions) => {\n const { count } = await distance(positions);\n return count;\n });\n\n const groundStages = await Promise.all(stagePromises);\n\n return {\n stages: groundStages,\n count: groundStages.reduce((count, current) => (count += current), 0),\n };\n}\n","import { CallbackProperty, Color, ConstantPositionProperty, ConstantProperty, Entity, PolygonHierarchy, Rectangle } from 'cesium';\nimport { toCartesian3 } from 'vesium';\nimport { control, interval } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\nimport { area } from './utils';\n\nexport const schemeMeasureArea = new PlotScheme({\n type: 'MeasureArea',\n allowManualComplete: packable => packable.positions!.length >= 3,\n skeletons: [\n control,\n interval,\n ],\n\n initRender() {\n return {\n entities: [\n new Entity({\n label: {\n font: '14pt',\n },\n polyline: {\n material: Color.YELLOW.withAlpha(0.5),\n },\n polygon: {\n material: Color.YELLOW.withAlpha(0.5),\n },\n }),\n ],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const { mouse, packable } = context;\n\n const positions = [...packable.positions ?? []];\n mouse && positions.push(mouse);\n\n if (positions.length === 2) {\n entity.position = undefined;\n entity.label!.text = undefined;\n entity.polygon!.hierarchy = undefined;\n entity.polyline!.positions = new CallbackProperty(() => positions, false);\n }\n else if (positions.length >= 3) {\n positions.push(positions[0]);\n entity.position = new ConstantPositionProperty(\n toCartesian3(Rectangle.center(Rectangle.fromCartesianArray(positions))),\n );\n entity.label!.text = new ConstantProperty('');\n\n area(positions).then((e) => {\n let text: string = '';\n if (e / 1000 / 1000 > 10) {\n text = `${(e / 1000 / 1000).toFixed(2)}km²`;\n }\n else {\n text = `${(+e).toFixed(2)}m²`;\n }\n entity.label!.text = new ConstantProperty(text);\n });\n entity.polyline!.positions = undefined;\n entity.polygon!.hierarchy = new CallbackProperty(() => {\n return positions.length >= 3 ? new PolygonHierarchy([...positions]) : undefined;\n }, false);\n }\n else {\n entity.position = undefined;\n entity.polygon!.hierarchy = undefined;\n entity.polyline!.positions = undefined;\n }\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackPositionProperty, CallbackProperty, Cartesian3, Color, Entity, LabelGraphics, PolylineGraphics } from 'cesium';\nimport { control } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\nimport { distance } from './utils';\n\nexport const schemeMeasureDistance = new PlotScheme({\n type: 'MeasureDistance',\n allowManualComplete: packable => packable.positions!.length >= 2,\n skeletons: [\n control,\n ],\n initRender() {\n return {\n entities: [\n new Entity({\n polyline: {\n width: 2,\n material: Color.YELLOW.withAlpha(0.5),\n },\n }),\n ],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const { mouse, packable, previous } = context;\n\n const entities = previous.entities!;\n\n const positions = [...packable.positions ?? []];\n mouse && positions.push(mouse);\n\n if (positions.length < 2) {\n return {\n entities,\n };\n }\n\n const pl = entities[0]!;\n\n pl.polyline ??= new PolylineGraphics();\n pl.polyline!.positions = new CallbackProperty(() => positions, false);\n\n positions.forEach((item, index) => {\n if (!entities[index + 1]) {\n entities[index + 1] = new Entity({\n position: item,\n label: new LabelGraphics({\n backgroundColor: Color.fromCssColorString('#fff'),\n font: '12pt sans-serif',\n\n }),\n });\n }\n });\n\n entities.splice(positions.length, entities.length - positions.length - 1);\n\n distance(positions).then(({ count, stages }) => {\n stages.forEach((stage, index) => {\n entities[index + 1]!.position = new CallbackPositionProperty(() => Cartesian3.midpoint(positions[index], positions[index + 1], new Cartesian3()), false);\n entities[index + 1]!.label!.text = new CallbackProperty(() => `${stage.toFixed(2)} m`, false);\n });\n if (stages.length > 1) {\n entities[entities.length - 1]!.position = new CallbackPositionProperty(() => positions[positions.length - 1], false);\n entities[entities.length - 1]!.label!.text = new CallbackProperty(() => `${count.toFixed(2)} m`, false);\n }\n else {\n entities[entities.length - 1]!.position = undefined;\n entities[entities.length - 1]!.label!.text = undefined;\n }\n });\n\n return {\n entities,\n };\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackPositionProperty, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * billboard标绘配置\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeBillboard = new PlotScheme({\n type: 'Billboard',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n initRender: () => {\n return { entities: [new Entity({ billboard: { image: '/favicon.svg', width: 32, height: 32 } })] };\n },\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities?.[0] ?? new Entity({ billboard: { } });\n const position = packable.positions?.[0] ?? mouse;\n entity.position = new CallbackPositionProperty(() => position, true);\n\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackPositionProperty, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * billboard-pin-builder标绘配置\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeBillboardPinBuilder = new PlotScheme({\n type: 'BillboardPinBuilder',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n initRender() {\n return {\n entities: [new Entity({ billboard: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const position = context.packable.positions[0] ?? context.mouse!;\n entity.position = new CallbackPositionProperty(() => position, true);\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackProperty, Cartesian3, ConstantPositionProperty, Entity } from 'cesium';\n\n/**\n * cylinder标绘配置\n */\nimport { toProperty, toPropertyValue } from 'vesium';\nimport { control, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeCylinder = new PlotScheme({\n type: 'Cylinder',\n complete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [\n new Entity({\n cylinder: {},\n }),\n ],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const positions = [...context.packable.positions];\n if (positions.length === 0) {\n return context.previous;\n }\n\n if (positions.length === 1) {\n const position = context.mouse;\n position && positions.push(position);\n }\n if (positions.length < 2) {\n return context.previous;\n }\n entity.position = new ConstantPositionProperty(positions[0]);\n const radius = Cartesian3.distance(positions[0], positions[1]);\n entity.cylinder!.bottomRadius = new CallbackProperty(() => radius, false);\n if (context.defining || !toPropertyValue(entity.cylinder!.length)) {\n entity.cylinder!.length = toProperty(radius * 2);\n }\n return {\n entities: [entity],\n };\n },\n});\n","/**\n * ellipse标绘配置 圆形扩散波\n */\nimport { CallbackProperty, Cartesian3, ConstantPositionProperty, Entity } from 'cesium';\nimport { control, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeEllipse = new PlotScheme({\n type: 'Ellipse',\n complete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ ellipse: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const positions = [...context.packable.positions];\n if (positions.length === 0) {\n return context.previous;\n }\n if (positions.length === 1) {\n const position = context.mouse;\n position && positions.push(position);\n }\n if (positions.length < 2) {\n return context.previous;\n }\n entity.position = new ConstantPositionProperty(positions[0]);\n const radius = Cartesian3.distance(positions[0], positions[1]);\n entity.ellipse!.semiMinorAxis = new CallbackProperty(() => radius || 1, false);\n entity.ellipse!.semiMajorAxis = entity.ellipse!.semiMinorAxis;\n\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackPositionProperty, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * 基础label标绘配置\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeLabel = new PlotScheme({\n type: 'Label',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n initRender() {\n return {\n entities: [new Entity({ label: { text: 'Label' } })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const position = context.packable.positions[0] ?? context.mouse!;\n entity.position = new CallbackPositionProperty(() => position, true);\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackPositionProperty, Color, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * 基础point标绘配置\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePoint = new PlotScheme({\n type: 'Point',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n initRender() {\n return {\n entities: [new Entity({ point: { pixelSize: 10, color: Color.RED } })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const position = context.packable.positions[0] ?? context.mouse!;\n entity.position = new CallbackPositionProperty(() => position, true);\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { control, interval, moved } from '../skeleton';\n/**\n * 基础Polygon标绘配置\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygon = new PlotScheme({\n type: 'Polygon',\n allowManualComplete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n interval,\n ],\n initRender: () => {\n return {\n entities: [new Entity({ polyline: {}, polygon: {} })],\n };\n },\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities![0];\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","import { arc } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, moved } from '../skeleton';\n/**\n * 弓形\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArc = new PlotScheme({\n type: 'PolygonArc',\n complete: packable => packable.positions!.length >= 3,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n if (points.length < 3) {\n context.mouse && points.push(context.mouse.clone());\n }\n const coords = points.map(e => toCoord(e)!);\n if (coords.length < 3) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const positions = arc(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowAttackDirection } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowAttackDirection = new PlotScheme({\n type: 'PolygonArrowAttackDirection',\n allowManualComplete: packable => packable.positions!.length >= 3,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n context.mouse && points.push(context.mouse.clone());\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length < 3) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const positions = arrowAttackDirection(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowAttackDirectionTailed } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowAttackDirectionTailed = new PlotScheme({\n type: 'PolygonArrowAttackDirectionTailed',\n allowManualComplete: packable => packable.positions!.length >= 3,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n context.mouse && points.push(context.mouse.clone());\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length < 3) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const positions = arrowAttackDirectionTailed(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowClamped } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowClamped = new PlotScheme({\n type: 'PolygonArrowClamped',\n complete: packable => packable.positions!.length >= 5,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n if (points.length < 5) {\n const mouse = context.mouse;\n mouse && points.push(mouse.clone());\n }\n\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length >= 3) {\n const positions = arrowClamped(coords);\n const hierarchy = new PolygonHierarchy(positions.map(item => toCartesian3(item)!));\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n }\n else {\n entity.polygon!.hierarchy = undefined;\n }\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowStraight } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowStraight = new PlotScheme({\n type: 'PolygonArrowStraight',\n complete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n if (points.length < 2) {\n const mouse = context.mouse;\n mouse && points.push(mouse.clone());\n }\n\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length >= 2) {\n const positions = arrowStraight(coords);\n const hierarchy = new PolygonHierarchy(positions.map(item => toCartesian3(item)!));\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n }\n else {\n entity.polygon!.hierarchy = undefined;\n }\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowStraightSharp } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowStraightSharp = new PlotScheme({\n type: 'PolygonArrowStraightSharp',\n complete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n if (points.length < 2) {\n const mouse = context.mouse;\n mouse && points.push(mouse.clone());\n }\n\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length >= 2) {\n const positions = arrowStraightSharp(coords);\n const hierarchy = new PolygonHierarchy(positions.map(item => toCartesian3(item)!));\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n }\n else {\n entity.polygon!.hierarchy = undefined;\n }\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowUnitCombatOperation } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowUnitCombatOperation = new PlotScheme({\n type: 'PolygonArrowUnitCombatOperation',\n allowManualComplete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n context.mouse && points.push(context.mouse.clone());\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length < 2) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const positions = arrowUnitCombatOperation(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowUnitCombatOperationTailed } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, interval, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowUnitCombatOperationTailed = new PlotScheme({\n type: 'PolygonArrowUnitCombatOperationTailed',\n allowManualComplete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n interval,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n context.mouse && points.push(context.mouse.clone());\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length < 2) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const positions = arrowUnitCombatOperationTailed(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import { assemblingPlace } from '@vesium/geometry';\nimport { CallbackProperty, Cartographic, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCartographic, toCoord } from 'vesium';\nimport { control, interval, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonAssemblingPlace = new PlotScheme({\n type: 'PolygonAssemblingPlace',\n complete: packable => packable.positions!.length >= 3,\n skeletons: [\n moved,\n control,\n interval,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n context.mouse && points.push(context.mouse.clone());\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length < 2) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n\n if (coords.length === 2) {\n const c0 = toCartographic(coords[0])!;\n const c1 = toCartographic(coords[1])!;\n const latitude = c0.latitude;\n const height = c0.height;\n const longitude = c1.longitude - (c0.longitude - c1.longitude);\n coords.push(toCoord(new Cartographic(longitude, latitude, height))!);\n }\n const positions = assemblingPlace(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import * as turf from '@turf/turf';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\n/**\n * polygon-smooth 标绘配置 平滑闭合面\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonSmooth = new PlotScheme({\n type: 'PolygonSmooth',\n allowManualComplete: packable => packable.positions!.length >= 3,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const positions = context.packable.positions;\n const mousePosition = context.mouse;\n mousePosition && positions.push(mousePosition.clone());\n if (positions.length <= 2) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const wgs84s = positions.map(e => toCoord(e)!);\n wgs84s.push(wgs84s[0]);\n const { features } = turf.polygonSmooth(turf.polygon([wgs84s]), {\n iterations: 3,\n });\n const cartesians = features[0].geometry.coordinates[0].map(item => toCartesian3(item as any)).filter(e => !!e);\n const hierarchy = new PolygonHierarchy(cartesians);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","/**\n * polyline\n */\nimport { CallbackProperty, Color, Entity } from 'cesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolyline = new PlotScheme({\n type: 'Polyline',\n allowManualComplete: packable => packable.positions!.length > 1,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polyline: { material: Color.RED, width: 2 } })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const positions = [...context.packable.positions];\n const mouse = context.mouse;\n mouse && positions.push(mouse.clone());\n const cache = positions.length >= 2 ? positions : [];\n entity.polyline!.positions = new CallbackProperty(() => cache, false);\n return {\n entities: [entity],\n };\n },\n});\n","import * as turf from '@turf/turf';\nimport { CallbackProperty, Color, Entity } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\n/**\n * polyline-Curve\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolylineCurve = new PlotScheme({\n type: 'PolylineCurve',\n allowManualComplete: packable => packable.positions!.length > 1,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polyline: { material: Color.RED, width: 2 } })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const positions = [...context.packable.positions];\n const mouse = context.mouse;\n mouse && positions.push(mouse.clone());\n if (positions.length < 2) {\n entity.polyline!.positions = undefined;\n return context.previous;\n }\n\n const coords = positions.map(position => toCoord(position)!);\n const { geometry: { coordinates } } = turf.bezierSpline(turf.lineString(coords));\n\n entity.polyline!.positions = new CallbackProperty(() => coordinates.map(toCartesian3), false);\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackProperty, Entity, Rectangle } from 'cesium';\nimport { control, moved } from '../skeleton';\n/**\n * rectangle\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeRectangle = new PlotScheme({\n type: 'Rectangle',\n complete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ rectangle: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const positions = [...context.packable.positions];\n const mouse = context.mouse;\n mouse && positions.push(mouse.clone());\n if (positions.length < 2) {\n entity.rectangle!.coordinates = undefined;\n return context.previous;\n }\n const coordinates = Rectangle.fromCartesianArray(positions ?? []);\n entity.rectangle!.coordinates = new CallbackProperty(() => coordinates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,MAEtB,GADA,GAAS,EAAU,KAAK,EAAM,OAAO,CAAC,CAClC,EAAU,OAAS,EAErB,MADA,GAAO,UAAW,YAAc,IAAA,GACzB,EAAQ,SAEjB,IAAM,EAAc,EAAU,mBAAmB,GAAa,EAAE,CAAC,CAEjE,MADA,GAAO,UAAW,YAAc,IAAI,MAAuB,EAAa,GAAM,CACvE,CACL,SAAU,CAAC,EAAO,CACnB,EAEJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.min.mjs","names":["defaultOptions","defaultOptions"],"sources":["../usePlot/PlotScheme.ts","../usePlot/SampledPlotProperty.ts","../usePlot/PlotFeature.ts","../usePlot/PlotSkeleton.ts","../usePlot/useRender.ts","../usePlot/useSampled.ts","../usePlot/useSkeleton.ts","../usePlot/usePlot.ts","../skeleton/control.ts","../skeleton/interval.ts","../skeleton/intervalNonclosed.ts","../skeleton/moved.ts","../measure/utils/tesselate.ts","../measure/utils/clampToGround.ts","../measure/utils/triangleGrid.ts","../measure/utils/area.ts","../measure/utils/lerpArray.ts","../measure/utils/distance.ts","../measure/measureArea.ts","../measure/measureDistance.ts","../scheme/Billboard.ts","../scheme/BillboardPinBuilder.ts","../scheme/Cylinder.ts","../scheme/Ellipse.ts","../scheme/Label.ts","../scheme/Point.ts","../scheme/Polygon.ts","../scheme/PolygonArc.ts","../scheme/PolygonArrowAttackDirection.ts","../scheme/PolygonArrowAttackDirectionTailed.ts","../scheme/PolygonArrowClamped.ts","../scheme/PolygonArrowStraight.ts","../scheme/PolygonArrowStraightSharp.ts","../scheme/PolygonArrowUnitCombatOperation.ts","../scheme/PolygonArrowUnitCombatOperationTailed.ts","../scheme/PolygonAssemblingPlace.ts","../scheme/PolygonSmooth.ts","../scheme/Polyline.ts","../scheme/PolylineCurve.ts","../scheme/Rectangle.ts"],"sourcesContent":["import type { Cartesian3, Entity } from 'cesium';\nimport type { Nullable } from 'vesium';\nimport type { CSSProperties } from 'vue';\nimport type { PlotSkeleton } from './PlotSkeleton';\nimport type { SampledPlotPackable } from './SampledPlotProperty';\nimport { assert } from '@vueuse/core';\nimport { assertError } from 'vesium';\n\nexport interface PlotRenderResult {\n entities?: Entity[];\n primitives?: any[];\n groundPrimitives?: any[];\n}\n\nexport interface PlotRenderContext<D = any> {\n /**\n * 当前标绘采集到点位原始数据\n */\n packable: SampledPlotPackable<D>;\n\n /**\n * 当前是否处于定义态\n */\n defining: boolean;\n\n /**\n * 当前鼠标位置,若当前标绘不处于定义态时,`mouse`为`undefined`\n */\n mouse?: Cartesian3;\n\n /**\n * 上一次的渲染结果\n */\n previous: PlotRenderResult;\n\n /**\n * 当前有效的点位数组,若处于定义态时,还会包含鼠标位置\n */\n getPositions: () => Cartesian3[];\n}\n\nexport interface PlotSchemeConstructorOptions {\n /**\n * 标绘类型。应当是全局唯一的字符串,会作为键名缓存\n */\n type: string;\n\n /**\n * 判断是否立即完成标绘.\n * 每次控制点发生变变化时,执行该回调函数,返回`true`则完成标绘\n */\n complete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 判断是否允许手动完成标绘。\n * 每次控制点发生变变化时,执行该回调函数,返回`true`则后续左键双击即完成标绘\n */\n allowManualComplete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 处于定义态时鼠标的样式\n * @default 'crosshair'\n */\n definingCursor?: Nullable<CSSProperties['cursor']> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);\n\n /**\n * 当前标绘的框架点数据\n */\n skeletons?: (() => PlotSkeleton) [];\n\n /**\n * 初始化时创建的render,创建后会作为配置项传入`render`中\n */\n initRender: () => PlotRenderResult;\n\n /**\n * 当标绘数据变化时,会触发`render`回调,返回的数据会被添加到cesium中\n */\n render?: (context: PlotRenderContext) => PlotRenderResult | Promise<PlotRenderResult>;\n}\n\nexport class PlotScheme {\n constructor(options: PlotSchemeConstructorOptions) {\n this.type = options.type;\n this.complete = options.complete;\n this.allowManualComplete = options.allowManualComplete;\n this.definingCursor = options.definingCursor ?? 'crosshair';\n this.skeletons = options.skeletons?.map(item => item()) ?? [];\n this.initRender = options.initRender;\n this.render = options.render;\n }\n\n /**\n * 标绘类型。应当是全局唯一的字符串,会作为键名缓存\n */\n type: string;\n\n /**\n * 判断是否立即完成标绘.\n * 每次控制点发生变变化时,执行该回调函数,返回`true`则完成标绘\n */\n complete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 判断是否允许手动完成标绘。\n * 每次控制点发生变变化时,执行该回调函数,返回`true`则后续左键双击即完成标绘\n */\n allowManualComplete?: (packable: SampledPlotPackable) => boolean;\n\n /**\n * 处于定义态时鼠标的样式\n * @default 'crosshair'\n */\n definingCursor?: Nullable<CSSProperties['cursor']> | ((packable: SampledPlotPackable) => Nullable<CSSProperties['cursor']>);\n\n /**\n * 当前标绘的框架点数据\n */\n skeletons: PlotSkeleton[];\n\n /**\n * 初始化时创建贴地`Primitive`的函数,创建后的`Primitive`会作为配置项传入`render`中\n */\n initRender?: () => PlotRenderResult;\n\n /**\n * 当标绘数据变化时,会触发`render`回调,返回的数据会被添加到cesium中\n */\n render?: (context: PlotRenderContext) => PlotRenderResult | Promise<PlotRenderResult>;\n\n private static _record = new Map<string, PlotScheme>();\n\n /**\n * 标绘方案缓存。\n * 每次标绘时都会将`PlotScheme.type`作为键名缓存,\n * 后续可用过`PlotScheme.getCache(type)`获取完整的`PlotScheme`配置。\n */\n static getCacheTypes(): string[] {\n return [...this._record.keys()];\n }\n\n /**\n * 通过`PlotScheme.type`获取缓存中的`PlotScheme`配置。\n */\n static getCache(type: string): PlotScheme | undefined {\n return PlotScheme._record.get(type);\n }\n\n /**\n * 缓存标绘方案。\n */\n static setCache(scheme: PlotScheme): void {\n assertError(!scheme.type, '`scheme.type` is required');\n PlotScheme._record.set(scheme.type, scheme);\n }\n\n /**\n * 解析传入的maybeScheme,maybeScheme可能是一个完整的PlotScheme,也可能是缓存中的`PlotScheme.type`,并返回 PlotScheme 实例。\n * 若传入的是`PlotScheme.type`字符串,并且缓存中不存在该标绘方案,则抛出错误。\n */\n static resolve(maybeScheme: string | PlotScheme | PlotSchemeConstructorOptions): PlotScheme {\n if (typeof maybeScheme === 'string') {\n const _scheme = PlotScheme.getCache(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\n /**\n * 当前标绘所属于的时间节点\n */\n time?: JulianDate;\n\n /**\n * 采样点位数据\n */\n positions: Cartesian3[];\n\n /**\n * 附带的额外自定义数据\n */\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 * 标绘采样点数据是一个时间序列数据,包含时间、位置和附带的额外数据。\n * 具体用法可参考 [Cesium.SampledProperty](https://cesium.com/learn/cesiumjs/ref-doc/SampledProperty.html)\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: new JulianDate(0, 0),\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, positions: [] };\n Object.assign(result, {\n time: time?.clone(),\n positions: [],\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 * @param value 样本数据对象,包含时间、位置和导数信息\n */\n setSample(value: SampledPlotPackable<D>): void {\n const time = value.time?.clone() ?? this._times[0]!.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 /**\n * 判断两个property是否相等\n */\n equals(other?: Property): boolean {\n return other === this;\n }\n}\n","import type { Entity } from 'cesium';\nimport type { PlotSchemeConstructorOptions } from './PlotScheme';\nimport type { PlotSkeletonEntity } from './PlotSkeleton';\nimport type { SampledPlotPropertyConstructorOptions } from './SampledPlotProperty';\nimport { createGuid, Event } from 'cesium';\nimport { PlotScheme } from './PlotScheme';\nimport { SampledPlotProperty } from './SampledPlotProperty';\n\nexport type PlotDefinitionChangedCallback = (\n scope: PlotFeature,\n key: keyof PlotFeature,\n newValue: PlotFeature[typeof key],\n oldValue: PlotFeature[typeof key],\n) => void;\n\n/**\n * 标绘实例构造参数\n */\nexport interface PlotFeatureConstructorOptions {\n /**\n * 唯一标识符\n *\n * 未指定时将自动生成GUID\n */\n id?: string;\n\n /**\n * 标绘方案配置\n *\n * 支持直接传入字符串方案名称、方案实例或构造参数\n */\n scheme: string | PlotScheme | PlotSchemeConstructorOptions;\n\n /**\n * 采样属性配置\n *\n * 控制标绘对象的动态属性采样行为\n */\n sampled?: SampledPlotProperty | SampledPlotPropertyConstructorOptions;\n\n /**\n * 禁用状态标志\n *\n * @default false\n */\n disabled?: boolean;\n}\n\n/**\n * 标绘实例\n */\nexport class PlotFeature {\n constructor(options: PlotFeatureConstructorOptions) {\n const { id, disabled = false, sampled } = options;\n this._id = id || createGuid();\n this._scheme = PlotScheme.resolve(options.scheme);\n\n this._definitionChanged = new Event();\n this._defining = true;\n this._disabled = disabled;\n this._sampled = sampled instanceof SampledPlotProperty ? sampled : new SampledPlotProperty(sampled);\n this._sampled.definitionChanged.addEventListener(property => this._definitionChanged.raiseEvent(this, 'sampled', property, property), this);\n\n const init = this._scheme.initRender?.() ?? {};\n this._entities = [...init.entities ?? []];\n this._primitives = [...init.primitives ?? []];\n this._groundPrimitives = [...init.groundPrimitives ?? []];\n this._skeletons = [];\n }\n\n /**\n * @internal\n */\n private _id: string;\n\n get id(): string {\n return this._id;\n }\n\n /**\n * @internal\n */\n private _scheme: PlotScheme;\n\n get scheme(): PlotScheme {\n return this._scheme;\n }\n\n /**\n * @internal\n */\n private _definitionChanged: Event<PlotDefinitionChangedCallback>;\n\n get definitionChanged(): Event<PlotDefinitionChangedCallback> {\n return this._definitionChanged;\n }\n\n /**\n * @internal\n */\n private _defining: boolean;\n\n get defining(): boolean {\n return this._defining;\n }\n\n /**\n * @internal\n */\n static setDefining(plot: PlotFeature, value: boolean): void {\n if (plot._defining !== value) {\n plot._definitionChanged.raiseEvent(plot, 'defining', value, plot._defining);\n plot._defining = value;\n }\n }\n\n /**\n * @internal\n */\n private _disabled: boolean;\n\n /**\n * 获取禁用状态\n *\n * 当为 `true` 时,标绘实例将停止响应交互和更新;\n * 为 `false` 时恢复正常功能。\n */\n get disabled(): boolean {\n return this._disabled;\n }\n\n set disabled(value: string) {\n this.disabled = value;\n }\n\n /**\n * @internal\n */\n private _sampled: SampledPlotProperty;\n\n get sampled(): SampledPlotProperty {\n return this._sampled;\n }\n\n /**\n * @internal\n */\n private _entities: Entity[];\n\n get entities(): Entity[] {\n return this._entities;\n }\n\n set entities(value: Entity[]) {\n this._definitionChanged.raiseEvent(this, 'entities', value, this._entities);\n this._entities = value;\n }\n\n /**\n * @internal\n */\n private _primitives: any[];\n\n get primitives(): any[] {\n return this._primitives;\n }\n\n /**\n * @internal\n */\n set primitives(value: any[]) {\n this._definitionChanged.raiseEvent(this, 'primitives', value, this._primitives);\n this._primitives = value;\n }\n\n /**\n * @internal\n */\n private _groundPrimitives: any[];\n\n get groundPrimitives(): any[] {\n return this._groundPrimitives;\n }\n\n /**\n * @internal\n */\n set groundPrimitives(value: any[]) {\n this._definitionChanged.raiseEvent(this, 'groundPrimitives', value, this._groundPrimitives);\n this._groundPrimitives = value;\n }\n\n /**\n * @internal\n */\n private _skeletons: PlotSkeletonEntity[];\n\n get skeletons(): PlotSkeletonEntity[] {\n return this._skeletons;\n }\n\n /**\n * @internal\n */\n set skeletons(value: PlotSkeletonEntity[]) {\n this._definitionChanged.raiseEvent(this, 'skeletons', value, this._skeletons);\n this._skeletons = value;\n }\n}\n","import type { Cartesian3, ScreenSpaceEventHandler, Viewer } from 'cesium';\nimport type { Nullable } from 'vesium';\nimport type { CSSProperties, MaybeRef, VNode } from 'vue';\nimport type { PlotFeature } from './PlotFeature';\nimport type { SampledPlotPackable, SampledPlotProperty } from './SampledPlotProperty';\nimport { Entity } from 'cesium';\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 sampled: 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 event: ScreenSpaceEventHandler.PositionedEvent;\n}\n\nexport interface OnSkeletonDragOptions {\n viewer: Viewer;\n\n /***\n * 当前标绘属性数据\n */\n sampled: 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 event: 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 sampled: 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 disabled?: 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\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: PlotFeature;\n\n /**\n * @internal\n */\n declare skeleton: PlotSkeleton;\n\n /**\n * @internal\n */\n declare index: number;\n}\n","import type { Cartesian3, Entity, JulianDate } from 'cesium';\nimport type { ComputedRef, ShallowRef } from 'vue';\nimport type { PlotFeature } from './PlotFeature';\nimport { watchArray } from '@vueuse/core';\nimport { CustomDataSource, PrimitiveCollection, ScreenSpaceEventType } from 'cesium';\nimport { arrayDiff, canvasCoordToCartesian, useCesiumEventListener, useDataSource, useEntityScope, usePrimitive, usePrimitiveScope, useScreenSpaceEventHandler, useViewer } from 'vesium';\nimport { computed, nextTick, 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<PlotFeature[]>,\n current: ShallowRef<PlotFeature | 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 (event) => {\n mouseCartesian.value = canvasCoordToCartesian(event?.endPosition, viewer.value!.scene);\n },\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 flush: 'post',\n });\n\n useCesiumEventListener(\n () => plots.value.map(item => item.definitionChanged),\n (_scope, key, newValue, oldValue) => {\n if (key === 'entities') {\n const { added, removed } = arrayDiff(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 } = arrayDiff(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 } = arrayDiff(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 = async (plot: PlotFeature) => {\n await nextTick();\n const packable = plot.sampled.getValue(getCurrentTime());\n const mouse = plot.defining ? mouseCartesian.value : undefined;\n const result = await plot.scheme.render?.({\n packable,\n mouse,\n defining: plot.defining,\n previous: {\n entities: plot.entities,\n primitives: plot.primitives,\n groundPrimitives: plot.groundPrimitives,\n },\n getPositions() {\n const points = packable.positions;\n mouse && points.push(mouse);\n return points;\n },\n });\n\n plot.entities = result?.entities ?? [];\n plot.primitives = result?.primitives ?? [];\n plot.groundPrimitives = result?.groundPrimitives ?? [];\n };\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', 'sampled', '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 { JulianDate } from 'cesium';\nimport type { Nullable } from 'vesium';\nimport type { CSSProperties, ShallowRef } from 'vue';\nimport { promiseTimeout } from '@vueuse/core';\nimport { ScreenSpaceEventType } from 'cesium';\nimport { canvasCoordToCartesian, isFunction, useCesiumEventListener, useScreenSpaceEventHandler, useViewer } from 'vesium';\nimport { computed, ref, watch } from 'vue';\nimport { PlotFeature } from './PlotFeature';\n\nexport function useSampled(\n current: ShallowRef<PlotFeature | undefined>,\n getCurrentTime: () => JulianDate,\n): void {\n const viewer = useViewer();\n const doubleClicking = ref(false);\n\n const packable = computed(() => {\n return current.value?.sampled.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, sampled } = 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 sampled.setSample(packable.value);\n const completed = scheme.complete?.(packable.value);\n completed && PlotFeature.setDefining(current.value, 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.allowManualComplete?.(packable.value);\n completed && PlotFeature.setDefining(current.value, 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, sampled } = 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 sampled.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!) : 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 === 'sampled') {\n setDefiningCursorCss();\n }\n });\n watch(current, () => setDefiningCursorCss());\n}\n","import type { JulianDate } from 'cesium';\nimport type { ComputedRef, ShallowRef } from 'vue';\nimport type { PlotFeature } from './PlotFeature';\nimport type { PlotSkeleton } from './PlotSkeleton';\nimport { onKeyStroke, watchArray } from '@vueuse/core';\nimport { CustomDataSource } from 'cesium';\nimport { arrayDiff, isFunction, useCesiumEventListener, useDataSource, useEntityScope, useGraphicEvent, useViewer } from 'vesium';\nimport { nextTick, shallowRef, toValue, watch, watchEffect } from 'vue';\nimport { PlotAction, PlotSkeletonEntity } from './PlotSkeleton';\n\nexport function useSkeleton(\n plots: ComputedRef<PlotFeature[]>,\n current: ShallowRef<PlotFeature | 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 = (plot: PlotFeature, destroyed?: boolean) => {\n const oldEntities = plot.skeletons;\n const entities: PlotSkeletonEntity[] = [];\n\n if (destroyed || plot.disabled) {\n plot.skeletons = [];\n }\n else {\n const packable = plot.sampled.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 disabled = isFunction(skeleton.disabled) ? skeleton.disabled({ active, defining }) : skeleton.disabled;\n if (disabled) {\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: any = new PlotSkeletonEntity(options ?? {});\n if (entity) {\n merge.propertyNames.forEach((key: string) => {\n if (key !== 'id') {\n (entity as any)[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.skeletons = entities;\n };\n\n const graphicEvent = useGraphicEvent();\n\n watchEffect((onCleanup) => {\n // cursor 仅在不存在定义态的标绘时才生效\n const remove = graphicEvent.add('global', 'DRAG', ({ event, pick, dragging, lockCamera }) => {\n if (pick.id instanceof PlotSkeletonEntity && entityScope.scope.has(pick.id)) {\n const entity = pick.id as PlotSkeletonEntity;\n\n const plot = entity.plot as PlotFeature;\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.sampled.getValue(getCurrentTime());\n skeleton.onDrag?.({\n viewer: viewer.value!,\n sampled: plot.sampled,\n packable,\n active: current.value === plot,\n index,\n event,\n dragging,\n lockCamera,\n });\n }\n else {\n activeEntity.value = undefined;\n }\n }, {\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 });\n onCleanup(remove);\n });\n\n // 键盘控制当前激活的点位\n onKeyStroke((keyEvent) => {\n if (activeEntity.value) {\n const entity = activeEntity.value;\n const plot = entity.plot as PlotFeature;\n const skeleton = entity.skeleton as PlotSkeleton;\n const index = entity.index as number;\n const packable = plot.sampled.getValue(getCurrentTime());\n\n skeleton.onKeyPressed?.({\n viewer: viewer.value!,\n sampled: plot.sampled,\n packable,\n index,\n keyEvent,\n });\n }\n });\n\n watchEffect((onCleanup) => {\n const remove = graphicEvent.add('global', 'HOVER', ({ 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 onCleanup(remove);\n });\n\n watchEffect((onCleanup) => {\n const remove = graphicEvent.add('global', 'LEFT_CLICK', ({ event, 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 PlotFeature;\n const skeleton = entity.skeleton as PlotSkeleton;\n const index = entity.index as number;\n const packable = plot.sampled.getValue(getCurrentTime());\n\n skeleton.onLeftClick?.({\n viewer: viewer.value!,\n sampled: plot.sampled,\n packable: packable!,\n active: current.value === plot,\n defining: plot.defining,\n index,\n event,\n });\n }\n else {\n activeEntity.value = undefined;\n }\n });\n onCleanup(remove);\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(\n () => plots.value.map(plot => plot.definitionChanged),\n (plot, key, newValue, oldValue) => {\n if (['disabled', 'defining', 'scheme', 'sampled', 'time'].includes(key)) {\n nextTick(() => update(plot));\n }\n else if (key === 'skeletons') {\n const { added, removed } = arrayDiff(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 // 当前激活的标绘变化时,更新渲染\n watch(current, (plot, previous) => {\n plot && update(plot);\n previous && update(previous);\n });\n\n return {\n dataSource,\n };\n}\n","import type { ShallowRef } from 'vue';\nimport type { PlotFeatureConstructorOptions } from './PlotFeature';\nimport type { SampledPlotPackable } from './SampledPlotProperty';\nimport { JulianDate, ScreenSpaceEventType } from 'cesium';\nimport { pickHitGraphic, useCesiumEventListener, useScreenSpaceEventHandler, useViewer } from 'vesium';\nimport { computed, shallowReactive, shallowRef, watch } from 'vue';\nimport { PlotFeature } from './PlotFeature';\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: PlotFeature | PlotFeatureConstructorOptions) => Promise<PlotFeature>;\n\nexport interface UsePlotRetrun {\n\n time: ShallowRef<JulianDate | undefined>;\n\n data?: ShallowRef<PlotFeature[]>;\n\n current?: ShallowRef<PlotFeature | 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() || new JulianDate(0, 0);\n };\n\n const collection = shallowReactive(new Set<PlotFeature>());\n const plots = computed(() => Array.from(collection));\n const current = shallowRef<PlotFeature>();\n const packable = shallowRef<SampledPlotPackable>();\n\n useCesiumEventListener([\n () => current.value?.sampled.definitionChanged,\n ], () => {\n packable.value = current.value?.sampled.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\n const pick = viewer.value?.scene.pick(data.position.clone());\n // 点击到了骨架点则不处理\n if (pick?.id?.plot instanceof PlotFeature) {\n return;\n }\n\n if (!pick) {\n current.value = undefined;\n return;\n }\n\n current.value = plots.value.find(plot => pickHitGraphic(pick, [...plot.entities, ...plot.primitives, ...plot.groundPrimitives]));\n });\n\n let operateResolve: ((plot: PlotFeature) => void) | undefined;\n let operateReject: (() => void) | undefined;\n\n // 当前激活的标绘发生变动时,上一个标绘取消激活。若上一标绘仍处于定义态时,应立即强制完成,若无法完成则删除。\n watch(current, (plot, previous) => {\n if (previous) {\n if (previous.defining) {\n const packable = previous.sampled.getValue(getCurrentTime());\n const completed = previous.scheme.allowManualComplete?.(packable);\n if (completed) {\n PlotFeature.setDefining(previous, 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 PlotFeature ? plot : new PlotFeature(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: PlotFeature): 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","import type { PlotSkeleton } from '../usePlot';\nimport { Color } from 'cesium';\nimport { canvasCoordToCartesian, toCartesian3, toCartographic } from 'vesium';\nimport { PlotAction } from '../usePlot';\n\n/**\n * 绘制控制的框架点,拖拽时,将更新该控制点的实时位置\n */\nexport function control(): PlotSkeleton {\n return {\n disabled: ({ active }) => !active,\n cursor: 'pointer',\n dragCursor: 'crosshair',\n onDrag({ viewer, sampled, packable, event, index, lockCamera }) {\n lockCamera();\n const position = canvasCoordToCartesian(event.endPosition, viewer.scene);\n if (position) {\n const positions = [...packable.positions ?? []];\n positions[index] = position;\n sampled.setSample({\n time: packable.time,\n derivative: packable.derivative,\n positions,\n });\n }\n },\n\n onKeyPressed({ viewer, keyEvent, sampled, 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 sampled.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';\nimport { Cartesian3, Color } from 'cesium';\nimport { canvasCoordToCartesian } from 'vesium';\nimport { PlotAction } from '../usePlot';\n\n/**\n * 绘制封闭的间隔框架点,如多边形。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。\n */\nexport function interval(): PlotSkeleton {\n let dragIndex = -1;\n return {\n disabled: ({ 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, sampled, packable, event, index, lockCamera, dragging }) {\n lockCamera();\n\n const position = canvasCoordToCartesian(event.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 sampled.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';\nimport { Cartesian3, Color } from 'cesium';\nimport { canvasCoordToCartesian } from 'vesium';\nimport { PlotAction } from '../usePlot';\n\n/**\n * 绘制非封闭的间隔框架点,如线段。拖拽时,会在两点之间插入一个控制点,并持续拖拽该点。\n */\nexport function intervalNonclosed(): PlotSkeleton {\n let dragIndex = -1;\n return {\n disabled: ({ 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 const midpoints: Cartesian3[] = [];\n for (let i = 0; i < _positions.length - 1; i++) {\n midpoints.push(Cartesian3.midpoint(_positions[i], _positions[i + 1], new Cartesian3()));\n }\n return midpoints;\n },\n onDrag({ viewer, sampled, packable, event, index, lockCamera, dragging }) {\n lockCamera();\n const position = canvasCoordToCartesian(event.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 sampled.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';\nimport { Cartesian3, Color, HorizontalOrigin, Rectangle, VerticalOrigin } from 'cesium';\nimport { canvasCoordToCartesian, toCartesian3 } from 'vesium';\nimport { PlotAction } from '../usePlot';\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 disabled: ({ 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, sampled, packable, event, lockCamera, dragging }) {\n dragging && lockCamera();\n const startPosition = canvasCoordToCartesian(event.startPosition, viewer.scene);\n const endPosition = canvasCoordToCartesian(event.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 sampled.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 { Cartesian3, CoplanarPolygonGeometry, VertexFormat } from 'cesium';\n\n/**\n * 将多个边界点组成的面切割成多个三角形返回参数,为三角形三点的数组\n */\nexport type TesselateReturn = Array<[p0: Cartesian3, p1: Cartesian3, p2: Cartesian3]>;\n\n/**\n * 将多个边界点组成的面切割成多个三角形\n * @param positions\n */\nexport function tesselate(positions: Cartesian3[]): TesselateReturn {\n if (positions.length < 3) {\n throw new Error('positions must >= 3');\n }\n\n if (positions.length === 3) {\n return [[positions[0].clone(), positions[1].clone(), positions[2].clone()]];\n }\n\n const geometry = CoplanarPolygonGeometry.createGeometry(\n CoplanarPolygonGeometry.fromPositions({\n positions,\n vertexFormat: VertexFormat.POSITION_ONLY,\n }),\n )!;\n\n if (!geometry) {\n throw new Error('positions无法组成有效的geometry,检查点位是否错误');\n }\n const values = geometry.attributes.position!.values as number[];\n const indices = geometry.indices;\n const result: TesselateReturn = [];\n for (let i = 0; i < indices!.length; i += 3) {\n const a = Cartesian3.unpack(values, indices![i] * 3, new Cartesian3());\n const b = Cartesian3.unpack(values, indices![i + 1] * 3, new Cartesian3());\n const c = Cartesian3.unpack(values, indices![i + 2] * 3, new Cartesian3());\n result.push([a, b, c]);\n }\n return result;\n}\n","import type { Cartesian3, Scene, TerrainProvider } from 'cesium';\nimport { Cartographic, ClassificationType, Ellipsoid, sampleTerrainMostDetailed } from 'cesium';\n\nexport interface ClampToHeightMostDetailedByTilesetOrTerrainOptions {\n /**\n * 待贴地的点位\n */\n positions: Cartesian3[];\n\n scene: Scene;\n\n /**\n * 贴地类型\n * @defaultValue ClassificationType.BOTH\n */\n classificationType?: ClassificationType;\n\n /**\n * 地形数据\n * @defaultValue scene.terrainProvider\n */\n terrainProvider?: TerrainProvider;\n}\n\n/**\n * 将传入的点位列表进行贴地处理,若某个点位获取高程失败则将此进行克隆返回\n * @param options - 配置项\n */\nexport async function clampToHeightMostDetailedByTilesetOrTerrain(\n options: ClampToHeightMostDetailedByTilesetOrTerrainOptions,\n): Promise<Cartesian3[]> {\n const {\n positions,\n scene,\n classificationType = ClassificationType.BOTH,\n terrainProvider = scene.terrainProvider,\n } = options;\n\n const tileset = [ClassificationType.BOTH, ClassificationType.CESIUM_3D_TILE].includes(classificationType);\n const terrain = [ClassificationType.BOTH, ClassificationType.TERRAIN].includes(classificationType);\n\n const tilesetPromise = new Promise<Cartesian3[]>((resolve) => {\n if (tileset) {\n scene\n .clampToHeightMostDetailed(positions.map(e => e.clone()))\n .then(resolve)\n .catch((error) => {\n console.warn(error);\n resolve([]);\n });\n }\n else {\n resolve([]);\n }\n });\n const terrainPromise = new Promise<Cartographic[]>((resolve) => {\n if (terrain && terrainProvider) {\n sampleTerrainMostDetailed(\n terrainProvider,\n positions.map(e => Cartographic.fromCartesian(e)),\n )\n .then(e => resolve(e))\n .catch((error) => {\n console.warn(error);\n resolve([]);\n });\n }\n else {\n resolve([]);\n }\n });\n const [tilesetPositions, terrainPositions] = await Promise.all([tilesetPromise, terrainPromise]);\n const results: Cartesian3[] = [];\n\n positions.forEach((item, index) => {\n const position\n = tilesetPositions[index] || terrainPositions[index]\n ? Ellipsoid.WGS84.cartographicToCartesian(terrainPositions[index])\n : item.clone();\n results.push(position);\n });\n\n return results;\n}\n","import type { Scene, TerrainProvider } from 'cesium';\nimport { Cartesian3, ClassificationType, PerInstanceColorAppearance, PolygonGeometry, Rectangle } from 'cesium';\nimport { clampToHeightMostDetailedByTilesetOrTerrain } from './clampToGround';\n\n/**\n * 三角网配置\n */\nexport interface TriangleGridOptions {\n /**\n * 三角网粒度(点位间隔约为边界Rectangle生成的经纬最大值去除以密度)\n * @defaultValue 10\n */\n density: number;\n\n scene?: Scene;\n\n /**\n * 是否贴地\n */\n clampToGround?: boolean;\n\n /**\n * 贴地类型\n * @defaultValue ClassificationType.BOTH\n */\n classificationType?: ClassificationType;\n\n /**\n * 地形数据\n * @defaultValue scene.terrainProvider\n */\n terrainProvider?: TerrainProvider;\n}\n\n/**\n * 生成三角网返回参数,为三角形三点的数组\n */\nexport type TriangleGridReturn = Array<[p0: Cartesian3, p1: Cartesian3, p2: Cartesian3]>;\n\nfunction defaultOptions(original?: TriangleGridOptions): TriangleGridOptions {\n const clampToGround = original?.clampToGround ?? false;\n const classificationType = original?.classificationType ?? ClassificationType.BOTH;\n const density = Math.floor(original?.density ?? 10);\n return {\n scene: original?.scene,\n clampToGround,\n classificationType,\n terrainProvider: original?.terrainProvider,\n density,\n };\n}\n\n/**\n * 生成三角网数组\n * @param positions - 边界点数组\n * @param options - 配置项\n */\nexport async function triangleGrid(\n positions: Cartesian3[],\n options?: TriangleGridOptions,\n): Promise<TriangleGridReturn> {\n if (positions.length < 3) {\n throw new Error('positions must >= 3');\n }\n const { density, scene, clampToGround, classificationType, terrainProvider } = defaultOptions(options);\n\n if (density <= 0) {\n throw new Error('options.density must > 0');\n }\n\n // 取经纬最大值,根据此最大值计算粒度\n const bbox = Rectangle.fromCartesianArray(positions);\n const vertical = bbox.north - bbox.south;\n const horizontal = bbox.east - bbox.west;\n const max = Math.max(horizontal, vertical);\n const granularity = max / density; // 弧度粒度\n\n const polygonGeometry = PolygonGeometry.fromPositions({\n positions,\n vertexFormat: PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,\n granularity,\n });\n\n const geometry = PolygonGeometry.createGeometry(polygonGeometry)!;\n const values = geometry.attributes.position!.values as number[];\n if (!geometry || !values) {\n throw new Error('positions无法组成有效的geometry,检查点位是否错误');\n }\n const indices = geometry.indices;\n\n let cartesian3List: Cartesian3[] = [];\n for (let i = 0; i < indices!.length; i += 3) {\n const a = Cartesian3.unpack(values, indices![i] * 3, new Cartesian3());\n const b = Cartesian3.unpack(values, indices![i + 1] * 3, new Cartesian3());\n const c = Cartesian3.unpack(values, indices![i + 2] * 3, new Cartesian3());\n cartesian3List.push(a, b, c);\n }\n\n if (clampToGround) {\n if (!scene) {\n throw new Error('scene is required on `clampToGround == true`.');\n }\n const detaileds = await clampToHeightMostDetailedByTilesetOrTerrain({\n scene,\n terrainProvider,\n positions: cartesian3List,\n classificationType,\n });\n cartesian3List = detaileds;\n }\n const grid: TriangleGridReturn = [];\n while (cartesian3List?.length) {\n const [a, b, c] = cartesian3List.splice(0, 3);\n grid.push([a, b, c]);\n }\n\n return grid;\n}\n","import type { Scene, TerrainProvider } from 'cesium';\nimport { Cartesian3, ClassificationType } from 'cesium';\nimport { tesselate } from './tesselate';\nimport { triangleGrid } from './triangleGrid';\n\n/**\n * 计算三维坐标系下三角形面积\n * @param p0 - 三角形第一个点\n * @param p1 - 三角形第二个点\n * @param p2 - 三角形第三个点\n */\nfunction triangleArea(p0: Cartesian3, p1: Cartesian3, p2: Cartesian3) {\n const v0 = Cartesian3.subtract(p0, p1, new Cartesian3());\n const v1 = Cartesian3.subtract(p2, p1, new Cartesian3());\n const cross = Cartesian3.cross(v0, v1, v0);\n return Cartesian3.magnitude(cross) * 0.5;\n}\n\nexport interface AreaOptions {\n scene?: Scene;\n\n /**\n * 是否贴地\n */\n clampToGround?: boolean;\n\n /**\n * 贴地类型\n * @defaultValue ClassificationType.BOTH\n */\n classificationType?: ClassificationType;\n\n /**\n * 地形数据\n * @defaultValue scene.terrainProvider\n */\n terrainProvider?: TerrainProvider;\n\n /**\n * 插值密度\n * @defaultValue 10\n */\n density?: number;\n}\n\nfunction defaultOptions(original?: AreaOptions): AreaOptions {\n const clampToGround = original?.clampToGround ?? false;\n const classificationType = original?.classificationType ?? ClassificationType.BOTH;\n const density = Math.floor(original?.density ?? 10);\n return {\n scene: original?.scene,\n clampToGround,\n classificationType,\n terrainProvider: original?.terrainProvider,\n density,\n };\n}\n\n/**\n * 计算三维坐标系下图形面积\n * @param positions - 图形各点的笛卡尔数组\n */\nexport async function area(positions: Cartesian3[], options?: AreaOptions): Promise<number> {\n if (positions.length < 2) {\n throw new Error('positions.length must >= 2');\n }\n\n const { density, scene, clampToGround, classificationType, terrainProvider } = defaultOptions(options);\n if (density! <= 0) {\n throw new Error('options.density must > 0');\n }\n\n if (!clampToGround) {\n const triangles = tesselate(positions);\n return triangles.reduce((count, current) => (count += triangleArea(...current)), 0);\n }\n\n const triangles = await triangleGrid(positions, {\n density: density!,\n scene,\n clampToGround,\n classificationType,\n terrainProvider,\n });\n return triangles.reduce((count, current) => (count += triangleArea(...current)), 0);\n}\n","import type { ClassificationType, Scene, TerrainProvider } from 'cesium';\nimport { Cartesian3 } from 'cesium';\nimport { clampToHeightMostDetailedByTilesetOrTerrain } from './clampToGround';\n\nexport interface LerpArrayOptions {\n /**\n * 起点\n */\n start: Cartesian3;\n /**\n * 终点\n */\n end: Cartesian3;\n\n /**\n * 内插值数量\n */\n count: number;\n\n scene?: Scene;\n\n /**\n * 是否贴地\n */\n clampToGround?: boolean;\n\n /**\n * 贴地类型\n * @defaultValue ClassificationType.BOTH\n */\n classificationType?: ClassificationType;\n\n /**\n * 地形数据\n * @defaultValue scene.terrainProvider\n */\n terrainProvider?: TerrainProvider;\n}\n\n/**\n * 在起点和终点间进行插值, 返回的数组包括起点和终点,数组长度为 count+1\n */\nexport async function lerpArray(options: LerpArrayOptions): Promise<Cartesian3[]> {\n const { start, end, count, scene, clampToGround, classificationType, terrainProvider } = options;\n const result: Cartesian3[] = [];\n\n for (let i = 0; i < count; i++) {\n const position = Cartesian3.lerp(start, end, 1 / count, new Cartesian3());\n result.push(position);\n }\n result.push(end.clone());\n if (!clampToGround) {\n return result;\n }\n if (!scene) {\n throw new Error('scene is required on `clampToGround == true`.');\n }\n const detaileds = await clampToHeightMostDetailedByTilesetOrTerrain({\n scene,\n terrainProvider,\n positions: result,\n classificationType,\n });\n\n return detaileds;\n}\n","import type { Scene, TerrainProvider } from 'cesium';\nimport { Cartesian3, ClassificationType } from 'cesium';\nimport { lerpArray } from './lerpArray';\n\n/**\n * 计算多点位之间的距离入参\n */\nexport interface DistanceOptions {\n scene?: Scene;\n\n /**\n * 是否贴地\n */\n clampToGround?: boolean;\n\n /**\n * 贴地类型\n * @defaultValue ClassificationType.BOTH\n */\n classificationType?: ClassificationType;\n\n /**\n * 地形数据\n * @defaultValue scene.terrainProvider\n */\n terrainProvider?: TerrainProvider;\n\n /**\n * 插值密度\n * @defaultValue 50\n */\n density?: number;\n}\n\n/**\n * 计算多点位之间的距离返回参数\n */\nexport interface DistanceReturn {\n /**\n * 当前点位与下一点位之间的距离(米)\n */\n stages: number[];\n\n /**\n * 所有点位之间相加的总距离(米)\n */\n count: number;\n}\n\nfunction defaultOptions(original?: DistanceOptions): DistanceOptions {\n const clampToGround = original?.clampToGround ?? false;\n const classificationType = original?.classificationType ?? ClassificationType.BOTH;\n const density = Math.floor(original?.density ?? 50);\n return {\n scene: original?.scene,\n clampToGround,\n classificationType,\n terrainProvider: original?.terrainProvider,\n density,\n };\n}\n\n/**\n * 计算多点位之间的距离\n * @param positions\n */\nexport async function distance(positions: Cartesian3[], options?: DistanceOptions): Promise<DistanceReturn> {\n if (positions.length < 2) {\n throw new Error('positions.length must >= 2');\n }\n const _options = defaultOptions(options);\n\n const stages: number[] = [];\n let count = 0;\n positions.forEach((position, index) => {\n if (index !== positions.length - 1) {\n const next = positions[index + 1];\n const distance = Cartesian3.distance(position, next);\n stages.push(distance);\n count += distance;\n }\n });\n\n // 不贴地\n if (!_options.clampToGround) {\n return {\n stages,\n count,\n };\n }\n\n // 贴地\n const density = _options.density!;\n if (density <= 0) {\n throw new Error('options.density must > 0');\n }\n\n // 按每段长度占总长度的比例分配插值数量\n const densities = stages.map((stage) => {\n return Math.floor((stage / count) * density);\n });\n // 出现未分配的插值数量则分配给最后一项\n const diff = density - densities.reduce((count, current) => (count += current), 0);\n if (diff) {\n densities[densities.length - 1] += diff;\n }\n\n const positionListPromises = densities.map((density, i) => {\n return lerpArray({\n scene: _options.scene,\n start: positions[i],\n end: positions[i + 1],\n count: density,\n clampToGround: true,\n classificationType: _options.classificationType,\n terrainProvider: _options.terrainProvider,\n });\n });\n const detaileds = await Promise.all(positionListPromises);\n\n const stagePromises = detaileds.map(async (positions) => {\n const { count } = await distance(positions);\n return count;\n });\n\n const groundStages = await Promise.all(stagePromises);\n\n return {\n stages: groundStages,\n count: groundStages.reduce((count, current) => (count += current), 0),\n };\n}\n","import { CallbackProperty, Color, ConstantPositionProperty, ConstantProperty, Entity, PolygonHierarchy, Rectangle } from 'cesium';\nimport { toCartesian3 } from 'vesium';\nimport { control, interval } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\nimport { area } from './utils';\n\nexport const schemeMeasureArea = new PlotScheme({\n type: 'MeasureArea',\n allowManualComplete: packable => packable.positions!.length >= 3,\n skeletons: [\n control,\n interval,\n ],\n\n initRender() {\n return {\n entities: [\n new Entity({\n label: {\n font: '14pt',\n },\n polyline: {\n material: Color.YELLOW.withAlpha(0.5),\n },\n polygon: {\n material: Color.YELLOW.withAlpha(0.5),\n },\n }),\n ],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const { mouse, packable } = context;\n\n const positions = [...packable.positions ?? []];\n mouse && positions.push(mouse);\n\n if (positions.length === 2) {\n entity.position = undefined;\n entity.label!.text = undefined;\n entity.polygon!.hierarchy = undefined;\n entity.polyline!.positions = new CallbackProperty(() => positions, false);\n }\n else if (positions.length >= 3) {\n positions.push(positions[0]);\n entity.position = new ConstantPositionProperty(\n toCartesian3(Rectangle.center(Rectangle.fromCartesianArray(positions))),\n );\n entity.label!.text = new ConstantProperty('');\n\n area(positions).then((e) => {\n let text: string = '';\n if (e / 1000 / 1000 > 10) {\n text = `${(e / 1000 / 1000).toFixed(2)}km²`;\n }\n else {\n text = `${(+e).toFixed(2)}m²`;\n }\n entity.label!.text = new ConstantProperty(text);\n });\n entity.polyline!.positions = undefined;\n entity.polygon!.hierarchy = new CallbackProperty(() => {\n return positions.length >= 3 ? new PolygonHierarchy([...positions]) : undefined;\n }, false);\n }\n else {\n entity.position = undefined;\n entity.polygon!.hierarchy = undefined;\n entity.polyline!.positions = undefined;\n }\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackPositionProperty, CallbackProperty, Cartesian3, Color, Entity, LabelGraphics, PolylineGraphics } from 'cesium';\nimport { control } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\nimport { distance } from './utils';\n\nexport const schemeMeasureDistance = new PlotScheme({\n type: 'MeasureDistance',\n allowManualComplete: packable => packable.positions!.length >= 2,\n skeletons: [\n control,\n ],\n initRender() {\n return {\n entities: [\n new Entity({\n polyline: {\n width: 2,\n material: Color.YELLOW.withAlpha(0.5),\n },\n }),\n ],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const { mouse, packable, previous } = context;\n\n const entities = previous.entities!;\n\n const positions = [...packable.positions ?? []];\n mouse && positions.push(mouse);\n\n if (positions.length < 2) {\n return {\n entities,\n };\n }\n\n const pl = entities[0]!;\n\n pl.polyline ??= new PolylineGraphics();\n pl.polyline!.positions = new CallbackProperty(() => positions, false);\n\n positions.forEach((item, index) => {\n if (!entities[index + 1]) {\n entities[index + 1] = new Entity({\n position: item,\n label: new LabelGraphics({\n backgroundColor: Color.fromCssColorString('#fff'),\n font: '12pt sans-serif',\n\n }),\n });\n }\n });\n\n entities.splice(positions.length, entities.length - positions.length - 1);\n\n distance(positions).then(({ count, stages }) => {\n stages.forEach((stage, index) => {\n entities[index + 1]!.position = new CallbackPositionProperty(() => Cartesian3.midpoint(positions[index], positions[index + 1], new Cartesian3()), false);\n entities[index + 1]!.label!.text = new CallbackProperty(() => `${stage.toFixed(2)} m`, false);\n });\n if (stages.length > 1) {\n entities[entities.length - 1]!.position = new CallbackPositionProperty(() => positions[positions.length - 1], false);\n entities[entities.length - 1]!.label!.text = new CallbackProperty(() => `${count.toFixed(2)} m`, false);\n }\n else {\n entities[entities.length - 1]!.position = undefined;\n entities[entities.length - 1]!.label!.text = undefined;\n }\n });\n\n return {\n entities,\n };\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackPositionProperty, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * billboard标绘配置\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeBillboard = new PlotScheme({\n type: 'Billboard',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n initRender: () => {\n return { entities: [new Entity({ billboard: { image: '/favicon.svg', width: 32, height: 32 } })] };\n },\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities?.[0] ?? new Entity({ billboard: { } });\n const position = packable.positions?.[0] ?? mouse;\n entity.position = new CallbackPositionProperty(() => position, true);\n\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackPositionProperty, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * billboard-pin-builder标绘配置\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeBillboardPinBuilder = new PlotScheme({\n type: 'BillboardPinBuilder',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n initRender() {\n return {\n entities: [new Entity({ billboard: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const position = context.packable.positions[0] ?? context.mouse!;\n entity.position = new CallbackPositionProperty(() => position, true);\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackProperty, Cartesian3, ConstantPositionProperty, Entity } from 'cesium';\n\n/**\n * cylinder标绘配置\n */\nimport { toProperty, toPropertyValue } from 'vesium';\nimport { control, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeCylinder = new PlotScheme({\n type: 'Cylinder',\n complete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [\n new Entity({\n cylinder: {},\n }),\n ],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const positions = [...context.packable.positions];\n if (positions.length === 0) {\n return context.previous;\n }\n\n if (positions.length === 1) {\n const position = context.mouse;\n position && positions.push(position);\n }\n if (positions.length < 2) {\n return context.previous;\n }\n entity.position = new ConstantPositionProperty(positions[0]);\n const radius = Cartesian3.distance(positions[0], positions[1]);\n entity.cylinder!.bottomRadius = new CallbackProperty(() => radius, false);\n if (context.defining || !toPropertyValue(entity.cylinder!.length)) {\n entity.cylinder!.length = toProperty(radius * 2);\n }\n return {\n entities: [entity],\n };\n },\n});\n","/**\n * ellipse标绘配置 圆形扩散波\n */\nimport { CallbackProperty, Cartesian3, ConstantPositionProperty, Entity } from 'cesium';\nimport { control, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeEllipse = new PlotScheme({\n type: 'Ellipse',\n complete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ ellipse: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const positions = [...context.packable.positions];\n if (positions.length === 0) {\n return context.previous;\n }\n if (positions.length === 1) {\n const position = context.mouse;\n position && positions.push(position);\n }\n if (positions.length < 2) {\n return context.previous;\n }\n entity.position = new ConstantPositionProperty(positions[0]);\n const radius = Cartesian3.distance(positions[0], positions[1]);\n entity.ellipse!.semiMinorAxis = new CallbackProperty(() => radius || 1, false);\n entity.ellipse!.semiMajorAxis = entity.ellipse!.semiMinorAxis;\n\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackPositionProperty, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * 基础label标绘配置\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeLabel = new PlotScheme({\n type: 'Label',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n initRender() {\n return {\n entities: [new Entity({ label: { text: 'Label' } })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const position = context.packable.positions[0] ?? context.mouse!;\n entity.position = new CallbackPositionProperty(() => position, true);\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackPositionProperty, Color, Entity } from 'cesium';\nimport { moved } from '../skeleton';\n\n/**\n * 基础point标绘配置\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePoint = new PlotScheme({\n type: 'Point',\n complete: packable => packable.positions!.length >= 1,\n skeletons: [\n moved,\n ],\n initRender() {\n return {\n entities: [new Entity({ point: { pixelSize: 10, color: Color.RED } })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const position = context.packable.positions[0] ?? context.mouse!;\n entity.position = new CallbackPositionProperty(() => position, true);\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { control, interval, moved } from '../skeleton';\n/**\n * 基础Polygon标绘配置\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygon = new PlotScheme({\n type: 'Polygon',\n allowManualComplete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n interval,\n ],\n initRender: () => {\n return {\n entities: [new Entity({ polyline: {}, polygon: {} })],\n };\n },\n render(options) {\n const { mouse, packable } = options;\n const entity = options.previous.entities![0];\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","import { arc } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, moved } from '../skeleton';\n/**\n * 弓形\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArc = new PlotScheme({\n type: 'PolygonArc',\n complete: packable => packable.positions!.length >= 3,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n if (points.length < 3) {\n context.mouse && points.push(context.mouse.clone());\n }\n const coords = points.map(e => toCoord(e)!);\n if (coords.length < 3) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const positions = arc(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowAttackDirection } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowAttackDirection = new PlotScheme({\n type: 'PolygonArrowAttackDirection',\n allowManualComplete: packable => packable.positions!.length >= 3,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n context.mouse && points.push(context.mouse.clone());\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length < 3) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const positions = arrowAttackDirection(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowAttackDirectionTailed } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowAttackDirectionTailed = new PlotScheme({\n type: 'PolygonArrowAttackDirectionTailed',\n allowManualComplete: packable => packable.positions!.length >= 3,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n context.mouse && points.push(context.mouse.clone());\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length < 3) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const positions = arrowAttackDirectionTailed(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowClamped } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowClamped = new PlotScheme({\n type: 'PolygonArrowClamped',\n complete: packable => packable.positions!.length >= 5,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n if (points.length < 5) {\n const mouse = context.mouse;\n mouse && points.push(mouse.clone());\n }\n\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length >= 3) {\n const positions = arrowClamped(coords);\n const hierarchy = new PolygonHierarchy(positions.map(item => toCartesian3(item)!));\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n }\n else {\n entity.polygon!.hierarchy = undefined;\n }\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowStraight } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowStraight = new PlotScheme({\n type: 'PolygonArrowStraight',\n complete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n if (points.length < 2) {\n const mouse = context.mouse;\n mouse && points.push(mouse.clone());\n }\n\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length >= 2) {\n const positions = arrowStraight(coords);\n const hierarchy = new PolygonHierarchy(positions.map(item => toCartesian3(item)!));\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n }\n else {\n entity.polygon!.hierarchy = undefined;\n }\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowStraightSharp } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowStraightSharp = new PlotScheme({\n type: 'PolygonArrowStraightSharp',\n complete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n if (points.length < 2) {\n const mouse = context.mouse;\n mouse && points.push(mouse.clone());\n }\n\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length >= 2) {\n const positions = arrowStraightSharp(coords);\n const hierarchy = new PolygonHierarchy(positions.map(item => toCartesian3(item)!));\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n }\n else {\n entity.polygon!.hierarchy = undefined;\n }\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowUnitCombatOperation } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowUnitCombatOperation = new PlotScheme({\n type: 'PolygonArrowUnitCombatOperation',\n allowManualComplete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n context.mouse && points.push(context.mouse.clone());\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length < 2) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const positions = arrowUnitCombatOperation(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import { arrowUnitCombatOperationTailed } from '@vesium/geometry';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, interval, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonArrowUnitCombatOperationTailed = new PlotScheme({\n type: 'PolygonArrowUnitCombatOperationTailed',\n allowManualComplete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n interval,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n context.mouse && points.push(context.mouse.clone());\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length < 2) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const positions = arrowUnitCombatOperationTailed(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import { assemblingPlace } from '@vesium/geometry';\nimport { CallbackProperty, Cartographic, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCartographic, toCoord } from 'vesium';\nimport { control, interval, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonAssemblingPlace = new PlotScheme({\n type: 'PolygonAssemblingPlace',\n complete: packable => packable.positions!.length >= 3,\n skeletons: [\n moved,\n control,\n interval,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const points = context.packable.positions;\n context.mouse && points.push(context.mouse.clone());\n const coords = points.map(e => toCoord(e)!);\n\n if (coords.length < 2) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n\n if (coords.length === 2) {\n const c0 = toCartographic(coords[0])!;\n const c1 = toCartographic(coords[1])!;\n const latitude = c0.latitude;\n const height = c0.height;\n const longitude = c1.longitude - (c0.longitude - c1.longitude);\n coords.push(toCoord(new Cartographic(longitude, latitude, height))!);\n }\n const positions = assemblingPlace(coords).map(item => toCartesian3(item)!);\n const hierarchy = new PolygonHierarchy(positions);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","import * as turf from '@turf/turf';\nimport { CallbackProperty, Entity, PolygonHierarchy } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\n/**\n * polygon-smooth 标绘配置 平滑闭合面\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolygonSmooth = new PlotScheme({\n type: 'PolygonSmooth',\n allowManualComplete: packable => packable.positions!.length >= 3,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polygon: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const positions = context.packable.positions;\n const mousePosition = context.mouse;\n mousePosition && positions.push(mousePosition.clone());\n if (positions.length <= 2) {\n entity.polygon!.hierarchy = undefined;\n return context.previous;\n }\n const wgs84s = positions.map(e => toCoord(e)!);\n wgs84s.push(wgs84s[0]);\n const { features } = turf.polygonSmooth(turf.polygon([wgs84s]), {\n iterations: 3,\n });\n const cartesians = features[0].geometry.coordinates[0].map(item => toCartesian3(item as any)).filter(e => !!e);\n const hierarchy = new PolygonHierarchy(cartesians);\n entity.polygon!.hierarchy = new CallbackProperty(() => hierarchy, false);\n return {\n entities: [entity],\n };\n },\n});\n","/**\n * polyline\n */\nimport { CallbackProperty, Color, Entity } from 'cesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolyline = new PlotScheme({\n type: 'Polyline',\n allowManualComplete: packable => packable.positions!.length > 1,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polyline: { material: Color.RED, width: 2 } })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const positions = [...context.packable.positions];\n const mouse = context.mouse;\n mouse && positions.push(mouse.clone());\n const cache = positions.length >= 2 ? positions : [];\n entity.polyline!.positions = new CallbackProperty(() => cache, false);\n return {\n entities: [entity],\n };\n },\n});\n","import * as turf from '@turf/turf';\nimport { CallbackProperty, Color, Entity } from 'cesium';\nimport { toCartesian3, toCoord } from 'vesium';\nimport { control, intervalNonclosed, moved } from '../skeleton';\n/**\n * polyline-Curve\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemePolylineCurve = new PlotScheme({\n type: 'PolylineCurve',\n allowManualComplete: packable => packable.positions!.length > 1,\n skeletons: [\n moved,\n control,\n intervalNonclosed,\n ],\n initRender() {\n return {\n entities: [new Entity({ polyline: { material: Color.RED, width: 2 } })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n\n const positions = [...context.packable.positions];\n const mouse = context.mouse;\n mouse && positions.push(mouse.clone());\n if (positions.length < 2) {\n entity.polyline!.positions = undefined;\n return context.previous;\n }\n\n const coords = positions.map(position => toCoord(position)!);\n const { geometry: { coordinates } } = turf.bezierSpline(turf.lineString(coords));\n\n entity.polyline!.positions = new CallbackProperty(() => coordinates.map(toCartesian3), false);\n return {\n entities: [entity],\n };\n },\n});\n","import { CallbackProperty, Entity, Rectangle } from 'cesium';\nimport { control, moved } from '../skeleton';\n/**\n * rectangle\n */\nimport { PlotScheme } from '../usePlot';\n\nexport const PlotSchemeRectangle = new PlotScheme({\n type: 'Rectangle',\n complete: packable => packable.positions!.length >= 2,\n skeletons: [\n moved,\n control,\n ],\n initRender() {\n return {\n entities: [new Entity({ rectangle: {} })],\n };\n },\n render(context) {\n const entity = context.previous.entities![0]!;\n const positions = [...context.packable.positions];\n const mouse = context.mouse;\n mouse && positions.push(mouse.clone());\n if (positions.length < 2) {\n entity.rectangle!.coordinates = undefined;\n return context.previous;\n }\n const coordinates = Rectangle.fromCartesianArray(positions ?? []);\n entity.rectangle!.coordinates = new CallbackProperty(() => coordinates, false);\n return {\n entities: [entity],\n };\n },\n});\n"],"mappings":"k+CAiFA,IAAa,EAAb,MAAa,CAAW,CACtB,YAAY,EAAuC,CACjD,KAAK,KAAO,EAAQ,KACpB,KAAK,SAAW,EAAQ,SACxB,KAAK,oBAAsB,EAAQ,oBACnC,KAAK,eAAiB,EAAQ,gBAAkB,YAChD,KAAK,UAAY,EAAQ,WAAW,IAAI,GAAQ,GAAM,CAAC,EAAI,EAAE,CAC7D,KAAK,WAAa,EAAQ,WAC1B,KAAK,OAAS,EAAQ,OAMxB,KAMA,SAMA,oBAMA,eAKA,UAKA,WAKA,OAEA,OAAe,QAAU,IAAI,IAO7B,OAAO,eAA0B,CAC/B,MAAO,CAAC,GAAG,KAAK,QAAQ,MAAM,CAAC,CAMjC,OAAO,SAAS,EAAsC,CACpD,OAAO,EAAW,QAAQ,I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