+struct request_line *make_new_line(void)
+{
+ struct request_line *rl = GARY_PUSH(requests_line);
+ rl->request.ind = num_requests++;
+ rl->request.type = REQUEST_LINE;
+ GARY_INIT(rl->sections, 0);
+
+ return rl;
+}
+
+struct request_section *make_new_section(struct request_line *rl)
+{
+ struct request_section *rls = GARY_PUSH(rl->sections);
+ rls->request.ind = num_requests++;
+ rls->request.type = REQUEST_SECTION;
+ rls->num_segments = 0;
+ GARY_INIT(rls->segments, 0);
+
+ return rls;
+}
+
+struct request_segment *make_new_segment(struct request_section *rls, struct symbol *sym)
+{
+ struct request_segment *rs = GARY_PUSH(rls->segments);
+ rls->num_segments++;
+
+ rs->request.ind = num_requests++;
+ rs->request.type = REQUEST_SEGMENT;
+
+ struct point_variant *v = malloc(sizeof(struct point_variant));
+ make_bitmap(v, sym);
+ rs->variant = v;
+
+ return rs;
+}
+
+void cut_edge(struct graph_edge *e, double dist)
+{
+ if (dbg_segments)
+ printf("Cutting [%.2f; %.2f] -- [%.2f; %.2f] to dist %.2f\n", e->n1->o->x, e->n1->o->y, e->n2->o->x, e->n2->o->y, dist);
+
+ struct graph_edge *new = malloc(sizeof(struct graph_edge));
+ *new = *e;
+ e->next = new;
+
+ struct osm_node *n1 = e->n1->o;
+ struct osm_node *n2 = e->n2->o;
+
+ // FIXME
+ if ((n1->x == n2->x) && (n1->y == n2->y))
+ {
+ printf("[%.2f; %.2f] -- [%.2f; %.2f]\n", n1->x, n1->y, n2->x, n2->y);
+ printf("Won't cut point\n");
+ return;
+ }
+
+ struct osm_node *n11 = malloc(sizeof(struct osm_node));
+ struct graph_node *gn = malloc(sizeof(struct graph_node));
+ gn->o = n11;
+ double vsize = sqrt(pow(n1->x - n2->x, 2) + pow(n1->y - n2->y, 2));
+ n11->x = n1->x + (n2->x - n1->x) / vsize * dist;
+ n11->y = n1->y + (n2->y - n1->y) / vsize * dist;
+
+ e->n2 = new->n1 = gn;
+
+ e->length = hypot(abs(n1->x - n11->x), abs(n1->y - n11->y));
+ new->length = hypot(abs(n11->x - n2->x), abs(n11->y - n2->y));
+}
+