source: tags/arb-6.0/GENOM/GEN_gene.hxx

Last change on this file was 7666, checked in by westram, 13 years ago
  • merge from dev [7539] [7541] [7543] [7544] [7548] [7549] [7550] [7552] [7553] [7554] [7555] [7556] [7557] [7558] [7559] [7561] [7562] [7563] [7564] [7565] [7566] [7567] [7568] [7569] [7570] [7571] [7572] [7574] [7575]
    • behavioral changes
      • when jumping to gene the text will also move into viewport
      • this slightly changed the zoom used in IRS tree
      • dont try to draw clipped bracket
      • arcs were not drawn if NW-quadrant was not fully visible
      • fixed '~'-bond (SECEDIT): use constants; fixed a small gap sometimes visible; reduced OUTSIDE overhang of arcs by 15 degrees
      • reset disp_device after show()
    • use new type AW_rgb for colors
    • removed old-style enum typedefs
    • refactored
      • AW_GC
      • DRYed AWT_graphic_tree::show() vs fake_AWT_graphic_tree::test_show_tree()
      • AW_clipable
      • moved font_overlap values into AW_font_overlap
      • AW_device
        • removed transform/rtransform flavors using ints (replaced usages by Position/Rectangle? transformations)
        • added get_rtransformed_cliprect
        • pass radius as Vector (circle/arc)
        • fixed degrees chaos in arc params: arc_degrees now also is clockwise (like start_degrees) - both are clockwise cause ARBs y-coordinate grows downwards
        • invisible_impl uses Position as param
        • fixed return type of draw functions
        • fixed a bug in pop_clip_scale
          • push+pop did not restore scale and offset properly (only if zoom was not 1.0)
          • reset AW_zoomable before restoring and restore offset before scale
        • AW_device_Xm
          • refactored arc_impl
        • AW_device_print
          • refactored circle_impl
            • added assertion against drawing zero-sized circles
            • test for positive radius before drawing bootstrap circles (e.g. if branchlength is zero)
            • "fix" clipping of circles on AW_device_print (only affects printing when "screen only" is selected)
              • if more than half of circle gets clipped → skip circle
              • otherwise force circle into clipped bounding rectangle (i.e. print a smaller circle, that fits on the screen)
          • basic implementation of AW_device_print::arc_impl
            • arcs based on circles are drawn using xfigs ARC command
            • arcs based on ellipses are interpolated using splines
            • clipping does some as with circles (clip bounding-box and draw arc inside; if less than half of arc is inside clipping area, skip arc completely)
          • separated fprintf into single lines for better documentation of single xfig parameters
      • AW_area_management (made member variables private + split up with useless friends)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : GEN_gene.hxx                                      //
4//   Purpose   :                                                   //
5//                                                                 //
6//   Coded by Ralf Westram (coder@reallysoft.de) in 2001           //
7//   Institute of Microbiology (Technical University Munich)       //
8//   http://www.arb-home.de/                                       //
9//                                                                 //
10// =============================================================== //
11
12#ifndef GEN_GENE_HXX
13#define GEN_GENE_HXX
14
15#ifndef ARBDB_BASE_H
16#include <arbdb_base.h>
17#endif
18#ifndef AW_BASE_HXX
19#include <aw_base.hxx>
20#endif
21#ifndef ARBTOOLS_H
22#include <arbtools.h>
23#endif
24#ifndef AW_POSITION_HXX
25#include <aw_position.hxx>
26#endif
27
28#ifndef _GLIBCXX_SET
29#include <set>
30#endif
31#ifndef _GLIBCXX_STRING
32#include <string>
33#endif
34
35
36// ------------------------------------------
37//      display classes for ARB_GENE_MAP:
38
39class  GEN_root;
40class  GEN_graphic;
41struct GEN_position;
42
43class GEN_gene { 
44    GBDATA              *gb_gene; 
45    GEN_root            *root; 
46    std::string          name;
47    mutable std::string  nodeInfo;
48    long                 pos1;
49    long                 pos2;
50    bool                 complement;
51
52    // Note: if a gene is joined from several parts it is represented in several GEN_gene's!
53
54    void init(GBDATA *gb_gene_, GEN_root *root_);
55    void load_location(int part, const GEN_position *location);
56
57public:
58    GEN_gene(GBDATA *gb_gene_, GEN_root *root_, const GEN_position *location);
59    GEN_gene(GBDATA *gb_gene_, GEN_root *root_, const GEN_position *location, int partNumber);
60    GEN_gene(const GEN_gene& other)
61        : gb_gene(other.gb_gene),
62          root(other.root),
63          name(other.name),
64          nodeInfo(other.nodeInfo),
65          pos1(other.pos1),
66          pos2(other.pos2),
67          complement(other.complement)
68    {}
69    DECLARE_ASSIGNMENT_OPERATOR(GEN_gene);
70    ~GEN_gene() {}
71
72    inline bool operator<(const GEN_gene& other) const {
73        long cmp     = pos1-other.pos1;
74        if (cmp) cmp = pos2-other.pos2;
75        return cmp<0;
76    }
77
78    long StartPos() const { return pos1; } // first position of gene (1..n)
79    long EndPos() const { return pos2; } // last position of gene (1..n)
80    long Length() const { return pos2-pos1+1; }
81    bool Complement() const { return complement; }
82    const std::string& NodeInfo() const { return nodeInfo; }
83    const std::string& Name() const { return name; } // returns the short name of the gene
84    const GBDATA *GbGene() const { return gb_gene; }
85    GEN_root *Root() { return root; }
86
87    void reinit_NDS() const;
88};
89
90typedef std::multiset<GEN_gene> GEN_gene_set;
91typedef GEN_gene_set::iterator GEN_iterator;
92
93class AW_device;
94
95class GEN_root : virtual Noncopyable {
96    GBDATA      *gb_main;
97    GEN_graphic *gen_graphic;
98    std::string  organism_name; // name1 of current species
99    // (in case of a pseudo gene-species this is the name of the species it originated from)
100
101    std::string  gene_name;     // name of current gene
102    GEN_gene_set gene_set;
103    std::string  error_reason;  // reason why we can't display gene_map
104    long         length;        // length of organism sequence
105
106    GBDATA *gb_gene_data;       // i am build upon this
107
108    AW::Rectangle gene_range;
109
110   
111    void clear_selected_range() { gene_range = AW::Rectangle(); }
112    void increase_selected_range(AW::Position pos) {
113        gene_range = gene_range.valid() ? bounding_box(gene_range, pos) : AW::Rectangle(pos, pos);
114    }
115    void increase_selected_range(AW::Rectangle rect) {
116        gene_range = gene_range.valid() ? bounding_box(gene_range, rect) : rect;
117    }
118
119    int smart_text(AW_device *device, int gc, const char *str, AW_pos x, AW_pos y);
120    int smart_line(AW_device *device, int gc, AW_pos x0, AW_pos y0, AW_pos x1, AW_pos y1);
121
122public:
123    GEN_root(const char *organism_name_, const char *gene_name_, GBDATA *gb_main_, AW_root *aw_root, GEN_graphic *gen_graphic_);
124    ~GEN_root() {}
125
126    const std::string& GeneName() const { return gene_name; }
127    const std::string& OrganismName() const { return organism_name; }
128
129    GBDATA *GbMain() { return gb_main; }
130
131    void set_GeneName(const std::string& gene_name_) { gene_name = gene_name_; }
132
133    void paint(AW_device *device);
134
135    void reinit_NDS() const;
136
137    const AW::Rectangle& get_selected_range() const { return gene_range; }
138};
139
140#else
141#error GEN_gene.hxx included twice
142#endif // GEN_GENE_HXX
Note: See TracBrowser for help on using the repository browser.