X-Git-Url: http://woldlab.caltech.edu/gitweb/?a=blobdiff_plain;f=alg%2Fglseqbrowser.hpp;h=f88caf5e7e5bb57e4dea0b1ff56f20d4f8c21408;hb=1498ea34399110d081cd06cb8eefb8950e2312c7;hp=2b313f65e5fca7bcd62434118572ea6fc702555d;hpb=db983dc495ba2397136e21b62c5dd9b70c25cae6;p=mussa.git diff --git a/alg/glseqbrowser.hpp b/alg/glseqbrowser.hpp index 2b313f6..f88caf5 100644 --- a/alg/glseqbrowser.hpp +++ b/alg/glseqbrowser.hpp @@ -28,6 +28,8 @@ public: //! select a region (using canvas coordinates) void selectRegion(int top, int left, int bottom, int right); + //! turn off selection + void clearSelection(); //! border size float border() const; @@ -50,6 +52,16 @@ public: float viewportHeight() const; //! return width of the viewport in world coordinates float viewportWidth() const; + + //! return viewport height in pixels + int viewportPixelHeight() const; + //! return viewport width in pixels + int viewportPixelWidth() const; + + //! convert x axis from display to world coordinates + float viewportXtoWorldX(int x); + //! convert y axis from display to world coordinates + float viewportYtoWorldY(int y); //! zoom out far enough to show the full size of the sequence double zoomOut(); @@ -64,7 +76,7 @@ public: void centerOnPath(const std::vector&); void setColorMapper(boost::shared_ptr cm); - const AnnotationColors& colorMapper(); + const AnnotationColorsRef colorMapper(); //! clear our tracks and connections void clear(); @@ -100,9 +112,7 @@ public: //! copy sequence from selected track using formating function template size_t copySelectedTracks(std::list& result, - Item (*format_track)(boost::shared_ptr s, - int left, - int right)); + Item (*format_track)(const Sequence& s, int left, int right)); //! copy sequence from selected tracks as FASTA sequences /*! \return number of base pairs copied */ @@ -205,13 +215,13 @@ private: //! the center of our current viewport (world coord) (used for scrollbar) float viewport_center; double zoom_level; - boost::shared_ptr color_mapper; - //! container of all the GlSequences loaded into our scene - std::vector > track_container; + AnnotationColorsRef color_mapper; //! counter for each path added to us via connect int pathid; protected: + //! container of all the GlSequences loaded into our scene + std::vector track_container; //! where to draw our box (world coordinates) rect selectedRegion; //! true if we have a selection @@ -222,4 +232,15 @@ protected: std::list selected_tracks; typedef std::list::iterator selected_track_iterator; }; + +inline float GlSeqBrowser::viewportXtoWorldX(int x) { + GLfloat x_scale = cur_ortho.width()/((float)viewport_size.x); + return (cur_ortho.left + (x * x_scale)); +} + +inline float GlSeqBrowser::viewportYtoWorldY(int y) { + GLfloat y_scale = cur_ortho.height()/((float)viewport_size.y); + return cur_ortho.top-(y * y_scale); +} + #endif