PSQt/include/WdgColorTable.h

Go to the documentation of this file.
00001 #ifndef WDGCOLORTABLE_H
00002 #define WDGCOLORTABLE_H
00003 
00004 #include <QWidget>
00005 #include <QLabel>
00006 #include <QPainter>
00007 #include <QPixmap>
00008 
00009 #include <Qt>
00010 #include <QtGui>
00011 #include <QtCore>
00012 
00013 #include "PSQt/LabColorRing.h"
00014 #include "PSQt/QGUtils.h"
00015 #include "ndarray/ndarray.h"
00016 
00017 namespace PSQt {
00018 
00019 /**
00020  *  @ingroup PSQt
00021  * 
00022  *  @brief Widget showing colot wheel and setting parameters (hue angles) for color table.
00023  * 
00024  *  @code
00025  *  @endcode
00026  *
00027  *  This software was developed for the LCLS project.  If you use all or 
00028  *  part of it, please give an appropriate acknowledgment.
00029  *
00030  *  @see GUIImageViewer
00031  *
00032  *  @version $Id: WdgColorTable.h 9841 2015-03-26 18:35:44Z dubrovin@SLAC.STANFORD.EDU $
00033  *
00034  *  @author Mikhail Dubrovin
00035  */
00036 
00037 class WdgColorTable : public QWidget
00038 {
00039  Q_OBJECT // macro is needed for connection of signals and slots
00040 
00041  public:
00042     WdgColorTable( QWidget *parent = 0, const float& h1=260, const float& h2=-60, const unsigned& colors=1024 );
00043 
00044     void setFrame() ;
00045     void setStyle() ;
00046     void showTips() ;
00047 
00048     void closeEvent      (QCloseEvent  *event = 0) ;
00049     void moveEvent       (QMoveEvent   *event = 0) ;
00050 
00051     void setColorBar( const float&    hue1=0,
00052                       const float&    hue2=360,
00053                       const unsigned& rows=40,
00054                       const unsigned& cols=256
00055                       );
00056 
00057     float getH1() {return m_h1;}
00058     float getH2() {return m_h2;}
00059 
00060     uint32_t* getColorTable(const unsigned& colors=1024) { return ColorTable(colors, m_h1, m_h2); }
00061     uint32_t* getColorTable(const unsigned& colors, const float& h1, const float& h2) { 
00062               return ColorTable(colors, h1, h2); }
00063 
00064     ndarray<uint32_t,1> getColorTableAsNDArray(const unsigned& colors=1024);
00065 
00066  protected :
00067 
00068     void mousePressEvent (QMouseEvent  *event = 0) ;
00069     void mouseMoveEvent  (QMouseEvent  *event = 0) ;
00070     void resizeEvent     (QResizeEvent *event = 0) ;
00071 
00072     //bool eventFilter     (QObject *obj, QEvent *event = 0) ;
00073 
00074 
00075  signals :
00076 
00077     void hueAnglesUpdated(const float&, const float&) ;
00078     void hueAngleIsEdited(const unsigned& edited) ;
00079 
00080  public slots:
00081 
00082     void onButExit() ;
00083     void onEdiH1() ;
00084     void onEdiH2() ;
00085     void onButApply() ;
00086     void onSetH(const unsigned& selected) ;
00087     void onHueAngleIsChanged() ;
00088     void testSignalHueAnglesUpdated(const float&, const float&) ;
00089 
00090  private:
00091 
00092     float         m_h1;
00093     float         m_h2;
00094     unsigned      m_colors;
00095     unsigned      m_figsize;
00096     unsigned      m_cbar_width;
00097 
00098     QFrame*       m_frame;
00099     LabColorRing* m_lab_cring;
00100     QLabel*       m_lab_cbar;
00101     QLabel*       m_lab_h1;
00102     QLabel*       m_lab_h2;
00103     QLineEdit*    m_edi_h1;
00104     QLineEdit*    m_edi_h2;
00105     QPushButton*  m_but_apply;
00106 
00107     QPixmap*      m_pixmap_cbar;
00108     inline const char* _name_(){return "WdgColorTable";}
00109 };
00110 
00111 } // namespace PSQt
00112 
00113 #endif // WDGCOLORTABLE_H

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7