ice-entity-designer 0.0.31 → 0.0.33
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/README.md +41 -0
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.umd.js +2 -2
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +1 -1
- package/dist/types/flow/FlowDesigner.d.mts +4 -2
- package/dist/types/flow/FlowDesigner.d.ts +4 -2
- package/dist/types/flow/FlowEdge.d.mts +2 -1
- package/dist/types/flow/FlowEdge.d.ts +2 -1
- package/dist/types/index.d.mts +5 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/power/PowerDesigner.d.mts +110 -0
- package/dist/types/power/PowerDesigner.d.ts +110 -0
- package/dist/types/power/power_shapes.d.mts +97 -0
- package/dist/types/power/power_shapes.d.ts +97 -0
- package/dist/types/power/power_voltage.d.mts +33 -0
- package/dist/types/power/power_voltage.d.ts +33 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ICE, SvgExportOptions } from '../ice-render/index.mjs';
|
|
2
2
|
import type { FlowNodeKind } from './FlowNode.mjs';
|
|
3
|
+
import type { FlowPort } from './FlowEdge.mjs';
|
|
3
4
|
/**
|
|
4
5
|
* 流程图文档。
|
|
5
6
|
*
|
|
@@ -84,7 +85,7 @@ export default class FlowDesigner {
|
|
|
84
85
|
protected __emitChange(): void;
|
|
85
86
|
/** 订阅节点的拖拽事件:拖动是画布侧的行为,designer 需要感知才能广播与记历史 */
|
|
86
87
|
protected __attachNodeListeners(node: any): void;
|
|
87
|
-
|
|
88
|
+
protected __detachNodeListeners(node: any): void;
|
|
88
89
|
private __onBeforeMove;
|
|
89
90
|
private __onAfterMove;
|
|
90
91
|
private __endMoveSession;
|
|
@@ -96,7 +97,8 @@ export default class FlowDesigner {
|
|
|
96
97
|
};
|
|
97
98
|
createNode(kind: FlowNodeKind, props?: any): any;
|
|
98
99
|
/** 由节点的插槽位置算出连线端点(引擎按插槽吸附,端点需要给出初始坐标) */
|
|
99
|
-
|
|
100
|
+
/** 取插槽点:`protected` 供域包(如电力一次图)建自己的连线类型时复用 */
|
|
101
|
+
protected __slotPoint(component: any, position: FlowPort): number[];
|
|
100
102
|
createEdge(props?: any): any;
|
|
101
103
|
updateNode(id: string, patch: Record<string, any>): any;
|
|
102
104
|
updateEdge(id: string, patch: Record<string, any>): any;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ICE, SvgExportOptions } from '../ice-render/index';
|
|
2
2
|
import type { FlowNodeKind } from './FlowNode';
|
|
3
|
+
import type { FlowPort } from './FlowEdge';
|
|
3
4
|
/**
|
|
4
5
|
* 流程图文档。
|
|
5
6
|
*
|
|
@@ -84,7 +85,7 @@ export default class FlowDesigner {
|
|
|
84
85
|
protected __emitChange(): void;
|
|
85
86
|
/** 订阅节点的拖拽事件:拖动是画布侧的行为,designer 需要感知才能广播与记历史 */
|
|
86
87
|
protected __attachNodeListeners(node: any): void;
|
|
87
|
-
|
|
88
|
+
protected __detachNodeListeners(node: any): void;
|
|
88
89
|
private __onBeforeMove;
|
|
89
90
|
private __onAfterMove;
|
|
90
91
|
private __endMoveSession;
|
|
@@ -96,7 +97,8 @@ export default class FlowDesigner {
|
|
|
96
97
|
};
|
|
97
98
|
createNode(kind: FlowNodeKind, props?: any): any;
|
|
98
99
|
/** 由节点的插槽位置算出连线端点(引擎按插槽吸附,端点需要给出初始坐标) */
|
|
99
|
-
|
|
100
|
+
/** 取插槽点:`protected` 供域包(如电力一次图)建自己的连线类型时复用 */
|
|
101
|
+
protected __slotPoint(component: any, position: FlowPort): number[];
|
|
100
102
|
createEdge(props?: any): any;
|
|
101
103
|
updateNode(id: string, patch: Record<string, any>): any;
|
|
102
104
|
updateEdge(id: string, patch: Record<string, any>): any;
|
|
@@ -15,7 +15,8 @@ export declare type FlowPort = 'T' | 'R' | 'B' | 'L' | 'C';
|
|
|
15
15
|
* 两端节点的插槽上 —— 节点被拖动时连线自动跟随重新布线。
|
|
16
16
|
*/
|
|
17
17
|
export default class FlowEdge extends ICEVisioLink {
|
|
18
|
-
|
|
18
|
+
/** 稳定类型标识。声明为 `string`(而不是字面量类型):域包可以派生自己的导体类型(如 PowerLine) */
|
|
19
|
+
static readonly typeId: string;
|
|
19
20
|
/** 连线没有子组件;声明派生可保证将来即使加了内部装饰也不会被重复序列化 */
|
|
20
21
|
hasDerivedChildren(): boolean;
|
|
21
22
|
constructor(props?: any);
|
|
@@ -15,7 +15,8 @@ export declare type FlowPort = 'T' | 'R' | 'B' | 'L' | 'C';
|
|
|
15
15
|
* 两端节点的插槽上 —— 节点被拖动时连线自动跟随重新布线。
|
|
16
16
|
*/
|
|
17
17
|
export default class FlowEdge extends ICEVisioLink {
|
|
18
|
-
|
|
18
|
+
/** 稳定类型标识。声明为 `string`(而不是字面量类型):域包可以派生自己的导体类型(如 PowerLine) */
|
|
19
|
+
static readonly typeId: string;
|
|
19
20
|
/** 连线没有子组件;声明派生可保证将来即使加了内部装饰也不会被重复序列化 */
|
|
20
21
|
hasDerivedChildren(): boolean;
|
|
21
22
|
constructor(props?: any);
|
package/dist/types/index.d.mts
CHANGED
|
@@ -48,6 +48,11 @@ export { default as GanttDesigner } from './gantt/GanttDesigner.mjs';
|
|
|
48
48
|
export type { GanttIssue, GanttTaskInput } from './gantt/GanttDesigner.mjs';
|
|
49
49
|
export { toMermaidGantt, fromMermaidGantt } from './gantt/gantt_text.mjs';
|
|
50
50
|
export type { GanttTextImportResult } from './gantt/gantt_text.mjs';
|
|
51
|
+
export { default as PowerSymbol, POWER_SYMBOL_KINDS, POWER_SYMBOL_PRESETS, POWER_STYLE } from './power/power_shapes.mjs';
|
|
52
|
+
export type { PowerSymbolKind } from './power/power_shapes.mjs';
|
|
53
|
+
export { default as PowerDesigner, PowerLine } from './power/PowerDesigner.mjs';
|
|
54
|
+
export type { PowerIssue, PowerTopology } from './power/PowerDesigner.mjs';
|
|
55
|
+
export { POWER_VOLTAGE_LEVELS, voltageColorOf, defaultVoltageColors } from './power/power_voltage.mjs';
|
|
51
56
|
export { parseDate, formatDate, addDays, diffDays, eachDay, tickLabel } from './gantt/gantt_date.mjs';
|
|
52
57
|
export { toPlantUml, fromPlantUml, arrowOf, detectUmlDialect } from './uml/uml_text.mjs';
|
|
53
58
|
export type { UmlTextImportResult } from './uml/uml_text.mjs';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -48,6 +48,11 @@ export { default as GanttDesigner } from './gantt/GanttDesigner';
|
|
|
48
48
|
export type { GanttIssue, GanttTaskInput } from './gantt/GanttDesigner';
|
|
49
49
|
export { toMermaidGantt, fromMermaidGantt } from './gantt/gantt_text';
|
|
50
50
|
export type { GanttTextImportResult } from './gantt/gantt_text';
|
|
51
|
+
export { default as PowerSymbol, POWER_SYMBOL_KINDS, POWER_SYMBOL_PRESETS, POWER_STYLE } from './power/power_shapes';
|
|
52
|
+
export type { PowerSymbolKind } from './power/power_shapes';
|
|
53
|
+
export { default as PowerDesigner, PowerLine } from './power/PowerDesigner';
|
|
54
|
+
export type { PowerIssue, PowerTopology } from './power/PowerDesigner';
|
|
55
|
+
export { POWER_VOLTAGE_LEVELS, voltageColorOf, defaultVoltageColors } from './power/power_voltage';
|
|
51
56
|
export { parseDate, formatDate, addDays, diffDays, eachDay, tickLabel } from './gantt/gantt_date';
|
|
52
57
|
export { toPlantUml, fromPlantUml, arrowOf, detectUmlDialect } from './uml/uml_text';
|
|
53
58
|
export type { UmlTextImportResult } from './uml/uml_text';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import FlowDesigner from '../flow/FlowDesigner.mjs';
|
|
9
|
+
import FlowEdge from '../flow/FlowEdge.mjs';
|
|
10
|
+
import type { PowerSymbolKind, PowerSwitchState } from './power_shapes.mjs';
|
|
11
|
+
export declare type PowerIssue = {
|
|
12
|
+
level: 'error' | 'warning';
|
|
13
|
+
message: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 母线接间隔的几何约定:设备**顶部引线**贴在母线中心线下方这么多像素。
|
|
18
|
+
*
|
|
19
|
+
* 方案 A(零引擎改动):母线当容器,挂在它上面的间隔用「几何贴合 + 父容器」表达等电位,
|
|
20
|
+
* 不再需要从母线中心拉一条绕行导体。评估见 `ice-render/docs/architecture/16-link-port-evaluation.md`。
|
|
21
|
+
*/
|
|
22
|
+
export declare const POWER_BUS_ATTACH_GAP = 3;
|
|
23
|
+
/** 判定「仍然挂在母线上」的纵向容差(拖离出这个范围就算断开,走校验提示) */
|
|
24
|
+
export declare const POWER_BUS_ATTACH_TOLERANCE = 8;
|
|
25
|
+
export declare type PowerTopology = {
|
|
26
|
+
/** 带电的设备 id(从电源点出发,只经过处于合位的开关) */
|
|
27
|
+
energized: string[];
|
|
28
|
+
/**
|
|
29
|
+
* 电气连通域(**忽略开关分合**:按「开关全合」算),用于结构检查
|
|
30
|
+
* (比如「这条母线所在连通域里有没有电源」)。
|
|
31
|
+
*/
|
|
32
|
+
islands: string[][];
|
|
33
|
+
};
|
|
34
|
+
/** 一次系统图的导线(导体)—— 复用引擎折线,颜色跟电压等级走 */
|
|
35
|
+
export declare class PowerLine extends FlowEdge {
|
|
36
|
+
static readonly typeId = "PowerLine";
|
|
37
|
+
constructor(props?: any);
|
|
38
|
+
/** 电压等级 → 线色(不标等级时用中性色) */
|
|
39
|
+
applyVoltageColor(table?: Record<string, string>): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @class PowerDesigner 电力一次系统图(单线图)设计器
|
|
43
|
+
*
|
|
44
|
+
* 域包的应用层,只做四件事,其余(选择 / 增删改 / 连线 / 撤销重做 / 快照 / 适应视图 / 订阅)
|
|
45
|
+
* 全部继承 `FlowDesigner`:
|
|
46
|
+
*
|
|
47
|
+
* 1. 建电力图元(`PowerSymbol`)与导体(`PowerLine`);
|
|
48
|
+
* 2. **运行态**:开关分合、带电状态写回(供色标与状态标签用);
|
|
49
|
+
* 3. **拓扑**:导电岛 / 带电范围(从电源点出发,只经过合位开关);
|
|
50
|
+
* 4. **语义校验**:设备名唯一、电压等级一致(变压器两侧例外)、母线要有进线、
|
|
51
|
+
* 断路器两侧应有隔离开关,以及两条与「五防」直接相关的规则
|
|
52
|
+
* (**带电合接地刀闸**、**带接地线合闸送电**)。
|
|
53
|
+
*/
|
|
54
|
+
export default class PowerDesigner extends FlowDesigner {
|
|
55
|
+
/** 色标表(可被公司规范覆盖) */
|
|
56
|
+
voltageColors: Record<string, string>;
|
|
57
|
+
constructor(ice: any);
|
|
58
|
+
get nodes(): any[];
|
|
59
|
+
get edges(): any[];
|
|
60
|
+
/** 覆盖电压等级色标(各电网公司规范不同) */
|
|
61
|
+
setVoltageColors(table: Record<string, string>): void;
|
|
62
|
+
/** 建一个电力设备(母线/断路器/隔离开关/互感器/变压器…) */
|
|
63
|
+
createSymbol(kind: PowerSymbolKind, props?: any): any;
|
|
64
|
+
/** 建一段导体(一次图里的导线) */
|
|
65
|
+
createLine(props?: any): any;
|
|
66
|
+
/** 开关分 / 合(运行态操作) */
|
|
67
|
+
setSwitchState(id: string, switchState: PowerSwitchState): any;
|
|
68
|
+
/** 标记 / 取消电源点(发电机、进线、主变电源侧…) */
|
|
69
|
+
setEnergizedSource(id: string, enabled: boolean): any;
|
|
70
|
+
/**
|
|
71
|
+
* 算拓扑并把带电状态写回节点(`energized`)—— 色标与状态标签据此着色。
|
|
72
|
+
*
|
|
73
|
+
* 规则:从电源点出发做 BFS;**只有合位的开关**才允许电流继续往外走
|
|
74
|
+
* (开关自身在分位时仍然算带电,因为它的一端接着电源)。
|
|
75
|
+
*/
|
|
76
|
+
applyTopology(): PowerTopology;
|
|
77
|
+
/** 拓扑分析(不改模型,只算) */
|
|
78
|
+
topology(): PowerTopology;
|
|
79
|
+
/** 语义校验(结构 + 电压等级 + 与五防相关的两条运行规则) */
|
|
80
|
+
validatePower(): PowerIssue[];
|
|
81
|
+
/**
|
|
82
|
+
* 把设备挂到母线上(母线 T 接)。
|
|
83
|
+
*
|
|
84
|
+
* 落地形态(方案 A 的精化版,见 `ice-render/docs/architecture/16-link-port-evaluation.md`):
|
|
85
|
+
* **不把设备变成母线的子节点** —— 复合组件的 `hasDerivedChildren() === true` 会让序列化器
|
|
86
|
+
* 跳过全部子节点,嵌套会让挂上去的设备在快照里直接丢失(实测 23 → 15)。
|
|
87
|
+
* 改成三件事:
|
|
88
|
+
*
|
|
89
|
+
* 1. 设备 state 里记 `attachedBusId`(普通字段,随快照往返);
|
|
90
|
+
* 2. 位置按「顶部引线贴住母线中心线下方 POWER_BUS_ATTACH_GAP 处」摆放;
|
|
91
|
+
* 3. 拖动母线时由应用层把挂上去的设备一起平移(`__followBusMove`),
|
|
92
|
+
* 设备之间的导体本来就会跟随宿主(引擎能力),所以整条间隔会跟着走。
|
|
93
|
+
*
|
|
94
|
+
* 电气语义:拓扑把「attachedBusId 指向的母线 **且** 几何仍然贴合」当成一条隐式连接,
|
|
95
|
+
* 所以把设备拖开就自动断开,不需要额外的「断开」操作。
|
|
96
|
+
*/
|
|
97
|
+
attachToBus(deviceOrId: any, busOrId: any, options?: {
|
|
98
|
+
centerX?: number;
|
|
99
|
+
}): any;
|
|
100
|
+
/** 设备挂在哪条母线上(按 `attachedBusId` 解析;不要求几何仍然贴合) */
|
|
101
|
+
attachedBusOf(device: any): any;
|
|
102
|
+
/** 设备是否**真的**还挂在母线上(记录 + 几何贴合 + 横向仍落在母线段内;拖离后为 false) */
|
|
103
|
+
isAttachedToBus(device: any): boolean;
|
|
104
|
+
/** 解除母线 T 接(设备留在原地,只是不再等电位) */
|
|
105
|
+
detachFromBus(deviceOrId: any): any;
|
|
106
|
+
/** 母线移动时,把挂在它上面的设备一起平移(应用层补上「容器」那部分行为) */
|
|
107
|
+
private __watchBusMove;
|
|
108
|
+
private __buildAdjacency;
|
|
109
|
+
private __symbolById;
|
|
110
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import FlowDesigner from '../flow/FlowDesigner';
|
|
9
|
+
import FlowEdge from '../flow/FlowEdge';
|
|
10
|
+
import type { PowerSymbolKind, PowerSwitchState } from './power_shapes';
|
|
11
|
+
export declare type PowerIssue = {
|
|
12
|
+
level: 'error' | 'warning';
|
|
13
|
+
message: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* 母线接间隔的几何约定:设备**顶部引线**贴在母线中心线下方这么多像素。
|
|
18
|
+
*
|
|
19
|
+
* 方案 A(零引擎改动):母线当容器,挂在它上面的间隔用「几何贴合 + 父容器」表达等电位,
|
|
20
|
+
* 不再需要从母线中心拉一条绕行导体。评估见 `ice-render/docs/architecture/16-link-port-evaluation.md`。
|
|
21
|
+
*/
|
|
22
|
+
export declare const POWER_BUS_ATTACH_GAP = 3;
|
|
23
|
+
/** 判定「仍然挂在母线上」的纵向容差(拖离出这个范围就算断开,走校验提示) */
|
|
24
|
+
export declare const POWER_BUS_ATTACH_TOLERANCE = 8;
|
|
25
|
+
export declare type PowerTopology = {
|
|
26
|
+
/** 带电的设备 id(从电源点出发,只经过处于合位的开关) */
|
|
27
|
+
energized: string[];
|
|
28
|
+
/**
|
|
29
|
+
* 电气连通域(**忽略开关分合**:按「开关全合」算),用于结构检查
|
|
30
|
+
* (比如「这条母线所在连通域里有没有电源」)。
|
|
31
|
+
*/
|
|
32
|
+
islands: string[][];
|
|
33
|
+
};
|
|
34
|
+
/** 一次系统图的导线(导体)—— 复用引擎折线,颜色跟电压等级走 */
|
|
35
|
+
export declare class PowerLine extends FlowEdge {
|
|
36
|
+
static readonly typeId = "PowerLine";
|
|
37
|
+
constructor(props?: any);
|
|
38
|
+
/** 电压等级 → 线色(不标等级时用中性色) */
|
|
39
|
+
applyVoltageColor(table?: Record<string, string>): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @class PowerDesigner 电力一次系统图(单线图)设计器
|
|
43
|
+
*
|
|
44
|
+
* 域包的应用层,只做四件事,其余(选择 / 增删改 / 连线 / 撤销重做 / 快照 / 适应视图 / 订阅)
|
|
45
|
+
* 全部继承 `FlowDesigner`:
|
|
46
|
+
*
|
|
47
|
+
* 1. 建电力图元(`PowerSymbol`)与导体(`PowerLine`);
|
|
48
|
+
* 2. **运行态**:开关分合、带电状态写回(供色标与状态标签用);
|
|
49
|
+
* 3. **拓扑**:导电岛 / 带电范围(从电源点出发,只经过合位开关);
|
|
50
|
+
* 4. **语义校验**:设备名唯一、电压等级一致(变压器两侧例外)、母线要有进线、
|
|
51
|
+
* 断路器两侧应有隔离开关,以及两条与「五防」直接相关的规则
|
|
52
|
+
* (**带电合接地刀闸**、**带接地线合闸送电**)。
|
|
53
|
+
*/
|
|
54
|
+
export default class PowerDesigner extends FlowDesigner {
|
|
55
|
+
/** 色标表(可被公司规范覆盖) */
|
|
56
|
+
voltageColors: Record<string, string>;
|
|
57
|
+
constructor(ice: any);
|
|
58
|
+
get nodes(): any[];
|
|
59
|
+
get edges(): any[];
|
|
60
|
+
/** 覆盖电压等级色标(各电网公司规范不同) */
|
|
61
|
+
setVoltageColors(table: Record<string, string>): void;
|
|
62
|
+
/** 建一个电力设备(母线/断路器/隔离开关/互感器/变压器…) */
|
|
63
|
+
createSymbol(kind: PowerSymbolKind, props?: any): any;
|
|
64
|
+
/** 建一段导体(一次图里的导线) */
|
|
65
|
+
createLine(props?: any): any;
|
|
66
|
+
/** 开关分 / 合(运行态操作) */
|
|
67
|
+
setSwitchState(id: string, switchState: PowerSwitchState): any;
|
|
68
|
+
/** 标记 / 取消电源点(发电机、进线、主变电源侧…) */
|
|
69
|
+
setEnergizedSource(id: string, enabled: boolean): any;
|
|
70
|
+
/**
|
|
71
|
+
* 算拓扑并把带电状态写回节点(`energized`)—— 色标与状态标签据此着色。
|
|
72
|
+
*
|
|
73
|
+
* 规则:从电源点出发做 BFS;**只有合位的开关**才允许电流继续往外走
|
|
74
|
+
* (开关自身在分位时仍然算带电,因为它的一端接着电源)。
|
|
75
|
+
*/
|
|
76
|
+
applyTopology(): PowerTopology;
|
|
77
|
+
/** 拓扑分析(不改模型,只算) */
|
|
78
|
+
topology(): PowerTopology;
|
|
79
|
+
/** 语义校验(结构 + 电压等级 + 与五防相关的两条运行规则) */
|
|
80
|
+
validatePower(): PowerIssue[];
|
|
81
|
+
/**
|
|
82
|
+
* 把设备挂到母线上(母线 T 接)。
|
|
83
|
+
*
|
|
84
|
+
* 落地形态(方案 A 的精化版,见 `ice-render/docs/architecture/16-link-port-evaluation.md`):
|
|
85
|
+
* **不把设备变成母线的子节点** —— 复合组件的 `hasDerivedChildren() === true` 会让序列化器
|
|
86
|
+
* 跳过全部子节点,嵌套会让挂上去的设备在快照里直接丢失(实测 23 → 15)。
|
|
87
|
+
* 改成三件事:
|
|
88
|
+
*
|
|
89
|
+
* 1. 设备 state 里记 `attachedBusId`(普通字段,随快照往返);
|
|
90
|
+
* 2. 位置按「顶部引线贴住母线中心线下方 POWER_BUS_ATTACH_GAP 处」摆放;
|
|
91
|
+
* 3. 拖动母线时由应用层把挂上去的设备一起平移(`__followBusMove`),
|
|
92
|
+
* 设备之间的导体本来就会跟随宿主(引擎能力),所以整条间隔会跟着走。
|
|
93
|
+
*
|
|
94
|
+
* 电气语义:拓扑把「attachedBusId 指向的母线 **且** 几何仍然贴合」当成一条隐式连接,
|
|
95
|
+
* 所以把设备拖开就自动断开,不需要额外的「断开」操作。
|
|
96
|
+
*/
|
|
97
|
+
attachToBus(deviceOrId: any, busOrId: any, options?: {
|
|
98
|
+
centerX?: number;
|
|
99
|
+
}): any;
|
|
100
|
+
/** 设备挂在哪条母线上(按 `attachedBusId` 解析;不要求几何仍然贴合) */
|
|
101
|
+
attachedBusOf(device: any): any;
|
|
102
|
+
/** 设备是否**真的**还挂在母线上(记录 + 几何贴合 + 横向仍落在母线段内;拖离后为 false) */
|
|
103
|
+
isAttachedToBus(device: any): boolean;
|
|
104
|
+
/** 解除母线 T 接(设备留在原地,只是不再等电位) */
|
|
105
|
+
detachFromBus(deviceOrId: any): any;
|
|
106
|
+
/** 母线移动时,把挂在它上面的设备一起平移(应用层补上「容器」那部分行为) */
|
|
107
|
+
private __watchBusMove;
|
|
108
|
+
private __buildAdjacency;
|
|
109
|
+
private __symbolById;
|
|
110
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 电力一次系统图(单线图)符号库。
|
|
10
|
+
*
|
|
11
|
+
* **记法来源**(不凭印象画,逐个符号对着标准图例核过):
|
|
12
|
+
* - JB/T 5872-1991《高压开关设备电气图形及文字符号》—— 3kV 及以上高压开关设备的图形符号与文字符号,
|
|
13
|
+
* 本文件里的 QF / QS / QL / QE / TA / TV / TM / FU / F / L / E 等记法都出自它;
|
|
14
|
+
* - GB/T 4728 系列《电气简图用图形符号》(等同采用 IEC 60617)—— 通用图形符号体系,第 7 部分为
|
|
15
|
+
* 开关、控制和保护器件;其中一条通用规则是:**开关电器的可动部分按「无激励、无外力」的正常状态绘制**。
|
|
16
|
+
* - 调度编号(设备命名,《电力系统部分设备统一编号准则》SD 240-87、母线 #1M 之类)是**另一层**,
|
|
17
|
+
* 属于设备命名而不是图形记法,本包用 `tag`(图形符号旁的文字符号)与之并存。
|
|
18
|
+
*
|
|
19
|
+
* **外观统一**:所有符号共用同一套描边色 / 线宽 / 文字符号字号与位置、统一端子在上下(T/B),
|
|
20
|
+
* 尺寸也按同一套基准走(见 `POWER_STYLE` 与各 preset 的 width/height)。
|
|
21
|
+
*/
|
|
22
|
+
import { ICEGroup } from '../ice-render/index.mjs';
|
|
23
|
+
export declare const POWER_SYMBOL_KINDS: readonly ["busbar", "breaker", "disconnector", "loadSwitch", "earthingSwitch", "earth", "currentTransformer", "voltageTransformer", "transformer", "fuse", "arrester", "reactor", "generator", "motor", "load"];
|
|
24
|
+
export declare type PowerSymbolKind = (typeof POWER_SYMBOL_KINDS)[number];
|
|
25
|
+
declare type PowerSymbolPreset = {
|
|
26
|
+
/** 中文名(属性面板 / 图例用) */
|
|
27
|
+
label: string;
|
|
28
|
+
/** 图形符号旁的文字符号(JB/T 5872 / GB/T 7159 口径) */
|
|
29
|
+
tag: string;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
/** 是否串联在导线上(母线/接地这类不串联的例外) */
|
|
33
|
+
inline: boolean;
|
|
34
|
+
};
|
|
35
|
+
/** 文字符号取自 JB/T 5872-1991 的「图形符号 + 文字符号」对照表 */
|
|
36
|
+
export declare const POWER_SYMBOL_PRESETS: Record<PowerSymbolKind, PowerSymbolPreset>;
|
|
37
|
+
/** 全局外观基准:所有符号共用,保证「一张图上不花」 */
|
|
38
|
+
export declare const POWER_STYLE: {
|
|
39
|
+
/** 符号描边色(近黑的石板色,不用纯黑,缩放/打印都不刺眼) */
|
|
40
|
+
strokeStyle: string;
|
|
41
|
+
/** 引线(导线)与符号本体同一线宽 */
|
|
42
|
+
lineWidth: number;
|
|
43
|
+
/** 接地/母线这类「加粗」元素用更粗的线 */
|
|
44
|
+
heavyLineWidth: number;
|
|
45
|
+
/** 文字符号(QF/QS…)的字号与颜色 */
|
|
46
|
+
tagFontSize: number;
|
|
47
|
+
tagColor: string;
|
|
48
|
+
/** 圆内字母(G / M)的字号 */
|
|
49
|
+
letterFontSize: number;
|
|
50
|
+
/** 明确不带电时的颜色(只有算过拓扑 `energized: false` 才会用到) */
|
|
51
|
+
deEnergizedColor: string;
|
|
52
|
+
/** 设备名 / 编号标注的字号与颜色 */
|
|
53
|
+
nameFontSize: number;
|
|
54
|
+
nameColor: string;
|
|
55
|
+
/** 开关状态标签(合 / 分)的字号 */
|
|
56
|
+
stateFontSize: number;
|
|
57
|
+
};
|
|
58
|
+
/** 有分 / 合状态的开关电器(其余是静止设备) */
|
|
59
|
+
export declare const POWER_SWITCH_KINDS: PowerSymbolKind[];
|
|
60
|
+
export declare type PowerSwitchState = 'open' | 'closed';
|
|
61
|
+
/**
|
|
62
|
+
* @class PowerSymbol 电力一次系统图的图元(复合组件)
|
|
63
|
+
*
|
|
64
|
+
* 与其它域包同一套做法:内部形状按 `kind` 派生(`hasDerivedChildren() === true`),不进文档、载入时重建。
|
|
65
|
+
* 每个派生部件都带一个稳定的 `role`(`blade` / `arcMark` / `earth` …),测试与属性面板按 role 认部件,
|
|
66
|
+
* **不用位置去猜**。
|
|
67
|
+
*/
|
|
68
|
+
export default class PowerSymbol extends ICEGroup {
|
|
69
|
+
static readonly typeId = "PowerSymbol";
|
|
70
|
+
/** 派生部件:`{ role, component }` 列表(按添加顺序) */
|
|
71
|
+
parts: Array<{
|
|
72
|
+
role: string;
|
|
73
|
+
component: any;
|
|
74
|
+
}>;
|
|
75
|
+
hasDerivedChildren(): boolean;
|
|
76
|
+
constructor(props?: any);
|
|
77
|
+
protected static arrangeParam(props?: any): any;
|
|
78
|
+
private static readonly __shapeKeys;
|
|
79
|
+
setState(patch: any): void;
|
|
80
|
+
applyPatch(patch?: any): void;
|
|
81
|
+
/** 取某个角色的派生部件(测试/属性面板用) */
|
|
82
|
+
part(role: string): any;
|
|
83
|
+
/** 按 `kind` 重建内部形状与文字符号 */
|
|
84
|
+
protected syncShape(): void;
|
|
85
|
+
/** 接地符号:三条递减横线 */
|
|
86
|
+
private __earth;
|
|
87
|
+
private __add;
|
|
88
|
+
/**
|
|
89
|
+
* 只清「派生部件」,**不能**清 `childNodes` 全集。
|
|
90
|
+
*
|
|
91
|
+
* 母线同时扮演容器(间隔作为真实子节点挂在它上面),如果这里把 childNodes 全删掉,
|
|
92
|
+
* 每次重建记法都会连挂在母线上的间隔一起删掉(`removeChild` 内部会 `destory()`)。
|
|
93
|
+
* 派生部件在 `parts` 里有登记,按登记删即可。
|
|
94
|
+
*/
|
|
95
|
+
private __clearParts;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 电力一次系统图(单线图)符号库。
|
|
10
|
+
*
|
|
11
|
+
* **记法来源**(不凭印象画,逐个符号对着标准图例核过):
|
|
12
|
+
* - JB/T 5872-1991《高压开关设备电气图形及文字符号》—— 3kV 及以上高压开关设备的图形符号与文字符号,
|
|
13
|
+
* 本文件里的 QF / QS / QL / QE / TA / TV / TM / FU / F / L / E 等记法都出自它;
|
|
14
|
+
* - GB/T 4728 系列《电气简图用图形符号》(等同采用 IEC 60617)—— 通用图形符号体系,第 7 部分为
|
|
15
|
+
* 开关、控制和保护器件;其中一条通用规则是:**开关电器的可动部分按「无激励、无外力」的正常状态绘制**。
|
|
16
|
+
* - 调度编号(设备命名,《电力系统部分设备统一编号准则》SD 240-87、母线 #1M 之类)是**另一层**,
|
|
17
|
+
* 属于设备命名而不是图形记法,本包用 `tag`(图形符号旁的文字符号)与之并存。
|
|
18
|
+
*
|
|
19
|
+
* **外观统一**:所有符号共用同一套描边色 / 线宽 / 文字符号字号与位置、统一端子在上下(T/B),
|
|
20
|
+
* 尺寸也按同一套基准走(见 `POWER_STYLE` 与各 preset 的 width/height)。
|
|
21
|
+
*/
|
|
22
|
+
import { ICEGroup } from '../ice-render/index';
|
|
23
|
+
export declare const POWER_SYMBOL_KINDS: readonly ["busbar", "breaker", "disconnector", "loadSwitch", "earthingSwitch", "earth", "currentTransformer", "voltageTransformer", "transformer", "fuse", "arrester", "reactor", "generator", "motor", "load"];
|
|
24
|
+
export declare type PowerSymbolKind = (typeof POWER_SYMBOL_KINDS)[number];
|
|
25
|
+
declare type PowerSymbolPreset = {
|
|
26
|
+
/** 中文名(属性面板 / 图例用) */
|
|
27
|
+
label: string;
|
|
28
|
+
/** 图形符号旁的文字符号(JB/T 5872 / GB/T 7159 口径) */
|
|
29
|
+
tag: string;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
/** 是否串联在导线上(母线/接地这类不串联的例外) */
|
|
33
|
+
inline: boolean;
|
|
34
|
+
};
|
|
35
|
+
/** 文字符号取自 JB/T 5872-1991 的「图形符号 + 文字符号」对照表 */
|
|
36
|
+
export declare const POWER_SYMBOL_PRESETS: Record<PowerSymbolKind, PowerSymbolPreset>;
|
|
37
|
+
/** 全局外观基准:所有符号共用,保证「一张图上不花」 */
|
|
38
|
+
export declare const POWER_STYLE: {
|
|
39
|
+
/** 符号描边色(近黑的石板色,不用纯黑,缩放/打印都不刺眼) */
|
|
40
|
+
strokeStyle: string;
|
|
41
|
+
/** 引线(导线)与符号本体同一线宽 */
|
|
42
|
+
lineWidth: number;
|
|
43
|
+
/** 接地/母线这类「加粗」元素用更粗的线 */
|
|
44
|
+
heavyLineWidth: number;
|
|
45
|
+
/** 文字符号(QF/QS…)的字号与颜色 */
|
|
46
|
+
tagFontSize: number;
|
|
47
|
+
tagColor: string;
|
|
48
|
+
/** 圆内字母(G / M)的字号 */
|
|
49
|
+
letterFontSize: number;
|
|
50
|
+
/** 明确不带电时的颜色(只有算过拓扑 `energized: false` 才会用到) */
|
|
51
|
+
deEnergizedColor: string;
|
|
52
|
+
/** 设备名 / 编号标注的字号与颜色 */
|
|
53
|
+
nameFontSize: number;
|
|
54
|
+
nameColor: string;
|
|
55
|
+
/** 开关状态标签(合 / 分)的字号 */
|
|
56
|
+
stateFontSize: number;
|
|
57
|
+
};
|
|
58
|
+
/** 有分 / 合状态的开关电器(其余是静止设备) */
|
|
59
|
+
export declare const POWER_SWITCH_KINDS: PowerSymbolKind[];
|
|
60
|
+
export declare type PowerSwitchState = 'open' | 'closed';
|
|
61
|
+
/**
|
|
62
|
+
* @class PowerSymbol 电力一次系统图的图元(复合组件)
|
|
63
|
+
*
|
|
64
|
+
* 与其它域包同一套做法:内部形状按 `kind` 派生(`hasDerivedChildren() === true`),不进文档、载入时重建。
|
|
65
|
+
* 每个派生部件都带一个稳定的 `role`(`blade` / `arcMark` / `earth` …),测试与属性面板按 role 认部件,
|
|
66
|
+
* **不用位置去猜**。
|
|
67
|
+
*/
|
|
68
|
+
export default class PowerSymbol extends ICEGroup {
|
|
69
|
+
static readonly typeId = "PowerSymbol";
|
|
70
|
+
/** 派生部件:`{ role, component }` 列表(按添加顺序) */
|
|
71
|
+
parts: Array<{
|
|
72
|
+
role: string;
|
|
73
|
+
component: any;
|
|
74
|
+
}>;
|
|
75
|
+
hasDerivedChildren(): boolean;
|
|
76
|
+
constructor(props?: any);
|
|
77
|
+
protected static arrangeParam(props?: any): any;
|
|
78
|
+
private static readonly __shapeKeys;
|
|
79
|
+
setState(patch: any): void;
|
|
80
|
+
applyPatch(patch?: any): void;
|
|
81
|
+
/** 取某个角色的派生部件(测试/属性面板用) */
|
|
82
|
+
part(role: string): any;
|
|
83
|
+
/** 按 `kind` 重建内部形状与文字符号 */
|
|
84
|
+
protected syncShape(): void;
|
|
85
|
+
/** 接地符号:三条递减横线 */
|
|
86
|
+
private __earth;
|
|
87
|
+
private __add;
|
|
88
|
+
/**
|
|
89
|
+
* 只清「派生部件」,**不能**清 `childNodes` 全集。
|
|
90
|
+
*
|
|
91
|
+
* 母线同时扮演容器(间隔作为真实子节点挂在它上面),如果这里把 childNodes 全删掉,
|
|
92
|
+
* 每次重建记法都会连挂在母线上的间隔一起删掉(`removeChild` 内部会 `destory()`)。
|
|
93
|
+
* 派生部件在 `parts` 里有登记,按登记删即可。
|
|
94
|
+
*/
|
|
95
|
+
private __clearParts;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 电压等级与色标。
|
|
10
|
+
*
|
|
11
|
+
* 电力行业习惯用颜色区分电压等级,但**各电网公司/各设计院的规范并不统一**,
|
|
12
|
+
* 所以这里给的是**可覆盖的默认值**(按公开资料里流传较广的一套命名:
|
|
13
|
+
* 500kV 淡黄、220kV 紫、110kV 朱红、35kV 鲜黄、10kV 绛红、6kV 深蓝),
|
|
14
|
+
* 颜色名对应的是行业称呼,hex 是近似值 —— 需要贴合某家公司规范时,
|
|
15
|
+
* 用 `PowerDesigner.setVoltageColors({ '110kV': '#xxxxxx' })` 覆盖即可。
|
|
16
|
+
*/
|
|
17
|
+
export declare type PowerVoltageLevel = {
|
|
18
|
+
/** 等级标识:'500kV' / '220kV' / '110kV' / '35kV' / '10kV' / '6kV' */
|
|
19
|
+
level: string;
|
|
20
|
+
/** 行业里的颜色称呼 */
|
|
21
|
+
colorName: string;
|
|
22
|
+
/** 近似的 hex 值(可被覆盖) */
|
|
23
|
+
color: string;
|
|
24
|
+
/** 标称电压(kV),用于排序与展示 */
|
|
25
|
+
kv: number;
|
|
26
|
+
};
|
|
27
|
+
export declare const POWER_VOLTAGE_LEVELS: PowerVoltageLevel[];
|
|
28
|
+
/** 未标注电压等级时用的中性色(不参与色标语义) */
|
|
29
|
+
export declare const POWER_NEUTRAL_COLOR = "#1f2937";
|
|
30
|
+
/** 默认色标表(level → color) */
|
|
31
|
+
export declare function defaultVoltageColors(): Record<string, string>;
|
|
32
|
+
/** 按等级取颜色;没标等级或等级不认识时回落到中性色 */
|
|
33
|
+
export declare function voltageColorOf(level: string, table?: Record<string, string>): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 电压等级与色标。
|
|
10
|
+
*
|
|
11
|
+
* 电力行业习惯用颜色区分电压等级,但**各电网公司/各设计院的规范并不统一**,
|
|
12
|
+
* 所以这里给的是**可覆盖的默认值**(按公开资料里流传较广的一套命名:
|
|
13
|
+
* 500kV 淡黄、220kV 紫、110kV 朱红、35kV 鲜黄、10kV 绛红、6kV 深蓝),
|
|
14
|
+
* 颜色名对应的是行业称呼,hex 是近似值 —— 需要贴合某家公司规范时,
|
|
15
|
+
* 用 `PowerDesigner.setVoltageColors({ '110kV': '#xxxxxx' })` 覆盖即可。
|
|
16
|
+
*/
|
|
17
|
+
export declare type PowerVoltageLevel = {
|
|
18
|
+
/** 等级标识:'500kV' / '220kV' / '110kV' / '35kV' / '10kV' / '6kV' */
|
|
19
|
+
level: string;
|
|
20
|
+
/** 行业里的颜色称呼 */
|
|
21
|
+
colorName: string;
|
|
22
|
+
/** 近似的 hex 值(可被覆盖) */
|
|
23
|
+
color: string;
|
|
24
|
+
/** 标称电压(kV),用于排序与展示 */
|
|
25
|
+
kv: number;
|
|
26
|
+
};
|
|
27
|
+
export declare const POWER_VOLTAGE_LEVELS: PowerVoltageLevel[];
|
|
28
|
+
/** 未标注电压等级时用的中性色(不参与色标语义) */
|
|
29
|
+
export declare const POWER_NEUTRAL_COLOR = "#1f2937";
|
|
30
|
+
/** 默认色标表(level → color) */
|
|
31
|
+
export declare function defaultVoltageColors(): Record<string, string>;
|
|
32
|
+
/** 按等级取颜色;没标等级或等级不认识时回落到中性色 */
|
|
33
|
+
export declare function voltageColorOf(level: string, table?: Record<string, string>): string;
|