draw link lines with a width
[mussa.git] / alg / glseqbrowser.cpp
index 02334cb9f271b5846eefcdd819828835ac557810..e82cfe1f48fab2cd13fb3f82dba47e6d62bef5f9 100644 (file)
@@ -358,7 +358,7 @@ void GlSeqBrowser::clear_links()
 }
 
 void 
-GlSeqBrowser::link(const vector<int>& path, const vector<bool>& rc, int )
+GlSeqBrowser::link(const vector<int>& path, const vector<bool>& rc, int length)
 {
   if (path.size() < 2) {
     // should i throw an error instead?
@@ -390,12 +390,17 @@ GlSeqBrowser::link(const vector<int>& path, const vector<bool>& rc, int )
             y2 += track_container[track_i+1]->height()/2;
       
       bool rcFlag = (prev_rc or *rc_i) and !(prev_rc and *rc_i);
-      Segment s(prev_x, y1, *path_i, y2, rcFlag);
+      Segment s(prev_x, y1, *path_i, y2, rcFlag, length);
       s.path_ids.insert(pathid);
       path_segments[track_i][p] = s;
     } else {
       //found
       found_segment->second.path_ids.insert(pathid);
+      // make each segment the size of the largest of any link between these 
+      // two bases
+      if (found_segment->second.length < length) {
+        found_segment->second.length = length;
+      }
     }
     prev_x = *path_i;
     prev_rc = *rc_i;
@@ -644,6 +649,7 @@ void GlSeqBrowser::draw_segments() const
   glLineWidth(1);
   glEnable(GL_BLEND);
   glDepthMask(GL_FALSE);
+  const float zdepth = -1.0;
   // each vector contains path_segment_maps of all the connections
   // between this track and the next
   path_segment_map_vector::const_iterator psmv_i;
@@ -682,22 +688,31 @@ void GlSeqBrowser::draw_segments() const
         } else {
           glColor4f(0.7, 0.7, 1.0, 0.4);
         }
-        /*
-        if (selected_paths.size() == 0 or selected.size() > 0) {
-          glColor3f(0.0, 0.0, 1.0);
-        } else {
-          glColor3f(0.8, 0.8, 1.0);
-        }
-        */
       }
       // save the multipart name for our segment
       glPushName(path_index); glPushName(key.first); glPushName(key.second);
-      glBegin(GL_LINES);
-      float seq_start_x = track_container[path_index]->x();
-      float seq_end_x = track_container[path_index+1]->x();
-      glVertex3f(s.start.x + seq_start_x, s.start.y, -1);
-      glVertex3f(s.end.x   + seq_end_x  , s.end.y, -1);
-      glEnd();
+      float seq_start_x = s.start.x 
+                        + track_container[path_index]->x();
+      float seq_end_x = s.end.x
+                      + track_container[path_index+1]->x();
+      // add in length
+      float seq_start_x_length = s.start.x 
+                               + s.length
+                               + track_container[path_index]->x();
+      float seq_end_x_length = s.end.x
+                             + s.length
+                             + track_container[path_index+1]->x();
+      //glBegin(GL_LINES);
+      //  glVertex3f(seq_start_x, s.start.y, -1);
+      //  glVertex3f(seq_end_x  , s.end.y, -1);
+      //glEnd();
+      
+      glBegin(GL_QUADS);
+        glVertex3f(seq_start_x, s.start.y, zdepth);
+        glVertex3f(seq_end_x, s.end.y, zdepth);
+        glVertex3f(seq_end_x_length, s.end.y, zdepth);
+        glVertex3f(seq_start_x_length, s.start.y, zdepth);
+      glEnd();      
       // clear the names
       glPopName(); glPopName(); glPopName();
     }