ice-entity-designer 0.2.6 → 0.2.7
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 +17 -4
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +1 -1
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/water/WaterProcessDesigner.d.mts +75 -0
- package/dist/types/water/WaterProcessDesigner.d.ts +75 -0
- package/dist/types/water/water_shapes.d.mts +134 -0
- package/dist/types/water/water_shapes.d.ts +134 -0
- package/package.json +2 -2
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
* - GB/T 50106《建筑给水排水制图标准》—— 管道、阀门、仪表等通用图例(第 3 章「图例」);
|
|
13
|
+
* - 工艺单元(格栅、沉砂池、初沉池、生物池、二沉池、浓缩池、脱水机…)按工艺专业通行画法自绘,
|
|
14
|
+
* 本包只用**构成要素**表达可辨识特征(例如格栅=矩形+斜栅条、曝气池=矩形+曝气盘排列)。
|
|
15
|
+
* - 文字:给排水图纸以「设备名称 + 位号」为主,不像电力有 QF/QS 那样的强制性文字符号体系。
|
|
16
|
+
* 本包给每个 kind 一个**行业习惯代号**(P/B/V/FIT/AIT…)作默认值,可自由覆盖。
|
|
17
|
+
*
|
|
18
|
+
* **外观统一**(与其它域包同一条铁律):全部符号共用一套描边色、线宽、字号与基准尺寸,
|
|
19
|
+
* 并且**不可变换**(只能拖动)—— 符号的比例与朝向是记法的一部分。
|
|
20
|
+
* 配色约定:**蓝色系=水线单元,黄色系=污泥线单元**,全图一眼能分清水与泥。
|
|
21
|
+
*/
|
|
22
|
+
import { ICEGroup } from 'ice-render';
|
|
23
|
+
export declare const WATER_SYMBOL_KINDS: readonly ["barScreen", "gritChamber", "primaryClarifier", "anaerobicTank", "anoxicTank", "aerobicTank", "secondaryClarifier", "coagulationTank", "filterBed", "disinfectionTank", "sludgeThickener", "dewateringMachine", "pump", "blower", "dosingUnit", "valve", "flowMeter", "analyzer", "inlet", "outlet", "sludgeOut"];
|
|
24
|
+
export type WaterSymbolKind = (typeof WATER_SYMBOL_KINDS)[number];
|
|
25
|
+
/** 处理单元:参与工艺链、需要进出管线 */
|
|
26
|
+
export declare const WATER_UNIT_KINDS: WaterSymbolKind[];
|
|
27
|
+
/** 设备与仪表:只参与连接,不要求"进出各一条" */
|
|
28
|
+
export declare const WATER_EQUIPMENT_KINDS: WaterSymbolKind[];
|
|
29
|
+
/** 边界符号:进水 / 出水 / 污泥外运 */
|
|
30
|
+
export declare const WATER_BOUNDARY_KINDS: WaterSymbolKind[];
|
|
31
|
+
/** 会产出剩余污泥的单元(校验「污泥有没有出路」用) */
|
|
32
|
+
export declare const WATER_SLUDGE_SOURCE_KINDS: WaterSymbolKind[];
|
|
33
|
+
export type WaterMedium = 'sewage' | 'sludge' | 'returnSludge' | 'recycle' | 'air' | 'chemical' | 'effluent';
|
|
34
|
+
/**
|
|
35
|
+
* 介质样式:**颜色与线型区分介质**,是给排水图纸的通行做法(具体色值各院略有差异,可覆盖)。
|
|
36
|
+
* - 污水 / 出水 / 回流:实线,颜色区分;
|
|
37
|
+
* - 剩余污泥 / 回流污泥:两个色阶的棕黄(一条是排泥、一条是回流,专业上是两回事);
|
|
38
|
+
* - 空气 / 药剂:虚线(不是水流)。
|
|
39
|
+
*/
|
|
40
|
+
export declare const WATER_MEDIUM_STYLES: Record<WaterMedium, {
|
|
41
|
+
label: string;
|
|
42
|
+
color: string;
|
|
43
|
+
lineType: 'solid' | 'dashed';
|
|
44
|
+
}>;
|
|
45
|
+
export type WaterSymbolPreset = {
|
|
46
|
+
label: string;
|
|
47
|
+
/** 行业习惯代号(可覆盖;给排水不像电力有强制文字符号体系) */
|
|
48
|
+
tag: string;
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
/** 画法分组:矩形单元 / 圆形单元 / 小设备 / 边界 */
|
|
52
|
+
shape: 'tank' | 'round' | 'device' | 'boundary';
|
|
53
|
+
/** 是否串联在管线上(阀门、流量计这类) */
|
|
54
|
+
inline: boolean;
|
|
55
|
+
};
|
|
56
|
+
export declare const WATER_SYMBOL_PRESETS: Record<WaterSymbolKind, WaterSymbolPreset>;
|
|
57
|
+
/** 全局外观基准:所有符号共用,保证「一张图上不花」 */
|
|
58
|
+
export declare const WATER_STYLE: {
|
|
59
|
+
strokeStyle: string;
|
|
60
|
+
lineWidth: number;
|
|
61
|
+
/** 栅条、折流板、搅拌器这类内部线更细 */
|
|
62
|
+
detailLineWidth: number;
|
|
63
|
+
/** 水线单元的填充(浅蓝) */
|
|
64
|
+
waterFill: string;
|
|
65
|
+
/** 污泥线单元的填充(浅黄) */
|
|
66
|
+
sludgeFill: string;
|
|
67
|
+
tagFontSize: number;
|
|
68
|
+
tagColor: string;
|
|
69
|
+
nameFontSize: number;
|
|
70
|
+
nameColor: string;
|
|
71
|
+
/** 圆形单元里的罗马数字/字母(G/M 那类) */
|
|
72
|
+
letterFontSize: number;
|
|
73
|
+
/** 空心符号的填充(必须是合法色值:fillStyle=false/'none' 会退化成实色) */
|
|
74
|
+
hollowFill: string;
|
|
75
|
+
/** 明确停用/旁通时的颜色 */
|
|
76
|
+
idleColor: string;
|
|
77
|
+
};
|
|
78
|
+
/** 污泥线单元(配色与校验都要用) */
|
|
79
|
+
export declare const WATER_SLUDGE_KINDS: WaterSymbolKind[];
|
|
80
|
+
export type WaterValveState = 'open' | 'closed';
|
|
81
|
+
/**
|
|
82
|
+
* @class WaterSymbol 给水排水工艺流程图图元(复合组件)
|
|
83
|
+
*
|
|
84
|
+
* 与其它域包同一套做法:内部形状按 `kind` 派生(`hasDerivedChildren() === true`),
|
|
85
|
+
* 不进文档、载入时按 state 重建;`getSerializableChildren()` 声明真实子节点(本包目前没有,
|
|
86
|
+
* 但保留钩子,后续做「单元里嵌设备」时不用改序列化契约)。
|
|
87
|
+
*/
|
|
88
|
+
export default class WaterSymbol extends ICEGroup {
|
|
89
|
+
/** 稳定的类型标识(判型与序列化都用它,不要用类名) */
|
|
90
|
+
static readonly typeId = "ice-entity-designer:WaterSymbol";
|
|
91
|
+
/** 派生部件(形状 / 文字),测试与属性面板可以按角色取用 */
|
|
92
|
+
parts: Array<{
|
|
93
|
+
role: string;
|
|
94
|
+
component: any;
|
|
95
|
+
}>;
|
|
96
|
+
/**
|
|
97
|
+
* 本次绘制的原点(= 符号中心在组内坐标系里的位置)。
|
|
98
|
+
*
|
|
99
|
+
* 组内坐标系原点在**左上角**(`ICERect` 的 left/top 是盒子左上角),而所有形状都是围绕中心
|
|
100
|
+
* 画的,所以绘图辅助统一按「中心相对坐标」收参、在这里加一次原点偏移。
|
|
101
|
+
*/
|
|
102
|
+
private __originX;
|
|
103
|
+
private __originY;
|
|
104
|
+
hasDerivedChildren(): boolean;
|
|
105
|
+
getSerializableChildren(): any[];
|
|
106
|
+
constructor(props?: any);
|
|
107
|
+
protected static arrangeParam(props?: any): any;
|
|
108
|
+
private static readonly __shapeKeys;
|
|
109
|
+
setState(patch: any): void;
|
|
110
|
+
applyPatch(patch?: any): void;
|
|
111
|
+
/** 取某个角色的派生部件(测试 / 属性面板用) */
|
|
112
|
+
part(role: string): any;
|
|
113
|
+
/** 按 `kind` 重建内部形状与文字 */
|
|
114
|
+
protected syncShape(): void;
|
|
115
|
+
private __box;
|
|
116
|
+
private __circle;
|
|
117
|
+
/**
|
|
118
|
+
* 闭合图形:**先画开放折线,再单独补一条闭合边**。
|
|
119
|
+
*
|
|
120
|
+
* 不用 `closePath` / 首尾重复点:那种写法会让首帧的包围盒退化,离屏缓存拿 0 尺寸画布去
|
|
121
|
+
* `drawImage` 而报错(引擎侧已记录此坑,见 13-gap-analysis)。拆成两段开放折线后,
|
|
122
|
+
* 每条边都走 `__poly`(含轴对齐直线兜底),盒子永远不退化,渲染结果完全一致。
|
|
123
|
+
*/
|
|
124
|
+
private __closedPoly;
|
|
125
|
+
private __poly;
|
|
126
|
+
/**
|
|
127
|
+
* 文本部件:**显式给文字盒(width/height)+ textAlign/textBaseline 居中**。
|
|
128
|
+
*
|
|
129
|
+
* 这是电力域包验证过的写法:不给盒、靠自己估算宽度去挪 left,实测会又偏又挤。
|
|
130
|
+
*/
|
|
131
|
+
private __text;
|
|
132
|
+
private __add;
|
|
133
|
+
private __clearParts;
|
|
134
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
* - GB/T 50106《建筑给水排水制图标准》—— 管道、阀门、仪表等通用图例(第 3 章「图例」);
|
|
13
|
+
* - 工艺单元(格栅、沉砂池、初沉池、生物池、二沉池、浓缩池、脱水机…)按工艺专业通行画法自绘,
|
|
14
|
+
* 本包只用**构成要素**表达可辨识特征(例如格栅=矩形+斜栅条、曝气池=矩形+曝气盘排列)。
|
|
15
|
+
* - 文字:给排水图纸以「设备名称 + 位号」为主,不像电力有 QF/QS 那样的强制性文字符号体系。
|
|
16
|
+
* 本包给每个 kind 一个**行业习惯代号**(P/B/V/FIT/AIT…)作默认值,可自由覆盖。
|
|
17
|
+
*
|
|
18
|
+
* **外观统一**(与其它域包同一条铁律):全部符号共用一套描边色、线宽、字号与基准尺寸,
|
|
19
|
+
* 并且**不可变换**(只能拖动)—— 符号的比例与朝向是记法的一部分。
|
|
20
|
+
* 配色约定:**蓝色系=水线单元,黄色系=污泥线单元**,全图一眼能分清水与泥。
|
|
21
|
+
*/
|
|
22
|
+
import { ICEGroup } from 'ice-render';
|
|
23
|
+
export declare const WATER_SYMBOL_KINDS: readonly ["barScreen", "gritChamber", "primaryClarifier", "anaerobicTank", "anoxicTank", "aerobicTank", "secondaryClarifier", "coagulationTank", "filterBed", "disinfectionTank", "sludgeThickener", "dewateringMachine", "pump", "blower", "dosingUnit", "valve", "flowMeter", "analyzer", "inlet", "outlet", "sludgeOut"];
|
|
24
|
+
export type WaterSymbolKind = (typeof WATER_SYMBOL_KINDS)[number];
|
|
25
|
+
/** 处理单元:参与工艺链、需要进出管线 */
|
|
26
|
+
export declare const WATER_UNIT_KINDS: WaterSymbolKind[];
|
|
27
|
+
/** 设备与仪表:只参与连接,不要求"进出各一条" */
|
|
28
|
+
export declare const WATER_EQUIPMENT_KINDS: WaterSymbolKind[];
|
|
29
|
+
/** 边界符号:进水 / 出水 / 污泥外运 */
|
|
30
|
+
export declare const WATER_BOUNDARY_KINDS: WaterSymbolKind[];
|
|
31
|
+
/** 会产出剩余污泥的单元(校验「污泥有没有出路」用) */
|
|
32
|
+
export declare const WATER_SLUDGE_SOURCE_KINDS: WaterSymbolKind[];
|
|
33
|
+
export type WaterMedium = 'sewage' | 'sludge' | 'returnSludge' | 'recycle' | 'air' | 'chemical' | 'effluent';
|
|
34
|
+
/**
|
|
35
|
+
* 介质样式:**颜色与线型区分介质**,是给排水图纸的通行做法(具体色值各院略有差异,可覆盖)。
|
|
36
|
+
* - 污水 / 出水 / 回流:实线,颜色区分;
|
|
37
|
+
* - 剩余污泥 / 回流污泥:两个色阶的棕黄(一条是排泥、一条是回流,专业上是两回事);
|
|
38
|
+
* - 空气 / 药剂:虚线(不是水流)。
|
|
39
|
+
*/
|
|
40
|
+
export declare const WATER_MEDIUM_STYLES: Record<WaterMedium, {
|
|
41
|
+
label: string;
|
|
42
|
+
color: string;
|
|
43
|
+
lineType: 'solid' | 'dashed';
|
|
44
|
+
}>;
|
|
45
|
+
export type WaterSymbolPreset = {
|
|
46
|
+
label: string;
|
|
47
|
+
/** 行业习惯代号(可覆盖;给排水不像电力有强制文字符号体系) */
|
|
48
|
+
tag: string;
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
/** 画法分组:矩形单元 / 圆形单元 / 小设备 / 边界 */
|
|
52
|
+
shape: 'tank' | 'round' | 'device' | 'boundary';
|
|
53
|
+
/** 是否串联在管线上(阀门、流量计这类) */
|
|
54
|
+
inline: boolean;
|
|
55
|
+
};
|
|
56
|
+
export declare const WATER_SYMBOL_PRESETS: Record<WaterSymbolKind, WaterSymbolPreset>;
|
|
57
|
+
/** 全局外观基准:所有符号共用,保证「一张图上不花」 */
|
|
58
|
+
export declare const WATER_STYLE: {
|
|
59
|
+
strokeStyle: string;
|
|
60
|
+
lineWidth: number;
|
|
61
|
+
/** 栅条、折流板、搅拌器这类内部线更细 */
|
|
62
|
+
detailLineWidth: number;
|
|
63
|
+
/** 水线单元的填充(浅蓝) */
|
|
64
|
+
waterFill: string;
|
|
65
|
+
/** 污泥线单元的填充(浅黄) */
|
|
66
|
+
sludgeFill: string;
|
|
67
|
+
tagFontSize: number;
|
|
68
|
+
tagColor: string;
|
|
69
|
+
nameFontSize: number;
|
|
70
|
+
nameColor: string;
|
|
71
|
+
/** 圆形单元里的罗马数字/字母(G/M 那类) */
|
|
72
|
+
letterFontSize: number;
|
|
73
|
+
/** 空心符号的填充(必须是合法色值:fillStyle=false/'none' 会退化成实色) */
|
|
74
|
+
hollowFill: string;
|
|
75
|
+
/** 明确停用/旁通时的颜色 */
|
|
76
|
+
idleColor: string;
|
|
77
|
+
};
|
|
78
|
+
/** 污泥线单元(配色与校验都要用) */
|
|
79
|
+
export declare const WATER_SLUDGE_KINDS: WaterSymbolKind[];
|
|
80
|
+
export type WaterValveState = 'open' | 'closed';
|
|
81
|
+
/**
|
|
82
|
+
* @class WaterSymbol 给水排水工艺流程图图元(复合组件)
|
|
83
|
+
*
|
|
84
|
+
* 与其它域包同一套做法:内部形状按 `kind` 派生(`hasDerivedChildren() === true`),
|
|
85
|
+
* 不进文档、载入时按 state 重建;`getSerializableChildren()` 声明真实子节点(本包目前没有,
|
|
86
|
+
* 但保留钩子,后续做「单元里嵌设备」时不用改序列化契约)。
|
|
87
|
+
*/
|
|
88
|
+
export default class WaterSymbol extends ICEGroup {
|
|
89
|
+
/** 稳定的类型标识(判型与序列化都用它,不要用类名) */
|
|
90
|
+
static readonly typeId = "ice-entity-designer:WaterSymbol";
|
|
91
|
+
/** 派生部件(形状 / 文字),测试与属性面板可以按角色取用 */
|
|
92
|
+
parts: Array<{
|
|
93
|
+
role: string;
|
|
94
|
+
component: any;
|
|
95
|
+
}>;
|
|
96
|
+
/**
|
|
97
|
+
* 本次绘制的原点(= 符号中心在组内坐标系里的位置)。
|
|
98
|
+
*
|
|
99
|
+
* 组内坐标系原点在**左上角**(`ICERect` 的 left/top 是盒子左上角),而所有形状都是围绕中心
|
|
100
|
+
* 画的,所以绘图辅助统一按「中心相对坐标」收参、在这里加一次原点偏移。
|
|
101
|
+
*/
|
|
102
|
+
private __originX;
|
|
103
|
+
private __originY;
|
|
104
|
+
hasDerivedChildren(): boolean;
|
|
105
|
+
getSerializableChildren(): any[];
|
|
106
|
+
constructor(props?: any);
|
|
107
|
+
protected static arrangeParam(props?: any): any;
|
|
108
|
+
private static readonly __shapeKeys;
|
|
109
|
+
setState(patch: any): void;
|
|
110
|
+
applyPatch(patch?: any): void;
|
|
111
|
+
/** 取某个角色的派生部件(测试 / 属性面板用) */
|
|
112
|
+
part(role: string): any;
|
|
113
|
+
/** 按 `kind` 重建内部形状与文字 */
|
|
114
|
+
protected syncShape(): void;
|
|
115
|
+
private __box;
|
|
116
|
+
private __circle;
|
|
117
|
+
/**
|
|
118
|
+
* 闭合图形:**先画开放折线,再单独补一条闭合边**。
|
|
119
|
+
*
|
|
120
|
+
* 不用 `closePath` / 首尾重复点:那种写法会让首帧的包围盒退化,离屏缓存拿 0 尺寸画布去
|
|
121
|
+
* `drawImage` 而报错(引擎侧已记录此坑,见 13-gap-analysis)。拆成两段开放折线后,
|
|
122
|
+
* 每条边都走 `__poly`(含轴对齐直线兜底),盒子永远不退化,渲染结果完全一致。
|
|
123
|
+
*/
|
|
124
|
+
private __closedPoly;
|
|
125
|
+
private __poly;
|
|
126
|
+
/**
|
|
127
|
+
* 文本部件:**显式给文字盒(width/height)+ textAlign/textBaseline 居中**。
|
|
128
|
+
*
|
|
129
|
+
* 这是电力域包验证过的写法:不给盒、靠自己估算宽度去挪 left,实测会又偏又挤。
|
|
130
|
+
*/
|
|
131
|
+
private __text;
|
|
132
|
+
private __add;
|
|
133
|
+
private __clearParts;
|
|
134
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "大漠穷秋",
|
|
3
3
|
"name": "ice-entity-designer",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.7",
|
|
5
5
|
"description": "An entity designer based on ice-render.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
102
102
|
"http-server": "14.1.1",
|
|
103
103
|
"husky": "8.0.3",
|
|
104
|
-
"ice-render": "^2.3.
|
|
104
|
+
"ice-render": "^2.3.2",
|
|
105
105
|
"jest": "29.7.0",
|
|
106
106
|
"jest-environment-jsdom": "29.7.0",
|
|
107
107
|
"lint-staged": "15.5.2",
|