function continuePath($path, $destination, $lineName) { $debug = true; outputDebug("algorithm.continuePath()", $debug); $currentStation = $path->getCurrentStation(); $currentLine = $currentStation->getLine($lineName); $connections = $currentLine->getConnections(); if ($debug) { echo "currentStation = " . $currentStation->getName() . " (" . $currentStation->getID() . ")<br/>\n"; echo "currentLine = " . $currentLine->name . "<br/>\n"; echo "continuePath() :: found " . count($connections) . " connections.<br/>\n"; } $newPaths = array(); foreach ($connections as $connection) { if ($connection->id == $path->getLastStation()->getID()) { continue; } // create a new segment from the connection outputDebug("connection->id = " . $connection->id, $debug); $nextStation = retrieveStation($connection->id); $visited = isVisited($nextStation, $path->visited); if ($visited) { if (count($connections) == 1) { // end of the line. no match. outputDebug("end of line.", $debug); $newPaths[] = new MetaPath("EOL", $path); return $newPaths; } else { // we only care to go in the forward direction outputDebug("continuePath() :: already visited.", $debug); continue; } } $lines = $currentStation->getOverlapLines($nextStation); $newPath = new Path($path, $nextStation, $currentLine, $connection); $pathDestination = $path->getDestination(); if ($destination instanceof Station2 && $nextStation->getID() == $destination->getID()) { outputDebug("found match, creating completed path", $debug); $newPaths[] = new MetaPath("match", $newPath); continue; } if ($pathDestination instanceof Station2 && $nextStation->getID() == $pathDestination->getID()) { outputDebug("found path destination, creating completed path", $debug); $newPaths[] = new MetaPath("found", $newPath); continue; } outputDebug("adding path to list = " . $newPath->toString(), $debug); $newPaths[] = new MetaPath("continue", $newPath); } outputDebug("algorithm.continuePath() : DONE", $debug); return $newPaths; }
if ($type == "s2s") { // S2S // get starting point //$start_marker = getMarker($sid); // get ending point //$end_marker = getMarker($did); // log if ($logging) { logS2SQuery($sid, $did); } // testing new function echo "***testing new algorithm<br/>\n"; //$start_station = retrieveStation($start_marker->id); //$end_station = retrieveStation($end_marker->id); $start_station = retrieveStation($sid); $end_station = retrieveStation($did); $pathArray = algorithm($start_station, $end_station); $path = $pathArray[0]; echo "*** end testing new algorithm<br/>\n"; // find the path //$path = findS2SPath($start_marker, $end_marker); } else { if ($type == "location") { // location if ($sa != "") { $loc = $sa; } else { $loc = $da; } // log if ($logging) {