my new draw_track code didn't test to see if the sequence text was visible
thus hiding the text. This fixes that, though at the cost of adding
more logic in the process of rendering the display.
GlSequenceRef new_gs(new GlSequence(gs));
new_gs->update_annotation_draw_function("gene", draw_narrow_track, default_color);
// mark where the sequence is
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_track);
+ new_gs->add_annotations_for_defined_sequence(draw_summarized_track);
clear_links();
track_container.push_back(new_gs);
clear_links();
track_container.push_back(new_gs);
using namespace std;
static const float default_height = 12.0;
using namespace std;
static const float default_height = 12.0;
+static const float char_pix_per_world_unit = 2.5;
GlSequence::GlSequence(const Sequence &s,
boost::shared_ptr<AnnotationColors> cm)
: Sequence(s),
GlSequence::GlSequence(const Sequence &s,
boost::shared_ptr<AnnotationColors> cm)
: Sequence(s),
- color_mapper(cm),
- char_pix_per_world_unit(2.5)
{
seq->setDrawable(default_drawable());
}
GlSequence::GlSequence(const GlSequence &s)
: Sequence(s),
{
seq->setDrawable(default_drawable());
}
GlSequence::GlSequence(const GlSequence &s)
: Sequence(s),
- color_mapper(s.color_mapper),
- char_pix_per_world_unit(s.char_pix_per_world_unit)
+ color_mapper(s.color_mapper)
{
seq->setDrawable(copy_drawable(s.seq->drawable()));
}
GlSequence::GlSequence(const GlSequence *s)
: Sequence(s),
{
seq->setDrawable(copy_drawable(s.seq->drawable()));
}
GlSequence::GlSequence(const GlSequence *s)
: Sequence(s),
- color_mapper(s->color_mapper),
- char_pix_per_world_unit(s->char_pix_per_world_unit)
+ color_mapper(s->color_mapper)
{
seq->setDrawable(copy_drawable(s->seq->drawable()));
}
GlSequence::GlSequence(const GlSequenceRef s)
: Sequence( (SequenceRef)s ),
{
seq->setDrawable(copy_drawable(s->seq->drawable()));
}
GlSequence::GlSequence(const GlSequenceRef s)
: Sequence( (SequenceRef)s ),
- color_mapper(s->color_mapper),
- char_pix_per_world_unit(s->char_pix_per_world_unit)
+ color_mapper(s->color_mapper)
{
seq->setDrawable(copy_drawable(s->seq->drawable()));
}
{
seq->setDrawable(copy_drawable(s->seq->drawable()));
}
Sequence::operator=(s);
seq->setDrawable(copy_drawable(s.seq->drawable()));
color_mapper = s.color_mapper;
Sequence::operator=(s);
seq->setDrawable(copy_drawable(s.seq->drawable()));
color_mapper = s.color_mapper;
- assert(char_pix_per_world_unit == s.char_pix_per_world_unit);
return round((right-left)/vp_width);
}
return round((right-left)/vp_width);
}
-bool GlSequence::is_sequence_renderable(GLfloat left, GLfloat right) const
+bool GlSequence::is_sequence_renderable(GLfloat left, GLfloat right)
{
return is_sequence_renderable(left, right, get_viewport_width_in_pixels());
}
bool GlSequence::is_sequence_renderable(GLfloat left,
GLfloat right,
{
return is_sequence_renderable(left, right, get_viewport_width_in_pixels());
}
bool GlSequence::is_sequence_renderable(GLfloat left,
GLfloat right,
- int viewport_width) const
{
GLfloat world_width = right - left;
GLfloat pixels_needed = (char_pix_per_world_unit * world_width);
{
GLfloat world_width = right - left;
GLfloat pixels_needed = (char_pix_per_world_unit * world_width);
-void draw_track(SeqSpanRef s, float left, float right)
+void draw_summarized_track(SeqSpanRef s, float left, float right)
- SeqSpanRef parent(s->parent());
- DrawableRef parent_draw(parent->drawable());
- float x( (parent_draw) ? parent_draw->x() : 0);
- float y( (parent_draw) ? parent_draw->y() : 0);
- float z( (parent_draw) ? parent_draw->z() : 10 );
- float height( (parent_draw) ? parent_draw->height() : default_height );
- Color c( (s->drawable()) ? s->drawable()->color() : *GlSequence::default_track_color() );
+ // if we can see the sequence text (AGCTN), don't draw the black boxes
+ if (not GlSequence::is_sequence_renderable(left, right)) {
+ SeqSpanRef parent(s->parent());
+ DrawableRef parent_draw(parent->drawable());
+ float x( (parent_draw) ? parent_draw->x() : 0);
+ float y( (parent_draw) ? parent_draw->y() : 0);
+ float z( (parent_draw) ? parent_draw->z() : 10 );
+ float height( (parent_draw) ? parent_draw->height() : default_height );
+ Color c( (s->drawable()) ? s->drawable()->color() : *GlSequence::default_track_color() );
- glColor3fv( c.get() );
- GlSequence::draw_box(left, right, x+s->start(), x+s->stop(),
- height, y, z+10);
+ glColor3fv( c.get() );
+ GlSequence::draw_box(left, right, x+s->start(), x+s->stop(),
+ height, y, z+10);
+ }
static GLfloat pixelWidth(GLfloat, GLfloat, int);
//! are we close enough that it would make sense to view the base pairs?
static GLfloat pixelWidth(GLfloat, GLfloat, int);
//! are we close enough that it would make sense to view the base pairs?
- bool is_sequence_renderable(GLfloat left, GLfloat right) const;
+ static bool is_sequence_renderable(GLfloat left, GLfloat right);
//! are we close enough that it would make sense to view the base pairs?
/*! though we don't actually check to see if there's sequence in our
* view, just that there's enough pixels to render something if
//! are we close enough that it would make sense to view the base pairs?
/*! though we don't actually check to see if there's sequence in our
* view, just that there's enough pixels to render something if
* coordinates
* \param[in] pixel_width allow setting the current viewport pixel width
*/
* coordinates
* \param[in] pixel_width allow setting the current viewport pixel width
*/
- bool is_sequence_renderable(GLfloat, GLfloat, int) const;
+ static bool is_sequence_renderable(GLfloat, GLfloat, int);
friend bool operator==(const GlSequence &left, const GlSequence &right);
protected:
AnnotationColorsRef color_mapper;
friend bool operator==(const GlSequence &left, const GlSequence &right);
protected:
AnnotationColorsRef color_mapper;
- const GLfloat char_pix_per_world_unit;
//! initalize a SeqSpanRef covering start, count
SeqSpanRef make_drawable_annotation(
//! initalize a SeqSpanRef covering start, count
SeqSpanRef make_drawable_annotation(
void draw_sequence(GLfloat, GLfloat) const;
};
void draw_sequence(GLfloat, GLfloat) const;
};
-void draw_track(SeqSpanRef ref, float left, float right);
+//! draw sequence track when we're far enough out not to see the AGCTs.
+void draw_summarized_track(SeqSpanRef ref, float left, float right);
+//! draw a 1/4 width centered track
void draw_narrow_track(SeqSpanRef ref, float left, float right);
#endif
void draw_narrow_track(SeqSpanRef ref, float left, float right);
#endif