vue-cesium
Version:
Vue 3.x components for CesiumJS.
1 lines • 13.6 kB
Source Map (JSON)
{"version":3,"file":"defaultProps.mjs","sources":["../../../../../../packages/components/drawings/src/defaultProps.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2021-10-18 10:40:15\n * @LastEditTime: 2023-02-09 18:11:26\n * @LastEditors: XIAOLIJUN\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\components\\drawings\\src\\defaultProps.ts\n */\n\nimport {\n actionOptions,\n billboardOptsDefault,\n circleDrawingActionDefault,\n circleDrawingDefault,\n labelOptsDefault,\n pointDrawingDefault,\n pointOptsDefault,\n polygonDrawingDefault,\n polylineDrawingDefault,\n rectangleDrawingDefault,\n regularDrawingActionDefault,\n regularDrawingDefault\n} from '@vue-cesium/composables/use-drawing/defaultOpts'\nimport { useDrawingFabProps } from '@vue-cesium/composables/use-drawing/props'\nimport {\n VcDrawingActiveEvt,\n VcDrawingDrawEvt,\n VcDrawingEditorEvt,\n VcDrawingMouseEvt,\n VcDrawingOpts,\n VcPointDrawing,\n VcPolylineDrawing,\n VcSegmentDrawing\n} from '@vue-cesium/utils/drawing-types'\nimport type { VcActionTooltipProps, VcComponentInternalInstance, VcReadyObject } from '@vue-cesium/utils/types'\nimport { getDefaultOptionByProps } from '@vue-cesium/utils/util'\nimport type { PropType } from 'vue'\nimport { VcFabProps } from '../../ui'\n\nconst pointDrawingActionDefault: VcActionTooltipProps = Object.assign({}, actionOptions, {\n icon: 'vc-icons-drawing-point'\n})\n\nconst polylineDrawingActionDefault: VcActionTooltipProps = Object.assign({}, actionOptions, {\n icon: 'vc-icons-drawing-polyline'\n})\n\nconst polygonDrawingActionDefault: VcActionTooltipProps = Object.assign({}, actionOptions, {\n icon: 'vc-icons-drawing-polygon'\n})\n\nconst rectangleDrawingActionDefault: VcActionTooltipProps = Object.assign({}, actionOptions, {\n icon: 'vc-icons-drawing-rectangle'\n})\n\nconst pinDrawingActionDefault: VcActionTooltipProps = Object.assign({}, actionOptions, {\n icon: 'vc-icons-drawing-pin'\n})\n\nconst pinDrawingDefault: VcDrawingOpts = Object.assign({}, pointDrawingDefault, {\n pointOpts: Object.assign({}, pointOptsDefault, {\n show: false\n }),\n billboardOpts: billboardOptsDefault,\n labelOpts: Object.assign({}, labelOptsDefault, {\n pixelOffset: [0, -30],\n verticalOrigin: 1\n }),\n showLabel: true\n})\n\nconst fabActionOptsDefault: VcActionTooltipProps = Object.assign({}, {})\n\nconst mainFabDefault = Object.assign({}, actionOptions, {\n direction: 'right',\n icon: 'vc-icons-drawing-button',\n activeIcon: 'vc-icons-drawing-button',\n verticalActionsAlign: 'center',\n hideIcon: false,\n persistent: false,\n modelValue: true,\n hideActionOnClick: false,\n color: 'info'\n} as VcFabProps)\n\nexport const drawingType = ['pin', 'point', 'polyline', 'polygon', 'rectangle', 'regular', 'circle']\n\nconst isValidDrawingType = (drawings: string[]) => {\n let flag = true\n drawings.forEach(drawing => {\n if (!drawingType.includes(drawing)) {\n console.error(`VueCesium: unknown drawing type: ${drawing}`)\n flag = false\n }\n })\n return flag\n}\n\nconst drawingsProps = {\n ...useDrawingFabProps,\n drawings: {\n type: Array as PropType<Array<'pin' | 'point' | 'polyline' | 'polygon' | 'rectangle' | 'regular' | 'circle'>>,\n default: () => drawingType,\n validator: isValidDrawingType\n },\n mainFabOpts: {\n type: Object as PropType<VcActionTooltipProps & VcFabProps>,\n default: () => mainFabDefault\n },\n fabActionOpts: {\n type: Object as PropType<VcActionTooltipProps>,\n default: () => fabActionOptsDefault\n },\n pinActionOpts: {\n type: Object as PropType<VcActionTooltipProps>,\n default: () => pinDrawingActionDefault\n },\n pinDrawingOpts: {\n type: Object as PropType<VcDrawingOpts>,\n default: () => pinDrawingDefault\n },\n pointActionOpts: {\n type: Object as PropType<VcActionTooltipProps>,\n default: () => pointDrawingActionDefault\n },\n pointDrawingOpts: {\n type: Object as PropType<VcDrawingOpts>,\n default: () => pointDrawingDefault\n },\n polylineActionOpts: {\n type: Object as PropType<VcActionTooltipProps>,\n default: () => polylineDrawingActionDefault\n },\n polylineDrawingOpts: {\n type: Object as PropType<VcDrawingOpts>,\n default: () => polylineDrawingDefault\n },\n polygonActionOpts: {\n type: Object as PropType<VcActionTooltipProps>,\n default: () => polygonDrawingActionDefault\n },\n polygonDrawingOpts: {\n type: Object as PropType<VcDrawingOpts>,\n default: () => polygonDrawingDefault\n },\n rectangleActionOpts: {\n type: Object as PropType<VcActionTooltipProps>,\n default: () => rectangleDrawingActionDefault\n },\n rectangleDrawingOpts: {\n type: Object as PropType<VcDrawingOpts>,\n default: () => rectangleDrawingDefault\n },\n circleActionOpts: {\n type: Object as PropType<VcActionTooltipProps>,\n default: () => circleDrawingActionDefault\n },\n circleDrawingOpts: {\n type: Object as PropType<VcDrawingOpts>,\n default: () => circleDrawingDefault\n },\n regularActionOpts: {\n type: Object as PropType<VcActionTooltipProps>,\n default: () => regularDrawingActionDefault\n },\n regularDrawingOpts: {\n type: Object as PropType<VcDrawingOpts>,\n default: () => regularDrawingDefault\n }\n}\n\nconst defaultOptions = getDefaultOptionByProps<VcDrawingsProps>(drawingsProps)\n\nexport {\n drawingsProps,\n defaultOptions,\n pointDrawingActionDefault,\n polylineDrawingActionDefault,\n polygonDrawingActionDefault,\n rectangleDrawingActionDefault,\n pinDrawingActionDefault,\n pinDrawingDefault,\n mainFabDefault\n}\n\nexport type VcDrawingsProps = {\n /**\n * Specify the position of the VcDrawings.\n * Default value: bottom-left\n */\n position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top' | 'right' | 'bottom' | 'left'\n /**\n * An array of two numbers to offset the VcDrawings horizontally and vertically in pixels.\n * Default value: [0, 0]\n */\n offset?: [number, number]\n /**\n * Specify whether the drawing result is visible.\n * Default value: true\n */\n show?: boolean\n /**\n * Specify the interactive drawing mode, 0 means continuous drawing, and 1 means drawing ends once.\n * Default value: 1\n */\n mode?: number\n /**\n * Specify which drawing instances to load.\n * Default value: ['pin', 'point', 'polyline', 'polygon', 'rectangle', 'regular', 'circle']\n */\n drawings?: Array<'pin' | 'point' | 'polyline' | 'polygon' | 'rectangle' | 'regular' | 'circle'>\n /**\n * Specify the color when the drawing instance is activated.\n * Default value: positive\n */\n activeColor?: string\n /**\n * Specify whether the drawing result can be edited.\n * Default value: false\n */\n editable?: boolean\n /**\n * Specify whether the drawing result object is attached to the ground or 3dtiles. Only polyline and polygon objects work.\n * Default value: false\n */\n clampToGround?: boolean\n /**\n * Specify the style options of the floating action button of the VcMeasurements component.\n */\n mainFabOpts?: VcActionTooltipProps & VcFabProps\n /**\n * Style options for other action buttons.\n */\n fabActionOpts?: VcActionTooltipProps\n /**\n * Specify the style options of the pin drawing action button.\n */\n pinActionOpts?: VcActionTooltipProps\n /**\n * Specify pin drawing options.\n */\n pinDrawingOpts?: VcDrawingOpts\n /**\n * Specify the style options of the point drawing action button.\n */\n pointActionOpts?: VcActionTooltipProps\n /**\n * Specify point drawing options.\n */\n pointDrawingOpts?: VcDrawingOpts\n /**\n * Specify the style options of the polyline drawing action button.\n */\n polylineActionOpts?: VcActionTooltipProps\n /**\n * Specify polyline drawing options.\n */\n polylineDrawingOpts?: VcDrawingOpts\n /**\n * Specify the style options of the polygon drawing action button.\n */\n polygonActionOpts?: VcActionTooltipProps\n /**\n * Specify polygon drawing options.\n */\n polygonDrawingOpts?: VcDrawingOpts\n /**\n * Specify the style options of the rectangle drawing action button.\n */\n rectangleActionOpts?: VcActionTooltipProps\n /**\n * Specify rectangle drawing options.\n */\n rectangleDrawingOpts?: VcDrawingOpts\n /**\n * Specify the style options of the circle drawing action button.\n */\n circleActionOpts?: VcActionTooltipProps\n /**\n * Specify circle drawing options.\n */\n circleDrawingOpts?: VcDrawingOpts\n /**\n * Specify the style options of the regular drawing action button.\n */\n regularActionOpts?: VcActionTooltipProps\n /**\n * Specify regular drawing options.\n */\n regularDrawingOpts?: VcDrawingOpts\n /**\n * Specify the style options of the clear action button.\n */\n clearActionOpts?: VcActionTooltipProps\n /**\n * Triggers before the VcDrawings is loaded.\n */\n onBeforeLoad?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the VcDrawings is successfully loaded.\n */\n onReady?: (readyObject: VcReadyObject) => void\n /**\n * Triggers when the component load failed.\n */\n onUnready?: (e: any) => void\n /**\n * Triggers when the VcDrawings is destroyed.\n */\n onDestroyed?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the measurement action is actived.\n */\n onActiveEvt?: (evt: VcDrawingActiveEvt, viewer: Cesium.Viewer) => void\n /**\n * \tTriggers when drawing.\n */\n onDrawEvt?: (evt: VcDrawingDrawEvt<VcPolylineDrawing | VcSegmentDrawing | VcPointDrawing>, viewer: Cesium.Viewer) => void\n /**\n * Triggers when the editor button is clicked.\n */\n onEditorEvt?: (evt: VcDrawingEditorEvt, viewer: Cesium.Viewer) => void\n /**\n * Triggers when the mouse is over or out on the drawing point.\n */\n onMouseEvt?: (evt: VcDrawingMouseEvt, viewer: Cesium.Viewer) => void\n /**\n * Triggers when the floating button is expanded or collapsed.\n */\n onFabUpdated?: (value: boolean) => void\n /**\n * Triggers when the clear button is clicked.\n */\n onClearEvt?: (\n evt: {\n type: 'clear'\n option: VcActionTooltipProps\n },\n viewer: Cesium.Viewer\n ) => void\n}\n"],"names":[],"mappings":";;;;;AAuCA,MAAM,yBAAkD,GAAA,MAAA,CAAO,MAAO,CAAA,IAAI,aAAe,EAAA;AAAA,EACvF,IAAM,EAAA,wBAAA;AACR,CAAC,EAAA;AAED,MAAM,4BAAqD,GAAA,MAAA,CAAO,MAAO,CAAA,IAAI,aAAe,EAAA;AAAA,EAC1F,IAAM,EAAA,2BAAA;AACR,CAAC,EAAA;AAED,MAAM,2BAAoD,GAAA,MAAA,CAAO,MAAO,CAAA,IAAI,aAAe,EAAA;AAAA,EACzF,IAAM,EAAA,0BAAA;AACR,CAAC,EAAA;AAED,MAAM,6BAAsD,GAAA,MAAA,CAAO,MAAO,CAAA,IAAI,aAAe,EAAA;AAAA,EAC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