ddt  0.1
ddtCPLImageGraphicsItem.hpp
Go to the documentation of this file.
1 // @copyright
2 // (c) Copyright ESO 2020
3 // All Rights Reserved
4 // ESO (eso.org) is an Intergovernmental Organization, and therefore special
5 // legal conditions apply.
6 //
7 // @file ddtCPLImageGraphicsItem.hpp
8 // @brief DDT Widgets. Class for CPL Image Graphics Items.
9 //
10 // Class derived from QGraphicsItem. Allows to render a CPL image as a
11 // QGraphicsItem.
12 //
13 // @author Carsten Mannel, CGI
14 // @since 2020/02/28
15 //
16 
17 #ifndef DDT_DATAVISUALISATION_DDTWIDGETS_CPL_IMAGE_GRAPHICSITEM_HPP
18 #define DDT_DATAVISUALISATION_DDTWIDGETS_CPL_IMAGE_GRAPHICSITEM_HPP
19 
20 
22 #include "ddt/imageColor.hpp"
23 
24 #include <cpl.h>
25 
29 class DdtCPLImageGraphicsItem : public QGraphicsItem {
30  public:
39  DdtCPLImageGraphicsItem(cpl_image* image);
40 
47  DdtCPLImageGraphicsItem(cpl_image* image, ddt::colorMap_t* color_map,
48  ddt::scalingLut_t* scaling_lut);
49 
57  DdtCPLImageGraphicsItem(cpl_image* image, ddt::colorMapARGB_t* color_map,
58  ddt::scalingLut_t* scaling_lut);
59 
63  virtual ~DdtCPLImageGraphicsItem();
64 
69  QRectF boundingRect() const;
76  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
77  QWidget* widget);
78 
83  virtual QImage* GetImage();
84 
88  enum { Type = UserType + 500 };
89 
94  int type() const;
95 
96  protected:
100  cpl_image* image;
104  QImage* qimage;
105 
106  private:
107  int width;
108  int height;
109 
114  void loadImageGrayColor(cpl_image* image);
115 
121  void loadImageGrayColorInt(cpl_image* image);
122 
128  void loadImageGrayColorFloat(cpl_image* image);
129 
135  void loadImageGrayColorDouble(cpl_image* image);
136 
143  void loadImageColor(cpl_image* image, ddt::colorMap_t* color_map,
144  ddt::scalingLut_t* scaling_lut);
153  void loadImageColorInt(cpl_image* image, ddt::colorMap_t* color_map,
154  ddt::scalingLut_t* scaling_lut);
162  void loadImageColorFloat(cpl_image* image, ddt::colorMap_t* color_map,
163  ddt::scalingLut_t* scaling_lut);
171  void loadImageColorDouble(cpl_image* image, ddt::colorMap_t* color_map,
172  ddt::scalingLut_t* scaling_lut);
173 
180  void loadImageColor(cpl_image* image, ddt::colorMapARGB_t* color_map,
181  ddt::scalingLut_t* scaling_lut);
189  void loadImageColorInt(cpl_image* image, ddt::colorMapARGB_t* color_map,
190  ddt::scalingLut_t* scaling_lut);
198  void loadImageColorFloat(cpl_image* image, ddt::colorMapARGB_t* color_map,
199  ddt::scalingLut_t* scaling_lut);
200 
208  void loadImageColorDouble(cpl_image* image, ddt::colorMapARGB_t* color_map,
209  ddt::scalingLut_t* scaling_lut);
210 };
211 
212 #endif // DDT_DATAVISUALISATION_DDTWIDGETS_CPL_IMAGE_GRAPHICSITEM_HPP
ddt::scalingLut_t
Definition: imageColor.hpp:72
DdtCPLImageGraphicsItem::~DdtCPLImageGraphicsItem
virtual ~DdtCPLImageGraphicsItem()
Definition: ddtCPLImageGraphicsItem.cpp:66
DdtCPLImageGraphicsItem
Definition: ddtCPLImageGraphicsItem.hpp:29
ddt::colorMapARGB_t
std::array< unsigned int, MAX_COLOR_MAP_ENTRIES > colorMapARGB_t
Definition: imageColor.hpp:62
DdtCPLImageGraphicsItem::qimage
QImage * qimage
Definition: ddtCPLImageGraphicsItem.hpp:104
DdtCPLImageGraphicsItem::GetImage
virtual QImage * GetImage()
Definition: ddtCPLImageGraphicsItem.cpp:84
imageColor.hpp
DdtCPLImageGraphicsItem::boundingRect
QRectF boundingRect() const
Definition: ddtCPLImageGraphicsItem.cpp:68
DdtCPLImageGraphicsItem::DdtCPLImageGraphicsItem
DdtCPLImageGraphicsItem()
Definition: ddtCPLImageGraphicsItem.cpp:23
ddtImageGraphicsItem.hpp
DdtCPLImageGraphicsItem::type
int type() const
Definition: ddtCPLImageGraphicsItem.cpp:72
DdtCPLImageGraphicsItem::paint
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: ddtCPLImageGraphicsItem.cpp:77
DdtCPLImageGraphicsItem::Type
@ Type
Definition: ddtCPLImageGraphicsItem.hpp:88
ddt::colorMap_t
std::array< std::array< float, COLOR_MAP_ENTRY_SIZE >, MAX_COLOR_MAP_ENTRIES > colorMap_t
Definition: imageColor.hpp:52
DdtCPLImageGraphicsItem::image
cpl_image * image
Definition: ddtCPLImageGraphicsItem.hpp:100