construct_limited_distance_matrix($data_points_array,$km_per_day);
// TODO : dijkstra algorithm
// we have a distance array now, time to get Dijkstra in
//$my_itinerary = new Itinerary();
//$test = $my_itinerary->dijkstra_matrix($distance_matrix,$km_per_day);
//var_dump ($test[5]);
// $z=0;
// add route array to each element of the data array
// foreach (($test["route_array"][5]) as $gimli ){
//echo ($gimli);
// $output_array["id_array"][$z] = $data_points_array["id_array"][$gimli];
//$output_array["name_array"][$z] = $data_points_array["name_array"][$gimli];
// $output_array["unique_id_array"][$z] = $data_points_array["unique_id_array"][$gimli];
// $output_array["latitude_array"][$z] = $data_points_array["latitude_array"][$gimli];
// $output_array["longitude_array"][$z] = $data_points_array["longitude_array"][$gimli];
// $output_array["coord_accuracy_array"][$z] = $data_points_array["coord_accuracy_array"][$gimli];
// $output_array["begin_date_array"][$z] = $data_points_array["begin_date_array"][$gimli];
// $output_array["end_date_array"][$z] = $data_points_array["end_date_array"][$gimli];
// $z++;
//var_dump($data_points_array["id_array"]);
// }
// var_dump ($output_array);
//foreach ($test as $route) {
//foreach ($test[1]["route_array"] as $road) {
// var_dump ( $test[5]["route_array"][0]);
//$a = $test[5]["route_array"][0];
//echo ($a);
//var_dump ($data_points_array[2]);
//$output_array[1] = $data_points_array[$test[5]["route_array"][1]];
// $output_array[2] = $data_points_array[$test[5]["route_array"][2]];
//var_dump ($output_array);
//echo("
");
//var_dump ( $test[1]["route_array"]);
//echo("
");
//var_dump ( $test[2]["route_array"]);
//echo("
");
//var_dump ( $test[3]["route_array"]);
//echo ($road);
//$output_array[$road] = $data_points_array[$road]
//}
} // function findShortestPath
public function simplifyLine ($points_array) {
// Code adapted from : http://www.fonant.com/demos/douglas_peucker/algorithm
$this->points = array();
$this->data_structure_array = array ( "startnode" => "",
"endnode" => "",
"node_count" => 0,
"distance" => 0,
"route_array" => array()
);
$this->count = 0;
foreach ($points_array ["id_array"] as $id_key2=>$id_value2) {
$this->points [$this->count] =
new GeoPoint($points_array ["latitude_array"][$this->count],$points_array ["longitude_array"][$this->count]);
$this->count++;
} // foreach
$reducer = new PolylineReducer($this->points);
$simple_line = $reducer->SimplerLine(0.001);
// REMOVE BEFORE FLIGHT
$mycount = 0;
foreach ($simple_line as $point) {
$data_dummy_array ["unique_id_array"][$mycount] = $mycount;
$data_dummy_array ["latitude_array"][$mycount] = $point->latitude;
$data_dummy_array ["longitude_array"][$mycount] = $point->longitude;
$mycount++;
}
// $this->data_structure_array
return ($data_dummy_array);
//echo "
\n"; //print_r($points); //print_r($simple_line); //echo "\n"; //} } // function simplifyLine } // class ProcessingUnit ?>