zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
package DrawImage;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.util.Vector;
import ColorAndFont.ChooseColor;
import PbuliClass.Get_Tb_Gass;
import PbuliClass.Systems;
import person.person_Dell;
import relloc.RealLoc;
import tbDataModel.Line;
import tbDataModel.Point_fence_inout;
import tbDataModel.PolygonNew;
import tbDataModel.TbGas;
import tbDataModel.Tb_fence_inout;
import tbDataModel.tb_line;
import tbDataModel_Dell.Dell_Fenceinout;
import tbDataModel_Dell.Dell_Line;
import tbDataModel_Dell.Dell_Polygon;
import tbDataModel_Dell.Dell_tbline;
import tbDataModel_Dell.Dell_yuan;
import tbDataModel_Dell.Map_Dell;
import tbDataModel_Dell.Tb_Warnig_Dell;
/**
 * »æÍ¼
 */
public class Drawok {
 
    static Stroke stroke = new BasicStroke(2);//ÉèÖû­±Ê
    static Font font = new Font("ËÎÌå", Font.PLAIN, 14);
    static Font font1 = new Font("ºÚÌå", Font.PLAIN, 16);
    static Font font2 = new Font("ËÎÌå", Font.PLAIN, 18);
 
    /**
     * »æÖƵç×ÓΧÀ¸ÇøÓò
     *
     * @param floorËùÔÚ²ã
     * @param x_bi
     * @param y_bi
     * @param x0
     * @param y0
     * @param Graphics2D g2
     */
    public static void fence(String floor, double x_bi, double y_bi, int x0, int y0, 
            int xpy, int ypy, Graphics2D g2,double bi) {
        /**»æÖÆÒѾ­´æÔÚµÄΧÀ¸¶ÔÏó**/
        int size1 = Dell_Polygon.getPolyVec().size();
        if (size1 != 0) {
            for (int i = 0; i < size1; i++) {
                PolygonNew polyg = Dell_Polygon.getPolyVec().get(i);
                if (polyg.getAllFloor()==null){
                    polyg.setAllFloor("0");
                }
                boolean equals = polyg.getAllFloor().equals("1");
                if (polyg.getFloor().equals(floor)||equals) {
                    String name = polyg.getName();
                    if (polyg.getShape().equals("¾ØÐÎ")) {
                        int x = (new Double((polyg.getX()[0] - xpy) / x_bi)).intValue() + x0;
                        int y = (new Double((polyg.getY()[0] - ypy) / y_bi)).intValue() + y0;
                        int w = (new Double(polyg.getX()[1] / x_bi)).intValue();
                        int h = (new Double(polyg.getY()[1] / y_bi)).intValue();
                        //
                        g2.setStroke(stroke);
                        Font font = new Font("ºÚÌå", Font.BOLD, 16);
                        g2.setFont(font);
                        g2.setColor(Color.RED);
                        g2.drawString(name, x + w / 2, y + h / 2);
                        g2.setColor(polyg.getColor());
                        g2.fillRect(x, y, w, h);
 
                    } else if (polyg.getShape().equals("¶à±ßÐÎ")) {
                        int size = polyg.getX().length;
                        int[] xs = new int[size];
                        int[] ys = new int[size];
                        for (int j = 0; j < size; j++) {
                            xs[j] = (new Double((polyg.getX()[j] - xpy) / x_bi)).intValue() + x0;
                            ys[j] = (new Double((polyg.getY()[j] - ypy) / y_bi)).intValue() + y0;
                        }
                        g2.setColor(polyg.getColor());
                        g2.setStroke(stroke);
                        g2.setColor(Color.RED);
                        g2.drawString(polyg.getName(), xs[0], ys[0]);
                        g2.setColor(polyg.getColor());
                        g2.fillPolygon(xs, ys, size);
                    } else if (polyg.getShape().equals("һάÏß")) {
                        int size = polyg.getX().length;
                        int[] xs = new int[size];
                        int[] ys = new int[size];
                        for (int j = 0; j < size; j++) {
                            xs[j] = (new Double((polyg.getX()[j] - xpy) / x_bi)).intValue() + x0;
                            ys[j] = (new Double((polyg.getY()[j] - ypy) / y_bi)).intValue() + y0;
                        }
                        g2.setColor(polyg.getColor());
                        g2.setStroke(stroke);
                        g2.setColor(Color.RED);
 
                        g2.setColor(polyg.getColor());
                        for (int a = 0; a < size; a++) {
                            g2.setColor(Color.green);
                            g2.fillOval(xs[a] - 5, ys[a] - 5, 10, 10);
                        }
                        for (int z = 0; z < size - 1; z++) {
                            g2.setStroke(stroke);
                            g2.setColor(Color.blue);
                            g2.drawString(polyg.getName(), xs[0], ys[0]);
                            g2.setColor(Color.red);
                            g2.drawLine(xs[z], ys[z], xs[z + 1], ys[z + 1]);
                        }
                    }else if (polyg.getShape().equals("Ô²ÐÎ")) {
                        int posx = (new Double((polyg.getX()[0] - xpy) / x_bi)).intValue() + x0;
                        int posy = (new Double((polyg.getY()[0] - ypy) / y_bi)).intValue() + y0;
                        int r1=2*(new Double(polyg.getBj()[0]/x_bi)).intValue();
                        int r2=2*(new Double(polyg.getBj()[0]/y_bi)).intValue();
                        g2.setStroke(stroke);
                        Font font = new Font("ºÚÌå", Font.BOLD, 16);
                        g2.setFont(font);
                        g2.setColor(Color.RED);
                        g2.drawString(name, posx,posy);
                        g2.setColor(polyg.getColor());                       
                        g2.fillOval(posx-4, posy-4,8,8);
                        g2.fillOval(posx-r1/2, posy-r2/2,r1,r2);                        
                        
                    }
                }
            }
        }
    }
 
    /**
     * »æÖƿɽøÈë¿É³öÇøÓòµÄ¶¥µã
     */
    public static void draw_point_inout(String floor, double x_bi, double y_bi, int x0, int y0, int xpy, int ypy, Graphics2D g2) {
        int size = Dell_Fenceinout.getPoint_finout_vec().size();
        if (size != 0) {
            for (int i = 0; i < size; i++) {
                Point_fence_inout pfi = Dell_Fenceinout.getPoint_finout_vec().get(i);
                String floor1 = pfi.getFloor();
                if (floor1.equals(floor)) {
//                    String name=pfi.getName();
                    int x = (new Double((pfi.getX() - xpy) / x_bi)).intValue() + x0;
                    int y = (new Double((pfi.getY() - ypy) / y_bi)).intValue() + y0;
                    g2.setStroke(stroke);
                    g2.setColor(Color.blue);
                    g2.fillOval(x - 5, y - 5, 10, 10);
//                    Font font=new Font("ºÚÌå",Font.BOLD,16);
                    //g2.setFont(font);
                    //g2.setColor(Color.RED);
                    //g2.drawString(name,x-40, y-10);
                }
            }
        }
    }
 
 
    /**
     * »æÖƿɽøÈë¿É³öÇøÓòµÄÖ±Ïß
     */
    public static void draw_point_inoutLine(String floor, Graphics2D g2) {
        int size = Dell_Fenceinout.getFinout_vec().size();
        if (size != 0) {
            for (int i = 0; i < size; i++) {
                Tb_fence_inout tfi = Dell_Fenceinout.getFinout_vec().get(i);
                String zuobiao = tfi.getZuobiao();
                String canin = tfi.getCanin();
                String[] split = zuobiao.split(";");
                String[] split1 = canin.split(",");
                String[] s = new String[split.length];
                for (int j = 1; j < split.length; j++) {
                    String aaa = split[j - 1] + "," + split1[j - 1] + "," + split[j] + "," + split1[j];
                    String trim = aaa.trim();
                    s[j - 1] = trim;
                    String bbb = split[0] + "," + split1[0] + "," + split[split.length - 1] + "," + split1[split.length - 1];
                    String trim1 = bbb.trim();
                    s[split.length - 1] = trim1;
                }
                String floor1 = tfi.getFloor();
                if (floor1.equals(floor)) {
                    for (int z = 0; z < s.length; z++) {
                        String[] split2 = s[z].split(",");
                        if ("1".equals(split2[2]) && "1".equals(split2[5])) {
                            int a = Integer.parseInt(split2[0]);
                            int b = Integer.parseInt(split2[1]);
                            int c = Integer.parseInt(split2[3]);
                            int d = Integer.parseInt(split2[4]);
                            int x1 = RealLoc.get_xpos(floor1, a);
                            int y1 = RealLoc.get_ypos(floor1, b);
                            int x2 = RealLoc.get_xpos(floor1, c);
                            ;
                            int y2 = RealLoc.get_ypos(floor1, d);
                            //ÉèÖñʻ­µÄ´Öϸ
                            g2.setStroke(new BasicStroke(3.0f));
                            g2.setColor(Color.green);
                            g2.drawLine(x1, y1, x2, y2);
                            //g2.drawString("¿É½ø¿É³ö",x2,y2+3);
                        }
 
                    }
                }
            }
        }
    }
 
 
    /**
     * »æÖÆÖ±Ïß
     */
    public static void line(double x_bi, double y_bi, int x0, int y0, Graphics2D g2) {
        int size = Dell_Line.getLine_vector().size();
        if (size != 0) {
            for (int i = 0; i < size; i++) {
                Line line = Dell_Line.getLine_vector().get(i);
                double a = (line.getX1() / x_bi) + x0;
                double b = (line.getY1() / y_bi) + y0;
                double c = (line.getX2() / x_bi) + x0;
                double d = (line.getY2() / y_bi) + y0;
                int x1 = (int) a;
                int y1 = (int) b;
                int x2 = (int) c;
                int y2 = (int) d;
                //ÉèÖñʻ­µÄ´Öϸ
                g2.setStroke(new BasicStroke(3.0f));
                g2.setColor(Color.blue);
                g2.drawLine(x1, y1, x2, y2);
                g2.drawString("³¤¶È:" + Dell_Line.getLine_vector().get(i).getLenght() + "cm", x2, y2 + 3);
            }
        }
    }
 
    /**
     * »æÖƵã
     */
    public static void drawyuan(double x_bi, double y_bi, int x0, int y0, Graphics2D g2) {
        int size = Dell_yuan.getYuan_vector().size();
        if (size != 0) {
            for (int i = 0; i < size; i++) {
                double a = (Dell_yuan.getYuan_vector().get(i).getX() / x_bi) + x0;
                double b = (Dell_yuan.getYuan_vector().get(i).getY() / y_bi) + y0;
                int x1 = (int) a;
                int y1 = (int) b;
                g2.setColor(ChooseColor.getColo("ÂÌÉ«", 150));
                g2.fillOval(x1 - 5, y1 - 5, 10, 10);
            }
        }
    }
 
 
    /**
     * »æÖÆÆøÌå´«¸ÐÆ÷¶ÔÏó
     */
    public static void gas(String mapfloor, double x_bi, double y_bi, int x0, int y0, Graphics2D g2) {
        if (Systems.sys().getGas_show().equals("1") && Get_Tb_Gass.get_gass().size() != 0) {//Èç¹ûÆøÌå´«¸ÐÆ÷ÏÔʾÊÇ¿ªÆôµÄ
            for (TbGas gas : Get_Tb_Gass.get_gass()) {//±éÀúËùÓÐµÄÆøÌå´«¸ÐÆ÷¶ÔÏó
                int gas_x = Integer.parseInt(gas.getX()) - Map_Dell.get_map(mapfloor).getX0_length();
                int gas_y = Integer.parseInt(gas.getY()) - Map_Dell.get_map(mapfloor).getY0_width();
                double aa = (gas_x / x_bi) + x0;
                double bb = (gas_y / y_bi) + y0;
                int gasx = (int) aa;
                int gasy = (int) bb;
                String gas_nongdu = gas.getNong_du() + "%";
                if (gas.getNong_du().equals("65535")) {
                    gas_nongdu = "";
                }
                String gas_name = gas.getGas_type();
                g2.setColor(Color.green);
                g2.fillOval(gasx, gasy, 30, 30);
                g2.setColor(Color.black);
                g2.setFont(font1);
                g2.drawString(gas_name, gasx + 4, gasy + 43);
                g2.setColor(Color.red);
                g2.drawString(gas_nongdu, gasx + 6, gasy + 22);
 
            }
 
        }
    }
 
 
    /**
     * »æÖƱêÇ©ÔÚÏß×ÜÊý
     */
    public static void tagidnum(int x, int y, int framey, int framex, Graphics2D g2, int online) {
        if (true) {
            g2.setColor(ChooseColor.getColo("À¶É«", 70));
            g2.fillRoundRect((framex - 500) / 2, framey - 50, 500, 28, 5, 5);
            g2.setFont(font);
            g2.setColor(Color.white);
            int off_online = person_Dell.getPerson_vector().size() - online;
            g2.drawString("ÔÚÏß:" + online + "    ÀëÏß:" + off_online +
                    "    Î´´¦Àí¸æ¾¯£º" + Tb_Warnig_Dell.getTbwarning_vector().size() + "  µ±Ç°¹â±ê£ºX=" + x + " ; Y=" + y, (framex - 500) / 2 + 10, framey - 30);
        }
    }
 
 
 
 
    /**
     * »æÖƶ¨Î»ÇøÓò
     */
    public static void lineAndArea(String floor,double x_bi, double y_bi, int x0, int y0, int xpy, int ypy, Graphics2D g2) {
        line(floor, x_bi, y_bi, x0, y0, xpy, ypy, g2);//»æÖÆÒ»Î¬Ïß
        area(floor, x_bi, y_bi, x0, y0, xpy, ypy, g2);//»æÖƶþÎ¬ÇøÓò
    }
 
    //»æÖƶþÎ¬ÇøÓò 2023.08.21 zsh
    private static void area(String floor, double x_bi, double y_bi, int x0, int y0, int xpy, int ypy, Graphics2D g2) {
        Vector<Tb_fence_inout> area = Dell_Fenceinout.getFinout_vec();
        int size1 = area.size();
        if (size1 != 0) {
            for (int i = 0; i < size1; i++) {
                Tb_fence_inout tb_fence_inout = area.get(i);
                String baoliu1 = tb_fence_inout.getBaoliu1();
                if (tb_fence_inout.getFloor().equals(floor)||baoliu1.equals("1")) {
                    String zuobiao = tb_fence_inout.getZuobiao();
                    String[] split = zuobiao.split(";");
                    int length = split.length;
                    int[] xs = new int[length];
                    int[] ys = new int[length];
                    for (int j = 0; j < length; j++) {
                        String s = split[j].trim();
                        String[] split1 = s.split(",");
                        int x = Integer.parseInt(split1[0].trim());
                        int y = Integer.parseInt(split1[1].trim());
                        xs[j] = (new Double((x - xpy) / x_bi)).intValue() + x0;
                        ys[j] = (new Double((y - ypy) / y_bi)).intValue() + y0;
                    }
 
                    g2.setStroke(stroke);
                    g2.setColor(Color.blue);
                    g2.drawString("¶þÎ¬ÇøÓòid:" + tb_fence_inout.getId() + ",Ô¼Êø:" + tb_fence_inout.getGoroup(), xs[0] + 10, ys[0] - 10);
                    if (tb_fence_inout.getGoroup()==3){
                        g2.setColor(new Color(178,34,34,100));
                    }else {
                        g2.setColor(new Color(50, 205, 50, 100));
                    }
                    g2.fillPolygon(xs, ys, length);
                }
            }
        }
    }
 
    //»æÖÆÒ»Î¬Ïß 023.08.21 zsh
    private static void line(String floor, double x_bi, double y_bi, int x0, int y0, int xpy, int ypy, Graphics2D g2) {
        Vector<tb_line> line_vector = Dell_tbline.getLine_vector();
        int size = line_vector.size();
        if (size != 0) {
            for (int i = 0; i < size; i++) {
                tb_line line = line_vector.get(i);
                String flr = line.getFlr();
                String baoliu1 = line.getBaoliu1();
                if (flr.equals(floor) || baoliu1.equals("1")) {
                    int length = line.getPx().length;
                    int[] px = new int[length];
                    int[] py = new int[length];
 
                    for (int j = 0; j < length; j++) {
                        int[] px1 = line.getPx();
                        int[] py1 = line.getPy();
                        px[j] = new Double((px1[j] - xpy) / x_bi).intValue() + x0;
                        py[j] = (new Double((py1[j] - ypy) / y_bi)).intValue() + y0;
 
                    }
                    for (int a = 0; a < length; a++) {
                        g2.setColor(Color.green);
                        g2.fillOval(px[a] - 5, py[a] - 5, 10, 10);
                    }
                    for (int z = 0; z < length - 1; z++) {
 
                        g2.setStroke(stroke);
                        g2.setColor(Color.blue);
                        g2.drawString("һάÏßid:" + line.getLineId() + ",×éid:" + line.getGrp(), px[0], py[0]);
                        g2.setColor(Color.red);
                        g2.drawLine(px[z], py[z], px[z + 1], py[z + 1]);
 
                    }
                }
            }
        }
    }
  
}