www.pudn.com > SurfWareNew06.3.5(LYW).rar > CreateSurfaceRotate.cpp
// CreateSurfaceRotate.cpp : implementation file
//
#include "stdafx.h"
#include "surfware.h"
#include "CreateSurfaceRotate.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CreateSurfaceRotate dialog
CreateSurfaceRotate::CreateSurfaceRotate(CSurfWareDoc* pDoc,int mode,CWnd* pParent /*=NULL*/)
: CDialog(CreateSurfaceRotate::IDD, pParent)
{
//{{AFX_DATA_INIT(CreateSurfaceRotate)
m_para1 = 0.0;
m_para2 = 0.0;
m_para3 = 0.0;
m_pDoc=pDoc;
m_mode=mode;
//}}AFX_DATA_INIT
}
void CreateSurfaceRotate::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CreateSurfaceRotate)
DDX_Text(pDX, IDC_EDIT1, m_para1);
DDX_Text(pDX, IDC_EDIT2, m_para2);
DDX_Text(pDX, IDC_EDIT3, m_para3);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CreateSurfaceRotate, CDialog)
//{{AFX_MSG_MAP(CreateSurfaceRotate)
ON_BN_CLICKED(IDC_PREVIEW, OnPreview)
ON_EN_CHANGE(IDC_EDIT2, OnChangePara2)
ON_EN_CHANGE(IDC_EDIT3, OnChangePara3)
ON_EN_CHANGE(IDC_EDIT1, OnChangePara1)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CreateSurfaceRotate message handlers
void CreateSurfaceRotate::OnPreview()
{
// TODO: Add your control notification handler code here
if(m_mode==0)
{CSurfNurbsSurface* sf;
sf=m_pDoc->m_CurrentSelSurface.GetElement(0);
m_pDoc->m_TempSurface.GetHead()->TransForm(*sf,3,m_para1,m_para2,m_para3);
m_pDoc->UpdateAllViews(NULL);
}
else if(m_mode==1)
{
CSurfNurbsVolume* sf;
sf=m_pDoc->m_CurrentSelVolume.GetElement(0);
m_pDoc->m_TempVolume.GetHead()->TransformVolume(sf,3,m_para1,m_para2,m_para3);
m_pDoc->UpdateAllViews(NULL);
}
}
void CreateSurfaceRotate::OnChangePara1()
{
UpdateData();
}
void CreateSurfaceRotate::OnChangePara2()
{
UpdateData();
}
void CreateSurfaceRotate::OnChangePara3()
{
UpdateData();
}
void CreateSurfaceRotate::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
if(m_mode==0)
{
m_pDoc->m_TempSurface.DelAllObject();
}
else if(m_mode==1)
{
m_pDoc->m_TempVolume.DelAllObject();
}
}
BOOL CreateSurfaceRotate::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if (m_mode==0) {
CSurfNurbsSurface* tempSF=new CSurfNurbsSurface;
tempSF->SetColor(RGB(255,0,0));
m_pDoc->m_TempSurface.AddTail(tempSF);
}else if(m_mode==1){
CSurfNurbsVolume* tempVOL=new CSurfNurbsVolume;
tempVOL->SetColor(RGB(255,0,0));;
m_pDoc->m_TempVolume.AddTail(tempVOL);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}