vue-cesium
Version:
Vue 3.x components for CesiumJS.
1 lines • 12.2 kB
Source Map (JSON)
{"version":3,"file":"defaultProps.mjs","sources":["../../../../../../packages/components/analyses/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:16:24\n * @LastEditors: XIAOLIJUN\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\components\\analyses\\src\\defaultProps.ts\n */\n\nimport {\n actionOptions,\n pointOptsDefault,\n polygonDrawingDefault,\n editorOptsDefault,\n polylineOptsDefault,\n segmentDrawingDefault,\n polylinePrimitiveOptsDefault\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 VcViewshedAnalysisOpts\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 type { VcFabProps } from '../../ui'\n\nconst sightlineAnalysisActionDefault: VcActionTooltipProps = Object.assign({}, actionOptions, {\n icon: 'vc-icons-analysis-sightline'\n})\n\nconst sightlineAnalysisDefault: VcDrawingOpts = Object.assign({}, segmentDrawingDefault, {\n polylineOpts: Object.assign({}, polylineOptsDefault, {\n colors: ['#51ff00', 'red']\n }),\n primitiveOpts: Object.assign({}, polylinePrimitiveOptsDefault, {\n appearance: {\n type: 'PolylineColorAppearance'\n },\n depthFailAppearance: {\n type: 'PolylineColorAppearance'\n }\n }),\n sightlineType: 'polyline' // segment polyline\n})\n\nconst viewshedAnalysisActionDefault: VcActionTooltipProps = Object.assign({}, actionOptions, {\n icon: 'vc-icons-analysis-viewshed'\n})\n\nconst viewshedAnalysisDefault: VcViewshedAnalysisOpts = Object.assign({}, polygonDrawingDefault, {\n pointOpts: Object.assign({}, pointOptsDefault, {\n show: false\n }),\n polylineOpts: Object.assign({}, polylineOptsDefault, {\n width: 15\n }),\n primitiveOpts: Object.assign({}, polylinePrimitiveOptsDefault, {\n show: false,\n appearance: {\n type: 'PolylineMaterialAppearance',\n options: {\n material: {\n fabric: {\n type: 'PolylineArrow',\n uniforms: {\n color: [255, 255, 0, 255]\n }\n }\n }\n }\n },\n depthFailAppearance: {\n type: 'PolylineMaterialAppearance',\n options: {\n material: {\n fabric: {\n type: 'PolylineArrow',\n uniforms: {\n color: [255, 255, 0, 255]\n }\n }\n }\n }\n }\n }),\n editorOpts: {\n pixelOffset: [16, -8],\n delay: 1000,\n hideDelay: 1000,\n move: Object.assign({}, editorOptsDefault),\n removeAll: Object.assign({}, editorOptsDefault, {\n icon: 'vc-icons-delete'\n })\n },\n viewshedOpts: {\n fovH: 90,\n fovV: 60,\n offsetHeight: 1.8,\n visibleColor: '#00ff00',\n invisibleColor: '#ff0000',\n showGridLine: true,\n faceColor: 'rgba(255,255,255,0.1)',\n lineColor: 'rgba(255,255,255,0.4)'\n }\n})\n\nconst fabActionOptsDefault: VcActionTooltipProps = Object.assign({}, {})\n\nconst mainFabDefault = Object.assign({}, actionOptions, {\n direction: 'right',\n icon: 'vc-icons-analysis-button',\n activeIcon: 'vc-icons-analysis-button',\n verticalActionsAlign: 'center',\n hideIcon: false,\n persistent: false,\n modelValue: true,\n hideActionOnClick: false,\n color: 'info'\n} as VcActionTooltipProps & VcFabProps)\n\nexport const analysisType = ['sightline', 'viewshed']\n\nconst isValidAnalysisType = (drawings: string[]) => {\n let flag = true\n drawings.forEach(drawing => {\n if (!analysisType.includes(drawing)) {\n console.error(`VueCesium: unknown analysis type: ${drawing}`)\n flag = false\n }\n })\n return flag\n}\n\nconst analysesProps = {\n ...useDrawingFabProps,\n analyses: {\n type: Array as PropType<Array<'sightline' | 'viewshed'>>,\n default: () => analysisType,\n validator: isValidAnalysisType\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 sightlineActionOpts: {\n type: Object as PropType<VcActionTooltipProps>,\n default: () => sightlineAnalysisActionDefault\n },\n sightlineAnalysisOpts: {\n type: Object as PropType<VcDrawingOpts>,\n default: () => sightlineAnalysisDefault\n },\n viewshedActionOpts: {\n type: Object as PropType<VcActionTooltipProps>,\n default: () => viewshedAnalysisActionDefault\n },\n viewshedAnalysisOpts: {\n type: Object as PropType<VcViewshedAnalysisOpts>,\n default: () => viewshedAnalysisDefault\n }\n}\nconst defaultOptions = getDefaultOptionByProps<VcAnalysesProps>(analysesProps)\n\nexport {\n analysesProps,\n defaultOptions,\n sightlineAnalysisActionDefault,\n sightlineAnalysisDefault,\n viewshedAnalysisActionDefault,\n viewshedAnalysisDefault,\n mainFabDefault\n}\n\nexport type VcAnalysesProps = {\n /**\n * Specify the position of the VcAnalyses.\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 VcAnalyses horizontally and vertically in pixels.\n * Default value: [0, 0]\n */\n offset?: [number, number]\n /**\n * Specify whether the analysis 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 analysis instances to load.\n * Default value: ['sightline', 'viewshed']\n */\n analyses?: Array<'sightline' | 'viewshed'>\n /**\n * Specify the color when the analysis instance is activated.\n * Default value: positive\n */\n activeColor?: string\n /**\n * Specify whether the analysis result can be edited.\n * Default value: false\n */\n editable?: boolean\n /**\n * Specify the style options of the floating action button of the VcAnalyses 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 sightline analysis action button.\n */\n sightlineActionOpts?: VcActionTooltipProps\n /**\n * Specify sightline analysis options.\n */\n sightlineAnalysisOpts?: VcDrawingOpts\n /**\n * Specify the style options of the viewshed analysis action button.\n */\n viewshedActionOpts?: VcActionTooltipProps\n /**\n * Specify viewshed analysis options.\n */\n viewshedAnalysisOpts?: VcViewshedAnalysisOpts\n /**\n * Specify the style options of the clear action button.\n */\n clearActionOpts?: VcActionTooltipProps\n /**\n * Triggers before the VcAnalyses is loaded.\n */\n onBeforeLoad?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the VcAnalyses 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 VcAnalyses is destroyed.\n */\n onDestroyed?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the analysis 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":";;;;;AAmCA,MAAM,8BAAuD,GAAA,MAAA,CAAO,MAAO,CAAA,IAAI,aA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