⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contour.cpp

📁 VC实现等值线编成的COM组件的源程序代码
💻 CPP
字号:
// contour.cpp : Implementation of Ccontour
#include "stdafx.h"
#include "Com_ex.h"
#include "contour.h"

/////////////////////////////////////////////////////////////////////////////
// Ccontour


STDMETHODIMP Ccontour::get_startZ(double *pVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	*pVal = startZ;

	return S_OK;
}

STDMETHODIMP Ccontour::put_startZ(double newVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	startZ = newVal;

	return S_OK;
}

STDMETHODIMP Ccontour::get_incZ(double *pVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	*pVal = incZ;

	return S_OK;
}

STDMETHODIMP Ccontour::put_incZ(double newVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	incZ = newVal;

	return S_OK;
}

STDMETHODIMP Ccontour::get_endZ(double *pVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	*pVal = endZ;

	return S_OK;
}

STDMETHODIMP Ccontour::put_endZ(double newVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	endZ = newVal;

	return S_OK;
}

STDMETHODIMP Ccontour::GetContourCount(long *nCount)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	*nCount = m_allcon.GetContourCount();

	return S_OK;
}

STDMETHODIMP Ccontour::GetContourValueOf(long nContourIndex, double *Z)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	*Z = m_allcon.GetContour()[nContourIndex].GetZValue();

	return S_OK;
}

STDMETHODIMP Ccontour::GetPointsCountOf(long nContourIndex, long nSegIndex, long *nPointsCount)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	*nPointsCount = m_allcon.GetContour()[nContourIndex].GetPointsCount()[nSegIndex];

	return S_OK;
}

STDMETHODIMP Ccontour::GetPointsOf(long nContourIndex, long nSegIndex, double *pPointsX, double *pPointsY)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	XYZ *pt;
	int count = m_allcon.GetContour()[nContourIndex].GetPointsCount()[nSegIndex];

	if (pPointsX && pPointsY)
	{
		pt = m_allcon.GetContour()[nContourIndex].GetPoints()[nSegIndex];
		for ( int i = 0; i< count; i++)
		{
			pPointsX[i] = pt[i].x;
			pPointsY[i] = pt[i].y;
		}
	}

	return S_OK;
}

STDMETHODIMP Ccontour::GetSegCountOf(long nContourIndex, long *nSegCount)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	*nSegCount = m_allcon.GetContour()[nContourIndex].GetSegCount();

	return S_OK;
}

STDMETHODIMP Ccontour::InitialContour(LPCSTR filename)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	char fn[1024];
	strcpy(fn, filename);
	if (! m_t.Initial(fn))
		return Error(_T("Error while read file."));
	m_t.CreateTriangle();

	if (startZ ==0 && endZ == 0 && incZ == 0)
		m_allcon.Initial(&m_t);
	else
		m_allcon.Initial(&m_t, startZ, endZ, incZ);

	m_allcon.CreateAllContour();

	return S_OK;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -