sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject svn commit: r1519025 [8/9] - in /sis/sandbox/gsoc2013/crimgeoprofile: ./ css/ jquery/ jquery/css/ jquery/css/ui-lightness/ jquery/css/ui-lightness/images/ jquery/js/ js/ js/images/
Date Fri, 30 Aug 2013 17:14:23 GMT
Added: sis/sandbox/gsoc2013/crimgeoprofile/js/Icon.Label.Default.js
URL: http://svn.apache.org/viewvc/sis/sandbox/gsoc2013/crimgeoprofile/js/Icon.Label.Default.js?rev=1519025&view=auto
==============================================================================
--- sis/sandbox/gsoc2013/crimgeoprofile/js/Icon.Label.Default.js (added)
+++ sis/sandbox/gsoc2013/crimgeoprofile/js/Icon.Label.Default.js Fri Aug 30 17:14:22 2013
@@ -0,0 +1,29 @@
+L.Icon.Label.Default = L.Icon.Label.extend({
+	options: {
+		//This is the top left position of the label within the wrapper. By default it will display
at the right
+		//middle position of the default icon. x = width of icon + padding
+		//If the icon height is greater than the label height you will need to set the y value.
+		//y = (icon height - label height) / 2
+		labelAnchor: new L.Point(29, 8),
+		
+		//This is the position of the wrapper div. Use this to position icon + label relative to
the Lat/Lng.
+		//By default the point of the default icon is anchor
+		wrapperAnchor: new L.Point(13, 41),
+		
+		//This is now the top left position of the icon within the wrapper.
+		//If the label height is greater than the icon you will need to set the y value.
+		//y = (label height - icon height) / 2
+		iconAnchor: new L.Point(0, 0),
+		
+		//label's text component, if this is null the element will not be created
+		labelText: null,
+		
+		/* From L.Icon.Default */
+		iconUrl: L.Icon.Default.imagePath + '/marker-icon.png',
+		iconSize: new L.Point(25, 41),
+		popupAnchor: new L.Point(0, -33),
+
+		shadowUrl: L.Icon.Default.imagePath + '/marker-shadow.png',
+		shadowSize: new L.Point(41, 41)
+	}
+});
\ No newline at end of file

Added: sis/sandbox/gsoc2013/crimgeoprofile/js/Icon.Label.js
URL: http://svn.apache.org/viewvc/sis/sandbox/gsoc2013/crimgeoprofile/js/Icon.Label.js?rev=1519025&view=auto
==============================================================================
--- sis/sandbox/gsoc2013/crimgeoprofile/js/Icon.Label.js (added)
+++ sis/sandbox/gsoc2013/crimgeoprofile/js/Icon.Label.js Fri Aug 30 17:14:22 2013
@@ -0,0 +1,111 @@
+L.Icon.Label = L.Icon.extend({
+	options: {
+		/*
+		labelAnchor: (Point) (top left position of the label within the wrapper, default is right)
+		wrapperAnchor: (Point) (position of icon and label relative to Lat/Lng)
+		iconAnchor: (Point) (top left position of icon within wrapper)
+		labelText: (String) (label's text component, if this is null the element will not be created)
+		*/
+		/* Icon options:
+		iconUrl: (String) (required)
+		iconSize: (Point) (can be set through CSS)
+		iconAnchor: (Point) (centered by default if size is specified, can be set in CSS with negative
margins)
+		popupAnchor: (Point) (if not specified, popup opens in the anchor point)
+		shadowUrl: (Point) (no shadow by default)
+		shadowSize: (Point)
+		*/
+		labelClassName: ''
+	},
+	
+	initialize: function (options) {
+		L.Util.setOptions(this, options);
+		L.Icon.prototype.initialize.call(this, this.options);
+	},
+
+	setLabelAsHidden: function () {
+		this._labelHidden = true;
+	},
+
+	createIcon: function () {
+		return this._createLabel(L.Icon.prototype.createIcon.call(this));
+	},
+	
+	createShadow: function () {
+		if (!this.options.shadowUrl) {
+			return null;
+		}
+		var shadow = L.Icon.prototype.createShadow.call(this);
+		//need to reposition the shadow
+		if (shadow) {
+			shadow.style.marginLeft = (-this.options.wrapperAnchor.x) + 'px';
+			shadow.style.marginTop = (-this.options.wrapperAnchor.y) + 'px';
+		}
+		return shadow;
+	},
+
+	updateLabel: function (icon, text) {
+		if (icon.nodeName.toUpperCase() === 'DIV') {
+			icon.childNodes[1].innerHTML = text;
+			
+			this.options.labelText = text;
+		}
+	},
+
+	showLabel: function (icon) {
+		if (!this._labelTextIsSet()) {
+			return;
+		}
+
+		icon.childNodes[1].style.display = 'block';
+	},
+
+	hideLabel: function (icon) {
+		if (!this._labelTextIsSet()) {
+			return;
+		}
+
+		icon.childNodes[1].style.display = 'none';
+	},
+
+	_createLabel: function (img) {
+		if (!this._labelTextIsSet()) {
+			return img;
+		}
+
+		var wrapper = document.createElement('div'),
+			label = document.createElement('span');
+
+		// set up wrapper anchor
+		wrapper.style.marginLeft = (-this.options.wrapperAnchor.x) + 'px';
+		wrapper.style.marginTop = (-this.options.wrapperAnchor.y) + 'px';
+
+		wrapper.className = 'leaflet-marker-icon-wrapper leaflet-zoom-animated';
+
+		// set up label
+		label.className = 'leaflet-marker-iconlabel ' + this.options.labelClassName;
+
+		label.innerHTML = this.options.labelText;
+
+		label.style.marginLeft = this.options.labelAnchor.x + 'px';
+		label.style.marginTop = this.options.labelAnchor.y + 'px';
+
+		if (this._labelHidden) {
+			label.style.display = 'none';
+			// Ensure that the pointer cursor shows
+			img.style.cursor = 'pointer';
+		}
+		
+		//reset icons margins (as super makes them -ve)
+		img.style.marginLeft = this.options.iconAnchor.x + 'px';
+		img.style.marginTop = this.options.iconAnchor.y + 'px';
+		
+		wrapper.appendChild(img);
+		wrapper.appendChild(label);
+
+		return wrapper;
+	},
+	
+	_labelTextIsSet: function () {
+		return typeof this.options.labelText !== 'undefined' && this.options.labelText
!== null;
+	}
+});
\ No newline at end of file

Added: sis/sandbox/gsoc2013/crimgeoprofile/js/Marker.Label.js
URL: http://svn.apache.org/viewvc/sis/sandbox/gsoc2013/crimgeoprofile/js/Marker.Label.js?rev=1519025&view=auto
==============================================================================
--- sis/sandbox/gsoc2013/crimgeoprofile/js/Marker.Label.js (added)
+++ sis/sandbox/gsoc2013/crimgeoprofile/js/Marker.Label.js Fri Aug 30 17:14:22 2013
@@ -0,0 +1,48 @@
+L.Marker.Label = L.Marker.extend({
+	updateLabel: function (text) {
+		this.options.icon.updateLabel(this._icon, text);
+	},
+
+	_initIcon: function () {
+		if (!(this.options.icon instanceof L.Icon.Label)) {
+			throw new Error('Icon must be an instance of L.Icon.Label.');
+		}
+
+		// Ensure that the label is hidden to begin with
+		if (this.options.revealing) {
+			this.options.icon.setLabelAsHidden();
+		}
+
+		L.Marker.prototype._initIcon.call(this);
+	},
+
+	_removeIcon: function () {
+		if (this.options.revealing) {
+			L.DomEvent
+				.off(this._icon, 'mouseover', this._showLabel)
+				.off(this._icon, 'mouseout', this._hideLabel);
+		}
+
+		L.Marker.prototype._removeIcon.call(this);
+	},
+
+	_initInteraction: function () {
+		L.Marker.prototype._initInteraction.call(this);
+
+		if (!this.options.revealing) {
+			return;
+		}
+
+		L.DomEvent
+			.on(this._icon, 'mouseover', this._showLabel, this)
+			.on(this._icon, 'mouseout', this._hideLabel, this);
+	},
+
+	_showLabel: function () {
+		this.options.icon.showLabel(this._icon);
+	},
+
+	_hideLabel: function () {
+		this.options.icon.hideLabel(this._icon);
+	}
+});
\ No newline at end of file

Added: sis/sandbox/gsoc2013/crimgeoprofile/js/functions.js
URL: http://svn.apache.org/viewvc/sis/sandbox/gsoc2013/crimgeoprofile/js/functions.js?rev=1519025&view=auto
==============================================================================
--- sis/sandbox/gsoc2013/crimgeoprofile/js/functions.js (added)
+++ sis/sandbox/gsoc2013/crimgeoprofile/js/functions.js Fri Aug 30 17:14:22 2013
@@ -0,0 +1,692 @@
+function init(){	
+	findroutes = 0;
+	first = 0;
+	first_transit = 0;
+	data_obj = new Object();
+	data_obj.home=new Array();
+	data_obj.office=new Array();
+	data_obj.hangout=new Array();	
+	data_obj.locations=new Array();	
+	data_obj.transit = new Array(100);
+	data_obj.homeid = 0;	
+	data_obj.officeid = 0;	
+	data_obj.lunchaid = 0;	
+	data_obj.lunchbid = 0;
+	data_obj.barid = 0;
+	data_obj.mallid = 0;		
+	data_obj.sch_sl = new Array(100);
+	data_obj.sch_el = new Array(100);
+	data_obj.sch_t = new Array(100);
+	data_obj.sch_type = new Array(100);
+	data_obj.sch_len = 0;
+	data_obj.loc_num = 0;
+	data_obj.sch_init = 0;
+	
+	data_obj.routes=[];
+	
+	for(var i=0; i<100; i++){
+		data_obj.transit[i] = new Array(100);
+		for(var j=0; j<100; j++){
+			data_obj.transit[i][j]="";
+		}
+	}
+	data_obj.transit_pts = new Array(100);
+	for(var i=0; i<100; i++){
+		data_obj.transit_pts[i] = new Array(100);
+		for(var j=0; j<100; j++){
+			data_obj.transit_pts[i][j]=null;
+		}
+	}
+	data_obj.num_home=0;
+	data_obj.num_office=0;
+	data_obj.num_hangout=0;
+	data_obj.num_locations=0;
+	data_obj.city_lat = 51.505, 21;
+	data_obj.city_lon = 21;
+	data_obj.zoom=1;
+}
+
+function markHome(e){	
+	var marker=L.marker(e.latlng, { icon: new L.Icon.Label.Default({ labelText: "Home" }) }).addTo(map);

+	//data_obj.home[data_obj.num_home++]=e.latlng;
+	data_obj.homeid=data_obj.num_locations;	
+	data_obj.locations[data_obj.num_locations++]=e.latlng;		
+	map.off('click', markHome);
+	$('#addhome').attr("disabled", "disabled");
+	data_obj.loc_num++;
+}
+
+function markOffice(e){
+	var marker=L.marker(e.latlng, { icon: new L.Icon.Label.Default({ labelText: "Office" })
}).addTo(map);	
+	//data_obj.office[data_obj.num_office++]=e.latlng;	
+	data_obj.officeid=data_obj.num_locations;
+	data_obj.locations[data_obj.num_locations++]=e.latlng;	
+	map.off('click', markOffice);
+	$('#addoffice').attr("disabled", "disabled");
+	data_obj.loc_num++;
+}
+
+function markBar(e){
+	var marker=L.marker(e.latlng, { icon: new L.Icon.Label.Default({ labelText: "Bar" }) }).addTo(map);

+	//data_obj.hangout[data_obj.num_hangout++]=e.latlng;
+	data_obj.barid=data_obj.num_locations;	
+	data_obj.locations[data_obj.num_locations++]=e.latlng;	
+	map.off('click', markBar);
+	$('#addbar').attr("disabled", "disabled");
+	data_obj.loc_num++;
+}
+
+function markLunchA(e){
+	var marker=L.marker(e.latlng, { icon: new L.Icon.Label.Default({ labelText: "Lunch-A" })
}).addTo(map);
+	data_obj.lunchaid=data_obj.num_locations;
+	data_obj.locations[data_obj.num_locations++]=e.latlng;	
+	map.off('click', markLunchA);
+	$('#addluncha').attr("disabled", "disabled");
+	data_obj.loc_num++;
+}
+
+function markLunchB(e){
+	var marker=L.marker(e.latlng, { icon: new L.Icon.Label.Default({ labelText: "Lunch-B" })
}).addTo(map);
+	data_obj.lunchbid=data_obj.num_locations;
+	data_obj.locations[data_obj.num_locations++]=e.latlng;	
+	map.off('click', markLunchB);
+	$('#addlunchb').attr("disabled", "disabled");
+	data_obj.loc_num++;
+}
+
+function markMall(e){
+	var marker=L.marker(e.latlng, { icon: new L.Icon.Label.Default({ labelText: "Mall" }) }).addTo(map);
+	data_obj.mallid=data_obj.num_locations;
+	data_obj.locations[data_obj.num_locations++]=e.latlng;	
+	map.off('click', markMall);
+	$('#addmall').attr("disabled", "disabled");
+	data_obj.loc_num++;
+}
+
+function markTransit(e){	
+	var label = "TP:"+starttp+endtp;
+	var marker=L.marker(e.latlng, { icon: new L.Icon.Label.Default({ labelText: label }) }).addTo(map);

+	data_obj.transit_pts[starttp-1][endtp-1] = e.latlng;	
+	data_obj.transit[starttp-1][endtp-1]+=e.latlng.lat+","+e.latlng.lng+",";
+	data_obj.transit[endtp-1][starttp-1]+=e.latlng.lat+","+e.latlng.lng+",";
+	map.off('click', markTransit);		
+}
+
+function addScript(url) {
+	var script = document.createElement('script');
+	script.type="text/javascript";
+	script.src=url;	
+	document.getElementsByTagName('head') [0].appendChild(script);
+}
+
+function addFunc(code){	
+	var script = document.createElement('script');
+	script.type="text/javascript";
+	script.appendChild(document.createTextNode(code));
+	document.getElementsByTagName('head') [0].appendChild(script);
+}
+
+
+function getLatLon(response){
+	var lat=response[0]["lat"];
+	var lon=response[0]["lon"];	
+	data_obj.city_lat = lat;
+	data_obj.city_lon = lon;
+	data_obj.zoom=14;
+	map.setView([lat, lon], 14);
+}
+           
+function showRoutes(){
+	findroutes = 1;
+	//alert("Finding and Storing routes between all possible pair of locations. You will be
alerted when we are done. Please wait till then.");
+	data_obj.path1 = new Array(data_obj.num_locations);
+	for(var i=0; i < data_obj.num_locations; i++){
+		data_obj.path1[i] = new Array(data_obj.num_locations);
+	}
+	data_obj.path2 = new Array(data_obj.num_locations);
+	for(var i=0; i < data_obj.num_locations; i++){
+		data_obj.path2[i] = new Array(data_obj.num_locations);
+	}
+	data_obj.path3 = new Array(data_obj.num_locations);
+	for(var i=0; i < data_obj.num_locations; i++){
+		data_obj.path3[i] = new Array(data_obj.num_locations);
+	}
+		
+	data_obj.time1 = new Array(data_obj.num_locations);
+	for(var i=0; i < data_obj.num_locations; i++){
+		data_obj.time1[i] = new Array(data_obj.num_locations);
+	}
+	data_obj.time2 = new Array(data_obj.num_locations);
+	for(var i=0; i < data_obj.num_locations; i++){
+		data_obj.time2[i] = new Array(data_obj.num_locations);
+	}
+	data_obj.time3 = new Array(data_obj.num_locations);
+	for(var i=0; i < data_obj.num_locations; i++){
+		data_obj.time3[i] = new Array(data_obj.num_locations);
+	}
+	
+	data_obj.dist1 = new Array(data_obj.num_locations);
+	for(var i=0; i < data_obj.num_locations; i++){
+		data_obj.dist1[i] = new Array(data_obj.num_locations);
+	}
+	data_obj.dist2 = new Array(data_obj.num_locations);
+	for(var i=0; i < data_obj.num_locations; i++){
+		data_obj.dist2[i] = new Array(data_obj.num_locations);
+	}
+	data_obj.dist3 = new Array(data_obj.num_locations);
+	for(var i=0; i < data_obj.num_locations; i++){
+		data_obj.dist3[i] = new Array(data_obj.num_locations);
+	}
+	
+	for(var i=0; i<data_obj.num_locations; i++){
+		for(var j=0 ;j < data_obj.num_locations; j++){
+			if(data_obj.transit[i][j]!=""){
+				data_obj.transit[i][j]='['+data_obj.transit[i][j].substring(0,data_obj.transit[i][j].length-1)+'],';
+			}
+		}
+	}
+	
+	index=0;
+	var idx1=0;
+	var idx2=0;
+	var idx3=0;
+	var idx4=0;	
+	for(var i=0;i<data_obj.num_locations-1;i++){		
+		for(var j=i+1;j<data_obj.num_locations;j++){			
+			//route1
+			var tmp = "function getRoute"+i+j+"1(response){"+
+				"done=0;"+
+				"var point, route, points = [];"+
+				"for (var i=0; i<response.route_geometry.length; i++)"+
+				"{"+
+					"point = new L.LatLng(response.route_geometry[i][0] , response.route_geometry[i][1]);"+
				
+					"points.push(point);"+
+				"}"+				
+				"data_obj.path1["+i+"]["+j+"] = points;"+
+				"data_obj.path1["+j+"]["+i+"] = points;"+
+				"data_obj.time1["+i+"]["+j+"] = response.route_summary['total_distance']*6.8/60;"+
+				"data_obj.time1["+j+"]["+i+"] = response.route_summary['total_distance']*6.8/60;"+
+				"data_obj.dist1["+i+"]["+j+"] = response.route_summary['total_distance'];"+
+				"data_obj.dist1["+j+"]["+i+"] = response.route_summary['total_distance'];"+	
+			/*	"route= new L.Polyline(points, {"+
+					"weight: 3,"+
+					"opacity: 0.5,"+
+					"color: 'blue',"+
+					"smoothFactor: 1"+
+				"}).addTo(map);"+
+				"route.bringToFront();"+*/
+			"}";		
+			addFunc(tmp);			
+			addScript('http://routes.cloudmade.com/81aa79a9504e4430a8a32f491ef96f07/api/0.3/' + data_obj.locations[i].lat
+ ',' + data_obj.locations[i].lng + ',' + data_obj.transit[i][j] + data_obj.locations[j].lat
+ ',' + data_obj.locations[j].lng + '/car/shortest.js?callback=getRoute'+i+j+'1');	
+			
+			//route2
+			tmp = "function getRoute"+i+j+"2(response){"+
+				"done=0;"+
+				"var point, route, points = [];"+
+				"for (var i=0; i<response.route_geometry.length; i++)"+
+				"{"+
+					"point = new L.LatLng(response.route_geometry[i][0] , response.route_geometry[i][1]);"+
+					"points.push(point);"+
+				"}"+				
+				"data_obj.path2["+i+"]["+j+"] = points;"+
+				"data_obj.path2["+j+"]["+i+"] = points;"+
+				"data_obj.time2["+i+"]["+j+"] = response.route_summary['total_distance']*6.8/60;"+
+				"data_obj.time2["+j+"]["+i+"] = response.route_summary['total_distance']*6.8/60;"+
+				"data_obj.dist2["+i+"]["+j+"] = response.route_summary['total_distance'];"+
+				"data_obj.dist2["+j+"]["+i+"] = response.route_summary['total_distance'];"+				
+			/*	"route= new L.Polyline(points, {"+
+					"weight: 3,"+
+					"opacity: 0.5,"+
+					"color: 'blue',"+
+					"smoothFactor: 1"+
+				"}).addTo(map);"+
+				"route.bringToFront();"+	*/		
+			"}";		
+			addFunc(tmp);
+			addScript('http://routes.cloudmade.com/81aa79a9504e4430a8a32f491ef96f07/api/0.3/' + data_obj.locations[i].lat
+ ',' + data_obj.locations[i].lng + ',' + data_obj.transit[i][j] + data_obj.locations[j].lat
+ ',' + data_obj.locations[j].lng + '/foot.js?callback=getRoute'+i+j+'2');
+			
+			//route3
+			if(i == data_obj.num_locations-2 && j == data_obj.num_locations-1){
+				tmp = "function getRoute"+i+j+"3(response){"+
+					"done=0;"+
+					"var point, route, points = [];"+
+					"for (var i=0; i<response.route_geometry.length; i++)"+
+					"{"+
+						"point = new L.LatLng(response.route_geometry[i][0] , response.route_geometry[i][1]);"+
					
+						"points.push(point);"+
+					"}"+
+					
+					"data_obj.path3["+i+"]["+j+"] = points;"+
+					"data_obj.path3["+j+"]["+i+"] = points;"+				
+					"data_obj.time3["+i+"]["+j+"] = response.route_summary['total_distance']*6.8/60;"+
+					"data_obj.time3["+j+"]["+i+"] = response.route_summary['total_distance']*6.8/60;"+
+					"data_obj.dist3["+i+"]["+j+"] = response.route_summary['total_distance'];"+
+					"data_obj.dist3["+j+"]["+i+"] = response.route_summary['total_distance'];"+					
+					/*"route= new L.Polyline(points, {"+
+						"weight: 3,"+
+						"opacity: 0.5,"+
+						"color: 'brown',"+
+						"smoothFactor: 1"+
+					"}).addTo(map);"+
+					"route.bringToFront();"+	*/
+					"$('#loading').dialog('close');"+
+				"}";			
+			}
+			else{
+				tmp = "function getRoute"+i+j+"3(response){"+
+				"done=0;"+
+				"var point, route, points = [];"+
+				"for (var i=0; i<response.route_geometry.length; i++)"+
+				"{"+
+					"point = new L.LatLng(response.route_geometry[i][0] , response.route_geometry[i][1]);"+
				
+					"points.push(point);"+
+				"}"+
+				
+				"data_obj.path3["+i+"]["+j+"] = points;"+
+				"data_obj.path3["+j+"]["+i+"] = points;"+				
+				"data_obj.time3["+i+"]["+j+"] = response.route_summary['total_time'];"+
+				"data_obj.time3["+j+"]["+i+"] = response.route_summary['total_time'];"+
+				"data_obj.dist3["+i+"]["+j+"] = response.route_summary['total_distance'];"+
+				"data_obj.dist3["+j+"]["+i+"] = response.route_summary['total_distance'];"+
+				/*
+				"route= new L.Polyline(points, {"+
+					"weight: 3,"+
+					"opacity: 0.5,"+
+					"color: 'brown',"+
+					"smoothFactor: 1"+
+				"}).addTo(map);"+
+				"route.bringToFront();"+		*/		
+			"}";			
+			}		
+			addFunc(tmp);
+			addScript('http://routes.cloudmade.com/81aa79a9504e4430a8a32f491ef96f07/api/0.3/' + data_obj.locations[i].lat
+ ',' + data_obj.locations[i].lng + ',' + data_obj.transit[i][j] + data_obj.locations[j].lat
+ ',' + data_obj.locations[j].lng + '/bicycle.js?callback=getRoute'+i+j+'3');			
+		//	console.log('http://routes.cloudmade.com/81aa79a9504e4430a8a32f491ef96f07/api/0.3/'
+ data_obj.locations[i].lat + ',' + data_obj.locations[i].lng + ',' + data_obj.transit[i][j]
+ data_obj.locations[j].lat + ',' + data_obj.locations[j].lng + '/bicycle.js?callback=getRoute'+i+j+'3');
+		}
+	}	
+}
+
+
+function clearMap(){ 
+	for(i in map._layers){ 
+		if(map._layers[i]._path != undefined) {
+			try{ 
+				map.removeLayer(map._layers[i]); 
+			} catch(e){
+				//console.log("problem with " + e + map._layers[i]); 
+			} 
+		} 
+	}
+ }
+
+function simulateBeeline(start, end, time, last){	
+	var nump = 0;
+	if(time >= data_obj.time3[start][end])nump=3;
+	else if(time >= data_obj.time2[start][end])nump=2;
+	else if(time >= data_obj.time1[start][end])nump=1;
+	
+	
+	var num = Math.floor((Math.random()*nump)+1);
+
+	if(num == 1){
+		var route= new L.Polyline(data_obj.path1[start][end], {
+			weight: 5,
+			opacity: 0.2,
+			color: 'blue',
+			smoothFactor: 1
+		}).addTo(map);
+		route.bringToFront();
+		data_obj.routes.push(data_obj.path1[start][end]);
+	}
+	else if(num ==2){
+		var route= new L.Polyline(data_obj.path2[start][end], {
+			weight: 5,
+			opacity: 0.2,
+			color: 'blue',
+			smoothFactor: 1
+		}).addTo(map);
+		route.bringToFront();
+		data_obj.routes.push(data_obj.path2[start][end]);
+	}
+	else if(num ==3){
+		var route= new L.Polyline(data_obj.path3[start][end], {
+			weight: 5,
+			opacity: 0.2,
+			color: 'blue',
+			smoothFactor: 1
+		}).addTo(map);
+		route.bringToFront();
+		data_obj.routes.push(data_obj.path3[start][end]);
+	}	
+}
+
+function simulateRandom(start, end, time,last ){
+	var start_lat = data_obj.locations[start].lat;
+	var start_lon = data_obj.locations[start].lng;
+	var end_lat = data_obj.locations[end].lat;
+	var end_lon = data_obj.locations[end].lng;	
+	//console.log("Random("+start_lat+","+start_lon+","+end_lat+","+end_lon+","+time+")");
+	var randomsim = $.ajax({
+		type: "POST",
+		url: "routing.php",		   
+		data : {
+			start_lat : start_lat ,
+			start_lon : start_lon ,
+			end_lat : end_lat ,
+			end_lon : end_lon ,
+			time : time				
+		},
+		beforeSend: function(){
+           if(last==1)$("#loading").dialog('open').html("<p>Simulating...</p>");
+        },
+		success: function(data){	
+			var rand_path = data;			
+			var pt, pts = [];
+			for (var i=0; i<rand_path.route_geometry.length; i++){					
+				pt = new L.LatLng(rand_path.route_geometry[i][0] , rand_path.route_geometry[i][1]);	
				
+				pts.push(pt);
+			}
+			data_obj.routes.push(pts);
+			route= new L.Polyline(pts, {
+				weight: 5,
+				opacity: 0.2,
+				color: 'blue',
+				smoothFactor: 1
+			}).addTo(map);
+			route.bringToFront();
+			if(last==1)$("#loading").dialog('close');
+		}
+	});	
+
+
+}
+
+function simulateHybrid(start , end, time, last){		
+	var start_lat = data_obj.locations[start].lat;
+	var start_lon = data_obj.locations[start].lng;
+	var end_lat = data_obj.locations[end].lat;
+	var end_lon = data_obj.locations[end].lng;		
+	//console.log("Hybrid("+start_lat+","+start_lon+","+end_lat+","+end_lon+","+time+")");
+	$.ajax({
+	  type: "POST",
+	  url: "hybrid.php",		   
+		data : {
+			start_lat : start_lat ,
+			start_lon : start_lon ,
+			end_lat : end_lat ,
+			end_lon : end_lon ,
+			time : time				
+		},
+		beforeSend: function(){
+           if(last==1)$("#loading").dialog('open').html("<p>Simulating...</p>");
+        },
+	  success: function(data){	
+			var obj = data;					
+			var pt, pts = [];
+			for (var i=0; i<obj.length; i++){					
+				pt = new L.LatLng(obj[i][0] , obj[i][1]);						
+				pts.push(pt);
+			}
+			data_obj.routes.push(pts);
+			route= new L.Polyline(pts, {
+				weight: 5,
+				opacity: 0.2,
+				color: 'blue',
+				smoothFactor: 1
+			}).addTo(map);
+			route.bringToFront();
+			if(last==1)$("#loading").dialog('close');
+		}
+	});
+}
+
+// to display saved data
+function display(){
+//	window.location.href = window.location.pathname;
+	//displaying locations	
+	//alert(data_obj.locations[data_obj.homeid]);
+	var marker=L.marker(data_obj.locations[data_obj.homeid], { icon: new L.Icon.Label.Default({
labelText: "Home"}) }).addTo(map);
+	var marker=L.marker(data_obj.locations[data_obj.officeid], { icon: new L.Icon.Label.Default({
labelText: "Office"}) }).addTo(map);
+	var marker=L.marker(data_obj.locations[data_obj.lunchaid], { icon: new L.Icon.Label.Default({
labelText: "Lunch-A"}) }).addTo(map);
+	var marker=L.marker(data_obj.locations[data_obj.lunchbid], { icon: new L.Icon.Label.Default({
labelText: "Lunch-B"}) }).addTo(map);
+	var marker=L.marker(data_obj.locations[data_obj.barid], { icon: new L.Icon.Label.Default({
labelText: "Bar"}) }).addTo(map);
+	var marker=L.marker(data_obj.locations[data_obj.mallid], { icon: new L.Icon.Label.Default({
labelText: "Mall"}) }).addTo(map);		
+	//displaying routes
+	for(var i=0;i<data_obj.routes.length;i++){			
+		route= new L.Polyline(data_obj.routes[i], {
+			weight: 3,
+			opacity: 0.2,
+			color: 'blue',
+			smoothFactor: 1
+		}).addTo(map);	
+		route.bringToFront();
+	}		
+	map.setView([data_obj.city_lat, data_obj.city_lon], data_obj.zoom);
+}
+
+function findHybridTime(time){
+	var new_time = time/60;
+	if(time%60 !=0) new_time += 1;
+	return new_time*60;
+}
+
+function sortTime(){
+	for(var i=0; i<data_obj.num_locations-1; i++){
+		for(var j=i+1;j<data_obj.num_locations;j++){
+			if(data_obj.time1[i][j] > data_obj.time2[i][j]){
+				var tmp1 = data_obj.time1[i][j];
+				data_obj.time1[i][j] = data_obj.time2[i][j];
+				data_obj.time2[i][j] = tmp1;
+				
+				var tmp2 = data_obj.dist1[i][j];
+				data_obj.dist1[i][j] = data_obj.dist2[i][j];
+				data_obj.dist2[i][j] = tmp2;
+				
+				var tmp3 = data_obj.path1[i][j];
+				data_obj.path1[i][j] = data_obj.path2[i][j];
+				data_obj.path2[i][j] = tmp3;
+			}
+			if(data_obj.time2[i][j] > data_obj.time3[i][j]){
+				var tmp1 = data_obj.time2[i][j];
+				data_obj.time2[i][j] = data_obj.time3[i][j];
+				data_obj.time3[i][j] = tmp1;
+				
+				var tmp2 = data_obj.dist2[i][j];
+				data_obj.dist2[i][j] = data_obj.dist3[i][j];
+				data_obj.dist3[i][j] = tmp2;
+				
+				var tmp3 = data_obj.path2[i][j];
+				data_obj.path2[i][j] = data_obj.path3[i][j];
+				data_obj.path3[i][j] = tmp3;
+			}
+			if(data_obj.time1[i][j] > data_obj.time2[i][j]){
+				var tmp1 = data_obj.time1[i][j];
+				data_obj.time1[i][j] = data_obj.time2[i][j];
+				data_obj.time2[i][j] = tmp1;
+				
+				var tmp2 = data_obj.dist1[i][j];
+				data_obj.dist1[i][j] = data_obj.dist2[i][j];
+				data_obj.dist2[i][j] = tmp2;
+				
+				var tmp3 = data_obj.path1[i][j];
+				data_obj.path1[i][j] = data_obj.path2[i][j];
+				data_obj.path2[i][j] = tmp3;
+			}
+		}
+	}
+	//alert(JSON.stringify(data_obj));
+}
+				
+
+function initSchedule(){
+	//Monday		
+	data_obj.sch_sl[0] = data_obj.homeid;
+	data_obj.sch_el[0] = data_obj.officeid;
+	data_obj.sch_t[0] = data_obj.time1[data_obj.sch_sl[0]][data_obj.sch_el[0]];
+	data_obj.sch_type[0] = 1;
+	
+	data_obj.sch_sl[1] = data_obj.officeid;
+	data_obj.sch_el[1] = data_obj.barid;
+	data_obj.sch_t[1] = data_obj.time1[data_obj.sch_sl[1]][data_obj.sch_el[1]] ;
+	data_obj.sch_type[1] = 1;
+	
+	data_obj.sch_sl[2] = data_obj.barid;
+	data_obj.sch_el[2] = data_obj.homeid;
+	data_obj.sch_t[2] = findHybridTime(data_obj.time3[data_obj.sch_sl[2]][data_obj.sch_el[2]]);
+	data_obj.sch_type[2] = 3;
+	
+	//Tuesday
+	data_obj.sch_sl[3] = data_obj.homeid;
+	data_obj.sch_el[3] = data_obj.officeid;
+	data_obj.sch_t[3] = data_obj.time2[data_obj.sch_sl[3]][data_obj.sch_el[3]];
+	data_obj.sch_type[3] = 1;
+	
+	data_obj.sch_sl[4] = data_obj.officeid;
+	data_obj.sch_el[4] = data_obj.lunchaid;
+	data_obj.sch_t[4] = data_obj.time1[data_obj.sch_sl[4]][data_obj.sch_el[4]] ;
+	data_obj.sch_type[4] = 1;
+	
+	data_obj.sch_sl[5] = data_obj.lunchaid;
+	data_obj.sch_el[5] = data_obj.officeid;
+	data_obj.sch_t[5] = data_obj.time1[data_obj.sch_sl[5]][data_obj.sch_el[5]];
+	data_obj.sch_type[5] = 1;
+
+	data_obj.sch_sl[6] = data_obj.officeid;
+	data_obj.sch_el[6] = data_obj.barid;
+	data_obj.sch_t[6] = data_obj.time2[data_obj.sch_sl[6]][data_obj.sch_el[6]];
+	data_obj.sch_type[6] = 1;
+	
+	data_obj.sch_sl[7] = data_obj.barid;
+	data_obj.sch_el[7] = data_obj.homeid;
+	data_obj.sch_t[7] = findHybridTime(data_obj.time3[data_obj.sch_sl[7]][data_obj.sch_el[7]]);
+	data_obj.sch_type[7] = 3;
+	
+	//Wednesday
+	data_obj.sch_sl[8] = data_obj.homeid;
+	data_obj.sch_el[8] = data_obj.officeid;
+	data_obj.sch_t[8] = data_obj.time3[data_obj.sch_sl[8]][data_obj.sch_el[8]];
+	data_obj.sch_type[8] = 1;
+	
+	data_obj.sch_sl[9] = data_obj.officeid;
+	data_obj.sch_el[9] = data_obj.lunchaid;
+	data_obj.sch_t[9] = data_obj.time1[data_obj.sch_sl[9]][data_obj.sch_el[9]] ;
+	data_obj.sch_type[9] = 1;
+	
+	data_obj.sch_sl[10] = data_obj.lunchaid;
+	data_obj.sch_el[10] = data_obj.officeid;
+	data_obj.sch_t[10] = data_obj.time1[data_obj.sch_sl[10]][data_obj.sch_el[10]];
+	data_obj.sch_type[10] = 1;
+
+	data_obj.sch_sl[11] = data_obj.officeid;
+	data_obj.sch_el[11] = data_obj.barid;
+	data_obj.sch_t[11] = data_obj.time3[data_obj.sch_sl[11]][data_obj.sch_el[11]];
+	data_obj.sch_type[11] = 1;
+	
+	data_obj.sch_sl[12] = data_obj.barid;
+	data_obj.sch_el[12] = data_obj.homeid;
+	data_obj.sch_t[12] = findHybridTime(data_obj.time3[data_obj.sch_sl[12]][data_obj.sch_el[12]]);
+	data_obj.sch_type[12] = 3;
+	
+	//Thursday
+	data_obj.sch_sl[13] = data_obj.homeid;
+	data_obj.sch_el[13] = data_obj.officeid;
+	data_obj.sch_t[13] = data_obj.time3[data_obj.sch_sl[13]][data_obj.sch_el[13]];
+	data_obj.sch_type[13] = 1;
+	
+	data_obj.sch_sl[14] = data_obj.officeid;
+	data_obj.sch_el[14] = data_obj.barid;
+	data_obj.sch_t[14] = data_obj.time3[data_obj.sch_sl[14]][data_obj.sch_el[14]];
+	data_obj.sch_type[14] = 1;
+	
+	data_obj.sch_sl[15] = data_obj.barid;
+	data_obj.sch_el[15] = data_obj.homeid;
+	data_obj.sch_t[15] = findHybridTime(data_obj.time3[data_obj.sch_sl[15]][data_obj.sch_el[15]]);
+	data_obj.sch_type[15] = 3;
+	
+	//Friday
+	data_obj.sch_sl[16] = data_obj.homeid;
+	data_obj.sch_el[16] = data_obj.officeid;
+	data_obj.sch_t[16] = data_obj.time3[data_obj.sch_sl[16]][data_obj.sch_el[16]];
+	data_obj.sch_type[16] = 1;
+	
+	data_obj.sch_sl[17] = data_obj.officeid;
+	data_obj.sch_el[17] = data_obj.lunchbid;
+	data_obj.sch_t[17] = data_obj.time1[data_obj.sch_sl[17]][data_obj.sch_el[17]] ;
+	data_obj.sch_type[17] = 1;
+	
+	data_obj.sch_sl[18] = data_obj.lunchbid;
+	data_obj.sch_el[18] = data_obj.officeid;
+	data_obj.sch_t[18] = data_obj.time1[data_obj.sch_sl[18]][data_obj.sch_el[18]];
+	data_obj.sch_type[18] = 1;
+
+	data_obj.sch_sl[19] = data_obj.officeid;
+	data_obj.sch_el[19] = data_obj.barid;
+	data_obj.sch_t[19] = data_obj.time3[data_obj.sch_sl[19]][data_obj.sch_el[19]];
+	data_obj.sch_type[19] = 1;
+	
+	data_obj.sch_sl[20] = data_obj.barid;
+	data_obj.sch_el[20] = data_obj.homeid;
+	data_obj.sch_t[20] = findHybridTime(data_obj.time3[data_obj.sch_sl[20]][data_obj.sch_el[20]]);
+	data_obj.sch_type[20] = 3;
+	
+	//Saturday
+	data_obj.sch_sl[21] = data_obj.homeid;
+	data_obj.sch_el[21] = data_obj.mallid;
+	data_obj.sch_t[21] = findHybridTime(data_obj.time3[data_obj.sch_sl[21]][data_obj.sch_el[21]]);
+	data_obj.sch_type[21] = 3;
+	
+	data_obj.sch_sl[22] = data_obj.mallid;
+	data_obj.sch_el[22] = data_obj.homeid;
+	data_obj.sch_t[22] = findHybridTime(data_obj.time3[data_obj.sch_sl[22]][data_obj.sch_el[22]]);
+	data_obj.sch_type[22] = 3;
+	
+	data_obj.sch_sl[23] = data_obj.homeid;
+	data_obj.sch_el[23] = data_obj.barid;
+	data_obj.sch_t[23] = 180;
+	data_obj.sch_type[23] = 2;
+	
+	data_obj.sch_sl[24] = data_obj.barid;
+	data_obj.sch_el[24] = data_obj.homeid;
+	data_obj.sch_t[24] = findHybridTime(data_obj.time3[data_obj.sch_sl[24]][data_obj.sch_el[24]]);
+	data_obj.sch_type[24] = 3;
+	
+	//Sunday
+	data_obj.sch_sl[25] = data_obj.homeid;
+	data_obj.sch_el[25] = data_obj.mallid;
+	data_obj.sch_t[25] = 90;
+	data_obj.sch_type[25] = 2;
+	
+	data_obj.sch_sl[26] = data_obj.mallid;
+	data_obj.sch_el[26] = data_obj.barid;
+	data_obj.sch_t[26] = 240;
+	data_obj.sch_type[26] = 2;
+	
+	data_obj.sch_sl[27] = data_obj.barid;
+	data_obj.sch_el[27] = data_obj.homeid;
+	data_obj.sch_t[27] = findHybridTime(data_obj.time3[data_obj.sch_sl[27]][data_obj.sch_el[27]]);
+	data_obj.sch_type[27] = 3;
+	
+	data_obj.sch_len = 28;
+}
+
+function simulateRoutineActivity(){
+	for(var i=0; i<data_obj.sch_len; i++){
+		var start = data_obj.sch_sl[i];
+		var end = data_obj.sch_el[i];
+		var time = data_obj.sch_t[i];
+		var type = data_obj.sch_type[i];
+		if(i == data_obj.sch_len-1){
+			if(type == 1)simulateBeeline(start, end, time,1);
+			else if(type == 2)simulateRandom(start, end, time,1);
+			else if(type == 3)simulateHybrid(start, end, time,1);
+		}else{
+			if(type == 1)simulateBeeline(start, end, time,0 );
+			else if(type == 2)simulateRandom(start, end, time, 0);
+			else if(type == 3)simulateHybrid(start, end, time, 0);
+		}
+	}
+}
+
+
+
+
+

Added: sis/sandbox/gsoc2013/crimgeoprofile/js/images/marker-icon.png
URL: http://svn.apache.org/viewvc/sis/sandbox/gsoc2013/crimgeoprofile/js/images/marker-icon.png?rev=1519025&view=auto
==============================================================================
Binary file - no diff available.

Propchange: sis/sandbox/gsoc2013/crimgeoprofile/js/images/marker-icon.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: sis/sandbox/gsoc2013/crimgeoprofile/js/images/marker-shadow.png
URL: http://svn.apache.org/viewvc/sis/sandbox/gsoc2013/crimgeoprofile/js/images/marker-shadow.png?rev=1519025&view=auto
==============================================================================
Binary file - no diff available.

Propchange: sis/sandbox/gsoc2013/crimgeoprofile/js/images/marker-shadow.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: sis/sandbox/gsoc2013/crimgeoprofile/js/images/marker_hole.png
URL: http://svn.apache.org/viewvc/sis/sandbox/gsoc2013/crimgeoprofile/js/images/marker_hole.png?rev=1519025&view=auto
==============================================================================
Binary file - no diff available.

Propchange: sis/sandbox/gsoc2013/crimgeoprofile/js/images/marker_hole.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: sis/sandbox/gsoc2013/crimgeoprofile/js/index.js
URL: http://svn.apache.org/viewvc/sis/sandbox/gsoc2013/crimgeoprofile/js/index.js?rev=1519025&view=auto
==============================================================================
--- sis/sandbox/gsoc2013/crimgeoprofile/js/index.js (added)
+++ sis/sandbox/gsoc2013/crimgeoprofile/js/index.js Fri Aug 30 17:14:22 2013
@@ -0,0 +1,319 @@
+var data_obj;
+var map; 
+var findroutes, first, first_transit;
+var start_tp, end_tp;
+
+$(document).ready(function () {
+	map = L.map('map').setView([51.505, 21], 1);
+	L.tileLayer('http://{s}.tile.cloudmade.com/e7b61e61295a44a5b319ca0bd3150890/997/256/{z}/{x}/{y}.png',
{
+	attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a>
contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>,
Imagery © <a href="http://cloudmade.com">CloudMade</a>',
+	maxZoom: 18
+	}).addTo(map);
+	init();
+	$('#toolbar1').buttonset();
+	$('#toolbar2').buttonset();
+	$('#toolbar3').buttonset();
+	$('#showmap').button();
+    //map = L.map('map').setView([51.505, 21], 1);
+	L.tileLayer('http://{s}.tile.cloudmade.com/e7b61e61295a44a5b319ca0bd3150890/997/256/{z}/{x}/{y}.png',
{
+	attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a>
contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>,
Imagery © <a href="http://cloudmade.com">CloudMade</a>',
+	maxZoom: 18
+	}).addTo(map);
+	$('#addhome').click(function(){
+		map.on('click', markHome);
+	});	
+	$('#addoffice').click(function(){
+		map.on('click', markOffice);
+	});	
+	$('#addbar').click(function(){
+		map.on('click', markBar);
+	});	
+	$('#addluncha').click(function(){
+		map.on('click', markLunchA);
+	});	
+	$('#addlunchb').click(function(){
+		map.on('click', markLunchB);
+	});	
+	$('#addmall').click(function(){
+		map.on('click', markMall);
+	});	
+	$('#findroutes').click(function(){
+		if(data_obj.loc_num!=6){
+			alert("You must mark all locations: Home, office, bar, Lunch-A, Lunch-B, Mall!!! Try again
after marking them");
+		}
+		else{	
+			data_obj.sch_init = 1;
+			$("#loading").dialog('open').html("<p>Finding Beeline Route Times between all pair
of locations marked and initializing schedule. Please Wait... You can proceed to simulate
Routine Activity once this dialog closes</p>");
+			showRoutes();
+		}
+	});	
+/*	$('#transit').click(function(){		
+		map.off('click', markTransit);
+		if(tdata!=""){
+			tdata=tdata.substring(0,tdata.length-1);		
+			tdata="["+tdata+"],";
+			transit_arr[starttp][endtp]=tdata;
+		}		
+		tdata="";
+		startp=0;
+		endtp=0;
+		$("#dialog" ).dialog( "open" );			
+	});*/
+	$('#simulate').click(function(){	
+		if(findroutes==0){
+			alert("You need to click on 'Find Routes' first");
+		}
+		else{			
+			if(first==0){				
+			var options1= "";
+			for(var i=0; i < data_obj.num_locations; i++){
+				options1+="<option value='"+i+"'>"+(i+1)+"</option>\n";
+			}
+			
+			$("#start").append(options1);
+			$("#end").append(options1);		
+			var options2= "";
+			for(var i=1; i<10000; i++){
+				options2+="<option value='"+i+"'>"+i+"</option>\n";
+			}
+			options2+="<option selected='selected' value='10000'>10000</option>\n";
+			//$("#times").append(options2);
+			first=1;
+		}
+			$("#dialog2" ).dialog( "open" );
+			
+		}
+				
+	});
+	$('#showmap').click(function(){
+		var city=$('#city').val();	
+		addScript('http://open.mapquestapi.com/nominatim/v1/search.php?format=json&json_callback=getLatLon&q='+city);
	
+	});
+	
+	$('#showroutes').click(function(){		
+		$("#loading").dialog('open').html("<p>Finding Beeline Route Time between all poosible
pair of locations and initializing schedule. Please Wait... You can proceed to simulate Routine
Activity once this dialog closes</p>");
+		showRoutes();
+	});	
+	$('#showdata').click(function(){
+		console.log(JSON.stringify(data_obj, null, 4));	
+	});
+	
+	$('#save').click(function(){
+		
+	    var filename = prompt("Save As: ");
+		$.ajax({
+		  type: "POST",
+		  url: "save.php",
+		  dataType : 'json', 
+			data : {
+				json : JSON.stringify(data_obj, null, 4) ,
+				fname : filename
+			},
+		  success: function(){				
+				alert("Saved");
+			}
+		});
+	});
+	
+	$('#load').click(function(){
+		var filename = prompt("Filename: ");
+		$.ajax({
+		  url: filename,
+		  dataType: 'json',		  
+		  success: function (data){			
+			data_obj = data;
+			display();
+		  }
+		});
+		
+	});
+		
+	$('#clear').click(function(){
+		window.location.href = window.location.pathname;
+	});
+	
+	$('#marktransit').click(function(){
+		if(first_transit==0){		
+			var options1= "";
+			for(var i=0; i < data_obj.num_locations; i++){
+				options1+="<option value='"+i+"'>"+(i+1)+"</option>\n";
+			}			
+			$("#transit_start").append(options1);
+			$("#transit_end").append(options1);			
+			first_transit=1;
+		}
+		$("#dialog" ).dialog( "open" );	
+	});	
+	
+	$('#random').click(function(){
+		var options1= "";
+		for(var i=0; i < data_obj.num_locations; i++){
+				options1+="<option value='"+i+"'>"+(i+1)+"</option>\n";
+			}			
+			$("#random_start").append(options1);
+			$("#random_end").append(options1);				
+			$("#dialog3" ).dialog( "open" );
+	});
+	
+	$('#hybrid').click(function(){
+		var options1= "";
+		for(var i=0; i < data_obj.num_locations; i++){
+				options1+="<option value='"+i+"'>"+(i+1)+"</option>\n";
+			}			
+			$("#hybrid_start").append(options1);
+			$("#hybrid_end").append(options1);				
+			$("#dialog4" ).dialog( "open" );
+	});
+	
+	$('#routine').click(function(){
+		if(data_obj.sch_init == 0){
+			alert("You must initialize schedule first. Try again after clicking on 'Initialize Schedule'");
+		}
+		else{
+			sortTime();
+			initSchedule();
+			simulateRoutineActivity();
+		}
+	});
+	
+	//dialogs
+	
+	$( "#dialog" ).dialog({	
+	  resizable: true,
+	  height:300,
+	  width :500,
+	  modal: true,
+	  buttons: {
+		Ok: function() {				  
+		  $( this ).dialog( "close" );	
+		  starttp = parseInt($("#transit_start").val(),10)+1;				
+		  endtp = parseInt($("#transit_end").val(),10)+1;
+		  map.on('click', markTransit);		  
+		}
+	  },
+	  autoOpen: false,	
+	});
+	
+	$( "#dialog2" ).dialog({	
+	  resizable: true,
+	  height:300,
+	  width :500,
+	  modal: true,
+	  buttons: {
+		Ok: function() {				  
+		  $( this ).dialog( "close" );	
+		  var start = $("#start").val();
+		  var end = $("#end").val();
+		  var times = $("#times").val();
+		  simulateBeeline($("#start").val(), $("#end").val());
+		}
+	  },
+	  autoOpen: false,	
+	});
+	
+	$( "#dialog3" ).dialog({	
+	  resizable: true,
+	  height:300,
+	  width :500,
+	  modal: true,
+	  buttons: {
+		Ok: function() {				  
+		  $( this ).dialog( "close" );	
+		  var start_rand = Number($("#random_start").val());
+		  var end_rand = Number($("#random_end").val());
+		 
+		
+		  var start_lat = data_obj.locations[start_rand].lat;
+		  var start_lon = data_obj.locations[start_rand].lng;
+		  var end_lat = data_obj.locations[end_rand].lat;
+		  var end_lon = data_obj.locations[end_rand].lng;
+		  var time = $("#time").val();	
+		  //console.log("("+start_lat+","+start_lon+","+end_lat+","+end_lon+","+time+")");
+		  var randomsim = $.ajax({
+		  type: "POST",
+		  url: "routing.php",		   
+			data : {
+				start_lat : start_lat ,
+				start_lon : start_lon ,
+				end_lat : end_lat ,
+				end_lon : end_lon ,
+				time : time				
+			},
+		  success: function(data){	
+				var rand_path = data;
+				//alert(rand_path);
+				var pt, pts = [];
+				for (var i=0; i<rand_path.route_geometry.length; i++){					
+					pt = new L.LatLng(rand_path.route_geometry[i][0] , rand_path.route_geometry[i][1]);
					
+					pts.push(pt);
+				}
+				route= new L.Polyline(pts, {
+					weight: 3,
+					opacity: 0.5,
+					color: 'blue',
+					smoothFactor: 1
+				}).addTo(map);
+				route.bringToFront();
+			}
+		});		  
+		}
+	  },
+	  autoOpen: false,	
+	});
+	
+	$( "#dialog4" ).dialog({	
+	  resizable: true,
+	  height:300,
+	  width :500,
+	  modal: true,
+	  buttons: {
+		Ok: function() {				  
+		  $( this ).dialog( "close" );	
+		  var start_rand = Number($("#hybrid_start").val());
+		  var end_rand = Number($("#hybrid_end").val());		
+		  var start_lat = data_obj.locations[start_rand].lat;
+		  var start_lon = data_obj.locations[start_rand].lng;
+		  var end_lat = data_obj.locations[end_rand].lat;
+		  var end_lon = data_obj.locations[end_rand].lng;
+		  var time = $("#hybrid_time").val();	
+		  //console.log("Hybrid("+start_lat+","+start_lon+","+end_lat+","+end_lon+","+time+")");
+		  $.ajax({
+			  type: "POST",
+			  url: "hybrid.php",		   
+				data : {
+					start_lat : start_lat ,
+					start_lon : start_lon ,
+					end_lat : end_lat ,
+					end_lon : end_lon ,
+					time : time				
+				},
+			  success: function(data){	
+					var obj = data;					
+					var pt, pts = [];
+					for (var i=0; i<obj.length; i++){					
+						pt = new L.LatLng(obj[i][0] , obj[i][1]);						
+						pts.push(pt);
+					}
+					route= new L.Polyline(pts, {
+						weight: 3,
+						opacity: 0.5,
+						color: 'green',
+						smoothFactor: 1
+					}).addTo(map);
+					route.bringToFront();
+				}
+		});
+		}
+	  },
+	  autoOpen: false,	
+	});
+	$("#loading").dialog({
+		modal: true,
+		hide: 'slide',
+		show: 'slide',
+		autoOpen: false,
+		closeOnEscape: false,
+		open: function(event, ui) { $(".ui-dialog-titlebar-close", ui.dialog || ui).hide(); }
+	});
+	
+});
\ No newline at end of file



Mime
View raw message