//build array with end points of raw links so we can build node to node links $primitives = pbuild_primitives($raw_segs, $prim_path); break; case 'links': //build ACTUAL node to node link reocrds $data = file_get_contents($near_path); //, FILE_BINARY); $stopsegs = clb_blob_dec($data); $data = file_get_contents($prim_path); //, FILE_BINARY); $primitives = clb_blob_dec($data); $query = 'SELECT ' . RF_ROUTES_KEY . ' FROM ' . RF_ROUTES_FROM . ' WHERE ' . $route_where; $sel = $wpdb->get_results($query, ARRAY_A); $rnums = clb_column($sel, RF_ROUTES_KEY); //creates node to node links from the primitive ones pbuild_daisychain($rnums, $primitives, $stopsegs); break; case 'stops': //build array of rnum/pnum stops so we can look up which stops are on which routes $query = 'SELECT ' . RF_ROUTES_KEY . ' FROM ' . RF_ROUTES_FROM . ' WHERE ' . $route_where; $sel = $wpdb->get_results($query, ARRAY_A); $rnums = clb_column($sel, RF_ROUTES_KEY); $stops_xref = pbuild_stops_xref($rnums, $stops_path); break; case 'p2p': //build array of node to node links that will be used when finding shortest paths $data = file_get_contents($stops_path); //, FILE_BINARY); $stops_xref = clb_blob_dec($data); //the p2p_links list is built based on a selection of routes and links only included if they are on a route $p2p_links = pbuild_p2p_links($node_types, $stops_xref, $p2p_path);
} break; case 'links': //build ACTUAL node to node link reocrds if (IS_CLI) { //arrays connecting nodes to raw segs $data = file_get_contents($map_path, FILE_BINARY); $stopsegs = clb_blob_dec($data); //array listing end points of raw segs $data = file_get_contents($links_path, FILE_BINARY); $links = clb_blob_dec($data); $sel = do_query('SELECT rnum FROM routes WHERE ' . $route_where, __FILE__, __LINE__, 'rnum'); //$sel = do_query('SELECT rnum FROM routes WHERE rnum = '.clb_escape('TUBDIS_WIM'), __FILE__, __LINE__,'rnum'); $rnums = array_keys($sel); //$rnums = array('test'); pbuild_daisychain($rnums, $links, $stopsegs); } else { qpre($mode . ' mode in the CLI generates the node to node link segments'); } break; case 'p2p': //build array of node to node links that will be used when finding shortest paths if (IS_CLI) { //array listing rnum/pnum intersections $data = file_get_contents($stops_path, FILE_BINARY); $stops_xref = clb_blob_dec($data); //the rp_stops list is built based on a selection of routes and links only included if they are on a route $map = pbuild_p2p_links($node_types, $stops_xref, $p2p_path); } else { $path = $p2p_path; }