vue-cesium
Version:
Vue 3.x components for CesiumJS.
1 lines • 5.81 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/primitives/osm-buildings/index.ts"],"sourcesContent":["import { createCommentVNode, defineComponent, getCurrentInstance, PropType, VNode } from 'vue'\nimport type {\n VcCartesian2,\n VcCartesian3Array,\n VcColor,\n VcComponentInternalInstance,\n VcComponentPublicInstance,\n VcDistanceDisplayCondition,\n VcPickEvent,\n VcReadyObject\n} from '@vue-cesium/utils/types'\nimport { usePrimitives } from '@vue-cesium/composables'\nimport { defaultColor, tileStyle, enableMouseEvent } from '@vue-cesium/utils/cesium-props'\nimport { kebabCase } from '@vue-cesium/utils/util'\nimport { primitiveEmits } from '@vue-cesium/utils/emits'\nimport { compareCesiumVersion } from '@vue-cesium/utils/cesium-helpers'\n\nexport const osmBuildingsProps = {\n ...defaultColor,\n ...tileStyle,\n enableShowOutline: {\n type: Boolean,\n default: true\n },\n showOutline: {\n type: Boolean,\n default: true\n },\n ...enableMouseEvent\n}\nexport default defineComponent({\n name: 'VcPrimitiveOsmBuildings',\n props: osmBuildingsProps,\n emits: {\n ...primitiveEmits\n },\n setup(props, ctx) {\n // state\n const instance = getCurrentInstance() as VcComponentInternalInstance\n instance.cesiumClass = 'VcPrimitiveOsmBuildings'\n const primitivesState = usePrimitives(props, ctx, instance)\n // methods\n instance.createCesiumObject = async () => {\n const options: any = primitivesState?.transformProps(props)\n options.style = options.tileStyle\n delete options.tileStyle\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return compareCesiumVersion(Cesium.VERSION, '1.104') ? await Cesium.createOsmBuildingsAsync(options) : Cesium.createOsmBuildings(options)\n }\n return () => createCommentVNode(kebabCase(instance.proxy?.$options.name || ''))\n }\n})\n\nexport type VcPrimitiveOsmBuildingsProps = {\n /**\n * The default color to use for buildings that do not have a color. This parameter is ignored if options.style is specified.\n * Default value: white\n */\n defaultColor?: VcColor\n /**\n * The style to use with the tileset. If not specified, a default style is used which gives each building or building part a color inferred from its OpenStreetMap tags. If no color can be inferred, options.defaultColor is used.\n */\n tileStyle?: Cesium.Cesium3DTileStyle\n /**\n * If true, enable rendering outlines. This can be set to false to avoid the additional processing of geometry at load time.\n * Default value: true\n */\n enableShowOutline?: boolean\n /**\n * Whether to show outlines around buildings. When true, outlines are displayed. When false, outlines are not displayed.\n * Default value: true\n */\n showOutline?: boolean\n /**\n * Specifies whether to respond to mouse pick events.\n * Default Value: true\n */\n enableMouseEvent?: boolean\n /**\n * Triggers before the component is loaded.\n */\n onBeforeLoad?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the component 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 component is destroyed.\n */\n onDestroyed?: (instance: VcComponentInternalInstance) => void\n /**\n * Triggers when the mouse is pressed on this primitive.\n */\n onMousedown?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse bounces up on this primitive.\n */\n onMouseup?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse clicks on this primitive.\n */\n onClick?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse clicks outside this primitive.\n */\n onClickout?: (evt: VcPickEvent) => void\n /**\n * Triggers when the left mouse button double-clicks this primitive.\n */\n onDblclick?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse moves on this primitive.\n */\n onMousemove?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse moves over to this primitive.\n */\n onMouseover?: (evt: VcPickEvent) => void\n /**\n * Triggers when the mouse moves out of this primitive.\n */\n onMouseout?: (evt: VcPickEvent) => void\n /**\n * Triggers when the primitive is ready to render.\n */\n onReadyPromise?: (primitive: Cesium.Primitive, viewer: Cesium.Viewer, instance: VcComponentPublicInstance) => void\n}\n\nexport type VcPrimitiveOsmBuildingsRef = VcComponentPublicInstance<VcPrimitiveOsmBuildingsProps>\n"],"names":[],"mappings":";;;;;;;;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