#include "stdafx.h"
#include "PGL/pgl.h"
#include "PGL/PGLLineHor.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
IMPLEMENT_SERIAL(CPGLLineHor, CPGLLine,1);
void CPGLLineHor::Serialize(CArchive &archive)
{
CPGLLine::Serialize( archive );
if( archive.IsStoring() )
{
archive>>m_dY;
}
else
{
archive>>m_dY;
}
}
#ifdef _DEBUG
void CPGLLineHor::Dump( CDumpContext& dc ) const
{
CPGLLine::Dump( dc );
}
void CPGLLineHor::AssertValid() const
{
CPGLLine::AssertValid();
}
#endif
CPGLLineHor::CPGLLineHor()
: CPGLLine()
{
m_dY = 0;
m_tCaption.SetColor(0,0,0);
}
CPGLLineHor::CPGLLineHor(const CPGLLineHor& lv)
: CPGLLine(lv)
{
m_dY = lv.m_dY;
m_tCaption = lv.m_tCaption;
}
CPGLLineHor& CPGLLineHor::operator =(const CPGLLineHor& lv)
{
if (this != &lv)
{
this->CPGLLineHor::operator =(lv);
m_dY = lv.m_dY;
m_tCaption = lv.m_tCaption;
}
return *this;
}
CPGLLineHor::~CPGLLineHor()
{
}
double* CPGLLineHor::GetExtent(CPGLView* pView)
{
if (NeedUpdateExtent())
UpdateExtent(pView);
return CPGLLine::GetExtent(pView);
}
void CPGLLineHor::UpdateExtent(CPGLView* pView)
{
CPGLLine::UpdateExtent(pView);
m_extent[0]=m_extent[1]=m_dY;
m_extent[2]=m_extent[3]=0;
}
void CPGLLineHor::PlotGfx(gfxinterface::CGfxInterface& gfx)
{
if (!IsVisible())
return;
CPGLObject::PlotGfx(gfx);
gfx.AddComment("--- CPGLLineHor ---");
SetDashGfx(gfx);
gfx.SetLineWidth(GetLineWidth());
gfx.DrawLine(gfx.GetWorldLeft(), m_dY, gfx.GetWorldRight(), m_dY);
float pos[2];
pos[0]=gfx.GetWorldClipLeft()+gfx.BBToWorldAbsx(5);
pos[1]=m_dY+gfx.BBToWorldAbsy(GetLineWidth()+5);
m_tCaption.SetPosition(pos);
m_tCaption.PlotGfx(gfx);
}