store default colors
[mussa.git] / alg / glsequence.hpp
index cbb933c6d3836717e4340e97aac5451bb55b8f12..af1e14c569e3b9dc0359005bfc2d3c8b6e5370e3 100644 (file)
@@ -35,6 +35,16 @@ public:
   static DrawableRef default_drawable();
   static DrawableRef copy_drawable(DrawableRef s);
   
+  //! search through sequence and add an annotation highlighting all the non AGCT characters
+  void add_annotations_for_defined_sequence(Drawable::draw_func_ptr draw=0);
+  /**!search through our annotations and set the draw function for a particular "type"
+   * this is really a temporary solution to configuring annotation display styles
+   */
+  void update_annotation_draw_function(
+         std::string type, 
+         Drawable::draw_func_ptr draw, 
+         ColorRef color
+       );
   //! set our starting x (horizontal) coordinate
   void setX(float x);
   //! get our starting x (horizontal) coordinate
@@ -54,7 +64,20 @@ public:
   const ColorRef color() const;
   //! return our draw color
   ColorRef color();
+  //! return default gene color
+  static ColorRef default_gene_color();
+  //! return default track color
+  static ColorRef default_track_color();
+  
+  //! return our annotation color mapper
+  AnnotationColorsRef colorMapper() { return color_mapper; }
 
+  //! draw a from left to right +/- height/2
+  static
+  void draw_box(GLfloat world_left, GLfloat world_right, 
+                GLfloat left, GLfloat right, GLfloat height,
+                GLfloat y, GLfloat z,
+                GLint primitive=GL_QUADS);
   //! draw a track 
   /*! left and right are the edges of the current viewport
    */
@@ -79,10 +102,12 @@ public:
   //! return a subsequence as a GlSequence (instead of a Sequence subsequence)
   GlSequence subseq(size_type start, size_type count) const;
   
+  //! Return the pixel width of the opengl viewport.
+  static int get_viewport_width_in_pixels();
   //! how big is a pixel in world coordinats
-  GLfloat pixelWidth(GLfloat, GLfloat) const;
+  static GLfloat pixelWidth(GLfloat, GLfloat);
   //! how big is a pixel in world coordinats (specifying viewport size)
-  GLfloat pixelWidth(GLfloat, GLfloat, int) const;
+  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;
@@ -100,13 +125,17 @@ public:
   friend bool operator==(const GlSequence &left, const GlSequence &right);
 
 protected:
-  boost::shared_ptr<AnnotationColors> color_mapper;
+  AnnotationColorsRef color_mapper;
   const GLfloat char_pix_per_world_unit;
 
-  //! Return the pixel width of the opengl viewport.
-  static int get_viewport_width_in_pixels();
-  //! draw a from left to right +/- height/2
-  void draw_box(GLfloat world_left, GLfloat world_right, GLfloat left, GLfloat right, GLfloat height, GLfloat z) const;
+  //! initalize a SeqSpanRef covering start, count
+  SeqSpanRef make_drawable_annotation(
+    Drawable::draw_func_ptr draw,
+    std::string name,
+    size_type start,
+    size_type count,
+    ColorRef color);
+
   //! draw sequence as a bar
   void draw_track(GLfloat, GLfloat) const;
   void draw_annotations(GLfloat, GLfloat) const;
@@ -115,4 +144,7 @@ protected:
    */
   void draw_sequence(GLfloat, GLfloat) const;
 };
+
+void draw_track(SeqSpanRef ref, float left, float right);
+void draw_narrow_track(SeqSpanRef ref, float left, float right);
 #endif