* Get a sorted list of all the measures that have values in a given ragen * * @param statFunc A pointer to a control Measure acessor * @param min the minimum value of acessor return for list inclusion * @param max the maximum value of acessor return for list inclusion */
| 1127 | * @param max the maximum value of acessor return for list inclusion |
| 1128 | */ |
| 1129 | QList< ControlMeasure * > ControlNet::sortedMeasureList(double(ControlMeasure::*statFunc)() const, |
| 1130 | double min,double max) { |
| 1131 | |
| 1132 | QList< ControlMeasure * >measures; |
| 1133 | |
| 1134 | //build a list of all the pointers to the relevant measures |
| 1135 | //get the number of object points |
| 1136 | int nObjPts = this->GetNumPoints(); |
| 1137 | for (int i=0;i<nObjPts;i++) { //for each Object point |
| 1138 | ControlPoint *point = this->GetPoint(i); |
| 1139 | if (point->IsIgnored()) continue; //if the point is ignored then continue |
| 1140 | |
| 1141 | // Get the number of measures |
| 1142 | int nObs = point->GetNumMeasures(); |
| 1143 | for (int j=0;j<nObs;j++) { //for every measure |
| 1144 | ControlMeasure *measure = point->GetMeasure(j); |
| 1145 | if (measure->IsIgnored()) continue; |
| 1146 | double temp = (measure->*statFunc)(); |
| 1147 | if (temp > min) |
| 1148 | if (min <= temp && temp <= max) measures.push_back(measure); |
| 1149 | } |
| 1150 | } |
| 1151 | |
| 1152 | // Sort the measures |
| 1153 | ControlMeasureLessThanFunctor lessThan(statFunc); |
| 1154 | std::sort(measures.begin(),measures.end(),lessThan); |
| 1155 | |
| 1156 | return measures; |
| 1157 | } |
| 1158 | |
| 1159 | |
| 1160 | /** |
no test coverage detected