DrawThread.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9 
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14 
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19 
20 /*!
21 \file terralib/qt/widgets/canvas/DrawThread.h
22 
23 \brief Thread to draw a Layer in a PaintDevice.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_DRAWTHREAD_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_DRAWTHREAD_H
28 
29 //TerraLib
30 #include "../../../maptools/Enums.h"
31 
32 // Qt
33 #include <QColor>
34 #include <QObject>
35 #include <QRunnable>
36 
37 class QPaintDevice;
38 class QSize;
39 
40 namespace te
41 {
42  namespace gm
43  {
44  class Envelope;
45  }
46 
47  namespace map
48  {
49  class AbstractLayer;
50  }
51 
52  namespace qt
53  {
54  namespace widgets
55  {
56  class DrawThread : public QObject, public QRunnable
57  {
58  Q_OBJECT
59 
60  public:
61 
62  DrawThread(QPaintDevice* dev, te::map::AbstractLayer* layer, te::gm::Envelope* env, const QColor& bckGround, int srid, double scale,
63  te::map::AlignType hAlign, te::map::AlignType vAlign);
64 
65  ~DrawThread();
66 
67  void run();
68 
69  bool hasFinished() const;
70 
71  QString errorMessage() const;
72 
73  QString layerId() const;
74 
75  Q_SIGNALS:
76 
77  void finished();
78 
79  protected:
80 
81  QPaintDevice* m_device;
82 
84 
86 
87  QColor m_bckGround;
88 
89  int m_srid;
90 
91  double m_scale;
92 
93  te::map::AlignType m_hAlign; //!< The display horizontal align.
94 
95  te::map::AlignType m_vAlign; //!< The display vertical align.
96 
97  public:
98 
99  bool m_cancel;
100 
101  protected:
102 
104 
105  QString m_errorMessage;
106  };
107  }
108  }
109 }
110 
111 #endif //__TERRALIB_QT_WIDGETS_INTERNAL_DRAWTHREAD_H
QString layerId() const
This is the base class for layers.
Definition: AbstractLayer.h:76
QString errorMessage() const
te::gm::Envelope * m_envelope
Definition: DrawThread.h:85
DrawThread(QPaintDevice *dev, te::map::AbstractLayer *layer, te::gm::Envelope *env, const QColor &bckGround, int srid, double scale, te::map::AlignType hAlign, te::map::AlignType vAlign)
AlignType
This enum contains values to control the alignment of components (like Canvas and MapDisplay)...
Definition: Enums.h:125
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
URI C++ Library.
te::map::AbstractLayer * m_layer
Definition: DrawThread.h:83
QPaintDevice * m_device
Definition: DrawThread.h:81
te::map::AlignType m_hAlign
The display horizontal align.
Definition: DrawThread.h:93
te::map::AlignType m_vAlign
The display vertical align.
Definition: DrawThread.h:95