-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path地下铁道.html
169 lines (151 loc) · 5.13 KB
/
地下铁道.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<html>
<head>
<meta charset="utf-8">
<title>这是一个课程设计作业</title>
<!-- <script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery
/jquery-1.4.min.js"></script> -->
<script src="stopinfo.js"></script>
<script src="findpath2.js"></script>
<script src="decide_path.js"></script>
<script src="stopoperation.js"></script>
<!-- <meta http-equiv="refresh" content="1"> -->
<style>
body::after{
/* background: url(subway_map.jpg)center center no-repeat; */
background: url(bgpic.jpg)center center no-repeat;
opacity: 0.7; /* 半透明 */
top:0;
left: 0;
right: 0;
bottom:0;
position:absolute;
content:"";
background-size: contain;
z-index:-1;
}
p{
text-indent: 2em;
}
</style>
<script> //画图部分
function clearcan(){
var canvas=document.getElementById("can")
var c=canvas.getContext("2d");
c.clearRect(0,0,canvas.width,canvas.height);
}
function draw(){
var canvas=document.getElementById("can")
var c=canvas.getContext("2d");
c.beginPath();
c.moveTo(368,377);
c.lineTo(624,377);
return c;
}
function xian(x1,y1,x2,y2) {
var canvas = new draw();
canvas.strokeStyle = "yellow";
canvas.lineWidth = 5;
canvas.beginPath();
canvas.moveTo(x1,y1);//设置起点
canvas.lineTo(x2,y2);//画线
/* canvas.moveTo(450, 160);//拿起画笔到新坐标
canvas.lineTo(600, 160);//画线 */
canvas.closePath();
canvas.stroke();
}
function yuan(x,y) {
var canvas = draw();
// canvas.fillStyle = "#2E81CE"; //等同于fillStyle="rgba(46,129,206,1)";
canvas.beginPath();
canvas.arc(x, y, 10, 0, 2 * Math.PI, true);
canvas.closePath();
canvas.fillStyle="yellow";
canvas.fill();
}
function redyuan(x,y) {
var canvas = draw();
// canvas.fillStyle = "#2E81CE"; //等同于fillStyle="rgba(46,129,206,1)";
canvas.beginPath();
canvas.arc(x, y, 10, 0, 2 * Math.PI, true);
canvas.closePath();
canvas.fillStyle="red";
canvas.fill();
}
</script>
<script type="text/javascript"> //查看点坐标用的
function show_coords(event)
{
x=event.clientX
y=event.clientY
alert("X 坐标: " + x + ", Y 坐标: " + y)
}
</script>
<!-- <script>
var wdx=document.body.clientWidth;
var wdy=document.body.clientHeight;
</script> -->
</head>
<body style="padding:0;margin:0"><!--onmousedown="show_coords(event)" onload="xian();" -->
<canvas id="can" width="1490" height="800" ></canvas>
<div style="float:left">
<div style="float:left">
<form>
<p>选择寻路方式:</p>
<select name="ways" style='margin-left:30px' id='select_path'>
<option value="short_dis">最短路径</option>
<option value="least_time" selected="selected">最少换乘</option>
<option value="r1">备选路径1</option>
<option value="r2">备选路径2</option>
</select>
<br>
<p>起点:</p>
<input type="text" value="北土城" id="startstop" style='margin-left:30px'/><br>
<p>终点:</p>
<input type="text" value="和平西桥" id="aimstop" style='margin-left:30px'/><br><br>
<button onclick="decide_path()" type="button" style='margin-left:30px'>确定</button>
<!-- <button type="reset" >重置</button> -->
</form>
<button
onclick="window.location.reload(true);"
style="margin-left:30px">
重置</button>
</div>
<div style="float:right;margin-left:100;margin-bottom:100">
<textarea
style="width:180px; height:300px;"
type="textarea"
id="show" readonly></textarea>
</div>
</div>
<!-- <p id="pathresult"></p> -->
<!-- <script src="stopinfo.js"></script>
<script src="stopoperation.js"></script> -->
<!-- <script>alert("X:"+document.body.clientWidth+"\nY:"+document.body.clientHeight);</script> -->
<from style="margin-left:200">
<p>加减站:
<select name="ways" style='margin-left:30px;width:100px;height:30px' id='add_del_jugg'>
<option value="add_stop" selected="selected">加站</option>
<option value="del_stop">删站</option>
</select>
</p><br>
<p>站名:
<input style='margin-left:30px' id=''/></p>
<p>x坐标:
<input style='margin-left:30px' id=''/> </p>
<p>y坐标:
<input style='margin-left:30px' id=''/> </p>
<p>所在线路:
<input style='margin-left:30px' id=''/> </p>
<p>相邻站1:
<input style='margin-left:30px' id=''/>
距离1:
<input style='margin-left:30px' id=''/> </p>
<p>相邻站2:
<input style='margin-left:30px' id=''/>
距离2:
<input style='margin-left:30px' id=''/> </p>
<button onclick="add_del_stop()" type="button" style='margin-left:300px'>确定</button>
</from>
</body>
</html>