void GlSeqBrowser::selectRegion(int top, int left, int bottom, int right)
{
- GLfloat x_scale = cur_ortho.width()/((float)viewport_size.x);
- GLfloat y_scale = cur_ortho.height()/((float)viewport_size.y);
- GLfloat x_left = cur_ortho.left + (left*x_scale);
- GLfloat x_right = cur_ortho.left + (right * x_scale);
+ GLfloat x_left = viewportXtoWorldX(left);
+ GLfloat x_right = viewportXtoWorldX(right);cur_ortho.left;
if (top > bottom) {
// woah, someone gave us a rectangle with the origin in the lower left
top = temp;
}
// swap the orientation of canvas coordinates
- GLfloat y_top = cur_ortho.top-(bottom*y_scale);
- GLfloat y_bottom = cur_ortho.top - top * y_scale;
+ GLfloat y_top = viewportYtoWorldY(bottom);
+ GLfloat y_bottom = viewportYtoWorldY(top);
selectedRegion = rect<float>(y_top, x_left, y_bottom, x_right);
// hopefully this will make a buffer big enough to receive
processSelection(hits, selectBuf, select_buf_size, selectedRegion);
}
+void GlSeqBrowser::clearSelection()
+{
+ selected_paths.clear();
+ selected_tracks.clear();
+ selectedMode = false;
+}
+
float GlSeqBrowser::border() const
{
return border_width;
return zoom_level;
}
-void GlSeqBrowser::setColorMapper(boost::shared_ptr<AnnotationColors> cm)
+void GlSeqBrowser::setColorMapper(AnnotationColorsRef cm)
{
color_mapper = cm;
}
-const AnnotationColors& GlSeqBrowser::colorMapper()
+const AnnotationColorsRef GlSeqBrowser::colorMapper()
{
- return *color_mapper;
+ return color_mapper;
}
void GlSeqBrowser::clear()
void GlSeqBrowser::push_sequence(const Sequence& s)
{
- GlSequence gs(s, color_mapper);
+ GlSequenceRef gs(new GlSequence(s, color_mapper));
push_sequence(gs);
}
-void GlSeqBrowser::push_sequence(boost::shared_ptr<Sequence> s)
+void GlSeqBrowser::push_sequence(SequenceRef s)
{
- boost::shared_ptr<GlSequence> gs(new GlSequence(*s, color_mapper));
+ GlSequenceRef gs(new GlSequence(*s, color_mapper));
push_sequence(gs);
}
void GlSeqBrowser::push_sequence(GlSequence gs)
{
- boost::shared_ptr<GlSequence> new_gs(new GlSequence(gs));
+ GlSequenceRef new_gs(new GlSequence(gs));
push_sequence(new_gs);
}
-void GlSeqBrowser::push_sequence(boost::shared_ptr<GlSequence> gs)
+void GlSeqBrowser::push_sequence(GlSequenceRef gs)
{
+ ColorRef default_color(GlSequence::default_gene_color());
+ GlSequenceRef new_gs(new GlSequence(gs));
+ new_gs->update_annotation_draw_function("gene", draw_narrow_track, default_color);
+ // mark where the sequence is
+ new_gs->add_annotations_for_defined_sequence(draw_summarized_track);
+
clear_links();
- track_container.push_back(gs);
+ track_container.push_back(new_gs);
update_layout();
if (track_container.size() > 1)
path_segments.push_back(pair_segment_map());
}
-const std::vector<boost::shared_ptr<GlSequence> >& GlSeqBrowser::sequences() const
+const std::vector<GlSequenceRef >& GlSeqBrowser::sequences() const
{
return track_container;
}