Ejemplo n.º 1
0
int editor_track_draw_current (RoadMapPen pen) {

   RoadMapPosition *from;
   RoadMapPosition *to;
   int first_shape = -1;
   int last_shape = -2;

   if (points_count < 2) return 0;

   if (pen == NULL) return 0;

   if (!cur_active_line) return 0;

   from = track_point_pos (0);
   to = track_point_pos (points_count-1);

   if (points_count > 2) {

      first_shape = 1;
      last_shape = points_count - 2;
   }

   roadmap_screen_draw_one_line
               (from, to, 0, from, first_shape, last_shape,
                editor_track_shape_position, &pen, 1, -1, 0, 0 ,0);
   return 1;
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
int editor_track_draw_current_new_direction_road(){
  	RoadMapPen layer_pens[LAYER_PROJ_AREAS];
 	NavigateSegment segment;
 	RoadMapPosition intersection;
 	int distance;
 	int i;
 	
  	if (points_count < 1) return 0;
  		
  	roadmap_square_set_current(TrackConfirmedLine.line.square);
  	if (!roadmap_line_route_is_low_weight (TrackConfirmedLine.line.line_id)) {
  	   return 0;
	}

	segment.square = TrackConfirmedLine.line.square;
	segment.line = TrackConfirmedLine.line.line_id;
	roadmap_line_from(TrackConfirmedLine.line.line_id, &segment.from_pos);
	roadmap_line_to(TrackConfirmedLine.line.line_id, &segment.to_pos);

	roadmap_line_shapes (TrackConfirmedLine.line.line_id, &segment.first_shape, &segment.last_shape);
	segment.shape_initial_pos = segment.from_pos;
   
   	for (i = 0; i < LAYER_PROJ_AREAS; i++) {
      			layer_pens[i] = roadmap_layer_get_pen (roadmap_line_cfcc(TrackConfirmedLine.line.line_id),1, i);
	}
	
	navigate_instr_fix_line_end(track_point_pos(points_count - 1), &segment,
							TrackConfirmedStreet.line_direction == ROUTE_DIRECTION_WITH_LINE ? LINE_END : LINE_START);
	
   	if (!editor_override_exists(TrackConfirmedLine.line.line_id, TrackConfirmedLine.line.square)){
   		distance =
            roadmap_math_get_distance_from_segment
            (track_point_pos(points_count - 1), &segment.from_pos, &segment.to_pos, &intersection, NULL);
	
						
		if (TrackConfirmedStreet.line_direction == ROUTE_DIRECTION_WITH_LINE)
   			distance = roadmap_math_distance (&intersection, &segment.from_pos);
   		else
   			distance = roadmap_math_distance (&intersection, &segment.to_pos);
	    roadmap_ticker_set_last_event(road_munching_event);
   		editor_points_display(distance);
   	}
   roadmap_screen_draw_one_line
               (&segment.from_pos, &segment.to_pos, 0, &segment.shape_initial_pos, segment.first_shape, segment.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]);
       }
   }
}