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
|
// GraphGL.cpp: implementation of the CPGLColor class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PGL/PGLGraph.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_SERIAL(CPGLGraph,CPGLRegion,1);
CPGLObjectManager* CPGLGraph::sm_mClipboard=NULL;
void CPGLGraph::Serialize(CArchive &archive)
{
// call base class function first
// base class is CPGLObject in this case
CPGLRegion::Serialize( archive );
m_axe.Serialize(archive);
m_mObjects.Serialize(archive);
if (archive.IsLoading())
{
// setting view...
m_axe.SetView(&m_view);
// calling updating graph
PostUpdateGraph();
}
}
#ifdef _DEBUG
void CPGLGraph::Dump( CDumpContext& dc ) const
{
// call base class function first
CPGLRegion::Dump( dc );
// now do the stuff for our specific class
// now dumping..
dc << _T("--- CPGLGraph ---\n")<< endl;
dc << m_background<<m_view<<m_axe<<m_mObjects<<"\n";
}
void CPGLGraph::AssertValid() const
{
// call inherited AssertValid first
CPGLRegion::AssertValid();
}
#endif
CPGLGraph::CPGLGraph()
{
m_view.SetViewport(0,0,1,1);
}
CPGLGraph::CPGLGraph(const CPGLGraph& g)
: CPGLRegion(g)
{
LoadBitmap(IDB_PGL_GRAPH_BITMAP);
}
CPGLGraph& CPGLGraph::operator =(const CPGLGraph& g)
{
if (&g!=this)
{
this->CPGLRegion::operator =(g);
}
return *this;
}
CPGLGraph::~CPGLGraph()
{
}
/// adds context menu items...
void CPGLGraph::AddContextMenuItems(CMenu* pMenu)
{
/* //filling menu items...
// check selection state
CString str;
if (IsSelectionEmpty())
{
pMenu->AppendMenu(MF_GRAYED | MF_STRING, ID_PGL_EDIT_CUT, "Cut");
pMenu->AppendMenu(MF_GRAYED | MF_STRING, ID_PGL_EDIT_COPY, "Copy");
}
else
{
pMenu->AppendMenu(MF_ENABLED | MF_STRING, ID_PGL_EDIT_CUT, "Cut");
pMenu->AppendMenu(MF_ENABLED | MF_STRING, ID_PGL_EDIT_COPY, "Copy");
}
// check clipboard state
if (IsClipBoardEmpty())
{
pMenu->AppendMenu(MF_GRAYED | MF_STRING, ID_PGL_EDIT_PASTE, "Paste");
}
else
{
pMenu->AppendMenu(MF_ENABLED | MF_STRING, ID_PGL_EDIT_PASTE, "Paste");
}
pMenu->AppendMenu(MF_SEPARATOR);
if (IsSelectionEmpty())
pMenu->AppendMenu(MF_GRAYED | MF_STRING, ID_PGL_EDIT_DELETE, "Delete");
else
pMenu->AppendMenu(MF_ENABLED | MF_STRING, ID_PGL_EDIT_DELETE, "Delete");
*/
}
//DEL void CPGLGraph::Plot(BOOL renderToSelect)
//DEL {
//DEL // set clearing color...
//DEL MakeBackgroundCurrent();
//DEL //clear buffer
//DEL glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//DEL PGL_TRACE("PGL-Graph: Plot : GL buffer cleared\n");
//DEL
//DEL CPGLRegion::Plot(renderToSelect);
//DEL };
void CPGLGraph::PlotGfx(gfxinterface::CGfxInterface& gfx)
{
// defining some operator...
gfx.PushState();
CPGLRegion::PlotGfx(gfx);
gfx.PopState();
}
void CPGLGraph::FormatSelectedText()
{
// check if single or multiple selection
// and choose new text format...
/* CPGLFont* pFont=m_mFonts.ChooseFontFromDialog();
if (pFont!=NULL)
{
// set font to selected text objects...
CPGLObject* pObject;
CPGLObjectManager* pTextSelection=m_mObjects.GetTextSelection();
POSITION pos=pTextSelection->GetHeadPosition();
while (pos!=NULL)
{
pObject=pTextSelection->GetNext(pos);
ASSERT( pObject->IsKindOf(RUNTIME_CLASS(CPGLText)));
m_mFonts.ChangeFont((CPGLText*)pObject, pFont->GetID());
}
// cleaning
delete pTextSelection;
}
*/
}
|
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).