27 #include "../common/Exception.h" 28 #include "../common/StringUtils.h" 29 #include "../core/translator/Translator.h" 30 #include "../datatype/Enums.h" 39 #include <boost/cstdint.hpp> 42 std::vector<te::se::Rule*>& rules,
int precision)
46 size_t valSize = inputValues.size();
58 std::vector<boost::int64_t> v;
60 for(i = 0; i < valSize; ++i)
61 v.push_back(atoi(inputValues[i].c_str()));
63 sort(v.begin(), v.end());
65 for (i = 0; i < v.size(); ++i)
70 std::vector<double> v;
72 for (i = 0; i < valSize; ++i)
74 double a = atof(inputValues[i].c_str());
78 stable_sort(v.begin(), v.end());
80 for (i = 0; i < v.size(); ++i)
85 sort(inputValues.begin(), inputValues.end());
93 for (i = 0, j = 1; i < valSize - 1 && j < valSize; ++i, ++j)
95 if (inputValues[i] == inputValues[j])
100 std::string* ruleName =
new std::string(inputValues[i]);
104 rules.push_back(ruleItem);
110 if((i > 1) && (inputValues[i] == inputValues[i-1]))
113 std::string* ruleName =
new std::string(inputValues[i]);
117 rules.push_back(ruleItem);
122 std::string* ruleName =
new std::string(inputValues[i]);
126 rules.push_back(ruleItem);
132 double p = pow(10.0, (
double)-precision);
TEMAPEXPORT void GroupingByUniqueValues(std::string attrName, std::vector< std::string > &inputValues, int dataType, std::vector< te::se::Rule * > &rules, int precision)
It groups the values using the unique value algorithm.
void setName(std::string *name)
TEMAPEXPORT double AdjustToPrecision(double val, int precision, bool reduce=false)
It adjusts a value to the precision specified.
void setFilter(te::fe::Filter *f)
#define TE_TR(message)
It marks a string in order to get translated.
TEFEEXPORT te::fe::Filter * CreateFilterByUniqueValue(const std::string &attrName, const std::string &value)
This file contains functions containing the algorithms for grouping values.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string.