Sidebar-FlowMeter.js
2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
(function () {
// Adds Atlassian shapes
// flowMeter label
Sidebar.prototype.addFlowMeterPalette = function () {
const { COMPONENT_TYPE } = this.enumCellBasicAttribute
const { DEFAULT } = this.enumComponentType
const gn = 'mxgraph.flowMeter';
const dt = 'flowMeter';
const label = '流量计'
const width = 66;
const height = 74;
const staticPath = `${Proxy_Prefix}/img/lib/thingskit/`
const prefix = 'image;image=img/lib/thingskit/'
const defaultStyle = ';imageAspect=0;'
this.setCurrentSearchEntryLibrary(dt);
// 自定义属性
const cellAttribute = {
[ COMPONENT_TYPE ]: DEFAULT
}
const graphPathLib = [
{ name: '压力.svg', path: 'flowMeter/压力.svg' },
{ name: '微电脑控制器.svg', path: 'flowMeter/微电脑控制器.svg' },
{ name: '排气压力.svg', path: 'flowMeter/排气压力.svg' },
{ name: '智能电磁流量计.svg', path: 'flowMeter/智能电磁流量计.svg' },
{ name: '智能科氏流量计 1.svg', path: 'flowMeter/智能科氏流量计 1.svg' },
{ name: '智能科氏流量计 2.svg', path: 'flowMeter/智能科氏流量计 2.svg' },
{ name: '模拟输出流量传感器.svg', path: 'flowMeter/模拟输出流量传感器.svg' },
{ name: '气旋流量计.svg', path: 'flowMeter/气旋流量计.svg' },
{ name: '流元件.svg', path: 'flowMeter/流元件.svg' },
{ name: '流管.svg', path: 'flowMeter/流管.svg' },
{ name: '流量积算器.svg', path: 'flowMeter/流量积算器.svg' },
{ name: '流量计.svg', path: 'flowMeter/流量计.svg' },
{ name: '涡轮流量计.svg', path: 'flowMeter/涡轮流量计.svg' },
{ name: '温度.svg', path: 'flowMeter/温度.svg' },
{ name: '热式质量流量计.svg', path: 'flowMeter/热式质量流量计.svg' },
{ name: '电磁流量计 1.svg', path: 'flowMeter/电磁流量计 1.svg' },
{ name: '电磁流量计 2.svg', path: 'flowMeter/电磁流量计 2.svg' },
{ name: '电磁流量计3.svg', path: 'flowMeter/电磁流量计3.svg' },
{ name: '简单流量控制器.svg', path: 'flowMeter/简单流量控制器.svg' },
{ name: '简单流量控制器2.svg', path: 'flowMeter/简单流量控制器2.svg' },
{ name: '锥式流量计.svg', path: 'flowMeter/锥式流量计.svg' },
]
const lib = graphPathLib.map(item => {
item.staticPath = staticPath + item.path
return item
})
const fns = graphPathLib.map(item => {
return this.addEntry(this.getTagsForStencil(gn, item.name, dt).join(' '), mxUtils.bind(this, function () {
const cell = new mxCell('', new mxGeometry(0, 0, width, height), `${ prefix }${ item.path }${ defaultStyle }`);
cell.setVertex(true)
this.setCellAttributes(cell, cellAttribute)
return this.createVertexTemplateFromCells([ cell ], cell.geometry.width, cell.geometry.height, item.name);
}));
})
this.setVariableImageLib(dt, label, lib)
this.addPaletteFunctions(dt, label, false, fns);
this.setCurrentSearchEntryLibrary();
};
})();