27 #include "../common/StringUtils.h"
28 #include "../datatype/Enums.h"
36 #include <boost/cstdint.hpp>
40 std::vector<te::map::GroupingItem*>& legend,
int precision)
44 size_t valSize = inputValues.size();
51 std::vector<boost::int64_t> v;
53 for(i = 0; i < valSize; ++i)
54 v.push_back(atoi(inputValues[i].c_str()));
56 sort(v.begin(), v.end());
58 for (i = 0; i < v.size(); ++i)
63 std::vector<double> v;
65 for (i = 0; i < valSize; ++i)
67 double a = atof(inputValues[i].c_str());
71 stable_sort(v.begin(), v.end());
73 for (i = 0; i < v.size(); ++i)
78 sort(inputValues.begin(), inputValues.end());
86 for (i = 0, j = 1; i < valSize - 1 && j < valSize; ++i, ++j)
88 if (inputValues[i] == inputValues[j])
93 legendItem->
setValue(inputValues[i]);
95 legend.push_back(legendItem);
100 if((i > 1) && (inputValues[i] == inputValues[i-1]))
103 legendItem->
setValue(inputValues[i]);
105 legend.push_back(legendItem);
110 legendItem->
setValue(inputValues[i]);
112 legend.push_back(legendItem);
118 double p = pow(10.0, (
double)-precision);
void setValue(const std::string &value)
It sets value of the legend item.
TEMAPEXPORT double AdjustToPrecision(double val, int precision, bool reduce=false)
It adjusts a value to the precision specified.
A GroupingItem contains information about a grouping item associated to a layer.
This file contains functions containing the algorithms for grouping values.
TEMAPEXPORT void GroupingByUniqueValues(std::vector< std::string > &inputValues, int dataType, std::vector< te::map::GroupingItem * > &legend, int precision)
It groups the values using the unique value algorithm.
void setCount(std::size_t count)
It It sets the number of objects whose values are between the lower and upper limits.
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string.