UNPKG

casc-cesium

Version:

Vue 3.x components for CesiumJS.

1 lines 6.43 kB
{"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 'casc-cesium-utils/types'\nimport { useProviders } from 'casc-cesium-composables'\nimport { url, credit, minimumLevel, maximumLevel, rectangle, tilingScheme, projectionTransforms } from 'casc-cesium-utils/cesium-props'\nimport { kebabCase } from 'casc-cesium-utils/util'\nimport { providerEmits } from 'casc-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":";;;;;;;;AAMY,MAAC,2BAA2B,GAAG;AAC3C,EAAE,GAAG,GAAG;AACR,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,KAAK;AACf,IAAI,OAAO,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAClC,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,QAAQ,EAAE,MAAM;AAClB,EAAE,GAAG,MAAM;AACX,EAAE,GAAG,YAAY;AACjB,EAAE,GAAG,YAAY;AACjB,EAAE,GAAG,SAAS;AACd,EAAE,GAAG,YAAY;AACjB,EAAE,GAAG,oBAAoB;AACzB,EAAE;AACF,6BAAe,eAAe,CAAC;AAC/B,EAAE,IAAI,EAAE,0BAA0B;AAClC,EAAE,KAAK,EAAE,2BAA2B;AACpC,EAAE,KAAK,EAAE,aAAa;AACtB,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE;AACpB,IAAI,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;AAC1C,IAAI,QAAQ,CAAC,WAAW,GAAG,wBAAwB,CAAC;AACpD,IAAI,MAAM,cAAc,GAAG,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC9D,IAAI,IAAI,cAAc,KAAK,KAAK,CAAC,EAAE;AACnC,MAAM,OAAO;AACb,KAAK;AACL,IAAI,QAAQ,CAAC,kBAAkB,GAAG,YAAY;AAC9C,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