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