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),
- color_mapper(cm),
- char_pix_per_world_unit(2.5)
+ color_mapper(cm)
{
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),
- 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 ),
- 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()));
}
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 *this;
}
return size()+x();
}
-GLfloat GlSequence::size() const
+Sequence::size_type GlSequence::size() const
{
return Sequence::size();
}
return default_color;
}
+ColorRef GlSequence::default_chipseq_color()
+{
+ static ColorRef default_color;
+ if (not default_color) {
+ default_color.reset(new Color(1.0, 0.5, 0.0));
+ }
+ return default_color;
+}
+
int GlSequence::get_viewport_width_in_pixels()
{
GLint viewport[4];
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,
- int viewport_width) const
+ int viewport_width)
{
GLfloat world_width = right - left;
GLfloat pixels_needed = (char_pix_per_world_unit * world_width);
hsmall, y, z+10);
}
-void draw_track(SeqSpanRef s, float left, float right)
+void draw_chipseq_window(SeqSpanRef s, float left, float right)
{
SeqSpanRef parent(s->parent());
DrawableRef parent_draw(parent->drawable());
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() );
+ glColor3fv(c.get());
+
+ float hsmall = height * 2.0;
GlSequence::draw_box(left, right, x+s->start(), x+s->stop(),
- height, y, z+10);
-}
\ No newline at end of file
+ hsmall, y, z+9.0);
+}
+
+void draw_summarized_track(SeqSpanRef s, float left, float right)
+{
+ // 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);
+ }
+}