{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/providers/supermap/index.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2021-09-16 09:28:13\n * @LastEditTime: 2022-04-08 13:44:46\n * @LastEditors: zouyaoji\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\components\\providers\\supermap\\index.ts\n */\nimport type { PropType } from 'vue'\nimport { createCommentVNode, defineComponent, getCurrentInstance } from 'vue'\nimport type { ProjectionTransforms, VcComponentInternalInstance, VcComponentPublicInstance, VcReadyObject } from 'casc-cesium-utils/types'\nimport { useProviders } from 'casc-cesium-composables'\nimport { minimumLevel, maximumLevel, projectionTransforms } from 'casc-cesium-utils/cesium-props'\nimport SuperMapImageryProvider from './SuperMapImageryProvider'\nimport { kebabCase } from 'casc-cesium-utils/util'\nimport { providerEmits } from 'casc-cesium-utils/emits'\n\nexport const supermapImageryProviderProps = {\n  url: String,\n  ...minimumLevel,\n  ...maximumLevel,\n  name: String,\n  transparent: {\n    type: Boolean,\n    default: true\n  },\n  credit: {\n    type: [String, Object] as PropType<string | Cesium.Credit>,\n    default: 'MapQuest, SuperMap iServer Imagery'\n  },\n  ...projectionTransforms\n}\nexport default defineComponent({\n  name: 'VcImageryProviderSupermap',\n  props: supermapImageryProviderProps,\n  emits: providerEmits,\n  setup(props, ctx) {\n    // state\n    const instance = getCurrentInstance() as VcComponentInternalInstance\n    instance.cesiumClass = 'SuperMapImageryProvider'\n    const providersState = useProviders(props, ctx, instance)\n\n    if (undefined === providersState) {\n      return\n    }\n    // methods\n    instance.createCesiumObject = async () => {\n      Cesium.SuperMapImageryProvider = Cesium.SuperMapImageryProvider || SuperMapImageryProvider\n      if (providersState.unwatchFns.length === 0) {\n        providersState.setPropsWatcher(true)\n      }\n      const options = providersState.transformProps(props)\n      return new Cesium.SuperMapImageryProvider(options)\n    }\n    return () => createCommentVNode(kebabCase(instance.proxy?.$options.name || ''))\n  }\n})\n\nexport type VcImageryProviderSupermapProps = {\n  /**\n   * The URL of the SuperMap iServer service.\n   */\n  url: string\n  /**\n   * The name of the layer.\n   */\n  name?: string\n  /**\n   * The minimum tile level to request, or undefined if there is no minimum.\n   * Default value: 0\n   */\n  minimumLevel?: number\n  /**\n   * The maximum tile level to request, or undefined if there is no maximum.\n   * Default value: 20\n   */\n  maximumLevel?: number\n  /**\n   * Whether the parameter of the requested map service is transparent.\n   * Default value: true\n   */\n  transparent?: boolean\n  /**\n   * A credit for the data source, which is displayed on the canvas.\n   * Default value: 'MapQuest, SuperMap iServer Imagery'\n   */\n  credit?: string | Cesium.Credit\n  /**\n   * Specify the projection transformation parameters. such as { from: 'BD09', to: 'WGS84' }\n   */\n  projectionTransforms?: ProjectionTransforms\n  /**\n   * Triggers before the VcImageryProviderSupermap is loaded.\n   */\n  onBeforeLoad?: (instance: VcComponentInternalInstance) => void\n  /**\n   * Triggers when the VcImageryProviderSupermap 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 VcImageryProviderSupermap is destroyed.\n   */\n  onDestroyed?: (instance: VcComponentInternalInstance) => void\n  /**\n   * Triggers when the imagery provider encounters an asynchronous error.\n   */\n  onErrorEvent?: (evt: Cesium.TileProviderError) => void\n  /**\n   * Triggers when the provider is ready for use.\n   */\n  onReadyPromise?: (evt: boolean, viewer: Cesium.Viewer, instance: VcComponentPublicInstance) => void\n}\n\nexport type VcImageryProviderSupermapRef = VcComponentPublicInstance<VcImageryProviderSupermapProps>\n"],"names":[],"mappings":";;;;;;;;AAMY,MAAC,4BAA4B,GAAG;AAC5C,EAAE,GAAG,EAAE,MAAM;AACb,EAAE,GAAG,YAAY;AACjB,EAAE,GAAG,YAAY;AACjB,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,E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