#ifndef _GL_SEQUENCE_H_
#define _GL_SEQUENCE_H_
+#include <boost/shared_ptr.hpp>
+
#include "alg/annotation_colors.hpp"
#include "alg/sequence.hpp"
#include "alg/color.hpp"
+// isn't it lovely how the header file can live in different places?
+#ifdef __APPLE__
+#include <OpenGL/gl.h>
+#else
#include <GL/gl.h>
+#endif
+
//! Manage rendering a mussa sequence track
/*! The idea is this will keep track of the location of where the sequence
* is being rendered, and handle displaying annotations on that track
class GlSequence
{
public:
- GlSequence(const Sequence & s, AnnotationColors &cm);
+ GlSequence(boost::shared_ptr<Sequence> s,
+ boost::shared_ptr<AnnotationColors> cm);
GlSequence(const GlSequence & s);
GlSequence &operator=(const GlSequence &s);
*/
void draw(GLfloat left, GLfloat right) const;
- const Sequence& sequence() const;
+ boost::shared_ptr<Sequence> sequence();
//! set our starting x (horizontal) coordinate
void setX(GLfloat);
//! get our starting x (horizontal) coordinate
GLfloat x() const;
+ //! get our right (horizontal) coordinate (size-x)
+ GLfloat right() const;
//! set our current y (vertical) position
void setY(GLfloat);
//! get our current y (vertical) position
GLfloat y() const;
+ //! how thick (high) the track we're drawing is
+ GLfloat height() const;
//! how long is our sequence track? (computed from the sequence)
- GLfloat length() const;
+ GLfloat size() const;
//! return the left (lowest) base index that is fully visible
- Sequence::size_type GlSequence::leftbase(GLfloat left) const;
+ Sequence::size_type leftbase(GLfloat left) const;
//! return one past rightmost (highest ) base index that is fully visible
- /*! done mostly so all the iterator logic continues to work correctly.
- */
- Sequence::size_type GlSequence::rightbase(GLfloat right) const;
+ //! done mostly so all the iterator logic continues to work correctly.
+ Sequence::size_type rightbase(GLfloat right) const;
//! return iterator to the start of the stored sequence
Sequence::const_iterator sequence_begin() const;
void setColor(Color &);
Color color();
+ //! how big is a pixel in world coordinats
+ GLfloat get_pixel_width(GLfloat, GLfloat) const;
+ //! how big is a pixel in world coordinats (specifying viewport size)
+ GLfloat get_pixel_width(GLfloat, GLfloat, int) const;
+
+ //! are we close enough that it would make sense to view the base pairs?
+ bool is_sequence_renderable(GLfloat left, GLfloat right) const;
//! 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
*/
- bool is_sequence_renderable(GLfloat left,
- GLfloat right,
- int pixel_width=-1) const;
+ bool is_sequence_renderable(GLfloat, GLfloat, int) const;
friend bool operator==(const GlSequence &left, const GlSequence &right);
protected:
- const Sequence& seq;
+ boost::shared_ptr<Sequence> seq;
GLfloat seq_x;
GLfloat seq_y;
GLfloat seq_z;
GLfloat seq_height;
- AnnotationColors& color_mapper;
+ boost::shared_ptr<AnnotationColors> color_mapper;
Color drawColor;
const GLfloat char_pix_per_world_unit;
//! Return the pixel width of the opengl viewport.
- static int get_viewport_pixel_width();
+ static int get_viewport_width_in_pixels();
//! draw a from left to right +/- height/2
- void draw_box(GLfloat left, GLfloat right, GLfloat height, GLfloat z) const;
+ void draw_box(GLfloat world_left, GLfloat world_right, GLfloat left, GLfloat right, GLfloat height, GLfloat z) const;
//! draw sequence as a bar
void draw_track(GLfloat, GLfloat) const;
void draw_annotations(GLfloat, GLfloat) const;