这个 ProxyManager 官方似乎是不给api文档的,尝试自己总结一下:
当前vtk.js 版本:18.2.0
使用例来源大多数来自paraview-glance
🔵基础API
setProxyConfiguration
设置proxyConfiguration
getProxyConfiguration
获取proxyConfiguration
setActiveSource
设置activeSource
getActiveSource
设置activeSource
使用例:
1 | const source = this.$proxyManager.getActiveSource(); |
setActiveView
设置activeView
getActiveView
设置activeView
使用例:
1 | const activeView = this.$proxyManager.getActiveView();. |
🔵事件
onActiveSourceChange
当 activeSource 改变
使用例:
1 | this.$proxyManager.onActiveSourceChange((s) => |
onActiveViewChange
当 activeView 改变
使用例:
1 | this.$proxyManager.onActiveViewChange((v) => |
onProxyRegistrationChange
当 proxyRegistration 改变时
使用例
1 | this.$proxyManager.onProxyRegistrationChange((info) => { |
🔵核心core
setActiveSource
设置 activeSource
源码
1 | publicAPI.setActiveSource = (source) => { |
setActiveView
设置 activeView
源码
1 | publicAPI.setActiveView = (view) => { |
getProxyById
获取 proxy 通过 id
源码
1 | publicAPI.getProxyById = (id) => model.proxyIdMapping[id]; |
使用例
1 | source() { |
getProxyGroups
获取 proxy Groups
源码
1 | publicAPI.getProxyGroups = () => Object.keys(model.proxyByGroup); |
使用例
1 | const groups = this.$proxyManager.getProxyGroups(); |
getProxyInGroup
获取 group 中的proxy
源码
1 | publicAPI.getProxyInGroup = (name) => |
使用例
1 | for (let i = 0; i < groups.length; i++) { |
getSources
获取 sources
源码
1 | publicAPI.getSources = () => [].concat(model.proxyByGroup.Sources || []); |
使用例
1 | // restore proxy keys |
getRepresentations
获取所有 Representations
源码
1 | publicAPI.getRepresentations = () => |
使用例
1 | const myReps = this.$proxyManager |
getViews
获取所有 views
源码
1 | publicAPI.getViews = () => [].concat(model.proxyByGroup.Views || []); |
使用例
1 | const views2D = pxm.getViews().filter((v) => v.isA('vtkView2DProxy')); |
createProxy
创建 proxy
源码
1 | publicAPI.createProxy = (group, name, options) => { |
使用例
1 | const view = proxyManager.createProxy('Views', 'ItkVtkView'); |
getRepresentation
获取 Representation
源码
1 | publicAPI.getRepresentation = (source, view) => { |
使用例
1 | const imageRepresentation = proxyManager.getRepresentation(imageSource, view); |
deleteProxy
删除代理
源码
1 | publicAPI.deleteProxy = (proxy) => { |
使用例
1 | deleteDataset(sourceId) { |
🔵状态 state
loadState
加载 state
源码
1 | publicAPI.loadState = (state, options = {}) => |
使用例
1 | restoreAppState({ commit, dispatch, state }, appState) { |
saveState
保存 state
源码
1 | publicAPI.saveState = (options = {}, userData = {}) => |
使用例
1 | const zip = new JSZip(); |
🔵视口 view
create3DView
创建3D视口
源码
1 | publicAPI.create3DView = (options) => |
create2DView
创建2D视口
源码
1 | publicAPI.create2DView = (options) => |
render
渲染单个view
源码
1 | publicAPI.render = (view) => { |
renderAllViews
渲染所有views
源码
1 | publicAPI.renderAllViews = (blocking = false) => { |
使用例
1 | view.resize(); |
setAnimationOnAllViews
在所有views上设置动画
源码
1 | publicAPI.setAnimationOnAllViews = (enable = false) => { |
使用例
1 | this.piecewiseWidget.onAnimation((animating) => { |
clearAnimations
清理所有动画
源码
1 | function clearAnimations() { |
autoAnimateViews
自动播放动画
源码
1 | publicAPI.autoAnimateViews = (debouceTimout = 250) => { |
使用例
1 | proxyManagerHooks: { |
resizeAllViews
重置视口大小
源码
1 | publicAPI.resizeAllViews = () => { |
使用例
1 | window.addEventListener('resize', proxyManager.resizeAllViews); |
resetCamera
重置Camera
源码
1 | publicAPI.resetCamera = (view) => { |
使用例
1 | resetCamera() { |
createRepresentationInAllViews
在所有views 上创建 Representation
源码
1 | publicAPI.createRepresentationInAllViews = (source) => { |
使用例
1 | proxyManager.createRepresentationInAllViews(imageSource); |
resetCameraInAllViews
重置所有views上面的摄像头
源码
1 | publicAPI.resetCameraInAllViews = () => { |
使用例
1 | setTimeout(() => { |
🔵属性 properties
getSections
获取 sections
1 | publicAPI.getSections = () => { |
使用例
1 | 无... |
updateCollapseState
更新 数据的 CollapseState
源码
1 | publicAPI.updateCollapseState = (name, state) => { |
使用例
1 | 无... |
applyChanges
源码
1 | publicAPI.applyChanges = (changeSet) => { |
使用例
1 | 无... |
getLookupTable
获取 LookupTable
源码
1 | publicAPI.getLookupTable = (arrayName, options) => { |
使用例
1 | const dataArray = imageData.getPointData().getScalars(); |
getPiecewiseFunction
获取 PiecewiseFunction
源码
1 | publicAPI.getPiecewiseFunction = (arrayName, options) => { |
使用例
1 | const piecewiseFunction = proxyManager.getPiecewiseFunction(dataArray.getName()); |
rescaleTransferFunctionToDataRange
设置转换区间
源码
1 | publicAPI.rescaleTransferFunctionToDataRange = (arrayName, dataRange) => { |
使用例
1 | 无.. |