Click here to Skip to main content
15,891,253 members
Articles / Desktop Programming / MFC

Plot Graphic Library

Rate me:
Please Sign up or sign in to vote.
4.95/5 (70 votes)
7 May 2003LGPL36 min read 1.4M   51.3K   383  
A library to plot data (lines, maps...) in MFC projects
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.
// IGfxTestDoc.cpp : implementation of the CIGfxTestDoc class
//

#include "stdafx.h"
#include "IGfxTest.h"

#include "IGfxTestDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CIGfxTestDoc

IMPLEMENT_DYNCREATE(CIGfxTestDoc, CDocument)

BEGIN_MESSAGE_MAP(CIGfxTestDoc, CDocument)
	//{{AFX_MSG_MAP(CIGfxTestDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CIGfxTestDoc, CDocument)
	//{{AFX_DISPATCH_MAP(CIGfxTestDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//      DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IIGfxTest to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {B4F0F0E1-F5FF-42B8-B0C4-95A0A72161D4}
static const IID IID_IIGfxTest =
{ 0xb4f0f0e1, 0xf5ff, 0x42b8, { 0xb0, 0xc4, 0x95, 0xa0, 0xa7, 0x21, 0x61, 0xd4 } };

BEGIN_INTERFACE_MAP(CIGfxTestDoc, CDocument)
	INTERFACE_PART(CIGfxTestDoc, IID_IIGfxTest, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CIGfxTestDoc construction/destruction

CIGfxTestDoc::CIGfxTestDoc()
{
	// TODO: add one-time construction code here

	EnableAutomation();

	AfxOleLockApp();
}

CIGfxTestDoc::~CIGfxTestDoc()
{
	AfxOleUnlockApp();
}

BOOL CIGfxTestDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CIGfxTestDoc serialization

void CIGfxTestDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CIGfxTestDoc diagnostics

#ifdef _DEBUG
void CIGfxTestDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CIGfxTestDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CIGfxTestDoc commands

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.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Engineer
United States United States
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).

Comments and Discussions