mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-06 19:20:45 +00:00
Dynamic Scaling
This commit is contained in:
parent
2b0845a32c
commit
f63bb39d54
@ -143,34 +143,10 @@ some messages from Apnea Board.
|
|||||||
//#define MAP_LOG_EVENTS
|
//#define MAP_LOG_EVENTS
|
||||||
//#define ENABLE_UNEVEN_MACHINE_MIN_MAX_TEST
|
//#define ENABLE_UNEVEN_MACHINE_MIN_MAX_TEST
|
||||||
|
|
||||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
/ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||||
// Define Display macros to enhance displays
|
// Define Display macros to enhance displays
|
||||||
|
|
||||||
|
|
||||||
#define DEBUGQ qDebug()
|
|
||||||
#define DEBUGT qDebug()<<QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz") << QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__
|
|
||||||
#define DEBUGF qDebug()<<QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__ << __func__
|
|
||||||
#define DEBUGTF qDebug()<<QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz") << QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__ << __func__
|
|
||||||
|
|
||||||
#include <QRegularExpression>
|
|
||||||
#define DEBUG qDebug()<<QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__
|
|
||||||
#define TIMEO( DD , XX ) " " #DD ":" << QDateTime::fromMSecsSinceEpoch( XX ).time().toString("hh:mm:ss.zzz")
|
|
||||||
#define TIME( XX ) QDateTime::fromMSecsSinceEpoch( XX ).time().toString("hh:mm:ss.zzz")
|
|
||||||
#define O( XX ) " " #XX ":" << XX
|
|
||||||
#define OO( XX , YY ) " " #XX ":" << YY
|
|
||||||
#define FULLNAME( id) schema::channel[ id ].fullname()
|
|
||||||
#define PLACE (QString(basename( __FILE__)).remove(QRegularExpression("\\..*$"))) << __LINE__
|
|
||||||
|
|
||||||
#define DATETIME( XX ) QDateTime::fromMSecsSinceEpoch( XX ).toString("dd MMM yyyy hh:mm:ss.zzz")
|
|
||||||
#define DATE( XX ) QDateTime::fromMSecsSinceEpoch( XX ).toString("dd MMM yyyy")
|
|
||||||
#define DATEO( XX ) " " #XX ":" << QDateTime::fromMSecsSinceEpoch( XX ).toString("dd MMM yyyy")
|
|
||||||
#define TIME2( XX ) " " #XX ":" << XX << QDateTime::fromMSecsSinceEpoch( XX ).time().toString("hh:mm:ss.zzz")
|
|
||||||
#define NAME( id) schema::channel[ id ].label()
|
|
||||||
|
|
||||||
//#define ENABLE_TEST_NODATA // no valid samples.
|
|
||||||
//#define ENABLE_TEST_SINGLE // a single value.
|
|
||||||
//#define ENABLE_TEST_CPAP // change all values to a single value.
|
|
||||||
//#define ENABLE_TEST_SAWTOOTH // change all sample time and value to a sawtooth
|
|
||||||
#endif
|
#endif
|
||||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||||
|
|
||||||
@ -180,6 +156,9 @@ some messages from Apnea Board.
|
|||||||
#define test_data(A,B,C,D,E,F,G,H)
|
#define test_data(A,B,C,D,E,F,G,H)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TEST_MACROS_ENABLEDoff
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||||
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||||
@ -553,7 +532,6 @@ void RecalcMAP::updateTimesValues(qint64 d1,qint64 d2, int key,PressureInfo & in
|
|||||||
|
|
||||||
//! \brief Updates Time At Pressure from session *sess
|
//! \brief Updates Time At Pressure from session *sess
|
||||||
void RecalcMAP::updateTimes(PressureInfo & info) {
|
void RecalcMAP::updateTimes(PressureInfo & info) {
|
||||||
//DEBUGF <<DATETIME(sessStartTime) << "CALLED" <<TIME(sessStartTime) <<TIME(sessEndTime);
|
|
||||||
qint64 d1,d2;
|
qint64 d1,d2;
|
||||||
qint64 minx=0,maxx=0;
|
qint64 minx=0,maxx=0;
|
||||||
//qint64 prevSessDuration=info.totalDuration;
|
//qint64 prevSessDuration=info.totalDuration;
|
||||||
@ -1080,7 +1058,6 @@ void MinutesAtPressure::setEnabled(gGraph &graph) {
|
|||||||
} else {
|
} else {
|
||||||
value &= pressureGraphLC->m_flags_enabled[ch];
|
value &= pressureGraphLC->m_flags_enabled[ch];
|
||||||
}
|
}
|
||||||
//DEBUGF << FULLNAME(ch) << O(value);
|
|
||||||
m_enabled[ch]=value;
|
m_enabled[ch]=value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
* License. See the file COPYING in the main directory of the source code
|
* License. See the file COPYING in the main directory of the source code
|
||||||
* for more details. */
|
* for more details. */
|
||||||
|
|
||||||
|
#define TEST_MACROS_ENABLEDoff
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
#include "Graphs/gGraph.h"
|
#include "Graphs/gGraph.h"
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@ -131,6 +134,7 @@ gGraph::gGraph(QString name, gGraphView *graphview, QString title, QString units
|
|||||||
m_units(units),
|
m_units(units),
|
||||||
m_visible(true)
|
m_visible(true)
|
||||||
{
|
{
|
||||||
|
// DEBUGF Q(name) Q(title) QQ("UNITS",units) Q(height) Q(group);
|
||||||
if (height == 0) {
|
if (height == 0) {
|
||||||
height = AppSetting->graphHeight();
|
height = AppSetting->graphHeight();
|
||||||
Q_UNUSED(height)
|
Q_UNUSED(height)
|
||||||
@ -153,7 +157,7 @@ gGraph::gGraph(QString name, gGraphView *graphview, QString title, QString units
|
|||||||
min_x = min_y = 0;
|
min_x = min_y = 0;
|
||||||
rec_miny = rec_maxy = 0;
|
rec_miny = rec_maxy = 0;
|
||||||
rphysmax_y = rphysmin_y = 0;
|
rphysmax_y = rphysmin_y = 0;
|
||||||
m_zoomY = 0;
|
m_zoomY = ZS_AUTO_FIT;
|
||||||
m_selectedDuration = 0;
|
m_selectedDuration = 0;
|
||||||
|
|
||||||
if (graphview) {
|
if (graphview) {
|
||||||
@ -281,9 +285,23 @@ void gGraph::setDay(Day *day)
|
|||||||
// ResetBounds();
|
// ResetBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gGraph::setZoomY(short zoom)
|
void gGraph::setZoomY(ZoomyScaling zoomy) {
|
||||||
{
|
m_zoomY = zoomy;
|
||||||
m_zoomY = zoom;
|
dynamicScalingOn =false;
|
||||||
|
timedRedraw(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gGraph::mouseDoubleClickYAxis(QMouseEvent * ) {
|
||||||
|
if ( isDynamicScalingEnabled() ) {
|
||||||
|
dynamicScalingOn = !dynamicScalingOn;
|
||||||
|
} else {
|
||||||
|
dynamicScalingOn =false;
|
||||||
|
if (m_zoomY == ZS_AUTO_FIT ) {
|
||||||
|
m_zoomY = ZS_DEFAULT;
|
||||||
|
} else if (m_zoomY == ZS_DEFAULT) {
|
||||||
|
m_zoomY = ZS_AUTO_FIT ;
|
||||||
|
}
|
||||||
|
}
|
||||||
timedRedraw(0);
|
timedRedraw(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -564,22 +582,67 @@ void gGraph::ToolTip(QString text, int x, int y, ToolTipAlignment align, int tim
|
|||||||
m_graphview->m_tooltip->display(text, x, y, align, timeout);
|
m_graphview->m_tooltip->display(text, x, y, align, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool gGraph::isDynamicScalingEnabled() {
|
||||||
|
return ((m_lineChart_layer!=nullptr) && AppSetting->allowYAxisScaling() );
|
||||||
|
}
|
||||||
|
|
||||||
|
QString gGraph::unitsTooltip() {
|
||||||
|
if (isDynamicScalingEnabled()) {
|
||||||
|
if(dynamicScalingOn) {
|
||||||
|
if (zoomY() == ZS_AUTO_FIT ) {
|
||||||
|
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: Return to AUTO-FIT Scaling"));
|
||||||
|
} else if (zoomY() == ZS_DEFAULT ) {
|
||||||
|
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: Return to DEFAULT Scaling"));
|
||||||
|
} else {
|
||||||
|
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: Return to OVERRIDE Scaling"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: For Dynamic Scaling"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (zoomY() == ZS_AUTO_FIT ) {
|
||||||
|
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: Select DEFAULT Scaling"));
|
||||||
|
} else if (zoomY() == ZS_DEFAULT ) {
|
||||||
|
return QString("%1%2%3").arg(m_units).arg("\n").arg(tr("Double click Y-axis: Select AUTO-FIT Scaling"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m_units;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gGraph::dynamicScaling(EventDataType &miny, EventDataType &maxy) {
|
||||||
|
// Have new Dynamic mode;
|
||||||
|
miny = m_lineChart_layer->actualMinY();
|
||||||
|
maxy = m_lineChart_layer->actualMaxY();
|
||||||
|
EventDataType diff= (maxy-miny);
|
||||||
|
maxy += diff*0.08; // more space at top for event ticks.
|
||||||
|
miny -= diff*0.04;
|
||||||
|
if (m_saved_minY!=m_lineChart_layer->actualMinY() || m_saved_maxY!=m_lineChart_layer->actualMaxY() ) {
|
||||||
|
// DEBUGF O(m_name) Q(m_saved_minY) QQ("==>",m_lineChart_layer->actualMinY() ) QQ("==>",miny) Q(m_saved_maxY) QQ("==>",m_lineChart_layer->actualMaxY() ) QQ("==>",maxy);
|
||||||
|
m_saved_minY=m_lineChart_layer->actualMinY();
|
||||||
|
m_saved_maxY=m_lineChart_layer->actualMaxY();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// YAxis Autoscaling code
|
// YAxis Autoscaling code
|
||||||
void gGraph::roundY(EventDataType &miny, EventDataType &maxy)
|
void gGraph::roundY(EventDataType &miny, EventDataType &maxy)
|
||||||
{
|
{
|
||||||
|
if (dynamicScalingOn) {
|
||||||
if (zoomY() == 2) {
|
dynamicScaling(miny, maxy) ;
|
||||||
|
if (maxy > miny) return;
|
||||||
|
};
|
||||||
|
if (zoomY() == ZS_OVERRIDE) { // Have override mode
|
||||||
|
// set min and max to override values.
|
||||||
miny = rec_miny;
|
miny = rec_miny;
|
||||||
maxy = rec_maxy;
|
maxy = rec_maxy;
|
||||||
if (maxy > miny) return;
|
if (maxy > miny) return; // Not Autoscaling
|
||||||
} else if (zoomY() ==1) {
|
} else if (zoomY() ==ZS_DEFAULT) { // Have Default mode
|
||||||
|
// set min and max to physical Min / max values.
|
||||||
miny = physMinY();
|
miny = physMinY();
|
||||||
maxy = physMaxY();
|
maxy = physMaxY();
|
||||||
if (maxy > miny) return;
|
if (maxy > miny) return; // Not Autoscaling
|
||||||
}
|
}
|
||||||
miny = MinY();
|
miny = MinY();
|
||||||
maxy = MaxY();
|
maxy = MaxY();
|
||||||
|
|
||||||
int m, t;
|
int m, t;
|
||||||
bool ymin_good = false, ymax_good = false;
|
bool ymin_good = false, ymax_good = false;
|
||||||
|
|
||||||
@ -685,6 +748,11 @@ void gGraph::AddLayer(Layer *l, LayerPosition position, short width, short heigh
|
|||||||
l->setPos(x, y);
|
l->setPos(x, y);
|
||||||
l->addref();
|
l->addref();
|
||||||
m_layers.push_back(l);
|
m_layers.push_back(l);
|
||||||
|
|
||||||
|
if (l->layerType()==LT_LineChart) {
|
||||||
|
m_lineChart_layer = dynamic_cast<gLineChart *>(l);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gGraph::dataChanged()
|
void gGraph::dataChanged()
|
||||||
@ -1111,24 +1179,6 @@ void gGraph::mouseDoubleClickEvent(QMouseEvent *event)
|
|||||||
layer->mouseDoubleClickEvent(event, this);
|
layer->mouseDoubleClickEvent(event, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//int w=m_lastbounds.width()-(m_marginleft+left+right+m_marginright);
|
|
||||||
//int h=m_lastbounds.height()-(bottom+m_marginbottom);
|
|
||||||
//int x2=m_graphview->pointClicked().x(),y2=m_graphview->pointClicked().y();
|
|
||||||
// if ((m_graphview->horizTravel()<mouse_movement_threshold) && (x>left+m_marginleft && x<w+m_marginleft+left && y>top+m_margintop && y<h)) { // normal click in main area
|
|
||||||
// if (event->button() & Qt::RightButton) {
|
|
||||||
// ZoomX(1.66,x); // Zoon out
|
|
||||||
// return;
|
|
||||||
// } else if (event->button() & Qt::LeftButton) {
|
|
||||||
// ZoomX(0.75/2.0,x); // zoom in.
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// Propagate the events to graph Layers
|
|
||||||
// }
|
|
||||||
//mousePressEvent(event);
|
|
||||||
//mouseReleaseEvent(event);
|
|
||||||
//qDebug() << m_title << "Double Clicked" << event->x() << event->y();
|
|
||||||
}
|
}
|
||||||
void gGraph::keyPressEvent(QKeyEvent *event)
|
void gGraph::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
@ -1416,16 +1466,14 @@ void gGraph::SetMaxY(EventDataType v)
|
|||||||
|
|
||||||
Layer *gGraph::getLineChart()
|
Layer *gGraph::getLineChart()
|
||||||
{
|
{
|
||||||
gLineChart *lc;
|
if (m_lineChart_layer) return m_lineChart_layer;
|
||||||
|
|
||||||
for (auto & layer : m_layers) {
|
for (auto & layer : m_layers) {
|
||||||
lc = dynamic_cast<gLineChart *>(layer);
|
Layer *tmp = dynamic_cast<gLineChart *>(layer);
|
||||||
|
if (tmp) m_lineChart_layer = tmp;
|
||||||
if (lc) { return lc; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gGraph::minHeight()
|
int gGraph::minHeight()
|
||||||
{
|
{
|
||||||
int minheight = m_min_height;
|
int minheight = m_min_height;
|
||||||
|
@ -35,6 +35,8 @@ void DestroyGraphGlobals();
|
|||||||
|
|
||||||
const int mouse_movement_threshold = 6;
|
const int mouse_movement_threshold = 6;
|
||||||
|
|
||||||
|
enum ZoomyScaling {ZS_AUTO_FIT =0 , ZS_DEFAULT =1 , ZS_OVERRIDE =2};
|
||||||
|
|
||||||
float CatmullRomSpline(float p0, float p1, float p2, float p3, float t = 0.5);
|
float CatmullRomSpline(float p0, float p1, float p2, float p3, float t = 0.5);
|
||||||
|
|
||||||
inline void GetTextExtent(QString text, int &width, int &height, QFont *font)
|
inline void GetTextExtent(QString text, int &width, int &height, QFont *font)
|
||||||
@ -164,6 +166,9 @@ class gGraph : public QObject
|
|||||||
//! \brief Returns the measurement Units the Y scale is referring to
|
//! \brief Returns the measurement Units the Y scale is referring to
|
||||||
QString units() { return m_units; }
|
QString units() { return m_units; }
|
||||||
|
|
||||||
|
//! \brief Returns the measurement Units the Y scale is referring to plus tooltip.
|
||||||
|
QString unitsTooltip() ;
|
||||||
|
|
||||||
//! \brief Sets the measurement Units the Y scale is referring to
|
//! \brief Sets the measurement Units the Y scale is referring to
|
||||||
void setUnits(const QString units) { m_units = units; }
|
void setUnits(const QString units) { m_units = units; }
|
||||||
|
|
||||||
@ -303,9 +308,14 @@ class gGraph : public QObject
|
|||||||
bool isSnapshot() { return m_snapshot; }
|
bool isSnapshot() { return m_snapshot; }
|
||||||
void setSnapshot(bool b) { m_snapshot = b; }
|
void setSnapshot(bool b) { m_snapshot = b; }
|
||||||
|
|
||||||
|
// returns if graph is a daily line chart with Dynamic Scaling mode enabled.
|
||||||
|
bool isDynamicScalingEnabled();
|
||||||
|
|
||||||
short left, right, top, bottom; // dirty magin hacks..
|
short left, right, top, bottom; // dirty magin hacks..
|
||||||
|
|
||||||
Layer *getLineChart();
|
Layer *getLineChart();
|
||||||
|
Layer *m_lineChart_layer =nullptr ;
|
||||||
|
bool dynamicScalingOn =false;
|
||||||
QTimer *timer;
|
QTimer *timer;
|
||||||
|
|
||||||
// This gets set to true to force a redraw of the yAxis tickers when graphs are resized.
|
// This gets set to true to force a redraw of the yAxis tickers when graphs are resized.
|
||||||
@ -318,10 +328,8 @@ class gGraph : public QObject
|
|||||||
gGraphView *graphView() { return m_graphview; }
|
gGraphView *graphView() { return m_graphview; }
|
||||||
short m_marginleft, m_marginright, m_margintop, m_marginbottom;
|
short m_marginleft, m_marginright, m_margintop, m_marginbottom;
|
||||||
|
|
||||||
inline short zoomY() { return m_zoomY; }
|
inline ZoomyScaling zoomY() { return m_zoomY; }
|
||||||
void setZoomY(short zoom);
|
void setZoomY(ZoomyScaling zoomy);
|
||||||
|
|
||||||
static const short maxZoomY = 2;
|
|
||||||
|
|
||||||
inline qint64 selectedDuration() const { return m_selectedDuration; }
|
inline qint64 selectedDuration() const { return m_selectedDuration; }
|
||||||
inline QString selDurString() const { return m_selDurString; }
|
inline QString selDurString() const { return m_selDurString; }
|
||||||
@ -331,6 +339,8 @@ class gGraph : public QObject
|
|||||||
|
|
||||||
inline bool printing() const { return m_printing; }
|
inline bool printing() const { return m_printing; }
|
||||||
|
|
||||||
|
void mouseDoubleClickYAxis(QMouseEvent *event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! \brief Mouse Wheel events
|
//! \brief Mouse Wheel events
|
||||||
virtual void wheelEvent(QWheelEvent *event);
|
virtual void wheelEvent(QWheelEvent *event);
|
||||||
@ -353,6 +363,8 @@ class gGraph : public QObject
|
|||||||
//! \brief Key Pressed event
|
//! \brief Key Pressed event
|
||||||
virtual void keyReleaseEvent(QKeyEvent *event);
|
virtual void keyReleaseEvent(QKeyEvent *event);
|
||||||
|
|
||||||
|
void dynamicScaling(EventDataType &miny, EventDataType &maxy);
|
||||||
|
|
||||||
void cancelSelection() {
|
void cancelSelection() {
|
||||||
m_selecting_area = false;
|
m_selecting_area = false;
|
||||||
m_selection = QRect(0,0,0,0);
|
m_selection = QRect(0,0,0,0);
|
||||||
@ -389,7 +401,7 @@ class gGraph : public QObject
|
|||||||
bool m_showTitle;
|
bool m_showTitle;
|
||||||
bool m_printing;
|
bool m_printing;
|
||||||
bool m_pinned;
|
bool m_pinned;
|
||||||
short m_zoomY;
|
ZoomyScaling m_zoomY;
|
||||||
bool m_block_select;
|
bool m_block_select;
|
||||||
QRect m_rect;
|
QRect m_rect;
|
||||||
|
|
||||||
@ -401,6 +413,8 @@ class gGraph : public QObject
|
|||||||
QString m_selDurString;
|
QString m_selDurString;
|
||||||
|
|
||||||
bool m_snapshot;
|
bool m_snapshot;
|
||||||
|
EventDataType m_saved_minY=0;
|
||||||
|
EventDataType m_saved_maxY=0;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
//! \brief Deselects any highlights, and schedules a main gGraphView redraw
|
//! \brief Deselects any highlights, and schedules a main gGraphView redraw
|
||||||
|
@ -7,21 +7,9 @@
|
|||||||
* License. See the file COPYING in the main directory of the source code
|
* License. See the file COPYING in the main directory of the source code
|
||||||
* for more details. */
|
* for more details. */
|
||||||
|
|
||||||
#define xDEBUG_FUNCTIONS
|
#define TEST_MACROS_ENABLEDoff
|
||||||
#ifdef DEBUG_FUNCTIONS
|
#include "test_macros.h"
|
||||||
#include <QRegularExpression>
|
|
||||||
#define DEBUG qDebug()<<QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__
|
|
||||||
#define DEBUGTF qDebug()<<QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz") << QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__ << __func__
|
|
||||||
#define DEBUGF qDebug()<< QString("%1[%2]%3").arg( QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) ).arg(__LINE__).arg(__func__)
|
|
||||||
|
|
||||||
#define O( XX ) " " #XX ":" << XX
|
|
||||||
#define Q( XX ) << #XX ":" << XX
|
|
||||||
#define R( XX )
|
|
||||||
#define OO( XX , YY ) " " #XX ":" << YY
|
|
||||||
#define NAME( id) schema::channel[ id ].label()
|
|
||||||
#define DATE( XX ) QDateTime::fromMSecsSinceEpoch(XX).toString("dd MMM yyyy")
|
|
||||||
#define DATETIME( XX ) QDateTime::fromMSecsSinceEpoch(XX).toString("dd MMM yyyy hh:mm:ss.zzz")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "Graphs/gGraphView.h"
|
#include "Graphs/gGraphView.h"
|
||||||
|
|
||||||
@ -560,7 +548,6 @@ void gGraphView::popoutGraph()
|
|||||||
dock->resize(width(),0);
|
dock->resize(width(),0);
|
||||||
// QScrollArea
|
// QScrollArea
|
||||||
}
|
}
|
||||||
|
|
||||||
//////// Create dock widget and resize dock to hold new widget
|
//////// Create dock widget and resize dock to hold new widget
|
||||||
QDockWidget * newDockWidget = new QDockWidget(dock);
|
QDockWidget * newDockWidget = new QDockWidget(dock);
|
||||||
newDockWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
newDockWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
@ -2061,8 +2048,8 @@ void MinMaxWidget::onMaxChanged(double d)
|
|||||||
}
|
}
|
||||||
void MinMaxWidget::onResetClicked()
|
void MinMaxWidget::onResetClicked()
|
||||||
{
|
{
|
||||||
int tmp = graph->zoomY();
|
ZoomyScaling tmp = graph->zoomY();
|
||||||
graph->setZoomY(0);
|
graph->setZoomY(ZS_AUTO_FIT);
|
||||||
EventDataType miny = graph->MinY(),
|
EventDataType miny = graph->MinY(),
|
||||||
maxy = graph->MaxY();
|
maxy = graph->MaxY();
|
||||||
|
|
||||||
@ -2084,15 +2071,16 @@ void MinMaxWidget::onResetClicked()
|
|||||||
graph->setZoomY(tmp);
|
graph->setZoomY(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinMaxWidget::onComboChanged(int idx)
|
void MinMaxWidget::onComboChanged(int _idx)
|
||||||
{
|
{
|
||||||
minbox->setEnabled(idx == 2);
|
ZoomyScaling idx = static_cast<ZoomyScaling>(_idx) ;
|
||||||
maxbox->setEnabled(idx == 2);
|
minbox->setEnabled(idx == ZS_OVERRIDE);
|
||||||
reset->setEnabled(idx == 2);
|
maxbox->setEnabled(idx == ZS_OVERRIDE);
|
||||||
|
reset->setEnabled(idx == ZS_OVERRIDE);
|
||||||
|
|
||||||
graph->setZoomY(idx);
|
graph->setZoomY(idx);
|
||||||
|
|
||||||
if (idx == 2) {
|
if (idx == ZS_OVERRIDE) {
|
||||||
if (qAbs(graph->rec_maxy - graph->rec_miny) < 0.0001) {
|
if (qAbs(graph->rec_maxy - graph->rec_miny) < 0.0001) {
|
||||||
onResetClicked();
|
onResetClicked();
|
||||||
}
|
}
|
||||||
@ -2106,9 +2094,9 @@ void MinMaxWidget::createLayout()
|
|||||||
layout->setSpacing(4);
|
layout->setSpacing(4);
|
||||||
|
|
||||||
combobox = new QComboBox(this);
|
combobox = new QComboBox(this);
|
||||||
combobox->addItem(tr("Auto-Fit"), 0);
|
combobox->addItem(tr("Auto-Fit"), ZS_AUTO_FIT);
|
||||||
combobox->addItem(tr("Defaults"), 1);
|
combobox->addItem(tr("Defaults"), ZS_DEFAULT);
|
||||||
combobox->addItem(tr("Override"), 2);
|
combobox->addItem(tr("Override"), ZS_OVERRIDE);
|
||||||
combobox->setToolTip(tr("The Y-Axis scaling mode, 'Auto-Fit' for automatic scaling, 'Defaults' for settings according to manufacturer, and 'Override' to choose your own."));
|
combobox->setToolTip(tr("The Y-Axis scaling mode, 'Auto-Fit' for automatic scaling, 'Defaults' for settings according to manufacturer, and 'Override' to choose your own."));
|
||||||
connect(combobox, SIGNAL(activated(int)), this, SLOT(onComboChanged(int)));
|
connect(combobox, SIGNAL(activated(int)), this, SLOT(onComboChanged(int)));
|
||||||
|
|
||||||
@ -3533,7 +3521,7 @@ void gGraphView::SaveSettings(QString title)
|
|||||||
out << graph->visible();
|
out << graph->visible();
|
||||||
out << graph->RecMinY();
|
out << graph->RecMinY();
|
||||||
out << graph->RecMaxY();
|
out << graph->RecMaxY();
|
||||||
out << graph->zoomY();
|
out << (short)graph->zoomY(); // the return type of zoomY was changed from a short to an enum (int) so much type cast it here
|
||||||
out << (bool)graph->isPinned();
|
out << (bool)graph->isPinned();
|
||||||
|
|
||||||
gLineChart * lc = dynamic_cast<gLineChart *>(findLayer(graph, LT_LineChart));
|
gLineChart * lc = dynamic_cast<gLineChart *>(findLayer(graph, LT_LineChart));
|
||||||
@ -3663,7 +3651,7 @@ bool gGraphView::LoadSettings(QString title)
|
|||||||
g->setVisible(vis);
|
g->setVisible(vis);
|
||||||
g->setRecMinY(recminy);
|
g->setRecMinY(recminy);
|
||||||
g->setRecMaxY(recmaxy);
|
g->setRecMaxY(recmaxy);
|
||||||
g->setZoomY(zoomy);
|
g->setZoomY(static_cast<ZoomyScaling>(zoomy));
|
||||||
g->setPinned(pinned);
|
g->setPinned(pinned);
|
||||||
|
|
||||||
if (gvversion >= 4) {
|
if (gvversion >= 4) {
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
* License. See the file COPYING in the main directory of the source code
|
* License. See the file COPYING in the main directory of the source code
|
||||||
* for more details. */
|
* for more details. */
|
||||||
|
|
||||||
|
|
||||||
|
#define TEST_MACROS_ENABLEDoff
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
#include "Graphs/gLineChart.h"
|
#include "Graphs/gLineChart.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@ -275,6 +279,7 @@ skipcheck:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EventDataType gLineChart::Miny()
|
EventDataType gLineChart::Miny()
|
||||||
{
|
{
|
||||||
if (m_codes.size() == 0) return 0;
|
if (m_codes.size() == 0) return 0;
|
||||||
@ -373,6 +378,7 @@ QString gLineChart::getMetaString(qint64 time)
|
|||||||
// Time Domain Line Chart
|
// Time Domain Line Chart
|
||||||
void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||||
{
|
{
|
||||||
|
EventDataType actual_min_y, actual_max_y;
|
||||||
QRectF rect = region.boundingRect();
|
QRectF rect = region.boundingRect();
|
||||||
rect.translate(0.0f, 0.001f);
|
rect.translate(0.0f, 0.001f);
|
||||||
// TODO: Just use QRect directly.
|
// TODO: Just use QRect directly.
|
||||||
@ -395,6 +401,8 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actual_min_y = INT_MAX;
|
||||||
|
actual_max_y = -INT_MAX;
|
||||||
|
|
||||||
top++;
|
top++;
|
||||||
|
|
||||||
@ -551,6 +559,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
painter.setPen(QPen(QBrush(color), lineThickness, Qt::DotLine));
|
painter.setPen(QPen(QBrush(color), lineThickness, Qt::DotLine));
|
||||||
EventDataType y=top + height + 1 - ((dot.value - miny) * ymult);
|
EventDataType y=top + height + 1 - ((dot.value - miny) * ymult);
|
||||||
painter.drawLine(left + 1, y, left + 1 + width, y);
|
painter.drawLine(left + 1, y, left + 1 + width, y);
|
||||||
|
DEBUGF NAME(dot.code) Q(dot.type) QQ(y,(int)y) Q(ratioX) O(QLine(left + 1, y, left + 1 + width, y)) Q(legendx) O(dot.value) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -742,6 +751,8 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
time += rate;
|
time += rate;
|
||||||
// This is much faster than QVector access.
|
// This is much faster than QVector access.
|
||||||
data = *ptr * gain;
|
data = *ptr * gain;
|
||||||
|
if (actual_min_y>data) { actual_min_y=data; }
|
||||||
|
if (actual_max_y<data) { actual_max_y=data; }
|
||||||
|
|
||||||
// Scale the time scale X to pixel scale X
|
// Scale the time scale X to pixel scale X
|
||||||
px = ((time - minx) * xmult);
|
px = ((time - minx) * xmult);
|
||||||
@ -822,6 +833,8 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
time += rate;
|
time += rate;
|
||||||
|
|
||||||
data = (*ptr + el.offset()) * gain;
|
data = (*ptr + el.offset()) * gain;
|
||||||
|
if (actual_min_y>data) { actual_min_y=data; }
|
||||||
|
if (actual_max_y<data) { actual_max_y=data; }
|
||||||
|
|
||||||
px = xst + ((time - minx) * xmult); // Scale the time scale X to pixel scale X
|
px = xst + ((time - minx) * xmult); // Scale the time scale X to pixel scale X
|
||||||
py = yst - ((data - miny) * ymult); // Same for Y scale, with precomputed gain
|
py = yst - ((data - miny) * ymult); // Same for Y scale, with precomputed gain
|
||||||
@ -880,6 +893,8 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
|
|
||||||
time = start + *tptr++;
|
time = start + *tptr++;
|
||||||
data = (*dptr++ + el.offset()) * gain;
|
data = (*dptr++ + el.offset()) * gain;
|
||||||
|
if (actual_min_y>data) { actual_min_y=data; }
|
||||||
|
if (actual_max_y<data) { actual_max_y=data; }
|
||||||
|
|
||||||
idx++;
|
idx++;
|
||||||
|
|
||||||
@ -897,10 +912,11 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
// Unrolling square plot outside of loop to gain a minor speed improvement.
|
// Unrolling square plot outside of loop to gain a minor speed improvement.
|
||||||
EventStoreType *eptr = dptr + siz;
|
EventStoreType *eptr = dptr + siz;
|
||||||
|
|
||||||
if (square_plot) {
|
|
||||||
for (; dptr < eptr; dptr++) {
|
for (; dptr < eptr; dptr++) {
|
||||||
time = start + *tptr++;
|
time = start + *tptr++;
|
||||||
data = gain * (*dptr + el.offset());
|
data = gain * (*dptr + el.offset());
|
||||||
|
if (actual_min_y>data) { actual_min_y=data; }
|
||||||
|
if (actual_max_y<data) { actual_max_y=data; }
|
||||||
|
|
||||||
px = xst + ((time - minx) * xmult); // Scale the time scale X to pixel scale X
|
px = xst + ((time - minx) * xmult); // Scale the time scale X to pixel scale X
|
||||||
py = yst - ((data - miny) * ymult); // Same for Y scale without precomputed gain
|
py = yst - ((data - miny) * ymult); // Same for Y scale without precomputed gain
|
||||||
@ -912,50 +928,18 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
|
|
||||||
// Cap px to right margin
|
// Cap px to right margin
|
||||||
if (px > xst + width) { px = xst + width; }
|
if (px > xst + width) { px = xst + width; }
|
||||||
|
}
|
||||||
// lines.append(QLine(lastpx, lastpy, px, lastpy));
|
//else {
|
||||||
// lines.append(QLine(px, lastpy, px, py));
|
|
||||||
} // else {
|
|
||||||
// Letting the scissor do the dirty work for non horizontal lines
|
// Letting the scissor do the dirty work for non horizontal lines
|
||||||
// This really should be changed, as it might be cause that weird
|
// This really should be changed, as it might be cause that weird
|
||||||
// display glitch on Linux..
|
// display glitch on Linux..
|
||||||
|
//}
|
||||||
|
if (square_plot) {
|
||||||
lines.append(QLine(lastpx, lastpy, px, lastpy));
|
lines.append(QLine(lastpx, lastpy, px, lastpy));
|
||||||
lines.append(QLine(px, lastpy, px, py));
|
lines.append(QLine(px, lastpy, px, py));
|
||||||
// }
|
|
||||||
|
|
||||||
lastpx = px;
|
|
||||||
lastpy = py;
|
|
||||||
|
|
||||||
if (time > maxx) {
|
|
||||||
done = true; // Let this iteration finish.. (This point will be in far clipping)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
for (; dptr < eptr; dptr++) {
|
|
||||||
//for (int i=0;i<siz;i++) {
|
|
||||||
time = start + *tptr++;
|
|
||||||
data = gain * (*dptr + el.offset());
|
|
||||||
|
|
||||||
px = xst + ((time - minx) * xmult); // Scale the time scale X to pixel scale X
|
|
||||||
py = yst - ((data - miny) * ymult); // Same for Y scale without precomputed gain
|
|
||||||
|
|
||||||
// Horizontal lines are easy to cap
|
|
||||||
if (py == lastpy) {
|
|
||||||
// Cap px to left margin
|
|
||||||
if (lastpx < xst) { lastpx = xst; }
|
|
||||||
|
|
||||||
// Cap px to right margin
|
|
||||||
if (px > xst + width) { px = xst + width; }
|
|
||||||
|
|
||||||
// lines.append(QLine(lastpx, lastpy, px, py));
|
|
||||||
} //else {
|
|
||||||
// Letting the scissor do the dirty work for non horizontal lines
|
|
||||||
// This really should be changed, as it might be cause that weird
|
|
||||||
// display glitch on Linux..
|
|
||||||
lines.append(QLine(lastpx, lastpy, px, py));
|
lines.append(QLine(lastpx, lastpy, px, py));
|
||||||
//}
|
}
|
||||||
|
|
||||||
lastpx = px;
|
lastpx = px;
|
||||||
lastpy = py;
|
lastpy = py;
|
||||||
@ -965,7 +949,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (w.printing() && AppSetting->monochromePrinting()) {
|
if (w.printing() && AppSetting->monochromePrinting()) {
|
||||||
painter.setPen(QPen(Qt::black, lineThickness + 0.5));
|
painter.setPen(QPen(Qt::black, lineThickness + 0.5));
|
||||||
} else {
|
} else {
|
||||||
@ -1127,9 +1111,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
|
|
||||||
double f = double(cnt) / hours; // / (sum / 3600.0);
|
double f = double(cnt) / hours; // / (sum / 3600.0);
|
||||||
QString txt = QObject::tr("Duration %1:%2:%3").arg(h,2,10,QChar('0')).arg(m,2,10,QChar('0')).arg(s,2,10,QChar('0')) + " "+
|
QString txt = QObject::tr("Duration %1:%2:%3").arg(h,2,10,QChar('0')).arg(m,2,10,QChar('0')).arg(s,2,10,QChar('0')) + " "+
|
||||||
QObject::tr("AHI %1").arg(f,0,'f',2);// +" " +
|
QObject::tr("AHI %1").arg(f,0,'f',2);// +" "
|
||||||
// QObject::tr("Events %1").arg(cnt) + " " +
|
|
||||||
// QObject::tr("Hours %1").arg(hours,0,'f',2);
|
|
||||||
|
|
||||||
if (linecursormode) txt+=lasttext;
|
if (linecursormode) txt+=lasttext;
|
||||||
|
|
||||||
@ -1138,4 +1120,9 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
|
|
||||||
|
|
||||||
// painter.setRenderHint(QPainter::Antialiasing, false);
|
// painter.setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
|
||||||
|
if (actual_max_y>0) {
|
||||||
|
m_actual_min_y=actual_min_y;
|
||||||
|
m_actual_max_y=actual_max_y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,12 @@ class gLineChart: public Layer
|
|||||||
//! \brief Returns Maximum Y-axis value for this layer
|
//! \brief Returns Maximum Y-axis value for this layer
|
||||||
virtual EventDataType Maxy();
|
virtual EventDataType Maxy();
|
||||||
|
|
||||||
|
//! \brief Returns Minimum Y-axis value for this layer
|
||||||
|
virtual EventDataType actualMinY() {return m_actual_min_y;};
|
||||||
|
|
||||||
|
//! \brief Returns Maximum Y-axis value for this layer
|
||||||
|
virtual EventDataType actualMaxY() {return m_actual_max_y;};
|
||||||
|
|
||||||
//! \brief Returns true if all subplots contain no data
|
//! \brief Returns true if all subplots contain no data
|
||||||
virtual bool isEmpty();
|
virtual bool isEmpty();
|
||||||
|
|
||||||
@ -164,6 +170,7 @@ class gLineChart: public Layer
|
|||||||
bool m_report_empty;
|
bool m_report_empty;
|
||||||
bool m_square_plot;
|
bool m_square_plot;
|
||||||
bool m_disable_accel;
|
bool m_disable_accel;
|
||||||
|
EventDataType m_actual_min_y=0,m_actual_max_y=0;
|
||||||
|
|
||||||
//! \brief Used by accelerated waveform plots. Must be >= Screen Resolution (or at least graph width)
|
//! \brief Used by accelerated waveform plots. Must be >= Screen Resolution (or at least graph width)
|
||||||
static const int max_drawlist_size = 10000;
|
static const int max_drawlist_size = 10000;
|
||||||
|
@ -7,19 +7,8 @@
|
|||||||
* License. See the file COPYING in the main directory of the source code
|
* License. See the file COPYING in the main directory of the source code
|
||||||
* for more details. */
|
* for more details. */
|
||||||
|
|
||||||
#define xDEBUG_FUNCTIONS
|
#define TEST_MACROS_ENABLEDoff
|
||||||
#ifdef DEBUG_FUNCTIONS
|
#include "test_macros.h"
|
||||||
#include <QRegularExpression>
|
|
||||||
#define DEBUG qDebug()<<QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__
|
|
||||||
#define DEBUGF qDebug()<<QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__ << __func__
|
|
||||||
#define DEBUGTF qDebug()<<QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz") << QString(basename( __FILE__)).remove(QRegularExpression("\\..*$")) << __LINE__ << __func__
|
|
||||||
|
|
||||||
#define O( XX ) " " #XX ":" << XX
|
|
||||||
#define OO( XX , YY ) " " #XX ":" << YY
|
|
||||||
#define NAME( id) schema::channel[ id ].label()
|
|
||||||
#define DATE( XX ) QDateTime::fromMSecsSinceEpoch(XX).toString("dd MMM yyyy")
|
|
||||||
#define DATETIME( XX ) QDateTime::fromMSecsSinceEpoch(XX).toString("dd MMM yyyy hh:mm:ss.zzz")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
* License. See the file COPYING in the main directory of the source code
|
* License. See the file COPYING in the main directory of the source code
|
||||||
* for more details. */
|
* for more details. */
|
||||||
|
|
||||||
|
#define TEST_MACROS_ENABLEDoff
|
||||||
|
#include <test_macros.h>
|
||||||
|
|
||||||
#include "Graphs/gYAxis.h"
|
#include "Graphs/gYAxis.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -20,6 +23,7 @@
|
|||||||
|
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
|
|
||||||
|
|
||||||
gXGrid::gXGrid(QColor col)
|
gXGrid::gXGrid(QColor col)
|
||||||
: Layer(NoChannel)
|
: Layer(NoChannel)
|
||||||
{
|
{
|
||||||
@ -306,7 +310,7 @@ bool gYAxis::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
|||||||
int y = event->y();
|
int y = event->y();
|
||||||
|
|
||||||
if (!graph->units().isEmpty()) {
|
if (!graph->units().isEmpty()) {
|
||||||
graph->ToolTip(graph->units(), x+10, y+10, TT_AlignLeft);
|
graph->ToolTip(graph->unitsTooltip(), x+10, y+10, TT_AlignLeft);
|
||||||
// graph->redraw();
|
// graph->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,14 +320,8 @@ bool gYAxis::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
|||||||
bool gYAxis::mouseDoubleClickEvent(QMouseEvent *event, gGraph *graph)
|
bool gYAxis::mouseDoubleClickEvent(QMouseEvent *event, gGraph *graph)
|
||||||
{
|
{
|
||||||
if (graph) {
|
if (graph) {
|
||||||
// int x=event->x();
|
graph->mouseDoubleClickYAxis(event);
|
||||||
// int y=event->y();
|
|
||||||
short z = (graph->zoomY() + 1) % gGraph::maxZoomY;
|
|
||||||
graph->setZoomY(z);
|
|
||||||
qDebug() << "Mouse double clicked for" << graph->name() << z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_UNUSED(event);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
* License. See the file COPYING in the main directory of the source code
|
* License. See the file COPYING in the main directory of the source code
|
||||||
* for more details. */
|
* for more details. */
|
||||||
|
|
||||||
|
#define TEST_MACROS_ENABLEDoff
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
#include "Graphs/layer.h"
|
#include "Graphs/layer.h"
|
||||||
|
|
||||||
Layer::~Layer()
|
Layer::~Layer()
|
||||||
|
@ -230,6 +230,10 @@ public:
|
|||||||
Q_UNUSED(graph);
|
Q_UNUSED(graph);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual EventDataType actualMinY() {return 0;};
|
||||||
|
virtual EventDataType actualMaxY() {return 0;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \class LayerGroup
|
/*! \class LayerGroup
|
||||||
|
119
oscar/test_macros.h
Normal file
119
oscar/test_macros.h
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
/* Test macros Implemntation
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019-2022 The OSCAR Team
|
||||||
|
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
||||||
|
*
|
||||||
|
* This file is subject to the terms and conditions of the GNU General Public
|
||||||
|
* License. See the file COPYING in the main directory of the source code
|
||||||
|
* for more details. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
These functions will display formatted debug information.
|
||||||
|
The macro TEST_MACROS_ENABLED will enable these macros to display information
|
||||||
|
When The macro TEST_MACROS_ENABLED is undefined then these marcos will expand to white space.
|
||||||
|
|
||||||
|
When these macos are used then debugging is disabled
|
||||||
|
When only these macos are used then debugging is disabled.
|
||||||
|
SO for production code rename TEST_MACROS_ENABLED to TEST_MACROS_ENABLEDoff
|
||||||
|
|
||||||
|
###########################################
|
||||||
|
The the following to source cpp files
|
||||||
|
to turn on the debug macros for use.
|
||||||
|
|
||||||
|
#define TEST_MACROS_ENABLED
|
||||||
|
#include <test_macros.h>
|
||||||
|
|
||||||
|
To turn off the the test macros.
|
||||||
|
#define TEST_MACROS_ENABLEDoff
|
||||||
|
#include <test_macros.h>
|
||||||
|
###########################################
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TEST_MACROS_ENABLED_ONCE
|
||||||
|
#define TEST_MACROS_ENABLED_ONCE
|
||||||
|
|
||||||
|
#ifdef TEST_MACROS_ENABLED
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
#define DEBUGL qDebug() <<QString("%1[%2]").arg(QFileInfo( __FILE__).baseName()).arg(__LINE__)
|
||||||
|
//example:
|
||||||
|
//12361: Debug: "gGraphView[572]"
|
||||||
|
|
||||||
|
|
||||||
|
#define DEBUGF qDebug() <<QString("%1[%2]%3").arg(QFileInfo( __FILE__).baseName()).arg(__LINE__).arg(__func__)
|
||||||
|
//example:
|
||||||
|
//12361: Debug: "gGraphView[572]popoutGraph"
|
||||||
|
|
||||||
|
|
||||||
|
#define DEBUGT qDebug() <<QString("%1 %2[%3]%4").arg(QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz")).arg(QFileInfo( __FILE__).baseName()).arg(__LINE__)
|
||||||
|
//example:
|
||||||
|
//12645: Debug: "06:00:18.284 gGraphView[622]"
|
||||||
|
|
||||||
|
#define DEBUGTF qDebug() <<QString("%1 %2[%3]%4").arg(QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz")).arg(QFileInfo( __FILE__).baseName()).arg(__LINE__).arg(__func__)
|
||||||
|
//example:
|
||||||
|
//12645: Debug: "06:00:18.284 gGraphView[622]popoutGraph"
|
||||||
|
|
||||||
|
// Macros to display variables
|
||||||
|
#define O( EXPRESSION ) << EXPRESSION
|
||||||
|
|
||||||
|
// return values from functions donr't work - QQ macro instead
|
||||||
|
#define Q( VALUE ) << "" #VALUE ":" << VALUE
|
||||||
|
//example:
|
||||||
|
|
||||||
|
//
|
||||||
|
#define QQ( TEXT , EXPRESSION) << #TEXT ":" << EXPRESSION
|
||||||
|
//example:
|
||||||
|
|
||||||
|
#define NAME( SCHEMECODE ) << schema::channel[ SCHEMECODE ].label()
|
||||||
|
//example:
|
||||||
|
|
||||||
|
#define FULLNAME( SCHEMECODE ) << schema::channel[ SCHEMEcODE ].fullname()
|
||||||
|
//example:
|
||||||
|
|
||||||
|
//display the date of an epoch time stamp "qint64"
|
||||||
|
#define DATE( EPOCH ) << QDateTime::fromMSecsSinceEpoch( EPOCH ).toString("dd MMM yyyy")
|
||||||
|
|
||||||
|
//display the date and Time of an epoch time stamp "qint64"
|
||||||
|
#define DATETIME( EPOCH ) << QDateTime::fromMSecsSinceEpoch( EPOCH ).toString("dd MMM yyyy hh:mm:ss.zzz")
|
||||||
|
|
||||||
|
/*
|
||||||
|
sample Lines.
|
||||||
|
|
||||||
|
code
|
||||||
|
DEBUGF Q(name) Q(title) QQ("UNITS",units) Q(height) Q(group);
|
||||||
|
output
|
||||||
|
00791: Debug: "gGraph[137]gGraph" name: "RespRate" title: "Respiratory Rate" "UNITS": "Rate of breaths per minute" height: 180 group: 0
|
||||||
|
|
||||||
|
|
||||||
|
DEBUGTF Q(newname);
|
||||||
|
12645: Debug: "06:00:18.284 gGraphView[622]popoutGraph" newname: "Pressure - Friday, April 15, 2022"
|
||||||
|
|
||||||
|
|
||||||
|
DEBUGF NAME(dot.code) Q(dot.type) QQ(y,(int)y) Q(ratioX) O(QLine(left + 1, y, left + 1 + width, y)) Q(legendx) O(dot.value) ;
|
||||||
|
92 00917: Debug: "gLineChart[568]paint" "Pressure" dot.type: 4 y: 341 ratioX: 1 QLine(QPoint(91,341),QPoint(464,341)) legendx: 463 12.04
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#else
|
||||||
|
// Turn debugging off. macros expands to white space
|
||||||
|
|
||||||
|
#define DEBUGL
|
||||||
|
#define DEBUGF
|
||||||
|
#define DEBUGT
|
||||||
|
#define DEBUGTF
|
||||||
|
|
||||||
|
#define O( XX )
|
||||||
|
#define Q( XX )
|
||||||
|
#define QQ( XX , YY )
|
||||||
|
#define NAME( id)
|
||||||
|
#define FULLNAME( id)
|
||||||
|
#define DATE( XX )
|
||||||
|
#define DATETIME( XX )
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user