* Filter PointID based on regular expression * Group by Points * * @author Sharmila Prasad (8/11/2010) * * @param pvlGrp - Pvl Group containing the filter info * @param pbLastFilter - Flag to indicate whether this is the last filter to print the stats */
| 443 | * @param pbLastFilter - Flag to indicate whether this is the last filter to print the stats |
| 444 | */ |
| 445 | void ControlNetFilter::PointIDFilter(const PvlGroup &pvlGrp, bool pbLastFilter) { |
| 446 | QString sPointIDExpr = pvlGrp["Expression"][0]; |
| 447 | QString sSeparator("*"); |
| 448 | QStringList strTokens = sPointIDExpr.split(sSeparator, Qt::SkipEmptyParts); |
| 449 | |
| 450 | int iTokenSize = (int)strTokens.size(); |
| 451 | int iNumPoints = mCNet->GetNumPoints(); |
| 452 | #ifdef _DEBUG_ |
| 453 | odb << "Net Size=" << iNumPoints << endl; |
| 454 | #endif |
| 455 | |
| 456 | if (pbLastFilter) { |
| 457 | PointStatsHeader(); |
| 458 | mOstm << endl; |
| 459 | } |
| 460 | |
| 461 | for (int i = (iNumPoints - 1); i >= 0; i--) { |
| 462 | const ControlPoint *cPoint = mCNet->GetPoint(i); |
| 463 | QString sPointID = cPoint->GetId(); |
| 464 | int iPosition = 0; |
| 465 | for (int j = (iTokenSize - 1); j >= 0; j--) { |
| 466 | int iLen = strTokens[j].length(); |
| 467 | if (iLen > 0) { |
| 468 | int found = sPointID.indexOf(strTokens[j], iPosition); |
| 469 | if (found != -1) { |
| 470 | iPosition = found + iLen; |
| 471 | // End of the expression |
| 472 | if (pbLastFilter && j == (iTokenSize - 1)) { |
| 473 | // Log into the output file |
| 474 | PointStats(*cPoint); |
| 475 | mOstm << endl; |
| 476 | } |
| 477 | } |
| 478 | else { |
| 479 | FilterOutPoint(i); |
| 480 | break; |
| 481 | } |
| 482 | } |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | // update the image stats with the changes |
| 487 | GenerateImageStats(); |
| 488 | } |
| 489 | |
| 490 | /** |
| 491 | * Filters the Control Network based on the user specified number of |