mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 20:20:44 +00:00
Beginning of Graph Hide/Show stuff, plus Event Flags group container
This commit is contained in:
parent
bbaf680bba
commit
9cff24fb29
@ -4,10 +4,50 @@
|
|||||||
License: GPL
|
License: GPL
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
#include <math.h>
|
#include <cmath>
|
||||||
|
#include <vector>
|
||||||
#include "SleepLib/profiles.h"
|
#include "SleepLib/profiles.h"
|
||||||
#include "gFlagsLine.h"
|
#include "gFlagsLine.h"
|
||||||
|
|
||||||
|
gFlagsGroup::gFlagsGroup()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
gFlagsGroup::~gFlagsGroup()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void gFlagsGroup::Plot(gGraphWindow &w, float scrx, float scry)
|
||||||
|
{
|
||||||
|
if (!m_visible) return;
|
||||||
|
int start_px=w.GetLeftMargin();
|
||||||
|
int start_py=w.GetBottomMargin();
|
||||||
|
int width=scrx-(w.GetLeftMargin()+w.GetRightMargin())-1;
|
||||||
|
int height=scry-(w.GetTopMargin()+w.GetBottomMargin());
|
||||||
|
|
||||||
|
glColor3f (0.1F, 0.1F, 0.1F);
|
||||||
|
glLineWidth (1);
|
||||||
|
glBegin (GL_LINE_LOOP);
|
||||||
|
glVertex2f (start_px-1, start_py);
|
||||||
|
glVertex2f (start_px-1, start_py+height);
|
||||||
|
glVertex2f (start_px+width,start_py+height);
|
||||||
|
glVertex2f (start_px+width, start_py);
|
||||||
|
glEnd ();
|
||||||
|
|
||||||
|
vector<gFlagsLine *> visible;
|
||||||
|
for (unsigned i=0;i<layers.size();i++) {
|
||||||
|
if (!layers[i]->isEmpty()) {
|
||||||
|
gFlagsLine *f=dynamic_cast<gFlagsLine *>(layers[i]);
|
||||||
|
visible.push_back(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int vis=visible.size();
|
||||||
|
for (unsigned i=0;i<visible.size();i++) {
|
||||||
|
visible[i]->line_num=i;
|
||||||
|
visible[i]->total_lines=vis;
|
||||||
|
visible[i]->Plot(w,scrx,scry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
gFlagsLine::gFlagsLine(gPointData *d,QColor col,QString _label,int _line_num,int _total_lines)
|
gFlagsLine::gFlagsLine(gPointData *d,QColor col,QString _label,int _line_num,int _total_lines)
|
||||||
:gLayer(d),label(_label),line_num(_line_num),total_lines(_total_lines)
|
:gLayer(d),label(_label),line_num(_line_num),total_lines(_total_lines)
|
||||||
@ -54,19 +94,6 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
line_h=line_h;
|
line_h=line_h;
|
||||||
float line_top=(start_py+height-line_h)-line_num*line_h;
|
float line_top=(start_py+height-line_h)-line_num*line_h;
|
||||||
|
|
||||||
|
|
||||||
if ((line_num==total_lines-1)) { // last lines responsibility to draw the bounding box
|
|
||||||
|
|
||||||
glColor3f (0.1F, 0.1F, 0.1F);
|
|
||||||
glLineWidth (1);
|
|
||||||
glBegin (GL_LINE_LOOP);
|
|
||||||
glVertex2f (start_px-1, start_py);
|
|
||||||
glVertex2f (start_px-1, start_py+height);
|
|
||||||
glVertex2f (start_px+width,start_py+height);
|
|
||||||
glVertex2f (start_px+width, start_py);
|
|
||||||
glEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alternating box color
|
// Alternating box color
|
||||||
QColor *barcol=&col2;
|
QColor *barcol=&col2;
|
||||||
if (line_num & 1)
|
if (line_num & 1)
|
||||||
@ -92,7 +119,7 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
// Draw text label
|
// Draw text label
|
||||||
float x,y;
|
float x,y;
|
||||||
GetTextExtent(label,x,y);
|
GetTextExtent(label,x,y);
|
||||||
DrawText(w,label,start_px-x-10,scry-(line_top-((line_h/2)-(y/2))+4));
|
DrawText(w,label,start_px-x-10,(scry-line_top)-(line_h/2)+(y/2)); //(line_top-((line_h/2)-(y/2))+4));
|
||||||
//glColor3ub(0,0,0);
|
//glColor3ub(0,0,0);
|
||||||
//w.renderText(start_px-x-10,scry-(line_top+(line_h/2)-(y/2)+3),label);
|
//w.renderText(start_px-x-10,scry-(line_top+(line_h/2)-(y/2)+3),label);
|
||||||
float x1,x2;
|
float x1,x2;
|
||||||
|
@ -9,8 +9,11 @@
|
|||||||
|
|
||||||
#include "graphlayer.h"
|
#include "graphlayer.h"
|
||||||
|
|
||||||
|
class gFlagsGroup;
|
||||||
|
|
||||||
class gFlagsLine:public gLayer
|
class gFlagsLine:public gLayer
|
||||||
{
|
{
|
||||||
|
friend class gFlagsGroup;
|
||||||
public:
|
public:
|
||||||
gFlagsLine(gPointData *d=NULL,QColor col=QColor("black"),QString _label="",int _line_num=0,int _total_lines=0);
|
gFlagsLine(gPointData *d=NULL,QColor col=QColor("black"),QString _label="",int _line_num=0,int _total_lines=0);
|
||||||
virtual ~gFlagsLine();
|
virtual ~gFlagsLine();
|
||||||
@ -22,5 +25,13 @@ class gFlagsLine:public gLayer
|
|||||||
int line_num,total_lines;
|
int line_num,total_lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class gFlagsGroup:public gLayerGroup
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
gFlagsGroup();
|
||||||
|
virtual ~gFlagsGroup();
|
||||||
|
|
||||||
|
virtual void Plot(gGraphWindow &w, float scrx, float scry);
|
||||||
|
};
|
||||||
|
|
||||||
#endif // GFLAGSLINE_H
|
#endif // GFLAGSLINE_H
|
||||||
|
@ -163,7 +163,7 @@ void gXAxis::Plot(gGraphWindow & w,float scrx,float scry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GetTextExtent(fd,x,y);
|
GetTextExtent(fd,x,y);
|
||||||
glColor3ub(0,0,0);
|
//glColor3ub(0,0,0);
|
||||||
if (!show_time) {
|
if (!show_time) {
|
||||||
DrawText(w,fd, px+y, scry-(py-(x/2)-8), 90.0);
|
DrawText(w,fd, px+y, scry-(py-(x/2)-8), 90.0);
|
||||||
//w.renderText(px-(y/2)+2, scry-(py-(x/2)-20), 90.0,fd);
|
//w.renderText(px-(y/2)+2, scry-(py-(x/2)-20), 90.0,fd);
|
||||||
|
@ -15,14 +15,14 @@ class gXAxis:public gLayer
|
|||||||
virtual ~gXAxis();
|
virtual ~gXAxis();
|
||||||
virtual void Plot(gGraphWindow & w,float scrx,float scry);
|
virtual void Plot(gGraphWindow & w,float scrx,float scry);
|
||||||
static const int Margin=25; // How much room does this take up. (Bottom margin)
|
static const int Margin=25; // How much room does this take up. (Bottom margin)
|
||||||
void SetShowMinorLines(bool b) { m_show_minor_lines=b; };
|
void SetShowMinorLines(bool b) { m_show_minor_lines=b; }
|
||||||
void SetShowMajorLines(bool b) { m_show_major_lines=b; };
|
void SetShowMajorLines(bool b) { m_show_major_lines=b; }
|
||||||
bool ShowMinorLines() { return m_show_minor_lines; };
|
bool ShowMinorLines() { return m_show_minor_lines; }
|
||||||
bool ShowMajorLines() { return m_show_major_lines; };
|
bool ShowMajorLines() { return m_show_major_lines; }
|
||||||
void SetShowMinorTicks(bool b) { m_show_minor_ticks=b; };
|
void SetShowMinorTicks(bool b) { m_show_minor_ticks=b; }
|
||||||
void SetShowMajorTicks(bool b) { m_show_major_ticks=b; };
|
void SetShowMajorTicks(bool b) { m_show_major_ticks=b; }
|
||||||
bool ShowMinorTicks() { return m_show_minor_ticks; };
|
bool ShowMinorTicks() { return m_show_minor_ticks; }
|
||||||
bool ShowMajorTicks() { return m_show_major_ticks; };
|
bool ShowMajorTicks() { return m_show_major_ticks; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// virtual const wxString & Format(double v) { static wxString t; wxDateTime d; d.Set(v); t=d.Format(wxT("%H:%M")); return t; };
|
// virtual const wxString & Format(double v) { static wxString t; wxDateTime d; d.Set(v); t=d.Format(wxT("%H:%M")); return t; };
|
||||||
|
@ -55,7 +55,7 @@ void GetTextExtent(QString text, float & width, float & height, QFont *font)
|
|||||||
width=fm.width(text); //fm.width(text);
|
width=fm.width(text); //fm.width(text);
|
||||||
height=fm.xHeight()+2; //fm.ascent();
|
height=fm.xHeight()+2; //fm.ascent();
|
||||||
}
|
}
|
||||||
void RDrawText(gGraphWindow & wid, QString text, int x, int y, float angle, QColor color,QFont *font)
|
inline void RDrawText(QPainter & painter, QString text, int x, int y, float angle, QColor color,QFont *font)
|
||||||
{
|
{
|
||||||
//QFontMetrics fm(*font);
|
//QFontMetrics fm(*font);
|
||||||
float w,h;
|
float w,h;
|
||||||
@ -70,10 +70,8 @@ void RDrawText(gGraphWindow & wid, QString text, int x, int y, float angle, QCo
|
|||||||
|
|
||||||
// glEnable(GL_TEXTURE_2D);
|
// glEnable(GL_TEXTURE_2D);
|
||||||
// glDisable(GL_DEPTH_TEST);
|
// glDisable(GL_DEPTH_TEST);
|
||||||
glFinish();
|
|
||||||
QPainter painter(&wid);
|
|
||||||
painter.setFont(*font);
|
painter.setFont(*font);
|
||||||
color=Qt::black;
|
//color=Qt::black;
|
||||||
painter.setPen(color);
|
painter.setPen(color);
|
||||||
painter.setBrush(QBrush(color));
|
painter.setBrush(QBrush(color));
|
||||||
painter.setOpacity(1);
|
painter.setOpacity(1);
|
||||||
@ -88,39 +86,49 @@ void RDrawText(gGraphWindow & wid, QString text, int x, int y, float angle, QCo
|
|||||||
painter.translate(floor(-x),floor(-y));
|
painter.translate(floor(-x),floor(-y));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
struct TextBuffer
|
||||||
|
{
|
||||||
|
QString text;
|
||||||
|
int x,y;
|
||||||
|
float angle;
|
||||||
|
QColor color;
|
||||||
|
QFont *font;
|
||||||
|
TextBuffer(QString _text, int _x, int _y, float _angle, QColor _color,QFont *_font) {
|
||||||
|
text=_text; x=_x; y=_y; angle=_angle; color=_color; font=_font;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
vector<TextBuffer *> TextQue;
|
||||||
|
vector<TextBuffer *> TextQueRot;
|
||||||
|
|
||||||
|
void DrawTextQueue(gGraphWindow & wid)
|
||||||
|
{
|
||||||
|
glFlush();
|
||||||
|
QPainter painter(&wid);
|
||||||
|
for (unsigned i=0;i<TextQue.size();i++) {
|
||||||
|
TextBuffer & t=*TextQue[i];
|
||||||
|
RDrawText(painter,t.text,t.x,t.y,t.angle,t.color,t.font);
|
||||||
|
delete TextQue[i];
|
||||||
|
}
|
||||||
|
// TODO.. Prerotate the 90degree stuff here and keep the matrix for all of these..
|
||||||
|
TextQue.clear();
|
||||||
|
for (unsigned i=0;i<TextQueRot.size();i++) {
|
||||||
|
TextBuffer & t=*TextQueRot[i];
|
||||||
|
RDrawText(painter,t.text,t.x,t.y,t.angle,t.color,t.font);
|
||||||
|
delete TextQueRot[i];
|
||||||
|
}
|
||||||
|
TextQueRot.clear();
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
}
|
|
||||||
struct TextBuffer
|
|
||||||
{
|
|
||||||
gGraphWindow *wid;
|
|
||||||
QString text;
|
|
||||||
int x,y;
|
|
||||||
float angle;
|
|
||||||
QColor *color;
|
|
||||||
QFont *font;
|
|
||||||
TextBuffer(gGraphWindow * _wid, QString _text, int _x, int _y, float _angle, QColor *_color,QFont *_font) {
|
|
||||||
wid=_wid; text=_text; x=_x; y=_y; angle=_angle; color=_color; font=_font;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
vector<TextBuffer *> TextQue;
|
|
||||||
|
|
||||||
void DrawTextQueue()
|
|
||||||
{
|
|
||||||
for (unsigned i=0;i<TextQue.size();i++) {
|
|
||||||
TextBuffer * t=TextQue[i];
|
|
||||||
RDrawText(*t->wid,t->text,t->x,t->y,t->angle,*t->color,t->font);
|
|
||||||
delete TextQue[i];
|
|
||||||
}
|
|
||||||
TextQue.clear();
|
|
||||||
}
|
}
|
||||||
|
// I bet this slows things down craploads.. should probably skip the vector and use a preallocated textbuffer array.
|
||||||
void DrawText(gGraphWindow & wid, QString text, int x, int y, float angle, QColor color,QFont *font)
|
void DrawText(gGraphWindow & wid, QString text, int x, int y, float angle, QColor color,QFont *font)
|
||||||
{
|
{
|
||||||
TextQue.push_back(new TextBuffer(&wid,text,x,y,angle,&color,font));
|
TextBuffer *b=new TextBuffer(text,x,y,angle,color,font);
|
||||||
|
if (!angle) TextQue.push_back(b);
|
||||||
|
else TextQueRot.push_back(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ extern GLshort *vertex_array[num_vert_arrays];
|
|||||||
class gGraphWindow;
|
class gGraphWindow;
|
||||||
void GetTextExtent(QString text, float & width, float & height, QFont *font=defaultfont);
|
void GetTextExtent(QString text, float & width, float & height, QFont *font=defaultfont);
|
||||||
void DrawText(gGraphWindow & wid, QString text, int x, int y, float angle=0, QColor color=QColor("black"),QFont *font=defaultfont);
|
void DrawText(gGraphWindow & wid, QString text, int x, int y, float angle=0, QColor color=QColor("black"),QFont *font=defaultfont);
|
||||||
void DrawTextQueue();
|
void DrawTextQueue(gGraphWindow & wid);
|
||||||
|
|
||||||
void LinedRoundedRectangle(int x,int y,int w,int h,int radius,int lw,QColor color);
|
void LinedRoundedRectangle(int x,int y,int w,int h,int radius,int lw,QColor color);
|
||||||
void RoundedRectangle(int x,int y,int w,int h,int radius,const QColor color);
|
void RoundedRectangle(int x,int y,int w,int h,int radius,const QColor color);
|
||||||
|
@ -29,6 +29,12 @@ void gGraphData::AddLayer(gLayer *g)
|
|||||||
{
|
{
|
||||||
notify_layers.push_back(g);
|
notify_layers.push_back(g);
|
||||||
}
|
}
|
||||||
|
bool gGraphData::isEmpty()
|
||||||
|
{
|
||||||
|
bool b=((vc==1) && (np[0]==0)) || vc==0;
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
gPointData::gPointData(int mp)
|
gPointData::gPointData(int mp)
|
||||||
:gGraphData(mp,gDT_Point)
|
:gGraphData(mp,gDT_Point)
|
||||||
|
@ -54,7 +54,8 @@ public:
|
|||||||
|
|
||||||
vector<int> np;
|
vector<int> np;
|
||||||
vector<int> maxsize;
|
vector<int> maxsize;
|
||||||
const bool & IsReady() { return m_ready; };
|
bool IsReady() { return m_ready; };
|
||||||
|
bool isEmpty();
|
||||||
|
|
||||||
void AddLayer(gLayer *g);
|
void AddLayer(gLayer *g);
|
||||||
protected:
|
protected:
|
||||||
|
@ -59,3 +59,112 @@ void gLayer::SetMaxY(double v) { if (data) data->SetMaxY(v); };
|
|||||||
|
|
||||||
void gLayer::NotifyGraphWindow(gGraphWindow *g) { m_graph.push_back(g); };
|
void gLayer::NotifyGraphWindow(gGraphWindow *g) { m_graph.push_back(g); };
|
||||||
|
|
||||||
|
bool gLayer::isEmpty() { if (!data) return false; return data->isEmpty(); };
|
||||||
|
|
||||||
|
gLayerGroup::gLayerGroup()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
gLayerGroup::~gLayerGroup()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//void gLayerGroup::DataChanged(gGraphData *src);
|
||||||
|
void gLayerGroup::NotifyGraphWindow(gGraphWindow *g)
|
||||||
|
{
|
||||||
|
for (unsigned i=0;i<layers.size();i++) {
|
||||||
|
layers[i]->NotifyGraphWindow(g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gLayerGroup::AddLayer(gLayer *l)
|
||||||
|
{
|
||||||
|
layers.push_back(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
double gLayerGroup::MinX()
|
||||||
|
{
|
||||||
|
bool first=true;
|
||||||
|
double m=0;
|
||||||
|
for (unsigned i=0;i<layers.size();i++) {
|
||||||
|
if (first) {
|
||||||
|
m=layers[i]->MinX();
|
||||||
|
first=false;
|
||||||
|
} else
|
||||||
|
if (m>layers[i]->MinX()) m=layers[i]->MinX();
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
double gLayerGroup::MaxX()
|
||||||
|
{
|
||||||
|
bool first=true;
|
||||||
|
double m=0;
|
||||||
|
for (unsigned i=0;i<layers.size();i++) {
|
||||||
|
if (first) {
|
||||||
|
m=layers[i]->MaxX();
|
||||||
|
first=false;
|
||||||
|
} else
|
||||||
|
if (m<layers[i]->MaxX()) m=layers[i]->MaxX();
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
double gLayerGroup::MinY()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
double gLayerGroup::MaxY()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
double gLayerGroup::RealMinX()
|
||||||
|
{
|
||||||
|
bool first=true;
|
||||||
|
double m=0;
|
||||||
|
for (unsigned i=0;i<layers.size();i++) {
|
||||||
|
if (first) {
|
||||||
|
m=layers[i]->RealMinX();
|
||||||
|
first=false;
|
||||||
|
} else
|
||||||
|
if (m>layers[i]->RealMinX()) m=layers[i]->RealMinX();
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
double gLayerGroup::RealMaxX()
|
||||||
|
{
|
||||||
|
bool first=true;
|
||||||
|
double m=0;
|
||||||
|
for (unsigned i=0;i<layers.size();i++) {
|
||||||
|
if (first) {
|
||||||
|
m=layers[i]->RealMaxX();
|
||||||
|
first=false;
|
||||||
|
} else
|
||||||
|
if (m>layers[i]->RealMaxX()) m=layers[i]->RealMaxX();
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
double gLayerGroup::RealMinY()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
double gLayerGroup::RealMaxY()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gLayerGroup::SetMinX(double v)
|
||||||
|
{
|
||||||
|
for (unsigned i=0;i<layers.size();i++)
|
||||||
|
layers[i]->SetMinX(v);
|
||||||
|
}
|
||||||
|
void gLayerGroup::SetMaxX(double v)
|
||||||
|
{
|
||||||
|
for (unsigned i=0;i<layers.size();i++)
|
||||||
|
layers[i]->SetMaxX(v);
|
||||||
|
}
|
||||||
|
void gLayerGroup::SetMinY(double v)
|
||||||
|
{
|
||||||
|
for (unsigned i=0;i<layers.size();i++)
|
||||||
|
layers[i]->SetMinY(v);
|
||||||
|
}
|
||||||
|
void gLayerGroup::SetMaxY(double v)
|
||||||
|
{
|
||||||
|
for (unsigned i=0;i<layers.size();i++)
|
||||||
|
layers[i]->SetMaxY(v);
|
||||||
|
}
|
||||||
|
@ -44,10 +44,10 @@ public:
|
|||||||
virtual void SetMaxY(double v);
|
virtual void SetMaxY(double v);
|
||||||
|
|
||||||
|
|
||||||
void NotifyGraphWindow(gGraphWindow *g);
|
virtual void NotifyGraphWindow(gGraphWindow *g);
|
||||||
void SetVisible(bool v) { m_visible=v; };
|
virtual void SetVisible(bool v) { m_visible=v; };
|
||||||
bool IsVisible() { return m_visible; };
|
virtual bool IsVisible() { return m_visible; };
|
||||||
|
virtual bool isEmpty();
|
||||||
protected:
|
protected:
|
||||||
bool m_visible;
|
bool m_visible;
|
||||||
bool m_movable;
|
bool m_movable;
|
||||||
@ -57,4 +57,34 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class gLayerGroup:public gLayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
gLayerGroup();
|
||||||
|
virtual ~gLayerGroup();
|
||||||
|
virtual void AddLayer(gLayer *l);
|
||||||
|
|
||||||
|
//virtual void DataChanged(gGraphData *src);
|
||||||
|
virtual void NotifyGraphWindow(gGraphWindow *g);
|
||||||
|
|
||||||
|
virtual double MinX();
|
||||||
|
virtual double MaxX();
|
||||||
|
virtual double MinY();
|
||||||
|
virtual double MaxY();
|
||||||
|
|
||||||
|
virtual double RealMinX();
|
||||||
|
virtual double RealMaxX();
|
||||||
|
virtual double RealMinY();
|
||||||
|
virtual double RealMaxY();
|
||||||
|
|
||||||
|
virtual void SetMinX(double v);
|
||||||
|
virtual void SetMaxX(double v);
|
||||||
|
virtual void SetMinY(double v);
|
||||||
|
virtual void SetMaxY(double v);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
vector<gLayer *> layers;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // GRAPHLAYER_H
|
#endif // GRAPHLAYER_H
|
||||||
|
@ -733,8 +733,7 @@ void gGraphWindow::Render(float w, float h)
|
|||||||
for (list<gLayer *>::iterator l=layers.begin();l!=layers.end();l++) {
|
for (list<gLayer *>::iterator l=layers.begin();l!=layers.end();l++) {
|
||||||
(*l)->Plot(*this,w,h);
|
(*l)->Plot(*this,w,h);
|
||||||
}
|
}
|
||||||
glFinish();
|
DrawTextQueue(*this);
|
||||||
DrawTextQueue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gGraphWindow::paintGL()
|
void gGraphWindow::paintGL()
|
||||||
|
@ -1060,7 +1060,7 @@ void InitModelMap()
|
|||||||
{
|
{
|
||||||
ModelMap[34]="RemStar Pro with C-Flex+";
|
ModelMap[34]="RemStar Pro with C-Flex+";
|
||||||
ModelMap[35]="RemStar Auto with A-Flex";
|
ModelMap[35]="RemStar Auto with A-Flex";
|
||||||
ModelMap[37]="RemStar BIPAP Auto with Bi-Flex";
|
ModelMap[37]="RemStar BiPAP Auto with Bi-Flex";
|
||||||
ModelMap[0x41]="BiPAP autoSV Advanced";
|
ModelMap[0x41]="BiPAP autoSV Advanced";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
62
daily.cpp
62
daily.cpp
@ -67,25 +67,27 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
|
|||||||
AddCPAPData(flags[9]=new FlagData(CPAP_Snore,1)); // Snore Index
|
AddCPAPData(flags[9]=new FlagData(CPAP_Snore,1)); // Snore Index
|
||||||
|
|
||||||
SF=new gGraphWindow(gSplitter,tr("Event Flags"),(QGLWidget *)NULL);
|
SF=new gGraphWindow(gSplitter,tr("Event Flags"),(QGLWidget *)NULL);
|
||||||
|
fg=new gFlagsGroup();
|
||||||
|
|
||||||
SF->SetLeftMargin(SF->GetLeftMargin()+gYAxis::Margin);
|
SF->SetLeftMargin(SF->GetLeftMargin()+gYAxis::Margin);
|
||||||
SF->SetBlockZoom(true);
|
SF->SetBlockZoom(true);
|
||||||
SF->AddLayer(new gXAxis());
|
SF->AddLayer(new gXAxis());
|
||||||
|
|
||||||
bool extras=false; //true;
|
|
||||||
int sfc=7;
|
int sfc=7;
|
||||||
|
bool extras=false; //true;
|
||||||
|
fg->AddLayer(new gFlagsLine(flags[0],QColor("light green"),"CSR",0,sfc));
|
||||||
|
fg->AddLayer(new gFlagsLine(flags[1],QColor("purple"),"CA",1,sfc));
|
||||||
|
fg->AddLayer(new gFlagsLine(flags[2],QColor("aqua"),"OA",2,sfc));
|
||||||
|
fg->AddLayer(new gFlagsLine(flags[3],QColor("blue"),"H",3,sfc));
|
||||||
|
fg->AddLayer(new gFlagsLine(flags[4],QColor("black"),"FL",4,sfc));
|
||||||
|
fg->AddLayer(new gFlagsLine(flags[6],QColor("gold"),"RE",6,sfc));
|
||||||
|
fg->AddLayer(new gFlagsLine(flags[5],QColor("red"),"VS",5,sfc));
|
||||||
if (extras) {
|
if (extras) {
|
||||||
sfc+=1;
|
fg->AddLayer(new gFlagsLine(flags[8],QColor("dark green"),"U0E",7,sfc));
|
||||||
SF->AddLayer(new gFlagsLine(flags[8],QColor("dark green"),"U0E",7,sfc));
|
fg->AddLayer(new gFlagsLine(flags[9],QColor("red"),"VS2",8,sfc));
|
||||||
//SF->AddLayer(new gFlagsLine(flags[8],QColor("red"),"VS2",7,sfc));
|
sfc++;
|
||||||
}
|
}
|
||||||
SF->AddLayer(new gFlagsLine(flags[6],QColor("gold"),"RE",6,sfc));
|
SF->AddLayer(fg);
|
||||||
SF->AddLayer(new gFlagsLine(flags[5],QColor("red"),"VS",5,sfc));
|
|
||||||
SF->AddLayer(new gFlagsLine(flags[4],QColor("black"),"FL",4,sfc));
|
|
||||||
SF->AddLayer(new gFlagsLine(flags[3],QColor("blue"),"H",3,sfc));
|
|
||||||
SF->AddLayer(new gFlagsLine(flags[2],QColor("aqua"),"OA",2,sfc));
|
|
||||||
SF->AddLayer(new gFlagsLine(flags[1],QColor("purple"),"CA",1,sfc));
|
|
||||||
SF->AddLayer(new gFlagsLine(flags[0],QColor("light green"),"CSR",0,sfc));
|
|
||||||
SF->AddLayer(new gFooBar(10,QColor("orange"),QColor("dark grey"),true));
|
SF->AddLayer(new gFooBar(10,QColor("orange"),QColor("dark grey"),true));
|
||||||
SF->setMinimumHeight(150+(extras ? 20 : 0));
|
SF->setMinimumHeight(150+(extras ? 20 : 0));
|
||||||
// SF->setMaximumHeight(350);
|
// SF->setMaximumHeight(350);
|
||||||
@ -106,23 +108,23 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
|
|||||||
PRD->AddLayer(new gLineChart(pressure_eap,Qt::red,4096,false,true,square));
|
PRD->AddLayer(new gLineChart(pressure_eap,Qt::red,4096,false,true,square));
|
||||||
PRD->setMinimumHeight(150);
|
PRD->setMinimumHeight(150);
|
||||||
|
|
||||||
AddCPAPData(leakdata=new EventData(CPAP_Leak,0));
|
AddCPAPData(leak=new EventData(CPAP_Leak,0));
|
||||||
LEAK=new gGraphWindow(gSplitter,tr("Leaks"),SF);
|
LEAK=new gGraphWindow(gSplitter,tr("Leaks"),SF);
|
||||||
LEAK->AddLayer(new gXAxis());
|
LEAK->AddLayer(new gXAxis());
|
||||||
LEAK->AddLayer(new gYAxis());
|
LEAK->AddLayer(new gYAxis());
|
||||||
//LEAK->AddLayer(new gFooBar());
|
//LEAK->AddLayer(new gFooBar());
|
||||||
LEAK->AddLayer(new gLineChart(leakdata,QColor("purple"),65536,false,false,true));
|
LEAK->AddLayer(new gLineChart(leak,QColor("purple"),65536,false,false,true));
|
||||||
|
|
||||||
LEAK->setMinimumHeight(150);
|
LEAK->setMinimumHeight(150);
|
||||||
|
|
||||||
|
|
||||||
AddCPAPData(mpw=new WaveData(CPAP_MaskPressure,1000000)); //FlowRate
|
AddCPAPData(mp=new WaveData(CPAP_MaskPressure,1000000)); //FlowRate
|
||||||
MP=new gGraphWindow(gSplitter,tr("Mask Pressure"),SF);
|
MP=new gGraphWindow(gSplitter,tr("Mask Pressure"),SF);
|
||||||
gYAxis *y=new gYAxis();
|
gYAxis *y=new gYAxis();
|
||||||
y->SetScale(.1);
|
y->SetScale(.1);
|
||||||
MP->AddLayer(y);
|
MP->AddLayer(y);
|
||||||
MP->AddLayer(new gXAxis());
|
MP->AddLayer(new gXAxis());
|
||||||
gLineChart *g=new gLineChart(mpw,Qt::black,4000,true);
|
gLineChart *g=new gLineChart(mp,Qt::blue,4000,true);
|
||||||
g->ReportEmpty(true);
|
g->ReportEmpty(true);
|
||||||
MP->AddLayer(g);
|
MP->AddLayer(g);
|
||||||
MP->setMinimumHeight(120);
|
MP->setMinimumHeight(120);
|
||||||
@ -698,10 +700,27 @@ void Daily::Load(QDate date)
|
|||||||
// and show based on this factor.
|
// and show based on this factor.
|
||||||
|
|
||||||
//cpap && cpap->count(CPAP_MinuteVentilation)>0 ? MV->show() : MV->hide();
|
//cpap && cpap->count(CPAP_MinuteVentilation)>0 ? MV->show() : MV->hide();
|
||||||
cpap && cpap->count(CPAP_MinuteVentilation)>0 ? MV->show() : MV->hide();
|
//cpap && cpap->count(CPAP_MinuteVentilation)>0 ? MV->show() : MV->hide();
|
||||||
cpap && cpap->count(CPAP_TidalVolume)>0 ? TV->show() : TV->hide();
|
//cpap && cpap->count(CPAP_TidalVolume)>0 ? TV->show() : TV->hide();
|
||||||
cpap && cpap->count(CPAP_RespiratoryRate)>0 ? RR->show() : RR->hide();
|
//cpap && cpap->count(CPAP_RespiratoryRate)>0 ? RR->show() : RR->hide();
|
||||||
cpap && cpap->count(CPAP_FlowLimitGraph)>0 ? FLG->show() : FLG->hide();
|
//cpap && cpap->count(CPAP_FlowLimitGraph)>0 ? FLG->show() : FLG->hide();
|
||||||
|
mv->isEmpty() ? MV->hide() : MV->show();
|
||||||
|
tv->isEmpty() ? TV->hide() : TV->show();
|
||||||
|
rr->isEmpty() ? RR->hide() : RR->show();
|
||||||
|
flg->isEmpty() ? FLG->hide() : FLG->show();
|
||||||
|
mp->isEmpty() ? MP->hide() : MP->show();
|
||||||
|
frw->isEmpty() ? FRW->hide() : FRW->show();
|
||||||
|
prd->isEmpty() && pressure_iap->isEmpty() ? PRD->hide() : PRD->show();
|
||||||
|
leak->isEmpty() ? LEAK->hide() : LEAK->show();
|
||||||
|
snore->isEmpty() ? SNORE->hide() : SNORE->show();
|
||||||
|
|
||||||
|
bool merge_oxi_graphs=true;
|
||||||
|
if (!merge_oxi_graphs) {
|
||||||
|
spo2->isEmpty() ? SPO2->hide() : SPO2->show();
|
||||||
|
pulse->isEmpty() ? PULSE->hide() : PULSE->show();
|
||||||
|
} else {
|
||||||
|
pulse->isEmpty() && spo2->isEmpty() ? PULSE->hide() : PULSE->show();
|
||||||
|
}
|
||||||
|
|
||||||
if (oxi) {
|
if (oxi) {
|
||||||
html+="<tr><td>"+tr("Pulse:");
|
html+="<tr><td>"+tr("Pulse:");
|
||||||
@ -716,10 +735,10 @@ void Daily::Load(QDate date)
|
|||||||
|
|
||||||
//html+=wxT("<tr><td colspan=4> </td></tr>\n");
|
//html+=wxT("<tr><td colspan=4> </td></tr>\n");
|
||||||
|
|
||||||
PULSE->show();
|
//PULSE->show();
|
||||||
//SPO2->show();
|
//SPO2->show();
|
||||||
} else {
|
} else {
|
||||||
PULSE->hide();
|
//PULSE->hide();
|
||||||
//SPO2->hide();
|
//SPO2->hide();
|
||||||
}
|
}
|
||||||
if (!cpap && !oxi) {
|
if (!cpap && !oxi) {
|
||||||
@ -952,6 +971,7 @@ void Daily::on_treeWidget_itemSelectionChanged()
|
|||||||
double st=(d.addSecs(-180)).toMSecsSinceEpoch()/86400000.0;
|
double st=(d.addSecs(-180)).toMSecsSinceEpoch()/86400000.0;
|
||||||
double et=(d.addSecs(180)).toMSecsSinceEpoch()/86400000.0;
|
double et=(d.addSecs(180)).toMSecsSinceEpoch()/86400000.0;
|
||||||
FRW->SetXBounds(st,et);
|
FRW->SetXBounds(st,et);
|
||||||
|
MP->SetXBounds(st,et);
|
||||||
SF->SetXBounds(st,et);
|
SF->SetXBounds(st,et);
|
||||||
PRD->SetXBounds(st,et);
|
PRD->SetXBounds(st,et);
|
||||||
LEAK->SetXBounds(st,et);
|
LEAK->SetXBounds(st,et);
|
||||||
|
8
daily.h
8
daily.h
@ -18,7 +18,7 @@
|
|||||||
#include <SleepLib/profiles.h>
|
#include <SleepLib/profiles.h>
|
||||||
#include <Graphs/graphwindow.h>
|
#include <Graphs/graphwindow.h>
|
||||||
#include <Graphs/graphdata.h>
|
#include <Graphs/graphdata.h>
|
||||||
|
#include <Graphs/gFlagsLine.h>
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Daily;
|
class Daily;
|
||||||
}
|
}
|
||||||
@ -57,15 +57,17 @@ private:
|
|||||||
void UpdateCalendarDay(QDate date);
|
void UpdateCalendarDay(QDate date);
|
||||||
void UpdateEventsTree(QTreeWidget * tree,Day *day);
|
void UpdateEventsTree(QTreeWidget * tree,Day *day);
|
||||||
|
|
||||||
gPointData *tap,*tap_eap,*tap_iap,*g_ahi,*frw,*prd,*leakdata,*pressure_iap,*pressure_eap,*snore;
|
gPointData *tap,*tap_eap,*tap_iap,*g_ahi,*frw,*prd,*leak,*pressure_iap,*pressure_eap,*snore;
|
||||||
gPointData *pulse,*spo2,*rr,*mv,*tv,*mpw,*flg;
|
gPointData *pulse,*spo2,*rr,*mv,*tv,*mp,*flg;
|
||||||
|
|
||||||
|
gFlagsGroup *fg;
|
||||||
gGraphWindow *PRD,*FRW,*G_AHI,*TAP,*LEAK,*SF,*TAP_EAP,*TAP_IAP,*PULSE,*SPO2,*SNORE,*RR,*MP,*MV,*TV,*FLG;
|
gGraphWindow *PRD,*FRW,*G_AHI,*TAP,*LEAK,*SF,*TAP_EAP,*TAP_IAP,*PULSE,*SPO2,*SNORE,*RR,*MP,*MV,*TV,*FLG;
|
||||||
|
|
||||||
list<gPointData *> OXIData;
|
list<gPointData *> OXIData;
|
||||||
list<gPointData *> CPAPData;
|
list<gPointData *> CPAPData;
|
||||||
list<gGraphWindow *> Graphs;
|
list<gGraphWindow *> Graphs;
|
||||||
|
|
||||||
|
|
||||||
void AddCPAPData(gPointData *d) { CPAPData.push_back(d); };
|
void AddCPAPData(gPointData *d) { CPAPData.push_back(d); };
|
||||||
void AddOXIData(gPointData *d) { OXIData.push_back(d); };
|
void AddOXIData(gPointData *d) { OXIData.push_back(d); };
|
||||||
void AddGraph(gGraphWindow *w);
|
void AddGraph(gGraphWindow *w);
|
||||||
|
Loading…
Reference in New Issue
Block a user