Logo Search packages:      
Sourcecode: navit version File versions

static void route_graph_add_segment ( struct route_graph this,
struct route_graph_point start,
struct route_graph_point end,
int  len,
struct item *  item,
int  flags,
int  offset,
int  maxspeed 
) [static]

Inserts a new segment into the route graph.

This function performs a check if a segment for the item specified already exists, and inserts a new segment representing this item if it does not.

Parameters:
this The route graph to insert the segment into
start The graph point which should be connected to the start of this segment
end The graph point which should be connected to the end of this segment
len The length of this segment
item The item that is represented by this segment
flags Flags for this segment
offset If the item passed in "item" is segmented (i.e. divided into several segments), this indicates the position of this segment within the item
maxspeed The maximum speed allowed on this segment in km/h. -1 if not known.

Definition at line 1091 of file route.c.

References route_graph_point::c, route_graph_point::end, route_graph_segment::end, route_graph_point::start, coord::x, and coord::y.

Referenced by route_process_street_graph(), route_process_traffic_distortion(), and route_process_turn_restriction().

{
      struct route_graph_segment *s;
      int size;

      size = sizeof(struct route_graph_segment)-sizeof(struct route_segment_data)+route_segment_data_size(flags);
      s = g_malloc0(size);
      if (!s) {
            printf("%s:Out of memory\n", __FUNCTION__);
            return;
      }
      s->start=start;
      s->start_next=start->start;
      start->start=s;
      s->end=end;
      s->end_next=end->end;
      end->end=s;
      dbg_assert(len >= 0);
      s->data.len=len;
      s->data.item=*item;
      s->data.flags=flags;

      if (flags & AF_SPEED_LIMIT) 
            RSD_MAXSPEED(&s->data)=maxspeed;
      if (flags & AF_SEGMENTED) 
            RSD_OFFSET(&s->data)=offset;

      s->next=this->route_segments;
      this->route_segments=s;
      if (debug_route)
            printf("l (0x%x,0x%x)-(0x%x,0x%x)\n", start->c.x, start->c.y, end->c.x, end->c.y);
}


Generated by  Doxygen 1.6.0   Back to index