/
index.html
135 lines (113 loc) · 5.36 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>VeriRoute</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, shrink-to-fit=no, initial-scale=1">
<script src="/js/latlongdistance.js"></script>
<script src="/js/datatypes.js"></script>
<script src="/js/calculatescore.js"></script>
<script src="js/jquery.js"></script>
<link href="css/main.css" rel="stylesheet">
<link href="css/sidebar.css" rel="stylesheet">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.css"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.6/d3.js" charset="utf-8"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.js"></script>
<script src="https://www.mapquestapi.com/sdk/leaflet/v2.2/mq-map.js?key=qCHdHcf30c1guM19c286tQVzNtLnUN02"></script>
<script src="https://www.mapquestapi.com/sdk/leaflet/v2.2/mq-routing.js?key=qCHdHcf30c1guM19c286tQVzNtLnUN02"></script>
<script src="js/gplaces.js"></script>
</head>
<body style="background-color:white">
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="#">
VeriRoute
</a>
</li>
<li>
<div style="padding-right: 25px"><label for="locationTextField">Enter From Address</label>
<input id="locationFromTextField" type="text" size="33">
</div>
<div><label for="locationTextField">Enter To Address</label>
<input id="locationToTextField" type="text" size="33">
</div>
</li>
</ul>
</div>
<!-- Map -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div>
<div id="mapview" style="width: 100%; height: 100vh;">
<script type="text/javascript">
var map = L.map('mapview').setView([40.7637581,-73.99181], 12);
//var data = [];
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: ' ',
dragging: 'true'
}).addTo(map);
var dir = MQ.routing.directions();
temp = MQ.routing.routeLayer({
directions: dir,
fitBounds: true,
ribbonOptions: {
draggable: false,
ribbonDisplay: { color: '#5882FA', opacity: 0.7 },
widths: [ 10, 15, 10, 15, 10, 13, 10, 12, 10, 11, 10, 11, 10, 12, 10, 14, 10 ]
},
altRibbonOptions: {
show: true,
ribbonDisplay: { color: '#F78181', opacity: 0.7},
hoverDisplay: { color: 'red', opacity: 0.6 }
}
});
function mquest(lat1,lng1,lat2,lng2){
d3.request('https://www.mapquestapi.com/directions/v2/alternateroutes?key=qCHdHcf30c1guM19c286tQVzNtLnUN02&from='+lat1+','+lng1+'&to='+lat2+','+lng2+'&outFormat=json&ambiguities=ignore&routeType=fastest&maxRoutes=3&timeOverage=25&doReverseGeocode=false&enhancedNarrative=false&avoidTimedConditions=false&unit=M').get(function(data){
var route=JSON.parse(data.response);
function arraytoJSON(l){
var lJSON = [];
for (var i = 0; i< l.length; i+=2){
lJSON.push({lat: l[i], long: l[i+1]});
}
return lJSON;
}
if (typeof(route.route.alternateRoutes) === "undefined");
else
console.log(calculatescore(arraytoJSON(route.route.alternateRoutes[0].route.shape.shapePoints)));
if (typeof(route.route.shape) === "undefined")
alert('No routes found');
else
console.log(calculatescore(arraytoJSON(route.route.shape.shapePoints)));
});
dir.route({
maxRoutes: 5,
timeOverage: 25,
locations: [
{latLng: { lat: lat1, lng: lng1}},
{latLng: { lat: lat2, lng: lng2}}
]
});
map.addLayer(temp);
}
</script>
</div>
</div>
</div>
</div>
</div>
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>
</body>
</html>