📄 atracks.java
字号:
package net.aetherial.gis.database;
import java.util.*;
import java.sql.*;
import net.aetherial.gis.excel.*;
public class ATracks
extends ConnectTracks {
public String tracksName = "";
public Vector name = new Vector(), lat = new Vector(), lon = new Vector();
public ATracks() {
super();
}
public void getTracks(int tracksID) { //取出一条航迹
ResultSet rs = null;
name = null;
lat = null;
lon = null;
String a,b,c;
/////////////////////////取出航迹名称//////////////////////////////////
this.sqlString = "Select * From tracksName Where ID =" + tracksID;
try {
rs = this.sql.executeQuery(sqlString);
if (rs.next()) {
tracksName = rs.getString("name");
}
}
catch (Exception e) {
e.printStackTrace();
}
/////////////////////////取出航迹名称——结束//////////////////////////////////
/////////////////////////取出航迹的各个点////////////////////////////
rs = null;
this.sqlString = "Select * From tracks Where track_ID =" + tracksID;
try {
rs = this.sql.executeQuery(sqlString);
while (rs.next()) {
a=rs.getString("name");
b=rs.getString("lat");
c=rs.getString("lon");
name.addElement(a);
lat.addElement(b);
lon.addElement(c);
}
}
catch (Exception e) {
e.printStackTrace();
}
//////////////////////////取出航迹的各个点——结束///////////////////////////
this.setClose();
}
public static void main(String args[]) {
ATracks at = new ATracks();
at.getTracks(2);
String[] number = new String[at.name.size()],
name = new String[at.name.size()], lat = new String[at.name.size()],
lon = new String[at.name.size()];
for (int i = 0; i < name.length; i++) {
number[i] = i + "";
name[i] = at.name.get(i) + "";
lat[i] = at.lat.get(i) + "";
lon[i] = at.lon.get(i) + "";
}
try{
CopyEditExcel t = new CopyEditExcel("D:\\GIS\\Excel\\test.xls");
t.fileCreate(at.tracksName, number, name, lat, lon, "", "", "", "", "",
"", "", "", "", "", "");
}catch(Exception e){
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -