static int editor_street_get_distance_with_shape (const RoadMapPosition *position, int line, int square, int fips, RoadMapNeighbour *neighbours, int max) { RoadMapPosition from; RoadMapPosition to; int first_shape; int last_shape; int cfcc; int trkseg; int i; RoadMapNeighbour current; int found = 0; editor_line_get (line, &from, &to, &trkseg, &cfcc, NULL); roadmap_plugin_set_line (¤t.line, EditorPluginID, line, cfcc, square, fips); current.from = from; editor_trkseg_get (trkseg, &i, &first_shape, &last_shape, NULL); editor_point_position (i, ¤t.to); if (first_shape == -1) { /* skip the for loop */ last_shape = -2; } for (i = first_shape; i <= last_shape; i++) { editor_shape_position (i, ¤t.to); if (roadmap_math_line_is_visible (¤t.from, ¤t.to)) { current.distance = roadmap_math_get_distance_from_segment (position, ¤t.from, ¤t.to, ¤t.intersection, NULL); found = roadmap_street_replace (neighbours, found, max, ¤t); } current.from = current.to; } current.to = to; if (roadmap_math_line_is_visible (¤t.from, ¤t.to)) { current.distance = roadmap_math_get_distance_from_segment (position, ¤t.to, ¤t.from, ¤t.intersection, NULL); found = roadmap_street_replace (neighbours, found, max, ¤t); } return found; }
int editor_track_draw_new_direction_roads () { int k; int count = editor_override_get_count(); if (TrackConfirmedStreet.valid) editor_track_draw_current_new_direction_road(); for (k=0; k<count; k++) { int line_id, square, flags, direction; if (!editor_override_get(k, &line_id, &square, &direction, &flags)) continue; if (flags & ED_LINE_NEW_DIRECTION){ RoadMapPosition from; RoadMapPosition to; int first_shape; int last_shape; RoadMapPen layer_pens[LAYER_PROJ_AREAS]; int i; if (!roadmap_square_set_current(square)) continue; if (line_id >= roadmap_line_count() || line_id < 0) continue; roadmap_line_shapes (line_id, &first_shape, &last_shape); roadmap_line_from (line_id, &from); roadmap_line_to (line_id, &to); if (!roadmap_layer_is_visible (roadmap_line_cfcc(line_id), 0)) continue; if (!roadmap_math_line_is_visible (&from, &to)) continue; for (i = 0; i < LAYER_PROJ_AREAS; i++) { layer_pens[i] = roadmap_layer_get_pen (roadmap_line_cfcc(line_id),1, i); } roadmap_screen_draw_one_line (&from, &to, 0, &from, first_shape, last_shape, NULL, layer_pens, LAYER_PROJ_AREAS, -1, 0, 0, 0); } } return 0; }
static void RealtimeTrafficInfoScreenRepaint (int max_pen) { int i; int iNumLines; int width = TRAFFIC_PEN_WIDTH; int previous_with = -1; int previous_type = -1; if (!isDisplayingTrafficInfoOn()) return; if (RTTrafficInfo_IsEmpty()) return; iNumLines = RTTrafficInfo_GetNumLines(); for (i=0; i<iNumLines; i++) { RTTrafficInfoLines *pTrafficLine = RTTrafficInfo_GetLine(i); RoadMapGuiPoint seg_middle; RoadMapPen previous_pen; RoadMapPen layer_pen; roadmap_square_set_current(pTrafficLine->pluginLine.square); if (!roadmap_layer_is_visible (pTrafficLine->pluginLine.cfcc, 0)) continue; if (!roadmap_math_line_is_visible (&pTrafficLine->positionFrom, &pTrafficLine->positionTo)) continue; layer_pen = roadmap_layer_get_pen (pTrafficLine->pluginLine.cfcc, 0, 0); if (layer_pen) width = roadmap_canvas_get_thickness (layer_pen)+1; else width = TRAFFIC_PEN_WIDTH; if (width < TRAFFIC_PEN_WIDTH) { width = TRAFFIC_PEN_WIDTH; } previous_pen = roadmap_canvas_select_pen (pens[pTrafficLine->iType]); roadmap_canvas_set_thickness (width); if (previous_pen) { roadmap_canvas_select_pen (previous_pen); } if ((width != previous_with) || (previous_type != pTrafficLine->iType)) roadmap_screen_draw_flush(); previous_with = width; previous_type = pTrafficLine->iType; roadmap_screen_draw_one_line (&pTrafficLine->positionFrom, &pTrafficLine->positionTo, 0, &pTrafficLine->positionFrom, pTrafficLine->iFirstShape, pTrafficLine->iLastShape, roadmap_shape_get_position, &pens[pTrafficLine->iType], 1, -1, NULL, &seg_middle, NULL); if (width >= 4){ static const char *direction_colors[3] = {"#fd9f0b", "#FFF380", "#FFFFFF"}; roadmap_screen_draw_line_direction (&pTrafficLine->positionFrom, &pTrafficLine->positionTo, &pTrafficLine->positionFrom, pTrafficLine->iFirstShape, pTrafficLine->iLastShape, roadmap_shape_get_position, width, pTrafficLine->iDirection, direction_colors[pTrafficLine->iType]); } } }