+ if ((over->start->flags & RP_TRAFFIC_DISTORTION) && (over->end->flags & RP_TRAFFIC_DISTORTION)) {
+ struct route_traffic_distortion dist;
+ if (route_get_traffic_distortion(over, &dist))
+ return route_time_seg(profile, &over->data, &dist);
+ }
+ return route_time_seg(profile, &over->data, NULL);
+}
+
+/**
+ * @brief Adds a route distortion item to the route graph
+ *
+ * @param this The route graph to add to
+ * @param item The item to add
+ */
+static void
+route_process_traffic_distortion(struct route_graph *this, struct item *item)
+{
+ struct route_graph_point *s_pnt,*e_pnt;
+ struct coord c,l;
+ struct attr delay_attr, maxspeed_attr;
+ int len=0;
+ int flags = 0;
+ int offset = 1;
+ int maxspeed = INT_MAX;
+
+ if (item_coord_get(item, &l, 1)) {
+ s_pnt=route_graph_add_point(this,&l);
+ while (item_coord_get(item, &c, 1)) {
+ l=c;
+ }
+ e_pnt=route_graph_add_point(this,&l);
+ s_pnt->flags |= RP_TRAFFIC_DISTORTION;
+ e_pnt->flags |= RP_TRAFFIC_DISTORTION;
+ if (item_attr_get(item, attr_maxspeed, &maxspeed_attr)) {
+ flags |= AF_SPEED_LIMIT;
+ maxspeed=maxspeed_attr.u.num;
+ }
+ if (item_attr_get(item, attr_delay, &delay_attr))
+ len=delay_attr.u.num;
+ route_graph_add_segment(this, s_pnt, e_pnt, len, item, flags, offset, maxspeed);
+ }