Appearance
dft-model-view
核心模型渲染组件, 以下示例默认父节点已正确设置宽高
。
代码示例
加载离线模型:
vue
<template>
<dft-model-view
:scene-constructor="DFTCore.Scene"
:scene-options="sceneOptions"
/>
</template>
<script setup>
import { reactive, ref } from "vue";
import DFTCore from "dft-vision-core-es6.min.js";
const sceneOptions = reactive({
// 数据源,默认 DFTCore.OFFLINE
dataType: DataType.OFFLINE,
// 文件路径
url: "/pdv/model-example",
});
</script>
vue
<template>
<dft-model-view
:scene-constructor="DFTCore.Scene"
:scene-options="sceneOptions"
/>
</template>
<script>
import DFTCore from "dft-vision-core-es6.min.js";
export default {
data() {
return {
sceneOptions: {
// 数据源,默认 DFTCore.OFFLINE
dataType: DFTCore.OFFLINE,
// 文件路径
url: "/pdv/1004",
},
DFTCore,
};
},
};
</script>
加载在线模型:
vue
<template>
<dft-model-view :scene-constructor="Scene" :scene-options="sceneOptions" />
</template>
<script setup>
import { reactive, ref } from "vue";
import DFTCore from "../public/lib/dft-vision-core-es6.min.js";
const sceneOptions = reactive({
// 数据源,默认 DFTCore.OFFLINE
dataType: DataType.ONLINE,
// api路径
url: "https://my.com/openapi",
// 场景id
id: "123456",
});
</script>
vue
<template>
<dft-model-view
:scene-constructor="DFTCore.Scene"
:scene-options="sceneOptions"
/>
</template>
<script>
import DFTCore from "dft-vision-core-es6.min.js";
export default {
data() {
return {
sceneOptions: {
// 数据源,默认 DFTCore.OFFLINE
dataType: DFTCore.ONLINE,
// api路径
url: "https://my.com/openapi",
// 场景id
id: "123456",
},
DFTCore,
};
},
};
</script>
Props
Invalid code snippet option
参数名 | 参数说明 | 类型 | 默认值 |
---|---|---|---|
symbol | 分组标识, 同组内组件产生联动交互, 默认所有组件在同一个组 | string|symbol | null |
sceneConstructor | 场景类 vision-core 中获取 | DFTCore.Scene | 必传 |
sceneOptions | 场景配置,参考初始化参数 | Object | null |
getContextMenus | 获取右键菜单列表,传递参数为默认菜单列表,接受处理后的列表 | (node: Node) => ContextMenu[]; | null |
getDialogPosition | 设置浮层中窗口(爆炸, 测量等)的初始化位置 | () => { x: number; y: number } | () => ({ x: 40, y: 40 }) |
showToolbar | 是否显示工具栏 | boolean | true |
toolbarOptions | 控制 toolbar 中某一项是否展示 | object | {} |
showLoadingTime | 是否显示属性面板 | boolean | true |
showLoadingProgress | 是否显示加载进度条 | boolean | true |
showLoadingTime | 是否显示加载时长 | boolean | false |
comments(v-model) | 审阅列表 | Note[] | [] |
======= | |||
参数名 | 参数说明 | 类型 | 默认值 |
:--------------------------- | :-------------------------------------------------------- | :-------------------------------- | :------------------------ |
symbol | 分组标识, 同组内组件产生联动交互, 默认所有组件在同一个组 | string|symbol | null |
sceneConstructor | 场景类 vision-core 中获取 | DFTCore.Scene | 必传 |
sceneOptions | 场景配置,参考初始化参数 | Object | null |
getContextMenus | 获取右键菜单列表,传递参数为默认菜单列表,接受处理后的列表 | (node: Node) => ContextMenu[]; | null |
getDialogPosition | 设置浮层中窗口(爆炸, 测量等)的初始化位置 | () => { x: number; y: number } | () => ({ x: 40, y: 40 }) |
showToolbar | 是否显示工具栏 | boolean | true |
toolbarOptions | 控制 toolbar 中某一项是否展示 | object | {} |
showPropertyPanel | 是否显示属性面板 | boolean | true |
showLoadingProgress | 是否显示加载进度条 | boolean | true |
showLoadingTime | 是否显示加载时长 | boolean | false |
notes(v-model) | 审阅列表 | Note[] | [] |
beforeAddNotedeprecated | 添加审阅之前调用 | (note: Note) => Note | null |
beforeDeleteNotedeprecated | 删除审阅之前调用 | (noteIds: string[], { selectedNotes: Note[]}) => void | null |
showCaeSectionExpand | 是否显示云图截面展开按钮 | boolean | false |
Stashed changes
初始化参数 sceneOption
参数名 | 参数说明 |
---|---|
dataType | 数据源,默认 DFTCore.OFFLINE |
url | 文件路径 |
id | 场景 id,当 dataType 设置为 DFTCore.ONLINE 时生效 |
selColor | 选中颜色,默认 0xff0000 |
backgroundColor | 背景颜色,默认 0xc0dcf8 |
backgroundAlpha | 背景透明度,默认 1 |
selectType | 选择类型,默认 DFTCore.BODY |
operateMode | 左键操作模式,默认 DFTCore.SELECT |
projectionMode | 投影模式,默认 DFTCore.PERSPECTIVE |
Emits
事件名称 | 事件说明 | 事件参数 |
---|---|---|
loaded | 模型加载完成 | (data) => void |
tree-loaded | 模型树加载完成 | (payload: { modelNodesTree, tileNodesMap }) => void |
<<<<<<< Updated upstream | ||
click | 鼠标左键点击事件 | ({ node }) => void |
selected-change | 模型选中变化时触发 | (keys: string[]) => void |
after-create-scene | 场景创建完成 | (scene: Scene) => void |
destroy-scene | 场景销毁 | - |
camera-changed | 摄像机视角变化 | (event) => void |
context-menu-selected | 右键菜单选中 | ({ type, node }) => void |
add-comment | 添加审阅 | (comment: Comment, { comments }) => void |
update-comment | 更新审阅 | (comment: Comment, { comments }) => void |
delete-comment | 删除审阅 | (keys: string[], { targetComments }) => void |
comment-click | 点击审阅 | (comment: Comment) => void |
======= | ||
click | 鼠标左键点击事件 | ({ node }) => void |
selected-change | 模型选中变化时触发 | (keys: string[]) => void |
after-create-scene | 场景创建完成 | (scene: Scene) => void |
destroy-scene | 场景销毁 | - |
camera-changed | 摄像机视角变化 | (event) => void |
context-menu-selected | 右键菜单选中 | ({ type, node }) => void |
add-note | 添加审阅 | (note: Note, { notes }) => void |
delete-note | 删除审阅 | (keys: string[], { targetNotes }) => void |
note-click | 点击审阅 | (note: Note) => void |
cloud-map-section-loaded | 云图截面补面状态 | (status:Boolean)=>void |
Stashed changes
Exposed
名称 | 说明 | 方法参数 | 方法返回 |
---|---|---|---|
getScene | 获取 scene 对象 | Scene | |
getSceneState | 获取 sceneState | SceneState | |
setSceneState | 设置 sceneState | Partial<SceneState> | |
resetSceneState | 重置 sceneState | ||
getScreenshot | 获取当前模型区 canvas 截图 | type, quality | 参数参考 canvas.toDataURL 参数 |
getAllTileNodesMap | 获取所有模型节点 | Map<string, TileNode> | |
setSelectedKeys | 设置选中节点 keys | string[] | |
setCheckedKeys | 设置要显示的节点 keys | string[] |