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;
|
}
|
|
|
}
|