1. 程式人生 > >華金礦業之人員定位系統的遞迴軌跡繪製(實踐版本)

華金礦業之人員定位系統的遞迴軌跡繪製(實踐版本)

根據華金礦業實際的地下基站系統圖紙,考慮來自基站,手卡,時間各個方面,獲得的一種尋找人員軌跡的演算法; 程式碼如下:

package cn.com.lf;

import java.awt.Graphics;
import java.awt.Point;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import cn.com.gj.Route;
public class Recursive {
//遞迴演算法尋找軌跡
//1.查詢資料庫獲取list(某個時間段某個經過的基站的集合)ll
	public static List<String> list=new ArrayList<String>(); 
	public static List<Route> lr=null;//尋找中介時的集合
    public static List<Point> point=new ArrayList<Point>();
    public static Point pp;
	public static List<Route> ll=new ArrayList<Route>();//最終的路線軌跡
	public static List<Route> l2=null;//最終的路線軌跡
	public static List<String> select_num(String id, String start_time,
			String end_time) {
		SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
		String dd = sim.format(new Date());
		String sql = "select bs from yh where number=? and time BETWEEN ? and ?  order by time asc";
		String[] sz = {id, start_time, end_time };
		ResultSet rs = JdbcUtils.select(sql, sz);
		List<String> list0 = new ArrayList<String>();
		try {
			rs.last();
			int c = rs.getRow();
			int j = 0;
			rs.beforeFirst();
			if (start_time == "" || end_time == "") {
			}
			if (c == 0) {
			
			} else {
	
				while (rs.next()) {
					list0.add(rs.getString(1));
					j++;
				}
			
				list.add(list0.get(0));
				for (int i = 0; i < j; i++) {
					if (i + 1 < j) {
						if (!(list0.get(i).endsWith(list0.get(i + 1)))) {
							list.add(list0.get(i + 1));
						}
					}
				}
			}
			JdbcUtils.closeAll();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//ll就是經過的基站集合
		return list;
	}
	//2.迴圈遍歷這個集合
	public static void crc(Graphics gh,List<String> list){
		//這個是取的第一個和第二個基站的;
		 int[] sz=null;
		 int[] zz=null;
		 int sa=0;
		 int sb=0;
		for (int i = 0; i < list.size()-1; i++) {
			  sz= case1(list.get(i),sa,sb);//#30的x y左邊
			  zz=case1(list.get(i+1),sa, sb);//#20的x y左邊
			  //尋找相鄰基站路線圖
			 ll =Plan(gh,sz,zz,sa,sb);
		 }
			
		  for (Route rr2 : ll) {
				System.out.println(rr2.getStarta()+":"+rr2.getEnda()+":"+rr2.getStartb()+":"+rr2.getEndb());		
				                     }
	}
	//這個是遞迴函式的精髓
	//遞迴函式
	
		public static List<Route>  Plan(Graphics gh,int sz[],int zz[],int sa,int sb){
			         //把每一個要經過的點都放在一個集合裡
			pp=new Point(sz[0], sz[1]);
	        point.add(pp);
	        l2=drawline(gh,sz[0],sz[1],zz[0], zz[1] );
	        if(l2.get(0)!=null){
				//第一次尋找中介集合
				//檢視新增的元素是不是最後一位
			 pp=new Point(sz[0], sz[1]);
	         point.add(pp);
	         pp=new Point(zz[0], zz[1]); 
			 point.add(pp); 
				 for(int i=0;i<point.size()-1;i++){
					 int x= (int) point.get(i).getX();
					    int y=(int) point.get(i).getY();
					    int x1=(int) point.get(i+1).getX();
					    int y1=(int) point.get(i+1).getY();
		            	Route re=new Route(x, y,x1 ,y1 );
		            	ll.add(re);
		                                           }   //for結束	
				//1.由於集合無論是否新增一個數組,大小都是1,所以需要判斷第一個是不是空的就可以了
				 return l2;
			                   } else{
			                	     pp=new Point(sz[0], sz[1]);
							         point.add(pp);
			                		for (Route rr : lr) {
			                			sa=rr.getStarta();
								        sb=rr.getEnda();
										l2=null;
										sz[0]=rr.getStartb();
										sz[1]=rr.getEndb();
										if(sz[0]==sa&&sz[1]==sb){
											break;
										}
			                		 l2=drawline(gh,sz[0],sz[1],zz[0], zz[1]);
			                		  if(l2.get(0)!=null){
			                				//第一次尋找中介集合
			                				//檢視新增的元素是不是最後一位
			                			 pp=new Point(sz[0], sz[1]);
			                	         point.add(pp);
			                	         pp=new Point(zz[0], zz[1]); 
			                   		    point.add(pp); 
			                				 for(int i=0;i<point.size()-1;i++){
			                					    int x= (int) point.get(i).getX();
			                					    int y=(int) point.get(i).getY();
			                					    int x1=(int) point.get(i+1).getX();
			                					    int y1=(int) point.get(i+1).getY();
			                		            	Route re=new Route(x, y,x1 ,y1 );
			                		            	ll.add(re);
			                		                                          }   //for結束	
			                				//1.由於集合無論是否新增一個數組,大小都是1,所以需要判斷第一個是不是空的就可以了
			                				return ll;
			                			                   }  //if 
			                			else{
			                			Plan(gh,sz,zz,sa,sb);
			                			}   }
			                   }
			                  
			return ll;
		}
	//這個是以某個基站為起點,所有可能相鄰基站的路線集合
		public static List<Route> drawline(Graphics gh,int sa,int sb,int ea,int eb) {
			List<Route> list=new ArrayList<Route>();
			// 1.1#30
			Route rr =null;
			if( sa== 71 && sb == 96 ){
				lr=new ArrayList<Route>(); 
				Route r = null;
				//==#22
				if(ea == 72 && eb== 281){
					gh.drawLine(71,96,72,281);
					//這個rr是放直達的路線的
					rr = new Route(sa, sb, ea, eb);	
				}
				//lr是所有的以71,96為開始的線段的集合
				r=new Route(71,96,72,281);
				lr.add(r);
			}
			//2.#22
			if( sa== 72 && sb == 281){
				//==#30
				 lr=new ArrayList<Route>(); 
				Route r = null;
				if(ea== 71 && eb == 96){
					gh.drawLine(72,281,71,96);	
					rr = new Route(sa, sb, ea, eb);
				}
				//==#20
				else if(ea == 337 && eb == 281){
					gh.drawLine(72,281,337,281);
				    rr = new Route(sa, sb, ea, eb);
				}
				//===#17曲線
				else if(ea == 145 && eb == 86){
					gh.drawLine(72, 281, 189, 281);// #22--(1)
					gh.drawLine( 189, 281,148, 275);// (1)----(2)
					gh.drawLine(148, 275,145, 86);// (2)--#17
				    rr = new Route(sa, sb, ea, eb);
				}
				//==#24曲線
				else if(ea == 149 && eb == 462){
					gh.drawLine(72, 281, 189, 281);// #22--(1)
					gh.drawLine( 189, 281,148, 275);// (1)----(2)
					gh.drawLine(148, 275,149, 462);// (2)--#24
				    rr = new Route(sa, sb, ea, eb);
				}
				 r=new Route(72,281,71,96);
				 lr.add(r);
				 r=new Route(72,281,337,281);
				 lr.add(r);
				 r=new Route(72,281,145,86);
				 lr.add(r);
				 r=new Route(72,281,149,462);
				 lr.add(r);
			}
			
	//3.#17
			if( sa== 145 && sb == 86){
				 lr=new ArrayList<Route>(); 
					Route r = null;
				//3.1#17--#24直線
				if(ea== 149 && eb == 462){
					gh.drawLine(145, 86,149, 462);
				    rr = new Route(sa, sb, ea, eb);			
						}
			   //3.2#17==#22曲線
				else if(ea== 72 && eb == 281){
					gh.drawLine(145, 86,148, 275);
					gh.drawLine(148, 275,189, 281);
					gh.drawLine(189, 281,72, 281);
				    rr = new Route(sa, sb, ea, eb);			
						}
			 //3.3#17==#20曲線
				else if(ea== 337 && eb == 281){
					gh.drawLine(145,86,148,275);
					gh.drawLine(148, 275, 189, 281);
					gh.drawLine(189, 281, 337, 283);
				    rr = new Route(sa, sb, ea, eb);			
						}
				 r=new Route(145, 86,149, 462);
				 lr.add(r);
				 r=new Route(145, 86,337, 281);
				 lr.add(r);
				 r=new Route(145, 86,72, 281);
				 lr.add(r);
			}
			//4.#20
		 if(sa== 337 && sb == 281){
				lr=new ArrayList<Route>(); 
				Route r = null;
				//4.1 #20==22直線
			 if(ea == 72 && eb == 281){
				gh.drawLine(337,281,72,281);
			  rr = new Route(sa, sb, ea, eb);
			}
			// 4.2 20#--12#(1)直線
			 else if(ea == 396 && eb == 282) {
					gh.drawLine(337, 281, 396, 282);
				 rr = new Route(sa, sb, ea, eb);
				}
			 //4.3#20--#21直線
			 else if(ea == 507 && eb == 286) {
					gh.drawLine(337, 281, 507, 286);
				 rr = new Route(sa, sb, ea, eb);
				}
			 //4.4 #20--#17曲線
			 else if(ea == 145 && eb == 86) {
				    gh.drawLine(145,86,148,275);
					gh.drawLine(148, 275, 189, 281);
					gh.drawLine(189, 281, 337, 283);
				 rr = new Route(sa, sb, ea, eb);
				}
			 //#4.5 20--#24
			 else if(ea == 149 && eb == 462) {
				gh.drawLine(337, 283, 189, 281);// #20--(1)
				gh.drawLine( 189, 281,148, 275);// (1)----(2)
				gh.drawLine(148, 275,149, 462);// (2)--#24
				 rr = new Route(sa, sb, ea, eb);
				}
			    r=new Route(337,281,72,281);
			    lr.add(r);
				r=new Route(337, 281, 396, 282);
				lr.add(r);
				r=new Route(337, 281, 507, 286);
				lr.add(r);
				r=new Route(337, 281, 145, 86);
				lr.add(r);
				r=new Route(337, 281, 149, 462);
				lr.add(r);
		 }
		 //#5.#12
		 if(sa== 396 && sb == 282){
				lr=new ArrayList<Route>(); 
				Route r = null;
				//5.1 #12-#13直線
				 if(ea == 441 && eb == 326){
					  gh.drawLine(396,282,441,326);
					  rr = new Route(sa, sb, ea, eb);
					}	
				//5.1 #12-#20直線
				 else if(ea == 337 && eb == 281){
					  gh.drawLine(396,282,337,281);
					  rr = new Route(sa, sb, ea, eb);
					}	
				    r=new Route(396, 282, 441, 326);
					lr.add(r);
					r=new Route(396, 282, 337, 281);
					lr.add(r);	
		 }
		//6.#15 
		 if(sa== 580 && sb == 286){
				lr=new ArrayList<Route>(); 
				Route r = null;
				//6.1 #15-#21直線
				 if(ea == 507 && eb == 286){
					  gh.drawLine(580,286,507,286);
					  rr = new Route(sa, sb, ea, eb);
					}	
				    r=new Route(580,286,507,286);
					lr.add(r);
		 }
		 
		 //7.#28
		 if(sa== 352 && sb == 80){
				lr=new ArrayList<Route>(); 
				Route r = null;
				//7.1 #28-#14直線
				 if(ea == 420 && eb == 71){
					  gh.drawLine(352,80,420,71);
					  rr = new Route(sa, sb, ea, eb);
					}	
				    r=new Route(352,80,420,71);
					lr.add(r);
		 }
		//8.#14
		 if(sa== 420 && sb == 71){
			 lr=new ArrayList<Route>(); 
			Route r = null;
		 //8.1#14-#28直線
			 if(ea == 352 && eb == 80){
				 gh.drawLine(352,80,420,71);
				  rr = new Route(sa, sb, ea, eb);	 
			 }
		 //8.2#14-#23直線
			 else if(ea == 441 && eb == 70){
				 gh.drawLine(441,70,420,71);
				  rr = new Route(sa, sb, ea, eb);	 
			 } 
			 r=new Route(420,71,352,80);
				lr.add(r);
				 r=new Route(420,71,441,70);
					lr.add(r);
		 }
		 //9. #23
		 if(sa== 441 && sb == 70){
			 lr=new ArrayList<Route>(); 
			Route r = null;
		 //9.1#23-#29直線
			 if(ea == 509 && eb == 58){
				 gh.drawLine(441,70,509,58);
				  rr = new Route(sa, sb, ea, eb);	 
			 }
		 //9.2#14-#23直線
			 else if(ea == 420 && eb == 71){
				 gh.drawLine(441,70,420,71);
				  rr = new Route(sa, sb, ea, eb);	 
			 } 
			 //9.3 #14-#39直線	 
			 else if(ea == 446 && eb == 547){
				 gh.drawLine(441,70,446,547);
				  rr = new Route(sa, sb, ea, eb);	 
			 } 
			 
			   r=new Route(441,70,509,58);
				lr.add(r);
				 r=new Route(441,70,420,71);
					lr.add(r);
					 r=new Route(441,70,446,547);
						lr.add(r);
		 }
		 //10  #24
		 if(sa== 149 && sb == 462){
			 lr=new ArrayList<Route>(); 
				Route r = null;
				//10.1  #24--#17直線
				 if(ea == 145 && eb == 86){
					 gh.drawLine(149,462,145,86);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				//10.2  #24--#22曲線
				 else if(ea == 72 && eb == 281){
						gh.drawLine(72, 281, 189, 281);// #22--(1)
						gh.drawLine( 189, 281,148, 275);// (1)----(2)
						gh.drawLine(148, 275,149, 462);// (2)--#24
					    rr = new Route(sa, sb, ea, eb); 
				 }
				//10.3  #24--#20曲線
				 else if(ea == 337 && eb == 281){
					 gh.drawLine(337, 283, 189, 281);// #20--(1)
						gh.drawLine( 189, 281,148, 275);// (1)----(2)
						gh.drawLine(148, 275,149, 462);// (2)--#24
						 rr = new Route(sa, sb, ea, eb); 
				 }
				//10.4  #24--#40直線
				 else if(ea == 149 && eb == 560){
					 gh.drawLine(149,462,149,560);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				//10.4  #24--#27
				 else if(ea == 145 && eb == 86){
					 gh.drawLine(149,462,145,86);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				 r=new Route(149,462,145,86);
					lr.add(r);
					 r=new Route(149,462,72,281);
						lr.add(r);
						 r=new Route(149,462,337,281);
							lr.add(r);
							 r=new Route(149,462,149,560);
								lr.add(r);
								 r=new Route(149,462,145,86);
									lr.add(r);
		 }
	//11.#13
		 if( sa == 441 && sb == 326){
			 lr=new ArrayList<Route>(); 
				Route r = null;
				//11.1 #12
				 if(ea == 396 && eb == 282){ 
					 gh.drawLine(441,326,396,282);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				//11.2 #19
				 else if(ea == 503 && eb == 378){ 
					 gh.drawLine(441,326,503,378);
					  rr = new Route(sa, sb, ea, eb); 
				 }
				 r=new Route(441,326,396,282);
					lr.add(r);
					 r=new Route(441,326,503,378);
						lr.add(r);
		 }
		 
		 
		 //12  #19
		 if( sa == 503 && sb == 378){
			 lr=new ArrayList<Route>(); 
				Route r = null;
				//12.1 #13直線
				 if(ea == 441 && eb == 326){ 
					 gh.drawLine(503,378,441,326);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				//12.2 #27直線
				 else if(ea == 600 && eb == 463){ 
					 gh.drawLine(503,378,600,463);
					  rr = new Route(sa, sb, ea, eb); 
				 }
				 r=new Route(503,378,441,326);
					lr.add(r);
					 r=new Route(503,378,600,463);
						lr.add(r);
		 }
		//13 #40
		 if( sa == 149 && sb == 560){
			 lr=new ArrayList<Route>(); 
				Route r = null;
				//13.1 #24
				if(ea == 149 && eb == 462){ 
					 gh.drawLine(149,560,149,462);
					  rr = new Route(sa, sb, ea, eb);	 
				 }	
				//13.1 #31/34
				if(ea == 656 && eb == 564){ 
					 gh.drawLine(149,560,656,564);
					  rr = new Route(sa, sb, ea, eb);	 
				 }	
				 r=new Route(149,560,149,462);
					lr.add(r);
					 r=new Route(149,560,656,564);
						lr.add(r);
		 }
		 //14 #39
		 if(sa == 446 && sb == 547){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //14.1  #23直線
				if(ea == 441 && eb == 70){ 
					 gh.drawLine(446,547,441,70);
					  rr = new Route(sa, sb, ea, eb);	 
				 }	
		 //14.2  #37直線
				else if(ea == 446 && eb == 596){ 
					 gh.drawLine(446,547,446,596);
					  rr = new Route(sa, sb, ea, eb);	 
				 }	
		//14.3  #38直線
				else if(ea == 736 && eb == 561){ 
					 gh.drawLine(446,547,734,561);
					  rr = new Route(sa, sb, ea, eb);	 
				 }	
				 r=new Route(446,547,441,70);
					lr.add(r);
					 r=new Route(446,547,446,596);
						lr.add(r);
						 r=new Route(446,547,736,561);
							lr.add(r);
			
		 }
		//15    #31/#34
		 if(sa == 656 && sb == 564){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //15.1 # 38直線
				if(ea == 736 && eb == 561){ 
					  gh.drawLine(656,564,736,561);
					  rr = new Route(sa, sb, ea, eb);	 
				 }		
		 //15.2 #40直線
				else if(ea == 149 && eb == 560){ 
					  gh.drawLine(656,564,149,560);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				 r=new Route(656,564,736,561);
					lr.add(r);
					 r=new Route(656,564,149,560);
						lr.add(r);
		 }
		 
		 
		 //16 #27
		 if(sa == 600 && sb == 463){
			 lr=new ArrayList<Route>(); 
				Route r = null;
				//16.1 #19直線
				if(ea == 503 && eb == 378){ 
					  gh.drawLine(600,463,503,378);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				//16.2 #24直線
				else if(ea == 149 && eb == 462){ 
					 gh.drawLine(600,463,149,462);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				//16.3 #38曲線
				else if(ea == 736 && eb == 561){ 
					 gh.drawLine(600,463,736,460);
					 gh.drawLine(736,460,736,561);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				 r=new Route(600,463,503,378);
					lr.add(r);
					 r=new Route(600,463,149,462);
						lr.add(r);
						 r=new Route(600,463,736,561);
							lr.add(r);
		 }
		//17  #37
		 if(sa == 446 && sb == 596){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //17.1 #39
				if(ea == 446 && eb == 547){ 
					  gh.drawLine(446,596,446,547);
					  rr = new Route(sa, sb, ea, eb);	 
				 }	
		 //17.2 #16
				else if(ea == 444 && eb == 649){ 
					gh.drawLine(446,596,444,649);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
		 //17.3 #25曲線
				else if(ea == 650 && eb == 601){ 
					gh.drawLine(446,596,567,591);
					gh.drawLine(567,591,650,601);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				 r=new Route(446,596,446,547);
					lr.add(r);
					 r=new Route(446,596,444,649);
						lr.add(r);
						r=new Route(446,596,444,649);
						lr.add(r);	
		 }
		 //18 #25
		 if(sa == 650 && sb == 601){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //18.1 #32曲線
				 if(ea == 690 && eb == 626){ 
					gh.drawLine(650,601,739,620);
					gh.drawLine(739,620,690,626);
					  rr = new Route(sa, sb, ea, eb);	 
				 }	
		 //18.2 #37曲線
				else if(ea == 446 && eb == 596){ 
					gh.drawLine(446,596,567,591);
					gh.drawLine(567,591,650,601);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				 r=new Route(650,601,690,626);
					lr.add(r);
					 r=new Route(650,601,446,596);
						lr.add(r);
		 }
		 
		//19 #16
		 if(sa == 444 && sb == 649){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //19.1 #37直線
				if(ea == 446 && eb == 596){ 
					gh.drawLine(444,649,446,596);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
		 //19.2 #36/26直線
				else if(ea == 549 && eb == 642){ 
					gh.drawLine(444,649,549,642);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				 r=new Route(444,649,446,596);
					lr.add(r);
					 r=new Route(444,649,549,642);
						lr.add(r);
		 }
		 
		 //20 #36/26
		 if(sa == 549 && sb == 642){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //20.1#16直線
				 if(ea == 444 && eb == 649){ 
					gh.drawLine(549,642,444,649);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
		 //20.2#35直線
				else if(ea == 650 && eb == 657){ 
					gh.drawLine(549,642,650,657);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				 r=new Route(549,642,444,649);
					lr.add(r);
					 r=new Route(549,642,650,657);
						lr.add(r);
		 }
		 //21 #35
		 if(sa == 650 && sb == 657){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //21.1 #11
				 if(ea == 694 && eb == 678){ 
					gh.drawLine(650,657,694,678);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
		 //21.2 #36/26
				else if(ea == 549 && eb == 642){ 
					gh.drawLine(650,657,549,642);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				 r=new Route(650,657,694,678);
					lr.add(r);
					 r=new Route(650,657,549,642);
						lr.add(r);
		 }
		 //22   #11
		 if(sa == 694 && sb == 678){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //22.1 #35
				if(ea == 650 && eb == 657){ 
					gh.drawLine(694,678,650,657);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
		 //22.2 #32
				else if(ea == 690 && eb == 626){ 
					gh.drawLine(694,678,690,626);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				 r=new Route(694,678,650,657);
					lr.add(r);
					 r=new Route(694,678,690,626);
						lr.add(r);
		 }
		 //23 #32
		 if(sa == 690 && sb == 626){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //23.1 #11直線
				if(ea == 694 && eb == 678){ 
					gh.drawLine(690,626,694,678);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
		 //23.1 #33直線
				else if(ea == 690 && eb == 575){ 
					gh.drawLine(690,626,690,575);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
		 //23.1 #25曲線
				else if(ea == 650 && eb == 601){ 
					gh.drawLine(650, 603, 739, 620);
					  gh.drawLine(739, 620, 690, 626);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				 r=new Route(690,626,694,678);
					lr.add(r);
					 r=new Route(690,626,690,575);
						lr.add(r);
						 r=new Route(690,626,650,601);
							lr.add(r);
		 }
		 
		 //24 #33		 
		 if(sa == 690 && sb == 575){
			 lr=new ArrayList<Route>(); 
				Route r = null;
				//24.1 #32
				if(ea == 690 && eb == 626){ 
					gh.drawLine(690, 575, 690, 626);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
		 //24.2 #38
				else if(ea == 736 && eb == 561){ 
					gh.drawLine(690, 575, 736, 561);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
				 r=new Route(690, 575, 690, 626);
					lr.add(r);
					 r=new Route(690, 575, 736, 561);
						lr.add(r);		
		 }
		 //25  #38
		 if(sa == 736 && sb == 561){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //25.1 #27曲線
			if(ea == 600 && eb == 463){ 
				 gh.drawLine(600,463,736,460);
				 gh.drawLine(736,460,736,561);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
		 //25.2 #33直線
				else if(ea == 690 && eb == 575){ 
					gh.drawLine(736, 561,690,575);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
		 //25.3 #31/34直線
				else if(ea == 656 && eb == 564){ 
					gh.drawLine(736, 561,656,564);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
			 r=new Route(736, 561,600,463);
				lr.add(r);
				 r=new Route(736, 561,690,575);
					lr.add(r);	
					 r=new Route(736, 561,656,564);
						lr.add(r);	
				
		 }
		 //26 #21
		 if(sa == 507 && sb == 286){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //26.1 #15
			if(ea == 580 && eb == 286){ 
					gh.drawLine(507, 286,580,286);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
		 //26.1 #20
				else if(ea == 337 && eb == 281){ 
					gh.drawLine(507, 286,337,281);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
			   r=new Route(507, 286,580,286);
				lr.add(r);	
				 r=new Route(507, 286,337,281);
					lr.add(r);	
		     }
		 //27 #29
		 if(sa == 509 && sb == 58){
			 lr=new ArrayList<Route>(); 
				Route r = null;
		 //27.1 #23
			if(ea == 441 && eb == 70){ 
					gh.drawLine(509, 58,441,70);
					  rr = new Route(sa, sb, ea, eb);	 
				 }
			   r=new Route(509, 58,441,70);
				lr.add(r);	
		 }
			list.add(rr);
			return list;
		}

		
	//這個專門放基站的位置的x,y軸座標
	private static int[] case1(String a, int x, int y) {
		switch (a) {
		case "030":
			x = 71;
			y = 96;
			break;
		case "017":
			x = 145;
			y = 86;
			break;
		case "022":
			x = 72;
			y = 281;
			break;
		case "020":
			x = 337;
			y = 281;
			break;
		case "028":
			x = 352;
			y = 80;
			break;
		case "012":
			x = 396;
			y = 282;
			break;
		case "014":
			x = 420;
			y = 71;
			break;
		case "023":
			x = 441;
			y =70;
			break;
		case "029":
			x = 509;
			y = 58;
			break;
		case "013":
			x = 441;
			y = 326;
			break;
		case "019":
			x = 503;
			y = 378;
			break;
		case "027":
			x = 600;
			y = 463;
			break;
		case "024":
			x = 149;
			y = 462;
			break;
		case "040":
			x = 149;
			y = 560;
			break;
		case "038":
			x = 736;
			y = 561;
			break;
		case "033":
			x = 690;
			y = 575;
			break;
		case "015":
			x = 580;
			y = 286;
			break;
		case "039":
			x = 446;
			y = 547;
			break;
		case "037":
			x = 446;
			y = 596;
			break;
		case "031":
			x = 656;
			y = 564;
			break;
		case "034":
			x = 656;
			y = 564;
			break;
		case "036":
			x = 549;
			y = 642;
			break;
		case "026":
			x = 549;
			y = 642;
			break;
		case "011":
			x = 694;
			y = 678;
			break;
		case "016":
			x = 444;
			y = 649;
			break;
		case "032":
			x = 690;
			y = 626;
			break;
		case "021":
			x = 507;
			y = 286;
			break;
		case "035":
			x = 650;
			y = 657;
			break;
		case "025":
			x = 650;
			y = 601;
			break;
		}
		int[] sz = { x, y };
		return sz;
	}
}