Loading isis/src/control/objs/ControlNetVitals/ControlNetVitals.cpp 0 → 100644 +259 −0 Original line number Diff line number Diff line #include "ControlNetVitals.h" #include <QList> #include "IException.h" #include "IString.h" #include "ControlNet.h" #include "ControlPoint.h" #include "ControlMeasure.h" namespace Isis { ControlNetVitals::ControlNetVitals(ControlNet *cnet) { m_controlNet = cnet; validate(); } ControlNetVitals::~ControlNetVitals() { } bool ControlNetVitals::hasIslands() { // Replace this with graph call!!!$!@$!@$!@$#@%#@$%#@ return true; } int ControlNetVitals::numIslands() { // replace this with graph call!#@$!#%#@%*($#) return 1; } QList< QList<QString> > ControlNetVitals::getIslands() { // TEMP, replace with graph QList<QString> list; list.append("CASSIS_01.cub"); QList< QList<QString> > outerList; outerList.append(list); return outerList; } int ControlNetVitals::numPoints() { return m_controlNet->GetNumPoints(); } // REFACTOR int ControlNetVitals::numIgnoredPoints() { int count = 0; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->IsIgnored()) { count++; } } return count; } int ControlNetVitals::numLockedPoints() { return m_controlNet->GetNumEditLockPoints(); } // REFACTOR int ControlNetVitals::numFixedPoints() { int count = 0; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Fixed) { count++; } } return count; } // REFACTOR int ControlNetVitals::numConstrainedPoints() { int count = 0; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Constrained) { count++; } } return count; } // REFACTOR int ControlNetVitals::numFreePoints() { int count = 0; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Free) { count++; } } return count; } // REFACTOR int ControlNetVitals::numPointsBelowMeasureThreshold(int num) { int count = 0; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetNumMeasures() < num) { count++; } } return count; } int ControlNetVitals::numImages() { return m_controlNet->GetCubeSerials().size(); } int ControlNetVitals::numMeasures() { return m_controlNet->GetNumMeasures(); } // REFACTOR int ControlNetVitals::numImagesBelowMeasureThreshold(int num) { int count = 0; foreach(QString serial, m_controlNet->GetCubeSerials()) { if (m_controlNet->GetMeasuresInCube(serial).size() < num) { count++; } } return count; } // REFACTOR int ControlNetVitals::numImagesBelowHullTolerance(int tolerance) { return 1; } QList<QString> ControlNetVitals::getCubeSerials() { return m_controlNet->GetCubeSerials(); } QList<ControlPoint*> ControlNetVitals::getAllPoints() { return m_controlNet->GetPoints(); } // REFACTOR QList<ControlPoint*> ControlNetVitals::getIgnoredPoints() { QList<ControlPoint*> ignoredPoints; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->IsIgnored()) ignoredPoints.append(point); } return ignoredPoints; } QList<ControlPoint*> ControlNetVitals::getLockedPoints() { QList<ControlPoint*> lockedPoints; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->IsEditLocked()) lockedPoints.append(point); } return lockedPoints; } QList<ControlPoint*> ControlNetVitals::getFixedPoints() { QList<ControlPoint*> fixedPoints; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Fixed) fixedPoints.append(point); } return fixedPoints; } QList<ControlPoint*> ControlNetVitals::getConstrainedPoints() { QList<ControlPoint*> constrainedPoints; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Constrained) constrainedPoints.append(point); } return constrainedPoints; } QList<ControlPoint*> ControlNetVitals::getFreePoints() { QList<ControlPoint*> freePoints; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Free) freePoints.append(point); } return freePoints; } // REFACTOR QList<ControlPoint*> ControlNetVitals::getPointsBelowMeasureThreshold(int num) { QList<ControlPoint*> belowThreshold; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetNumMeasures() < num) belowThreshold.append(point); } return belowThreshold; } QList<QString> ControlNetVitals::getAllImageSerials() { return m_controlNet->GetCubeSerials(); } // REFACTOR QList<QString> ControlNetVitals::getImagesBelowMeasureThreshold(int num) { QList<QString> imagesBelowThreshold; foreach(QString serial, m_controlNet->GetCubeSerials()) { if (m_controlNet->GetMeasuresInCube(serial).size() < num) imagesBelowThreshold.append(serial); } return imagesBelowThreshold; } // REFACTOR QList<QString> ControlNetVitals::getImagesBelowHullTolerance(int num) { QList<QString> list; list.append("Example.cub"); return list; } QString ControlNetVitals::getStatus() { return m_status; } QString ControlNetVitals::getStatusDetails() { return m_statusDetails; } QString ControlNetVitals::getNetworkId() { return m_controlNet->GetNetworkId(); } // // ImageVitals ControlNetVitals::getImageVitals(QString serial) { // return NULL; // } void ControlNetVitals::validate() { QString status = ""; QString details = ""; if (hasIslands()) { status = "Broken!"; details = "This network has " + toString(numIslands()) + " islands."; } else { if (numPointsBelowMeasureThreshold() < 3) { status = "Weak!"; details += "This network has " + toString(numPointsBelowMeasureThreshold()) + " points with less than 3 measures\n"; } if (numImagesBelowMeasureThreshold() < 3) { status = "Weak!"; details += "This network has " + toString(numImagesBelowMeasureThreshold()) + " images with less than 3 measures\n"; } if (numImagesBelowHullTolerance() > 0) { status = "Weak!"; details += "This network has " + toString(numImagesBelowHullTolerance()) + " images below the Convex Hull Tolerance of 75%\n"; } if (status.isEmpty()) { status = "Healthy!"; details = "This network is healthy."; } } updateStatus(status, details); } void ControlNetVitals::updateStatus(QString status, QString details) { m_status = status; m_statusDetails = details; emit networkChanged(); } } isis/src/control/objs/ControlNetVitals/ControlNetVitals.h 0 → 100644 +136 −0 Original line number Diff line number Diff line #ifndef ControlNetVitals_h #define ControlNetVitals_h /** * @file * $Revision: 1.2 $ * $Date: 2010/06/28 17:15:01 $ * * Unless noted otherwise, the portions of Isis written by the USGS are * public domain. See individual third-party library and package descriptions * for intellectual property information, user agreements, and related * information. * * Although Isis has been used by the USGS, no warranty, expressed or * implied, is made by the USGS as to the accuracy and functioning of such * software and related material nor shall the fact of distribution * constitute any such warranty, and no responsibility is assumed by the * USGS in connection therewith. * * For additional information, launch * $ISISROOT/doc/documents/Disclaimers/Disclaimers.html * in a browser or see the Privacy & Disclaimers page on the Isis website, * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ #include "ControlMeasure.h" #include "ControlNet.h" #include "ControlPoint.h" #include <QStringList> namespace Isis { class ControlNet; /** * @author 2018-05-28 Adam Goins * * @internal * @history 2018-05-28 Adam Goins - Initial Creation. */ class ControlNetVitals : public QObject { Q_OBJECT public: ControlNetVitals(ControlNet *net); virtual ~ControlNetVitals(); ControlNet *m_controlNet; QString m_status; QString m_statusDetails; bool hasIslands(); int numIslands(); QList< QList<QString> > getIslands(); int numPoints(); int numIgnoredPoints(); int numLockedPoints(); int numFixedPoints(); int numConstrainedPoints(); int numFreePoints(); int numPointsBelowMeasureThreshold(int num=3); int numImages(); int numMeasures(); int numImagesBelowMeasureThreshold(int num=3); int numImagesBelowHullTolerance(int tolerance=75); QList<QString> getCubeSerials(); QList<ControlPoint*> getAllPoints(); QList<ControlPoint*> getIgnoredPoints(); QList<ControlPoint*> getLockedPoints(); QList<ControlPoint*> getFixedPoints(); QList<ControlPoint*> getConstrainedPoints(); QList<ControlPoint*> getFreePoints(); QList<ControlPoint*> getPointsBelowMeasureThreshold(int num=3); QList<QString> getAllImageSerials(); QList<QString> getImagesBelowMeasureThreshold(int num=3); QList<QString> getImagesBelowHullTolerance(int num=75); QString getNetworkId(); QString getStatus(); QString getStatusDetails(); void updateStatus(QString status, QString details); // ImageVitals getImageVitals(QString serial); signals: void networkChanged(); public slots: void validate(); private: // QHash<QString, ImageVitals> m_imageVitals; // class ImageVitals { // public: // ImageVitals(QString cubeSerial, // QList<ControlMeasure*> measures, // QList<ControlMeasure*> validMeasures) { // m_serial = cubeSerial; // m_measures = measures; // m_validMeasures = validMeasures; // } // ~ImageVitals() {} // // QString getSerial { // return m_serial; // } // // QList<ControlMeasure> getMeasures() { // return m_measures; // }; // // QList<ControlMeasure> getValidMeasures() { // return m_validMeasures; // } // // // // private: // QString m_serial; // QList<ControlMeasure*> m_measures; // QList<ControlMeasure*> m_validMeasures; // ControlNet *m_controlNet; // }; }; }; #endif isis/src/control/objs/ControlNetVitals/Makefile 0 → 100644 +7 −0 Original line number Diff line number Diff line ifeq ($(ISISROOT), $(BLANK)) .SILENT: error: echo "Please set ISISROOT"; else include $(ISISROOT)/make/isismake.objs endif No newline at end of file isis/src/control/objs/ControlNetVitals/unitTest.cpp 0 → 100644 +14 −0 Original line number Diff line number Diff line #include <string> #include <iostream> #include "ControlNetVitals.h" #include "FileName.h" #include "IException.h" #include "Preference.h" using namespace Isis; using namespace std; int main() { } isis/src/qisis/apps/healthmonitor/Makefile 0 → 100644 +7 −0 Original line number Diff line number Diff line ifeq ($(ISISROOT), $(BLANK)) .SILENT: error: echo "Please set ISISROOT"; else include $(ISISROOT)/make/isismake.apps endif No newline at end of file Loading
isis/src/control/objs/ControlNetVitals/ControlNetVitals.cpp 0 → 100644 +259 −0 Original line number Diff line number Diff line #include "ControlNetVitals.h" #include <QList> #include "IException.h" #include "IString.h" #include "ControlNet.h" #include "ControlPoint.h" #include "ControlMeasure.h" namespace Isis { ControlNetVitals::ControlNetVitals(ControlNet *cnet) { m_controlNet = cnet; validate(); } ControlNetVitals::~ControlNetVitals() { } bool ControlNetVitals::hasIslands() { // Replace this with graph call!!!$!@$!@$!@$#@%#@$%#@ return true; } int ControlNetVitals::numIslands() { // replace this with graph call!#@$!#%#@%*($#) return 1; } QList< QList<QString> > ControlNetVitals::getIslands() { // TEMP, replace with graph QList<QString> list; list.append("CASSIS_01.cub"); QList< QList<QString> > outerList; outerList.append(list); return outerList; } int ControlNetVitals::numPoints() { return m_controlNet->GetNumPoints(); } // REFACTOR int ControlNetVitals::numIgnoredPoints() { int count = 0; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->IsIgnored()) { count++; } } return count; } int ControlNetVitals::numLockedPoints() { return m_controlNet->GetNumEditLockPoints(); } // REFACTOR int ControlNetVitals::numFixedPoints() { int count = 0; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Fixed) { count++; } } return count; } // REFACTOR int ControlNetVitals::numConstrainedPoints() { int count = 0; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Constrained) { count++; } } return count; } // REFACTOR int ControlNetVitals::numFreePoints() { int count = 0; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Free) { count++; } } return count; } // REFACTOR int ControlNetVitals::numPointsBelowMeasureThreshold(int num) { int count = 0; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetNumMeasures() < num) { count++; } } return count; } int ControlNetVitals::numImages() { return m_controlNet->GetCubeSerials().size(); } int ControlNetVitals::numMeasures() { return m_controlNet->GetNumMeasures(); } // REFACTOR int ControlNetVitals::numImagesBelowMeasureThreshold(int num) { int count = 0; foreach(QString serial, m_controlNet->GetCubeSerials()) { if (m_controlNet->GetMeasuresInCube(serial).size() < num) { count++; } } return count; } // REFACTOR int ControlNetVitals::numImagesBelowHullTolerance(int tolerance) { return 1; } QList<QString> ControlNetVitals::getCubeSerials() { return m_controlNet->GetCubeSerials(); } QList<ControlPoint*> ControlNetVitals::getAllPoints() { return m_controlNet->GetPoints(); } // REFACTOR QList<ControlPoint*> ControlNetVitals::getIgnoredPoints() { QList<ControlPoint*> ignoredPoints; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->IsIgnored()) ignoredPoints.append(point); } return ignoredPoints; } QList<ControlPoint*> ControlNetVitals::getLockedPoints() { QList<ControlPoint*> lockedPoints; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->IsEditLocked()) lockedPoints.append(point); } return lockedPoints; } QList<ControlPoint*> ControlNetVitals::getFixedPoints() { QList<ControlPoint*> fixedPoints; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Fixed) fixedPoints.append(point); } return fixedPoints; } QList<ControlPoint*> ControlNetVitals::getConstrainedPoints() { QList<ControlPoint*> constrainedPoints; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Constrained) constrainedPoints.append(point); } return constrainedPoints; } QList<ControlPoint*> ControlNetVitals::getFreePoints() { QList<ControlPoint*> freePoints; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetType() == ControlPoint::Free) freePoints.append(point); } return freePoints; } // REFACTOR QList<ControlPoint*> ControlNetVitals::getPointsBelowMeasureThreshold(int num) { QList<ControlPoint*> belowThreshold; foreach(ControlPoint* point, m_controlNet->GetPoints()) { if (point->GetNumMeasures() < num) belowThreshold.append(point); } return belowThreshold; } QList<QString> ControlNetVitals::getAllImageSerials() { return m_controlNet->GetCubeSerials(); } // REFACTOR QList<QString> ControlNetVitals::getImagesBelowMeasureThreshold(int num) { QList<QString> imagesBelowThreshold; foreach(QString serial, m_controlNet->GetCubeSerials()) { if (m_controlNet->GetMeasuresInCube(serial).size() < num) imagesBelowThreshold.append(serial); } return imagesBelowThreshold; } // REFACTOR QList<QString> ControlNetVitals::getImagesBelowHullTolerance(int num) { QList<QString> list; list.append("Example.cub"); return list; } QString ControlNetVitals::getStatus() { return m_status; } QString ControlNetVitals::getStatusDetails() { return m_statusDetails; } QString ControlNetVitals::getNetworkId() { return m_controlNet->GetNetworkId(); } // // ImageVitals ControlNetVitals::getImageVitals(QString serial) { // return NULL; // } void ControlNetVitals::validate() { QString status = ""; QString details = ""; if (hasIslands()) { status = "Broken!"; details = "This network has " + toString(numIslands()) + " islands."; } else { if (numPointsBelowMeasureThreshold() < 3) { status = "Weak!"; details += "This network has " + toString(numPointsBelowMeasureThreshold()) + " points with less than 3 measures\n"; } if (numImagesBelowMeasureThreshold() < 3) { status = "Weak!"; details += "This network has " + toString(numImagesBelowMeasureThreshold()) + " images with less than 3 measures\n"; } if (numImagesBelowHullTolerance() > 0) { status = "Weak!"; details += "This network has " + toString(numImagesBelowHullTolerance()) + " images below the Convex Hull Tolerance of 75%\n"; } if (status.isEmpty()) { status = "Healthy!"; details = "This network is healthy."; } } updateStatus(status, details); } void ControlNetVitals::updateStatus(QString status, QString details) { m_status = status; m_statusDetails = details; emit networkChanged(); } }
isis/src/control/objs/ControlNetVitals/ControlNetVitals.h 0 → 100644 +136 −0 Original line number Diff line number Diff line #ifndef ControlNetVitals_h #define ControlNetVitals_h /** * @file * $Revision: 1.2 $ * $Date: 2010/06/28 17:15:01 $ * * Unless noted otherwise, the portions of Isis written by the USGS are * public domain. See individual third-party library and package descriptions * for intellectual property information, user agreements, and related * information. * * Although Isis has been used by the USGS, no warranty, expressed or * implied, is made by the USGS as to the accuracy and functioning of such * software and related material nor shall the fact of distribution * constitute any such warranty, and no responsibility is assumed by the * USGS in connection therewith. * * For additional information, launch * $ISISROOT/doc/documents/Disclaimers/Disclaimers.html * in a browser or see the Privacy & Disclaimers page on the Isis website, * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ #include "ControlMeasure.h" #include "ControlNet.h" #include "ControlPoint.h" #include <QStringList> namespace Isis { class ControlNet; /** * @author 2018-05-28 Adam Goins * * @internal * @history 2018-05-28 Adam Goins - Initial Creation. */ class ControlNetVitals : public QObject { Q_OBJECT public: ControlNetVitals(ControlNet *net); virtual ~ControlNetVitals(); ControlNet *m_controlNet; QString m_status; QString m_statusDetails; bool hasIslands(); int numIslands(); QList< QList<QString> > getIslands(); int numPoints(); int numIgnoredPoints(); int numLockedPoints(); int numFixedPoints(); int numConstrainedPoints(); int numFreePoints(); int numPointsBelowMeasureThreshold(int num=3); int numImages(); int numMeasures(); int numImagesBelowMeasureThreshold(int num=3); int numImagesBelowHullTolerance(int tolerance=75); QList<QString> getCubeSerials(); QList<ControlPoint*> getAllPoints(); QList<ControlPoint*> getIgnoredPoints(); QList<ControlPoint*> getLockedPoints(); QList<ControlPoint*> getFixedPoints(); QList<ControlPoint*> getConstrainedPoints(); QList<ControlPoint*> getFreePoints(); QList<ControlPoint*> getPointsBelowMeasureThreshold(int num=3); QList<QString> getAllImageSerials(); QList<QString> getImagesBelowMeasureThreshold(int num=3); QList<QString> getImagesBelowHullTolerance(int num=75); QString getNetworkId(); QString getStatus(); QString getStatusDetails(); void updateStatus(QString status, QString details); // ImageVitals getImageVitals(QString serial); signals: void networkChanged(); public slots: void validate(); private: // QHash<QString, ImageVitals> m_imageVitals; // class ImageVitals { // public: // ImageVitals(QString cubeSerial, // QList<ControlMeasure*> measures, // QList<ControlMeasure*> validMeasures) { // m_serial = cubeSerial; // m_measures = measures; // m_validMeasures = validMeasures; // } // ~ImageVitals() {} // // QString getSerial { // return m_serial; // } // // QList<ControlMeasure> getMeasures() { // return m_measures; // }; // // QList<ControlMeasure> getValidMeasures() { // return m_validMeasures; // } // // // // private: // QString m_serial; // QList<ControlMeasure*> m_measures; // QList<ControlMeasure*> m_validMeasures; // ControlNet *m_controlNet; // }; }; }; #endif
isis/src/control/objs/ControlNetVitals/Makefile 0 → 100644 +7 −0 Original line number Diff line number Diff line ifeq ($(ISISROOT), $(BLANK)) .SILENT: error: echo "Please set ISISROOT"; else include $(ISISROOT)/make/isismake.objs endif No newline at end of file
isis/src/control/objs/ControlNetVitals/unitTest.cpp 0 → 100644 +14 −0 Original line number Diff line number Diff line #include <string> #include <iostream> #include "ControlNetVitals.h" #include "FileName.h" #include "IException.h" #include "Preference.h" using namespace Isis; using namespace std; int main() { }
isis/src/qisis/apps/healthmonitor/Makefile 0 → 100644 +7 −0 Original line number Diff line number Diff line ifeq ($(ISISROOT), $(BLANK)) .SILENT: error: echo "Please set ISISROOT"; else include $(ISISROOT)/make/isismake.apps endif No newline at end of file