ExchaneMain.java 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. //import com.google.gson.Gson;
  2. //
  3. //import java.io.FileNotFoundException;
  4. //import java.util.ArrayList;
  5. //import java.util.HashMap;
  6. //import java.util.List;
  7. //import java.util.Map;
  8. //
  9. //public class ExchaneMain {
  10. //
  11. // static Map minXYMap;
  12. //
  13. // static List<Map> areaList = new ArrayList<>();
  14. //
  15. // public static void main(String[] args) throws FileNotFoundException {
  16. //
  17. //// getTransDistance("C:\\Users\\16s01\\Desktop\\GPS\\trans\\text.txt");
  18. // getTransDistance("/Users/haoqianpan/file/programfile/gpsexchange/GPS/trans/text.txt");
  19. //
  20. // printArea();
  21. //
  22. // printYard();
  23. //
  24. // printTml();
  25. //
  26. // printBaiscCor();
  27. //
  28. // calTemp();
  29. //
  30. //
  31. //
  32. //
  33. // }
  34. //
  35. // public static void getTransDistance(String dataInputFilePath) throws FileNotFoundException {
  36. // ReadData readData = new ReadData();
  37. // readData.setFilePath(dataInputFilePath);
  38. // List<Map> gpsCorList = readData.readData();
  39. //
  40. // int pointsNum = gpsCorList.size();
  41. //
  42. //
  43. // int xm = Integer.MAX_VALUE;
  44. // int ym = Integer.MAX_VALUE;
  45. //
  46. // for (int i = 0 ; i < pointsNum;i++){
  47. // Map map;
  48. // map = gpsCorList.get(i);
  49. // double lat = Double.parseDouble(map.get("lat").toString());
  50. // double lon = Double.parseDouble(map.get("lon").toString());
  51. //
  52. //// System.out.println("lat: " + lat + " lon: " + lon);
  53. // //墨卡托转换为平面坐标.
  54. // double[] corArray = new double[2];
  55. // corArray = GpsConvertMethod.MCT84Bl2xy(lon,lat);
  56. // System.out.println(corArray[0] + " " + corArray[1]);
  57. //
  58. // Map mapTemp = new HashMap();
  59. // mapTemp.put("x",(int)corArray[0]);
  60. // mapTemp.put("y",(int)corArray[1]);
  61. //
  62. //
  63. // //平面坐标旋转
  64. // double[] normalcorArray = new double[2];
  65. // normalcorArray = GpsConvertMethod.xy2normalxy(corArray[0],corArray[1]);
  66. //
  67. //
  68. // //旋转以后的坐标
  69. // double normalX = normalcorArray[0];
  70. // double normalY = normalcorArray[1];
  71. //
  72. // System.out.println(normalX + " " + normalY);
  73. //
  74. // //找到最小值
  75. //
  76. // if (normalX < xm) {
  77. //
  78. // xm = (int)Math.ceil(normalX);
  79. //
  80. // }
  81. //
  82. // if (normalY < ym) {
  83. //
  84. // ym = (int)Math.ceil(normalY);
  85. //
  86. // }
  87. //
  88. // Map normalmapTemp = new HashMap();
  89. //
  90. // normalmapTemp.put("x",normalX);
  91. //
  92. // normalmapTemp.put("y",normalY);
  93. // }
  94. //
  95. // Map resultMap = new HashMap();
  96. //
  97. // resultMap.put("minX",xm - 121);
  98. //
  99. // resultMap.put("minY",ym - 12);
  100. //
  101. // minXYMap = resultMap;
  102. //
  103. // }
  104. //
  105. // public static void printArea() throws FileNotFoundException {
  106. // String sgAName = "首钢A区";
  107. // String sgBName = "首钢B区";
  108. // String sgCName = "首钢C区";
  109. // String sgDBName = "首钢待磅区";
  110. //
  111. // String[] areaFileInputPath = new String[4];
  112. //
  113. // String[] areaFileOutPutPath = new String[4];
  114. //
  115. // String[] areaName = new String[4];
  116. //
  117. // String areaFileInputBasicPath ="/Users/haoqianpan/file/programfile/gpsexchange/GPS/area/areaIn";
  118. //
  119. // String areaFileOutputBasicPath ="/Users/haoqianpan/file/programfile/gpsexchange/GPS/area/out/areaOut";
  120. //
  121. // for (int i = 0 ; i < 4;i++){
  122. //
  123. // areaFileInputPath[i] = areaFileInputBasicPath + "-" + (i+1) + ".txt";
  124. //
  125. // areaFileOutPutPath[i] = areaFileOutputBasicPath + "-" + (i+1) + ".txt";
  126. //
  127. // };
  128. //
  129. // areaName[0] = sgAName;
  130. // areaName[1] = sgBName;
  131. // areaName[2] = sgCName;
  132. // areaName[3] = sgDBName;
  133. //
  134. //
  135. // for (int i = 0 ; i < 4 ; i++){
  136. //
  137. // Exchange exchange = new Exchange();
  138. // exchange.setDataInputFilePath(areaFileInputPath[i]);
  139. // exchange.setMinXY(minXYMap);
  140. // exchange.setDataOutPutFilePath(areaFileOutPutPath[i]);
  141. // exchange.execute();
  142. // Map areaMap = exchange.printArea(areaName[i]);
  143. // areaList.add(areaMap);
  144. //
  145. // }
  146. // }
  147. //
  148. // public static void printYard() throws FileNotFoundException {
  149. //
  150. // String[] yardName = {"BY01","BY02","BY03","BY04","BY05","BY06","AY01","AY02","AY03","AY04","AY05","AY06","AY07","CY01","DY01"};
  151. // String[] yardId = {"首钢B区-Y01","首钢B区-Y02","首钢B区-Y03","首钢B区-Y04","首钢B区-Y05","首钢B区-Y06","首钢A区-Y01","首钢A区-Y02","首钢A区-Y03","首钢A区-Y04","首钢A区-Y05","首钢A区-Y06","首钢A区-Y07","首钢C区-Y01","首钢待磅区-Y01"};
  152. // String[] yardInputPath = new String[15];
  153. // String[] yardOutputPath = new String[15];
  154. // String yardBasicInPutPath = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/yard/yardIn";
  155. // String yardBasicOutPutPath = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/yard/out/yardOut";
  156. //
  157. // for (int i = 0 ; i < 15;i++){
  158. // yardInputPath[i] = yardBasicInPutPath + "-" + (i+1) + ".txt";
  159. // yardOutputPath[i] = yardBasicOutPutPath + "-" + (i+1) + ".txt";
  160. // };
  161. //
  162. // for (int i = 0 ; i < 15; i++){
  163. // Exchange exchange = new Exchange();
  164. // exchange.setMinXY(minXYMap);
  165. // exchange.setDataInputFilePath(yardInputPath[i]);
  166. // exchange.setDataOutPutFilePath(yardOutputPath[i]);
  167. // exchange.execute();
  168. // Map yardMap = exchange.printYard(yardName[i],yardId[i]);
  169. // areaList.add(yardMap);
  170. // }
  171. // }
  172. //
  173. //
  174. // public static void printBaiscCor() throws FileNotFoundException {
  175. // String basicCorOutPutPath = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/basic/out/basicOut.txt";
  176. //
  177. // Map basicCor =new HashMap();
  178. //
  179. // basicCor.put("angle",55.5);
  180. //
  181. // basicCor.put("corRevise",minXYMap);
  182. //
  183. // Exchange exchange = new Exchange();
  184. //
  185. // exchange.setDataOutPutFilePath(basicCorOutPutPath);
  186. //
  187. // exchange.printCor(basicCor);
  188. //
  189. //
  190. // }
  191. //
  192. //
  193. // public static void printTml() throws FileNotFoundException {
  194. //
  195. //
  196. // ////////////////////////////////////
  197. //
  198. // String tmlBasicInPutPath = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/tml/in/tmlIn.txt";
  199. //
  200. // String tmlBasicOutPutPath = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/tml/out/tmlOut.txt";
  201. //
  202. // Exchange exchange = new Exchange();
  203. //
  204. // exchange.setMinXY(minXYMap);
  205. //
  206. // exchange.setDataInputFilePath(tmlBasicInPutPath);
  207. //
  208. // exchange.setDataOutPutFilePath(tmlBasicOutPutPath);
  209. //
  210. // exchange.execute();
  211. //
  212. // List<Map> tmlCorList = exchange.corAfterTransList;
  213. //
  214. // ////////////////////////////////////
  215. //
  216. // List<Map> roadInfoMapList = getRoadData();
  217. //
  218. // List<Map> trackInfoMapList = getTrackData();
  219. //
  220. // List<Map> buildingInfoMapList = getBuildingData();
  221. //
  222. // Map resultMap = new HashMap();
  223. //
  224. // resultMap.put("TRACK",trackInfoMapList);
  225. //
  226. // resultMap.put("ROAD",roadInfoMapList);
  227. //
  228. // resultMap.put("BUILDING",buildingInfoMapList);
  229. //
  230. // resultMap.put("POINTS",tmlCorList);
  231. //
  232. // ////////////////////
  233. // exchange.printTml(resultMap);
  234. // ////////////////////
  235. //
  236. // }
  237. //
  238. // public static List<Map> getRoadData() throws FileNotFoundException {
  239. //
  240. // String[] roadName = {"R01","R02","R03","R04","R05","R06","R07","R08","R09","R10"};
  241. // String[] roadDirection = {"DOWN","UP","UP","UP","UP","UP","UP","UP","LEFT","RIGHT"};
  242. // String[] roadInputPath = new String[10];
  243. // String[] roadOutputPath = new String[10];
  244. // String roadBasicInPutPath = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/road/in/roadIn";
  245. // String roadBasicOutPutPath = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/road/out/roadOut";
  246. //
  247. // List<Map> roadInfoMapList = new ArrayList<>();
  248. //
  249. // for (int i = 0 ; i < 10;i++){
  250. // roadInputPath[i] = roadBasicInPutPath + "-" + (i+1) + ".txt";
  251. // roadOutputPath[i] = roadBasicOutPutPath + "-" + (i+1) + ".txt";
  252. // };
  253. //
  254. // for (int i = 0 ; i < 10; i++){
  255. //
  256. // Exchange exchange = new Exchange();
  257. //
  258. // exchange.setMinXY(minXYMap);
  259. //
  260. // exchange.setDataInputFilePath(roadInputPath[i]);
  261. //
  262. // exchange.setDataOutPutFilePath(roadOutputPath[i]);
  263. //
  264. // try {
  265. // exchange.execute();
  266. // }
  267. // catch (Exception e){
  268. //// throw new Exception("eee");
  269. // System.out.println(i);
  270. // }
  271. //
  272. //
  273. // Map tempMap = exchange.getRoadData(roadName[i],roadDirection[i]);
  274. //
  275. // roadInfoMapList.add(tempMap);
  276. //
  277. // }
  278. //
  279. // return roadInfoMapList;
  280. //
  281. // }
  282. //
  283. //
  284. // public static List<Map> getTrackData() throws FileNotFoundException {
  285. //
  286. // String[] trackName = {"track01","track02","track03","track04","track05","track06"};
  287. // String[] trackInputPath = new String[6];
  288. // String[] trackOutputPath = new String[6];
  289. // String trackBasicInPutPath = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/track/in/trackIn";
  290. // String trackBasicOutPutPath = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/track/out/trackOut";
  291. //
  292. // List<Map> trackInfoMapList = new ArrayList<>();
  293. //
  294. // for (int i = 0 ; i < 6;i++){
  295. // trackInputPath[i] = trackBasicInPutPath + "-" + (i+1) + ".txt";
  296. // trackOutputPath[i] = trackBasicOutPutPath + "-" + (i+1) + ".txt";
  297. // };
  298. //
  299. // for (int i = 0 ; i < 6 ; i++){
  300. //
  301. // Exchange exchange = new Exchange();
  302. //
  303. // exchange.setMinXY(minXYMap);
  304. //
  305. // exchange.setDataInputFilePath(trackInputPath[i]);
  306. //
  307. // exchange.setDataOutPutFilePath(trackOutputPath[i]);
  308. //
  309. // exchange.execute();
  310. //
  311. // Map tempMap = exchange.getTrackData(trackName[i]);
  312. //
  313. // trackInfoMapList.add(tempMap);
  314. //
  315. // }
  316. //
  317. // return trackInfoMapList;
  318. //
  319. // }
  320. //
  321. //
  322. // public static List<Map> getBuildingData() throws FileNotFoundException {
  323. //
  324. // String[] buildingName = {"中检公司(北)","中检公司(南)","中控室","矿石1#变电站","洗车房","食堂","候工厅","港机公司","库房(北)","库房(南)","污水处理厂","喷淋泵房","矿石4#变电站","矿石2#变电所","矿石5#变电所"};
  325. //
  326. // String[] buildingInputPath = new String[15];
  327. //
  328. // String[] buildingOutputPath = new String[15];
  329. //
  330. // String buildingBasicInPutPath = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/building/in/buildingIn";
  331. //
  332. // String buildingBasicOutPutPath = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/building/out/buildingOut";
  333. //
  334. // List<Map> buildingInfoMapList = new ArrayList<>();
  335. //
  336. // for (int i = 0 ; i < 15;i++){
  337. // buildingInputPath[i] = buildingBasicInPutPath + "-" + (i+1) + ".txt";
  338. // buildingOutputPath[i] = buildingBasicOutPutPath + "-" + (i+1) + ".txt";
  339. // };
  340. //
  341. // for (int i = 0 ; i < 15; i++){
  342. //
  343. // Exchange exchange = new Exchange();
  344. //
  345. // exchange.setMinXY(minXYMap);
  346. //
  347. // exchange.setDataInputFilePath(buildingInputPath[i]);
  348. //
  349. // exchange.setDataOutPutFilePath(buildingOutputPath[i]);
  350. //
  351. // exchange.execute();
  352. //
  353. // Map tempMap = exchange.getBuildingData(buildingName[i]);
  354. //
  355. // buildingInfoMapList.add(tempMap);
  356. //
  357. // }
  358. //
  359. // return buildingInfoMapList;
  360. //
  361. // }
  362. //
  363. // public static ArrayList<Map> cal(Double xStart,Double yStart,Double xEnd,Double yEnd){
  364. //
  365. //
  366. //
  367. //
  368. // Point pointStart = new Point();
  369. // pointStart.setColX(xStart);
  370. // pointStart.setColY(yStart);
  371. //
  372. // Point pointEnd = new Point();
  373. // pointEnd.setColX(xEnd);
  374. // pointEnd.setColY(yEnd);
  375. //
  376. // CurveTool curveTool = new CurveTool();
  377. // ArrayList<Double> lineParamList = curveTool.calLineabc(pointStart,pointEnd);
  378. //
  379. // Double k = lineParamList.get(0);
  380. // Double counterValue = Math.sqrt(25/(Math.pow(k,2) + 1));
  381. // ArrayList<Map> rulerPointsList = new ArrayList<>();
  382. //
  383. // if (xStart >= xEnd){
  384. //
  385. // for(int i = 0 ; i < 207; i++){
  386. //
  387. // double xTemp = xStart - i * counterValue;
  388. // double yTemp = curveTool.getLineYValue(xTemp,lineParamList);
  389. //// Point point = new Point();
  390. //
  391. // Map map = new HashMap();
  392. // map.put("x",xTemp);
  393. // map.put("y",yTemp);
  394. //// point.setColX(xTemp);
  395. //// point.setColY(yTemp);
  396. // rulerPointsList.add(map);
  397. //
  398. // }
  399. //
  400. // }
  401. //
  402. // if (xStart < xEnd){
  403. //
  404. // for(int i = 0 ; i < 207; i++){
  405. //
  406. // double xTemp = xStart + i * counterValue;
  407. // double yTemp = curveTool.getLineYValue(xTemp,lineParamList);
  408. // Map map = new HashMap();
  409. // map.put("x",xTemp);
  410. // map.put("y",yTemp);
  411. //// point.setColX(xTemp);
  412. //// point.setColY(yTemp);
  413. // rulerPointsList.add(map);
  414. // }
  415. //
  416. // }
  417. // return rulerPointsList;
  418. // }
  419. //
  420. // public static void calTemp() throws FileNotFoundException {
  421. //
  422. // String rulerInputFilePathe = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/ruler/in/sr6ein.txt";
  423. // String rulerInputFilePathw = "/Users/haoqianpan/file/programfile/gpsexchange/GPS/ruler/in/sr6win.txt";
  424. // ArrayList<String> inputFilePathList = new ArrayList<>();
  425. // inputFilePathList.add(rulerInputFilePathe);
  426. // inputFilePathList.add(rulerInputFilePathw);
  427. //
  428. // for (int i = 0 ; i < inputFilePathList.size();i++){
  429. // String rulerName = "";
  430. // if (i == 0){
  431. // rulerName = "SR6东";
  432. // }
  433. // else if (i ==1){
  434. //
  435. // rulerName = "SR6西";
  436. // }
  437. //
  438. // String filePathTemp = inputFilePathList.get(i);
  439. // Exchange exchange = new Exchange();
  440. // exchange.setDataInputFilePath(filePathTemp);
  441. // exchange.setMinXY(minXYMap);
  442. // exchange.execute();
  443. // ArrayList<Map> corAfterTransList = exchange.corAfterTransList;
  444. // Map mapStart = corAfterTransList.get(0);
  445. // Map mapEnd = corAfterTransList.get(1);
  446. // Double xStart = Double.parseDouble(mapStart.get("x").toString());
  447. // Double yStart = Double.parseDouble(mapStart.get("y").toString());
  448. //
  449. // Double xEnd = Double.parseDouble(mapEnd.get("x").toString());
  450. // Double yEnd = Double.parseDouble(mapEnd.get("y").toString());
  451. // ArrayList<Map> points = cal(xStart,yStart,xEnd,yEnd);
  452. // Map map1 = new HashMap();
  453. // map1.put("TYPE","标尺");
  454. // map1.put("NAME",rulerName);
  455. // map1.put("POINTS",points);
  456. // Gson gson = new Gson();
  457. // String str = gson.toJson(map1);
  458. // System.out.println("打印ruler");
  459. // System.out.println(str);
  460. // System.out.println("打印完毕");
  461. // }
  462. //
  463. //
  464. // }
  465. //}