contour.cpp
资源名称:08.zip [点击查看]
上传用户:ynjin1970
上传日期:2014-10-13
资源大小:6438k
文件大小:3k
源码类别:
中间件编程
开发平台:
Visual C++
- // 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;
- }