5 #include "../canvas/MapDisplay.h" 6 #include "../canvas/Canvas.h" 9 #include <QtCore/QPropertyAnimation> 10 #include <QtGui/QPainter> 11 #include <QtCore/QVector> 12 #include <QtCore/QFile> 13 #include <QtCore/QMutex> 22 m_forwardColor(Qt::blue),
23 m_backwardColor(Qt::magenta),
30 if(file.isEmpty() ==
false)
37 QPainter painter(&pp);
38 painter.drawPixmap(pp.rect(),
p, p.rect());
47 pix.fill(Qt::transparent);
48 QPainter painter(&pix);
53 painter.drawEllipse(QRect(1, 1, 18, 18));
77 if(rm.contains(
m_pos) ==
false)
81 QPointF c = r.center();
82 QPointF dif =
m_pos - c;
83 double dw = fabs(dif.x());
84 double dh = fabs(dif.y());
93 if(dif.x() >= 0 && dif.y() >= 0)
94 cc = c + QPointF(mw, mh);
95 else if(dif.x() >= 0 && dif.y() < 0)
96 cc = c + QPointF(mw, -mh);
97 else if(dif.x() < 0 && dif.y() >= 0)
98 cc = c + QPointF(-mw, mh);
99 else if(dif.x() < 0 && dif.y() < 0)
100 cc = c + QPointF(-mw, -mh);
103 if(r.contains(
m_pos) ==
false)
109 e.
m_ury = r.bottom();
122 if(
m_animation->direction() == QAbstractAnimation::Forward)
141 this->
erase(curTime);
154 size_t size = vec.count();
156 for (
size_t i = 0; i < size; ++i)
157 line.
setPoint(i, vec[(
int)i].x(), vec[(
int)i].y());
161 for (
size_t i = 0; i < size; ++i)
174 if (ind == -1 || indold == -1)
177 QVector<QPointF> vec;
182 vec.push_back(
m_pos);
184 else if(
m_animation->direction() == QAbstractAnimation::Forward)
188 if(vec.isEmpty() ==
false && vec.last() !=
m_pos)
189 vec.push_back(
m_pos);
195 if(vec.isEmpty() ==
false && vec.last() !=
m_pos)
196 vec.push_back(
m_pos);
199 size_t size = vec.count();
205 QPolygon pol =
m_matrix.map(polf).toPolygon();
207 QPen pen(Qt::NoBrush, 2);
209 if(
m_animation->direction() == QAbstractAnimation::Forward)
213 pen.setColor(trailColor);
218 QPainter painter(scenePixmap);
220 painter.setBrush(Qt::NoBrush);
221 painter.drawPolyline(pol);
235 if (ind == -1 || indold == -1)
238 QVector<QPointF> vec;
242 vec.push_back(
m_pos);
244 else if(
m_animation->direction() == QAbstractAnimation::Backward)
249 vec.push_back(
m_pos);
256 vec.push_back(
m_pos);
259 size_t size = vec.count();
265 QPolygon pol =
m_matrix.map(polf).toPolygon();
267 QPen pen(Qt::NoBrush, 2);
268 QColor trailColor(Qt::white);
269 pen.setColor(trailColor);
274 QPainter painter(scenePixmap);
276 painter.setCompositionMode(QPainter::CompositionMode_DestinationOut);
277 painter.setBrush(Qt::NoBrush);
278 painter.drawPolyline(pol);
303 QVector<QPointF> vec;
304 if (
m_animation->direction() == QAbstractAnimation::Forward)
311 if (vec.isEmpty() ==
false && vec.last() !=
m_pos)
312 vec.push_back(
m_pos);
322 if (vec.isEmpty() ==
false && vec.last() !=
m_pos)
323 vec.push_back(
m_pos);
327 size_t size = vec.count();
333 QPolygon pol =
m_matrix.map(polf).toPolygon();
335 QPen pen(Qt::NoBrush, 2);
337 if (
m_animation->direction() == QAbstractAnimation::Forward)
342 pen.setColor(trailColor);
347 QPainter painter(scenePixmap);
349 painter.setBrush(Qt::NoBrush);
350 painter.drawPolyline(pol);
371 QVector<QPointF> vec;
372 if (
m_animation->direction() == QAbstractAnimation::Forward)
390 if (vec.isEmpty() ==
false)
392 double PI = 3.14159265;
393 QPointF
p = vec[1] - vec[0];
413 angle = atan(p.y() / p.x());
426 painter->translate(pos);
427 painter->scale(xScale, yScale);
430 painter->rotate(-angle);
431 painter->translate(-pos);
434 QRect r = pixmap().rect();
437 if (dr.intersects(r))
440 painter->drawPixmap(r, pixmap());
443 QSize size = pixmap().size();
444 int width = size.width();
445 int height = size.height();
446 QImage ima = pixmap().toImage();
448 if (ima.format() == QImage::Format_ARGB32)
450 for (
int i = 0; i < height; ++i)
452 unsigned char* u = ima.scanLine(i);
453 for (
int j = 0; j < width; ++j)
455 QRgb* v = (QRgb*)(u + (j << 2));
457 *v = qRgba(255, 255, 255, 0);
459 *v = qRgba(qRed(*v), qGreen(*v), qBlue(*v),
m_opacity);
462 painter->drawImage(r, ima);
466 QImage img(size, QImage::Format_ARGB32);
467 for (
int i = 0; i < height; ++i)
469 unsigned char* u = ima.scanLine(i);
470 unsigned char* uu = img.scanLine(i);
472 for (
int j = 0; j < width; ++j)
474 QRgb* v = (QRgb*)(u + (j << 2));
475 QRgb* uv = (QRgb*)(uu + (j << 2));
477 *uv = qRgba(255, 255, 255, 0);
479 *uv = qRgba(qRed(*v), qGreen(*v), qBlue(*v),
m_opacity);
482 painter->drawImage(r, img);
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
double m_urx
Upper right corner x-coordinate.
std::unique_ptr< Point > getPointN(std::size_t i) const
It returns the specified point in this LineString.
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
double getWidth() const
It returns the envelope width.
double m_llx
Lower left corner x-coordinate.
This file defines a class for a Animation Scene.
LineString is a curve with linear interpolation between points.
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point.
An Envelope defines a 2D rectangular region.
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
double m_lly
Lower left corner y-coordinate.
This file defines a class for a Trajectory Animation.
double m_ury
Upper right corner y-coordinate.
This file defines a class for a Trajectory Item.
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
double getHeight() const
It returns the envelope height.
file(WRITE ${CMAKE_BINARY_DIR}/config_qhelp.cmake"configure_file (${TERRALIB_ABSOLUTE_ROOT_DIR}/doc/qhelp/help.qhcp.in ${CMAKE_BINARY_DIR}/share/terraview/help/help.qhcp @ONLY)") add_custom_command(OUTPUT del_dir COMMAND $
void transform(int srid)
It converts the coordinate values of the linestring to the new spatial reference system.