whycwx
2021-07-22 4bfe87304988cfa2338bb58210ee227b917a9247
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
import Diagram from '@/assets/js/newDiagram'
import dynamometry from '../images/dynamometry.png'
import testedmotor from '../images/testedmotor.png'
import sensor from '../images/sensor.png'
import shock from '../images/shock.png'
import speedCabinet from '../images/speedCabinet.png'
 
const lineWidth = 2;
const lineStrokeColor = '#105b96';
 
function girdCircuitDiagram(stc, flush) {
    
    let diagram = new Diagram();
    // let thisWidth = stc.scrollWidth;
    // let thisHeight = stc.scrollHeight;
    diagram.width = 525;
    diagram.height= 380;
    diagram.setCanvas(stc, flush);
 
    let start = [60, 100];
    // // 线
    let line1 = diagram.line({
        id: 'line1',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            start,
            [start[0], start[1]+200]
        ]
    });
 
    let line2 = diagram.line({
        id: 'line2',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line1[1][0],line1[1][1]],
            [line1[1][0]+200, line1[1][1]]
        ]
    });
 
    let line3 = diagram.line({
        id: 'line3',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line2[1][0]+2,line2[1][1]],
            [line2[1][0]+190, line2[1][1]]
        ]
    });
    let line4 = diagram.line({
        id: 'line4',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line2[1][0],line2[1][1]-10],
            [line2[1][0], line2[1][1]+10]
        ]
    });
 
    let line5 = diagram.line({
        id: 'line5',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line3[0][0],line3[0][1]-10],
            [line3[0][0], line3[0][1]+10]
        ]
    });
 
    let line6 = diagram.line({
        id: 'line6',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line3[1][0],line3[1][1]],
            [line3[1][0], line3[1][1]-220]
        ]
    });
 
    let line7 = diagram.line({
        id: 'line7',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line6[1][0],line6[1][1]],
            [line6[1][0]-40, line6[1][1]]
        ]
    });
 
    let arc1 = diagram.arc({
        id: 'arc1',
        point: [
            line7[1][0], line7[1][1]
        ],
        fillStyle: lineStrokeColor,
        strokeStyle: lineStrokeColor,
        radius: 3,
        type: 'fill'
    })
 
    let line8 = diagram.line({
        id: 'line8',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line7[1][0]-30,line7[1][1]],
            [line7[1][0]-300, line7[1][1]]
        ]
    });
    let arc2 = diagram.arc({
        id: 'arc2',
        point: [
            line8[0][0], line8[0][1]
        ],
        fillStyle: lineStrokeColor,
        strokeStyle: lineStrokeColor,
        radius: 3,
        type: 'fill'
    })
 
    let line9 = diagram.line({
        id: 'line9',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line7[1][0],line7[1][1]],
            [line8[0][0], line8[0][1]]
            
        ],
        
    });
 
 
    let text1 = diagram.text({
        id: "text1",
        text: '直流配电板',
        fillStyle: '#1e9ff2',
        fontSize: 12,
        fontWidth:1,
        point:[line1[0][0]-28,line1[0][1]-21],
        showPanel: false,
        type:true,
        radBorder: true,
        borderColor:"#1e9ff2"
    });
 
    let text2 = diagram.text({
        id: "text2",
        text: '整流电源',
        fillStyle: '#1e9ff2',
        fontSize: 12,
        fontWidth:1,
        point:[line9[1][0]-120,line9[1][1]],
        showPanel: false,
        type:true,
        radBorder: true,
        borderColor:"#1e9ff2"
    });
 
    let text3 = diagram.text({
        id: "text3",
        text: '900V',
        fillStyle: '#fff',
        fontSize: 12,
        fontWidth:1,
        point:[line9[1][0]-220,line9[1][1]-10],
        showPanel: false,
    });
 
    let text4 = diagram.text({
        id: "text4",
        text: '直流调速柜',
        fillStyle: '#1e9ff2',
        fontSize: 12,
        fontWidth:1,
        point:[line1[0][0]+20,line1[0][1]+50],
        showPanel: false,
    });
 
    let text5 = diagram.text({
        id: "text5",
        text: '升压变压器',
        fillStyle: '#1e9ff2',
        fontSize: 12,
        fontWidth:1,
        point:[line6[1][0]-30,line6[1][1]+60],
        showPanel: false,
        type:true,
        radBorder: true,
        borderColor:"#1e9ff2"
    });
 
    let text6 = diagram.text({
        id: "text6",
        text: '   AFE变频&     驱动柜   ',
        fillStyle: '#1e9ff2',
        fontSize: 12,
        fontWidth:1,
        point:[line6[1][0]-30,line6[1][1]+120],
        showPanel: false,
        type:true,
        radBorder: true,
        borderColor:"#1e9ff2"
    });
    let dashLine1 =diagram.dashLine({
        id:"diagram1",
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line4[1][0]-150,line4[1][1]-10],
            [line4[1][0]-150, line4[1][1]-70]
        ]
    })
    let dashLine2 =diagram.dashLine({
        id:"diagram2",
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [dashLine1[1][0],dashLine1[1][1]],
            [dashLine1[1][0]+70, dashLine1[1][1]]
        ]
    })
    let dashLine3 =diagram.dashLine({
        id:"diagram3",
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [dashLine2[1][0],dashLine2[1][1]],
            [dashLine2[1][0], dashLine2[1][1]-20]
        ]
    })
    let arrow1 = diagram.drawArrow({
        id: 'arrow1',
        fillStyle: '#105b96',
        size: 50,
        direction: 'top',
        type: 'fill',
        point: dashLine3[0]
    })
    // // 测试电机
    let Image1 = diagram.drawImage({
        id: 'img1',
        url: dynamometry,
        point: [line3[0][0]+20, line3[0][1]-30],
        width: 70,
        height:60,
    })
    // // 受试电机
    let Image2 = diagram.drawImage({
        id: 'img2',
        url: testedmotor,
        point: [dashLine1[0][0]-20, dashLine1[0][1]-30],
        width: 70,
        height:60,
    })
 
    // // 齿轮箱
    let Image3 = diagram.drawImage({
        id: 'img3',
        url: sensor,
        point: [line4[1][0]-60, line4[1][1]-25],
        width: 30,
        height:30,
    })
 
    // // 直流调速柜
    let Image4 = diagram.drawImage({
        id: 'img4',
        url: speedCabinet,
        point: [line1[0][0]-30, line1[0][1]+60],
        width: 60,
        height:70,
    })
 
    // // 噪声
    let Image6 = diagram.drawImage({
        id: 'img6',
        url: shock,
        point: [dashLine3[1][0]-30, dashLine3[1][1]-100],
        width: 60,
        height:70,
    })
    // 转速:9r/min
    let text7 = diagram.text({
        id: "text7",
        text: '转速:9r/min',
        fillStyle: "#ffff18",
        fontSize: 12,
        fontWidth:1,
        point:[Image2.top[0]-10,Image2.top[1]-10],
        showPanel: false,
    });
    // 受试电机
    let text8 = diagram.text({
        id: "text8",
        text: '受试电机',
        fillStyle: "#ffff18",
        fontSize: 12,
        fontWidth:1,
        point:[Image2.bottom[0]-10,Image2.bottom[1]+10],
        showPanel: false,
    });
    // 
    let text9 = diagram.text({
        id: "text9",
        text: '轴联器链接',
        fillStyle: "#ffff18",
        fontSize: 12,
        fontWidth:1,
        point:[Image3.top[0]+20,Image3.top[1]-20],
        showPanel: false,
    });
    let text10 = diagram.text({
        id: "text10",
        text: '齿轮箱',
        fillStyle: "#ffff18",
        fontSize: 12,
        fontWidth:1,
        point:[Image3.bottom[0]-20,Image3.bottom[1]+10],
        showPanel: false,
    });
 
    let text11 = diagram.text({
        id: "text11",
        text: '噪声: 20 dB',
        fillStyle: "#ffff18",
        fontSize: 12,
        fontWidth:1,
        point:[Image6.top[0]-30,Image6.top[1]-15],
        showPanel: false,
    });
 
    // let text12 = diagram.text({
    //     id: "text12",
    //     text: '&电压:690V&频率:44.5Hz&转速:89r/min&输出功率:980kW',
    //     fillStyle: '#ffffff',
    //     fontSize: 12,
    //     fontWidth:1,
    //     point:[Image3.top[0]+50,Image3.top[1]-160],
    //     showPanel: false,
    //     type:true,
    //     radBorder: true,
    //     bgColor:"rgba(2, 151, 215, 0.3)",
    //     borderColor:"rgba(30, 159, 242, 1)"
    // });
    // let text13 = diagram.text({
    //     id: "text13",
    //     text: '      受功电机',
    //     fillStyle: "#ffff18",
    //     fontSize: 12,
    //     fontWidth:1,
    //     point:[Image3.top[0]+50,Image3.top[1]-160],
    //     showPanel: false,
    // });
// 
 
 
 
 
 
    return diagram;
}
 
 
export default girdCircuitDiagram;