5 #include "../canvas/MapDisplay.h"
6 #include "../canvas/Canvas.h"
9 #include <QtCore/QPropertyAnimation>
10 #include <QtGui/QPainter>
11 #include <QtCore/QVector>
19 :
te::qt::widgets::
ImageItem(title, folder, display)
29 if (getCtlParameters() ==
false)
36 m_animation->m_spatialExtent =
te::gm::Envelope(m_imaRect.x(), m_imaRect.y(), m_imaRect.right(), m_imaRect.bottom());
37 m_animation->setEasingCurve(QEasingCurve::Linear);
40 QStringList nameFilter;
41 nameFilter.append(
"*.bin");
42 QStringList files = m_dir.entryList(nameFilter, QDir::Files, QDir::Name);
43 size_t count = files.count();
52 for (
size_t i = 0; i < count; ++i)
54 QString f = files[(int)i];
68 QString file(m_dir.path() +
"/racc.ctl");
69 FILE* fp = fopen(file.toStdString().c_str(),
"r");
73 fread(buf, 2000,
sizeof(
char), fp);
75 QString s, ss(QString(buf).simplified());
78 if(!(ss.contains(
"undef ", Qt::CaseInsensitive) && ss.contains(
"title", Qt::CaseInsensitive) &&
79 ss.contains(
"xdef", Qt::CaseInsensitive) && ss.contains(
"ydef", Qt::CaseInsensitive) &&
80 ss.contains(
"linear", Qt::CaseInsensitive) && ss.contains(
"zdef", Qt::CaseInsensitive)))
87 size_t pos = ss.indexOf(
"UNDEF ", Qt::CaseInsensitive) + strlen(
"UNDEF ");
88 ss.remove(0, (
int)pos);
89 pos = ss.indexOf(
"TITLE", Qt::CaseInsensitive);
90 s = ss.left((
int)pos);
91 m_undef = atoi(s.toStdString().c_str());
92 ss.remove(0, (
int)pos);
95 pos = ss.indexOf(
"XDEF ", Qt::CaseInsensitive) + strlen(
"XDEF ");
96 ss.remove(0, (
int)pos);
97 pos = ss.indexOf(
" ");
98 s = ss.left((
int)pos);
99 m_ncols = atoi(s.toStdString().c_str());
100 ss.remove(0, (
int)pos);
102 pos = ss.indexOf(
"LINEAR ", Qt::CaseInsensitive) + strlen(
"LINEAR ");
103 ss.remove(0, (
int)pos);
104 pos = ss.indexOf(
" ");
105 s = ss.left((
int)pos);
106 double llx = atof(s.toStdString().c_str()) - 360.;
107 ss.remove(0, (
int)pos);
108 pos = ss.indexOf(
"YDEF ", Qt::CaseInsensitive);
109 s = ss.left((
int)pos);
110 double resX = atof(s.toStdString().c_str());
111 ss.remove(0, (
int)pos);
114 pos = ss.indexOf(
"YDEF ", Qt::CaseInsensitive) + strlen(
"YDEF ");
115 ss.remove(0, (
int)pos);
116 pos = ss.indexOf(
" ");
117 s = ss.left((
int)pos);
118 m_nlines = atoi(s.toStdString().c_str());
119 ss.remove(0, (
int)pos);
121 pos = ss.indexOf(
"LINEAR ", Qt::CaseInsensitive) + strlen(
"LINEAR ");
122 ss.remove(0, (
int)pos);
123 pos = ss.indexOf(
" ");
124 s = ss.left((
int)pos);
125 double lly = atof(s.toStdString().c_str());
126 ss.remove(0, (
int)pos);
127 pos = ss.indexOf(
"ZDEF ", Qt::CaseInsensitive);
128 s = ss.left((
int)pos);
129 double resY = atof(s.toStdString().c_str());
130 ss.remove(0, (
int)pos);
132 double w = (double)m_ncols * resX;
133 double h = (double)m_nlines * resY;
134 m_imaRect = QRectF(llx, lly, w, h);
145 QString path = m_dir.absolutePath() +
"/";
146 QString file = m_currentImageFile;
148 QString baseName = fi.baseName();
150 if (m_suffix ==
".bin" && baseName ==
"racc")
152 size_t nchars = m_ncols * 2;
153 uchar* buf =
new uchar[nchars];
154 FILE* fp = fopen(file.toStdString().c_str(),
"rb");
155 m_image =
new QImage((
int)m_ncols, (
int)m_nlines, QImage::Format_ARGB32);
156 m_image->fill(Qt::transparent);
160 for (
size_t j = 0; j < m_nlines; ++j)
162 uchar* u = m_image->scanLine((
int)j);
163 fread(buf, nchars,
sizeof(
char), fp);
164 for (
size_t i = 0; i < m_ncols; i++)
166 uc[0] = *(buf + (i << 1));
167 uc[1] = *(buf + (1 + (i << 1)));
168 ushort b = *(ushort*)uc;
172 QRgb* v = (QRgb*)(u + (i << 2));
173 *v = qRgba(m_lut[b].red(), m_lut[b].green(), m_lut[b].blue(), 255);
184 QString file(fileName);
185 int ind = file.indexOf(
"racc.") + (int)strlen(
"racc.");
187 QString ano =
"20" + file.mid(0, 2);
188 QString mes = file.mid(2, 2);
189 QString dia = file.mid(4, 2);
190 QString hour = file.mid(7, 2);
191 QString min = file.mid(9, 2);
193 te::dt::Date date(ano.toInt(), mes.toInt(), dia.toInt());
200 std::vector<std::pair<int, QColor> > tab;
202 tab.push_back(std::pair<int, QColor>(i += 3, QColor(2, 1, 201, 255)));
203 tab.push_back(std::pair<int, QColor>(i += 3, QColor(1, 71, 254, 255)));
204 tab.push_back(std::pair<int, QColor>(i += 3, QColor(3, 148, 250, 255)));
205 tab.push_back(std::pair<int, QColor>(i += 3, QColor(5, 200, 251, 255)));
206 tab.push_back(std::pair<int, QColor>(i += 3, QColor(2, 254, 233, 255)));
207 tab.push_back(std::pair<int, QColor>(i += 3, QColor(1, 254, 151, 255)));
208 tab.push_back(std::pair<int, QColor>(i += 3, QColor(2, 254, 4, 255)));
209 tab.push_back(std::pair<int, QColor>(i += 3, QColor(99, 254, 2, 255)));
210 tab.push_back(std::pair<int, QColor>(i += 3, QColor(200, 255, 1, 255)));
211 tab.push_back(std::pair<int, QColor>(i += 3, QColor(237, 255, 0, 255)));
212 tab.push_back(std::pair<int, QColor>(i += 3, QColor(251, 232, 2, 255)));
213 tab.push_back(std::pair<int, QColor>(i += 3, QColor(254, 199, 2, 255)));
214 tab.push_back(std::pair<int, QColor>(i += 3, QColor(252, 179, 2, 255)));
215 tab.push_back(std::pair<int, QColor>(i += 3, QColor(254, 147, 4, 255)));
216 tab.push_back(std::pair<int, QColor>(i += 3, QColor(253, 99, 2, 255)));
217 tab.push_back(std::pair<int, QColor>(i += 3, QColor(254, 1, 2, 255)));
218 tab.push_back(std::pair<int, QColor>(i += 3, QColor(254, 0, 49, 255)));
219 tab.push_back(std::pair<int, QColor>(i += 3, QColor(255, 5, 1, 255)));
A class to represent time instant.
This file defines a class for a Animation Scene.
An Envelope defines a 2D rectangular region.
A base class for date data types.
A class to represent time period.
This file defines a class for a Trajectory Animation.
A class to represent time duration with nano-second/micro-second resolution.