| 1 | #ifndef SAIPROBEVISUALIZATION_HXX |
|---|
| 2 | #define SAIPROBEVISUALIZATION_HXX |
|---|
| 3 | |
|---|
| 4 | #ifndef _GLIBCXX_CCTYPE |
|---|
| 5 | #include <cctype> |
|---|
| 6 | #endif |
|---|
| 7 | #ifndef _GLIBCXX_VECTOR |
|---|
| 8 | #include <vector> |
|---|
| 9 | #endif |
|---|
| 10 | #ifndef AWT_CANVAS_HXX |
|---|
| 11 | #include <awt_canvas.hxx> |
|---|
| 12 | #endif |
|---|
| 13 | |
|---|
| 14 | #include <string> |
|---|
| 15 | |
|---|
| 16 | #define sai_assert(cond) arb_assert(cond) |
|---|
| 17 | |
|---|
| 18 | #define AWAR_SPV_SAI_2_PROBE "sai_visualize/sai_2_probe" |
|---|
| 19 | #define AWAR_SPV_DISP_SAI "sai_visualize/disp_sai" |
|---|
| 20 | #define AWAR_SPV_SAI_COLOR "sai_visualize/probeSai/color_0" |
|---|
| 21 | |
|---|
| 22 | #define AWAR_SPV_DB_FIELD_NAME "sai_visualize/db_field_name" |
|---|
| 23 | #define AWAR_SPV_DB_FIELD_WIDTH "sai_visualize/db_field_width" |
|---|
| 24 | #define AWAR_SPV_ACI_COMMAND "sai_visualize/aci_command" |
|---|
| 25 | #define AWAR_SPV_SELECTED_PROBE "sai_visualize/selected_probe" |
|---|
| 26 | |
|---|
| 27 | #define SAI_CLR_COUNT 10 |
|---|
| 28 | |
|---|
| 29 | enum { |
|---|
| 30 | PROBE, |
|---|
| 31 | PROBE_PREFIX, |
|---|
| 32 | PROBE_SUFFIX |
|---|
| 33 | }; |
|---|
| 34 | |
|---|
| 35 | enum { |
|---|
| 36 | SAI_GC_HIGHLIGHT, SAI_GC_HIGHLIGHT_FONT = SAI_GC_HIGHLIGHT, |
|---|
| 37 | SAI_GC_FOREGROUND, SAI_GC_FOREGROUND_FONT = SAI_GC_FOREGROUND, |
|---|
| 38 | SAI_GC_PROBE, SAI_GC_PROBE_FONT = SAI_GC_PROBE, |
|---|
| 39 | |
|---|
| 40 | SAI_GC_0, SAI_GC_1, SAI_GC_2, SAI_GC_3, SAI_GC_4, |
|---|
| 41 | SAI_GC_5, SAI_GC_6, SAI_GC_7, SAI_GC_8, SAI_GC_9, |
|---|
| 42 | |
|---|
| 43 | SAI_GC_MAX |
|---|
| 44 | }; |
|---|
| 45 | |
|---|
| 46 | // global data for interaction with probe match result list: |
|---|
| 47 | |
|---|
| 48 | class saiProbeData : virtual Noncopyable { // Note: also used for ProbeCollection! |
|---|
| 49 | std::string probeTarget; |
|---|
| 50 | std::string headline; // needed for ProbeMatchParser |
|---|
| 51 | |
|---|
| 52 | public: |
|---|
| 53 | |
|---|
| 54 | std::vector<std::string> probeSpecies; |
|---|
| 55 | std::vector<std::string> probeSeq; |
|---|
| 56 | |
|---|
| 57 | saiProbeData() : probeTarget("<notarget>"), headline() {} |
|---|
| 58 | ~saiProbeData() { |
|---|
| 59 | probeSpecies.clear(); |
|---|
| 60 | probeSeq.clear(); |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | const char *getProbeTarget() const { |
|---|
| 64 | // sai_assert(probeTarget.length() > 0); // always need a target |
|---|
| 65 | return probeTarget.c_str(); |
|---|
| 66 | } |
|---|
| 67 | size_t getProbeTargetLen() const { |
|---|
| 68 | return probeTarget.length(); |
|---|
| 69 | } |
|---|
| 70 | const char *getHeadline() const { return headline.c_str(); } |
|---|
| 71 | |
|---|
| 72 | void setProbeTarget(const char *target) { |
|---|
| 73 | sai_assert(target); |
|---|
| 74 | |
|---|
| 75 | unsigned int len = strlen(target); |
|---|
| 76 | char temp[len+1]; |
|---|
| 77 | for (unsigned int i = 0; i < len; i++) { |
|---|
| 78 | temp[i] = toupper(target[i]); // converting the Bases to Upper case |
|---|
| 79 | } |
|---|
| 80 | temp[len] = '\0'; |
|---|
| 81 | probeTarget = temp; |
|---|
| 82 | } |
|---|
| 83 | void setHeadline(const char *hline) { |
|---|
| 84 | sai_assert(hline); |
|---|
| 85 | headline = hline; |
|---|
| 86 | } |
|---|
| 87 | }; |
|---|
| 88 | |
|---|
| 89 | struct SAI_graphic : public AWT_nonDB_graphic, virtual Noncopyable { |
|---|
| 90 | GBDATA *gb_main; |
|---|
| 91 | AW_root *aw_root; |
|---|
| 92 | |
|---|
| 93 | SAI_graphic(AW_root *aw_root, GBDATA *gb_main); |
|---|
| 94 | ~SAI_graphic() OVERRIDE; |
|---|
| 95 | |
|---|
| 96 | AW_gc_manager *init_devices(AW_window *, AW_device *, AWT_canvas *scr) OVERRIDE; |
|---|
| 97 | |
|---|
| 98 | void show(AW_device *device) OVERRIDE; |
|---|
| 99 | void handle_command(AW_device *device, AWT_graphic_event& event) OVERRIDE; |
|---|
| 100 | void paint(AW_device *device); |
|---|
| 101 | |
|---|
| 102 | }; |
|---|
| 103 | |
|---|
| 104 | AW_window *createSaiProbeMatchWindow(AW_root *awr, GBDATA *gb_main); |
|---|
| 105 | void transferProbeData(saiProbeData *spd); |
|---|
| 106 | |
|---|
| 107 | #else |
|---|
| 108 | #error SaiProbeVisualization.hxx included twice |
|---|
| 109 | #endif |
|---|