package Frame; import java.awt.BorderLayout; import java.awt.Container; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; import javax.swing.ImageIcon; import javax.swing.JComboBox; import javax.swing.JInternalFrame; import javax.swing.JTextField; import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; import ColorAndFont.NothJPanel; import ColorAndFont.UIColor; import Method.GetNowTime; import PbuliClass.JButtonModel; import PbuliClass.JlableModel; import PbuliClass.ShowMessage; import PbuliClass.Systems; import PbuliClass.jinternalFrame; import tag.Tag_Dell; import tbDataModel.TbMap; import tbDataModel_Dell.Dell_tag_gas_jiaozhun_value; import tbDataModel_Dell.Dell_tb_suanfa2; import tbDataModel_Dell.JPanelModel1; import tbDataModel_Dell.Map_Dell; import urt.GNSS2jiajiao; import urt.GnssToXY; import urt.xytognss; import urt.xytoutm; /**¾àÀë·ÖÎö*/ public class Tool extends jinternalFrame { /** * */ private static final long serialVersionUID = 1L; jinternalFrame jinerFrame=null; JInternalFrame jinFrame=null; NothJPanel mb=null;//±±²¿Ãæ°å JlableModel Jl_b0=new JlableModel("Aµã¾­;γ;x;y"); JlableModel Jl_bd=new JlableModel("Bµã¾­;γ;x;y"); JTextField Jt_jd0=null; JTextField Jt_wd0=null; JlableModel Jl_b3=new JlableModel("Ô­µãX¡¢Y×ø±ê"); JTextField Jt_x=null; JTextField Jt_y=null; //¶Èת¶È·Ö JTextField Jt_d2dm=null; JButtonModel jbt_d2dm=null; JlableModel Jl_b1=new JlableModel("¾­Î³¶ÈתX¡¢Y×ø±ê"); JlableModel Jl_jd=new JlableModel("¾­¶È:"); JlableModel Jl_wd=new JlableModel("γ¶È:"); JlableModel Jl_jg=new JlableModel("½á¹û:"); JTextField Jt_jd=null; JTextField Jt_wd=null; JTextField Jt_jg=null; JlableModel Jl_b2=new JlableModel("¼ÆËã2µã¼Ð½Ç"); JlableModel Jl_jwd1=new JlableModel("µã1¾­¡¢Î³¶È:"); JlableModel Jl_jwd2=new JlableModel("µã2¾­¡¢Î³¶È:"); JlableModel Jl_jg1=new JlableModel("½á¹û:"); JTextField Jt_jd1=null; JTextField Jt_wd1=null; JTextField Jt_jd2=null; JTextField Jt_wd2=null; JTextField Jt_jg1=null; JlableModel Jl_b4=new JlableModel("X¡¢Y×ø±êתΪ¾­Î³¶È"); JlableModel Jl_x1=new JlableModel("X¡¢Y×ø±ê:"); JlableModel Jl_y1=new JlableModel("½á¹û:"); JTextField Jt_x1=null; JTextField Jt_y1=null; JTextField Jt_jg3=null; JButtonModel Jbt_jisuan=null;//¼ÆËã°´Å¥ JButtonModel Jbt_jisuan1=null;//¼ÆËã°´Å¥ JButtonModel Jbt_jisuan3=null;//¼ÆËã°´Å¥ JPanelModel1 mp1=null;//»ù´¡ÉèÖÃÃæ°å JlableModel Jl_jt=new JlableModel("Ñ¡Ôñ±êÇ©:"); JComboBox tagAll=null;//ËùÓбêÇ©µÄ¼¯ºÏ JlableModel Jl_tag_gao=new JlableModel("±êÇ©¸ß¶È:"); static JTextField Jt_tag_gao=new JTextField(); JlableModel Jl_tag_gas=new JlableModel("TgÆøÑ¹:"); static JTextField Jt_tag_gas=new JTextField(); JlableModel Jl_anchor_gas=new JlableModel("AgÆøÑ¹:"); static JTextField Jt_anchor_gas=new JTextField(); static JTextField Jt_jiao_zhun_qing_kuang=new JTextField();//У׼Çé¿ö JButtonModel jiaozhun_gas_button=null;//Ð£×¼ÆøÑ¹°´Å¥ static String tagischose="0000"; static String acischose="0000"; TbMap mp=Map_Dell.getmp1(); //»ùÕ¾ºÍ±êÇ©µÄ¸ß¶È²î static int ac_tagh=0; static int tagnum_online=0; int tagoknum=0;//È«²¿Ð޸ıêÇ©ÆøÑ¹Ê±ºòд¹ýµÄ±êÇ©ÊýÁ¿ static Vector oktaggas=null; //ËùÓÐÔÚÏß±êÇ©µÄ¼¯ºÏ static Vector tagidonlie=new Vector(); public Tool() {//¹¹Ôì·½·¨ Container rq=getContentPane();//»ñÈ¡ÈÝÆ÷ rq.setLayout(new BorderLayout()); rq.setBackground(UIColor.getNorth_color()); if (Map_Dell.getMap_vector().size()==0){ ShowMessage.zidingyi_24("µØÍ¼²»´æÔÚ,ÇëÏÈÌí¼ÓµØÍ¼"); this.dispose(); return; } this.addInternalFrameListener(new InternalFrameListener() { @Override public void internalFrameOpened(InternalFrameEvent e) { } @Override public void internalFrameIconified(InternalFrameEvent e) { } @Override public void internalFrameDeiconified(InternalFrameEvent e) { } @Override public void internalFrameDeactivated(InternalFrameEvent e) { } @Override public void internalFrameClosing(InternalFrameEvent e) { Dell_tag_gas_jiaozhun_value.setGas_jiaozhun_isstart(false); } @Override public void internalFrameClosed(InternalFrameEvent e) { } @Override public void internalFrameActivated(InternalFrameEvent e) { } }); String title="¿ì½Ý¼ÆËã"; if(Systems.sys().getLanguage().equals("English")) { title="FASTTOOL"; } this.setTitle(title); this.setFrameIcon(new ImageIcon("image/icon/debug.png"));//ÉèÖô°Ìåͼ±ê this.setBounds(175,0,850,600); rq.add(getNorthPanel(),BorderLayout.CENTER); Jt_tag_gao.setToolTipText("±êÇ©¸ß¶ÈΪµ±Ç°±êÇ©·ÅµÄ¸ß¶Èµ¥Î»ÀåÃ×"); } /**»ñÈ¡±±²¿Ãæ°åµÄ·½·¨*/ public NothJPanel getNorthPanel() { if(mb==null) { mb=new NothJPanel(); mb.setLayout(null); int a=20; int y0=10; int y=y0+35+95; mb.add(Jl_b0); Jl_b0.setBounds(a,y0,100,25); mb.add(getJt_jd0()); Jt_jd0.setBounds(a+100,y0,240,25); mb.add(getJt_wd0()); mb.add(Jl_bd); Jl_bd.setBounds(a+360,y0,100,25); Jt_wd0.setBounds(a+460,y0,280,25); mb.add(Jl_bd); mb.add(Jl_b3); Jl_b3.setBounds(a,y0+40,100,25); mb.add(getJt_x()); Jt_x.setBounds(a+100,y0+40, 100,25); mb.add(getJt_y()); Jt_y.setBounds(a+210,y0+40, 100,25); //¶Èת¶È·Ö¼ÆËã JlableModel Jl_ba=new JlableModel("¶Èת¶È·Ö£º"); mb.add(Jl_ba); mb.add(getJt_d2dm()); mb.add(getJbt_d2dm()); Jl_ba.setBounds(a+360,y0+40, 80,25); Jt_d2dm.setBounds(a+440,y0+40,200,25); jbt_d2dm.setBounds(a+650,y0+40, 100,25); //¾­¶È mb.add(Jl_b1); Jl_b1.setBounds(a,y-40,200,25); mb.add(Jl_jd); Jl_jd.setBounds(a,y,50,25); mb.add(getJt_jd()); Jt_jd.setBounds(a+50,y, 100,25); //γ¶È mb.add(Jl_wd); Jl_wd.setBounds(a+170, y,50,25); mb.add(getJt_wd()); Jt_wd.setBounds(a+210,y, 100,25); //½á¹û mb.add(Jl_jg); Jl_jg.setBounds(a+330,y,50,25); mb.add(getJt_jg()); Jt_jg.setBounds(a+370,y, 200,25); //¼ÆËã mb.add(getJbt_jisuan()); Jbt_jisuan.setBounds(a+580,y,80,25); int y2=y+25+20; mb.add(Jl_b2); Jl_b2.setBounds(a,y2,200,25); int y3=y+50+30; mb.add(Jl_jwd1); Jl_jwd1.setBounds(a,y3,100,25); mb.add(getJt_jd1()); mb.add(getJt_wd1()); Jt_jd1.setBounds(a+100,y3,80,25); Jt_wd1.setBounds(a+190,y3,80,25); mb.add(Jl_jwd2); Jl_jwd2.setBounds(a+280,y3,100,25); mb.add(getJt_jd2()); mb.add(getJt_wd2()); Jt_jd2.setBounds(a+380,y3,80,25); Jt_wd2.setBounds(a+470,y3,80,25); //½á¹û mb.add(Jl_jg1); Jl_jg1.setBounds(a+560,y3,50,25); mb.add(getJt_jg1()); Jt_jg1.setBounds(a+610,y3,50,25); //¼ÆËã mb.add(getJbt_jisuan1()); Jbt_jisuan1.setBounds(a+670,y3,80,25); int y7=y3+50; int y8=y7+40; mb.add(Jl_b4); mb.add(Jl_x1); Jl_b4.setBounds(a,y7,200,25); Jl_x1.setBounds(a,y8,100,25); mb.add(getJt_x1()); Jt_x1.setBounds(a+100,y8, 100,25); mb.add(getJt_y1()); Jt_y1.setBounds(a+220,y8, 100,25); mb.add(Jl_y1); Jl_y1.setBounds(a+330,y8,50,25); mb.add(getJt_jg3()); Jt_jg3.setBounds(a+380,y8,200,25); mb.add(getJbt_jisuan3()); Jbt_jisuan3.setBounds(a+590,y8,100,25); mb.add(getMp1()); mp1.setBounds(a, y8+35, 790, 150); } return mb; } public JTextField getJt_jd0() { if(Jt_jd0==null) { Jt_jd0=new JTextField(); if(mp !=null) { String a=mp.getBaoliu1(); Jt_jd0.setText(a); } } return Jt_jd0; } public JTextField getJt_wd0() { if(Jt_wd0==null) { Jt_wd0=new JTextField(); if(mp !=null) { String a=mp.getBaoliu2(); Jt_wd0.setText(a); } } return Jt_wd0; } public JTextField getJt_x() { if(Jt_x==null) { TbMap map = Map_Dell.get_map("0"); if (map==null){ ShowMessage.zidingyi("µØÍ¼²»´æÔÚ"); return null; } String a=String.valueOf(map.x0_length); Jt_x=new JTextField(a); } return Jt_x; } public JTextField getJt_y() { if(Jt_y==null) { String b=String.valueOf(Map_Dell.get_map("0").getY0_width()); Jt_y=new JTextField(b); } return Jt_y; } public JTextField getJt_x1() { if(Jt_x1==null) { Jt_x1=new JTextField(); } return Jt_x1; } public JTextField getJt_y1() { if(Jt_y1==null) { Jt_y1=new JTextField(); } return Jt_y1; } public JTextField getJt_jg3() { if(Jt_jg3==null) { Jt_jg3=new JTextField(); } return Jt_jg3; } public JTextField getJt_jd() { if(Jt_jd==null) { Jt_jd=new JTextField(); } return Jt_jd; } public JTextField getJt_wd() { if(Jt_wd==null) { Jt_wd=new JTextField(); } return Jt_wd; } public JTextField getJt_jg() { if(Jt_jg==null) { Jt_jg=new JTextField(); } return Jt_jg; } public JTextField getJt_jd1() { if(Jt_jd1==null) { Jt_jd1=new JTextField(); } return Jt_jd1; } public JTextField getJt_wd1() { if(Jt_wd1==null) { Jt_wd1=new JTextField(); } return Jt_wd1; } public JTextField getJt_jd2() { if(Jt_jd2==null) { Jt_jd2=new JTextField(); } return Jt_jd2; } public JTextField getJt_wd2() { if(Jt_wd2==null) { Jt_wd2=new JTextField(); } return Jt_wd2; } public JTextField getJt_jg1() { if(Jt_jg1==null) { Jt_jg1=new JTextField(); } return Jt_jg1; } public JButtonModel getJbt_jisuan() { if(Jbt_jisuan==null) { Jbt_jisuan=new JButtonModel("¼ÆËãXY"); Jbt_jisuan.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String yd=Jt_jd0.getText().trim(); String b=Jt_wd0.getText().trim(); String[] A1=yd.split(";"); String[] B1=b.split(";"); if(B1.length !=4) { ShowMessage.zidingyi_24("ÊäÈ볤¶È²»¶Ô£¬Ó¢ÎÄÏÂ;·Ö¸ô"); return; } String jd1=Jt_jd.getText().trim(); String wd1=Jt_wd.getText().trim(); if(jd1.length()>3 || wd1.length()>3) { int[] xy=GnssToXY.gps_xy( A1, B1, jd1, wd1); String a="x="+xy[0]+"; y="+xy[1]; Jt_jg.setText(a); }else { ShowMessage.zidingyi("ÇëÊäÈëÕýÈ·µÄ¾­Î³¶ÈÖµ"); } } }); } return Jbt_jisuan; } public JButtonModel getJbt_jisuan1() { if(Jbt_jisuan1==null) { Jbt_jisuan1=new JButtonModel("¼ÆËã½Ç¶È"); Jbt_jisuan1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String jd1=Jt_jd1.getText().trim(); String wd1=Jt_wd1.getText().trim(); String jd2=Jt_jd2.getText().trim(); String wd2=Jt_wd2.getText().trim(); if(jd1.length()>0 || jd2.length()>0) { String jd=GNSS2jiajiao.GetAzimuth(jd1,wd1,jd2,wd2); Jt_jg1.setText(String.valueOf(jd)); }else { ShowMessage.zidingyi("ÇëÊäÈëÕýÈ·µÄ¾­Î³¶ÈÖµ"); } } }); } return Jbt_jisuan1; } public JButtonModel getJbt_jisuan3() { if(Jbt_jisuan3==null) { Jbt_jisuan3=new JButtonModel("¼ÆË㾭γ¶È"); Jbt_jisuan3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String x=Jt_x1.getText().replaceAll(" ",""); String y=Jt_y1.getText().replaceAll(" ",""); if(x.length()==0) { ShowMessage.zidingyi("x×ø±ê²»ÄÜΪ¿Õ"); return; } if(y.length()==0) { ShowMessage.zidingyi("y×ø±ê²»ÄÜΪ¿Õ"); return; } String yd=Jt_jd0.getText().trim(); String b=Jt_wd0.getText().trim(); String[] A=yd.split(";"); String[] B=b.split(";"); if(A.length<4 || B.length<4 ) { if(Dell_tb_suanfa2.isGnss2xyopen()) { ShowMessage.zidingyi_24("µØÍ¼ABµã¾­Î³¶ÈÉèÖÃÓдí,Ëã·¨ÅäÖÿªÆôÁËGNSSתXY×ø±ê"); } return; }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]); double[] xycs=GnssToXY.initiize_ublox_AB2(lat_a, lon_a,lat_b, lon_b,xa,ya,xb,yb); String jwd[]=xytoutm.xy2jwd(x, y,xycs); String a=jwd[3]+";"+jwd[2]; Jt_jg3.setText(a); } } }); } return Jbt_jisuan3; } public JPanelModel1 getMp1() { if(mp1==null) { mp1=new JPanelModel1("¸ß¶ÈÒ»¼üУ׼"); mp1.setBackground(null); int x=30; int y=30; int height=25; mp1.add(Jl_jt); mp1.add(getTagAll()); mp1.add(Jl_tag_gao); mp1.add(Jt_tag_gao); mp1.add(Jl_tag_gas); mp1.add(Jt_tag_gas); mp1.add(Jl_anchor_gas); mp1.add(Jt_anchor_gas); mp1.add(Jt_jiao_zhun_qing_kuang); mp1.add(getjiaozhun_gas_button()); int x1=x+80; int x2=x1+150; int x3=x2+80; int x4=x3+110; int x5=x4+60; int x6=x5+110; int x7=x6+60; int y1=height+y+30; Jl_jt.setBounds(x, y,80, height);//Ñ¡Ôñ±êÇ© Jt_jiao_zhun_qing_kuang.setBounds(x, y1,630, height);//Ñ¡Ôñ»ùÕ¾ tagAll.setBounds(x1,y,120, height);//Ñ¡Ôñ±êÇ©ÏÂÀ­¿ò Jl_tag_gao.setBounds(x2,y,80, height);//µ±Ç°¸ß¶È Jt_tag_gao.setBounds(x3,y,80, height); Jl_tag_gas.setBounds(x4,y, 60, height); Jt_tag_gas.setBounds(x5,y, 80, height); Jl_anchor_gas.setBounds(x6,y, 60, height); Jt_anchor_gas.setBounds(x7,y,100, height); jiaozhun_gas_button.setBounds(x7,y1,100, height); } return mp1; } public JComboBox getTagAll() { if( tagAll==null) { tagAll=new JComboBox() ; tagAll.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 12));//ÉèÖÃ×ÖÌå ComboBoxModel coModel=new DefaultComboBoxModel<>(Tag_Dell.GetTagAllstr());//ÏÂÀ­ÁбíÄ£ÐÍ tagAll.setModel(coModel); tagAll.setEnabled(true); //ÏÂÀ­¿ò¿ÉÒÔÊäÈë tagAll.setEditable(true); tagAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { tagischose=(String) tagAll.getSelectedItem(); } }); } return tagAll; } public JButtonModel getjiaozhun_gas_button() { if(jiaozhun_gas_button==null) { jiaozhun_gas_button=new JButtonModel("Ò»¼üУ׼"); jiaozhun_gas_button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if( !Dell_tag_gas_jiaozhun_value.isGas_jiaozhun_isstart()) { //±êÇ©µ±Ç°¸ß¶È String tagg=Jt_tag_gao.getText().trim(); if(tagg.length()<2) { ShowMessage.zidingyi("±êÇ©µ±Ç°¸ß¶È²»ÄÜΪ¿Õ"); return; } int tagnowh=Integer.parseInt(tagg); tagischose=(String) tagAll.getSelectedItem(); if(!tagischose.equals("ËùÓбêÇ©")) { //²»ÊÇËùÓбêÇ©µÄʱºò Dell_tag_gas_jiaozhun_value.alertallgasstate1(tagischose,tagnowh); }else { Jt_tag_gas.setText(""); Dell_tag_gas_jiaozhun_value.alertallgasstate1("ALL",tagnowh); } Dell_tag_gas_jiaozhun_value.setGas_jiaozhun_isstart(true);//ÆøÑ¹Ð£×¼¿ªÊ¼ Dell_tag_gas_jiaozhun_value.setGas_jiaozhun_start_time(GetNowTime.now()); jiaozhun_gas_button.setText("½áÊøÐ£×¼"); }else { Dell_tag_gas_jiaozhun_value.setGas_jiaozhun_isstart(false);//ÆøÑ¹Ð£×¼¿ªÊ¼ Jt_tag_gao.setText(""); Jt_tag_gas.setText(""); Jt_anchor_gas.setText(""); jiaozhun_gas_button.setText("¿ªÊ¼Ð£×¼"); } } }); } return jiaozhun_gas_button; } /**´¦Àí¸ß¶ÈУ׼ָÁî*/ //¸ß¶ÈУ׼¿ØÖÆÖ¸Áî //Ö¸Áî¸ñʽ£º55BB,HeightModify,tagid,tagidheight,END //Ö¸Áî˵Ã÷£º //55BB£ºÎª°üÍ·£» //HeightModify£º¸ß¶ÈÐÞÕý //tagid£ºÐèÒªÐÞÕýµÄ±êÇ©ID£¬ALL±íʾȫ²¿ÐÞÕý //tagidheight£º±êÇ©µ±Ç°¸ß¶È£¬µ¥Î»ÀåÃ× //END£º½áÊø±êÖ¾ //ʾÁУº55BB,HeightModify,1001,100,END //ʾÁУº55BB,HeightModify,ALL,100,END public static void HeightModify(String message) { String a1=message.toUpperCase(); if(a1.startsWith("55BB")) { String[] msb=a1.split(","); if(msb[1].equals("HEIGHTMODIFY")) { String tagid=msb[2]; String tag_now_gao1=msb[3];//±êÇ©µ±Ç°Ëù´¦µÄ¸ß¶È int tag_now_gao=Integer.parseInt(tag_now_gao1); Dell_tag_gas_jiaozhun_value.alertallgasstate1(tagid,tag_now_gao); Dell_tag_gas_jiaozhun_value.setGas_jiaozhun_isstart(true);//ÆøÑ¹Ð£×¼¿ªÊ¼ Dell_tag_gas_jiaozhun_value.setGas_jiaozhun_start_time(GetNowTime.now()); } } } public static JTextField getJt_jiao_zhun_qing_kuang() { return Jt_jiao_zhun_qing_kuang; } public static void setJt_jiao_zhun_qing_kuang(JTextField jt_jiao_zhun_qing_kuang) { Jt_jiao_zhun_qing_kuang = jt_jiao_zhun_qing_kuang; } public static JTextField getJt_tag_gas() { return Jt_tag_gas; } public static JTextField getJt_anchor_gas() { return Jt_anchor_gas; } public static void setJt_tag_gas(JTextField jt_tag_gas) { Jt_tag_gas = jt_tag_gas; } public static void setJt_anchor_gas(JTextField jt_anchor_gas) { Jt_anchor_gas = jt_anchor_gas; } public JTextField getJt_d2dm() { if(Jt_d2dm==null) { Jt_d2dm=new JTextField(); } return Jt_d2dm; } public JButtonModel getJbt_d2dm() { if(jbt_d2dm==null) { jbt_d2dm=new JButtonModel("¶Èת¶È·Ö"); jbt_d2dm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String a=Jt_d2dm.getText(); if(a.length()>4) { if(a.split("=").length>1) { ShowMessage.zidingyi(a+"ÊäÈëµÄÊý¾ÝÓÐÎÊÌâ..."); return; } double adb=Double.parseDouble(a); String wd=String .format("%.6f",xytognss.ublox_d2dm(adb)); Jt_d2dm.setText(a+"="+wd); }else { ShowMessage.zidingyi(a+"ÊäÈëµÄÊý¾ÝÓÐÎÊÌâ..."); return; } } }); } return jbt_d2dm; } public void setJbt_d2dm(JButtonModel jbt_d2dm) { this.jbt_d2dm = jbt_d2dm; } }