vue-cesium
Version:
Vue 3.x components for CesiumJS.
1 lines • 71.7 kB
Source Map (JSON)
{"version":3,"file":"use-drawing-polyline.mjs","sources":["../../../../../packages/composables/use-drawing/use-drawing-polyline.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2021-10-21 10:43:32\n * @LastEditTime: 2024-10-08 23:22:33\n * @LastEditors: zouyaoji 370681295@qq.com\n * @Description:\n * @FilePath: \\vue-cesium\\packages\\composables\\use-drawing\\use-drawing-polyline.ts\n */\nimport { VcPrimitive, VcPrimitiveGroundPolyline } from '@vue-cesium/components/primitives'\nimport { VcGeometryInstance } from '@vue-cesium/components/geometry-instance'\nimport { VcGeometryPolyline, VcGeometryGroundPolyline } from '@vue-cesium/components/geometries'\nimport { VcOverlayHtml } from '@vue-cesium/components/overlays'\nimport { VcCollectionLabel, VcCollectionPoint, VcCollectionPrimitive, VcLabelProps, VcPolygon } from '@vue-cesium/components/primitive-collections'\nimport { VcBtn, VcTooltip } from '@vue-cesium/components/ui'\nimport { useLocale } from '../use-locale'\nimport { DrawStatus, MeasureUnits } from '@vue-cesium/shared'\nimport {\n calculateAreaByPostions,\n compareCesiumVersion,\n getFirstIntersection,\n getGeodesicDistance,\n makeCartesian3Array\n} from '@vue-cesium/utils/cesium-helpers'\nimport type { VcPolylineDrawing } from '@vue-cesium/utils/drawing-types'\nimport type { VcComponentInternalInstance, VcDrawingProvider, VcReadyObject } from '@vue-cesium/utils/types'\nimport { reactive, VNode } from 'vue'\nimport { computed, getCurrentInstance, nextTick, ref, h } from 'vue'\nimport useCommon from '../use-common'\nimport useDrawingAction from './use-drawing-action'\nimport { VcAnalysesRef, VcDrawingsRef, VcMeasurementsRef } from '@vue-cesium/components'\nimport { platform } from '@vue-cesium/utils/platform'\n\nexport default function (props, ctx, cmpName: string) {\n const instance = getCurrentInstance() as VcComponentInternalInstance\n\n const commonState = useCommon(props, ctx, instance)\n if (commonState === void 0) {\n return\n }\n\n const { t } = useLocale()\n const $services = commonState.$services as VcDrawingProvider\n const { emit } = ctx\n\n const {\n drawingType,\n drawTip,\n drawTipOpts,\n drawStatus,\n canShowDrawTip,\n drawTipPosition,\n showEditor,\n editorPosition,\n mouseoverPoint,\n editingPoint,\n primitiveCollectionRef,\n editorType,\n onMouseoverPoints,\n onMouseoutPoints,\n onMouseenterEditor,\n onMouseleaveEditor,\n onPrimitiveCollectionReady,\n onVcCollectionPointReady,\n onVcCollectionLabelReady,\n onVcPrimitiveReady\n } = useDrawingAction(props, ctx, instance, cmpName, $services)\n\n let lastClickPosition: Cesium.Cartesian2\n let restorePosition\n const mouseDelta = 10\n\n const renderDatas = ref<Array<VcPolylineDrawing>>([])\n\n if (props.preRenderDatas && props.preRenderDatas.length) {\n props.preRenderDatas.forEach(preRenderData => {\n const polylineDrawing: VcPolylineDrawing = {\n show: true,\n positions: makeCartesian3Array(preRenderData) as Array<Cesium.Cartesian3>,\n tempPositions: [],\n drawStatus: DrawStatus.AfterDraw,\n loop: props.loop,\n distance: 0,\n area: 0,\n distances: [],\n labels: [],\n angles: [],\n\n polylineOpts: {},\n pointOpts: {},\n labelOpts: {},\n labelsOpts: {},\n primitiveOpts: {},\n polygonOpts: {}\n }\n\n renderDatas.value.push(polylineDrawing)\n })\n }\n\n const computedRenderDatas = computed<Array<VcPolylineDrawing>>(() => {\n const { Cartesian3, createGuid, defined, Math: CesiumMath } = Cesium\n const polylines: Array<VcPolylineDrawing> = []\n const { viewer } = $services\n const angleFormatter = props.angleFormatter || MeasureUnits.angleToString\n const distanceFormatter = props.distanceFormatter || MeasureUnits.distanceToString\n const areaFormatter = props.areaFormatter || MeasureUnits.areaToString\n\n renderDatas.value.forEach((polyline, index) => {\n const labels = reactive<Array<VcLabelProps>>([])\n const distances: number[] = []\n const angles: number[] = []\n let distance = 0\n const dashedLines: Array<{\n positions: Array<Cesium.Cartesian3>\n }> = []\n polyline.points = polyline.positions.map(v => {\n return {\n position: v\n }\n })\n const positions = polyline.positions.slice()\n if (cmpName === 'VcAnalysisSightline') {\n const observationPoint = positions.shift()\n const destinationPoints = positions\n observationPoint &&\n destinationPoints.forEach(destinationPoint => {\n const positionsNew: Array<Cesium.Cartesian3> = []\n positionsNew.push(observationPoint)\n\n const objectsToExclude = []\n const primitiveCollection: Array<Cesium.PrimitiveCollection> = (primitiveCollectionRef.value.cesiumObject as any)._primitives\n primitiveCollection.forEach(primitive => {\n if (primitive instanceof Cesium.PointPrimitiveCollection) {\n objectsToExclude.push(...primitive._pointPrimitives)\n }\n if (primitive instanceof Cesium.Primitive) {\n objectsToExclude.push(primitive)\n }\n })\n const intersection = getFirstIntersection(observationPoint, destinationPoint, $services.viewer, objectsToExclude)\n if (defined(intersection)) {\n positionsNew.push(intersection)\n }\n positionsNew.push(destinationPoint)\n let distance = 0\n const distances = []\n for (let i = 0; i < positionsNew.length - 1; i++) {\n const s = Cartesian3.distance(positionsNew[i], positionsNew[i + 1])\n distances.push(s)\n distance = distance + s\n }\n polylines.push({\n ...polyline,\n positions: positionsNew,\n distance,\n distances\n } as VcPolylineDrawing)\n })\n } else {\n props.loop && positions.length > 2 && positions.push(positions[0])\n for (let i = 0; i < positions.length - 1; i++) {\n let s = 0\n if (props.polylineOpts?.arcType === 0) {\n s = getGeodesicDistance(positions[i], positions[i + 1], $services.viewer.scene.globe.ellipsoid)\n } else {\n s = Cartesian3.distance(positions[i], positions[i + 1])\n }\n distances.push(s)\n distance = distance + s\n const polylineLabelsOpts = Object.assign({}, props.labelsOpts, polyline.labelsOpts)\n\n if (s > 0 && positions.length > 2 && props.showDistanceLabel) {\n labels.push({\n text: distanceFormatter(s, props.measureUnits?.distanceUnits, props.locale, props.decimals?.distance),\n position: Cartesian3.midpoint(positions[i], positions[i + 1], {} as any),\n id: createGuid(),\n ...polylineLabelsOpts\n })\n }\n if (positions.length > 2 && props.showAngleLabel) {\n if (i > 0 || props.loop) {\n const point0 = positions[i === 0 ? positions.length - 2 : i - 1]\n const point1 = positions[i]\n const point2 = positions[i + 1]\n const diffrence1 = Cartesian3.subtract(point0, point1, {} as any)\n const diffrence2 = Cartesian3.subtract(point2, point1, {} as any)\n let angle = 0\n if (!(Cartesian3.ZERO.equals(diffrence1) || Cartesian3.ZERO.equals(diffrence2))) {\n angle = Cartesian3.angleBetween(diffrence1, diffrence2)\n }\n angles.push(angle)\n labels.push({\n text: angleFormatter(angle, props.measureUnits?.angleUnits, props.locale, props.decimals?.angle),\n position: point1,\n id: createGuid(),\n ...polylineLabelsOpts\n })\n }\n }\n\n if (props.showDashedLine) {\n dashedLines.push({\n positions: [positions[i], getEndPostion(positions[i])]\n })\n\n if (i === positions.length - 2) {\n dashedLines.push({\n positions: [positions[i + 1], getEndPostion(positions[i + 1])]\n })\n }\n }\n }\n const area = calculateAreaByPostions(positions)\n\n const polylineLabelOpts = Object.assign({}, props.labelOpts, polyline.labelOpts)\n\n if (props.showLabel && positions.length) {\n if (cmpName.includes('Area')) {\n labels.push({\n text: areaFormatter(area, props.measureUnits?.areaUnits, props.locale, props.decimals?.area),\n position: positions[positions.length - 1],\n id: createGuid(),\n ...polylineLabelOpts\n })\n } else {\n labels.push({\n text: distanceFormatter(distance, props.measureUnits?.distanceUnits, props.locale, props.decimals?.distance),\n position: positions[positions.length - 1],\n id: createGuid(),\n ...polylineLabelOpts\n })\n }\n }\n\n polyline.positionsDegreesArray = polyline.positions.map(v => {\n const cart = Cesium.Cartographic.fromCartesian(v, viewer.scene.globe.ellipsoid)\n return [CesiumMath.toDegrees(cart.longitude), CesiumMath.toDegrees(cart.latitude), cart.height]\n })\n\n polylines.push({\n ...polyline,\n labels,\n distance,\n distances,\n area,\n angles,\n dashedLines\n } as VcPolylineDrawing)\n }\n })\n return polylines\n })\n\n // methods\n instance.mount = async () => {\n const { viewer } = $services\n props.autoUpdateLabelPosition && viewer.scene.preRender.addEventListener(updateLabelPosition)\n return true\n }\n instance.unmount = async () => {\n const { viewer } = $services\n props.autoUpdateLabelPosition && viewer.scene.preRender.removeEventListener(updateLabelPosition)\n return true\n }\n\n const getEndPostion = (position: Cesium.Cartesian3) => {\n const { defined, defaultValue } = Cesium\n const { viewer } = $services\n const scene = viewer.scene\n const globe = scene.globe\n const ellipsoid = scene.frameState.mapProjection.ellipsoid as Cesium.Ellipsoid\n const positionCartographic = ellipsoid.cartesianToCartographic(position)\n positionCartographic.height = defined(globe) ? defaultValue(globe.getHeight(positionCartographic), 0) : 0\n return ellipsoid.cartographicToCartesian(positionCartographic)\n }\n\n const updateLabelPosition = () => {\n computedRenderDatas.value.forEach((polyline, index) => {\n const positions = polyline.positions\n if (!(positions.length < 2)) {\n const { defined, SceneTransforms, Cartesian2, HorizontalOrigin } = Cesium\n const { viewer } = $services\n const scene = viewer.scene\n\n let startPosition = positions[0]\n const positionWindow = compareCesiumVersion(Cesium.VERSION, '1.121')\n ? SceneTransforms.worldToWindowCoordinates(scene, startPosition, {} as any)\n : SceneTransforms['wgs84ToWindowCoordinates'](scene, startPosition, {} as any)\n\n let startPositionWindow = defined(positionWindow)\n ? Cartesian2.clone(positionWindow, {} as any)\n : Cartesian2.fromElements(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, {} as any)\n let startY = startPositionWindow.y\n const primitiveCollection = primitiveCollectionRef.value?.cesiumObject as Cesium.PrimitiveCollection\n const labelCollection: Array<Cesium.LabelCollection> = (primitiveCollection as any)._primitives.filter(\n v => v instanceof Cesium.LabelCollection\n )\n const labels = labelCollection[index]._labels\n const labelTotalLength = labels[labels.length - 1]\n for (let i = 1; i < positions.length; i++) {\n const positionWindow = compareCesiumVersion(Cesium.VERSION, '1.121')\n ? SceneTransforms.worldToWindowCoordinates(scene, positions[i], {} as any)\n : SceneTransforms['wgs84ToWindowCoordinates'](scene, positions[i], {} as any)\n\n if (defined(positionWindow)) {\n const l = (startPositionWindow.y - positionWindow.y) / (positionWindow.x - startPositionWindow.x)\n if (labels[i - 1] !== labelTotalLength) {\n if (defined(labels[i - 1]?.horizontalOrigin)) {\n labels[i - 1].horizontalOrigin = 0 < l ? HorizontalOrigin.LEFT : HorizontalOrigin.RIGHT\n }\n }\n\n if (positionWindow.y < startY) {\n startY = positionWindow.y\n startPosition = positions[i]\n }\n\n startPositionWindow = Cartesian2.clone(positionWindow, startPositionWindow)\n }\n\n polyline.drawStatus === DrawStatus.AfterDraw && (labelTotalLength.position = startPosition)\n }\n }\n })\n }\n\n const startNew = () => {\n const polyline: VcPolylineDrawing = {\n show: false,\n positions: [],\n tempPositions: [],\n drawStatus: DrawStatus.BeforeDraw,\n loop: props.loop,\n distance: 0,\n area: 0,\n distances: [],\n labels: [],\n angles: [],\n\n polylineOpts: {},\n pointOpts: {},\n labelOpts: {},\n labelsOpts: {},\n primitiveOpts: {},\n polygonOpts: {}\n }\n\n if (cmpName === 'VcMeasurementHorizontal') {\n const { Cartesian3, Plane } = Cesium\n Object.assign(polyline, {\n dashedLines: [],\n heightPlane: new Plane(Cartesian3.UNIT_X, 0),\n heightPlaneCV: new Plane(Cartesian3.UNIT_X, 0),\n height: 0,\n firstMove: false,\n tempNextPos: new Cartesian3()\n })\n }\n\n drawStatus.value = DrawStatus.BeforeDraw\n renderDatas.value.push(polyline)\n canShowDrawTip.value = true\n drawTip.value = drawTipOpts.value.drawingTipStart\n }\n\n const stop = (removeLatest = true) => {\n if (removeLatest && drawStatus.value === DrawStatus.Drawing) {\n renderDatas.value.pop()\n }\n const index = editingPoint.value ? editingPoint.value._vcPolylineIndex : renderDatas.value.length - 1\n const polyline = renderDatas.value[index] as VcPolylineDrawing\n if (polyline) {\n polyline.positions = polyline.tempPositions\n polyline.drawStatus = DrawStatus.AfterDraw\n }\n\n drawStatus.value = DrawStatus.AfterDraw\n canShowDrawTip.value = false\n drawTipPosition.value = [0, 0, 0]\n }\n\n const handleMouseClick = (movement: Cesium.Cartesian2, options?) => {\n const { viewer, drawingFabInstance, getWorldPosition, selectedDrawingActionInstance } = $services\n const drawingFabInstanceVm = drawingFabInstance?.proxy as VcDrawingsRef | VcMeasurementsRef | VcAnalysesRef\n if (options.button === 2 && options.ctrl) {\n const drawingsOption = drawingFabInstanceVm.getDrawingActionInstance(drawingType)\n drawingFabInstanceVm.toggleAction(drawingsOption)\n nextTick(() => {\n emit(\n 'drawEvt',\n {\n name: drawingType,\n finished: true,\n windowPoistion: movement,\n type: 'cancel'\n },\n viewer\n )\n })\n return\n }\n\n if (drawStatus.value === DrawStatus.AfterDraw) {\n startNew()\n }\n\n const { defined, Cartesian2, Plane, Cartesian3 } = Cesium\n const index = editingPoint.value ? editingPoint.value._vcPolylineIndex : renderDatas.value.length - 1\n const polyline = renderDatas.value[index] as VcPolylineDrawing\n const tempPositions = polyline.tempPositions\n\n const pointIndex = editingPoint.value ? editingPoint.value._index : polyline.positions.length - 1\n\n if (options.button === 2 && editingPoint.value) {\n if (editorType.value === 'insert') {\n polyline.positions.splice(editingPoint.value._index, 1)\n } else {\n polyline.positions[editingPoint.value._index] = restorePosition\n }\n drawStatus.value = DrawStatus.AfterDraw\n polyline.drawStatus = DrawStatus.AfterDraw\n editingPoint.value = undefined\n drawTip.value = drawTipOpts.value.drawingTipStart\n drawingFabInstanceVm.editingActionName = undefined\n canShowDrawTip.value = defined(selectedDrawingActionInstance)\n nextTick(() => {\n emit(\n 'drawEvt',\n Object.assign(\n {\n index,\n pointIndex,\n name: drawingType,\n renderDatas,\n finished: true,\n windowPoistion: movement,\n type: 'cancel'\n },\n computedRenderDatas.value[index]\n ),\n viewer\n )\n })\n return\n }\n\n lastClickPosition = lastClickPosition || new Cesium.Cartesian2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY)\n\n if (Cartesian2.magnitude(Cartesian2.subtract(lastClickPosition, movement, {} as any)) < mouseDelta) {\n return\n }\n\n if (options.button === 2 && drawStatus.value === DrawStatus.Drawing) {\n if (tempPositions.length > 1) {\n tempPositions.pop()\n handleMouseMove(movement)\n }\n }\n\n if (options.button !== 0) {\n return\n }\n\n const scene = viewer.scene\n const position = getWorldPosition(scene, movement, {} as any)\n if (!defined(position)) {\n return\n }\n let finished = false\n let type = 'new'\n if (cmpName === 'VcMeasurementHorizontal') {\n if (editingPoint.value) {\n drawStatus.value = DrawStatus.AfterDraw\n editingPoint.value = undefined\n finished = true\n type = editorType.value\n drawTip.value = drawTipOpts.value.drawingTipStart\n } else if (tempPositions.length === 0) {\n const ellipsoid = scene.frameState.mapProjection.ellipsoid as Cesium.Ellipsoid\n tempPositions.push(position)\n polyline.positions = tempPositions\n polyline.heightPlane = Plane.fromPointNormal(position, ellipsoid.geodeticSurfaceNormal(position, {} as any), polyline.heightPlane)\n const positionCartographic = ellipsoid.cartesianToCartographic(position, {} as any)\n const positionProject = scene.mapProjection.project(positionCartographic, {} as any)\n const positionCV = Cartesian3.fromElements(positionProject.z, positionProject.x, positionProject.y, positionProject)\n polyline.heightPlaneCV = Plane.fromPointNormal(positionCV, Cartesian3.UNIT_X, polyline.heightPlaneCV)\n polyline.height = positionCartographic.height\n polyline.firstMove = true\n polyline.drawStatus = DrawStatus.Drawing\n polyline.show = true\n drawStatus.value = DrawStatus.Drawing\n } else {\n tempPositions.push(polyline.tempNextPos!)\n polyline.positions = tempPositions\n polyline.firstMove = true\n }\n drawTip.value = drawTipOpts.value.drawingTipEnd\n } else {\n if (editingPoint.value) {\n if (platform().hasTouch === true) {\n const position = getWorldPosition(scene, movement, {} as any)\n if (defined(position)) {\n const positions = polyline.positions\n positions.splice(editingPoint.value._index, 1, position)\n editingPoint.value.pixelSize = props.pointOpts?.pixelSize * 1.0\n }\n }\n\n drawStatus.value = DrawStatus.AfterDraw\n editingPoint.value = undefined\n finished = true\n type = editorType.value\n drawTip.value = drawTipOpts.value.drawingTipStart\n } else {\n tempPositions.push(position)\n\n polyline.positions = tempPositions\n polyline.show = true\n polyline.drawStatus = DrawStatus.Drawing\n drawStatus.value = DrawStatus.Drawing\n canShowDrawTip.value = true\n drawTip.value = drawTipOpts.value.drawingTipEnd\n }\n\n if (type !== 'new') {\n drawingFabInstanceVm.editingActionName = undefined\n canShowDrawTip.value = defined(selectedDrawingActionInstance)\n }\n }\n\n Cartesian2.clone(movement, lastClickPosition)\n\n nextTick(() => {\n emit(\n 'drawEvt',\n Object.assign(\n {\n index,\n pointIndex,\n name: drawingType,\n renderDatas,\n finished,\n position: cmpName === 'VcMeasurementHorizontal' ? polyline.positions[polyline.positions.length - 1] : position,\n windowPoistion: movement,\n type: type\n },\n computedRenderDatas.value[index]\n ),\n viewer\n )\n })\n }\n\n const handleMouseMove = (movement: Cesium.Cartesian2, options?) => {\n const { viewer, getWorldPosition } = $services\n const scene = viewer.scene\n const position = getWorldPosition(scene, movement, {} as any)\n const { defined } = Cesium\n\n if (!defined(position)) {\n return\n }\n\n drawTipPosition.value = position\n\n if (drawStatus.value !== DrawStatus.Drawing) {\n return\n }\n\n const index = editingPoint.value ? editingPoint.value._vcPolylineIndex : renderDatas.value.length - 1\n const polyline = renderDatas.value[index] as VcPolylineDrawing\n const pointIndex = editingPoint.value ? editingPoint.value._index : polyline.positions.length - 1\n\n let type = 'new'\n if (cmpName === 'VcMeasurementHorizontal') {\n const { SceneMode, IntersectionTests, Cartesian3 } = Cesium\n const ellipsoid = scene.frameState.mapProjection.ellipsoid as Cesium.Ellipsoid\n const positions = polyline.positions\n const cameraRay = scene.camera.getPickRay(movement)\n let intersectionPosition, unprojectPosition\n if (scene.mode === SceneMode.SCENE3D && polyline.heightPlane) {\n intersectionPosition = IntersectionTests.rayPlane(cameraRay, polyline.heightPlane)\n } else if (scene.mode === SceneMode.COLUMBUS_VIEW && polyline.heightPlaneCV) {\n intersectionPosition = IntersectionTests.rayPlane(cameraRay, polyline.heightPlaneCV)\n intersectionPosition = Cartesian3.fromElements(intersectionPosition.y, intersectionPosition.z, intersectionPosition.x, intersectionPosition)\n unprojectPosition = scene.mapProjection.unproject(intersectionPosition)\n intersectionPosition = ellipsoid.cartographicToCartesian(unprojectPosition)\n } else {\n intersectionPosition = scene.camera.pickEllipsoid(movement, ellipsoid)\n if (defined(intersectionPosition)) {\n const cartographicPosition = ellipsoid.cartesianToCartographic(intersectionPosition)\n cartographicPosition.height = polyline.height || 0\n intersectionPosition = ellipsoid.cartographicToCartesian(cartographicPosition, intersectionPosition)\n }\n }\n\n if (!defined(intersectionPosition)) {\n return\n }\n\n if (!polyline.firstMove && options?.shift) {\n const lastPosition = positions[positions.length - 2]\n const tempNextPos = polyline.tempNextPos\n const d1 = Cartesian3.subtract(tempNextPos!, lastPosition, {} as any)\n let d2 = Cartesian3.subtract(intersectionPosition, lastPosition, {} as any)\n d2 = Cartesian3.projectVector(d2, d1, d2)\n intersectionPosition = Cartesian3.add(lastPosition, d2, intersectionPosition)\n }\n\n if (editingPoint.value) {\n const positions = polyline.positions\n positions.splice(editingPoint.value._index, 1, intersectionPosition)\n type = editorType.value\n // drawTip.value = drawTipOpts.value.drawingTipStart\n } else {\n const tempPositions = polyline.tempPositions.slice()\n tempPositions.push(intersectionPosition)\n polyline.positions = tempPositions\n polyline.firstMove = false\n polyline.tempNextPos = Object.assign(intersectionPosition)\n drawTip.value = drawTipOpts.value.drawingTipEnd\n }\n } else {\n if (editingPoint.value) {\n const positions = polyline.positions\n positions.splice(editingPoint.value._index, 1, position)\n type = editorType.value\n } else {\n const tempPositions = polyline.tempPositions.slice()\n\n tempPositions.push(position)\n polyline.positions = tempPositions\n }\n }\n\n nextTick(() => {\n emit(\n 'drawEvt',\n Object.assign(\n {\n index,\n pointIndex,\n name: drawingType,\n renderDatas,\n finished: false,\n position: cmpName === 'VcMeasurementHorizontal' ? polyline.positions[polyline.positions.length - 1] : position,\n windowPoistion: movement,\n type\n },\n computedRenderDatas.value[index]\n ),\n viewer\n )\n })\n }\n\n const handleDoubleClick = movement => {\n const { drawingFabInstance, selectedDrawingActionInstance, viewer } = $services\n if (drawStatus.value === DrawStatus.Drawing) {\n const index = editingPoint.value ? editingPoint.value._vcPolylineIndex : renderDatas.value.length - 1\n const polyline = renderDatas.value[index] as VcPolylineDrawing\n const pointIndex = editingPoint.value ? editingPoint.value._index : polyline.positions.length - 1\n stop(false)\n drawTip.value = drawTipOpts.value.drawingTipStart\n\n nextTick(() => {\n emit(\n 'drawEvt',\n Object.assign(\n {\n index,\n pointIndex,\n name: drawingType,\n renderDatas,\n finished: true,\n position: polyline.positions[polyline.positions.length - 1],\n windowPoistion: movement,\n type: 'new'\n },\n computedRenderDatas.value[index]\n ),\n viewer\n )\n\n if (props.mode === 1) {\n const drawingFabInstanceVm = drawingFabInstance?.proxy as VcDrawingsRef | VcMeasurementsRef | VcAnalysesRef\n drawingFabInstanceVm.toggleAction(selectedDrawingActionInstance)\n }\n })\n }\n }\n\n const getPointIndexes = () => {\n let polylineIndex = editingPoint.value._vcPolylineIndex\n let pointIndex = editingPoint.value._index\n\n if (cmpName === 'VcAnalysisSightline') {\n for (let i = 0; i < renderDatas.value.length; i++) {\n const polyline = renderDatas.value[i]\n for (let j = 0; j < polyline.positions.length; j++) {\n const position = polyline.positions[j]\n if (editingPoint.value.position.equals(position)) {\n polylineIndex = i\n pointIndex = j\n }\n }\n }\n }\n\n return [polylineIndex, pointIndex]\n }\n\n const onEditorClick = e => {\n editorPosition.value = [0, 0, 0]\n showEditor.value = false\n\n if (!props.editable) {\n return\n }\n\n const { viewer, drawingFabInstance } = $services\n const drawingFabInstanceVm = drawingFabInstance?.proxy as VcDrawingsRef | VcMeasurementsRef | VcAnalysesRef\n editorType.value = e\n if (e === 'move') {\n drawTip.value = drawTipOpts.value.drawingTipEditing\n drawStatus.value = DrawStatus.Drawing\n editingPoint.value = mouseoverPoint.value\n canShowDrawTip.value = true\n const indexes = getPointIndexes()\n editingPoint.value._vcPolylineIndex = indexes[0]\n editingPoint.value._index = indexes[1]\n restorePosition = renderDatas.value[indexes[0]].positions[indexes[1]]\n drawingFabInstanceVm.editingActionName = drawingType\n } else if (e === 'insert') {\n const index = mouseoverPoint.value._vcPolylineIndex\n const polyline = renderDatas.value[index]\n polyline.positions.splice(mouseoverPoint.value._index, 0, mouseoverPoint.value.position)\n editingPoint.value = mouseoverPoint.value\n canShowDrawTip.value = true\n drawStatus.value = DrawStatus.Drawing\n drawTip.value = drawTipOpts.value.drawingTipEditing\n drawingFabInstanceVm.editingActionName = drawingType\n } else if (e === 'remove') {\n const index = mouseoverPoint.value._vcPolylineIndex\n const polyline = renderDatas.value[index]\n polyline.positions.length > 2 && polyline.positions.splice(mouseoverPoint.value._index, 1)\n } else if (e === 'removeAll') {\n const index = mouseoverPoint.value._vcPolylineIndex\n renderDatas.value.splice(index, 1)\n } else {\n const index = mouseoverPoint.value._vcPolylineIndex\n const polyline = renderDatas.value[index]\n props.editorOpts?.[e]?.callback?.(index, polyline)\n }\n\n emit(\n 'editorEvt',\n {\n type: e,\n renderDatas: renderDatas,\n name: drawingType,\n polylineIndex: mouseoverPoint.value._vcPolylineIndex,\n pointIndex: mouseoverPoint.value._index,\n point: mouseoverPoint.value\n },\n viewer\n )\n }\n\n const clear = () => {\n renderDatas.value = []\n stop()\n }\n\n // expose public methods\n const publicMethods = {\n computedRenderDatas,\n renderDatas,\n startNew,\n stop,\n clear,\n handleMouseClick,\n handleMouseMove,\n handleDoubleClick\n }\n Object.assign(instance.proxy, publicMethods)\n\n return () => {\n const { createGuid, Cartesian3 } = Cesium\n const children: Array<VNode> = []\n\n const points = []\n computedRenderDatas.value.forEach((polyline, index) => {\n const positions = polyline.positions.slice()\n if (positions.length > 1) {\n // polyline\n polyline.loop && positions.push(positions[0])\n const polylineOpts = Object.assign({}, props.polylineOpts, polyline.polylineOpts)\n props.clampToGround && delete polylineOpts.arcType\n const primitiveOpts = Object.assign({}, props.primitiveOpts, polyline.primitiveOpts)\n children.push(\n h(\n props.clampToGround ? VcPrimitiveGroundPolyline : VcPrimitive,\n {\n show: (polyline.show && primitiveOpts.show) || props.editable || polyline.drawStatus === DrawStatus.Drawing,\n ...primitiveOpts,\n onReady: (readyObject: VcReadyObject) => {\n primitiveOpts?.onReady?.(readyObject)\n ;(readyObject.cesiumObject as any)._vcPolylineIndex = index // for editor\n }\n },\n () =>\n h(\n VcGeometryInstance,\n {\n id: createGuid()\n },\n () =>\n h(props.clampToGround ? VcGeometryGroundPolyline : VcGeometryPolyline, {\n positions: positions,\n ...polylineOpts\n })\n )\n )\n )\n }\n // for VcMeasurementHorizontal\n const dashLineOpts = Object.assign({}, props.dashLineOpts, polyline.dashLineOpts)\n const dashLinePrimitiveOpts = Object.assign({}, props.dashLinePrimitiveOpts, polyline.dashLinePrimitiveOpts)\n polyline.dashedLines?.forEach(dashedLine => {\n children.push(\n h(\n VcPrimitive,\n {\n show: (polyline.show && props.dashLinePrimitiveOpts.show) || props.editable || polyline.drawStatus === DrawStatus.Drawing,\n ...dashLinePrimitiveOpts\n },\n () =>\n h(\n VcGeometryInstance,\n {\n id: createGuid()\n },\n () =>\n h(VcGeometryPolyline, {\n positions: dashedLine.positions,\n ...dashLineOpts\n })\n )\n )\n )\n })\n // points\n const polylinePointOpts = Object.assign({}, props.pointOpts, polyline.pointOpts)\n children.push(\n h(VcCollectionPoint, {\n enableMouseEvent: props.enableMouseEvent,\n show: polyline.show,\n points: polyline.points.map((point, subIndex) => {\n const position = point.position as Cesium.Cartesian3\n let includes = false\n for (let i = 0; i < points.length; i++) {\n // 通视分析 的观察点会加载很多个 在这儿过滤下只显示一个\n Cartesian3.equals(position, points[i]) && (includes = true)\n }\n const show =\n (props.pointOpts?.show || props.editable || polyline.drawStatus === DrawStatus.Drawing) &&\n (cmpName === 'VcAnalysisSightline' && polyline.positions.length === 3 ? subIndex !== 1 : true) &&\n !includes\n\n if (cmpName === 'VcAnalysisSightline') {\n points.push(position)\n }\n\n const pointOpts = Object.assign({}, polylinePointOpts, point)\n return {\n position,\n id: createGuid(),\n _vcPolylineIndex: index, // for editor\n show,\n ...pointOpts\n }\n }),\n onMouseover: onMouseoverPoints,\n onMouseout: onMouseoutPoints,\n onReady: onVcCollectionPointReady\n })\n )\n // labels\n children.push(\n h(VcCollectionLabel, {\n enableMouseEvent: props.enableMouseEvent,\n show: polyline.show,\n labels: polyline.labels,\n onReady: onVcCollectionLabelReady\n })\n )\n // polygon\n if (positions.length > 2 && (cmpName.includes('Polygon') || cmpName.includes('Area'))) {\n const polygonOpts = Object.assign({}, props.polygonOpts, polyline.polygonOpts)\n children.push(\n h(VcPolygon, {\n positions: positions,\n clampToGround: props.clampToGround,\n show: polyline.show && props.polygonOpts?.show,\n ...polygonOpts,\n onReady: (readyObject: VcReadyObject) => {\n onVcPrimitiveReady(readyObject)\n polygonOpts?.onReady?.(readyObject)\n ;(readyObject.cesiumObject as any)._vcPolylineIndex = index // for editor\n }\n })\n )\n }\n })\n\n if (props.drawtip?.show && canShowDrawTip.value) {\n const { viewer } = $services\n children.push(\n h(\n VcOverlayHtml,\n {\n position: drawTipPosition.value,\n pixelOffset: props.drawtip.pixelOffset,\n teleport: {\n to: viewer.container\n }\n },\n () =>\n h(\n 'div',\n {\n class: 'vc-drawtip vc-tooltip--style'\n },\n drawTip.value\n )\n )\n )\n }\n\n if (showEditor.value) {\n const buttons: Array<VNode> = []\n if (mouseoverPoint.value) {\n const editorOpts = props.editorOpts\n for (const key in editorOpts) {\n if (!Array.isArray(editorOpts[key]) && typeof editorOpts[key] !== 'number') {\n const opts = {\n ...editorOpts[key]\n }\n delete opts.color\n\n buttons.push(\n h(\n VcBtn,\n {\n style: { color: editorOpts[key].color, background: editorOpts[key].background },\n ...opts,\n onclick: onEditorClick.bind('polyline', key)\n },\n () =>\n h(\n VcTooltip,\n {\n ...editorOpts[key].tooltip\n },\n () => h('strong', null, editorOpts[key].tooltip?.tip || t(`vc.drawing.editor.${key}`))\n )\n )\n )\n }\n }\n }\n\n const { viewer } = $services\n children.push(\n h(\n VcOverlayHtml,\n {\n position: editorPosition.value,\n pixelOffset: props.editorOpts?.pixelOffset,\n teleport: {\n to: viewer.container\n },\n onMouseenter: onMouseenterEditor,\n onMouseleave: onMouseleaveEditor\n },\n () =>\n h(\n 'div',\n {\n class: 'vc-editor'\n },\n buttons\n )\n )\n )\n }\n return h(\n VcCollectionPrimitive,\n {\n ref: primitiveCollectionRef,\n show: props.show,\n onReady: onPrimitiveCollectionReady\n },\n () => children\n )\n }\n}\n"],"names":["distance","distances","positionWindow","position","positions","_a","_b"],"mappings":";;;;;;;;;;;;;;;;;AAgCyB,2BAAA,CAAA,KAAA,EAAO,KAAK,OAAiB,EAAA;AACpD,EAAA,MAAM,WAAW,kBAAmB,EAAA,CAAA;AAEpC,EAAA,MAAM,WAAc,GAAA,SAAA,CAAU,KAAO,EAAA,GAAA,EAAK,QAAQ,CAAA,CAAA;AAClD,EAAA,IAAI,gBAAgB,KAAQ,CAAA,EAAA;AAC1B,IAAA,OAAA;AAAA,GACF;AAEA,EAAM,MAAA,EAAE,CAAE,EAAA,GAAI,SAAU,EAAA,CAAA;AACxB,EAAA,MAAM,YAAY,WAAY,CAAA,SAAA,CAAA;AAC9B,EAAM,MAAA,EAAE,MAAS,GAAA,GAAA,CAAA;AAEjB,EAAM,MAAA;AAAA,IACJ,WAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,eAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA,YAAA;AAAA,IACA,sBAAA;AAAA,IACA,UAAA;AAAA,IACA,iBAAA;AAAA,IACA,gBAAA;AAAA,IACA,kBAAA;AAAA,IACA,kBAAA;AAAA,IACA,0BAAA;AAAA,IACA,wBAAA;AAAA,IACA,wBAAA;AAAA,IACA,kBAAA;AAAA,MACE,gBAAiB,CAAA,KAAA,EAAO,GAAK,EAAA,QAAA,EAAU,SAAS,SAAS,CAAA,CAAA;AAE7D,EAAI,IAAA,iBAAA,CAAA;AACJ,EAAI,IAAA,eAAA,CAAA;AACJ,EAAA,MAAM,UAAa,GAAA,EAAA,CAAA;AAEnB,EAAM,MAAA,WAAA,GAAc,GAA8B,CAAA,EAAE,CAAA,CAAA;AAEpD,EAAA,IAAI,KAAM,CAAA,cAAA,IAAkB,KAAM,CAAA,cAAA,CAAe,MAAQ,EA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