Click here to Skip to main content
15,894,180 members
Articles / Desktop Programming / MFC

A 2D data visualisation class

Rate me:
Please Sign up or sign in to vote.
4.54/5 (34 votes)
20 Mar 2000 316.3K   17.6K   175  
A comprehensive set of classes for displaying 2 dimensional data
/*
This file was created by Paul Barvinko (pbarvinko@yahoo.com).
This file is distributed "as is", e.g. there are no warranties 
and obligations and you could use it in your applications on your
own risk. 
Your comments and questions are welcome.
If using in your applications, please mention author in credits for your app.
*/
// Changed from RULER.H by Nick
#ifndef __GRULER_H
#define __GRULER_H

#include "coords.h"

//FRuler object
class FRuler : public CWnd
{
protected:
	DECLARE_DYNCREATE(FRuler)

// Attributes
public:
	LOGFONT MainFontRec;
//	int MinShift,MaxShift;
	double MinValue, MaxValue;
	CString sUnit, sTitle;
	CToolTipCtrl tooltip;

// Operations
public:
	int ConvertLogPixToRealPix(CDC* dest_dc, double log_pix_num, BOOL b_x_axis);
	virtual int Width(CDC* dest_dc){return 0;};
	void SetMinMax(double minv, double maxv, BOOL bRedraw);
	void SetNewTitles(char* newUOM, char* newTitle);
	virtual int GetNMax(CDC* dc_to_draw, CRect rect_to_draw){return 0;};
	virtual void DrawRuler(CDC* dc_to_draw, CRect rect_to_draw){};

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(FRuler)
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	//}}AFX_VIRTUAL

// Implementation
protected:
	FRuler();
	virtual ~FRuler();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
protected:
	//{{AFX_MSG(FRuler)
	afx_msg void OnPaint();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

class FHRuler : public FRuler
{
	DECLARE_DYNAMIC(FHRuler)
  public:
	FHRuler();
	virtual int Width(CDC* dest_dc);
	virtual int GetNMax(CDC* dc_to_draw, CRect rect_to_draw);
	virtual void DrawRuler(CDC* dc_to_draw, CRect rect_to_draw);

protected:
	//{{AFX_MSG(FHRuler)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

class FVRuler : public FRuler
{
	DECLARE_DYNAMIC(FVRuler)
  public:
	FVRuler();
	virtual int Width(CDC* dest_dc);
	virtual int GetNMax(CDC* dc_to_draw, CRect rect_to_draw);
	virtual void DrawRuler(CDC* dc_to_draw, CRect rect_to_draw);
protected:
	//{{AFX_MSG(FVRuler)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#endif

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions