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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
package relloc;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Stroke;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.lang.ref.SoftReference;
import java.util.Vector;
import javax.swing.ImageIcon;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
import BaoWen.Stac;
import ColorAndFont.ChooseColor;
import ColorAndFont.UIColor;
import DrawImage.Drawok;
import Frame.AnchorManage;
import Frame.AnchorNearby;
import Frame.DebugManage;
import JNADell.DellJAN;
import Judge.JugeNumber;
import Method.Bj;
import Method.Map_suo_fang;
import PbuliClass.FastAddAnc;
import PbuliClass.Systems;
import PbuliClass.jinternalFrame;
import ToolBarS.ToolBarModel;
import anchor.Anchor;
import anchor.Anchor_Dell;
import anchor.Dell_cengao;
import circle.Dell_ResultYuang;
import circle.Dell_yuang;
import circle.ResultYuang;
import circle.Yuang;
import circle.Yuangvc;
import fence.Fences;
import fence.kaoqing.Dell_KaoQing;
import person.Person;
import person.person_Dell;
import tbDataModel.RealTrackPoint;
import tbDataModel.TbFence;
import tbDataModel.TbMap;
import tbDataModel.Tb_gas_anchor;
import tbDataModel_Dell.Dell_Line;
import tbDataModel_Dell.Dell_ReallPoint;
import tbDataModel_Dell.Dell_tb_gas_anchor;
import tbDataModel_Dell.Dell_yuan;
import tbDataModel_Dell.FontChoose;
import tbDataModel_Dell.Map_Dell;
 
/**¸ÃÀàÓÃÓÚʵʱÏÔʾ±êǩλÖÃ*/
public class RealLoc extends jinternalFrame  implements Runnable {
 
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    Mycanvas mycanvas=null;
    double bi=1;//µØÍ¼Ëõ·Å±ÈÀý³õʼֵΪ1ĬÈϲ»Ëõ·Å    
    int countnum=200;
    Point origin;
    int x0=0;//µØÍ¼Î»ÖÃX×ø±ê,ͨ¹ý¸Ä±ä´ËÖµ¸Ä±äµØÍ¼Î»ÖÃ
    int y0=0;//µØÍ¼Î»ÖÃy×ø±ê,ͨ¹ý¸Ä±ä´ËÖµ¸Ä±äµØÍ¼Î»ÖÃ
    static int x1=0;
    static int y1=0;
    int width;//µØÍ¼³õʼ¿í¶È
    int height;//µØÍ¼³õʼ¸ß¶È
    int new_width;//µØÍ¼ÐµĿí¶È£¬Í¨¹ý¸Ä±ä´ËÖµ¿ÉÒÔ¸Ä±äµØÍ¼µÄ¿í¶È
    int new_height;//µØÍ¼Ðµĸ߶ȣ¬Í¨¹ý¸Ä±ä´ËÖµ¿ÉÒÔ¸Ä±äµØÍ¼µÄ¸ß¶È
    int orix;//µØÍ¼µ±Ç°µÄX×ø±ê
    int oriy;//µØÍ¼µ±Ç°Y×ø±ê
    double x_bi;//ͼƬµÄxÏñËØµãºÍʵ¼Ê³¤µÄ±ÈÖµ
    double y_bi;//ͼƬµÄyÏñËØµãºÍʵ¼Ê¿íµÄ±ÈÖµ
    double map_true_width;//µØÍ¼Êµ¼Ê³¤¶È
    double map_true_height;//µØÍ¼Êµ¼Ê¸ß¶È
    TbMap map=null;//ÉêÃ÷µØÍ¼¶ÔÏó
    Color color;
    String mapfloor;
    int shubiaox;
    int shubiaoy;
    int framey;//µ±Ç°Ãæ°å¸ß¶È
    int framex;//µ±Ç°Ãæ°åµÄ¿í¶È
    int newOffsetX;
    int newOffsetY;
    int shubiao=0;//Êó±êµã»÷µÄ´ÎÊý
    int[] xy=new int[4];
    //µØÍ¼Êµ¼ÊÔ­µã×ø±ê
    int yuan_x0=0;
    int yuan_y0=0;
 
    //µ±Ç°¹â±êµÄ×ø±ê
    int guangx=0;
    int guangy=0;
    static int sosnum=0;
    static boolean relocopen=false;
    int corloc=0;
    static int sleeptime=300;
    Graphics2D g2=null;
 
    Image sos=new ImageIcon("image/icon/sos.png").getImage();
    Image sos1=new ImageIcon("image/icon/sos1.png").getImage();
    Image anchor_red=new ImageIcon("image/anchor/red.png").getImage();
    Image anchor_yellow=new ImageIcon("image/anchor/ceju.png").getImage();
    Image anchor_green=new ImageIcon("image/anchor/lingjin.png").getImage();
    Image anchor_off=new ImageIcon("image/anchor/anchoroff.png").getImage();
    Image anchor_on=new ImageIcon("image/anchor/anchoron.png").getImage();
    
    Color ancid=ChooseColor.getColo("À¶É«",255);
    int online=0;
 
    int showguijitime=Systems.get_real_track_time();
    Color grenn=new Color(50,205,50,150);
    Color red=new Color(255,105,180,150);
 
    boolean showname=Systems.sys().getViewName().equals("1");
    boolean showtagid=Systems.sys().getViewTagid().equals("1");
    SoftReference<Image> sfRefer =null;
    int clickx=0;//Êó±êµã»÷ʱºòµÄX
    int clicky=0;//Êó±êµã»÷ʱºòµÄY
    Stroke stroke=new BasicStroke(2);//ÉèÖû­±Ê
 
    /**¹¹Ôì·½·¨*/
    public RealLoc(String floor,String mapName) {
        map=Map_Dell.get_map(floor);
        mapfloor=map.getFloor();
        String mapAdress="image/mapfile/"+map.getMapname();
        Image image=new ImageIcon(mapAdress).getImage();//»ñÈ¡µØÍ¼
        sfRefer = new SoftReference<Image> (image );
        map_true_width=map.getX_Truelength();
        map_true_height=map.getY_Truewidth();
        width=image.getWidth(this);
        height=image.getHeight(this);
        new_width=width;
        new_height=height;
        x_bi=map_true_width/new_width;//µØÍ¼µÄʵ¼Ê³¤¶ÈºÍеĿí¶È±ÈÖµ
        y_bi=map_true_height/new_height;//µØÍ¼Êµ¼Ê¸ß¶ÈºÍеĸ߶ȱÈÖµ
        color=Color.red;
        Container rq=getContentPane();//»ñÈ¡ÈÝÆ÷
        rq.setLayout(new BorderLayout());
        rq.setBackground(Color.white);
        mycanvas=new Mycanvas();//³õʼ»¯»æÍ¼Ãæ°å¶ÔÏó
        this.setTitle(mapName);
        this.setFrameIcon(new ImageIcon("image/icon/mapicon.png"));//ÉèÖô°Ìåͼ±ê
        rq.add(mycanvas,BorderLayout.CENTER);
        yuan_x0=Map_Dell.get_map(mapfloor).getX0_length();
        yuan_y0=Map_Dell.get_map(mapfloor).getY0_width();
 
        startThread();//Æô¶¯Ïß³Ì
        this.addInternalFrameListener(new InternalFrameListener() {
 
            @Override
            public void internalFrameOpened(InternalFrameEvent e) {
 
            }
 
            @Override
            public void internalFrameIconified(InternalFrameEvent e) {
                sleeptime=2000;
                relocopen=false;
                Dell_ReallPoint.clear();
            }
 
            @Override
            public void internalFrameDeiconified(InternalFrameEvent e) {
                sleeptime=300;
                relocopen=true;
            }
 
            @Override
            public void internalFrameDeactivated(InternalFrameEvent e) {
 
            }
 
            @Override
            public void internalFrameClosing(InternalFrameEvent e) {
                relocopen=false;
                sfRefer =null;
                Tanchu_Menu.setKusubudain(false);
            }
 
            @Override
            public void internalFrameClosed(InternalFrameEvent e) {
            }
 
            @Override
            public void internalFrameActivated(InternalFrameEvent e) {
            }
        });
 
 
 
    }
 
    /**Æô¶¯Ï̵߳ķ½·¨*/
    public void startThread() {
        Thread t=new Thread(this);
        relocopen=true;
        t.start();
    }
 
    public void run() {
        while(true) {
            try {
                if(map !=null) {
                    if(relocopen) {
                        mycanvas.repaint();
                    }
                }
                Thread.sleep(sleeptime);//ÐÝÃßʱ¼ä
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
 
    /**ÄÚ²¿µÄ»­²¼*/
    class Mycanvas extends Canvas implements MouseListener,MouseMotionListener,MouseWheelListener {
        /**
         *
         */
        private static final long serialVersionUID = 1L;
        public void update(Graphics g){        //¸²¸Çupdate·½·¨£¬½ØÈ¡Ä¬Èϵĵ÷Óùý³Ì
            Image ImageBuffer = createImage(this.getWidth(), this.getHeight());    //´´½¨Í¼Ðλº³åÇø
            Graphics GraImage = ImageBuffer.getGraphics();        //»ñȡͼÐλº³åÇøµÄͼÐÎÉÏÏÂÎÄ
            paint(GraImage);        //ÓÃpaint·½·¨ÖбàдµÄ»æÍ¼¹ý³Ì¶ÔͼÐλº³åÇø»æÍ¼
            GraImage.dispose();        //ÊÍ·ÅͼÐÎÉÏÏÂÎÄ×ÊÔ´
            g.drawImage(ImageBuffer, 0, 0, this);    //½«Í¼Ðλº³åÇø»æÖƵ½ÆÁÄ»ÉÏ
 
            ImageBuffer =null;
            GraImage =null;
        }
 
        public Mycanvas() {
            origin = new Point();;
            addMouseWheelListener(this);
            addMouseListener(this);
            addMouseMotionListener(this);
        }
 
        public void paint(Graphics g) {
 
            g2=(Graphics2D) g;
            g2.setColor(getBackground());
            g2.fillRect(0,0,this.getSize().width,this.getSize().height);
            g2.drawImage(sfRefer.get(), x0, y0, new_width, new_height,this);
            x1=x0;
            y1=y0;
            framey=this.getSize().height;//µ±Ç°Ãæ°åµÄ¸ß¶È
            framex=this.getSize().width;
 
            if(true) {    //»æÖÆÔ­µã
                double aa=(-yuan_x0/x_bi)+x0;
                double bb=(-yuan_y0/y_bi)+y0;
                int x_newyuan=(int)aa;
                int y_newyuan=(int)bb;
                g2.setColor(Color.red);
                g2.fillOval(x_newyuan-4, y_newyuan-4,8,8);
            }
 
            Vector<Person> pervc=person_Dell.getPerson_vector();
            if(Stac.isSerchperson()) {
                String tagid=Stac.getSerchtagid();
                if(!tagid.equals("0")) {
                    pervc=person_Dell.serch(tagid);
                }
            }
 
            //»æÖÆ»ùÕ¾
            draw_anchor(g2);
            draw_gasanchor(g2) ;//»æÖÆÆøÑ¹»ùÕ¾
 
            //»æÖƱêÇ©¶ÔÏó
            int size=pervc.size();
            online=size;
            if( size!=0) {
                for(int i=0;i<size;i++) {
                    Person person=pervc.get(i);
                    String personid=person.getP_tagid();                    
                    if(Systems.isIssanwei()) {//Èç¹û¿ªÆôÈýάģʽ
                        if( person.getP_name().equals("ÆøÑ¹»ùÕ¾")) {
                            continue;
                        }
                    }
 
                    int person_online=Integer.parseInt(person.getP_online());//±êÇ©ÊÇ·ñÔÚÏß
                    if(person_online==0) {
                        online--;
                    }
 
                    //±êÇ©ÊÇ·ñÔÚ¿¼ÇÚÇøÓò
                    int person_inkaoqing=Integer.parseInt(person.getP_kaoqing());
 
                    //Èç¹û¿ªÆôÀëÏßÏûʧͬʱ±êÇ©ÀëÏß
                    if(Systems.sys().getOffView().equals("1") && person_online==0) {
                        continue;
                    }
 
                    //Èç¹ûϵͳ¿ªÆôÁ˳ö¿¼ÇÚÇøÓòÏûʧͬʱ±êÇ©ÓÖ²»ÔÚ¿¼ÇÚÇøÓò
                    if(Systems.isOffkaoqing() && person_inkaoqing==0 || person.getInwuxiaoqu()==1 ) {
                        //Ìø³öµ±Ç°Ñ­»·½øÈëÏÂÒ»´ÎÑ­»·
                        continue;
                    }
 
 
                    if(person.getP_floor().equals(mapfloor) ) {
                        int posx=person.getP_x();
                        int posy=person.getP_y();
                        int x=(int)get_xpos(mapfloor,posx);
                        int y=(int)get_ypos(mapfloor,posy);
 
                        int tbw=person.getP_image().getIconWidth();
                        int tbh=person.getP_image().getIconHeight();
 
                        //»ñÈ¡±êÇ©µçÁ¿
                        String powers=person.getP_power();
                        if(powers==null) {
                            powers="100";
                        }else {
                            if(!JugeNumber.isDigit(powers)) {
                                powers="100";
                            }
                        }
                        int power=Integer.parseInt(powers);
                        drawtuoyuan(g2,x,y,person);//»æÖÆÍÖÔ²
                        drawguiji(personid,g2);    //»æÖƱêÇ©¹ì¼£
                        ischoosetag(g2,person,posx,posy);//±êÇ©È类ѡÖÐ
                        if(person.getIschoose()==1){
                            drawperson_more(
                                    g2,
                                    x,
                                    y,
                                    person.getP_name(),
                                    person.getP_phone(),
                                    person.getP_tagid(),
                                    person.getP_department(),
                                    person.getP_power(),
                                    person.getJingdu(),
                                    person.getWeidu(),
                                    person.getGao(),
                                    posx,
                                    posy,
                                    mapfloor,
                                    person.getGpsstate(),
                                    person,
                                    framex,
                                    framey);
                            g2.drawImage(person.getP_image().getImage(), x-tbw/2, y-tbh,tbw,tbh,this);
                        }else {
                            //»æÖƱêÇ©,±êÇ©²»ÔÚSOS£¬²»ÔÚΣÏÕÇøÓò£¬±êÇ©ÔÚÏß
                            if(person.getSos_state().equals("0") && person.getP_fence().equals("0") ) {
                                g2.drawImage(person.getP_image().getImage(), x-tbw/2, y-tbh,tbw,tbh,this);
                            }else {
                                tbw=40;
                                tbh=40;
                                sosnum++;
                                if(sosnum==4) {
                                    g2.drawImage(sos, x-15,y-30,30,30,this);
                                    sosnum=0;
                                }else {
                                    g2.drawImage(sos1,x-15, y-30,30,30,this);
                                }
                            }
 
                            if(showtagid && showname) {//»­±³¾°¿ò
                                g2.setColor(grenn);//ÂÌÉ«
                                if(power<10) {
                                    g2.setColor(red);//ºìÉ«
                                }
                                g2.fillRoundRect(x-45, y-tbh-35,90,30,3,3);
                                g2.setFont(FontChoose.ziti(14));
                                g2.setColor(Color.white);
                                g2.drawString(person.getP_name(), x-40, y-tbh-15);
                                g2.drawString(person.getP_tagid(), x+10, y-tbh-15);
                            }else {
                                g2.setColor(grenn);//ÂÌÉ«
                                if(power<10) {
                                    g2.setColor(red);//ºìÉ«
                                }
                                g2.fillRoundRect(x-30, y-tbh-35,60, 30,3,3);
                                if(showname) {
                                    g2.setFont(FontChoose.ziti(14));
                                    g2.setColor(Color.white);
                                    g2.drawString(person.getP_name(), x-20, y-tbh-15);
                                }else {
                                    g2.setFont(FontChoose.ziti(14));
                                    g2.setColor(Color.white);
                                    g2.drawString(person.getP_tagid(), x-20, y-tbh-15);
                                }
                            }
 
                            if(Systems.isShow0ceng()) {
                                g2.setColor(red);//±êǩʵ¼ÊËùÔÚµÄÂ¥²ã
                                g2.fillRoundRect(x-30, y-tbh-70,60, 30,3,3);
                                g2.setColor(Color.white);
                                g2.drawString("ÔÚ"+person.getFloortrue()+"²ã", x-20, y-tbh-50);
                            }
 
                            //ÏÔʾͼ±êʵʱλÖÃ×ø±ê
                            if(Systems.sys().getTagZb().equals("1")) {
                                g2.setFont(FontChoose.ziti(14));
                                g2.setColor(Color.gray);
                                String zb="["+posx+","+posy+"]";
                                g2.drawString(zb,x-tbw,y+tbh/2);
                            }
                        }
                    }
                }
            }
 
            //ËíµÀģʽ
            draw_suidaotongji(g2);
 
            //ÏÔʾÔÚÏß±êÇ©×ÜÊý
            Drawok.tagidnum(guangx,guangy,framey,framex,g2,online);
 
            /**»æÖÆÆøÌå´«¸ÐÆ÷¶ÔÏó*/
            Drawok.gas(mapfloor, x_bi, y_bi, x0, y0, g2);
 
            /**»­Ô²È¦,Èç¹ûϵͳµ÷ÊÔ¿ªÆô**/
            int rownum=DebugManage.getSelectedRow();
            if(rownum !=(-1)) {
                String a=(String) DebugManage.getTable().getValueAt(rownum, 0);
                int key=Integer.parseInt(a);
                Yuangvc yvc=Dell_yuang.get_Yuangvc(key,mapfloor);
                if(yvc !=null) {
                    Vector<Yuang>  circ=yvc.getYuangs();
                    int size1=circ.size();
                    if( size1 !=0) {
 
                        for(int i=0;i<size1;i++) {
                            int anx=get_xpos(mapfloor,circ.get(i).getX());
                            int any=get_ypos(mapfloor,circ.get(i).getY());
                            int anchorh=circ.get(i).getAnchor_h();
                            int tagh=circ.get(i).getTag_h();
 
                            //°ë¾¶µÄƽ·½
                            double r=circ.get(i).getWidth();
                            double rr=r*r;
                            //²ã¸ß
                            int cengid=Integer.parseInt(mapfloor);
                            String buttom=Dell_cengao.get_tbceng(cengid).getButtom();
                            double cenggao=Double.parseDouble(buttom);
                            //¸ß¶È²îµÄƽ·½
                            double hh=(anchorh-tagh-cenggao)*(anchorh-tagh-cenggao);
                            double r_h=rr-hh;
                            if (r_h<0){
                                r_h=5;
                            }
                            if(r_h>0) {
                                int r1=2*new Double(Math.sqrt(r_h)/x_bi).intValue();
                                int r2=2*new Double(Math.sqrt(r_h)/y_bi).intValue();
                                g2.setColor(Color.red);
                                g2.setStroke(new BasicStroke(1.0f));
                                g2.drawOval(anx-r1/2, any-r2/2,r1,r2);
                                g2.drawImage(Anchor_Dell.getCeju(), anx-15, any-30,30,30,this);
                            }
                        }
 
                        circ=null;
                    }
 
                    ResultYuang rsy=Dell_ResultYuang.get_resty(key);
                    String afloor=String.valueOf(rsy.getFloor());
                    if(afloor.equals(mapfloor)) {
                        g2.setColor(UIColor.getGrenn());
                        int x=rsy.getX();
                        int y=rsy.getY();
                        int anx=get_xpos(mapfloor,x);
                        int any=get_ypos(mapfloor,y);
                        g2.fillOval(anx-7,any-7,14,14);
                    }
                    rsy=null;
                    afloor=null;
                }
            }
 
            /**»æÖÆÖ±Ïß*/
            Drawok.drawyuan(x_bi, y_bi, x0, y0, g2);
            Drawok.line(x_bi, y_bi, x0, y0, g2);
 
            /**»æÖÆÒѾ­´æÔÚµÄΧÀ¸¶ÔÏó**/
            if(ToolBarModel.isShowfence()) {
                Drawok.draw_point_inoutLine(mapfloor,g2);
                Drawok.fence(mapfloor, x_bi, y_bi, x0, y0,yuan_x0,yuan_y0, g2,bi);
                Drawok.draw_point_inout(mapfloor, x_bi, y_bi, x0, y0,yuan_x0,yuan_y0,g2);
            }
            if (ToolBarModel.getSuanFa()){
                Drawok.lineAndArea(mapfloor, x_bi, y_bi, x0, y0,yuan_x0,yuan_y0,g2);
            }
 
            g2=null;
 
        }
 
        public void mouseReleased(MouseEvent e) {//°´¼üÊÍ·Å
            clickx=0;
            clicky=0;
            setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        }
 
        public void mousePressed(MouseEvent e) {//°´¼ü°´ÏÂ
            origin.= e.getX(); //»ñµÃÊó±êµã»÷ʱºòµÄX×ø±ê
            origin.= e.getY();//»ñµÃÊó±êµã»÷ʱºòµÄY×ø±ê
            orix=x0;//½«µ±Ç°Í¼Æ¬µÄÆðµã×ø±êX¸øorix
            oriy=y0;//½«µ±Ç°Í¼Æ¬µÄÆðµã×ø±êX¸øoriy
 
            int x_cursor=e.getX();//Êó±ê¶ÔÓ¦µÄÏñËØµã
            int y_cursor=e.getY();//Êó±ê¶ÔÓ¦µÄÏñËØµã
            shubiaox=(new Double((x_cursor-x0)*x_bi)).intValue();//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êx
            shubiaoy=(new Double((y_cursor-y0)*y_bi)).intValue();//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êy
            clickx=shubiaox+yuan_x0;
            clicky=shubiaoy+yuan_y0;
 
        }
 
        public void mouseExited(MouseEvent e) {//Êó±êÍ˳ö
 
        }
 
        public void mouseEntered(MouseEvent e) {//Êó±ê½øÈë
            setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        }
 
        /**Êó±êµã»÷ʼþ*/
        public void mouseClicked(MouseEvent e) {//Êó±êµã»÷
            if(e.isMetaDown()){//¼ì²âÊó±êÓÒ¼üµ¥»÷
                popupMenu().show(e.getComponent(), e.getX(), e.getY());
 
            }else if(e.getButton()==MouseEvent.BUTTON1){//µã»÷Êó±ê×ó¼ü
                if(ToolBarModel.isDrawline()) {
                    if(shubiao==0) {
                        xy[0]=shubiaox;
                        xy[1]=shubiaoy;
                        Dell_yuan.insert_yuan(xy[0], xy[1],6,6);
                        shubiao++;
                    }else if(shubiao==1) {
                        xy[2]=shubiaox;
                        xy[3]=shubiaoy;
                        Dell_yuan.insert_yuan(xy[2], xy[3],6,6);
                        //¹´¹É¶¨Àí¼ÆËãб±ßµÄ³¤¶È
                        double a0=xy[2]-xy[0];
                        double b0=xy[3]-xy[1];
                        double distance=Math.sqrt(a0*a0+b0*b0);
                        Dell_Line.insert_aline(xy,distance);
                        shubiao=0;
                    }
                }
 
                //¹öÂÖ°´ÏÂ
            }else if(e.getButton()==MouseEvent.BUTTON2) {
                DellJAN.SetSetReferencePoint(guangx,guangy);
            }
 
            if(e.getButton()==MouseEvent.BUTTON1 && Tanchu_Menu.isKusubudain()) {
                if(!Bj.isHavefas()) {
                    FastAddAnc fa=new FastAddAnc("¿ìËÙÔö¼Ó»ùվģʽ");
                    String id=Bj.getAnc()+"";
                    fa.getAnchorIdFile().setText(id);
                    fa.getPosxFile().setText(guangx+"");
                    fa.getPosyFile().setText(guangy+"");
                    fa.getPoszFile().setText("200");
                    Bj.setHavefas(true);
                }
            }
 
        }
 
        public void mouseDragged(MouseEvent e) {
            setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
            //Ãæ°åеÄ×ø±êλÖà = Òƶ¯Ç°×ø±êλÖÃ+£¨Êó±êÖ¸Õëµ±Ç°×ø±ê-Êó±ê°´ÏÂʱָÕëµÄλÖã©
            x0=orix+e.getX()-origin.x;
            y0=oriy+e.getY()-origin.y;
            this.repaint();
 
        }
 
        public void mouseMoved(MouseEvent e) {
            int x_cursor=e.getX();//Êó±ê¶ÔÓ¦µÄÏñËØµã
            int y_cursor=e.getY();//Êó±ê¶ÔÓ¦µÄÏñËØµã
            shubiaox=(new Double((x_cursor-x0)*x_bi)).intValue();//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êx
            shubiaoy=(new Double((y_cursor-y0)*y_bi)).intValue();//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êy
            guangx=shubiaox+yuan_x0;
            guangy=shubiaoy+yuan_y0;
            clickx=0;
            clicky=0;
        }
 
        /**Êó±ê¹öÂÖ¹ö¶¯Ê¼þ¼àÌý*/
        public void mouseWheelMoved(MouseWheelEvent e) {//Êó±ê¹öÂÖ¹ö¶¯¼àÌý
            //e.getWheelRotation()>0±íʾÊó±ê¹öÂÖÏòÍâ¹ö¶¯Ð¡ÓÚ0±íʾÏòÄÚ¹ö¶¯
            int xh1=e.getX();
            int yh1=e.getY();
            double bi0=bi;
            int xr=x0;
            int yr=y0;
 
            if(e.getWheelRotation()>0 && countnum>0 ) {//ËõСͼƬ
 
                countnum=countnum-50;
                bi=Map_suo_fang.get_bi(countnum);
 
            }
 
 
            if(e.getWheelRotation()<0 && countnum <600) {//·Å´óͼƬ
                countnum=countnum+50;
                bi=Map_suo_fang.get_bi(countnum);
            }
 
 
            new_width=new Double(width*bi).intValue();//ͼƬеĿí¶È
            new_height=new Double(height*bi).intValue();//ͼƬеĸ߶È
 
            x_bi=map_true_width/new_width;//µØÍ¼µÄʵ¼Ê³¤¶ÈºÍеĿí¶È±ÈÖµ
            y_bi=map_true_height/new_height;//µØÍ¼Êµ¼Ê¸ß¶ÈºÍеĸ߶ȱÈÖµ
            map.setXb(x_bi);
            map.setYb(y_bi);
            //x0=new Double(xh1-width/2*bi).intValue();
            //y0=new Double(yh1-height/2*bi).intValue();
 
            x0=new Double(xh1-(xh1-xr)*bi/bi0).intValue();
            y0=new Double(yh1-(yh1-yr)*bi/bi0).intValue();
            this.repaint();
 
 
        }
 
 
    }
 
 
    /**µ¯³ö²Ëµ¥À¸*/
    public JPopupMenu popupMenu() {
        JPopupMenu popupMenu = new JPopupMenu();// ´´½¨µ¯³öʽ²Ëµ¥¶ÔÏó        
        popupMenu.setBorderPainted(false);
        JMenuItem  center = new JMenuItem("Ô­µã¾ÓÖÐ");//´´½¨²Ëµ¥Ïî
        center.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                // TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
                x0=framex/2;
                y0=framey/2;
                mycanvas.repaint();
            }
        });
 
        JMenuItem accolor=new JMenuItem("»ùÕ¾ÑÕÉ«");
        accolor.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                // TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
                if(corloc==0) {
                    ancid=ChooseColor.getColo("°×É«",255);
                    corloc=1;
                }else if(corloc==1) {
                    ancid=ChooseColor.getColo("ºÚÉ«",255);
                    corloc=2;
                }else if(corloc==2) {
                    ancid=ChooseColor.getColo("ºìÉ«",255);
                    corloc=0;
                }
                mycanvas.repaint();
            }
        });
 
 
 
        popupMenu.add(center);
        popupMenu.addSeparator();// Ìí¼Ó·Ö¸ôÏß
        popupMenu.add(Tanchu_Menu.get_sousuo());
        popupMenu.addSeparator();
        popupMenu.add(Tanchu_Menu.get_sendtext());
        popupMenu.addSeparator();
        popupMenu.add(accolor);
        popupMenu.addSeparator();
        popupMenu.add(Tanchu_Menu.get_fastbudian());
        popupMenu.addSeparator();
        popupMenu.add(Tanchu_Menu.get_clerguiji());
        popupMenu.addSeparator();
        popupMenu.add(Tanchu_Menu.get_xiangxi());
        return popupMenu;
    }
 
 
 
    /**»ñÈ¡ÔÚµØÍ¼ÖеÄX×ø±ê*/
    public static int get_xpos(String mapfloor, int x){
        int a0=Map_Dell.get_map(mapfloor).getX0_length();
        double anc_x=x-a0;
        double x1_bi=Map_Dell.get_map(mapfloor).getXb();
        double xx=(anc_x/x1_bi)+x1;
        int anx=(int)Math.round(xx);
        return anx;
    }
 
    /**»ñÈ¡ÔÚµØÍ¼ÖеÄY×ø±ê*/
    public static int get_ypos(String mapfloor,int y){
        int b0=Map_Dell.get_map(mapfloor).getY0_width();
        double anc_y=y-b0;
        double y1_bi=Map_Dell.get_map(mapfloor).getYb();
        double yy=(anc_y/y1_bi)+y1;
        int any=(int)Math.round(yy);
        return any;
    }
 
    public static boolean isRelocopen() {
        return relocopen;
    }
 
 
    /**»æÖƱêÇ©¶ÔÏóµÄ¹ì¼£*/
    public void drawguiji(String tagid,Graphics2D g2) {
        if( showguijitime !=0) {
            Vector<RealTrackPoint> track_vector=Dell_ReallPoint.get_rtpt(tagid);
            if( track_vector !=null && track_vector.size()!=0) {
                for(int k=0;k<track_vector.size();k++) {
                    RealTrackPoint tb=track_vector.get(k);
                    int tbx1=tb.getX()-Map_Dell.get_map(mapfloor).getX0_length();
                    int tby1=tb.getY()-Map_Dell.get_map(mapfloor).getY0_width();
                    double ff=(tbx1/x_bi)+x0;
                    double gg=(tby1/y_bi)+y0;
                    int tbx=(int)ff;
                    int tby=(int)gg;
                    if(tb.getFloor().equals(mapfloor)) {
                        g2.setColor(Systems.get_real_track_color());
                        g2.fillOval(tbx-2, tby-2,4,4);
                    }
                    tb=null;
                }
                //ɾ³ý³¬Ê±µÄ¹ì¼£
                Dell_ReallPoint.delte_off_time_track(tagid);
            }
        }
    }
 
    /**»æÖÆ»ùÕ¾¶ÔÏó*/
    public void draw_anchor(Graphics2D g2) {
        if(Systems.isShowanchor()) {
            int size2=Anchor_Dell.getAnchor_vector().size();
            if(size2!=0) {
                for(int k=0;k<size2;k++) {
                    Anchor anchor=Anchor_Dell.getAnchor_vector().get(k);
                    Image image=anchor.getAnc_image();
                    if(mapfloor.equals(anchor.getAnc_floor())) {
                        String axs=anchor.getAnc_x();
                        String ays=anchor.getAnc_y();
                        double axd = Double.valueOf(axs);
                        double ayd = Double.valueOf(ays);
                        int acx=(int) axd;
                        int acy=(int) ayd;
                        int anx=get_xpos(mapfloor,acx);
                        int any=get_ypos(mapfloor,acy);
                        if(image!=null) {
                            int anwidth=image.getWidth(this);
                            int anheight=image.getHeight(this);
                            //Èç¹û»ùÕ¾ÊDZ»Ñ¡ÖеĻùÕ¾
                            if(AnchorManage.getChoose_anchor().equals(anchor.getAnc_id())) {//»ùÕ¾±»Ñ¡ÖÐ
                                image=anchor_yellow;
                            }else {
                                if(anchor.getAnchor_distance_state()==1) {//»ùÕ¾²â¾à״̬Òì³£
                                    image=anchor_red;
                                }else if(anchor.getAnchor_power_state()==1){//»ùÕ¾µçÁ¿×´Ì¬Òì³£ºìÉ«
                                    image=anchor_red;
                                }else {
                                    if(anchor.getAnc_status().equals("1") ){
                                        image=anchor_on;
                                    }else {
                                        image=anchor_off;
                                    }
                                    
                                }                                
                            }
                            g2.drawImage(image, anx-anwidth/2, any-anheight,anwidth,anheight,this);
                            //Èç¹ûÁÙ½üÅäÖñ»Ñ¡ÖÐ
                            Vector<String> vecnertac=AnchorNearby.getChoose_anchor();
                            if(vecnertac.size() !=0) {
                                for(int i=0;i<vecnertac.size();i++) {
                                    String anchorid=vecnertac.get(i);
                                    if(i==0 && anchorid.equals(anchor.getAnc_id())) {
                                        image=anchor_yellow;
                                    }else if(i!=0 && anchorid.equals(anchor.getAnc_id())) {
                                        image=anchor_green;
                                    }
                                    g2.drawImage(image, anx-anwidth/2, any-anheight,anwidth,anheight,this);
                                }
                            }
 
 
                            if(Systems.sys().getViewAnckid().equals("1")) {
                                g2.setFont(FontChoose.ziti(14));
                                g2.setColor(ancid);
                                g2.drawString(anchor.getAnc_id(),anx-15,any-anheight-6);
                            }
 
                            if(Systems.isShowanczuobiao()) {
                                g2.setFont(FontChoose.ziti(14));
                                g2.setColor(Color.gray);
                                String anx1=anchor.getAnc_x();
                                String any1=anchor.getAnc_y();
                                String anzb="["+anx1+","+any1+"]";
                                g2.drawString(anzb,anx-20,any+14);
                            }
                        }
                    }
                }
            }
        }
 
    }
 
    /**»æÖÆÆøÑ¹»ùÕ¾*/
    public void draw_gasanchor(Graphics2D g2) {
        if(Systems.isIssanwei()) {
            Vector<Tb_gas_anchor> gas_anchorvc=Dell_tb_gas_anchor.getGas_anchorvc();
            int size=gas_anchorvc.size();
            for(int i=0;i<size;i++) {
                String axs=gas_anchorvc.get(i).getAnchorx();
                String ays=gas_anchorvc.get(i).getAnchory();
                double axd = Double.valueOf(axs);
                double ayd = Double.valueOf(ays);
                int acx=(int) axd;
                int acy=(int) ayd;
                int anx=get_xpos("0",acx);
                int any=get_ypos("0",acy);
                int anwidth=gas_anchorvc.get(i).getAnc_image().getWidth(this);
                int anheight=gas_anchorvc.get(i).getAnc_image().getHeight(this);
                g2.drawImage(gas_anchorvc.get(i).getAnc_image(), anx-anwidth/2, any-anheight,anwidth,anheight,this);
 
                g2.setFont(FontChoose.ziti(14));
                g2.setColor(ancid);
                g2.drawString(gas_anchorvc.get(i).getAnchorid(),anx-15,any-anheight-6);
            }
        }
    }
 
 
    /**»æÖÆËíµÀͳ¼Æ*/
    public void draw_suidaotongji(Graphics2D g2) {
        if(Systems.isSuidaomoshi()) {
            Vector<TbFence> kqfc=Fences.get_kaoqing_fences(mapfloor);
            if(kqfc !=null) {//Èç¹û¿¼ÇÚÇøÓò´æÔÚ
                int size1=kqfc.size();
                int hig=60;
                if (size1>2){
                    hig=30*(size1+1);
                }
                int j=30;
                g2.setColor(ChooseColor.getColo("Æ·ºì", 100));
                g2.fillRoundRect(50,10,140,hig, 10, 10);
                g2.setFont(FontChoose.ziti(18));
                g2.setColor(Color.white);
                if(size1 !=0) {
                    for(int i=0;i<size1;i++) {
                        String name=kqfc.get(i).getName();
                        if(size1==1) {
                            String kq=Dell_KaoQing.kao_qing_num(name, mapfloor);
                            g2.drawString(kq, 65,50);
                            return;
                        }else {
                            String kq=Dell_KaoQing.kao_qing_num(name, mapfloor);
                            g2.drawString(kq,65, i*j+30);
                        }
                    }
                    //¿¼ÇÚÇøÓò×ÜÈËÊý  2023.07.19 zsh
                    int kq=Dell_KaoQing.all_kaoqing();
                    g2.drawString("×ÜÈËÊý£º"+kq+"ÈË",65,(size1)*j+30);
                }
            }
        }
    }
 
 
    /**ÏÔʾ¸ü¶àÐÅÏ¢*/
    int jxw=280;//¾ØÐ㤶È
    int jxh=120;//¾ØÐοí¶È
    public void drawperson_more(
            Graphics2D g2,
            int x,
            int y,
            String name,
            String phone,
            String tagid,
            String bumen,
            String power,
            String jd,//¾­¶È
            String wd,//γ¶È
            String gc,
            int posx,
            int posy,
            String floor,
            String state,//¾«¶È״̬
            Person person,
            int framex,
            int framey
            ) {
        int posfrom=person.getPosfrom();//λÖÃÊý¾ÝÀ´Ô´
        g2.setColor(grenn);
        int x2=x-jxw/2;
        int y2=y-10-jxh;
        g2.fillRoundRect(x2,y2,jxw,jxh, 10, 10);//»æÖƾØÐÎ
        int[] xPoints= {x-5,x+5,x};
        int[] yPoints= {y-10,y-10,y};
        g2.fillPolygon(xPoints, yPoints,3);
        g2.setColor(Color.white);
        g2.setFont(FontChoose.ziti(14));
        g2.drawString(bumen+","+name+","+tagid+","+power+"%"+","+posfrom,x2+10,y2+20);
        g2.drawString("µç»°:"+phone,x2+10,y2+45);
        g2.drawString("¾­Î³:"+jd+";"+wd+";"+gc,x2+10,y2+70);
        g2.drawString("×ø±ê:"+posx+";"+posy+";"+person.getP_z()+";"+floor+";"+state,x2+10,y2+95);
 
        g2.setColor(ChooseColor.getColo("Æ·ºì", 100));
        int x22=20;
        int y22=20;
        int x23=30;
        int y23=y22+20;
        int n=21;
        g2.fillRoundRect(x22,y22,200,n*11+20,5,5);
        g2.setColor(Color.white);
        g2.drawString("É豸±àºÅ:"+person.getP_tagid(),x23,y23);
        g2.drawString("ÊÇ·ñ²ð³ý:"+person.getTagoff(),x23,y23+n*1);
        g2.drawString("ʵʱÐÄÂÊ:"+person.getBaoliu16(),x23,y23+n*2);
        g2.drawString("¾²Ö¹×´Ì¬:"+person.getJingzhi(),x23,y23+n*3);
        g2.drawString("ÐÞÃß״̬:"+person.getXiumian(),x23,y23+n*4);
        g2.drawString("ʵʱµçÁ¿:"+person.getP_power(),x23,y23+n*5);
        g2.drawString("ʱ¼äƬÊý:"+person.getPian(),x23,y23+n*6);
        g2.drawString("ʵʱƵÂÊ:"+person.getRealhz(),x23,y23+n*7);
        g2.drawString("²â¾àÖ÷Õ¾:"+person.getNow_ceju_anchorid(),x23,y23+n*8);
        String reson=person.getIndoor_or_outdoor()+","+person.getReason_indoor_from();
        g2.drawString("ʵʱ¸ß¶È:"+person.getP_z(),x23,y23+n*9);
        g2.drawString("λÖÃÀ´Ô´:"+reson,x23,y23+n*10);
 
    }
 
    /**µ±Ç°Êó±êµÄXºÍµ±Ç°Êó±êµÄY*/
    public void ischoosetag(Graphics2D g2,Person person,int posx,int posy) {
        if(Tanchu_Menu.isShowxiagnxi()) {
            if(clickx !=0 && clicky !=0) {
                int x1=clickx+80;
                int y1=clicky+80;
                int choose=person.getIschoose();
                if( clickx-40<=posx && posx<=x1 && clicky-40<=posy && posy<=y1) {
                    if(choose==0) {
                        person.setIschoose(1);
                    }else {
                        person.setIschoose(0);
                    }
                }
            }
        }
    }
 
    /**»æÖÆÍÖÔ²*/
    public static void drawtuoyuan(Graphics2D g2,int x,int y,Person person) {
        g2.setColor(Color.green);
        if(person.getPosfrom()==0) {
            g2.setColor(Color.RED);
        }
        int num2=person.getTuoyuan_num();
        if(person.getJingzhi().equals("1")) {
            g2.setColor(Color.ORANGE);
            g2.setStroke(new BasicStroke(4.0f));
            g2.drawOval(x-10,y-5,20,10);//x,y,width,heigh
        }else {
            if(num2==3) {
                g2.setStroke(new BasicStroke(2.0f));
                g2.drawOval(x-10,y-5,20,10);//x,y,width,heigh
                person.setTuoyuan_num(2);
            }else if(num2==2) {
                g2.setStroke(new BasicStroke(4.0f));
                g2.drawOval(x-10,y-5,20,10);//x,y,width,heigh
                person.setTuoyuan_num(0);
            }else if(num2==0) {
                g2.setStroke(new BasicStroke(1.0f));
                g2.drawOval(x-10,y-5,20,10);//x,y,width,heigh
                person.setTuoyuan_num(3);
            }
        }
    }
 
    public int getX0() {
        return x0;
    }
 
    public void setX0(int x0) {
        this.x0 = x0;
    }
 
 
}