In this article, you will see a library called PGL that encapsulates plot capabilities in a MFC project for VC6 and VC7. It can easily plot data generated in a project without the need of any external software.
- pgllib_src.zip
- pgllib_demo.zip
- PGL.dll
- testpgl.exe
- pgluml_pdf.zip
- pgluml.pdf
- pglmfclib_src.zip
- CVS
- Base
- Debug
- OGLT
- CVS
- Base
- pglmfclib
- AlgoTools
- bin
- CVS
- Base
- Doxygen
- CVS
- Base
- images
- CVS
- Base
- PlotGraphicLibrary
- Doc
- HTML - English
- PlotGraphicLibrary.dow
- IGfx
- IGfxTest
- lib
- licence.txt
- OGLTools
- CVS
- Base
- Debug
- OGLT
- CVS
- Base
- Release
- res
- CVS
- Base
- PGL
- PGL_Install
- PGLPowerAddIn
- CVS
- Base
- Release
- res
- CVS
- Base
- Plot Graphic Library.dsw
- TestPGL
- Release
- res
- CVS
- Base
- pglmfclib_demo.zip
- PGL.dll
- testpgl.exe
|
// GfxInterface.cpp: implementation of the CGfxInterface class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "GfxInterface.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
namespace gfxinterface
{
CGfxInterface::CGfxInterface()
{
m_rCurClip.left=m_rCurClip.top=m_rCurClip.width=m_rCurClip.height=0;
}
CGfxInterface::~CGfxInterface()
{
ASSERT(m_lClips.empty());
}
void CGfxInterface::BeginPaint()
{
m_rBoundingBox=m_rMainBoundingBox;
m_rCurClip=m_rWorldBoundingBox;
}
void CGfxInterface::EndPaint()
{
m_rBoundingBox = m_rMainBoundingBox;
}
bool CGfxInterface::SetMainBoundingBox(const CRect rect)
{
m_rMainBoundingBox.left=rect.left;
m_rMainBoundingBox.top=rect.bottom;
m_rMainBoundingBox.width=rect.Width();
m_rMainBoundingBox.height=rect.Height();
return true;
}
bool CGfxInterface::SetMainBoundingBox(int llx, int lly, int urx, int ury)
{
if ((llx>=urx) || (lly>=ury))
return false;
m_rMainBoundingBox.left=llx;
m_rMainBoundingBox.top=ury;
m_rMainBoundingBox.width=urx-llx;
m_rMainBoundingBox.height=ury-lly;
ASSERT(m_rMainBoundingBox.width>=0);
ASSERT(m_rMainBoundingBox.height>=0);
return SetBoundingBox(llx,lly,urx,ury);
}
bool CGfxInterface::SetBoundingBox(int llx, int lly, int urx, int ury)
{
if ((llx>=urx) || (lly>=ury))
return false;
m_rBoundingBox.left=llx;
m_rBoundingBox.top=ury;
m_rBoundingBox.width=urx-llx;
m_rBoundingBox.height=ury-lly;
ASSERT(m_rBoundingBox.width>=0);
ASSERT(m_rBoundingBox.height>=0);
return true;
}
bool CGfxInterface::SetWorldBoundingBox(double llx, double lly, double urx, double ury)
{
if ((llx>=urx) || (lly>=ury))
return false;
m_rWorldBoundingBox.left=llx;
m_rWorldBoundingBox.top=ury;
m_rWorldBoundingBox.width=urx-llx;
m_rWorldBoundingBox.height=ury-lly;
return true;
}
void CGfxInterface::GetDefaultLOGFONT(LOGFONT& lf)
{
lf.lfHeight=8;
lf.lfWidth=0;
lf.lfEscapement=0;
lf.lfOrientation=0;
lf.lfWeight=FW_NORMAL;
lf.lfItalic=FALSE;
lf.lfUnderline=FALSE;
lf.lfStrikeOut=FALSE;
lf.lfCharSet=ANSI_CHARSET;
lf.lfOutPrecision=OUT_TT_PRECIS;
lf.lfClipPrecision=CLIP_DEFAULT_PRECIS;
lf.lfQuality=ANTIALIASED_QUALITY;
lf.lfPitchAndFamily=FF_DONTCARE|DEFAULT_PITCH;
}
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Jonathan de Halleux is Civil Engineer in Applied Mathematics. He finished his PhD in 2004 in the rainy country of Belgium. After 2 years in the Common Language Runtime (i.e. .net), he is now working at Microsoft Research on Pex (http://research.microsoft.com/pex).