Functions | |
| template<class iterator> | |
| void | TeElemCountingBySlice (iterator begin, iterator end, vector< TeSlice > &result) |
| Counts the number of elements, from a general container, per slice of a vector of slices. | |
| template<class iterator> | |
| void | TeGroupByEqualStep (iterator begin, iterator end, int nstep, vector< TeSlice > &result, int precision=0, bool countElements=true) |
| Groups a set of elements defined by a range of iterators in nstep groups, using Equal Step algorithm. | |
| template<class iterator> | |
| void | TeGroupByQuantil (iterator begin, iterator end, int nstep, vector< TeSlice > &result, int precision=0, bool countElements=true) |
| Groups a set of elements defined by a range of iterators in nstep groups, using Quantil algorithm. | |
| template<class iterator> | |
| void | TeGroupByStdDev (iterator begin, iterator end, double ndev, vector< TeSlice > &result, string &rmean, int precision=0, bool countElements=true) |
| Groups a set of elements defined by a range of iterators in ndev groups, using Standanrd deviation algorithm. | |
| TL_DLL void | TeGroupByUniqueValue (vector< string > &vec, TeAttrDataType tipo, vector< TeSlice > &result, int precision) |
| Groups a set of elements in a vector of string using Unique Value algorithm. | |
| void TeElemCountingBySlice | ( | iterator | begin, | |
| iterator | end, | |||
| vector< TeSlice > & | result | |||
| ) | [inline] |
Definition at line 249 of file TeGroupingAlgorithms.h.
References TeSlice::count_, TeSlice::from_, and TeSlice::to_.
Referenced by TeQtLegendSource::generateLegends(), TeQtLegendSource::setCell(), TeGroupByEqualStep(), TeGroupByQuantil(), and TeGroupByStdDev().
00250 { 00251 iterator it; 00252 double from, to; 00253 00254 for (unsigned int i = 0; i < result.size(); ++i) 00255 { 00256 TeSlice& sl = result[i]; 00257 sl.count_ = 0; 00258 from = atof(sl.from_.c_str()); 00259 to = atof(sl.to_.c_str()); 00260 for (it = begin; it != end; ++it) 00261 { 00262 if (*it >= from && *it < to) 00263 ++sl.count_; 00264 } 00265 } 00266 }
| void TeGroupByEqualStep | ( | iterator | begin, | |
| iterator | end, | |||
| int | nstep, | |||
| vector< TeSlice > & | result, | |||
| int | precision = 0, |
|||
| bool | countElements = true | |||
| ) | [inline] |
Definition at line 94 of file TeGroupingAlgorithms.h.
References TeSlice::count_, TeSlice::from_, MAX, MIN, Te2String(), TeAdjustToPrecision(), TeElemCountingBySlice(), TeMAXFLOAT, and TeSlice::to_.
00096 { 00097 double min = TeMAXFLOAT; 00098 double max = -TeMAXFLOAT; 00099 00100 iterator it=begin; 00101 while(it < end) 00102 { 00103 min = MIN(min, *it); 00104 max = MAX(max, *it); 00105 it++; 00106 } 00107 double slice = (max - min)/double(nstep); 00108 int ns; 00109 for (ns=0;ns<nstep;ns++) 00110 { 00111 TeSlice ps; 00112 ps.count_ = 0; 00113 ps.from_ = Te2String(min+double(ns)*slice, precision); 00114 ps.to_ = Te2String(min+double(ns+1)*slice, precision); 00115 result.push_back(ps); 00116 } 00117 min = TeAdjustToPrecision(min, precision, true); 00118 result[0].from_ = Te2String(min, precision); 00119 max = TeAdjustToPrecision(max, precision); 00120 result[result.size()-1].to_ = Te2String(max, precision); 00121 00122 // Set the number of elements for each slice 00123 if (countElements == true) 00124 TeElemCountingBySlice(begin, end, result); 00125 }
| void TeGroupByQuantil | ( | iterator | begin, | |
| iterator | end, | |||
| int | nstep, | |||
| vector< TeSlice > & | result, | |||
| int | precision = 0, |
|||
| bool | countElements = true | |||
| ) | [inline] |
Definition at line 129 of file TeGroupingAlgorithms.h.
References TeSlice::from_, Te2String(), TeAdjustToPrecision(), TeElemCountingBySlice(), and TeSlice::to_.
Referenced by TeTheme::buildGrouping(), and TeExternalTheme::buildGrouping().
00131 { 00132 sort(begin, end); 00133 00134 int size = end - begin; 00135 double step = (double)size / (double)nstep; 00136 00137 int n = 0; 00138 iterator it = begin; 00139 while(it < end) 00140 { 00141 TeSlice ps; 00142 ps.from_ = Te2String((*it), precision); 00143 int p = (int)(step * (double)++n + .5); 00144 it = begin + p; 00145 if(it < end) 00146 ps.to_ = Te2String((*it), precision); 00147 else 00148 ps.to_ = Te2String(*(it-1), precision); 00149 result.push_back(ps); 00150 } 00151 if(end-begin > 1) 00152 { 00153 double min = (*begin); 00154 double max = (*(end-1)); 00155 min = TeAdjustToPrecision(min, precision, true); 00156 result[0].from_ = Te2String(min, precision); 00157 max = TeAdjustToPrecision(max, precision); 00158 result[result.size()-1].to_ = Te2String(max, precision); 00159 } 00160 00161 // Set the number of elements for each slice 00162 if (countElements == true) 00163 TeElemCountingBySlice(begin, end, result); 00164 }
| void TeGroupByStdDev | ( | iterator | begin, | |
| iterator | end, | |||
| double | ndev, | |||
| vector< TeSlice > & | result, | |||
| string & | rmean, | |||
| int | precision = 0, |
|||
| bool | countElements = true | |||
| ) | [inline] |
Definition at line 168 of file TeGroupingAlgorithms.h.
References aux, TeSlice::from_, MAX, MIN, Te2String(), TeAdjustToPrecision(), TeElemCountingBySlice(), TeMAXFLOAT, and TeSlice::to_.
Referenced by TeTheme::buildGrouping(), and TeExternalTheme::buildGrouping().
00170 { 00171 // Compute mim, max and mean 00172 double min = TeMAXFLOAT; 00173 double max = -TeMAXFLOAT; 00174 long double sum=0.; 00175 long double sm2=0.; 00176 iterator it=begin; 00177 while(it < end) 00178 { 00179 min = MIN(min, *it); 00180 max = MAX(max, *it); 00181 sum += (*it); 00182 sm2 += ((*it) * (*it)); 00183 it++; 00184 } 00185 double cont = (double)(end - begin); 00186 double mean = (double)(sum/cont); 00187 long double var = (sm2 / cont) - (mean * mean); 00188 double sdev = sqrt(var); 00189 00190 double slice = sdev * ndev; 00191 00192 vector<TeSlice> aux; 00193 rmean = Te2String(mean, precision); 00194 double val = mean; 00195 while(val-slice > min-slice) 00196 { 00197 TeSlice ps; 00198 double v = val - slice; 00199 ps.from_ = Te2String(v, precision); 00200 ps.to_ = Te2String(val, precision); 00201 aux.push_back(ps); 00202 val = v; 00203 } 00204 00205 std::vector<TeSlice>::reverse_iterator sit; 00206 00207 for(sit = aux.rbegin(); sit != aux.rend(); ++sit) 00208 { 00209 result.push_back(*sit); 00210 } 00211 00212 string media = "mean = " + rmean; 00213 TeSlice ps; 00214 ps.from_ = media; 00215 ps.to_.clear(); 00216 result.push_back(ps); 00217 val = mean; 00218 while(val+slice < max+slice) 00219 { 00220 TeSlice ps; 00221 double v = val + slice; 00222 ps.from_ = Te2String(val, precision); 00223 ps.to_ = Te2String(v, precision); 00224 result.push_back(ps); 00225 val = v; 00226 } 00227 if(result.size() > 2) 00228 { 00229 if (result[0].from_.find("mean") == string::npos) 00230 { 00231 min = TeAdjustToPrecision(min, precision, true); 00232 result[0].from_ = Te2String(min, precision); 00233 } 00234 if (result[result.size()-1].from_.find("mean") == string::npos) 00235 { 00236 max = TeAdjustToPrecision(max, precision); 00237 result[result.size()-1].to_ = Te2String(max, precision); 00238 } 00239 } 00240 00241 // Set the number of elements for each slice 00242 if (countElements == true) 00243 TeElemCountingBySlice(begin, end, result); 00244 }
| TL_DLL void TeGroupByUniqueValue | ( | vector< string > & | vec, | |
| TeAttrDataType | tipo, | |||
| vector< TeSlice > & | result, | |||
| int | precision | |||
| ) |
1.5.3