vue-cesium
Version:
Vue 3.x components for CesiumJS.
1 lines • 6.35 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/providers/tencent/index.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2022-03-31 11:14:52\n * @LastEditTime: 2022-05-13 14:26:33\n * @LastEditors: zouyaoji\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\components\\providers\\tencent\\index.ts\n */\nimport type { PropType } from 'vue'\nimport { createCommentVNode, defineComponent, getCurrentInstance } from 'vue'\nimport type {\n ProjectionTransforms,\n VcComponentInternalInstance,\n VcComponentPublicInstance,\n VcImageryProvider,\n VcReadyObject,\n VcRectangle\n} from '@vue-cesium/utils/types'\nimport { useProviders } from '@vue-cesium/composables'\nimport { url, credit, minimumLevel, maximumLevel, rectangle, tilingScheme, projectionTransforms } from '@vue-cesium/utils/cesium-props'\nimport { kebabCase } from '@vue-cesium/utils/util'\nimport { providerEmits } from '@vue-cesium/utils/emits'\nimport TencentImageryProvider from './TencentImageryProvider'\n\nexport const tencentImageryProviderProps = {\n ...url,\n subdomains: {\n type: Array as PropType<string[]>,\n default: () => ['1', '2', '3']\n },\n mapStyle: {\n type: String as PropType<'img' | 'terrain' | 'vector'>,\n default: 'vector'\n },\n styleId: {\n // 1: 经典; 2: 标签; 3: 标签; 4: 墨渊; 8: 白浅; 9: 灰色;\n type: String,\n default: '1'\n },\n protocol: String as PropType<'http' | 'https'>,\n ...credit,\n ...minimumLevel,\n ...maximumLevel,\n ...rectangle,\n ...tilingScheme,\n ...projectionTransforms\n}\nexport default defineComponent({\n name: 'VcImageryProviderTencent',\n props: tencentImageryProviderProps,\n emits: providerEmits,\n setup(props, ctx) {\n // state\n // state\n const instance = getCurrentInstance() as VcComponentInternalInstance\n instance.cesiumClass = 'TencentImageryProvider'\n const providersState = useProviders(props, ctx, instance)\n\n if (undefined === providersState) {\n return\n }\n // methods\n instance.createCesiumObject = async () => {\n Cesium.TencentImageryProvider = Cesium.TencentImageryProvider || TencentImageryProvider\n if (providersState.unwatchFns.length === 0) {\n providersState.setPropsWatcher(true)\n }\n const options = providersState.transformProps(props)\n return new Cesium.TencentImageryProvider(options)\n }\n return () => createCommentVNode(kebabCase(instance.proxy?.$options.name || ''))\n }\n})\n\nexport interface VcImageryProviderTencentProps {\n /**\n * Specify the URL template.\n */\n url?: string\n /**\n * Specify the service polling parameters.\n * Default value: ['1', '2', '3']\n */\n subdomains?: string[]\n /**\n * Specify the map style type of the tencent service.\n * Default value: vector\n */\n mapStyle?: 'img' | 'terrain' | 'vector'\n /**\n * Specify the map style type of the tencent service. Valid when mapStyle is vector. 1: Classic; 2: Label; 3: Label; 4: Mo Yuan; 8: White Light; 9: Gray\n * Default value: 1\n */\n styleId?: string\n /**\n * Specify protocol of service.\n */\n protocol?: 'https' | 'http'\n /**\n * A credit for the data source, which is displayed on the canvas.\n */\n credit?: string | Cesium.Credit\n /**\n * The minimum level-of-detail supported by the imagery provider.\n * Default value: 0\n */\n minimumLevel?: number\n /**\n * The maximum level-of-detail supported by the imagery provider.\n * Default value: 20\n */\n maximumLevel?: number\n /**\n * The rectangle, in radians, covered by the image.\n */\n rectangle?: VcRectangle\n /**\n * The tiling scheme specifying how the ellipsoidal surface is broken into tiles.\n */\n tilingScheme?: Cesium.GeographicTilingScheme | Cesium.WebMercatorTilingScheme\n /**\n * Specify the projection transformation parameters.\n */\n projectionTransforms?: false | ProjectionTransforms\n /**\n * Triggers before the VcImageryProviderTencent is loaded.\n */\n onBeforeLoad?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the VcImageryProviderTencent 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 VcImageryProviderTencent is destroyed.\n */\n onDestroyed?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the imagery provider encounters an asynchronous error.\n */\n errorEvent?: (evt: Cesium.TileProviderError) => void\n /**\n * Triggers when the provider is ready for use.\n */\n readyPromise?: (provider: VcImageryProvider, viewer: Cesium.Viewer, instance: VcComponentPublicInstance) => void\n}\n\nexport type VcImageryProviderTencentRef = VcComponentPublicInstance<VcImageryProviderTencentProps>\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,2BAA8B,GAAA;AAAA,EACzC,GAAG,GAAA;AAAA,EACH,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,KAAA;AAAA,IACN,OAAS,EAAA,MAAM,CAAC,GAAA,EAAK,KAAK,GAAG,CAAA;AAAA,GAC/B;AAAA,EACA,QAAU,EAAA;AAAA,IACR,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,QAAA;AAAA,GACX;AAAA,EACA,OAAS,EAAA;AAAA;AAAA,IAEP,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,GAAA;AAAA,GACX;AAAA,EACA,QAAU,EAAA,MAAA;AAAA,EACV,GAAG,MAAA;AAAA,EACH,GAAG,YAAA;AAAA,EACH,GAAG,YAAA;AAAA,EACH,GAAG,SAAA;AAAA,EACH,GAAG,YAAA;AAAA,EACH,GAAG,oBAAA;AACL,EAAA;AACA,6BAAe,eAAgB,CAAA;AAAA,EAC7B,IAAM,EAAA,0BAAA;AAAA,EACN,KAAO,EAAA,2BAAA;AAAA,EACP,KAAO,EAAA,aAAA;AAAA,EACP,KAAA,CAAM,OAAO,GAAK,EAAA;AAGhB,IAAA,MAAM,WAAW,kBAAmB,EAAA,CAAA;AACpC,IAAA,QAAA,CAAS,WAAc,GAAA,wBAAA,CAAA;AACvB,IAAA,MAAM,cAAiB,GAAA,YAAA,CAAa,KAAO,EAAA,GAAA,EAAK,QAAQ,CAAA,CAAA;AAExD,IAAA,IAAI,WAAc,cAAgB,EAAA;AAChC,MAAA,OAAA;AAAA,KACF;AAEA,IAAA,QAAA,CAAS,qBAAqB,YAAY;AACxC,MAAO,MAAA,CAAA,sBAAA,GAAyB,OAAO,sBAA0B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