]> mj.ucw.cz Git - leo.git/blobdiff - lab-lines.c
Labelling: (Mostly) structs documentation and cleanup
[leo.git] / lab-lines.c
index 4436e4dff19525dd1bdf451044fa61b482c6b45a..e3c3005df336cf6503c73a0786293c91cd1efc45 100644 (file)
@@ -25,6 +25,7 @@ enum edge_dir
   DIR_BWD,
 };
 
+// List of lines (osm_ways) making up a logical line
 struct longline
 {
   uns id;
@@ -36,27 +37,25 @@ struct graph_node
   osm_id_t id;
   struct osm_node *o;
   struct graph_edge **edges;
-  int num;
+  int num;     // Used for debug, mostly debug prints
 };
 
 struct graph_edge
 {
-  osm_id_t id;
-  double length;
+  osm_id_t id;                 // Actual line (osm_way) ID
+  struct sym_line *line;
   color_t color;
-  int visited;
-  struct graph_edge *prev;
-  struct graph_edge *next;
-  struct graph_node *n1;
-  struct graph_node *n2;
-  uns longline;
   struct symbol *label;
-  struct sym_line *line;
-  z_index_t zindex;
-  enum edge_dir dir;
-  struct graph_node *anode;
-  struct graph_node *bnode; // DEBUG PRINT
-  int num; // DEBUG
+  z_index_t zindex;            // z-index of label
+  double length;
+  int visited;                 // Iteration when line was last visited with BFS
+  uns longline;                        // Logical line this line was made part of
+  enum edge_dir dir;           // Direction with respect to logical line, used by BFS
+  struct graph_node *n1;       // Actual line endpoints
+  struct graph_node *n2;
+  struct graph_edge *prev;     // Neighbouring lines in logical line
+  struct graph_edge *next;
+  int num;                     // Used for debug
 };
 
 #define HASH_NODE struct graph_node
@@ -117,7 +116,6 @@ static 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);
   GARY_INIT(rls->request.variants, 0);
 
@@ -127,7 +125,6 @@ static struct request_section *make_new_section(struct request_line *rl)
 static 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;
@@ -525,7 +522,7 @@ static void make_segments(void)
       e = e->next;
     }
 
-    if (request->sections[0].num_segments == 0)
+    if (GARY_SIZE(request->sections[0].segments) == 0)
     {
       DEBUG(dbg_segments, VERBOSITY_INDIVIDUAL, "WARNING: Longline without any segment, skipped\n");