whychdw
2021-01-04 bd187076c36bf39abbfa270a0c1c49d937acace4
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
import Diagram from '@/assets/js/newDiagram'
import ACImg from '../images/AC.png'
import frequencyImg from '../images/frequency.png'
import parameterImg from '../images/parameter.png'
 
const lineWidth = 5;
const lineStrokeColor = '#00f6f8';
const frequencyWidth = 96;
const ACWidth = 124;
const parameterWidth = 85;
 
function girdCircuitDiagram(stc, flush) {
    let diagram = new Diagram();
    diagram.setCanvas(stc, flush);
 
    let start = [260, 380];
 
    let Image1 = diagram.drawImage({
        id: 'img1',
        url: frequencyImg,
        point: [start[0] - frequencyWidth, start[1] - frequencyWidth * 148 / 96 / 2],
        width: frequencyWidth,
        height: frequencyWidth * 148 / 96
    })
 
    let line1 = diagram.line({
        id: 'line1',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            start,
            [start[0] + 110, start[1]]
        ]
    })
 
    let line2 = diagram.line({
        id: 'line2',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line1[1][0], line1[1][1]],
            [line1[1][0] + 100, line1[1][1]]
        ]
    })
 
    let Image2 = diagram.drawImage({
        id: 'img2',
        url: ACImg,
        point: [line2[1][0], line2[1][1] - ACWidth / 2],
        width: ACWidth,
        height: ACWidth
    })
 
    let line3 = diagram.line({
        id: 'line3',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line2[1][0] + Image2.width, line2[1][1]],
            [line2[1][0] + Image2.width + 90, line2[1][1]]
        ]
    })
 
    let arc1 = diagram.arc({
        id: 'arc1',
        point: [
            line3[1][0] + 6, line3[1][1]
        ],
        fillStyle: lineStrokeColor,
        strokeStyle: lineStrokeColor,
        radius: 12,
        type: 'fill'
    })
 
    let line4 = diagram.line({
        id: 'line4',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line3[1][0] + arc1.radius, line3[1][1]],
            [line3[1][0] + arc1.radius + 90, line3[1][1]]
        ]
    })
 
    let Image3 = diagram.drawImage({
        id: 'img3',
        url: ACImg,
        point: [line4[1][0], line4[1][1] - ACWidth / 2],
        width: ACWidth,
        height: ACWidth
    })
 
    let line5 = diagram.line({
        id: 'line5',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line4[1][0] + Image3.width, line4[1][1]],
            [line4[1][0] + Image3.width + 100, line4[1][1]]
        ]
    })
 
    let line6 = diagram.line({
        id: 'line6',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line5[1][0], line5[1][1]],
            [line5[1][0] + 110, line5[1][1]]
        ]
    })
 
    let Image4 = diagram.drawImage({
        id: 'img4',
        url: frequencyImg,
        point: [line6[1][0], line6[1][1] - frequencyWidth * 148 / 96 / 2],
        width: frequencyWidth,
        height: frequencyWidth * 148 / 96
    })
 
    let line7 = diagram.line({
        id: 'line7',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line1[1][0], line1[1][1]],
            [line1[1][0], line1[1][1] - 200]
        ]
    })
 
    let line8 = diagram.line({
        id: 'line8',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line7[1][0], line7[1][1]],
            [line3[1][0] + arc1.radius / 2 - parameterWidth / 2, line7[1][1]]
        ]
    })
 
    let Image5 = diagram.drawImage({
        id: 'img5',
        url: parameterImg,
        point: [line8[1][0], line8[1][1] - frequencyWidth * 141 / 85 / 2],
        width: parameterWidth,
        height: parameterWidth * 141 / 85
    })
 
    let line9 = diagram.line({
        id: 'line9',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line8[1][0] + Image5.width, line8[1][1]],
            [line5[1][0], line8[1][1]],
        ]
    })
 
    let line10 = diagram.line({
        id: 'line10',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line9[1][0], line9[1][1]],
            [line9[1][0], line5[1][1]],
        ]
    })
 
    let line11 = diagram.line({
        id: 'line11',
        strokeStyle: lineStrokeColor,
        lineWidth: lineWidth,
        points: [
            [line3[1][0] + arc1.radius / 2, line3[1][1]],
            [line3[1][0] + arc1.radius / 2, line3[1][1] + 110],
        ]
    })
 
    return diagram;
}
 
 
export default girdCircuitDiagram;