【JavaWeb】石家庄地铁搭乘系统——第二版

换了一种画图方式:放大缩小后点与线的比例不在发生变化

增加了路线显示(信息显示 +地图涂色)

增加了点击图,自动添加地址到输入框

增加了输入框的清除和地图涂色的重置

代码如下:

  1 <%@ page language="java" contentType="text/html; charset=UTF-8"
  2     pageEncoding="UTF-8"%>
  3 <!DOCTYPE html>
  4 <html>
  5 <head>
  6     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7     <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  8     <link rel="stylesheet" type="text/css" href="../css/showMapCss.css" />
  9     <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=yie6aV67M0SYr9za3uZ5G9AYKgwOPqRA"></script>
 10     <title>石家庄地铁查询系统</title>
 11 </head>
 12 <body>
 13     <div class="selectDiv" id="selectDiv">
 14  
 15         <div class="selectQiDiv">
 16             <label>线路<input type="text" id="listName" name="listName" placeholder="演示用,可不填"/></label>
 17         </div>
 18 
 19         <div class="selectQiDiv">
 20             <label>起点<input type="text" id="startName" name="startName" placeholder="文字:地名/地图:序号"/></label>
 21         </div>
 22         <div class="selectZhongDiv">
 23             <label>终点<input type="text" id="endName" name="endName" placeholder="文字:地名/地图:序号"/></label>
 24         </div>
 25         <input type="button" class="select" id="select" name="select" value="查询"/>
 26         <input type="button" class="delete" id="delete" name="delete" value="清除" />
 27     </div>
 28     <div class="listDiv" id="listDiv">
 29         <input type="button" class="list_1" id="list_1" name="list_1"value="1号线" onclick="list_1()"/>
 30         <input type="button" class="list_2" id="list_2" name="list_1"value="2号线" onclick="list_2()"/>
 31         <input type="button" class="list_3" id="list_3" name="list_1"value="3号线" onclick="list_3()"/>
 32         <input type="button" class="list_4" id="list_4" name="list_1"value="4号线" onclick="list_4()"/>
 33         <input type="button" class="list_5" id="list_5" name="list_1"value="5号线" onclick="list_5()"/>
 34         <input type="button" class="list_6" id="list_6" name="list_1"value="6号线" onclick="list_6()"/>
 35     </div>
 36     <div id="allmap"></div>
 37     
 38 </body>
 39 </html>
 40 <script src="../jquery-1.11.3/jquery.js"></script>
 41 <script>
 42     $(document).ready(function()
 43             {
 44         $("#delete").click(function()
 45                 {//删除临时直线
 46                     $("#listName").val("");
 47                     $("#startName").val("");
 48                     $("#endName").val("");
 49                     $(".out").remove();
 50                     flag=0;
 51                     map.clearOverlays();
 52                 });
 53         $("#select").click(function()
 54                 {
 55                     $.ajax(
 56                             {
 57                                 type: "POST",
 58                                 url: "../SubwayServlet?startName="+$("[id=startName]").val()+"&endName="+$("[id=endName]").val(),
 59                                 dataType: "text",
 60                                 success: function(data)
 61                                 {
 62                                     if(data!="请输入正确的")
 63                                     {
 64                                         //alert("您的路线为:\n"+data);
 65                                         $("#allmap").after("<div class='out' id='outDiv'><p class='out'>您的路线为</p><ol class='out' id='outOl'></div>");
 66                                         var s=data.split("->");
 67                                         for(var i=0;i<s.length;i++)
 68                                         {
 69                                             $("#outOl").append("<li class='out'>"+s[i]+"</li>");
 70                                         }
 71                                     }
 72                                     
 73                                 },
 74                                 error: function()
 75                                 {
 76                                     alert("ERROR");
 77                                 }
 78                             });
 79                     drawAllLine();
 80                 });
 81         });
 82 </script>
 83 <script type="text/javascript">
 84     var flag=0;
 85     var map = new BMap.Map("allmap");    // 创建Map实例
 86     map.centerAndZoom(new BMap.Point(114.539294,38.048844), 13);  // 初始化地图,设置中心点坐标和地图级别
 87     //添加地图类型控件
 88     map.addControl(new BMap.MapTypeControl({
 89         mapTypes:[
 90             BMAP_NORMAL_MAP,
 91             BMAP_HYBRID_MAP
 92         ]}));     
 93     map.setCurrentCity("石家庄");          // 设置地图显示的城市 此项是必须设置的
 94     map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
 95     
 96     function address(e)
 97     {
 98         var p = e.target;
 99         var aname=p.getTitle();
100         //alert(aname);
101         if(flag==0)
102         {
103             $("#startName").val(aname);
104             flag=1;
105         }
106         else if(flag==1)
107         {
108             $("#endName").val(aname);
109             flag=0;
110         }
111         
112     }
113     
114     function setPoint(x,y,name,direction)//创建站点
115     {
116         var px,py;
117         var point = new BMap.Point(x,y);//创建点
118         //文字方向选择
119         if(name!="")
120         {
121             switch(direction)
122             {
123                 case 1://
124                 {
125                     px=-20;
126                     py=-20;
127                     break;
128                 }
129                 case 2://
130                 {
131                     px=-20;
132                     py=30;
133                     break;
134                 }
135                 case 3://
136                 {
137                     px=-80;
138                     py=-10;
139                     break;
140                 }
141                 case 4://
142                 {
143                     px=30;
144                     py=-10;
145                     break;
146                 }
147                 case 5://左上
148                 {
149                     px=-60;
150                     py=-40;
151                     break;
152                 }
153             }
154             
155             
156             var opts = {position : point,offset:new BMap.Size(px, py)}
157             var label = new BMap.Label(name, opts);  // 创建文本标注对象
158             label.setStyle({border:"0",color : "black",fontSize : "12px",height : "20px",lineHeight : "20px",fontFamily:"微软雅黑"});
159           
160             
161             var pt = new BMap.Point(x,y);
162             var myIcon = new BMap.Icon("../img/Point2.png", new BMap.Size(30,30));
163             var marker = new BMap.Marker(pt,{icon:myIcon});  // 创建标注
164             map.addOverlay(marker);              // 将标注添加到地图中
165             marker.setLabel(label);
166             marker.setTitle(name);
167             marker.disableMassClear();
168             marker.addEventListener("click",address);
169             label.disableMassClear();
170         }
171         
172     }
173     
174     function setPoint2(x,y,name,direction)//创建临时站点
175     {
176         var px,py;
177         var point = new BMap.Point(x,y);//创建点
178         var circle = new BMap.Circle(point,200,{strokeColor:"black", strokeWeight:5, strokeOpacity:1}); //创建圆//
179         circle.setFillColor("#ffffff");
180         
181         map.addOverlay(circle);         
182     }
183     function setLine(x1,y1,x2,y2,color)//画出直线
184     {
185         var polyline = new BMap.Polyline([
186             new BMap.Point(x1, y1),
187             new BMap.Point(x2, y2)
188         ], {strokeColor:color, strokeWeight:21, strokeOpacity:1});//创建
189         map.addOverlay(polyline);
190         polyline.disableMassClear();
191     }
192     function setLine2(x1,y1,x2,y2)//画出临时直线
193     {
194         var polyline = new BMap.Polyline([
195             new BMap.Point(x1, y1),
196             new BMap.Point(x2, y2)
197         ], {strokeColor:"green", strokeWeight:21, strokeOpacity:1});//创建
198         map.addOverlay(polyline);
199     }
200     function drawAllLine()
201     {
202         var startNum=0;//起始
203         var endNum=0;//结束
204         startNum=document.getElementById("startName").value;
205         endNum=document.getElementById("endName").value;
206         //TODO 计算各段并循环执行drawALine函数
207         var listNum=document.getElementById("listName").value;
208         //alert("startNum"+startNum+"endNum"+endNum);
209         drawALine(listNum,startNum,endNum);
210     }
211     
212     function drawALine(listNum,start,end)//画出一段指定直线
213     {
214         
215         map.clearOverlays();        
216         if(listNum==1)//地铁1号线
217         {
218             if(start<=0&&end>0)
219             {
220                 setLine2(114.64192,38.189343,114.628268,38.167745);//东洋-东上泽
221                 setPoint2(114.64192,38.189343);
222                 setPoint2(114.628268,38.167745);
223             }
224             if(start<=1&&end>1)
225             {
226                 setLine2(114.628268,38.167745,114.62759,38.160134);//东上泽-天元湖
227                 setPoint2(114.628268,38.167745);
228                 setPoint2(114.62759,38.160134);
229             }
230             if(start<=2&&end>2)
231             {
232                 setLine2(114.62759,38.160134,114.627449,38.14953);//天元湖-园博园
233                 setPoint2(114.62759,38.160134);
234                 setPoint2(114.627449,38.14953);
235             }
236             if(start<=3&&end>3)
237             {
238                 setLine2(114.627449,38.14953,114.627305,38.138874);//园博园-行政中心
239                 setPoint2(114.627449,38.14953);
240                 setPoint2(114.627305,38.138874);
241             }
242             if(start<=4&&end>4)
243             {
244                 setLine2(114.627305,38.138874,114.62137,38.129852);//行政中心-会展中心
245                 setPoint2(114.627305,38.138874);
246                 setPoint2(114.62137,38.129852);
247             }
248             if(start<=5&&end>5)
249             {
250                 
251                 setLine2(114.62137,38.129852,114.634152,38.096772);//会展中心-东庄
252                 setPoint2(114.62137,38.129852);
253                 setPoint2(114.634152,38.096772);
254             }
255             if(start<=6&&end>6)
256             {
257                 setLine2(114.634152,38.096772,114.634402,38.088129);//东庄-西庄
258                 setPoint2(114.634152,38.096772);
259                 setPoint2(114.634402,38.088129);
260             }
261             if(start<=7&&end>7)
262             {
263                 setLine2(114.634402,38.088129,114.634787,38.075265);//西庄-洨河大道
264                 setPoint2(114.634402,38.088129);
265                 setPoint2(114.634787,38.075265);
266             }
267             if(start<=8&&end>8)
268             {
269                 setLine2(114.634787,38.075265,114.635236,38.065713);//洨河大道-南村
270                 setPoint2(114.634787,38.075265);
271                 setPoint2(114.635236,38.065713);
272             }
273             if(start<=9&&end>9)
274             {
275                 setLine2(114.635236,38.065713,114.635676,38.054882);//南村-石家庄东
276                 setPoint2(114.635236,38.065713);
277                 setPoint2(114.635676,38.054882);
278             }
279             if(start<=10&&end>10)
280             {
281                 setLine2(114.635676,38.054882,114.635984,38.044023);///石家庄东-
282                 setLine2(114.635984,38.044023,114.62989,38.04387);//-火炬广场
283                 setPoint2(114.635676,38.054882);
284                 setPoint2(114.62989,38.04387);
285             }
286             if(start<=11&&end>11)
287             {
288                 setLine2(114.62989,38.04387,114.614825,38.04399);//火炬广场-留村
289                 setPoint2(114.62989,38.04387);
290                 setPoint2(114.614825,38.04399);
291             }
292             if(start<=12&&end>12)
293             {
294                 setLine2(114.614825,38.04399,114.5976,38.043412);//留村-
295                 setLine2(114.5976,38.043412,114.592682,38.050428);//-白佛
296                 setPoint2(114.614825,38.04399);
297                 setPoint2(114.592682,38.050428);
298             }
299             if(start<=13&&end>13)
300             {
301                 setLine2(114.592682,38.050428,114.582999,38.050094);//白佛-朝晖桥
302                 setPoint2(114.592682,38.050428);
303                 setPoint2(114.582999,38.050094);
304             }
305             if(start<=14&&end>14)
306             {
307                 
308                 setLine2(114.582999,38.050094,114.568896,38.049525);//朝晖桥-谈固
309                 setPoint2(114.582999,38.050094);
310                 setPoint2(114.568896,38.049525);
311             }
312             if(start<=15&&end>15)
313             {
314                 setLine2(114.568896,38.049525,114.552434,38.049006);//谈固-北宋
315                 setPoint2(114.568896,38.049525);
316                 setPoint2(114.552434,38.049006);
317             }
318             if(start<=16&&end>16)
319             {
320                 setLine2(114.552434,38.049006,114.539294,38.048844);//北宋-体育场
321                 setPoint2(114.552434,38.049006);
322                 setPoint2(114.539294,38.048844);
323             }
324             if(start<=17&&end>17)
325             {
326                 setLine2(114.539294,38.048844,114.528438,38.048592);//体育场-博物院
327                 setPoint2(114.539294,38.048844);
328                 setPoint2(114.528438,38.048592);
329             }
330             if(start<=18&&end>18)
331             {
332                 setLine2(114.528438,38.048592,114.518483,38.049043);//博物院-北国商城
333                 setPoint2(114.528438,38.048592);
334                 setPoint2(114.518483,38.049043);
335             }
336             if(start<=19&&end>19)
337             {
338                 setLine2(114.518483,38.049043,114.507972,38.049667);//北国商城-平安大街
339                 setPoint2(114.518483,38.049043);
340                 setPoint2(114.507972,38.049667);
341             }
342             if(start<=20&&end>20)
343             {
344                 setLine2(114.507972,38.049667,114.493744,38.049809);//平安大街-解放广场
345                 setPoint2(114.507972,38.049667);
346                 setPoint2(114.493744,38.049809);
347             }
348             if(start<=21&&end>21)
349             {
350                 setLine2(114.493744,38.049809,114.483772,38.049448);//解放广场-新百广场
351                 setPoint2(114.493744,38.049809);
352                 setPoint2(114.483772,38.049448);
353             }
354             if(start<=22&&end>22)
355             {
356                 setLine2(114.483772,38.049448,114.472184,38.048965);//新百广场-烈士陵园
357                 setPoint2(114.483772,38.049448);
358                 setPoint2(114.472184,38.048965);
359             }
360             if(start<=23&&end>23)
361             {
362                 
363                 setLine2(114.472184,38.048965,114.458637,38.048111);//烈士陵园-和平医院
364                 setPoint2(114.472184,38.048965);
365                 setPoint2(114.458637,38.048111);
366             }
367             if(start<=24&&end>24)
368             {
369                 setLine2(114.458637,38.048111,114.44353,38.047209);//和平医院-长城桥
370                 setPoint2(114.458637,38.048111);
371                 setPoint2(114.44353,38.047209);
372             }
373             if(start<=25&&end>25)
374             {
375                 setLine2(114.44353,38.047209,114.429246,38.046385);//长城桥-时光街
376                 setPoint2(114.44353,38.047209);
377                 setPoint2(114.429246,38.046385);
378             }
379             if(start<=26&&end>26)
380             {
381                 setLine2(114.429246,38.046385,114.415825,38.045975);//时光街-西王
382                 setPoint2(114.429246,38.046385);
383                 setPoint2(114.415825,38.045975);
384             }
385             if(start<=27&&end>27)
386             {
387                 setLine2(114.415825,38.045975,114.388983,38.042902);//西王-上庄
388                 setPoint2(114.415825,38.045975);
389                 setPoint2(114.388983,38.042902);
390             }
391             if(start<=28&&end>28)
392             {
393                 setLine2(114.388983,38.042902,114.386238,38.031524);//上庄-上庄南
394                 setPoint2(114.388983,38.042902);
395                 setPoint2(114.386238,38.031524);
396             }
397         }
398         if(listNum==2)//地铁2号线
399         {
400             if(start<=0&&end>0)
401             {
402                 setLine2(114.528629,38.098455,114.523502,38.089514);//西古城-铁道大学
403                 setPoint2(114.528629,38.098455);
404                 setPoint2(114.523502,38.089514);
405             }
406             if(start<=1&&end>1)
407             {
408                 setLine2(114.523502,38.089514,114.518328,38.078832);//铁道大学-运河桥
409                 setPoint2(114.523502,38.089514);
410                 setPoint2(114.518328,38.078832);
411             }
412             if(start<=2&&end>2)
413             {
414                 setLine2(114.518328,38.078832,114.518314,38.064561);//运河桥-蓝天圣木
415                 setPoint2(114.518328,38.078832);
416                 setPoint2(114.518314,38.064561);
417             }
418             if(start<=3&&end>3)
419             {
420                 setLine2(114.518314,38.064561,114.518304,38.056567);//蓝天圣木-长安公园
421                 setPoint2(114.518314,38.064561);
422                 setPoint2(114.518304,38.056567);
423             }
424             if(start<=4&&end>4)
425             {
426                 setLine2(114.518304,38.056567,114.518381,38.048924);//长安公园-北国商城
427                 setPoint2(114.518304,38.056567);
428                 setPoint2(114.518381,38.048924);
429             }
430             if(start<=5&&end>5)
431             {
432                 
433                 setLine2(114.518381,38.048924,114.518394,38.041566);//北国商城-大戏院
434                 setPoint2(114.518381,38.048924);
435                 setPoint2(114.518394,38.041566);
436             }
437             if(start<=6&&end>6)
438             {
439                 setLine2(114.518394,38.041566,114.51852,38.034297);//大戏院-新世隆
440                 setPoint2(114.518394,38.041566);
441                 setPoint2(114.51852,38.034297);
442             }
443             if(start<=7&&end>7)
444             {
445                 setLine2(114.51852,38.034297,114.518493,38.026611);//新世隆-东港头
446                 setPoint2(114.51852,38.034297);
447                 setPoint2(114.518493,38.026611);
448             }
449             if(start<=8&&end>8)
450             {
451                 setLine2(114.518493,38.026611,114.508881,38.023598);//东港头-东三教
452                 setPoint2(114.518493,38.026611);
453                 setPoint2(114.508881,38.023598);
454             }
455             if(start<=9&&end>9)
456             {
457                 setLine2(114.508881,38.023598,114.49553,38.022315);//东三教-
458                 setLine2(114.49553,38.022315,114.490951,38.016391);//-石家庄站
459                 setPoint2(114.508881,38.023598);
460                 setPoint2(114.490951,38.016391);
461             }
462             if(start<=10&&end>10)
463             {
464                 setLine2(114.490951,38.016391,114.491398,38.01373);//石家庄站-
465                 setLine2(114.491398,38.01373,114.498692,38.007888);//-塔谈
466                 setPoint2(114.490951,38.016391);
467                 setPoint2(114.498692,38.007888);
468             }
469             if(start<=11&&end>11)
470             {
471                 setLine2(114.498692,38.007888,114.500705,37.998192);//塔谈-塔谈南
472                 setPoint2(114.498692,38.007888);
473                 setPoint2(114.500705,37.998192);
474             }
475             if(start<=12&&end>12)
476             {
477                 setLine2(114.500705,37.998192,114.503058,37.988594);//塔谈南-南位
478                 setPoint2(114.500705,37.998192);
479                 setPoint2(114.503058,37.988594);
480             }
481             if(start<=13&&end>13)
482             {
483                 setLine2(114.503058,37.988594,114.504711,37.980432);//南位-嘉华
484                 setPoint2(114.503058,37.988594);
485                 setPoint2(114.504711,37.980432);
486             }
487         }
488     }
489     
490     
491     
492     
493     
494     
495     
496     
497     
498     
499     //1号线
500     setLine(114.64192,38.189343,114.628268,38.167745,"red");//东洋-东上泽
501     setLine(114.628268,38.167745,114.62759,38.160134,"red");//东上泽-天元湖
502     setLine(114.62759,38.160134,114.627449,38.14953,"red");//天元湖-园博园
503     setLine(114.627449,38.14953,114.627305,38.138874,"red");//园博园-行政中心
504     setLine(114.627305,38.138874,114.62137,38.129852,"red");//行政中心-会展中心
505     setLine(114.62137,38.129852,114.634152,38.096772,"red");//会展中心-东庄
506     setLine(114.634152,38.096772,114.634402,38.088129,"red");//东庄-西庄
507     setLine(114.634402,38.088129,114.634787,38.075265,"red");//西庄-洨河大道
508     setLine(114.634787,38.075265,114.635236,38.065713,"red");//洨河大道-南村
509     setLine(114.635236,38.065713,114.635676,38.054882,"red");//南村-石家庄东
510     setLine(114.635676,38.054882,114.635984,38.044023,"red");///石家庄东-
511     setLine(114.635984,38.044023,114.62989,38.04387,"red");//-火炬广场
512     setLine(114.62989,38.04387,114.614825,38.04399,"red");//火炬广场-留村
513     setLine(114.614825,38.04399,114.5976,38.043412,"red");//留村-
514     setLine(114.5976,38.043412,114.592682,38.050428,"red");//-白佛
515     setLine(114.592682,38.050428,114.582999,38.050094,"red");//白佛-朝晖桥
516     setLine(114.582999,38.050094,114.568896,38.049525,"red");//朝晖桥-谈固
517     setLine(114.568896,38.049525,114.552434,38.049006,"red");//谈固-北宋
518     setLine(114.552434,38.049006,114.539294,38.048844,"red");//北宋-体育场
519     setLine(114.539294,38.048844,114.528438,38.048592,"red");//体育场-博物院
520     setLine(114.528438,38.048592,114.518483,38.049043,"red");//博物院-北国商城
521     setLine(114.518483,38.049043,114.507972,38.049667,"red");//北国商城-平安大街
522     setLine(114.507972,38.049667,114.493744,38.049809,"red");//平安大街-解放广场
523     setLine(114.493744,38.049809,114.483772,38.049448,"red");//解放广场-新百广场
524     setLine(114.483772,38.049448,114.472184,38.048965,"red");//新百广场-烈士陵园
525     setLine(114.472184,38.048965,114.458637,38.048111,"red");//烈士陵园-和平医院
526     setLine(114.458637,38.048111,114.44353,38.047209,"red");//和平医院-长城桥
527     setLine(114.44353,38.047209,114.429246,38.046385,"red");//长城桥-时光街
528     setLine(114.429246,38.046385,114.415825,38.045975,"red");//时光街-西王
529     setLine(114.415825,38.045975,114.388983,38.042902,"red");//西王-上庄
530     setLine(114.388983,38.042902,114.386238,38.031524,"red");//上庄-上庄南
531     //2号线
532     setLine(114.528629,38.098455,114.523502,38.089514,"#800080");//西古城-铁道大学
533     setLine(114.523502,38.089514,114.518328,38.078832,"#800080");//铁道大学-运河桥
534     setLine(114.518328,38.078832,114.518314,38.064561,"#800080");//运河桥-蓝天圣木
535     setLine(114.518314,38.064561,114.518304,38.056567,"#800080");//蓝天圣木-长安公园
536     setLine(114.518304,38.056567,114.518381,38.048924,"#800080");//长安公园-北国商城
537     setLine(114.518381,38.048924,114.518394,38.041566,"#800080");//北国商城-大戏院
538     setLine(114.518394,38.041566,114.51852,38.034297,"#800080");//大戏院-新世隆
539     setLine(114.51852,38.034297,114.518493,38.026611,"#800080");//新世隆-东港头
540     setLine(114.518493,38.026611,114.508881,38.023598,"#800080");//东港头-东三教
541     setLine(114.508881,38.023598,114.49553,38.022315,"#800080");//东三教-
542     setLine(114.49553,38.022315,114.490951,38.016391,"#800080");//-石家庄站
543     setLine(114.490951,38.016391,114.491398,38.01373,"#800080");//石家庄站-
544     setLine(114.491398,38.01373,114.498692,38.007888,"#800080");//-塔谈
545     setLine(114.498692,38.007888,114.500705,37.998192,"#800080");//塔谈-塔谈南
546     setLine(114.500705,37.998192,114.503058,37.988594,"#800080");//塔谈南-南位
547     setLine(114.503058,37.988594,114.504711,37.980432,"#800080");//南位-嘉华
548     
549   //3号线
550 
551     setLine(114.67263,38.012049,114.646461,38.00412,"#0000ff");//北乐乡-韩通
552     setLine(114.646461,38.00412,114.626985,38.015267,"#0000ff");//韩通-南豆
553     setLine(114.626985,38.015267,114.615567,38.020009,"#0000ff");//南豆-天山大街
554     setLine(114.615567,38.020009,114.61105,38.014937,"#0000ff");//天山大街-中仰陵
555     setLine(114.61105,38.014937,114.586883,38.015855,"#0000ff");//中仰陵-三教堂
556     setLine(114.586883,38.015855,114.583649,38.01289,"#0000ff");//三教堂-位同
557     setLine(114.583649,38.01289,114.553633,38.015436,"#0000ff");//位同-南王
558     setLine(114.553633,38.015436,114.549034,38.017123,"#0000ff");//南王-东王
559     setLine(114.549034,38.017123,114.527286,38.011163,"#0000ff");//东王-塔冢
560     setLine(114.527286,38.011163,114.516501,38.019433,"#0000ff");//塔冢-孙村
561     setLine(114.516501,38.019433,114.49876,38.017979,"#0000ff");//孙村-东广场
562     setLine(114.49876,38.017979,114.490951,38.016391,"#0000ff");//东广场-石家庄站
563     setLine(114.490951,38.016391,114.484998,38.01865,"#0000ff");//石家庄站-西三教
564     setLine(114.484998,38.01865,114.483458,38.023028,"#0000ff");
565     setLine(114.483458,38.023028,114.483754,38.034207,"#0000ff");//西三教-槐安桥
566     setLine(114.483754,38.034207,114.483754,38.043075,"#0000ff");//槐安桥-东里
567     setLine(114.483754,38.043075,114.483772,38.049448,"#0000ff");//东里-新百广场
568     setLine(114.483772,38.049448,114.483763,38.059236,"#0000ff");//新百广场-市二中
569     setLine(114.483763,38.059236,114.48041,38.070724,"#0000ff");//市二中-市庄
570     setLine(114.48041,38.070724,114.495303,38.084926,"#0000ff");//市庄-柏林庄
571     setLine(114.495303,38.084926,114.464866,38.085248,"#0000ff");//柏林庄-水上公园
572     setLine(114.464866,38.085248,114.447421,38.088436,"#0000ff");//水上公园-西三庄
573     
574     //4号线
575     setLine(114.609796,38.110264,114.593825,38.100418,"#ff8000");//交通驾校-南高营
576     setLine(114.593825,38.100418,114.57921,38.075527,"#ff8000");//南高营-十里铺
577     setLine(114.57921,38.075527,114.556369,38.07512,"#ff8000");//十里铺-北翟营
578     setLine(114.556369,38.07512,114.54838,38.06494,"#ff8000");//北翟营-建华市场
579     setLine(114.54838,38.06494,114.553055,38.056808,"#ff8000");//建华市场-长安医院
580     setLine(114.553055,38.056808,114.552434,38.049006,"#ff8000");//长安医院-北宋
581     setLine(114.552434,38.049006,114.553598,38.04185,"#ff8000");//北宋-儿童医院
582     setLine(114.553598,38.04185,114.553466,38.034817,"#ff8000");//儿童医院-东明商城
583     setLine(114.553466,38.034817,114.555804,38.027975,"#ff8000");//东明商城-经济学院
584     setLine(114.555804,38.027975,114.553633,38.015436,"#ff8000");//经济学院-南王
585     setLine(114.553633,38.015436,114.554525,38.006825,"#ff8000");//南王-赵卜口
586     setLine(114.554525,38.006825,114.536286,38.005437,"#ff8000");//赵卜口-南焦客运站
587     setLine(114.536286,38.005437,114.531733,37.993754,"#ff8000");//南焦客运站-南粟
588     setLine(114.531733,37.993754,114.500705,37.998192,"#ff8000");//南粟-塔谈南
589     setLine(114.500705,37.998192,114.490705,37.998192,"#ff8000");//塔谈南-京广东街
590     setLine(114.490705,37.998192,114.481527,37.997262,"#ff8000");//京广东街-滨河街
591     setLine(114.481527,37.997262,114.467527,37.999187,"#ff8000");//滨河街-法商学院
592     setLine(114.467527,37.999187,114.461781,37.999187,"#ff8000");//法商医院-华医学院
593     setLine(114.461781,37.999187,114.442926,38.004907,"#ff8000");//华医学院-东良厢
594     setLine(114.442926,38.004907,114.428656,38.014796,"#ff8000");//东良厢-碧海蓝湾
595   //5号线
596       setLine(114.559371,38.064785,114.54838,38.06494,"#808000");//南翟营-建华市场
597       setLine(114.54838,38.06494,114.539289,38.065026,"#808000");//建华市场-常青园
598       setLine(114.539289,38.065026,114.518314,38.064561,"#808000");//常青园-蓝天圣木
599       setLine(114.518314,38.064561,114.497959,38.066719,"#808000");//蓝天圣木-军械学院
600       setLine(114.497959,38.066719,114.48041,38.070724,"#808000");//军械学院-市庄
601       setLine(114.48041,38.070724,114.472054,38.072363,"#808000");//市庄-火车北站
602       setLine(114.472054,38.072363,114.453612,38.066388,"#808000");//火车北站-农科院
603       setLine(114.453612,38.066388,114.453803,38.060893,"#808000");//农科院-合作路
604       setLine(114.453803,38.060893,114.453467,38.056613,"#808000");//合作路-西焦
605       setLine(114.453467,38.056613,114.458637,38.048111,"#808000");//西焦-和平医院
606       setLine(114.458637,38.048111,114.458396,38.039924,"#808000");//和平医院-益友百货
607       setLine(114.458396,38.039924,114.4589,38.034159,"#808000");//益友百货-审计厅
608       setLine(114.4589,38.034159,114.457267,38.024399,"#808000");//审计厅-碧海云天
609       setLine(114.457267,38.024399,114.466517,38.005553,"#808000");//碧海云天-东五里
610       setLine(114.466517,38.005553,114.467527,37.999187,"#808000");//东五里-法商学院
611       setLine(114.467527,37.999187,114.479055,37.984525,"#808000");//法商学院-宫家庄
612 
613   //6号线
614       setLine(114.642996,37.971908,114.626356,37.984586,"#00ffff");//东佐-北郗马
615       setLine(114.626356,37.984586,114.626985,38.009324,"#00ffff");//北郗马-东仰陵
616       setLine(114.626985,38.009324,114.626985,38.015267,"#00ffff");//东仰陵-南豆
617       setLine(114.626985,38.015267,114.626985,38.02753,"#00ffff");//南豆-北豆
618       setLine(114.626985,38.02753,114.622890,38.03659,"#00ffff");//北豆-星辰广场
619       setLine(114.622890,38.03659,114.622890,38.04399,"#00ffff");//星辰广场-//114.62989,38.04387,114.614825,38.04399
620       setLine(114.622890,38.04399,114.614805,38.04393,"#00ffff");//-留村//114.62989,38.04387,114.614825,38.04399
621       setLine(114.614805,38.04393,114.583325,38.043458,"#00ffff");
622       setLine(114.583325,38.043458,114.583421,38.036067,"#00ffff");//留村-二十里铺
623       setLine(114.583421,38.036067,114.575094,38.035572,"#00ffff");//二十里铺-国际城
624       setLine(114.575094,38.035572,114.553466,38.034817,"#00ffff");//国际城-东明商城
625 
626     
627     
628     
629     
630     
631     //一号线
632     setPoint(114.64192,38.189343,"东洋",4);
633     setPoint(114.628268,38.167745,"东上泽",4);
634     setPoint(114.62759,38.160134,"天元湖",4);
635     setPoint(114.627449,38.14953,"园博园",4);
636     setPoint(114.627305,38.138874,"行政中心",4);
637     setPoint(114.62137,38.129852,"会展中心",4);
638     setPoint(114.634152,38.096772,"东庄",4);
639     setPoint(114.634402,38.088129,"西庄",4);
640     setPoint(114.634787,38.075265,"洨河大道",4);
641     setPoint(114.635236,38.065713,"南村",4);
642     setPoint(114.635676,38.054882,"石家庄东",4);
643     setPoint(114.62989,38.04387,"火炬广场",4);
644     setPoint(114.614825,38.04399,"留村",1);
645     setPoint(114.592682,38.050428,"白佛",1);
646     setPoint(114.582999,38.050094,"朝晖桥",1);
647     setPoint(114.568896,38.049525,"谈固",1);
648     setPoint(114.552434,38.049006,"北宋",1);
649     setPoint(114.539294,38.048844,"体育场",1);
650     setPoint(114.528438,38.048592,"博物院",1);
651     setPoint(114.518483,38.049043,"北国商城",5);
652     setPoint(114.507972,38.049667,"平安大街",2);
653     setPoint(114.493744,38.049809,"解放广场",1);
654     setPoint(114.483772,38.049448,"新百广场",2);
655     setPoint(114.472184,38.048965,"烈士陵园",1);
656     setPoint(114.458637,38.048111,"和平医院",2);
657     setPoint(114.44353,38.047209,"长城桥",1);
658     setPoint(114.429246,38.046385,"时光街",1);
659     setPoint(114.415825,38.045975,"西王",1);
660     setPoint(114.388983,38.042902,"上庄",1);
661     setPoint(114.386238,38.031524,"上庄南",2);
662     
663     //2号线
664     setPoint(114.528629,38.098455,"西古城",4);
665     setPoint(114.523502,38.089514,"铁道大学",4);
666     setPoint(114.518328,38.078832,"运河桥",4);
667     setPoint(114.518314,38.064561,"蓝天圣木",5);
668     setPoint(114.518304,38.056567,"长安公园",5);
669     setPoint(114.518381,38.048924,"",3);
670     setPoint(114.518394,38.041566,"大戏院",4);
671     setPoint(114.51852,38.034297,"新世隆",4);
672     setPoint(114.518493,38.026611,"东港头",4);
673     setPoint(114.508881,38.023598,"东三教",1);
674     setPoint(114.490951,38.016391,"石家庄站",4);
675     setPoint(114.498692,38.007888,"塔谈",4);
676     setPoint(114.500705,37.998192,"塔谈南",4);
677     setPoint(114.503058,37.988594,"南位",4);
678     setPoint(114.504711,37.980432,"嘉华",4);
679     //3号线
680     
681     setPoint(114.67263,38.012049,"北乐乡",3);
682     setPoint(114.646461,38.00412,"韩通",3);
683     setPoint(114.626985,38.015267,"南豆",3);
684     setPoint(114.615567,38.020009,"天山大街",3);
685     setPoint(114.61105,38.014937,"中仰陵",3);
686     setPoint(114.586883,38.015855,"三教堂",3);
687     setPoint(114.583649,38.01289,"位同",3);
688     setPoint(114.553633,38.015436,"南王",3);
689     setPoint(114.549034,38.017123,"东王",3);
690     setPoint(114.527286,38.011163,"塔冢",3);
691     setPoint(114.516501,38.019433,"孙村",3);
692     setPoint(114.49876,38.017979,"东广场",3);
693     setPoint(114.490951,38.016391,"石家庄站",3);
694     setPoint(114.483458,38.023028,"西三教",3);
695     setPoint(114.483754,38.034207,"槐安桥",3);
696     setPoint(114.483754,38.043075,"东里",3);
697     setPoint(114.483772,38.049448,"",3);
698     setPoint(114.483763,38.059236,"市二中",3);
699     setPoint(114.48041,38.070724,"市庄",3);
700     setPoint(114.495303,38.084926,"柏林庄",3);
701     setPoint(114.464866,38.085248,"水上公园",3);
702     setPoint(114.447421,38.088436,"西三庄",3);
703     
704     
705     
706   //4号线
707     setPoint(114.609796,38.110264,"交通驾校",4);
708     setPoint(114.593825,38.100418,"南高营",4);
709     setPoint(114.57921,38.075527,"十里铺",4);
710     setPoint(114.556369,38.07512,"北翟营",4);
711     setPoint(114.54838,38.06494,"建华市场",4);
712     setPoint(114.553055,38.056808,"长安医院",4);
713     setPoint(114.552434,38.049006,"",4);
714     setPoint(114.553598,38.04185,"儿童医院",4);
715     setPoint(114.553466,38.034817,"东明商城",4);
716     setPoint(114.555804,38.027975,"经济学院",4);
717     setPoint(114.553633,38.015436,"",4);
718     setPoint(114.554525,38.006825,"赵卜口",4);
719     setPoint(114.536286,38.005437,"南焦客运站",4);
720     setPoint(114.531733,37.993754,"南粟",4);
721     setPoint(114.500705,37.998192,"",4);
722     setPoint(114.490705,37.998192,"京广东街",4);
723     setPoint(114.481527,37.997262,"滨河街",4);
724     setPoint(114.467527,37.999187,"法商学院",4);
725     setPoint(114.461781,37.999187,"华医学院",4);   
726     setPoint(114.442926,38.004907,"东良厢",4);
727     setPoint(114.428656,38.014796,"碧海蓝湾",4);
728     
729     //5号线
730     
731     setPoint(114.559371,38.064785,"南翟营",1);
732     setPoint(114.54838,38.06494,"",1);
733     setPoint(114.539289,38.065026,"常青园",1);
734     setPoint(114.518314,38.064561,"",1);
735     setPoint(114.497959,38.066719,"军械学院",1);
736     setPoint(114.48041,38.070724,"",1);
737     setPoint(114.472054,38.072363,"火车北站",1);
738     setPoint(114.453612,38.066388,"农科院",1);
739     setPoint(114.453803,38.060893,"合作路",1);
740     setPoint(114.453467,38.056613,"西焦",1);
741     setPoint(114.458637,38.048111,"",1);
742     setPoint(114.458396,38.039924,"益友百货",1);
743     setPoint(114.4589,38.034159,"审计厅",1);
744     setPoint(114.457267,38.024399,"碧海云天",1);
745     setPoint(114.466517,38.005553,"东五里",1);
746     setPoint(114.467527,37.999187,"",1);
747     setPoint(114.479055,37.984525,"宫家庄",1);
748     
749     //6号线
750     setPoint(114.642996,37.971908,"东佐",1);
751     setPoint(114.626356,37.984586,"北郗马",1);
752     setPoint(114.626985,38.009324,"东仰陵",1);
753     setPoint(114.626985,38.015267,"",1);
754     setPoint(114.626985,38.02753,"北豆",1);
755     setPoint(114.622890,38.03659,"星辰广场",1);
756     setPoint(114.614805,38.04393,"留村",1);
757     setPoint(114.583421,38.036067,"二十里铺",1);
758     setPoint(114.575094,38.035572,"国际城",1);
759     setPoint(114.553466,38.034817,"",1);
760 
761     
762    
763     
764     function list_1()
765     {
766         dingWei(114.634402,38.088129);
767     }
768     function list_2()
769     {
770         dingWei(114.518381,38.048924);
771     }
772     function list_3()
773     {
774         dingWei(114.539294,38.048844);
775     }
776     function list_4()
777     {
778         dingWei(114.518381,38.048924);
779     }
780     function list_5()
781     {
782         dingWei(114.457267,38.024399);
783     }
784     function list_6()
785     {
786         dingWei(114.626985,38.015267);
787     }
788     function dingWei(x,y)
789     {
790         var new_point = new BMap.Point(x,y);
791         map.panTo(new_point);
792     }
793 </script>

 

 1 @charset "UTF-8";
 2 body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
 3 .listDiv{ width:110px; height: 310px; border: 4px solid #0080ff; position:fixed;z-index:999;right:0;top:15%;background:#f7f7f7;}
 4 .selectDiv{ width:250px; height:200px; border: 4px solid #0080ff; position:fixed;z-index:999;left:0;top:0;background:#f7f7f7;}
 5 #outDiv{ width:250px; border: 4px solid #0080ff; position:fixed;z-index:999;left:0;top:200px;background:#f7f7f7;}
 6 .selectQiDiv{margin:10px 10px  10px  10px ;}
 7 .selectZhongDiv{margin:10px 10px  10px  10px ;}
 8 
 9 .select{background-color: #0080ff;border: none;color: white;padding: 10px 30px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin:15px 15px 15px 15px;}
10 .delete{background-color: #0080ff;border: none;color: white;padding: 10px 30px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin:15px 15px 15px 15px;}
11 .list_1{background-color: #ff0000;border: none;color: white;padding: 10px 30px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin:5px;}
12 .list_2{background-color: #800080;border: none;color: white;padding: 10px 30px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin:5px;}
13 .list_3{background-color: #0000ff;border: none;color: white;padding: 10px 30px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin:5px;}
14 .list_4{background-color: #ff8000;border: none;color: white;padding: 10px 30px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin:5px;}
15 .list_5{background-color: #808000;border: none;color: white;padding: 10px 30px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin:5px;}
16 .list_6{background-color: #00ffff;border: none;color: white;padding: 10px 30px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin:5px;}
17 
18 
19 .select:hover {box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);}
20 .delete:hover {box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);}
21 .list_1:hover {box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);}
22 .list_2:hover {box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);}
23 .list_3:hover {box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);}
24 .list_4:hover {box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);}
25 .list_5:hover {box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);}
26 .list_6:hover {box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);}
package servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import service.TrainService;
/**
 * Servlet implementation class SubwayServlet
 */
@WebServlet("/SubwayServlet")
public class SubwayServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public SubwayServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        request.setCharacterEncoding("UTF-8");
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        response.setHeader("content-type", "text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        String startName = request.getParameter("startName");
        String endName = request.getParameter("endName");
        //System.out.println("SubwayYYYYYYYYY"+startName+endName);
        String text="";
        text=TrainService.trainText(startName,endName);
        
        System.out.println(text);
        out.write(text);
        out.close();
    }

}

其余部分为后台运算,不归我写

我像这样调用就OK了

text=TrainService.trainText(startName,endName);

也正是因为小伙伴写的这个接口只能返回输出信息text,所以涂色功能尚未连接上

 

posted @ 2019-06-22 21:32  CCRNRT  阅读(557)  评论(0编辑  收藏  举报