vtkviewer-vue 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +753 -0
- package/README.md +1760 -0
- package/lib/types/components/PluginToolbar.vue.d.ts +7 -0
- package/lib/types/components/ToolbarExtension.vue.d.ts +9 -0
- package/lib/types/components/ToolbarInfoPanel.vue.d.ts +10 -0
- package/lib/types/components/VtkViewer.vue.d.ts +32 -0
- package/lib/types/components/index.d.ts +4 -0
- package/lib/types/composables/index.d.ts +7 -0
- package/lib/types/composables/useFormatLoader.d.ts +33 -0
- package/lib/types/composables/useResponsiveLayout.d.ts +46 -0
- package/lib/types/composables/useUIPlugins.d.ts +57 -0
- package/lib/types/composables/useViewer.d.ts +47 -0
- package/lib/types/configs/index.d.ts +76 -0
- package/lib/types/core/CommandRegistrar.d.ts +12 -0
- package/lib/types/core/CommandRegistry.d.ts +34 -0
- package/lib/types/core/ConfigAccessor.d.ts +33 -0
- package/lib/types/core/DisposalRegistry.d.ts +32 -0
- package/lib/types/core/EventBus.d.ts +79 -0
- package/lib/types/core/FormatDetector.d.ts +59 -0
- package/lib/types/core/I18nManager.d.ts +135 -0
- package/lib/types/core/InteractionSubContext.d.ts +73 -0
- package/lib/types/core/RenderSubContext.d.ts +74 -0
- package/lib/types/core/ResetManager.d.ts +122 -0
- package/lib/types/core/ResetRegistry.d.ts +170 -0
- package/lib/types/core/SceneSubContext.d.ts +25 -0
- package/lib/types/core/StateManager.d.ts +104 -0
- package/lib/types/core/ThemeContext.d.ts +37 -0
- package/lib/types/core/ToolbarExtensionRegistry.d.ts +105 -0
- package/lib/types/core/ToolbarInfoRegistry.d.ts +77 -0
- package/lib/types/core/UISubContext.d.ts +32 -0
- package/lib/types/core/ViewerContext.d.ts +101 -0
- package/lib/types/core/ViewerContextBuilder.d.ts +57 -0
- package/lib/types/core/createViewerContext.d.ts +26 -0
- package/lib/types/core/index.d.ts +23 -0
- package/lib/types/icons/index.d.ts +47 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/plugins/PluginBase.d.ts +131 -0
- package/lib/types/plugins/PluginRegistry.d.ts +67 -0
- package/lib/types/plugins/defaults.d.ts +3 -0
- package/lib/types/plugins/format/DrcPlugin.d.ts +30 -0
- package/lib/types/plugins/format/GlbPlugin.d.ts +23 -0
- package/lib/types/plugins/format/ObjPlugin.d.ts +23 -0
- package/lib/types/plugins/format/PdbPlugin.d.ts +33 -0
- package/lib/types/plugins/format/PlyPlugin.d.ts +24 -0
- package/lib/types/plugins/format/StlPlugin.d.ts +25 -0
- package/lib/types/plugins/format/VtiPlugin.d.ts +60 -0
- package/lib/types/plugins/format/VtpPlugin.d.ts +24 -0
- package/lib/types/plugins/format/VtuPlugin.d.ts +25 -0
- package/lib/types/plugins/format/ZipPlugin.d.ts +38 -0
- package/lib/types/plugins/format/index.d.ts +13 -0
- package/lib/types/plugins/index.d.ts +13 -0
- package/lib/types/plugins/injectionKeys.d.ts +22 -0
- package/lib/types/plugins/pluginUtils.d.ts +61 -0
- package/lib/types/plugins/service/DragDropPlugin.d.ts +94 -0
- package/lib/types/plugins/service/KeyBindingPlugin.d.ts +83 -0
- package/lib/types/plugins/service/MemoryPressurePlugin.d.ts +68 -0
- package/lib/types/plugins/service/index.d.ts +6 -0
- package/lib/types/plugins/toolbar/animation/AnimationPlugin.d.ts +34 -0
- package/lib/types/plugins/toolbar/animation/index.d.ts +1 -0
- package/lib/types/plugins/toolbar/index.d.ts +9 -0
- package/lib/types/plugins/toolbar/interaction/CenterModelPlugin.d.ts +21 -0
- package/lib/types/plugins/toolbar/interaction/FullscreenPlugin.d.ts +27 -0
- package/lib/types/plugins/toolbar/interaction/PanPlugin.d.ts +24 -0
- package/lib/types/plugins/toolbar/interaction/ResetAllPlugin.d.ts +25 -0
- package/lib/types/plugins/toolbar/interaction/RotatePlugin.d.ts +24 -0
- package/lib/types/plugins/toolbar/interaction/ViewSelectPlugin.d.ts +26 -0
- package/lib/types/plugins/toolbar/interaction/ZoomPlugin.d.ts +24 -0
- package/lib/types/plugins/toolbar/interaction/index.d.ts +7 -0
- package/lib/types/plugins/toolbar/model/ClippingPlugin.d.ts +87 -0
- package/lib/types/plugins/toolbar/model/ColorByPlugin.d.ts +113 -0
- package/lib/types/plugins/toolbar/model/LoadModelPlugin.d.ts +93 -0
- package/lib/types/plugins/toolbar/model/RenderPrecisionPlugin.d.ts +68 -0
- package/lib/types/plugins/toolbar/model/RenderStylePlugin.d.ts +88 -0
- package/lib/types/plugins/toolbar/model/UnloadModelPlugin.d.ts +25 -0
- package/lib/types/plugins/toolbar/model/index.d.ts +6 -0
- package/lib/types/plugins/toolbar/scene/AxesPlugin.d.ts +96 -0
- package/lib/types/plugins/toolbar/scene/BackgroundColorPlugin.d.ts +25 -0
- package/lib/types/plugins/toolbar/scene/LanguageSwitchPlugin.d.ts +45 -0
- package/lib/types/plugins/toolbar/scene/LightIntensityPlugin.d.ts +42 -0
- package/lib/types/plugins/toolbar/scene/RenderGridPlugin.d.ts +98 -0
- package/lib/types/plugins/toolbar/scene/ThemeSwitchPlugin.d.ts +49 -0
- package/lib/types/plugins/toolbar/scene/index.d.ts +6 -0
- package/lib/types/plugins/toolbar/tools/BookmarkPlugin.d.ts +70 -0
- package/lib/types/plugins/toolbar/tools/MeasurementPlugin.d.ts +112 -0
- package/lib/types/plugins/toolbar/tools/PerformancePlugin.d.ts +55 -0
- package/lib/types/plugins/toolbar/tools/ScreenshotPlugin.d.ts +58 -0
- package/lib/types/plugins/toolbar/tools/index.d.ts +4 -0
- package/lib/types/plugins/toolbar/utils.d.ts +67 -0
- package/lib/types/plugins/types/index.d.ts +250 -0
- package/lib/types/plugins/ui/ErrorPlugin.d.ts +30 -0
- package/lib/types/plugins/ui/FilenameInfoPlugin.d.ts +40 -0
- package/lib/types/plugins/ui/LoadingPlugin.d.ts +28 -0
- package/lib/types/plugins/ui/SceneTreePlugin.d.ts +60 -0
- package/lib/types/plugins/ui/WebGLContextLostPlugin.d.ts +33 -0
- package/lib/types/plugins/ui/index.d.ts +8 -0
- package/lib/types/polyfills.d.ts +1 -0
- package/lib/types/types/index.d.ts +187 -0
- package/lib/types/types/vtk-modules.d.ts +80 -0
- package/lib/types/utils/asyncUtils.d.ts +8 -0
- package/lib/types/utils/colorByUtils.d.ts +55 -0
- package/lib/types/utils/debugLog.d.ts +13 -0
- package/lib/types/utils/errorHandler.d.ts +28 -0
- package/lib/types/utils/index.d.ts +10 -0
- package/lib/types/utils/sceneUtils.d.ts +11 -0
- package/lib/types/utils/themeManager.d.ts +78 -0
- package/lib/types/utils/volumeUtils.d.ts +14 -0
- package/lib/types/utils/vtkHelpers.d.ts +46 -0
- package/lib/types/utils/vtuLoader.d.ts +26 -0
- package/lib/types/utils/zipReader.d.ts +71 -0
- package/lib/vtkviewer.css +2 -0
- package/lib/vtkviewer.js +54714 -0
- package/lib/vtkviewer.umd.cjs +4560 -0
- package/package.json +89 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Component, DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
import { IResettableActions, ResetAction } from '../../../core';
|
|
3
|
+
import { ToolbarPluginConfig, IToolbarPlugin } from '../../types';
|
|
4
|
+
import { PluginBase } from '../../PluginBase';
|
|
5
|
+
/** 色条位置预设 */
|
|
6
|
+
export type ScalarBarPosition = 'right' | 'left' | 'top' | 'bottom';
|
|
7
|
+
/** 颜色映射插件配置 */
|
|
8
|
+
export interface ColorByPluginConfig extends ToolbarPluginConfig {
|
|
9
|
+
/** 默认颜色预设名称(重置时恢复),默认 'erdc_rainbow_bright' */
|
|
10
|
+
defaultPreset?: string;
|
|
11
|
+
/** 色条是否显示刻度数值,默认 true */
|
|
12
|
+
showScalarBarTickLabels?: boolean;
|
|
13
|
+
/** 色条是否显示轴标题(数组名称),默认 true */
|
|
14
|
+
showScalarBarTitle?: boolean;
|
|
15
|
+
/** 色条轴标题自定义文本(为空时使用数组名称) */
|
|
16
|
+
scalarBarTitle?: string;
|
|
17
|
+
/** 色条位置,默认 'right' */
|
|
18
|
+
scalarBarPosition?: ScalarBarPosition;
|
|
19
|
+
/** 色条刻度数量,默认 'auto'(根据色条长度自动计算) */
|
|
20
|
+
scalarBarTickCount?: number | 'auto';
|
|
21
|
+
/** 色条刻度数值字号,默认 14 */
|
|
22
|
+
scalarBarTickFontSize?: number;
|
|
23
|
+
/** 色条轴标题字号,默认 18 */
|
|
24
|
+
scalarBarTitleFontSize?: number;
|
|
25
|
+
/** 色条轴标题与刻度的间距(像素),默认 48 */
|
|
26
|
+
scalarBarTitleOffset?: number;
|
|
27
|
+
/** 色条轴标题颜色,默认 '#000000'*/
|
|
28
|
+
scalarBarTitleColor?: string;
|
|
29
|
+
/** 点拾取最大保存数量,默认 5 */
|
|
30
|
+
maxPickPoints?: number;
|
|
31
|
+
/** 拾取点标记颜色,支持 '#rrggbb' 或 [r, g, b](0~1),默认 '#00bcd4'(青色) */
|
|
32
|
+
pickPointColor?: [number, number, number][];
|
|
33
|
+
/** 拾取点标记半径占场景对角线比例,默认 0.003 */
|
|
34
|
+
pickPointRadiusRatio?: number;
|
|
35
|
+
}
|
|
36
|
+
export declare class ColorByPlugin extends PluginBase<ColorByPluginConfig> implements IToolbarPlugin, IResettableActions {
|
|
37
|
+
readonly metadata: {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
type: "toolbar";
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
readonly order = 0;
|
|
44
|
+
readonly defaultConfig: ColorByPluginConfig;
|
|
45
|
+
private currentArray;
|
|
46
|
+
private currentPreset;
|
|
47
|
+
private colorOptions;
|
|
48
|
+
private arrayFeatures;
|
|
49
|
+
private scalarBarActor;
|
|
50
|
+
/** 模型加载时自动选择的第一个数据数组(用于 resetToDefault 恢复) */
|
|
51
|
+
private initialArrayValue;
|
|
52
|
+
/** 当前加载的格式是否支持颜色映射(由 scene:loaded 事件传入) */
|
|
53
|
+
private supportsColorBy;
|
|
54
|
+
/** 扩展区是否激活 */
|
|
55
|
+
private extensionActive;
|
|
56
|
+
/** 点拾取是否启用 */
|
|
57
|
+
private pickingEnabled;
|
|
58
|
+
/** 已拾取的点列表 */
|
|
59
|
+
private pickedPoints;
|
|
60
|
+
private pickedPointsCount;
|
|
61
|
+
/** 拾取点自动分配颜色调色板(与 erdc_rainbow_bright 彩虹色差异较大的深色调) */
|
|
62
|
+
private static readonly PICK_MARKER_PALETTE;
|
|
63
|
+
/** 拾取器 */
|
|
64
|
+
private cellPicker;
|
|
65
|
+
/** 左键点击事件订阅句柄 */
|
|
66
|
+
private clickSubscription;
|
|
67
|
+
protected onInit(): void;
|
|
68
|
+
protected onDispose(): void;
|
|
69
|
+
registerResetActions(): ResetAction[];
|
|
70
|
+
/** 重置颜色映射为默认状态 */
|
|
71
|
+
private resetToDefault;
|
|
72
|
+
private registerExtension;
|
|
73
|
+
/** 渲染扩展区内容(颜色映射数组选择 + 预设选择) */
|
|
74
|
+
renderExtension(): Component;
|
|
75
|
+
private onSceneCleared;
|
|
76
|
+
/** 隐藏色条并从渲染器移除 */
|
|
77
|
+
private hideScalarBar;
|
|
78
|
+
/** 应用色条配置(位置、标题、刻度等)
|
|
79
|
+
* 必须在 showScalarBar 中调用(此时 automated=false,手动控制生效) */
|
|
80
|
+
private applyScalarBarConfig;
|
|
81
|
+
/** 显示色条并添加到渲染器 */
|
|
82
|
+
private showScalarBar;
|
|
83
|
+
/** 切换点拾取开关 */
|
|
84
|
+
private togglePicking;
|
|
85
|
+
/** 启用点拾取 */
|
|
86
|
+
private enablePicking;
|
|
87
|
+
/** 禁用点拾取 */
|
|
88
|
+
private disablePicking;
|
|
89
|
+
/** 处理鼠标左键点击(拾取点并获取标量值) */
|
|
90
|
+
private handlePickClick;
|
|
91
|
+
/** 计算场景对角线长度 */
|
|
92
|
+
private getSceneDiagonal;
|
|
93
|
+
/** 创建拾取点标记(小球) */
|
|
94
|
+
private createPickMarker;
|
|
95
|
+
/** 移除单个拾取点标记 */
|
|
96
|
+
private removePickMarker;
|
|
97
|
+
/** 清理所有拾取点标记 */
|
|
98
|
+
private clearPickMarkers;
|
|
99
|
+
/** 注册点拾取信息面板 */
|
|
100
|
+
private registerPickInfoPanel;
|
|
101
|
+
private onSceneLoaded;
|
|
102
|
+
/** 获取所有可用的颜色映射数组名称(不含 Solid Color) */
|
|
103
|
+
get availableArrays(): string[];
|
|
104
|
+
private updateAvailableArrays;
|
|
105
|
+
/** 设置颜色映射数组(接受数组名称或 'location:arrayName' 格式) */
|
|
106
|
+
private setColorByArray;
|
|
107
|
+
/** 应用当前预设到所有 actor 的 lookupTable(与官网 applyPreset 一致) */
|
|
108
|
+
private applyPreset;
|
|
109
|
+
/** 对所有 actor 应用颜色映射(与官网 Geometry Viewer 一致) */
|
|
110
|
+
private applyColorBy;
|
|
111
|
+
render(): DefineComponent<{}, () => null, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
112
|
+
isVisible(): boolean;
|
|
113
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { ToolbarPluginConfig, KeyboardShortcutConfigItem, IToolbarPlugin } from '../../types';
|
|
3
|
+
import { PluginBase } from '../../PluginBase';
|
|
4
|
+
/** 加载模型插件配置 */
|
|
5
|
+
export interface LoadModelPluginConfig extends ToolbarPluginConfig {
|
|
6
|
+
}
|
|
7
|
+
export declare class LoadModelPlugin extends PluginBase<LoadModelPluginConfig> implements IToolbarPlugin {
|
|
8
|
+
readonly metadata: {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
type: "toolbar";
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
/** 在核心组中靠前排列 */
|
|
15
|
+
readonly order = 0;
|
|
16
|
+
readonly defaultConfig: LoadModelPluginConfig;
|
|
17
|
+
/** 是否显示下拉弹窗 */
|
|
18
|
+
private isDropdownOpen;
|
|
19
|
+
/** 当前tab:'local'(本地文件)或 'remote'(远程URL) */
|
|
20
|
+
private tab;
|
|
21
|
+
/** URL输入框内容 */
|
|
22
|
+
private urlInput;
|
|
23
|
+
/** 是否正在加载 */
|
|
24
|
+
private isLoading;
|
|
25
|
+
/** 状态提示文本 */
|
|
26
|
+
private statusText;
|
|
27
|
+
/** 状态提示类型 */
|
|
28
|
+
private statusType;
|
|
29
|
+
/** 下拉弹窗对齐管理器(运行时自动根据按钮位置判断向左/向右展开) */
|
|
30
|
+
private dropdownAlignment;
|
|
31
|
+
/** 隐藏的文件选择input元素 */
|
|
32
|
+
private fileInput;
|
|
33
|
+
protected onInit(): void;
|
|
34
|
+
protected onDispose(): void;
|
|
35
|
+
/** 点击外部时关闭下拉 */
|
|
36
|
+
private handleOutsideClick;
|
|
37
|
+
/** 打开文件选择对话框 */
|
|
38
|
+
private openFileDialog;
|
|
39
|
+
/** 文件选择回调 */
|
|
40
|
+
private handleFileSelect;
|
|
41
|
+
/**
|
|
42
|
+
* 加载本地文件
|
|
43
|
+
* @param file 用户选择的File对象
|
|
44
|
+
*/
|
|
45
|
+
private loadLocalFile;
|
|
46
|
+
/**
|
|
47
|
+
* 从远程URL加载模型
|
|
48
|
+
*/
|
|
49
|
+
private loadFromUrl;
|
|
50
|
+
/**
|
|
51
|
+
* 核心加载流程:清场→解析→添加到场景→重置相机→发送事件
|
|
52
|
+
*
|
|
53
|
+
* @param buffer 文件二进制内容
|
|
54
|
+
* @param format 检测到的格式标识(如 'stl', 'obj')
|
|
55
|
+
* @param filename 文件名(用于日志和事件)
|
|
56
|
+
* @param fileSize 文件大小(字节),用于LoadingPlugin显示
|
|
57
|
+
*/
|
|
58
|
+
private loadBuffer;
|
|
59
|
+
/**
|
|
60
|
+
* 处理格式校验失败,设置错误并清除加载状态
|
|
61
|
+
*/
|
|
62
|
+
private handleValidationError;
|
|
63
|
+
/**
|
|
64
|
+
* 处理加载异常
|
|
65
|
+
*/
|
|
66
|
+
private handleLoadError;
|
|
67
|
+
/**
|
|
68
|
+
* 清空已有场景(复用UnloadModelPlugin的完备卸载逻辑)
|
|
69
|
+
*/
|
|
70
|
+
private clearExistingScene;
|
|
71
|
+
/**
|
|
72
|
+
* 从已注册的格式插件中收集所有支持的格式
|
|
73
|
+
* @returns 去重排序后的格式列表
|
|
74
|
+
*/
|
|
75
|
+
private getSupportedFormats;
|
|
76
|
+
/**
|
|
77
|
+
* 构建文件选择框的accept属性字符串。
|
|
78
|
+
* 直接从 FormatDetector.EXTENSION_MAP 动态查找,无硬编码扩展名映射。
|
|
79
|
+
*
|
|
80
|
+
* @param formats 支持的格式列表
|
|
81
|
+
* @returns HTML accept属性值(如 ".stl,.stla,.stlb,.obj,.ply")
|
|
82
|
+
*/
|
|
83
|
+
private buildAcceptString;
|
|
84
|
+
/**
|
|
85
|
+
* 根据格式名查找对应的格式插件(委托给 PluginRegistry 的索引)
|
|
86
|
+
* @param format 格式标识(如 'stl', 'obj')
|
|
87
|
+
* @returns 匹配的格式插件,未找到则返回 undefined
|
|
88
|
+
*/
|
|
89
|
+
private findFormatPlugin;
|
|
90
|
+
render(): Component;
|
|
91
|
+
isVisible(): boolean;
|
|
92
|
+
getShortcutConfig(): KeyboardShortcutConfigItem[];
|
|
93
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { IResettableActions, ResetAction } from '../../../core';
|
|
2
|
+
import { ToolbarPluginConfig, KeyboardShortcutConfigItem, KeyboardShortcutAction, IToolbarPlugin } from '../../types';
|
|
3
|
+
import { PluginBase } from '../../PluginBase';
|
|
4
|
+
import { DefineComponent, VNode, RendererNode, RendererElement, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
5
|
+
/** 渲染精度级别 */
|
|
6
|
+
export type PrecisionLevel = 'low' | 'medium' | 'high' | 'ultra';
|
|
7
|
+
/** 渲染精度插件配置 */
|
|
8
|
+
export interface RenderPrecisionPluginConfig extends ToolbarPluginConfig {
|
|
9
|
+
/** 默认精度级别 */
|
|
10
|
+
defaultLevel?: PrecisionLevel;
|
|
11
|
+
/** 是否默认在信息面板显示精度信息 */
|
|
12
|
+
defaultShowInfo?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class RenderPrecisionPlugin extends PluginBase<RenderPrecisionPluginConfig> implements IToolbarPlugin, IResettableActions {
|
|
15
|
+
readonly metadata: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
type: "toolbar";
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
readonly order = 6;
|
|
22
|
+
readonly defaultConfig: RenderPrecisionPluginConfig;
|
|
23
|
+
/** 当前精度级别 */
|
|
24
|
+
private currentLevel;
|
|
25
|
+
/** 是否展开面板 */
|
|
26
|
+
private panelOpen;
|
|
27
|
+
/** 下拉弹窗对齐管理器(运行时自动根据按钮位置判断向左/向右展开) */
|
|
28
|
+
private dropdownAlignment;
|
|
29
|
+
/** 自定义精度值(当使用自定义模式时) */
|
|
30
|
+
private customPolygonDivision;
|
|
31
|
+
private customEdgeAngle;
|
|
32
|
+
private customAntiAliasing;
|
|
33
|
+
/** 是否在信息面板显示精度信息 */
|
|
34
|
+
private showInPanel;
|
|
35
|
+
/** 是否使用自定义模式 */
|
|
36
|
+
private useCustom;
|
|
37
|
+
/** 当前实际应用的三角形数 */
|
|
38
|
+
private appliedTriangles;
|
|
39
|
+
/** 当前实际应用的顶点数 */
|
|
40
|
+
private appliedVertices;
|
|
41
|
+
private boundHandleClickOutside;
|
|
42
|
+
protected onInit(): void;
|
|
43
|
+
protected onDispose(): void;
|
|
44
|
+
registerResetActions(): ResetAction[];
|
|
45
|
+
private handleClickOutside;
|
|
46
|
+
/** 应用精度级别 */
|
|
47
|
+
private applyPrecision;
|
|
48
|
+
/** 应用自定义精度 */
|
|
49
|
+
private applyCustomPrecision;
|
|
50
|
+
/** 将精度配置应用到渲染器 */
|
|
51
|
+
private applyToRenderer;
|
|
52
|
+
/** 更新已应用的统计信息 */
|
|
53
|
+
private updateAppliedStats;
|
|
54
|
+
/** 重置精度 */
|
|
55
|
+
private resetPrecision;
|
|
56
|
+
/** 切换精度级别 */
|
|
57
|
+
private setLevel;
|
|
58
|
+
/** 切换信息面板显示状态 */
|
|
59
|
+
private toggleInfoPanel;
|
|
60
|
+
/** 注册信息面板 */
|
|
61
|
+
private registerInfoPanel;
|
|
62
|
+
render(): DefineComponent<{}, () => VNode<RendererNode, RendererElement, {
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
}>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
65
|
+
isVisible(): boolean;
|
|
66
|
+
getShortcutConfig(): KeyboardShortcutConfigItem[];
|
|
67
|
+
getKeyboardShortcutActions(): KeyboardShortcutAction[];
|
|
68
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { IResettableActions, ResetAction } from '../../../core';
|
|
2
|
+
import { ToolbarPluginConfig, KeyboardShortcutConfigItem, KeyboardShortcutAction, IToolbarPlugin } from '../../types';
|
|
3
|
+
import { PluginBase } from '../../PluginBase';
|
|
4
|
+
import { DefineComponent, VNode, RendererNode, RendererElement, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
5
|
+
/** 渲染模式 */
|
|
6
|
+
type RepresentationMode = 'surface' | 'wireframe' | 'points' | 'surface-with-edges';
|
|
7
|
+
/** 插值方式 */
|
|
8
|
+
type InterpolationMode = 'flat' | 'gouraud' | 'phong';
|
|
9
|
+
/** 渲染样式插件配置 */
|
|
10
|
+
export interface RenderStylePluginConfig extends ToolbarPluginConfig {
|
|
11
|
+
/** 默认渲染模式 */
|
|
12
|
+
defaultRepresentation?: RepresentationMode;
|
|
13
|
+
/** 默认透明度 (0-1) */
|
|
14
|
+
defaultOpacity?: number;
|
|
15
|
+
/** 默认点大小 */
|
|
16
|
+
defaultPointSize?: number;
|
|
17
|
+
/** 默认线宽 */
|
|
18
|
+
defaultLineWidth?: number;
|
|
19
|
+
/** 是否显示边缘 */
|
|
20
|
+
showEdges?: boolean;
|
|
21
|
+
/** 边缘颜色 [r, g, b] (0-255) */
|
|
22
|
+
edgeColor?: [number, number, number];
|
|
23
|
+
/** 是否启用光照 */
|
|
24
|
+
enableLighting?: boolean;
|
|
25
|
+
/** 插值方式 */
|
|
26
|
+
interpolation?: InterpolationMode;
|
|
27
|
+
}
|
|
28
|
+
export declare class RenderStylePlugin extends PluginBase<RenderStylePluginConfig> implements IToolbarPlugin, IResettableActions {
|
|
29
|
+
readonly metadata: {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
type: "toolbar";
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
readonly order = 3;
|
|
36
|
+
readonly defaultConfig: RenderStylePluginConfig;
|
|
37
|
+
/** 当前渲染模式 */
|
|
38
|
+
private representation;
|
|
39
|
+
/** 当前透明度 */
|
|
40
|
+
private opacity;
|
|
41
|
+
/** 当前点大小 */
|
|
42
|
+
private pointSize;
|
|
43
|
+
/** 当前线宽 */
|
|
44
|
+
private lineWidth;
|
|
45
|
+
/** 是否显示边缘 */
|
|
46
|
+
private showEdges;
|
|
47
|
+
/** 边缘颜色 */
|
|
48
|
+
private edgeColor;
|
|
49
|
+
/** 是否启用光照 */
|
|
50
|
+
private enableLighting;
|
|
51
|
+
/** 当前插值方式 */
|
|
52
|
+
private interpolation;
|
|
53
|
+
/** 是否展开面板 */
|
|
54
|
+
private panelOpen;
|
|
55
|
+
protected onInit(): void;
|
|
56
|
+
/** 应用所有属性到场景中的 Actor */
|
|
57
|
+
private applyAllProperties;
|
|
58
|
+
/** 应用属性到单个 Actor */
|
|
59
|
+
private applyPropertiesToActor;
|
|
60
|
+
/** 设置渲染模式 */
|
|
61
|
+
private setRepresentation;
|
|
62
|
+
/** 设置透明度 */
|
|
63
|
+
private setOpacity;
|
|
64
|
+
/** 设置点大小 */
|
|
65
|
+
private setPointSize;
|
|
66
|
+
/** 设置线宽 */
|
|
67
|
+
private setLineWidth;
|
|
68
|
+
/** 切换边缘显示 */
|
|
69
|
+
private toggleEdges;
|
|
70
|
+
/** 设置光照 */
|
|
71
|
+
private setLighting;
|
|
72
|
+
/** 设置插值方式 */
|
|
73
|
+
private setInterpolation;
|
|
74
|
+
/** 获取当前图标配置(含多状态图标) */
|
|
75
|
+
private getIconConfig;
|
|
76
|
+
/** 重置所有设置到默认值 */
|
|
77
|
+
private resetToDefaults;
|
|
78
|
+
/** 切换面板展开状态 */
|
|
79
|
+
private togglePanel;
|
|
80
|
+
registerResetActions(): ResetAction[];
|
|
81
|
+
render(): DefineComponent<{}, () => VNode<RendererNode, RendererElement, {
|
|
82
|
+
[key: string]: any;
|
|
83
|
+
}>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
84
|
+
isVisible(): boolean;
|
|
85
|
+
getShortcutConfig(): KeyboardShortcutConfigItem[];
|
|
86
|
+
getKeyboardShortcutActions(): KeyboardShortcutAction[];
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ToolbarPluginConfig, KeyboardShortcutConfigItem, KeyboardShortcutAction, IToolbarPlugin } from '../../types';
|
|
2
|
+
import { PluginBase } from '../../PluginBase';
|
|
3
|
+
import { DefineComponent, VNode, RendererNode, RendererElement, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
4
|
+
/** 卸载模型插件配置 */
|
|
5
|
+
export interface UnloadModelPluginConfig extends ToolbarPluginConfig {
|
|
6
|
+
}
|
|
7
|
+
export declare class UnloadModelPlugin extends PluginBase<UnloadModelPluginConfig> implements IToolbarPlugin {
|
|
8
|
+
readonly metadata: {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
type: "toolbar";
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
readonly order = 100;
|
|
15
|
+
readonly defaultConfig: UnloadModelPluginConfig;
|
|
16
|
+
/**
|
|
17
|
+
* 卸载模型:清除场景、重置插件状态、恢复默认相机
|
|
18
|
+
*/
|
|
19
|
+
private unload;
|
|
20
|
+
render(): DefineComponent<{}, () => VNode<RendererNode, RendererElement, {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
23
|
+
getShortcutConfig(): KeyboardShortcutConfigItem[];
|
|
24
|
+
getKeyboardShortcutActions(): KeyboardShortcutAction[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { IResettableActions, ResetAction } from '../../../core';
|
|
2
|
+
import { ToolbarPluginConfig, KeyboardShortcutConfigItem, KeyboardShortcutAction, IToolbarPlugin } from '../../types';
|
|
3
|
+
import { PluginBase } from '../../PluginBase';
|
|
4
|
+
import { DefineComponent, VNode, RendererNode, RendererElement, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
5
|
+
/** 坐标系模式 */
|
|
6
|
+
type CoordinateMode = 'none' | 'world' | 'display' | 'both';
|
|
7
|
+
/** 视口角落位置 */
|
|
8
|
+
type ViewportCorner = 'TOP_LEFT' | 'TOP_RIGHT' | 'BOTTOM_LEFT' | 'BOTTOM_RIGHT';
|
|
9
|
+
/** RGB 颜色元组 [r, g, b],值范围 0-255 */
|
|
10
|
+
type RGBColor = [number, number, number];
|
|
11
|
+
/** 坐标轴插件配置 */
|
|
12
|
+
export interface AxesPluginConfig extends ToolbarPluginConfig {
|
|
13
|
+
/** 默认坐标系模式 */
|
|
14
|
+
defaultMode?: CoordinateMode;
|
|
15
|
+
/** 方向指示器位置,默认 BOTTOM_RIGHT */
|
|
16
|
+
viewportCorner?: ViewportCorner;
|
|
17
|
+
/** 视口大小比例 (0~1),默认 0.15 */
|
|
18
|
+
viewportSize?: number;
|
|
19
|
+
/** 最小像素大小,默认 80 */
|
|
20
|
+
minPixelSize?: number;
|
|
21
|
+
/** 最大像素大小,默认 200 */
|
|
22
|
+
maxPixelSize?: number;
|
|
23
|
+
/** 箭头尖端分辨率(圆锥段数),默认 60 */
|
|
24
|
+
tipResolution?: number;
|
|
25
|
+
/** 箭头尖端半径,默认 0.05 */
|
|
26
|
+
tipRadius?: number;
|
|
27
|
+
/** 箭头尖端长度,默认 0.2 */
|
|
28
|
+
tipLength?: number;
|
|
29
|
+
/** 箭杆分辨率(圆柱段数),默认 60 */
|
|
30
|
+
shaftResolution?: number;
|
|
31
|
+
/** 箭杆半径,默认 0.01 */
|
|
32
|
+
shaftRadius?: number;
|
|
33
|
+
/** 方向指示器 X轴颜色 [r, g, b],默认 [255, 150, 150] */
|
|
34
|
+
orientationXAxisColor?: RGBColor;
|
|
35
|
+
/** 方向指示器 Y轴颜色 [r, g, b],默认 [150, 255, 150] */
|
|
36
|
+
orientationYAxisColor?: RGBColor;
|
|
37
|
+
/** 方向指示器 Z轴颜色 [r, g, b],默认 [150, 150, 255] */
|
|
38
|
+
orientationZAxisColor?: RGBColor;
|
|
39
|
+
/** 原点坐标轴 X轴颜色 [r, g, b],默认 [255, 0, 0] */
|
|
40
|
+
originXAxisColor?: RGBColor;
|
|
41
|
+
/** 原点坐标轴 Y轴颜色 [r, g, b],默认 [0, 255, 0] */
|
|
42
|
+
originYAxisColor?: RGBColor;
|
|
43
|
+
/** 原点坐标轴 Z轴颜色 [r, g, b],默认 [0, 0, 255] */
|
|
44
|
+
originZAxisColor?: RGBColor;
|
|
45
|
+
/** 原点坐标轴长度占场景对角线的比例 (0~1),默认 0.2 */
|
|
46
|
+
originAxisScaleRatio?: number;
|
|
47
|
+
}
|
|
48
|
+
export declare class AxesPlugin extends PluginBase<AxesPluginConfig> implements IToolbarPlugin, IResettableActions {
|
|
49
|
+
readonly metadata: {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
type: "toolbar";
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
readonly order = 2;
|
|
56
|
+
readonly defaultConfig: AxesPluginConfig;
|
|
57
|
+
/** 当前坐标系模式(响应式) */
|
|
58
|
+
private coordinateMode;
|
|
59
|
+
/** 是否显示坐标系(computed) */
|
|
60
|
+
private showAxes;
|
|
61
|
+
/** VTK.js OrientationMarkerWidget 实例(右下角方向指示器) */
|
|
62
|
+
private orientationWidget;
|
|
63
|
+
/** 原点坐标轴 Actor(世界坐标系) */
|
|
64
|
+
private originAxesActor;
|
|
65
|
+
protected onInit(): void;
|
|
66
|
+
/** 视口角落名称到 VTK.js Corners 枚举的映射 */
|
|
67
|
+
private static readonly CORNER_MAP;
|
|
68
|
+
/**
|
|
69
|
+
* 初始化坐标系系统
|
|
70
|
+
* 在渲染管线就绪后调用,确保 renderWindow/renderer 可用
|
|
71
|
+
*/
|
|
72
|
+
private initCoordinateSystem;
|
|
73
|
+
/**
|
|
74
|
+
* 应用坐标系模式
|
|
75
|
+
*/
|
|
76
|
+
private applyCoordinateMode;
|
|
77
|
+
/**
|
|
78
|
+
* 更新原点坐标轴缩放比例
|
|
79
|
+
* 根据场景边界自动计算合适的坐标轴大小
|
|
80
|
+
*/
|
|
81
|
+
private updateOriginAxesScale;
|
|
82
|
+
/**
|
|
83
|
+
* 循环切换坐标系模式
|
|
84
|
+
*/
|
|
85
|
+
private toggleAxes;
|
|
86
|
+
/** 释放 VTK.js 资源和事件监听器 */
|
|
87
|
+
protected onDispose(): void;
|
|
88
|
+
registerResetActions(): ResetAction[];
|
|
89
|
+
render(): DefineComponent<{}, () => VNode<RendererNode, RendererElement, {
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
}>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
92
|
+
isVisible(): boolean;
|
|
93
|
+
getShortcutConfig(): KeyboardShortcutConfigItem[];
|
|
94
|
+
getKeyboardShortcutActions(): KeyboardShortcutAction[];
|
|
95
|
+
}
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IResettableActions, ResetAction } from '../../../core';
|
|
2
|
+
import { ToolbarPluginConfig, IToolbarPlugin } from '../../types';
|
|
3
|
+
import { PluginBase } from '../../PluginBase';
|
|
4
|
+
import { DefineComponent, VNode, RendererNode, RendererElement, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
5
|
+
/** 背景色插件配置 */
|
|
6
|
+
export interface BackgroundColorPluginConfig extends ToolbarPluginConfig {
|
|
7
|
+
}
|
|
8
|
+
export declare class BackgroundColorPlugin extends PluginBase<BackgroundColorPluginConfig> implements IToolbarPlugin, IResettableActions {
|
|
9
|
+
readonly metadata: {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
type: "toolbar";
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
readonly order = 3;
|
|
16
|
+
readonly defaultConfig: BackgroundColorPluginConfig;
|
|
17
|
+
/** 当前背景色(响应式) */
|
|
18
|
+
private currentColor;
|
|
19
|
+
protected onInit(): void;
|
|
20
|
+
registerResetActions(): ResetAction[];
|
|
21
|
+
render(): DefineComponent<{}, () => VNode<RendererNode, RendererElement, {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
24
|
+
isVisible(): boolean;
|
|
25
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { LanguageOption } from '../../../core';
|
|
3
|
+
import { ToolbarPluginConfig, IToolbarPlugin } from '../../types';
|
|
4
|
+
import { PluginBase } from '../../PluginBase';
|
|
5
|
+
/** 语言切换插件配置 */
|
|
6
|
+
export interface LanguageSwitchPluginConfig extends ToolbarPluginConfig {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 语言切换插件
|
|
10
|
+
* 在工具栏中提供语言切换下拉菜单
|
|
11
|
+
* 选择后通过 I18nManager + EventBus 同步状态
|
|
12
|
+
*/
|
|
13
|
+
export declare class LanguageSwitchPlugin extends PluginBase<LanguageSwitchPluginConfig> implements IToolbarPlugin {
|
|
14
|
+
readonly metadata: {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
type: "toolbar";
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
readonly order = 11;
|
|
21
|
+
readonly defaultConfig: LanguageSwitchPluginConfig;
|
|
22
|
+
/** 下拉菜单是否展开 */
|
|
23
|
+
private isDropdownOpen;
|
|
24
|
+
/** 下拉对齐管理器 */
|
|
25
|
+
private dropdownAlignment;
|
|
26
|
+
protected onInit(): void;
|
|
27
|
+
protected onDispose(): void;
|
|
28
|
+
/** 处理点击外部关闭下拉菜单 */
|
|
29
|
+
private handleOutsideClick;
|
|
30
|
+
/** 切换语言 */
|
|
31
|
+
switchLanguage(locale: string): void;
|
|
32
|
+
/** 设置当前语言(供 VtkViewer 外部同步使用,保持向后兼容) */
|
|
33
|
+
setCurrentLocale(locale: string): void;
|
|
34
|
+
/** 获取当前语言 */
|
|
35
|
+
getCurrentLocale(): string;
|
|
36
|
+
/**
|
|
37
|
+
* 设置可用语言列表(供 VtkViewer props.languages 传入,保持向后兼容)。
|
|
38
|
+
* 委托给 I18nManager。
|
|
39
|
+
*/
|
|
40
|
+
setAvailableLanguages(opts?: LanguageOption[]): void;
|
|
41
|
+
/** 切换下拉菜单 */
|
|
42
|
+
private toggleDropdown;
|
|
43
|
+
render(): Component;
|
|
44
|
+
isVisible(): boolean;
|
|
45
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IResettableActions, ResetAction } from '../../../core';
|
|
2
|
+
import { ToolbarPluginConfig, KeyboardShortcutConfigItem, KeyboardShortcutAction, IToolbarPlugin } from '../../types';
|
|
3
|
+
import { PluginBase } from '../../PluginBase';
|
|
4
|
+
import { DefineComponent, VNode, RendererNode, RendererElement, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
5
|
+
/** 光照强度调节插件配置 */
|
|
6
|
+
export interface LightIntensityPluginConfig extends ToolbarPluginConfig {
|
|
7
|
+
/** 默认光照强度 (0-1, 默认 1.0) */
|
|
8
|
+
defaultIntensity?: number;
|
|
9
|
+
/** 强度步进值 (默认 0.1) */
|
|
10
|
+
step?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class LightIntensityPlugin extends PluginBase<LightIntensityPluginConfig> implements IToolbarPlugin, IResettableActions {
|
|
13
|
+
readonly metadata: {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
type: "toolbar";
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
readonly order = 7;
|
|
20
|
+
readonly defaultConfig: LightIntensityPluginConfig;
|
|
21
|
+
private intensity;
|
|
22
|
+
private panelOpen;
|
|
23
|
+
protected onInit(): void;
|
|
24
|
+
protected onDispose(): void;
|
|
25
|
+
registerResetActions(): ResetAction[];
|
|
26
|
+
/** 获取渲染器中的所有灯光 */
|
|
27
|
+
private getLights;
|
|
28
|
+
/** 应用光照强度到所有灯光 */
|
|
29
|
+
private applyIntensity;
|
|
30
|
+
/** 增加光照强度 */
|
|
31
|
+
increaseIntensity(): void;
|
|
32
|
+
/** 减少光照强度 */
|
|
33
|
+
decreaseIntensity(): void;
|
|
34
|
+
/** 重置光照强度 */
|
|
35
|
+
resetIntensity(): void;
|
|
36
|
+
render(): DefineComponent<{}, () => VNode<RendererNode, RendererElement, {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
}>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
39
|
+
isVisible(): boolean;
|
|
40
|
+
getShortcutConfig(): KeyboardShortcutConfigItem[];
|
|
41
|
+
getKeyboardShortcutActions(): KeyboardShortcutAction[];
|
|
42
|
+
}
|