casc-cesium
Version:
Vue 3.x components for CesiumJS.
1 lines • 7.69 kB
Source Map (JSON)
{"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 'casc-cesium-utils/types'\nimport { useProviders } from 'casc-cesium-composables'\nimport { 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 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}<ype={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}<ype={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":";;;;;;;;AAMY,MAAC,wBAAwB,GAAG;AACxC,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,2HAA2H;AACxI,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,KAAK;AACf,IAAI,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAC3C,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,I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