00001 #ifndef PSQT_WDGIMAGE_H
00002 #define PSQT_WDGIMAGE_H
00003
00004 #include "PSQt/GeoImage.h"
00005
00006 #include <QWidget>
00007 #include <QLabel>
00008 #include <QFrame>
00009 #include <QPainter>
00010 #include <QPen>
00011
00012 #include <QPoint>
00013 #include <QRect>
00014
00015 #include <QPixmap>
00016 #include <QImage>
00017 #include <QBitmap>
00018
00019 #include <QCloseEvent>
00020 #include <QResizeEvent>
00021 #include <QMouseEvent>
00022
00023
00024
00025
00026
00027
00028 #include <QtCore>
00029
00030
00031 namespace PSQt {
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 class WdgImage : public QLabel
00068 {
00069 Q_OBJECT
00070
00071 public:
00072 typedef GeoImage::image_t image_t;
00073
00074
00075 WdgImage(QWidget *parent = 0, const std::string& fname=std::string());
00076 WdgImage(QWidget *parent, const QImage* image);
00077 virtual ~WdgImage();
00078
00079 inline QPainter* getPainter(){ return m_painter; }
00080
00081
00082 QPointF pointInImage(const QPointF& point_raw);
00083 QPointF pointInRaw(const QPointF& point_raw);
00084
00085
00086 public slots:
00087 void onImageIsUpdated(ndarray<GeoImage::raw_image_t,2>&);
00088 void onFileNameChanged(const std::string& fname);
00089 void onTest();
00090 void onZoomResetButton();
00091 void onPressOnAxes(QMouseEvent* e, QPointF p);
00092 void onHueAnglesUpdated(const float&, const float&);
00093 void testSignalZoomIsChanged(int&, int&, int&, int&, float&, float&);
00094
00095 signals :
00096 void zoomIsChanged(int&, int&, int&, int&, float&, float&);
00097 void mouseInPoint(const float&, const float&, const float&);
00098
00099 protected:
00100
00101 int m_xmin_raw;
00102 int m_xmax_raw;
00103 int m_ymin_raw;
00104 int m_ymax_raw;
00105
00106 QPixmap* m_pixmap_raw;
00107 QPixmap* m_pixmap_scl;
00108
00109 void setFrame() ;
00110 void paintEvent(QPaintEvent *event = 0) ;
00111 void closeEvent(QCloseEvent *event = 0) ;
00112 void resizeEvent(QResizeEvent *event = 0) ;
00113 void mousePressEvent(QMouseEvent *event = 0) ;
00114 void mouseReleaseEvent(QMouseEvent *event = 0) ;
00115 void mouseMoveEvent(QMouseEvent *event = 0) ;
00116 void loadImageFromFile(const std::string& fname=std::string()) ;
00117
00118 void drawRect() ;
00119 void zoomInImage() ;
00120 void setPixmapScailedImage(const QImage* = 0) ;
00121
00122 void setCameraImage( const std::string& fname_geo=std::string()
00123 , const std::string& fname_img=std::string()) ;
00124 void setColorPixmap() ;
00125 void setColorWhellPixmap() ;
00126 void setColorBar(const unsigned& rows = 20,
00127 const unsigned& cols = 1024,
00128 const float& hue1 = -120,
00129 const float& hue2 = 60) ;
00130
00131 private:
00132 QFrame* m_frame;
00133 QPainter* m_painter;
00134
00135 GeoImage* m_geo_img;
00136
00137 QPen* m_pen1;
00138 QPen* m_pen2;
00139 QPoint* m_point1;
00140 QPoint* m_point2;
00141 QRect* m_rect1;
00142 QRect* m_rect2;
00143 bool m_is_pushed;
00144 bool m_zoom_is_on;
00145
00146 float m_amin;
00147 float m_amax;
00148 unsigned m_ncolors;
00149 float m_hue1;
00150 float m_hue2;
00151
00152
00153 ndarray<GeoImage::raw_image_t,2>* p_nda_img_raw;
00154
00155 inline const char* _name_(){return "WdgImage";}
00156 void setWdgParams() ;
00157 void resetZoom() ;
00158 void setIntensityRange(const float& amin, const float& amax);
00159 void setNormImage(const ndarray<GeoImage::image_t,2>&) ;
00160 void getIntensityLimits(float& imin, float& imax);
00161 void getIntensityLimitsV1(float& imin, float& imax);
00162 };
00163
00164 }
00165
00166 #endif // PSQT_WDGIMAGE_H