Click here to Skip to main content
15,895,709 members
Articles / Multimedia / GDI

Curve representation by ICAS (Inner Centered Arcs)

Rate me:
Please Sign up or sign in to vote.
4.80/5 (13 votes)
13 Nov 2011CPOL7 min read 30.2K   1.7K   25  
Suggestion about another curve representation
#pragma once

#include "IcasFig.h" 

// CIcasSegmentDlg dialog
#pragma warning( disable : 4996 )//sscanf
#define L_RESERVE1 8

class CIcasSegmentDlg : public CDialog
{
	DECLARE_DYNAMIC(CIcasSegmentDlg)

public:
	CIcasSegmentDlg(int x, int y, ICASPOINT *pD, CWnd* pParent = NULL);
	CIcasSegmentDlg(int x, int y, CWnd* pParent = NULL);
	CIcasSegmentDlg(CWnd* pParent = NULL);   // default constructor
	virtual ~CIcasSegmentDlg();
	BOOL Create();

protected:
	CWnd* m_pParent;
	int   m_nID;

// dialog data
	enum { IDD = IDD_ICASSEGMENTDLG };

public:
	int m_x;//
	int m_y;
	int m_typ;
	int m_nNormal;
	int m_nParallel;
	int m_nMultiple;
	int	m_nReserve1;
	double m_dx;
	double m_dy;
	//
	ICASPOINT *m_pD;

	void SetType(int type) {
		if (type & L_NORMAL)     m_nNormal    = 1;
		else                     m_nNormal    = 0;
		if (type & L_PARALLEL)   m_nParallel  = 1;
		else                     m_nParallel  = 0;
		if (type & L_MULTIPLE)   m_nMultiple  = 1;
		else                     m_nMultiple  = 0;
		if (type & L_RESERVE1)   m_nReserve1  = 1;
		else                     m_nReserve1  = 0;
	}
	int GetType() {
		int type = 0;
		if (m_nNormal)     type |= L_NORMAL;
		if (m_nParallel)   type |= L_PARALLEL;
		if (m_nMultiple)   type |= L_MULTIPLE;
		if (m_nReserve1)   type |= L_RESERVE1;
		return type;
	}
	void SetSeg(ICASPOINT* pD) {
		if (NULL == pD) return;
		SetType(pD->typ);
		m_dx = pD->x;
		m_dy = pD->y;
	}
	int SetHitSeg() {
		if (NULL == m_pD) return 0;
		m_pD->typ = GetType();
		m_pD->x   = m_dx;
		m_pD->y   = m_dy;
		return m_pD->typ;
	}

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL OnInitDialog();
	afx_msg void OnBnClickedSegNormal();
	afx_msg void OnBnClickedSegParallel();
	afx_msg void OnBnClickedSegMultiple();
	afx_msg void OnBnClickedSegReserve1();
};

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 Code Project Open License (CPOL)


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

Comments and Discussions