|
From: Danny B. <dan...@us...> - 2009-03-29 13:28:19
|
Update of /cvsroot/roadmap/roadmap/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10034 Modified Files: roadmap_dbread.c roadmap_line.c Log Message: Remove dead code. Add the debug code that created the map sizes just published on the list. Index: roadmap_dbread.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_dbread.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** roadmap_dbread.c 28 Mar 2009 15:58:05 -0000 1.19 --- roadmap_dbread.c 29 Mar 2009 13:28:14 -0000 1.20 *************** *** 606,609 **** --- 606,611 ---- return 0; } + roadmap_log (ROADMAP_DEBUG, "roadmap_db_get_size(%s) : %d", + section->head->name, section->head->size); return (unsigned) (section->head->size); } Index: roadmap_line.c =================================================================== RCS file: /cvsroot/roadmap/roadmap/src/roadmap_line.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** roadmap_line.c 29 Mar 2009 12:08:57 -0000 1.17 --- roadmap_line.c 29 Mar 2009 13:28:14 -0000 1.18 *************** *** 197,205 **** if (by_point1_table && by_point2_table) { - roadmap_log(ROADMAP_DEBUG, "***** This map has line by point *****"); context->LineByPoint1 = (RoadMapLineByPoint1 *) roadmap_db_get_data (by_point1_table); context->LineByPoint1Count = roadmap_db_get_count (by_point1_table); - roadmap_log(ROADMAP_DEBUG, "***** This map has line by point1 (%d) *****", - context->LineByPoint1Count); if (roadmap_db_get_size (by_point1_table) != --- 197,202 ---- *************** *** 211,216 **** context->LineByPoint2 = (RoadMapLineByPoint2 *) roadmap_db_get_data (by_point2_table); context->LineByPoint2Count = roadmap_db_get_count (by_point2_table); - roadmap_log(ROADMAP_DEBUG, "***** This map has line by point2 (%d) *****", - context->LineByPoint2Count); if (roadmap_db_get_size (by_point2_table) != --- 208,211 ---- *************** *** 219,222 **** --- 214,245 ---- goto roadmap_line_map_abort; } + + #if 0 + /* Get sizes */ + { + int i, j, counters[20], lost; + int *p, *q; + + for (j=0; j<20; j++) counters[j] = 0; + lost = 0; + for (i=0; i<context->LineByPoint1Count; i++) { + q = (int *)context->LineByPoint1; + q += i; + + p = (int *)context->LineByPoint2; + p += *q; + + for (j=0; p[j]; j++) + ; + if (j < 20) + counters[j]++; + else + lost++; + } + for (j=0; j<20; j++) + roadmap_log(ROADMAP_DEBUG, "stats(%d) -> %d", j, counters[j]); + roadmap_log(ROADMAP_DEBUG, "lost stats(>= 20) -> %d", lost); + } + #endif } else { context->LineByPoint1 = 0; *************** *** 448,501 **** /** - * @brief OLD, TO BE REMOVED EXCEPT FOR BACKWARDS COMPATIBILITY - * determine the layer that some line is in - * note: rewritten completely, I guess Ehud's data model is different from trunk - * @param line_id the line whose layer we want to query - * @return the layer - */ - int roadmap_line_get_layer_old (int line_id) - { - int *index; - int first, last, layer, i; - int square; - RoadMapPosition pos; - int last_road_layer; - - /* - * This is hacked for now, we can't call roadmap_layer_() functions from here - * because this would pull roadmap_canvas_() functions into executables that - * aren't linked with that (e.g. roadgps). - */ - #define roadmap_layer_road_last() 11 - #warning Hack for roadmap_layer_road_last - - last_road_layer = roadmap_layer_road_last(); - - if (RoadMapLineActive == NULL) - return 0; /* No line. */ - - roadmap_point_position(RoadMapLineActive->Line[line_id].from, &pos); - square = roadmap_square_search (&pos); - - square = roadmap_square_index(square); - if (square < 0) { - return 0; /* This square is empty. */ - } - - index = RoadMapLineActive->LineByLayer1 + RoadMapLineActive->LineBySquare1[square].first; - - for (layer = 1; layer < last_road_layer; layer++) { - first = index[layer-1]; - last = index[layer]-1; - - for (i=first; i<last; i++) - if (i == line_id) { - return layer; - } - } - return 0; - } - - /** * @brief determine the layer that some line is in * @param line_id the line whose layer we want to query --- 471,474 ---- *************** *** 517,531 **** } ! return roadmap_line_get_layer_old(line); } - #if 0 - /* debug */ - int ol = roadmap_line_get_layer_old(line), - nl = RoadMapLineActive->Line2[line].layer; - if (ol != nl) - roadmap_log (ROADMAP_WARNING, "roadmap_line_get_layer(%d) old %d new %d", - line, ol, nl); - #endif return RoadMapLineActive->Line2[line].layer; } --- 490,496 ---- } ! return 0; } return RoadMapLineActive->Line2[line].layer; } *************** *** 548,552 **** } - #if defined(HAVE_NAVIGATE_PLUGIN) /** * @brief look up the point that a line is coming "from" --- 513,516 ---- *************** *** 577,581 **** return RoadMapLineActive->Line[line].to; } - #endif /** --- 541,544 ---- |