All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Utils.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2010-2013 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 Utils.cpp
22 
23  \brief This file contains a set of utility chart functions
24 */
25 
26 // TerraLib
27 #include "../../../color/RGBAColor.h"
28 #include "../../../common/progress/TaskProgress.h"
29 #include "../../../dataaccess/dataset/DataSet.h"
30 #include "../../../dataaccess/dataset/DataSetType.h"
31 #include "../../../dataaccess/dataset/ObjectId.h"
32 #include "../../../dataaccess/dataset/ObjectIdSet.h"
33 #include "../../../dataaccess/utils/Utils.h"
34 #include "../../../datatype.h"
35 #include "../../../raster.h"
36 #include "../../../maptools/ExternalGraphicRendererManager.h"
37 #include "../../../maptools/MarkRendererManager.h"
38 #include "../../../qt/widgets/Utils.h"
39 #include "../../../se/Utils.h"
40 #include "../../../se.h"
41 #include "ChartDisplay.h"
42 #include "ChartDisplayWidget.h"
43 #include "ChartStyle.h"
44 #include "Histogram.h"
45 #include "HistogramChart.h"
46 #include "Scatter.h"
47 #include "ScatterChart.h"
48 #include "Utils.h"
49 
50 //Boost
51 #include <boost/lexical_cast.hpp>
52 
53 //QT
54 #include <QPen>
55 
56 //STL
57 #include <memory>
58 
59 double getDouble(const std::string& value, std::vector<std::string>& sVector)
60 {
61  //verify if it exists
62  for(std::size_t i=0;i<sVector.size();++i)
63  {
64  if(value==sVector[i])
65  return (double)i;
66  }
67 
68  sVector.push_back(value);
69  return (double)sVector.size()-1;
70 }
71 
72 double getDouble(te::dt::DateTime* dateTime)
73 {
74  if(dateTime->getTypeCode() == te::dt::TIME_INSTANT)
75  {
76  std::auto_ptr<te::dt::TimeInstant> ti ((te::dt::TimeInstant*)dateTime);
77  boost::gregorian::date basedate(1400, 01, 01);
78  boost::gregorian::date_duration days = ti->getDate().getDate() - basedate;
79  long long int seconds = ti->getTime().getTimeDuration().total_seconds();
80  long long int dias = days.days();
81  double v = (double) dias * 86400 + seconds;
82  return v;
83  }
84  else if(dateTime->getTypeCode() == te::dt::DATE)
85  {
86  std::auto_ptr<te::dt::Date> d ((te::dt::Date*)dateTime);
87  boost::gregorian::date basedate(1400, 01, 01);
88  boost::gregorian::date_duration days = d->getDate() - basedate;
89  double v = days.days();
90  return v;
91  }
92  return 0.;
93 }
94 
95 double getDouble(te::da::DataSet* dataset, int propId)
96 {
97  double res = 0.;
98 
99  int propType = dataset->getPropertyDataType(propId);
100  switch (propType)
101  {
102  case(te::dt::INT16_TYPE):
103  res = dataset->getInt16(propId);
104  break;
105  case(te::dt::UINT16_TYPE):
106  res = dataset->getInt16(propId);
107  break;
108  case(te::dt::INT32_TYPE):
109  res = dataset->getInt32(propId);
110  break;
111  case(te::dt::UINT32_TYPE):
112  res = dataset->getInt32(propId);
113  break;
114  case(te::dt::INT64_TYPE):
115  res = dataset->getInt64(propId);
116  break;
117  case(te::dt::UINT64_TYPE):
118  res = dataset->getInt64(propId);
119  break;
120  case(te::dt::FLOAT_TYPE):
121  res = dataset->getFloat(propId);
122  break;
123  case(te::dt::NUMERIC_TYPE):
124  res = boost::lexical_cast<double>(dataset->getNumeric(propId));
125  break;
126  default:
127  res = dataset->getDouble(propId);
128  break;
129  }
130 
131  return res;
132 }
133 
134 void getObjectIds (te::da::DataSet* dataset, std::vector<std::size_t> pkeys, std::vector<te::da::ObjectId*>& valuesOIDs)
135 {
136  std::vector<size_t>::iterator it;
137  std::vector<std::string> propNames;
138 
139  for(it=pkeys.begin(); it!=pkeys.end(); ++it)
140  propNames.push_back(dataset->getPropertyName(*it));
141 
142  //The caller will take ownership of the generated pointers.
143  te::da::ObjectId* oid = te::da::GenerateOID(dataset, propNames);
144  valuesOIDs.push_back(oid);
145 }
146 
147 te::da::ObjectId* getObjectIds (te::da::DataSet* dataset, std::vector<std::size_t> pkeys)
148 {
149  std::vector<size_t>::iterator it;
150  std::vector<std::string> propNames;
151 
152  for(it=pkeys.begin(); it!=pkeys.end(); ++it)
153  propNames.push_back(dataset->getPropertyName(*it));
154 
155  //The caller will take ownership of the generated pointer.
156  te::da::ObjectId* oid = te::da::GenerateOID(dataset, propNames);
157  return oid;
158 }
159 
161 {
163 
164  std::vector<std::size_t> objIdIdx;
165  te::da::GetOIDPropertyPos(dataType, objIdIdx);
166 
167  std::map<double, std::vector<te::da::ObjectId*> > valuesIdsByinterval;
168  std::vector<te::da::ObjectId*> valuesOIds;
169 
170  std::size_t rpos = te::da::GetFirstPropertyPos(dataset, te::dt::RASTER_TYPE);
171  if(rpos != std::string::npos)
172  {
173  std::auto_ptr<te::rst::Raster> raster(dataset->getRaster(rpos));
174 
175  unsigned int nCol = raster->getNumberOfColumns();
176  unsigned int nLin = raster->getNumberOfRows();
177 
179  task.setTotalSteps(nCol);
180  task.setMessage("Scatter creation");
181 
182  for (unsigned int c=0; c < nCol; ++c)
183  {
184  if(!task.isActive())
185  {
186  break;
187  }
188 
189  for (unsigned int r=0; r <nLin; ++r)
190  {
191  double val1, val2;
192 
193  raster->getValue(c, r, val1, propX);
194  raster->getValue(c, r, val2, propY);
195 
196  newScatter->addX(val1);
197  newScatter->addY(val2);
198  }
199 
200  task.pulse();
201  }
202  }
203  else
204  {
205  int xType = dataset->getPropertyDataType(propX);
206  int yType = dataset->getPropertyDataType(propY);
207 
209  task.setTotalSteps(dataset->getNumProperties());
210  task.setMessage("Scatter creation");
211 
212  while(dataset->moveNext())
213  {
214 
215  if(!task.isActive())
216  {
217  break;
218  }
219 
220  double x_doubleValue = 0.;
221  double y_doubleValue = 0.;
222 
223  if((xType >= te::dt::INT16_TYPE && xType <= te::dt::UINT64_TYPE) ||
224  xType == te::dt::FLOAT_TYPE || xType == te::dt::DOUBLE_TYPE ||
225  xType == te::dt::NUMERIC_TYPE)
226  {
227  if(dataset->isNull(propX))
228  continue;
229 
230  x_doubleValue = getDouble(dataset, propX);
231  }
232  else if(xType == te::dt::DATETIME_TYPE)
233  {
234  if(dataset->isNull(propX))
235  continue;
236 
237  std::auto_ptr<te::dt::DateTime> dateTime = dataset->getDateTime(propX);
238  x_doubleValue = getDouble(dateTime.get());
239  }
240 
241  //======treat the Y value
242  if((yType >= te::dt::INT16_TYPE && yType <= te::dt::UINT64_TYPE) ||
243  yType == te::dt::FLOAT_TYPE || yType == te::dt::DOUBLE_TYPE ||
244  yType == te::dt::NUMERIC_TYPE)
245  {
246  if(dataset->isNull(propY))
247  continue;
248  y_doubleValue = getDouble(dataset, propY);
249  }
250  else if(yType == te::dt::DATETIME_TYPE)
251  {
252  if(dataset->isNull(propY))
253  continue;
254 
255  std::auto_ptr<te::dt::DateTime> dateTime = dataset->getDateTime(propY);
256  y_doubleValue = getDouble(dateTime.get());
257  }
258 
259  //insert values into the vectors
260  newScatter->addData(x_doubleValue, y_doubleValue, getObjectIds(dataset, objIdIdx));
261  task.pulse();
262  } //end of the data set
263  }
264  newScatter->calculateMinMaxValues();
265  return newScatter;
266 }
267 
269 {
270  //Creating the scatter and it's chart with the given dataset
272 
273  //Creating and adjusting the chart Display's style.
275  chartStyle->setTitle(QString::fromStdString("Scatter"));
276  chartStyle->setAxisX(QString::fromStdString(dataset->getPropertyName(propX)));
277  chartStyle->setAxisY(QString::fromStdString(dataset->getPropertyName(propY)));
278 
279  //Creating and adjusting the chart Display
280  te::qt::widgets::ChartDisplay* chartDisplay = new te::qt::widgets::ChartDisplay(0, QString::fromStdString("Scatter"), chartStyle);
281  chartDisplay->adjustDisplay();
282  chart->attach(chartDisplay);
283 
284  //Adjusting the chart widget
286  displayWidget->show();
287  displayWidget->setWindowTitle("Scatter");
288  return displayWidget;
289 }
290 
292 {
293  if(slices <=1)
294  slices = 2;
295 
297 
298  std::size_t rpos = te::da::GetFirstPropertyPos(dataset, te::dt::RASTER_TYPE);
299  std::vector<std::size_t> objIdIdx;
300  te::da::GetOIDPropertyPos(dataType, objIdIdx);
301 
302  if(rpos != std::string::npos)
303  {
304  std::auto_ptr<te::rst::Raster> rstptr = dataset->getRaster(rpos);
305  std::map<double, unsigned int> values = rstptr->getBand(propId)->getHistogramR(0, 0, 0, 0, slices);
306 
307  for(std::map<double, unsigned int>::iterator it = values.begin(); it != values.end(); ++it)
308  {
309  newHistogram->insert(std::make_pair(new te::dt::Double(it->first), it->second));
310  }
311  }
312  else
313  {
314 
315  int propType = dataset->getPropertyDataType(propId);
316  newHistogram->setType(propType);
317 
318  //The vector containing the frequency of each interval, will be used to every property type
319  std::vector< unsigned int> values;
320 
321  if((propType >= te::dt::INT16_TYPE && propType <= te::dt::UINT64_TYPE) ||
322  propType == te::dt::FLOAT_TYPE || propType == te::dt::DOUBLE_TYPE || propType == te::dt::NUMERIC_TYPE)
323  {
324 
325  std::map<double, std::vector<te::da::ObjectId*> > intervalToOIds;
326  std::vector<te::da::ObjectId*> valuesOIds;
327 
328  double interval, minValue, maxValue;
329  minValue = std::numeric_limits<double>::max();
330  maxValue = -std::numeric_limits<double>::max();
331 
332  std::vector<double> intervals;
333 
335  task.setMessage("Histogram creation");
336  task.setTotalSteps((dataset->getNumProperties()) * 2);
337 
338  //Calculating the minimum and maximum values of the given property and adjusting the Histogram's interval.
339  dataset->moveBeforeFirst();
340  while(dataset->moveNext())
341  {
342 
343  if(!task.isActive())
344  {
345  break;
346  }
347 
348  //calculate range
349  if(minValue > getDouble(dataset, propId))
350  minValue = getDouble(dataset, propId);
351  if(maxValue < getDouble(dataset, propId))
352  maxValue = getDouble(dataset, propId);
353 
354  task.pulse();
355  }
356 
357  //Adjusting the interval to the user-defined number of slices.
358  interval = maxValue - minValue;
359  newHistogram->setInterval(interval/slices);
360 
361  //Adjusting the histogram's intervals
362  for (double i = minValue; i <(maxValue+newHistogram->getInterval()); i+=newHistogram->getInterval())
363  {
364  intervals.push_back(i);
365  intervalToOIds.insert(std::make_pair(i, valuesOIds));
366  }
367 
368  values.resize(intervals.size(), 0);
369 
370  dataset->moveBeforeFirst();
371 
372  //Adjusting the Histogram's values
373  while(dataset->moveNext())
374  {
375 
376  if(!task.isActive())
377  {
378  break;
379  }
380 
381  double currentValue = getDouble(dataset, propId);
382 
383  for (unsigned int i= 0; i<intervals.size(); ++i)
384  {
385  if((currentValue >= intervals[i]) && (currentValue <= intervals[i+1]))
386  {
387  values[i] = values[i]+1;
388  getObjectIds(dataset, objIdIdx, intervalToOIds.at(intervals[i]));
389  break;
390  }
391 
392  }
393  task.pulse();
394  }
395 
396  //With both the intervals and values ready, the map can be populated
397  for (unsigned int i= 0; i<intervals.size(); ++i)
398  {
399  te::dt::Double* data = new te::dt::Double(intervals[i]);
400  newHistogram->insert(std::make_pair(data, values[i]), intervalToOIds.at(intervals[i]));
401  }
402 
403  newHistogram->setMinValue(minValue);
404  dataset->moveBeforeFirst();
405 
406  }
407  }
408 
409  return newHistogram;
410 }
411 
413 {
415 
416  std::size_t rpos = te::da::GetFirstPropertyPos(dataset, te::dt::RASTER_TYPE);
417  std::vector<std::size_t> objIdIdx;
418  te::da::GetOIDPropertyPos(dataType, objIdIdx);
419 
421  task.setMessage("Histogram creation");
422 
423 
424  if(rpos != std::string::npos)
425  {
426  std::auto_ptr<te::rst::Raster> rstptr = dataset->getRaster(rpos);
427  std::map<double, unsigned int> values = rstptr->getBand(propId)->getHistogramR();
428 
429  for(std::map<double, unsigned int>::iterator it = values.begin(); it != values.end(); ++it)
430  {
431  task.pulse();
432  newHistogram->insert(std::make_pair(new te::dt::Double(it->first), it->second));
433  }
434  }
435  else
436  {
437  int propType = dataset->getPropertyDataType(propId);
438 
439  newHistogram->setType(propType);
440 
441  //The vector containing the frequency of each interval, will be used to every property type
442  std::vector< unsigned int> values;
443 
444  if(propType == te::dt::DATETIME_TYPE || propType == te::dt::STRING_TYPE)
445  {
446 
447  std::set <std::string> intervals;
448  std::set <std::string>::iterator intervalsIt;
449  std::map<std::string, std::vector<te::da::ObjectId*> > valuesIdsByinterval;
450  std::vector<te::da::ObjectId*> valuesOIds;
451 
452  //Adjusting the histogram's intervals
453 
454  dataset->moveBeforeFirst();
455  while(dataset->moveNext())
456  {
457 
458  if(!task.isActive())
459  {
460  break;
461  }
462 
463  std::string interval = dataset->getString(propId);
464 
465  //Every unique string will be an interval
466  intervals.insert(interval);
467  task.pulse();
468  }
469 
470  for (intervalsIt = intervals.begin(); intervalsIt != intervals.end(); ++intervalsIt)
471  {
472  valuesIdsByinterval.insert(make_pair((*intervalsIt), valuesOIds));
473  }
474 
475  values.resize(intervals.size(), 0);
476  dataset->moveBeforeFirst();
477  newHistogram->setStringInterval(intervals);
478 
479  //Adjusting the Histogram's values
480  while(dataset->moveNext())
481  {
482 
483  if(!task.isActive())
484  {
485  break;
486  }
487 
488  std::string currentValue = dataset->getString(propId);
489  int i;
490 
491  for ( i= 0, intervalsIt = intervals.begin(); intervalsIt != intervals.end(); ++intervalsIt,++i)
492  {
493  if(currentValue == *intervalsIt)
494  {
495  values[i] = values[i]+1;
496  getObjectIds(dataset, objIdIdx, valuesIdsByinterval.at(*intervalsIt));
497  break;
498  }
499  }
500  task.pulse();
501  }
502 
503  //With both the intervals and values ready, the map can be populated
504  int i;
505  for (i= 0, intervalsIt = intervals.begin(); intervalsIt != intervals.end(); ++intervalsIt,++i)
506  {
507  te::dt::String* data = new te::dt::String(*intervalsIt);
508  newHistogram->insert(std::make_pair(data, values[i]), valuesIdsByinterval.at(*intervalsIt));
509  }
510 
511  dataset->moveBeforeFirst();
512  }
513  }
514  return newHistogram;
515 }
516 
518 {
520  int propType = dataset->getPropertyDataType(propId);
521 
522  if(slices <=1)
523  slices = 2;
524 
525  //Creating the histogram and it's chart with the given dataset
526  if(propType == te::dt::DATETIME_TYPE || propType == te::dt::STRING_TYPE)
527  chart = new te::qt::widgets::HistogramChart(te::qt::widgets::createHistogram(dataset, dataType, propId));
528  else
529  chart = new te::qt::widgets::HistogramChart(te::qt::widgets::createHistogram(dataset, dataType, propId, slices));
530 
531  //Creating and adjusting the chart Display's style.
533  chartStyle->setTitle(QString::fromStdString("Histogram"));
534  chartStyle->setAxisX(QString::fromStdString(dataset->getPropertyName(propId)));
535  chartStyle->setAxisY(QString::fromStdString("Frequency"));
536 
537  //Creating and adjusting the chart Display
538  te::qt::widgets::ChartDisplay* chartDisplay = new te::qt::widgets::ChartDisplay(0, QString::fromStdString("Histogram"), chartStyle);
539  chartDisplay->adjustDisplay();
540  chart->attach(chartDisplay);
541 
542  //Adjusting the chart widget
544  displayWidget->show();
545  displayWidget->setWindowTitle("Histogram");
546  return displayWidget;
547 }
548 
549 QwtText* te::qt::widgets::Terralib2Qwt(const std::string& text)
550 {
551  QwtText* result = new QwtText(text.c_str());
552  result->setBackgroundBrush(QBrush(QColor(0, 255, 0)));
553  result->setBorderPen(QPen(Qt::red, 3, Qt::SolidLine));
554  return result;
555 }
556 
557 QwtText* te::qt::widgets::Terralib2Qwt(const std::string& text, te::color::RGBAColor* color,
558  te::se::Font* font, te::se::Fill* backFill,
559  te::se::Stroke* backStroke)
560 {
561  QwtText* result = new QwtText(QString(text.c_str()));
562 
563  return result;
564 }
565 
567 {
568  //Default symbol used in case the Graphic is not completely populated.
569  QwtSymbol* symbol = new QwtSymbol( QwtSymbol::Ellipse, QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ));
570 
571  //Default size and width for the symbols
572  size_t height = 8, width = 8;
573 
574  //Adjusting the size if the user changed it
575  if(graphic->getSize())
576  {
577  height = te::se::GetInt(graphic->getSize());
578  width = height;
579  }
580 
581  /*Image that will be used to generate the symbol's pixmap,
582  it can be either from a mark or from an external graphic, whichever is valid.
583  */
584  te::color::RGBAColor** image;
585 
586  if(!graphic->getMarks().empty())
587  {
588  image = te::map::MarkRendererManager::getInstance().render(graphic->getMarks()[0], height);
589  }
590  else
591  {
592  image = te::map::ExternalGraphicRendererManager::getInstance().render(graphic->getExternalGraphics()[0], height, width);
593  }
594 
595  QImage* qimg = te::qt::widgets::GetImage(image, height, width);
596  QPixmap pixmap;
597  pixmap = QPixmap::fromImage(*qimg);
598 
599  //Adjusting the symbol
600  symbol->setPixmap(pixmap);
601  symbol->setSize(width, height);
602 
603  delete image;
604  delete qimg;
605 
606  return symbol;
607 }
virtual std::auto_ptr< te::dt::DateTime > getDateTime(std::size_t i) const =0
Method for retrieving a date and time attribute value.
SimpleData< std::string, STRING_TYPE > String
Definition: SimpleData.h:229
virtual boost::int16_t getInt16(std::size_t i) const =0
Method for retrieving a 16-bit integer attribute value (2 bytes long).
void setMessage(const std::string &message)
Set the task message.
Utility functions for the data access module.
void adjustDisplay()
Updates the general display settings according to the ChartStyle. The adjusted properties are: Title;...
TEQTWIDGETSEXPORT ChartDisplayWidget * createHistogramDisplay(te::da::DataSet *dataset, te::da::DataSetType *dataType, int propId, int slices=10)
Histogram Creator.
Definition: Utils.cpp:517
virtual boost::int32_t getInt32(std::size_t i) const =0
Method for retrieving a 32-bit integer attribute value (4 bytes long).
void addY(double &yValue)
It adds a new value to the vector containing the Y axis values.
Definition: Scatter.cpp:151
TEDATAACCESSEXPORT ObjectId * GenerateOID(DataSet *dataset, const std::vector< std::string > &names)
Definition: Utils.cpp:397
const std::vector< ExternalGraphic * > getExternalGraphics() const
Definition: Graphic.cpp:76
TEQTWIDGETSEXPORT QwtText * Terralib2Qwt(const std::string &title)
Definition: Utils.cpp:549
A class that models the description of a dataset.
Definition: DataSetType.h:72
void attach(QwtPlot *plot)
It atttaches a QwtPlot to this Cahrt.
virtual boost::int64_t getInt64(std::size_t i) const =0
Method for retrieving a 64-bit integer attribute value (8 bytes long).
double getDouble(const std::string &value, std::vector< std::string > &sVector)
Definition: Utils.cpp:59
TEQTWIDGETSEXPORT Histogram * createHistogram(te::da::DataSet *dataset, te::da::DataSetType *dataType, int propId, int slices)
Histogram Creator.
Definition: Utils.cpp:291
TEQTWIDGETSEXPORT ChartDisplayWidget * createScatterDisplay(te::da::DataSet *dataset, te::da::DataSetType *dataType, int propX, int propY)
Scatter Creator.
Definition: Utils.cpp:268
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:53
virtual std::auto_ptr< te::rst::Raster > getRaster(std::size_t i) const =0
Method for retrieving a raster attribute value.
virtual std::string getNumeric(std::size_t i) const =0
Method for retrieving a numeric attribute value.
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition: Graphic.h:66
A class to represent a Histogram.
Definition: Histogram.h:56
void setTitle(QString newTitle)
It sets the style's title.
Definition: ChartStyle.cpp:71
bool isActive() const
Verify if the task is active.
virtual double getDouble(std::size_t i) const =0
Method for retrieving a double attribute value.
A class to represent time instant.
Definition: TimeInstant.h:55
void setTotalSteps(int value)
Set the task total stepes.
A class to represent a histogram.
void setStringInterval(std::set< std::string > new_Interval)
It sets the histogram's string set of intervals.
Definition: Histogram.cpp:108
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
void getObjectIds(te::da::DataSet *dataset, std::vector< std::size_t > pkeys, std::vector< te::da::ObjectId * > &valuesOIDs)
Definition: Utils.cpp:134
A class to represent a scatter.
Definition: Scatter.h:51
static MarkRendererManager & getInstance()
It returns a reference to the singleton instance.
virtual float getFloat(std::size_t i) const =0
Method for retrieving a float attribute value.
A base class for date data types.
Definition: Date.h:53
virtual std::string getPropertyName(std::size_t i) const =0
It returns the property name at position pos.
void setAxisY(QString newAxisY)
It sets the style's y axis label.
Definition: ChartStyle.cpp:101
virtual bool isNull(std::size_t i) const =0
It checks if the attribute value is NULL.
This class represents an unique id for a data set element.
Definition: ObjectId.h:47
void addX(double &xValue)
It adds a new value to the vector containing the X axis values.
Definition: Scatter.cpp:146
A Font specifies the text font to use in a text symbolizer.
Definition: Font.h:63
A class to represent a chart display.
Definition: ChartDisplay.h:65
void setAxisX(QString newAxisX)
It sets the style's x axis label.
Definition: ChartStyle.cpp:91
A class to represent a histogram chart.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
A Fill specifies the pattern for filling an area geometry.
Definition: Fill.h:59
void setInterval(double new_Interval)
It sets the histogram's interval.
Definition: Histogram.cpp:98
A class to represent a scatter chart.
Definition: ScatterChart.h:55
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
A class to represent a scatter's chart.
A class to represent a scatter.
TEQTWIDGETSEXPORT Scatter * createScatter(te::da::DataSet *dataset, te::da::DataSetType *dataType, int propX, int propY)
Scatter Creator.
Definition: Utils.cpp:160
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
A wdiget used to display a chart.
const std::vector< Mark * > getMarks() const
Definition: Graphic.cpp:98
TEDATAACCESSEXPORT void GetOIDPropertyPos(const DataSetType *type, std::vector< std::size_t > &ppos)
Definition: Utils.cpp:352
TEQTWIDGETSEXPORT QImage * GetImage(te::color::RGBAColor **img, int width, int height)
It creates a QImage from an RGBA color array.
Definition: Utils.cpp:63
A Stroke specifies the appearance of a linear geometry.
Definition: Stroke.h:67
virtual bool moveBeforeFirst()=0
It moves the internal pointer to a position before the first item in the collection.
SimpleData< double, DOUBLE_TYPE > Double
Definition: SimpleData.h:227
void setMinValue(double new_minValue)
It sets the histogram's minimum value.
Definition: Histogram.cpp:88
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
TESEEXPORT int GetInt(const te::se::ParameterValue *param)
It gets the parameter value as an integer.
Definition: Utils.cpp:443
int getTypeCode() const
It returns the data type code associated to date and time values: DATETIME_TYPE.
Definition: DateTime.h:103
void calculateMinMaxValues()
Calculates the minimum and maximum values for both the X and Y axis.
Definition: Scatter.cpp:53
A widget used to display a set of charts.
void insert(std::pair< te::dt::AbstractData *, unsigned int > new_value, std::vector< te::da::ObjectId * > valuesOIds)
It adds a new value to the map containing the histogram values.
Definition: Histogram.cpp:113
A class used to define a chartDisplay's style.
virtual std::string getString(std::size_t i) const =0
Method for retrieving a string value attribute.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
Definition: Utils.cpp:432
A template for atomic data types (integers, floats, strings and others).
Definition: SimpleData.h:59
double & getInterval()
It returns the histogram's interval. Will be invalid if the histogram was created based on string int...
Definition: Histogram.cpp:93
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos.
void addData(double &xValue, double &yValue, te::da::ObjectId *oid)
It adds the x and Y axis values to the scatter's vectors and the associeted objectId to the scatter's...
Definition: Scatter.cpp:156
A class to represent a chart display.
const ParameterValue * getSize() const
Definition: Graphic.cpp:120
void setType(int new_type)
It sets the histogram's type.
Definition: Histogram.cpp:58