OSCAR-code/Graphs/graphdata.cpp
Mark Watkins e6fe771adf QT Commit
2011-06-26 18:30:44 +10:00

49 lines
1.1 KiB
C++

/********************************************************************
gGraphData Implementation
Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net>
License: GPL
*********************************************************************/
#include "graphdata.h"
gGraphData::gGraphData(int mp,gDataType t)
:vc(0),type(t),max_points(mp)
{
m_ready=false;
force_min_y=force_max_y=0;
}
gGraphData::~gGraphData()
{
}
void gGraphData::Update(Day *day)
{
Reload(day);
for (list<gLayer *>::iterator i=notify_layers.begin();i!=notify_layers.end();i++) {
gGraphData *g=this;
if (!day) g=NULL;
(*i)->DataChanged(g);
}
}
void gGraphData::AddLayer(gLayer *g)
{
notify_layers.push_back(g);
}
gPointData::gPointData(int mp)
:gGraphData(mp,gDT_Point)
{
}
gPointData::~gPointData()
{
for (vector<QPointD *>::iterator i=point.begin();i!=point.end();i++)
delete [] (*i);
}
void gPointData::AddSegment(int max_points)
{
maxsize.push_back(max_points);
np.push_back(0);
QPointD *p=new QPointD [max_points];
point.push_back(p);
}