OSCAR-code/Graphs/graphdata.cpp

55 lines
1.2 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);
}
bool gGraphData::isEmpty()
{
bool b=((vc==1) && (np[0]==0)) || vc==0;
return b;
}
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);
}