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
package tbDataModel_Dell;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import DataBase.DatabaseManagement;
import Method.GetNowTime;
import PbuliClass.ShowMessage;
import home.Open_soft_dialog;
import tbDataModel.TbMap;
import urt.GnssToXY;
/**¸ÃÀàÓÃÓÚµØÍ¼µÄ´¦Àí*/
@SuppressWarnings("rawtypes")
public class Map_Dell {
    static Vector<TbMap> map_vector;//µØÍ¼µÄ¼¯ºÏ
    static Vector<csxy> csxyvc=new Vector<csxy>();
    //    static String ajwxy="11615.41730;3951.73757;1700;-4000";//AÔ­µã¾­¶Èά¶ÈXY×ø±ê
    //    static String bjwxy="11615.42906;3951.74345;700;-4000";//AÔ­µã¾­¶Èά¶ÈXY×ø±ê
    static {    
        Open_soft_dialog.addara("¼ÓÔØtb_map");
        Iterator iterator = DatabaseManagement.get_alldate_indatabase("tb_map").iterator();
        map_vector=new Vector<>();
        while (iterator.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ            
            List info = (List) iterator.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½info¼¯ºÏ
            TbMap map=new TbMap();
            String floor=(String)info.get(1);
            map.setFloor(floor);
            map.setMapname((String)info.get(2));
            map.setX_Truelength(Integer.parseInt((String)info.get(3)));
            map.setY_Truewidth(Integer.parseInt((String)info.get(4)));
            map.setX0_length(Integer.parseInt((String)info.get(5)));
            map.setY0_width(Integer.parseInt((String)info.get(6)));
            map.setX_Pixel(Integer.parseInt((String)info.get(7)));
            map.setY_Pixel(Integer.parseInt((String)info.get(8)));
            map.setAddTime((String)info.get(9));
            map.setJingdu((String)info.get(10));
            map.setWeidu((String)info.get(11));
            map.setJiajiao((String)info.get(12));
            String baoliu1=(String)info.get(13);//Aµã¾­¶ÈXY
            String baoliu2=(String)info.get(14);//Bµã¾­¶ÈXY
            String baoliu3=(String)info.get(15);
            String baoliu4=(String)info.get(16);
            if(baoliu1==null) {
                baoliu1="0";
            }else {
                if(Dell_tb_suanfa2.isGnss2xyopen()) {
                    if(baoliu1.split(";").length==4) {
                        //                        ajwxy=baoliu1;
                    }else {
                        ShowMessage.zidingyi_24(floor+"²ã£¬Ëã·¨ÅäÖÃAµã¾­Î³¶ÈXY×ø±ê²»ºÏ·¨");
                    }
                }
 
            }
 
            if(baoliu2==null) {
                baoliu2="0";
            }else {
                if(Dell_tb_suanfa2.isGnss2xyopen()) {
                    if(baoliu1.split(";").length==4) {
                        //                        bjwxy=baoliu2;
                    }else {
                        ShowMessage.zidingyi_24(floor+"²ã£¬Ëã·¨ÅäÖÃBµã¾­Î³¶ÈXY×ø±ê²»ºÏ·¨");
                    }
                }                
            }
            if(baoliu3==null) {
                baoliu3="0";
            }
            if(baoliu4==null) {
                baoliu4="0";
            }
            map.setBaoliu1(baoliu1);
            map.setBaoliu2(baoliu2);
            map.setBaoliu3(baoliu3);
            map.setBaoliu4(baoliu4);
            map_vector.add(map); 
        }
        get_foor_xycs();
    }
 
    /**¾­Î³¶ÈתΪXyµÄʱºò»ñȡij²ãµØÍ¼µÄXYCS*/
    public static  void get_foor_xycs() {
        int size=map_vector.size();
        for(int i=0 ;i<size;i++) {
            TbMap map=map_vector.get(i);
            String floor=map.getFloor();
            String ajw=map.getBaoliu1();
            String bjw=map.getBaoliu2();
            String[] A=ajw.split(";");
            String[] B=bjw.split(";");
            if(A.length<4 || B.length<4 ) {
                if(Dell_tb_suanfa2.isGnss2xyopen()) {
                    ShowMessage.zidingyi_24("µØÍ¼"+floor+"²ãABµã¾­Î³¶ÈÉèÖÃÓдí,Ëã·¨ÅäÖÿªÆôÁËGNSSתXY×ø±ê");
                }
            }else {
                double lon_a=Double.parseDouble(A[0]);//A¾­¶È
                double lat_a=Double.parseDouble(A[1]);//Aγ¶È
                double xa=Double.parseDouble(A[2]);
                double ya=Double.parseDouble(A[3]);
                double lon_b=Double.parseDouble(B[0]);//B¾­¶È
                double lat_b=Double.parseDouble(B[1]);//Bγ¶È
                double xb=Double.parseDouble(B[2]);
                double yb=Double.parseDouble(B[3]);
                if(lon_a !=0 && lon_b !=0 && lat_a !=0 && lat_b !=0 ) {
                    double[] xycs=GnssToXY.initiize_ublox_AB2(lat_a, lon_a,lat_b, lon_b,xa,ya,xb,yb);
                    csxy a=new csxy();
                    a.setXycs(xycs);
                    a.setFloor(floor);
                    a.setAj(lon_a);
                    a.setAw(lat_a);
                    csxyvc.add(a);
                }else {
                    if(Dell_tb_suanfa2.isGnss2xyopen()) {
                        ShowMessage.zidingyi_24("µØÍ¼"+floor+"²ãABµã¾­Î³¶ÈÉèÖÃÓдí,Ëã·¨ÅäÖÿªÆôÁËGNSSתXY×ø±ê");
                    }
                }
            }
        }
 
    }
 
    /**ͨ¹ýÂ¥²ãÈ·¶¨csxy*/
    public static double[] get_xycs(String floor) {
        double[] xycs1=null;
        int size=csxyvc.size();
        for(int i=0;i<size;i++) {
            csxy cs=csxyvc.get(i);  
            String floor1=cs.getFloor();
            if(floor.equals(floor1)) {
                xycs1=cs.getXycs();
            }
        }
        return xycs1;
    }
 
 
    /**¸ù¾ÝËùÔڵIJã»ñÈ¡µ½µØÍ¼¶ÔÏó*/
    public static TbMap get_map(String floor) {
        TbMap map=null;    
        if(map_vector.size() !=0) {
            Iterator<TbMap> it=map_vector.iterator();
            while(it.hasNext()) {
                TbMap map1=it.next();
                String floor1=map1.getFloor();
                if(floor1.equals(floor)) {
                    map=map1;
                    break;
                }
            }
        }
        return map;
    }
 
    /**¸ù¾ÝµØÍ¼Ãû³Æ»ñÈ¡µ½µØÍ¼¶ÔÏó*/
    public static TbMap get_map_from_name(String name) {
        TbMap map=null;    
        if(map_vector.size() !=0) {
            Iterator<TbMap> it=map_vector.iterator();
            while(it.hasNext()) {
                TbMap map1=it.next();
                String name1=map1.getMapname();
                if(name.equals(name1)) {
                    map=map1;
                    break;
                }
            }
        }
        return map;
    }
 
    public static Vector<TbMap> get_serch_map_vector(String name){
        Vector<TbMap> vcmap=new Vector<TbMap>();
        int size=map_vector.size();
        for(int i=0;i<size;i++) {
            String name1=map_vector.get(i).getMapname();
            String floor=map_vector.get(i).getFloor();
            if(name.equals(name1)||name.equals(floor)) {
                vcmap.add(map_vector.get(i));
            }
 
        }
        return vcmap;        
    }
 
    /**ÐÂÔöÒ»¸öµØÍ¼¶ÔÏó*/
    public static void add_map(String mapname,String floor,String x,String y,
            String x0,String y0,String xp,String yp,String baoliu1,String baoliu2) {
        TbMap map=new TbMap();
        map.setFloor(floor);
        map.setMapname(mapname);
        map.setX_Truelength(Integer.parseInt(x));
        map.setY_Truewidth(Integer.parseInt(y));
        map.setX0_length(Integer.parseInt(x0));
        map.setY0_width(Integer.parseInt(y0));
        map.setX_Pixel(Integer.parseInt(xp));
        map.setY_Pixel(Integer.parseInt(yp));
        map.setAddTime(GetNowTime.now2());
        map.setBaoliu1(baoliu1);
        map.setBaoliu2(baoliu2);
        map_vector.add(map);
    }
 
    /**Ð޸ĵØÍ¼¶ÔÏó*/
    public static void alert_map(String mapname,String floor,String x,String y,
            String x0,String y0,String xp,String yp,String baoliu1,String baoliu2) {
        if(get_map_from_name(mapname) !=null) {
            get_map_from_name(mapname).setFloor(floor);
            get_map_from_name(mapname).setX_Truelength(Integer.parseInt(x));
            get_map_from_name(mapname).setY_Truewidth(Integer.parseInt(y));
            get_map_from_name(mapname).setX0_length(Integer.parseInt(x0));
            get_map_from_name(mapname).setY0_width(Integer.parseInt(y0));
            get_map_from_name(mapname).setX_Pixel(Integer.parseInt(xp));
            get_map_from_name(mapname).setY_Pixel(Integer.parseInt(yp));
            get_map_from_name(mapname).setAddTime(GetNowTime.now2());
            get_map_from_name(mapname).setBaoliu1(baoliu1);
            get_map_from_name(mapname).setBaoliu2(baoliu2);
        }
    }
 
    /**ɾ³ýÒ»¸öµØÍ¼¶ÔÏó*/
    public static void delete_map(String floor) {
        if(get_map_from_name(floor) !=null) {
            map_vector.remove(get_map_from_name(floor));
        }
 
    }
 
    /**ÐÞ¸Ä0²ãµÄ¾­¶Èγ¶È½ö½öURTģʽʹÓÃ*/
    public static void alert_jwdj(String jingdu,String weidu) {
        if(get_map("0") !=null) {
            get_map("0").setWeidu(weidu);
            get_map("0").setJingdu(jingdu);
            String[]  ziduan= {"jingdu","weidu","floor"};
            String[] zhi= {jingdu,weidu,"0"};            
 
            DatabaseManagement.fast_alert_dbase("tb_map", ziduan, zhi);
        }
 
    }
 
    /**ɾ³ýÈ«²¿µØÍ¼¶ÔÏó*/
    public static void delete_all_map() {
        if(map_vector.size() !=0) {
            map_vector.removeAllElements();
        }
 
    }
 
    /**Ð޸ĵØÍ¼¶ÔÓ¦µÄGPSÔ­µã¾­Î³¶È¼Ð½Ç*/
    public static void alert_gps(
            String floor,
            String baoliu1,
            String baoliu2
            ) {
        if(get_map(floor) !=null) {
            get_map(floor).setBaoliu1(baoliu1);
            get_map(floor).setBaoliu2(baoliu2);
            String[] ziduan= {"baoliu1","baoliu2","floor"};
            String[] zhi= {baoliu1,baoliu2,floor};
            DatabaseManagement.fast_alert_dbase("tb_map", ziduan, zhi);
        }
    }
 
    public static Vector<TbMap> getMap_vector() {
        return map_vector;
    }
 
    /**´Ë·½·¨ÓÃÓÚ»ñÈ¡µØÍ¼Ãû³Æ¼¯ºÏ*/
    public static  Vector<String> getMapName() { 
        Vector<String> mapname =null;
        if(map_vector.size() !=0) {
            mapname = new Vector<>();            
            Iterator<TbMap> it= map_vector.iterator();//´´½¨µü´úÆ÷
            while (it.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ            
                TbMap map = it.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½list¼¯ºÏ
                String name=map.getMapname();// µØÍ¼Ãû³Æ
                mapname.add(name);// Ïò±í¸ñ¶ÔÏóÌí¼ÓÐÐÊý¾Ý
            }
        }
        return mapname;    
    }
 
    /**µØÍ¼²ãµÄ¼¯ºÏ*/
    public static String[] get_all_floor() {
        int size = map_vector.size();
        if (size > 0) {
            String[] floors = new String[size +1];
            floors[0] = "Ñ¡Ôñͼ²ã";
            for (int i = 0; i < size; i++) {
                floors[i] = map_vector.get(i).getFloor();
            }
            floors[size] = "ËùÓÐͼ²ã";
            return floors;
        }else {
            return new String[0];
        }
    }
 
    /**µØÍ¼Ãû³ÆµÄ¼¯ºÏ*/
    public static String[] get_map() {
        int size=map_vector.size() ;
        String[] floors = new String[size + 1];
        if (size==0){
            ShowMessage.zidingyi_24("µØÍ¼Î´Ìí¼Ó,ÇëÌí¼ÓµØÍ¼¡£¡£¡£");
        }else {
            floors[0] = "°Ù¶ÈµØÍ¼";
            floors[1] = "ÈýάµØÍ¼";
            for (int i = 1; i < size; i++) {
                floors[i + 1] = map_vector.get(i).getMapname();
            }
        }
        return floors;
    }
 
    /**»ñÈ¡µÚÒ»¸öµØÍ¼¶ÔÏó*/
    public static TbMap getmp1() {
        TbMap map=null;
        int size=map_vector.size() ;
        if(size !=0) {
            map=map_vector.get(0);
        }
        return map;
    }
 
    //    public static String getAjwxy() {
    //        return ajwxy;
    //    }
    //
    //    public static String getBjwxy() {
    //        return bjwxy;
    //    }
 
    public static Vector<csxy> getCsxyvc() {
        return csxyvc;
    }
 
    public static void setCsxy(Vector<csxy> csxyvc) {
        Map_Dell.csxyvc = csxyvc;
    } 
 
 
}