Changeset 5a235ae in subsurface


Ignore:
Timestamp:
Mar 28, 2017, 11:17:03 AM (2 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
622ab22
Parents:
bb31c775
git-author:
Jan Mulder <jlmulder@…> (03/25/17 03:15:13)
git-committer:
Dirk Hohndel <dirk@…> (03/28/17 11:17:03)
Message:

minimal pO2 threshold: color the p02 graph also for minumum

Color the p02 graph also in red for going under the minumum p02 value as
set in the Preferences.

Signed-off-by: Jan Mulder <jlmulder@…>

Location:
profile-widget
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • profile-widget/diveprofileitem.cpp

    r597539c r5a235ae  
    971971        QPolygonF alertpoly;
    972972        alertPolygons.clear();
    973         double threshold = 0.0;
    974         if (thresholdPtr)
    975                 threshold = *thresholdPtr;
     973        double threshold_min = 100.0; // yes, a ridiculous high partial pressure
     974        double threshold_max = 0.0;
     975        if (thresholdPtrMax)
     976                threshold_max = *thresholdPtrMax;
     977        if (thresholdPtrMin)
     978                threshold_min = *thresholdPtrMin;
    976979        bool inAlertFragment = false;
    977980        for (int i = 0; i < dataModel->rowCount(); i++, entry++) {
     
    980983                QPointF point(hAxis->posAtValue(time), vAxis->posAtValue(value));
    981984                poly.push_back(point);
    982                 if (value >= threshold) {
     985                if (thresholdPtrMax && value >= threshold_max) {
     986                        if (inAlertFragment) {
     987                                alertPolygons.back().push_back(point);
     988                        } else {
     989                                alertpoly.clear();
     990                                alertpoly.push_back(point);
     991                                alertPolygons.append(alertpoly);
     992                                inAlertFragment = true;
     993                        }
     994                } else if (thresholdPtrMin && value <= threshold_min) {
    983995                        if (inAlertFragment) {
    984996                                alertPolygons.back().push_back(point);
     
    10161028}
    10171029
    1018 void PartialPressureGasItem::setThreshouldSettingsKey(double *prefPointer)
    1019 {
    1020         thresholdPtr = prefPointer;
     1030void PartialPressureGasItem::setThreshouldSettingsKey(double *prefPointerMin, double *prefPointerMax)
     1031{
     1032        thresholdPtrMin = prefPointerMin;
     1033        thresholdPtrMax = prefPointerMax;
    10211034}
    10221035
    10231036PartialPressureGasItem::PartialPressureGasItem() :
    1024         thresholdPtr(NULL)
     1037        thresholdPtrMin(NULL),
     1038        thresholdPtrMax(NULL)
    10251039{
    10261040}
  • profile-widget/diveprofileitem.h

    rfd46167 r5a235ae  
    216216        virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
    217217        virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
    218         void setThreshouldSettingsKey(double *prefPointer);
     218        void setThreshouldSettingsKey(double *prefPointerMin, double *prefPointerMax);
    219219        void setVisibilitySettingsKey(const QString &setVisibilitySettingsKey);
    220220        void setColors(const QColor &normalColor, const QColor &alertColor);
     
    222222private:
    223223        QVector<QPolygonF> alertPolygons;
    224         double *thresholdPtr;
     224        double *thresholdPtrMin;
     225        double *thresholdPtrMax;
    225226        QString visibilityKey;
    226227        QColor normalColor;
  • profile-widget/profilewidget2.cpp

    rbb31c775 r5a235ae  
    343343        setupItem(meanDepthItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::INSTANT_MEANDEPTH, DivePlotDataModel::TIME, 1);
    344344
    345 #define CREATE_PP_GAS(ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS)              \
     345#define CREATE_PP_GAS(ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS_MIN, THRESHOULD_SETTINGS_MAX)              \
    346346        setupItem(ITEM, timeAxis, gasYAxis, dataModel, DivePlotDataModel::VERTICAL_COLUMN, DivePlotDataModel::TIME, 0); \
    347         ITEM->setThreshouldSettingsKey(THRESHOULD_SETTINGS);                                                            \
     347        ITEM->setThreshouldSettingsKey(THRESHOULD_SETTINGS_MIN, THRESHOULD_SETTINGS_MAX);                                                            \
    348348        ITEM->setColors(getColor(COLOR, isGrayscale), getColor(COLOR_ALERT, isGrayscale));                              \
    349349        ITEM->settingsChanged();                                                                                        \
    350350        ITEM->setZValue(99);
    351351
    352         CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, &prefs.pp_graphs.pn2_threshold);
    353         CREATE_PP_GAS(pheGasItem, PHE, PHE, PHE_ALERT, &prefs.pp_graphs.phe_threshold);
    354         CREATE_PP_GAS(po2GasItem, PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_max);
    355         CREATE_PP_GAS(o2SetpointGasItem, O2SETPOINT, PO2_ALERT, PO2_ALERT, &prefs.pp_graphs.po2_threshold_max);
    356         CREATE_PP_GAS(ccrsensor1GasItem, CCRSENSOR1, CCRSENSOR1, PO2_ALERT, &prefs.pp_graphs.po2_threshold_max);
    357         CREATE_PP_GAS(ccrsensor2GasItem, CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_max);
    358         CREATE_PP_GAS(ccrsensor3GasItem, CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold_max);
     352        CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, NULL, &prefs.pp_graphs.pn2_threshold);
     353        CREATE_PP_GAS(pheGasItem, PHE, PHE, PHE_ALERT, NULL, &prefs.pp_graphs.phe_threshold);
     354        CREATE_PP_GAS(po2GasItem, PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
     355        CREATE_PP_GAS(o2SetpointGasItem, O2SETPOINT, PO2_ALERT, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
     356        CREATE_PP_GAS(ccrsensor1GasItem, CCRSENSOR1, CCRSENSOR1, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
     357        CREATE_PP_GAS(ccrsensor2GasItem, CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
     358        CREATE_PP_GAS(ccrsensor3GasItem, CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
    359359
    360360#undef CREATE_PP_GAS
Note: See TracChangeset for help on using the changeset viewer.