vue-cesium
Version:
Vue 3.x components for CesiumJS.
80 lines (77 loc) • 2.53 kB
JavaScript
import { defineComponent, getCurrentInstance, createCommentVNode } from 'vue';
import '../../../composables/index.mjs';
import { credit, minimumLevel, maximumLevel, rectangle, tilingScheme, projectionTransforms } from '../../../utils/cesium-props.mjs';
import { kebabCase } from '../../../utils/util.mjs';
import { providerEmits } from '../../../utils/emits.mjs';
import AMapImageryProvider from './AMapImageryProvider.mjs';
import useProviders from '../../../composables/use-providers/index.mjs';
;
const amapImageryProviderProps = {
url: {
type: String,
default: "https://{domain}{s}.is.autonavi.com/appmaptile?lang={lang}&size=1&style={style}&scl={scl}<ype={ltype}&x={x}&y={y}&z={z}"
},
subdomains: {
type: Array,
default: () => ["01", "02", "03", "04"]
},
domain: {
type: String,
default: "webst"
},
lang: {
type: String,
default: "zh_cn"
},
mapStyle: {
// 地图类型控制,6卫星图(st),7简图(st rd),8详图(不透明rd,透明图st)
type: String,
default: "6"
},
scl: {
// 尺寸控制,1=256,2=512
type: String,
default: "1"
},
ltype: {
// 线性控制,只对地图要素进行控制,没有文字注记,要素多少,是否透明
// 纯道路 ltype=11 mapStyle=8
// 纯地标 ltype=4 mapStyle=8
// 道路标注 ltype=0 mapStyle=8
type: String,
default: "0"
},
...credit,
...minimumLevel,
...maximumLevel,
...rectangle,
...tilingScheme,
...projectionTransforms
};
var ImageryProviderAmap = defineComponent({
name: "VcImageryProviderAmap",
props: amapImageryProviderProps,
emits: providerEmits,
setup(props, ctx) {
const instance = getCurrentInstance();
instance.cesiumClass = "AMapImageryProvider";
const providersState = useProviders(props, ctx, instance);
if (void 0 === providersState) {
return;
}
instance.createCesiumObject = async () => {
Cesium.AMapImageryProvider = Cesium.AMapImageryProvider || AMapImageryProvider;
if (providersState.unwatchFns.length === 0) {
providersState.setPropsWatcher(true);
}
const options = providersState.transformProps(props);
return new Cesium.AMapImageryProvider(options);
};
return () => {
var _a;
return createCommentVNode(kebabCase(((_a = instance.proxy) == null ? void 0 : _a.$options.name) || ""));
};
}
});
export { amapImageryProviderProps, ImageryProviderAmap as default };
//# sourceMappingURL=index.mjs.map