27 #include "../../../dataaccess/Exception.h"
28 #include "../../../geometry/Envelope.h"
29 #include "../../../maptools/AbstractLayer.h"
39 connect(
this, SIGNAL(started()), SLOT(
onStarted()));
40 connect(
this, SIGNAL(finished()), SLOT(
onFinished()));
60 m_finishedWithSuccess =
true;
61 m_errorMessage.clear();
64 if(m_image.size() != size)
66 m_image = QImage(size, QImage::Format_ARGB32_Premultiplied);
67 m_image.fill(qRgba(0, 0, 0, 0));
76 return m_finishedWithSuccess;
81 return m_errorMessage;
94 canvas.
calcAspectRatio(m_env.m_llx, m_env.m_lly, m_env.m_urx, m_env.m_ury);
95 canvas.
setWindow(m_env.m_llx, m_env.m_lly, m_env.m_urx, m_env.m_ury);
103 m_layer->draw(&canvas, m_env, m_srid);
106 catch(
const te::da::Exception& e)
110 m_finishedWithSuccess =
false;
111 m_errorMessage = QString(tr(
"The layer") +
" %1 " + tr(
"could not be drawn! Details:") +
" %2").arg(m_layer->getTitle().c_str()).arg(e.what());
116 catch(
const std::exception& e)
118 m_finishedWithSuccess =
false;
119 m_errorMessage = QString(tr(
"The layer") +
" %1 " + tr(
"could not be drawn! Details:") +
" %2").arg(m_layer->getTitle().c_str()).arg(e.what());
127 m_feedback.start(m_interval);
132 emit feedback(m_image);
137 emit drawLayerFinished(m_index, m_image);
138 m_image.fill(qRgba(0, 0, 0, 0));
QTimer m_feedback
Timer used to send feedback. The feedback will be sent right after timeout() QTimer's signal...
This is the base class for layers.
bool finishedWithSuccess() const
This method tells if the thread finished with success.
DrawLayerThread(QObject *parent=0)
It constructs a new thread responsible to draw a given layer.
A canvas built on top of Qt.
~DrawLayerThread()
Destructor.
void draw(te::map::AbstractLayer *layer, const te::gm::Envelope &box, int srid, const QSize &size, const int &index)
This method is used to request the draw of the given layer.
A canvas built on top of Qt.
void calcAspectRatio(double &llx, double &lly, double &urx, double &ury, const te::map::AlignType hAlign=te::map::Center, const te::map::AlignType vAlign=te::map::Center)
It calculates the best aspect ratio for world (or window) coordinates area (supposing a cartesian ref...
void clear()
It clears the canvas content and fills with the background color.
An Envelope defines a 2D rectangular region.
void setWindow(const double &llx, const double &lly, const double &urx, const double &ury)
It sets the world (or window) coordinates area (supposing a cartesian reference system).
QString getErrorMessage() const
This method returns an error message if the thread has not finished with success. Otherwise...
This class represents a thread responsible to draw a given layer. Basically, this class receives draw...
te::map::AbstractLayer * getLayer() const
This method returns the layer handled by this thread.