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)
38 QStringList nameFilter;
39 nameFilter.append(
"*.bin");
40 QStringList files =
m_dir.entryList(nameFilter, QDir::Files, QDir::Name);
41 size_t count = files.count();
50 for (
size_t i = 0; i < count; ++i)
52 QString f = files[(
int)i];
71 size_t n = fread(buf,
sizeof(
char), 500, fp);
74 QString s, ss(QString(buf).simplified());
77 if (!(ss.contains(
"undef ", Qt::CaseInsensitive) && ss.contains(
"title", Qt::CaseInsensitive) &&
78 ss.contains(
"xdef", Qt::CaseInsensitive) && ss.contains(
"ydef", Qt::CaseInsensitive) &&
79 ss.contains(
"linear", Qt::CaseInsensitive) && ss.contains(
"zdef", Qt::CaseInsensitive)))
86 size_t pos = ss.indexOf(
"UNDEF ", Qt::CaseInsensitive) + strlen(
"UNDEF ");
87 ss.remove(0, (
int)pos);
88 if (pos != std::string::npos)
90 pos = ss.indexOf(
"SRID", Qt::CaseInsensitive);
91 s = ss.left((
int)pos);
92 m_undef = atoi(s.toUtf8().data());
93 ss.remove(0, (
int)pos);
96 pos = ss.indexOf(
"SRID ", Qt::CaseInsensitive) + (
int)strlen(
"SRID ");
97 ss.remove(0, (
int)pos);
98 pos = ss.indexOf(
"XDEF ", Qt::CaseInsensitive);
99 s = ss.left((
int)pos);
100 m_SRID = atoi(s.toUtf8().data());
101 ss.remove(0, (
int)pos);
107 pos = ss.indexOf(
"XDEF ", Qt::CaseInsensitive) + strlen(
"XDEF ");
108 ss.remove(0, (
int)pos);
109 pos = ss.indexOf(
" ");
110 s = ss.left((
int)pos);
111 m_ncols = atoi(s.toUtf8().data());
112 ss.remove(0, (
int)pos);
114 pos = ss.indexOf(
"LINEAR ", Qt::CaseInsensitive) + strlen(
"LINEAR ");
115 ss.remove(0, (
int)pos);
116 pos = ss.indexOf(
" ");
117 s = ss.left((
int)pos);
118 double llx = atof(s.toUtf8().data()) - 360.;
119 ss.remove(0, (
int)pos);
120 pos = ss.indexOf(
"YDEF ", Qt::CaseInsensitive);
121 s = ss.left((
int)pos);
122 double resX = atof(s.toUtf8().data());
123 ss.remove(0, (
int)pos);
126 pos = ss.indexOf(
"YDEF ", Qt::CaseInsensitive) + strlen(
"YDEF ");
127 ss.remove(0, (
int)pos);
128 pos = ss.indexOf(
" ");
129 s = ss.left((
int)pos);
131 ss.remove(0, (
int)pos);
133 pos = ss.indexOf(
"LINEAR ", Qt::CaseInsensitive) + strlen(
"LINEAR ");
134 ss.remove(0, (
int)pos);
135 pos = ss.indexOf(
" ");
136 s = ss.left((
int)pos);
137 double lly = atof(s.toUtf8().data());
138 ss.remove(0, (
int)pos);
139 pos = ss.indexOf(
"ZDEF ", Qt::CaseInsensitive);
140 s = ss.left((
int)pos);
141 double resY = atof(s.toUtf8().data());
142 ss.remove(0, (
int)pos);
144 double w = (double)
m_ncols * resX;
149 if (
m_dir.exists(
"staticRepresentation.png"))
166 m_image =
new QImage(r.size(), QImage::Format_ARGB32);
167 m_image->fill(QColor(0, 0, 255, 100).rgba());
169 p.setPen(QPen(QColor(255, 0, 0)));
171 QFont font(p.font());
173 int w = (
int)((
double)
m_image->width() / 1.2);
176 font.setPointSize(ps);
177 QFontMetrics fm(font);
178 QRectF rec(fm.boundingRect(
m_title));
180 while (rec.width() < w && rec.height() < h)
183 font.setPointSize(ps);
184 QFontMetrics fm(font);
185 rec = fm.boundingRect(
m_title);
187 rec.moveCenter(
m_image->rect().center());
189 p.drawText(rec.toRect(), Qt::AlignLeft,
m_title);
196 QString path =
m_dir.absolutePath() +
"/";
199 QString baseName = fi.baseName();
201 if (
m_suffix ==
".bin" && baseName ==
"racc")
204 uchar* buf =
new uchar[nchars];
207 m_image->fill(Qt::transparent);
211 for (
size_t j = 0; j <
m_nlines; ++j)
213 uchar* u = m_image->scanLine((
int)j);
214 fread(buf, nchars,
sizeof(
char), fp);
215 for (
size_t i = 0; i <
m_ncols; i++)
217 uc[0] = *(buf + (i << 1));
218 uc[1] = *(buf + (1 + (i << 1)));
219 ushort
b = *(ushort*)uc;
223 QRgb* v = (QRgb*)(u + (i << 2));
236 QString
file(fileName);
237 int ind = file.indexOf(
"racc.") + (
int)strlen(
"racc.");
239 QString ano =
"20" + file.mid(0, 2);
240 QString mes = file.mid(2, 2);
241 QString dia = file.mid(4, 2);
242 QString hour = file.mid(7, 2);
243 QString min = file.mid(9, 2);
245 te::dt::Date date(ano.toInt(), mes.toInt(), dia.toInt());
252 std::vector<std::pair<int, QColor> > tab;
254 tab.push_back(std::pair<int, QColor>(i += 3, QColor(2, 1, 201, 255)));
255 tab.push_back(std::pair<int, QColor>(i += 3, QColor(1, 71, 254, 255)));
256 tab.push_back(std::pair<int, QColor>(i += 3, QColor(3, 148, 250, 255)));
257 tab.push_back(std::pair<int, QColor>(i += 3, QColor(5, 200, 251, 255)));
258 tab.push_back(std::pair<int, QColor>(i += 3, QColor(2, 254, 233, 255)));
259 tab.push_back(std::pair<int, QColor>(i += 3, QColor(1, 254, 151, 255)));
260 tab.push_back(std::pair<int, QColor>(i += 3, QColor(2, 254, 4, 255)));
261 tab.push_back(std::pair<int, QColor>(i += 3, QColor(99, 254, 2, 255)));
262 tab.push_back(std::pair<int, QColor>(i += 3, QColor(200, 255, 1, 255)));
263 tab.push_back(std::pair<int, QColor>(i += 3, QColor(237, 255, 0, 255)));
264 tab.push_back(std::pair<int, QColor>(i += 3, QColor(251, 232, 2, 255)));
265 tab.push_back(std::pair<int, QColor>(i += 3, QColor(254, 199, 2, 255)));
266 tab.push_back(std::pair<int, QColor>(i += 3, QColor(252, 179, 2, 255)));
267 tab.push_back(std::pair<int, QColor>(i += 3, QColor(254, 147, 4, 255)));
268 tab.push_back(std::pair<int, QColor>(i += 3, QColor(253, 99, 2, 255)));
269 tab.push_back(std::pair<int, QColor>(i += 3, QColor(254, 1, 2, 255)));
270 tab.push_back(std::pair<int, QColor>(i += 3, QColor(254, 0, 49, 255)));
271 tab.push_back(std::pair<int, QColor>(i += 3, QColor(255, 5, 1, 255)));
static std::string fromUTF8(const std::string &src)
Convert a string in UTF-8 to the current locale encoding.
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.
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 $