1 #ifndef _GL_SEQUENCE_H_
2 #define _GL_SEQUENCE_H_
4 #include "alg/sequence.hh"
7 //! Manage rendering a mussa sequence track
8 /*! The idea is this will keep track of the location of where the sequence
9 * is being rendered, and handle displaying annotations on that track
14 GlSequence(const Sequence & s);
15 GlSequence(const GlSequence & s);
16 GlSequence &operator=(const GlSequence &s);
19 /*! left and right are the edges of the current viewport
21 void draw(GLfloat left, GLfloat right) const;
23 const Sequence& sequence() const;
24 //! set our starting x (horizontal) coordinate
26 //! get our starting x (horizontal) coordinate
28 //! set our current y (vertical) position
30 //! get our current y (vertical) position
32 //! how long is our sequence track? (computed from the sequence)
33 GLfloat length() const;
35 //! return the left (lowest) base index that is fully visible
36 Sequence::size_type GlSequence::leftbase(GLfloat left) const;
37 //! return one past rightmost (highest ) base index that is fully visible
38 /*! done mostly so all the iterator logic continues to work correctly.
40 Sequence::size_type GlSequence::rightbase(GLfloat right) const;
42 //! return iterator to the start of the stored sequence
43 Sequence::const_iterator sequence_begin() const;
44 //! return iterator to the end of the stored sequence
45 Sequence::const_iterator sequence_end() const;
46 //! provide an iterator to the sequence starting at world coordinate left
47 Sequence::const_iterator sequence_begin(GLfloat left, GLfloat right) const;
48 //! provide an iterator to the sequence ending at world coordinate right
49 Sequence::const_iterator sequence_end(GLfloat left, GLfloat right) const;
52 void setColor(Color &);
55 //! are we close enough that it would make sense to view the base pairs?
56 /*! though we don't actually check to see if there's sequence in our
57 * view, just that there's enough pixels to render something if
59 * \param[in] left the left edge of the viewable region in world coordinates
60 * \param[in] right the right edge of the viewable region in world
62 * \param[in] pixel_width allow setting the current viewport pixel width
64 bool is_sequence_renderable(GLfloat left,
66 int pixel_width=-1) const;
68 friend bool operator==(const GlSequence &left, const GlSequence &right);
77 const GLfloat char_pix_per_world_unit;
79 //! Return the pixel width of the opengl viewport.
80 static int get_viewport_pixel_width();
81 //! draw a from left to right +/- height/2
82 void draw_box(GLfloat left, GLfloat right, GLfloat height, GLfloat z) const;
83 //! draw sequence as a bar
84 void draw_track(GLfloat, GLfloat) const;
85 void draw_annotations(GLfloat, GLfloat) const;
86 //! render a sequence as ATGC
87 /*! left and right are the current edges of the viewable world
89 void draw_sequence(GLfloat, GLfloat) const;