OSCAR-code/Graphs/graphlayer.h

66 lines
1.7 KiB
C
Raw Normal View History

2011-06-26 08:30:44 +00:00
/********************************************************************
gLayer Headers
Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net>
License: GPL
*********************************************************************/
#ifndef GRAPHLAYER_H
#define GRAPHLAYER_H
#include <QString>
2011-07-27 09:21:53 +00:00
#include "SleepLib/day.h"
2011-06-26 08:30:44 +00:00
#include "graphwindow.h"
enum FlagType { FT_Bar, FT_Dot, FT_Span };
2011-06-26 08:30:44 +00:00
class gGraphWindow;
class gLayer
{
public:
2011-07-27 09:21:53 +00:00
gLayer(MachineCode code=MC_UNKNOWN,QString title="");
2011-06-26 08:30:44 +00:00
virtual ~gLayer();
2011-07-01 10:10:44 +00:00
virtual void Plot(gGraphWindow & w,float scrx,float scry)=0;
2011-06-26 08:30:44 +00:00
vector<QColor> color;
2011-07-27 09:21:53 +00:00
virtual void SetDay(Day * d);
void SetCode(MachineCode c) { m_code=c; }
virtual qint64 Minx() { if (m_day) return m_day->first(); return m_minx; }
virtual qint64 Maxx() { if (m_day) return m_day->last(); return m_maxx; }
virtual EventDataType Miny() { return m_miny; }
virtual EventDataType Maxy() { return m_maxy; }
2011-06-26 08:30:44 +00:00
2011-07-27 09:21:53 +00:00
virtual void setVisible(bool v) { m_visible=v; }
virtual bool isVisible() { return m_visible; }
virtual bool isEmpty();
2011-07-27 09:21:53 +00:00
inline const MachineCode & code() { return m_code; }
2011-06-26 08:30:44 +00:00
protected:
bool m_visible;
bool m_movable;
2011-07-27 09:21:53 +00:00
qint64 m_minx,m_maxx;
EventDataType m_miny,m_maxy;
Day *m_day;
MachineCode m_code;
QString m_title;
2011-06-26 08:30:44 +00:00
};
class gLayerGroup:public gLayer
{
public:
gLayerGroup();
virtual ~gLayerGroup();
virtual void AddLayer(gLayer *l);
2011-07-27 09:21:53 +00:00
virtual qint64 Minx();
virtual qint64 Maxx();
virtual EventDataType Miny();
virtual EventDataType Maxy();
virtual bool isEmpty();
virtual void SetDay(Day * d);
protected:
vector<gLayer *> layers;
};
2011-06-26 08:30:44 +00:00
#endif // GRAPHLAYER_H