UNPKG

vue-cesium

Version:
1 lines 7.62 kB
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/providers/amap/index.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2022-03-30 15:40:44\n * @LastEditTime: 2022-05-26 22:10:39\n * @LastEditors: zouyaoji\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\components\\providers\\amap\\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 { 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 AMapImageryProvider from './AMapImageryProvider'\n\nexport const amapImageryProviderProps = {\n url: {\n type: String,\n default: 'https://{domain}{s}.is.autonavi.com/appmaptile?lang={lang}&size=1&style={style}&scl={scl}&ltype={ltype}&x={x}&y={y}&z={z}'\n },\n subdomains: {\n type: Array as PropType<string[]>,\n default: () => ['01', '02', '03', '04']\n },\n domain: {\n type: String as PropType<'webrd' | 'webst'>,\n default: 'webst'\n },\n lang: {\n type: String as PropType<'zh_cn' | 'en'>,\n default: 'zh_cn'\n },\n mapStyle: {\n // 地图类型控制,6卫星图(st),7简图(st rd),8详图(不透明rd,透明图st)\n type: String as PropType<'6' | '7' | '8'>,\n default: '6'\n },\n scl: {\n // 尺寸控制,1=256,2=512\n type: String as PropType<'1' | '2'>,\n default: '1'\n },\n ltype: {\n // 线性控制,只对地图要素进行控制,没有文字注记,要素多少,是否透明\n // 纯道路 ltype=11 mapStyle=8\n // 纯地标 ltype=4 mapStyle=8\n // 道路标注 ltype=0 mapStyle=8\n type: String,\n default: '0'\n },\n ...credit,\n ...minimumLevel,\n ...maximumLevel,\n ...rectangle,\n ...tilingScheme,\n ...projectionTransforms\n}\nexport default defineComponent({\n name: 'VcImageryProviderAmap',\n props: amapImageryProviderProps,\n emits: providerEmits,\n setup(props, ctx) {\n // state\n // state\n const instance = getCurrentInstance() as VcComponentInternalInstance\n instance.cesiumClass = 'AMapImageryProvider'\n const providersState = useProviders(props, ctx, instance)\n\n if (undefined === providersState) {\n return\n }\n // methods\n instance.createCesiumObject = async () => {\n Cesium.AMapImageryProvider = Cesium.AMapImageryProvider || AMapImageryProvider\n if (providersState.unwatchFns.length === 0) {\n providersState.setPropsWatcher(true)\n }\n const options = providersState.transformProps(props)\n return new Cesium.AMapImageryProvider(options)\n }\n return () => createCommentVNode(kebabCase(instance.proxy?.$options.name || ''))\n }\n})\n\nexport interface VcImageryProviderAmapProps {\n /**\n * Specify the URL template.\n * Default value: https://{domain}{s}.is.autonavi.com/appmaptile?lang={lang}&size=1&style={style}&scl={scl}&ltype={ltype}&x={x}&y={y}&z={z}\n */\n url?: string\n /**\n * Specify the domain name.\n * Default value: webst\n */\n domain?: 'webrd' | 'webst'\n /**\n * Specify the service polling parameters.\n * Default value: ['01', '02', '03', '04']\n */\n subdomains?: string[]\n /**\n * Specify the language.\n * Default value: zh_cn\n */\n lang?: 'zh_cn' | 'en'\n /**\n * Specify the map style type of the amap service. '6': satellite image; '7': road map; '8': road map (with transparent background).\n * Default value: 6\n */\n mapStyle?: '6' | '7' | '8'\n /**\n * Specify size control parameters. '1': 256*256; '2': 512*512\n * Default value: 1\n */\n scl?: '1' | '2'\n /**\n * Specify the type parameter. '0': default; '4': only annotations; '8': only roads\n * Default value: 0\n */\n ltype?: string\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 VcImageryProviderAmap is loaded.\n */\n onBeforeLoad?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the VcImageryProviderAmap 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 VcImageryProviderAmap 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 VcImageryProviderAmapRef = VcComponentPublicInstance<VcImageryProviderAmapProps>\n"],"names":[],"mappings":";;;;;;;;;AAwBO,MAAM,wBAA2B,GAAA;AAAA,EACtC,GAAK,EAAA;AAAA,IACH,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,2HAAA;AAAA,GACX;AAAA,EACA,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,KAAA;AAAA,IACN,SAAS,MAAM,CAAC,IAAM,EAAA,IAAA,EAAM,MAAM,IAAI,CAAA;AAAA,GACxC;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,OAAA;AAAA,GACX;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,OAAA;AAAA,GACX;AAAA,EACA,QAAU,EAAA;AAAA;AAAA,IAER,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAA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