00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef FLOAT2D_H
00019 #define FLOAT2D_H
00020
00021 #include <qlabel.h>
00022
00023 #include "odinqt.h"
00024 #include "plot.h"
00025
00026
00027 class QPixmap;
00028
00032 class floatLabel2D : public QLabel {
00033 Q_OBJECT
00034
00035 public:
00036 floatLabel2D(const float *data, float lowbound, float uppbound, unsigned int nx, unsigned int ny, unsigned int coarseFactor,
00037 QWidget *parent, const char *name,
00038 const float *overlay_map, float lowbound_map, float uppbound_map, unsigned int nx_map, unsigned int ny_map, bool map_firescale, float map_rectsize,
00039 bool colormap);
00040 ~floatLabel2D();
00041
00042 int xpos2labelxpos(int pos);
00043 int ypos2labelypos(int pos);
00044 int labelxpos2xpos(int pos);
00045 int labelypos2ypos(int pos);
00046 int xypos2index(int xpos,int ypos);
00047
00048 unsigned int get_nx() const {return nx_cache;}
00049 unsigned int get_ny() const {return ny_cache;}
00050
00051 void init_pixmap(bool clear=true);
00052 void set_pixmap();
00053
00054 void write_pixmap(const char* fname, const char* format) const;
00055
00056 QLabel* get_map_legend(QWidget *parent) const;
00057 void write_map_legend(const char* fname, const char* format) const;
00058
00059
00060 QPixmap *pixmap;
00061
00062 protected:
00063
00064 void mousePressEvent (QMouseEvent *);
00065 void mouseReleaseEvent (QMouseEvent *);
00066 void mouseMoveEvent ( QMouseEvent * );
00067
00068
00069 public slots:
00070 void refresh(const float *data, float lowbound, float uppbound);
00071 void refreshMap(const float *map, float map_lowbound, float map_uppbound, float rectsize);
00072
00073 private slots:
00074 void drawprofil(int position,int direction);
00075 void drawcross(int xposition,int yposition);
00076 void drawroi();
00077
00078 signals:
00079 void clicked(int xposition,int yposition);
00080 void newProfile(const float *data, int npts, bool horizontal, int position);
00081 void newMask(const float *data);
00082
00083 private:
00084
00085 static int scale_width(float lowbound, float uppbound);
00086
00087 void draw_text(GuiPainter& gp, int xpos, int ypos, const char* txt) const;
00088 void draw_scale_text(GuiPainter& gp, int ypos, float val) const;
00089
00090 static int check_range(int val, int min, int max);
00091
00092 int get_map_hue(float relval) const;
00093 int get_map_value(float relval) const;
00094 int get_map_saturation(float relval) const;
00095
00096 int scalespace_cache;
00097
00098 GuiPainter* roi_painter;
00099 mutable QPixmap* legend_pixmap;
00100
00101 unsigned char* imagebuff;
00102 unsigned int len;
00103
00104 const float* data_cache;
00105 unsigned int nx_cache;
00106 unsigned int ny_cache;
00107
00108 float lowbound_cache;
00109 float uppbound_cache;
00110
00111 unsigned int nx_map_cache;
00112 unsigned int ny_map_cache;
00113 float lowbound_map_cache;
00114 float uppbound_map_cache;
00115 bool fire_map_cache;
00116
00117 float *profile_x;
00118 float *profile_y;
00119 unsigned int coarseFactor_cache;
00120 bool colormap_cache;
00121 long unsigned int i;
00122
00123 STD_list<QPoint> roi_polygon;
00124 float* roi_mask;
00125
00126 bool mouse_moved;
00127 };
00128
00129
00130
00131
00132 #endif