/** * @brief Method overwrites parent method. * This method keeps all points that contain at least one * measure whose Goodness of Fit is within the range specified * by the user. * * @internal * @history 2008-11-26 Jeannie Walldren - Original Version * @history 2009-01-08 Jeannie Walldren - Modified to remove * new filter points from the existing * filtered list. Previously, a new * filtered list was created from the * entire control net each time. */ void QnetPointGoodnessFilter::filter() { // Make sure there is a control net loaded if (controlNet() == NULL) { QMessageBox::information((QWidget *)parent(), "Error","No points to filter"); return; } // Make sure the user entered a value to use in the filtering if (m_lessThanCB->isChecked() && m_maxValueEdit->text() == "") { QMessageBox::information((QWidget *)parent(), "Error","Maximum Goodness of Fit value must be entered"); return; } if (m_greaterThanCB->isChecked() && m_minValueEdit->text() == "") { QMessageBox::information((QWidget *)parent(), "Error","Minimum Goodness of Fit value must be entered"); return; } // Get the user entered filtering value double maxValue = m_maxValueEdit->text().toDouble(); double minValue = m_minValueEdit->text().toDouble(); // Loop through each value of the filtered points list // Loop in reverse order since removal list of elements affects index number for (int i = filteredPoints().size()-1; i >= 0; i--) { ControlPoint &cp = *(*controlNet())[filteredPoints()[i]]; int numMeasOutsideRange = 0; // Loop through each measure of the point at this index of the control net for (int j = 0; j < cp.GetNumMeasures(); j++) { double goodnessOfFit = cp[j]->GetLogData( ControlMeasureLogData::GoodnessOfFit).GetNumericalValue(); if (goodnessOfFit == Null) { numMeasOutsideRange++; } else if (m_lessThanCB->isChecked() && m_greaterThanCB->isChecked()) { if (goodnessOfFit < maxValue && goodnessOfFit > minValue) break; else numMeasOutsideRange++; } else if (m_lessThanCB->isChecked()) { if (goodnessOfFit < maxValue) break; else numMeasOutsideRange++; } else if (m_greaterThanCB->isChecked()) { if (goodnessOfFit > minValue) break; else numMeasOutsideRange++; } } // if no measures are within the range, remove from filter list if (cp.GetNumMeasures() == numMeasOutsideRange) { filteredPoints().removeAt(i); } } // Tell the navtool that a list has been filtered and it needs to update emit filteredListModified(); return; }
/** * Filters a list of images looking for cube names using the regular expression * entered. The filtered list will appear in the navtools cube list display. * * @internal * @history 2009-01-08 Jeannie Walldren - Modified to remove * new filter points from the existing * filtered list. */ void QnetPointIdFilter::filter() { // Make sure there is a control net loaded if (g_controlNetwork == NULL) { QMessageBox::information((QWidget *)parent(), "Error","No points to filter"); return; } // Make sure the user has entered a regular expression for filtering QRegExp rx(p_pointIdEdit->text()); rx.setPatternSyntax(QRegExp::Wildcard); if (rx.isEmpty()) { QMessageBox::information((QWidget *)parent(), "Error","Enter search string"); return; } // Loop through each value of the filtered points list checking // the types of each control measure for each of the control points // Loop in reverse order since removal list of elements affects index number for (int i = g_filteredPoints.size()-1; i >= 0; i--) { string cNetId = (*g_controlNetwork)[g_filteredPoints[i]].Id(); if (rx.indexIn(QString(cNetId.c_str())) != -1) { continue; } else g_filteredPoints.removeAt(i); } // Tell the navtool a list has been filtered and it needs to update emit filteredListModified(); return; }
/** * @brief Method overwrites parent method. * This method keeps all points that contain at least one * measure whose Goodness of Fit is within the range specified * by the user. * * @internal * @history 2008-11-26 Jeannie Walldren - Original Version * @history 2009-01-08 Jeannie Walldren - Modified to remove * new filter points from the existing * filtered list. Previously, a new * filtered list was created from the * entire control net each time. */ void QnetPointGoodnessFilter::filter() { // Make sure there is a control net loaded if (g_controlNetwork == NULL) { QMessageBox::information((QWidget *)parent(), "Error","No points to filter"); return; } // Make sure the user entered a value to use in the filtering if (p_lessThanCB->isChecked() && p_maxValueEdit->text() == "") { QMessageBox::information((QWidget *)parent(), "Error","Maximum Goodness of Fit value must be entered"); return; } if (p_greaterThanCB->isChecked() && p_minValueEdit->text() == "") { QMessageBox::information((QWidget *)parent(), "Error","Minimum Goodness of Fit value must be entered"); return; } // Get the user entered filtering value double maxValue = p_maxValueEdit->text().toDouble(); double minValue = p_minValueEdit->text().toDouble(); // Loop through each value of the filtered points list // Loop in reverse order since removal list of elements affects index number for (int i = g_filteredPoints.size()-1; i >= 0; i--) { Isis::ControlPoint cp = (*g_controlNetwork)[g_filteredPoints[i]]; int numMeasOutsideRange = 0; // Loop through each measure of the point at this index of the control net for (int j = 0; j < cp.Size(); j++) { if (cp[j].GoodnessOfFit() == Isis::Null) { numMeasOutsideRange++; } else if (p_lessThanCB->isChecked() && p_greaterThanCB->isChecked()) { if (cp[j].GoodnessOfFit() < maxValue && cp[j].GoodnessOfFit() > minValue) break; else numMeasOutsideRange++; } else if (p_lessThanCB->isChecked()) { if (cp[j].GoodnessOfFit() < maxValue) break; else numMeasOutsideRange++; } else if (p_greaterThanCB->isChecked()) { if (cp[j].GoodnessOfFit() > minValue) break; else numMeasOutsideRange++; } } // if no measures are within the range, remove from filter list if (cp.Size() == numMeasOutsideRange) { g_filteredPoints.removeAt(i); } } // Tell the navtool that a list has been filtered and it needs to update emit filteredListModified(); return; }
/** * Filters a list of points for points that are of the selected * Range or in the given range. The filtered list will appear in * the navtools point list display. * @internal * @history 2009-01-08 Jeannie Walldren - Modified to remove * new filter points from the existing * filtered list. Previously, a new * filtered list was created from the * entire control net each time. * @history 2010-06-03 Jeannie Walldren - Removed "std::" * since "using namespace std" * */ void QnetPointRangeFilter::filter() { // Make sure there is a control net loaded if (controlNet() == NULL) { QMessageBox::information((QWidget *)parent(), "Error", "No points to filter"); return; } // Make sure all the values we need have been entered by the user if ((m_minlat->text() == "") || (m_maxlat->text() == "") || (m_minlon->text() == "") || (m_maxlon->text() == "")) { QMessageBox::information((QWidget *)parent(), "Error", "All lat/lon range values must be entered"); return; } else { // Get the user entered values for the range double minlat = m_minlat->text().toDouble(); double maxlat = m_maxlat->text().toDouble(); double minlon = m_minlon->text().toDouble(); double maxlon = m_maxlon->text().toDouble(); // Make sure the lat values are in order if (minlat > maxlat) { QString msg = "The minimum latitude value must be less than the maximum latitude value"; QMessageBox::information((QWidget *)parent(), "Error", msg); return; } // Make sure the lon values are in order else if (minlon > maxlon) { QString msg = "The minimum longitude value must be less than the maximum longitude value"; QMessageBox::information((QWidget *)parent(), "Error", msg); return; } // Loop through each value of the filtered points list // checking to see if each point falls within the rangee // Loop in reverse order since removal list of elements affects index number for (int i = filteredPoints().size() - 1; i >= 0; i--) { // Get the current control point ControlPoint &cp = *(*controlNet())[filteredPoints()[i]]; Latitude lat = cp.GetBestSurfacePoint().GetLatitude(); Longitude lon = cp.GetBestSurfacePoint().GetLongitude(); if (lat.inRange(Latitude(minlat,Angle::Degrees),Latitude(maxlat,Angle::Degrees)) && lon.inRange(Longitude(minlon,Angle::Degrees),Longitude(maxlon,Angle::Degrees))) { continue; } else { filteredPoints().removeAt(i); } } } // Tell the navtool that a list has been filtered and it needs to update emit filteredListModified(); return; }
/** * @brief Method overwrites parent method. * This method keeps all points that contain at least one * measure whose CubeName is within the range specified by the * user. * * @internal * @history 2009-01-26 Jeannie Walldren - Original Version */ void QnetPointCubeNameFilter::filter() { // Make sure there is a control net loaded if (controlNet() == NULL) { QMessageBox::information((QWidget *)parent(), "Error", "No points to filter"); return; } if (serialNumberList() == NULL) { QMessageBox::information((QWidget *)parent(), "Error", "No cubes to filter"); return; } // load??? int index = p_listBox->currentRow(); if (index < 0) { QApplication::restoreOverrideCursor(); QMessageBox::information((QWidget *)parent(), "Error", "No file selected to filter"); return; } QList<QListWidgetItem *> selected = p_listBox->selectedItems(); for (int i = 0; i < selected.size(); i++) { int index = p_listBox->row(selected[i]); QString selectedCubeSerNum = serialNumberList()->SerialNumber(index); // Loop through each value of the filtered points list // checking the types of each control measure for each // of the control points. If no measures match, we remove // it from the filtered list // Loop in reverse order since removal list of elements affects index number for (int i = filteredPoints().size() - 1; i >= 0; i--) { ControlPoint &cp = *(*controlNet())[filteredPoints()[i]]; int numMeasNotMatching = 0; for (int j = 0; j < cp.GetNumMeasures(); j++) { // if the point contains a measure that matches a checked type, // keep this point in the list and go on to the next point if (cp[j]->GetCubeSerialNumber() == selectedCubeSerNum) { break; } // if this measure doesn't match any of the checked values, increment else numMeasNotMatching++; } // if no measures match the checked values, // remove this point from the filter list if (cp.GetNumMeasures() == numMeasNotMatching) { filteredPoints().removeAt(i); } } } // Tell the navtool that a list has been filtered and it needs to update emit filteredListModified(); return; }
/** * Filters a list of points for points that have less than or greater * than the entered bundle adjust error values. The filtered list will * appear in the navtools point list display. * * @internal * @history 2007-06-05 Tracie Sucharski - Look at ControlPoint::MaximumError * instead of ControlPoint::AverageError * @history 2008-08-06 Tracie Sucharski - Added functionality of filtering * range of errors. * @history 2009-01-08 Jeannie Walldren - Modified to remove * new filter points from the existing * filtered list. Previously, a new * filtered list was created from the * entire control net each time. */ void QnetPointErrorFilter::filter() { // Make sure we have a list of control points to filter if (g_controlNetwork == NULL) { QMessageBox::information((QWidget *)parent(), "Error","No points to filter"); return; } // Make sure the user entered a value to use in the filtering double lessNum = -1.; if (p_lessThanCB->isChecked() && p_lessErrorEdit->text() == "") { QMessageBox::information((QWidget *)parent(), "Error","Error value must be entered"); return; } double greaterNum = -1.; if (p_greaterThanCB->isChecked() && p_greaterErrorEdit->text() == "") { QMessageBox::information((QWidget *)parent(), "Error","Error value must be entered"); return; } // Get the user entered filtering value lessNum = p_lessErrorEdit->text().toDouble(); greaterNum = p_greaterErrorEdit->text().toDouble(); // Loop through each value of the filtered points list comparing the error of its // corresponding point with error with the user entered value and remove it from // the filtered list if it is outside the filtering range // Loop in reverse order since removal list of elements affects index number for (int i = g_filteredPoints.size()-1; i >= 0; i--) { Isis::ControlPoint cp = (*g_controlNetwork)[g_filteredPoints[i]]; if (p_lessThanCB->isChecked() && p_greaterThanCB->isChecked()) { if ( (cp.MaximumError() < lessNum) && (cp.MaximumError() > greaterNum) ) { continue; } else g_filteredPoints.removeAt(i); } else if (p_lessThanCB->isChecked()) { if (cp.MaximumError() < lessNum) { continue; } else g_filteredPoints.removeAt(i); } else if (p_greaterThanCB->isChecked()) { if (cp.MaximumError() > greaterNum) { continue; } else g_filteredPoints.removeAt(i); } } // Tell the navtool that a list has been filtered and it needs to update emit filteredListModified(); return; }
/** * Filters a list of images looking for cube names using the regular expression * entered. The filtered list will appear in the navtools cube list display. * @internal * @history 2009-01-08 Jeannie Walldren - Modified to create * new filtered list from images in the * existing filtered list. Previously, * a new filtered list was created from * the entire serial number list each * time. */ void QnetCubeNameFilter::filter() { // Make sure we have a list of images to filter if (g_serialNumberList == NULL) { QMessageBox::information((QWidget *)parent(), "Error", "No cubes to filter"); return; } // Make sure the user has entered a regular expression for filtering QRegExp rx(p_cubeNameEdit->text()); rx.setPatternSyntax(QRegExp::Wildcard); if (rx.isEmpty()) { QMessageBox::information((QWidget *)parent(), "Error", "Enter search QString"); return; } // Loop through each image in the filtered list // Loop in reverse order since removal list of elements affects index number for (int i = g_filteredImages.size() - 1; i >= 0; i--) { QString tempFileName = g_serialNumberList->FileName(g_filteredImages[i]); // this name contains the QString, keep it in the filtered list if (rx.indexIn(QString(tempFileName)) != -1) { continue; } // if there is no match, remove image from filtered list else g_filteredImages.removeAt(i); } // Tell the navtool a list has been filtered and it needs to update emit filteredListModified(); return; }
/** * Filters a list of points for points that are less than the user entered * distance from another point in the control net. The filtered list will * appear in the navtools point list display. * @internal * @history 2008-11-26 Jeannie Walldren - Modified code to * handle case in which the lat/lon of * the point is Null. In this event, * the Camera class will be used to * determine lat/lon/rad for the * reference measure or for the first * measure. Changed variable names for * clarity. Adjusted inner "for" loop * to reduce number of iterations. * @history 2009-01-08 Jeannie Walldren - Modified to replace * existing filtered list with a subset * of that list. Previously, a new * filtered list was created from the * entire control net each time. * @history 2011-03-17 Tracie Sucharski - Use surface point from camera * and updated for changes to SurfacePoint. */ void QnetPointDistanceFilter::filter() { // Make sure we have a control network to filter through if (controlNet() == NULL) { QMessageBox::information((QWidget *)parent(), "Error", "No points to filter"); return; } // Make sure the user entered a filtering value if (m_lineEdit->text() == "") { QMessageBox::information((QWidget *)parent(), "Error", "Distance value must be entered"); return; } // Get the user entered value for filtering double userEntered = m_lineEdit->text().toDouble(); // create temporary QList to contain new filtered images QList <int> temp; // Loop through each value of the filtered points list // Loop in reverse order for consistency with other filter methods for (int i = filteredPoints().size() - 1; i >= 0; i--) { ControlPoint &cp1 = *(*controlNet())[filteredPoints()[i]]; // Get necessary info from the control point for later use // First check if an adjusted point from jigsaw exists. If not, use // the apriori values. SurfacePoint sp1 = cp1.GetBestSurfacePoint(); // If no lat/lon for this point, use lat/lon of first measure if (!sp1.Valid()) { Camera *cam1; ControlMeasure cm1; cm1 = *cp1.GetRefMeasure(); int camIndex1 = serialNumberList()->SerialNumberIndex(cm1.GetCubeSerialNumber()); cam1 = controlNet()->Camera(camIndex1); cam1->SetImage(cm1.GetSample(), cm1.GetLine()); sp1 = cam1->GetSurfacePoint(); } // Loop through each control point, comparing it to the initial point // from the filtered list for (int j = 0; j < controlNet()->GetNumPoints(); j++) { if (j == filteredPoints()[i]) { // cp1 = cp2, go to next value of j continue; } ControlPoint cp2 = *(*controlNet())[j]; SurfacePoint sp2 = cp2.GetBestSurfacePoint(); // If no lat/lon for this point, use lat/lon of first measure if (!sp2.Valid()) { Camera *cam2; ControlMeasure cm2; cm2 = *cp2.GetRefMeasure(); int camIndex2 = serialNumberList()->SerialNumberIndex(cm2.GetCubeSerialNumber()); cam2 = controlNet()->Camera(camIndex2); cam2->SetImage(cm2.GetSample(), cm2.GetLine()); sp2 = cam2->GetSurfacePoint(); } // Get the distance from the camera class double dist = sp1.GetDistanceToPoint(sp2,sp1.GetLocalRadius()).meters(); // If the distance found is less than the input number, add the // control points' indices to the new filtered points list if (dist < userEntered) { if (!temp.contains(filteredPoints()[i])) { temp.push_back(filteredPoints()[i]); } break; } } } // Sort QList of filtered points before displaying list to user qSort(temp.begin(), temp.end()); // replace existing filter list with this one filteredPoints() = temp; // Tell the nav tool that a list has been filtered and needs to be updated emit filteredListModified(); return; }
/** * Filters a list of points for points that are of the selected * Range or in the given range. The filtered list will appear in * the navtools point list display. * @internal * @history 2009-01-08 Jeannie Walldren - Modified to remove * new filter points from the existing * filtered list. Previously, a new * filtered list was created from the * entire control net each time. */ void QnetPointRangeFilter::filter() { // Make sure there is a control net loaded if (g_controlNetwork == NULL) { QMessageBox::information((QWidget *)parent(), "Error","No points to filter"); return; } // Make sure all the values we need have been entered by the user if ((p_minlat->text() == "") || (p_maxlat->text() == "") || (p_minlon->text() == "") || (p_maxlon->text() == "")) { QMessageBox::information((QWidget *)parent(), "Error","All lat/lon range values must be entered"); return; } else { // Get the user entered values for the range double minlat = p_minlat->text().toDouble(); double maxlat = p_maxlat->text().toDouble(); double minlon = p_minlon->text().toDouble(); double maxlon = p_maxlon->text().toDouble(); // Make sure the lat values are in order if (minlat > maxlat) { QString msg = "The minimum latitude value must be less than the maximum latitude value"; QMessageBox::information((QWidget *)parent(),"Error",msg); return; } // Make sure the lon values are in order else if (minlon > maxlon) { QString msg = "The minimum longitude value must be less than the maximum longitude value"; QMessageBox::information((QWidget *)parent(),"Error",msg); return; } // Set up a polygon with the range values the user entered // Create all the coordinates we will need std::vector<geos::geom::Coordinate> *coords = new std::vector<geos::geom::Coordinate>; geos::geom::Coordinate *c1 = new geos::geom::Coordinate(minlat,minlon); geos::geom::Coordinate *c2 = new geos::geom::Coordinate(maxlat,minlon); geos::geom::Coordinate *c3 = new geos::geom::Coordinate(maxlat,maxlon); geos::geom::Coordinate *c4 = new geos::geom::Coordinate(minlat,maxlon); geos::geom::Coordinate *c5 = new geos::geom::Coordinate(minlat,minlon); // create the coordinate sequence coords->push_back(*c1); coords->push_back(*c2); coords->push_back(*c3); coords->push_back(*c4); coords->push_back(*c5); geos::geom::GeometryFactory *factory = new geos::geom::GeometryFactory(); const geos::geom::CoordinateSequenceFactory *csFact = factory->getCoordinateSequenceFactory(); geos::geom::CoordinateSequence *seq = csFact->create(coords); // Create the polygon with the coordinate sequence geos::geom::LinearRing *ring = factory->createLinearRing(seq); geos::geom::Polygon *poly = factory->createPolygon(ring, new std::vector<geos::geom::Geometry*>); // Loop through each value of the filtered points list // checking to see if each point is in the polygon we created above // Loop in reverse order since removal list of elements affects index number for (int i = g_filteredPoints.size()-1; i >= 0; i--) { // Get the current control point Isis::ControlPoint cp = (*g_controlNetwork)[g_filteredPoints[i]]; // Create a new point const geos::geom::Coordinate *coord = new geos::geom::Coordinate(cp.UniversalLatitude(),cp.UniversalLongitude()); geos::geom::Point *pt = factory->createPoint(*coord); // See if the point is in the polygon & add it if it is if (poly->contains(pt)) { continue; } else g_filteredPoints.removeAt(i); } } // Tell the navtool that a list has been filtered and it needs to update emit filteredListModified(); return; }
/** * Filters a list of points for points that have at least one measure * of the selected type(s). The filtered list will appear in the * navtools point list display. * * @internal * @history 2009-01-08 Jeannie Walldren - Modified to remove * new filter points from the existing * filtered list. Previously, a new * filtered list was created from the * entire control net each time. * @history 2010-06-02 Jeannie Walldren - Added functionality * to filter by ignore status in * addition to measure type * @history 2010-07-16 Tracie Sucharski - Implemented binary * control networks. */ void QnetPointMeasureFilter::filter() { // Make sure there is a control net loaded to filter if (controlNet() == NULL) { QMessageBox::information((QWidget *)parent(), "Error", "No points to filter"); return; } // Make sure they selected at least one type to filter for if (!m_measureType->isChecked() && !m_ignoreStatus->isChecked() && !m_editLockStatus->isChecked()) { QMessageBox::information((QWidget *)parent(), "Input Erro", "You must select at least one measure property to filter"); return; } // if Filter by Measure Type is selected but no Measure Type is checked, throw error if ((m_measureType->isChecked()) && !(m_candidate->isChecked() || m_manual->isChecked() || m_registeredPixel->isChecked() || m_registeredSubPixel->isChecked())) { QMessageBox::information((QWidget *)parent(), "Input Error", "Filter by Measure Type is selected. You must choose at least one " "Measure Type to filter"); return; } // Loop through each value of the filtered points list // checking the types of each control measure for each // of the control points. If no measures match, we remove // it from the filtered list // Loop in reverse order since removal list of elements affects index number for (int i = filteredPoints().size() - 1; i >= 0; i--) { ControlPoint &cp = *(*controlNet())[filteredPoints()[i]]; int numMeasNotMatching = 0; for (int j = 0; j < cp.GetNumMeasures(); j++) { // While keep is true, keep testing for next filter option bool keep = true; if (m_measureType->isChecked() && !MeasureTypeMatched(cp[j]->GetType())) { keep = false; } // ????? Not sure why this code was here, was introduced for binary, but // it does not work. TODO: GET RID OF??? // // Is this a reference measure // bool reference = cp.IsReferenceExplicit() && // ((QString(cp[j]->GetCubeSerialNumber()) == cp.GetReferenceSN())); // if (!MeasureTypeMatched(cp[j]->GetType()) && !reference) keep = false; if (keep && m_ignoreStatus->isChecked()) { if (m_ignored->isChecked() && !cp[j]->IsIgnored()) keep = false; if (m_notIgnored->isChecked() && cp[j]->IsIgnored()) keep = false; } if (keep && m_editLockStatus->isChecked()) { if (m_editLocked->isChecked() && !cp[j]->IsEditLocked()) keep = false; if (m_notEditLocked->isChecked()&& cp[j]->IsEditLocked()) keep = false; } // if this measure doesn't match any of the checked values, increment if (!keep) numMeasNotMatching++; } int numMeasures = cp.GetNumMeasures(); // if no measures match the checked values, // remove this point from the filter list if (numMeasNotMatching == numMeasures) { filteredPoints().removeAt(i); } } // Tell the navtool that a list has been filtered and it needs to update emit filteredListModified(); return; }
/** * Filters a list of points and keeps points that have the * selected property or in the given range. Note: If a point * does not have Ignore=True but all measures of the point have * Ignore=True, this point will be considered "Ignored". The * filtered list will appear in the navtools point list display. * * @internal * @history 2008-11-26 Jeannie Walldren - Fixed comment. * @history 2009-01-08 Jeannie Walldren - Modified to remove * new filter points from the existing * filtered list. Previously, a new * filtered list was created from the * entire control net each time. * @history 2010-06-02 Jeannie Walldren - Modified to treat * a point as ignored if all of its * measures have Ignore=True * @history 2010-06-03 Jeannie Walldren - Replaced "0" with * ControlPoint::Ground in case * enumeration changes. * @history 2010-07-16 Tracie Sucharski - Implemented binary * control networks. * @history 2010-10-05 Tracie Sucharski - Remove multiple ground types, back * to simply tie or ground. Also help points no * longer an option. */ void QnetPointTypeFilter::filter() { // Make sure there is a control net loaded if (controlNet() == NULL) { QMessageBox::information((QWidget *)parent(), "Error", "No points to filter"); return; } // Make sure something is selected for filtering if (!m_pointType->isChecked() && !m_ignoreStatus->isChecked() && !m_editLockStatus->isChecked()) { QMessageBox::information((QWidget *)parent(),"Input Error", "You must select something to filter."); return; } // if Filter by Measure Type is selected but no Measure Type is checked, throw error if ((m_pointType->isChecked()) && !(m_fixed->isChecked() || m_constrained->isChecked() || m_free->isChecked())) { QMessageBox::information((QWidget *)parent(), "Input Error", "Filter by Point Type is selected. You must choose at least one " "Point Type to filter"); return; } // Loop through each value of the filtered points list checking the types of // each control point Loop in reverse order since removal list of elements // affects index number for (int i = filteredPoints().size() - 1; i >= 0; i--) { ControlPoint &cp = *(*controlNet())[filteredPoints()[i]]; // While keep is true, keep testing for next filter option bool keep = true; if (m_pointType->isChecked()) { if (!PointTypeMatched(cp.GetType())) keep = false; } if (keep && m_ignoreStatus->isChecked()) { // First check all measures in point. if all measures are ignored, // point is considered ignored. bool allMeasuresIgnored = true; for (int j = 0; j < cp.GetNumMeasures(); j++) { if (!cp[j]->IsIgnored()) { allMeasuresIgnored = false; break; } } if (m_ignored->isChecked() && !cp.IsIgnored() && !allMeasuresIgnored) { keep = false; } else if (m_notIgnored->isChecked() && (cp.IsIgnored() || allMeasuresIgnored)) { keep = false; } } if (keep && m_editLockStatus->isChecked()) { if (m_editLocked->isChecked() && !cp.IsEditLocked()) { keep = false; } else if (m_notEditLocked->isChecked() && cp.IsEditLocked()) { keep = false; } } if (!keep) filteredPoints().removeAt(i); } // Tell the navtool that a list has been filtered and it needs to update emit filteredListModified(); return; }
/** * Filters a list of images for images that have more or less * than the user entered number of points. The filtered list * will appear in the navtools cube list display. * * @internal * @history 2009-01-08 Jeannie Walldren - Modified to create * new filtered list from images in the * existing filtered list. Previously, * a new filtered list was created from * the entire serial number list each * time. */ void QnetCubePointsFilter::filter() { // Make sure we have a list of images to filter if (serialNumberList() == NULL) { QMessageBox::information((QWidget *)parent(), "Error", "No cubes to filter"); return; } // Make sure the user has entered a value for filtering int num = -1; if (m_pointEdit->text() == "") { QMessageBox::information((QWidget *)parent(), "Error", "Point value must be entered"); return; } // Get the value the user entered for filtering num = m_pointEdit->text().toInt(); // Loop through each image in the list // Loop in reverse order since removal of list elements affects index number for (int i = filteredImages().size() - 1; i >= 0; i--) { // Set up a counter parameter int count = 0; // Loop through each control point in the network for (int c = 0; c < controlNet()->GetNumPoints(); c++) { ControlPoint &cp = *(*controlNet())[c]; // Check to see if it has a measure on the current image for (int cm = 0; cm < cp.GetNumMeasures(); cm++) { // Increment the count if it does if ((cp[cm]->GetCubeSerialNumber()) == ((*serialNumberList()).SerialNumber(filteredImages()[i]))) { count++; break; } } } // If the count is greater than the number the user entered and the // greater than option was selected, add the image to the filtered list if (m_greaterThanRB->isChecked()) { if (count > num) continue; else filteredImages().removeAt(i); } // If the count is less than the number the user entered and the less than // option was selected, add the image to the filtered list else if (m_lessThanRB->isChecked()) { if (count < num) continue; else filteredImages().removeAt(i); } } // Tell the navtool a list has been filtered and it needs to update emit filteredListModified(); return; }