00001 // 00002 // C++ Interface: histoview 00003 // 00004 // Description: 00005 // 00006 // 00007 // Author: Nicholas Phillips <nicholas.G.Phillips@nasa.gov>, (C) 2008 00008 // 00009 // Copyright: See COPYING file that comes with this distribution 00010 // 00011 // 00012 #ifndef HISTOVIEW_H 00013 #define HISTOVIEW_H 00014 00015 #include <QWidget> 00016 00017 class Histogram; 00018 class ColorTable; 00019 /* 00020 Paint a histogram. 00021 00022 Once we have a histogram, allows the painting of it via a 00023 QPaintEvent request. When it is painted, 'c' and 'z' control 00024 the center and zoom of the region to be highlighted. Both 00025 c-z/2 and c+z/2 are assumed to be between 0 and 1. 00026 00027 @author Nicholas Phillips <nicholas.G.Phillips@nasa.gov> 00028 */ 00029 class HistoView : public QWidget 00030 { 00031 Q_OBJECT 00032 public: 00033 HistoView(QWidget *parent = 0); 00034 00035 // Associate with given histogram data 00036 void set(const Histogram *h); 00037 00038 // Use this color table 00039 void set(const ColorTable *ct); 00040 00041 // This is a fixed sized widget at this point 00042 QSize minimumSizeHint() const { 00043 return QSize(w+2*w1, h); } 00044 QSize sizeHint() const { 00045 return QSize(w+2*w1, h); } 00046 00047 00048 public slots: 00049 void setCenterZoom(float, float); 00050 00051 protected: 00052 void paintEvent(QPaintEvent *event); 00053 00054 int h; // Height of view window 00055 int w; // Width of selected range 00056 int w1; // Width of border region on each side of the selected range 00057 00058 float c; // Current center mark 00059 float z; // Current zoom width 00060 00061 const Histogram *histo; // pointer to histogram data 00062 const ColorTable *ct; 00063 }; 00064 00065 #endif