Example #1
0
    $arr = array();
    $arr = split(":", $checkString);
    //print_r($arr);
    if ($arr[4] < 0.7) {
        $strRoute = '';
        $routeDetails = htmlentities($startStop) . ":" . $arr[0] . ":" . $arr[1] . ":" . htmlentities($endStop) . ":" . $arr[2] . ":" . $arr[3] . ":" . $arr[4];
        //$st='sdsd';
        $strRoute = '<Routes>';
        $strRoute = $strRoute . '<Route>';
        $strRoute = $strRoute . '<IsDirectRoute>N</IsDirectRoute>';
        $strRoute = $strRoute . '<ErrorCode>5</ErrorCode>';
        $strRoute = $strRoute . '<RouteDetails>' . $routeDetails . '</RouteDetails>';
        $strRoute = $strRoute . '</Route>';
        $strRoute = $strRoute . '</Routes>';
        echo $strRoute;
        //echo "The distance is walkable";
    } else {
        $startBuses = split(",", getBusesForStop($startStop));
        $endBuses = split(",", getBusesForStop($endStop));
        //print_r($startBuses);
        //print_r($endBuses);
        // for now pick the first entry as the bus number but we need to do some optimization on choosing the buses based on their frequency, the stop number etc
        $arrCommonBuses = getCommonBuses($startBuses, $endBuses, $showOnlyIndirectRoutes);
        // print_r($arrCommonBuses);
        echo getJunctionsForIndirectBuses($arrCommonBuses, $startStop, $endStop, $startDistance, $endDistance);
    }
    //echo "<sample>hhhh</sample>";
}
?>

                 //return;
             } else {
                 //echo "<H3>starting address details: StartStop->".$startStop."Lat->".$startLatitude."Long->".$startLongitude."Distance Offset->".$startDistance."</h3><br/>";
                 //echo "<h3>destination address details: EndStop->".$endStop."Lat->".$endLatitude."Long->".$endLongitude."Distance Offset->".$endDistance."</h3><br/>";
                 echo "<b>starting address details: StartStop->" . $startStop . " Distance Offset->" . $startDistance . "</b><br/>";
                 echo "<b>destination address details: EndStop->" . $endStop . " Distance Offset->" . $endDistance . "</b><br/>";
                 $log->LogDebug("StopFoundResult: Address is resolved successfully");
                 $log->LogDebug("StopFoundResult: For Source " . $_GET['txtSourceAddress'] . " the stop is resolved to " . $startStop . " with offset of " . $startDistance);
                 $log->LogDebug("StopFoundResult: For Destination " . $_GET['txtDestinationAddress'] . " the stop is resolved to " . $endStop . " with offset of " . $endDistance);
                 // find out the buses that pass through these stops
                 $startBuses = split(",", getBusesForStop($startStop));
                 $endBuses = split(",", getBusesForStop($endStop));
                 //print_r($startBuses);
                 //print_r($endBuses);
                 // for now pick the first entry as the bus number but we need to do some optimization on choosing the buses based on their frequency, the stop number etc
                 $arrCommonBuses = getCommonBuses($startBuses, $endBuses);
                 // now need to filter them based on the junctions. In case the same bus has been found then there is no jusntion
                 // print_r($arrCommonBuses);
                 getJunctionsForIndirectBuses($arrCommonBuses, $startStop, $endStop, $startDistance, $endDistance);
                 // also calculate the distcnae of the orute
                 /*
                 	list($firstBus,$secondBus)=split(":",getCommonBuses($startBuses,$endBuses));
                 	echo $firstBus.",".$secondBus."<br/>";
                 	
                 	// find the routes of the bus
                 	echo getIntermediateStopsAndDistance(getRouteName($firstBus),getRouteName($secondBus));
                 */
             }
         }
     }
 }