1 #ifndef _GL_SEQUENCE_H_
2 #define _GL_SEQUENCE_H_
4 #include "alg/annotation_colors.hpp"
5 #include "alg/sequence.hpp"
6 #include "alg/color.hpp"
8 //! Manage rendering a mussa sequence track
9 /*! The idea is this will keep track of the location of where the sequence
10 * is being rendered, and handle displaying annotations on that track
15 GlSequence(const Sequence & s, AnnotationColors &cm);
16 GlSequence(const GlSequence & s);
17 GlSequence &operator=(const GlSequence &s);
20 /*! left and right are the edges of the current viewport
22 void draw(GLfloat left, GLfloat right) const;
24 const Sequence& sequence() const;
25 //! set our starting x (horizontal) coordinate
27 //! get our starting x (horizontal) coordinate
29 //! set our current y (vertical) position
31 //! get our current y (vertical) position
33 //! how long is our sequence track? (computed from the sequence)
34 GLfloat length() const;
36 //! return the left (lowest) base index that is fully visible
37 Sequence::size_type GlSequence::leftbase(GLfloat left) const;
38 //! return one past rightmost (highest ) base index that is fully visible
39 /*! done mostly so all the iterator logic continues to work correctly.
41 Sequence::size_type GlSequence::rightbase(GLfloat right) const;
43 //! return iterator to the start of the stored sequence
44 Sequence::const_iterator sequence_begin() const;
45 //! return iterator to the end of the stored sequence
46 Sequence::const_iterator sequence_end() const;
47 //! provide an iterator to the sequence starting at world coordinate left
48 Sequence::const_iterator sequence_begin(GLfloat left, GLfloat right) const;
49 //! provide an iterator to the sequence ending at world coordinate right
50 Sequence::const_iterator sequence_end(GLfloat left, GLfloat right) const;
53 void setColor(Color &);
56 //! are we close enough that it would make sense to view the base pairs?
57 /*! though we don't actually check to see if there's sequence in our
58 * view, just that there's enough pixels to render something if
60 * \param[in] left the left edge of the viewable region in world coordinates
61 * \param[in] right the right edge of the viewable region in world
63 * \param[in] pixel_width allow setting the current viewport pixel width
65 bool is_sequence_renderable(GLfloat left,
67 int pixel_width=-1) const;
69 friend bool operator==(const GlSequence &left, const GlSequence &right);
77 AnnotationColors& color_mapper;
79 const GLfloat char_pix_per_world_unit;
81 //! Return the pixel width of the opengl viewport.
82 static int get_viewport_pixel_width();
83 //! draw a from left to right +/- height/2
84 void draw_box(GLfloat left, GLfloat right, GLfloat height, GLfloat z) const;
85 //! draw sequence as a bar
86 void draw_track(GLfloat, GLfloat) const;
87 void draw_annotations(GLfloat, GLfloat) const;
88 //! render a sequence as ATGC
89 /*! left and right are the current edges of the viewable world
91 void draw_sequence(GLfloat, GLfloat) const;