354 lines
15 KiB
C++
354 lines
15 KiB
C++
//ROMTEAM WorldEditor
|
|
////////////////////////////////////////////////////////////////////////////////////////
|
|
// File : DlgCone3D.cpp : implementation file
|
|
// Author : Cristi Petrescu
|
|
// Date : 97.11
|
|
// Description :
|
|
////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
#include "stdafx.h"
|
|
#include "ACP_Base.h"
|
|
#include "incITF.h"
|
|
|
|
#undef CPA_WANTS_IMPORT
|
|
#undef CPA_EXPORT
|
|
#define CPA_WANTS_EXPORT
|
|
#include "OGD.h"
|
|
#undef CPA_WANTS_EXPORT
|
|
#define CPA_WANTS_IMPORT
|
|
|
|
#include "3Dinterf.hpp"
|
|
#include "DlgCon3D.hpp"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDlgCone3D dialog
|
|
|
|
CDlgCone3D::CDlgCone3D(Cone3D *pCone3D, CWnd* pParent /*= NULL*/)
|
|
:CDialog(CDlgCone3D::IDD, pParent)
|
|
{
|
|
m_pCone3D = pCone3D;
|
|
|
|
//{{AFX_DATA_INIT(CDlgCone3D)
|
|
m_Edition_Zone_Angle = _T("");
|
|
m_Edition_Zone_Radius = _T("");
|
|
m_Edition_Zone_X_Base = _T("");
|
|
m_Edition_Zone_X_Top = _T("");
|
|
m_Edition_Zone_Y_Base = _T("");
|
|
m_Edition_Zone_Y_Top = _T("");
|
|
m_Edition_Zone_Z_Base = _T("");
|
|
m_Edition_Zone_Z_Top = _T("");
|
|
//}}AFX_DATA_INIT
|
|
}
|
|
|
|
void CDlgCone3D::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDlgCone3D)
|
|
DDX_Text(pDX, IDC_Edition_Zone_Angle, m_Edition_Zone_Angle);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Radius, m_Edition_Zone_Radius);
|
|
DDX_Text(pDX, IDC_Edition_Zone_X_Base, m_Edition_Zone_X_Base);
|
|
DDX_Text(pDX, IDC_Edition_Zone_X_Top, m_Edition_Zone_X_Top);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Y_Base, m_Edition_Zone_Y_Base);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Y_Top, m_Edition_Zone_Y_Top);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Z_Base, m_Edition_Zone_Z_Base);
|
|
DDX_Text(pDX, IDC_Edition_Zone_Z_Top, m_Edition_Zone_Z_Top);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CDlgCone3D, CDialog)
|
|
//{{AFX_MSG_MAP(CDlgCone3D)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Angle, On_Change_Edition_Zone_Angle)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Radius, On_Change_Edition_Zone_Radius)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_X_Base, On_Change_Edition_Zone_X_Base)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_X_Top, On_Change_Edition_Zone_X_Top)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Y_Base, On_Change_Edition_Zone_Y_Base)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Y_Top, On_Change_Edition_Zone_Y_Top)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Z_Base, On_Change_Edition_Zone_Z_Base)
|
|
ON_EN_CHANGE(IDC_Edition_Zone_Z_Top, On_Change_Edition_Zone_Z_Top)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method :CDlgCone3D - OnInitDialog
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : initialisation of the window
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
BOOL CDlgCone3D::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
m_InitialTop = m_pCone3D -> GetTopPoint ();
|
|
m_InitialBase = m_pCone3D -> GetBasePoint ();
|
|
m_InitialRadius = m_pCone3D -> GetRadius ();
|
|
m_InitialAngle = m_pCone3D -> GetAngle ();
|
|
RefreshData ();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method :CDlgCone3D - On_Change_Edition_Zone_X_Base
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : this function is called when the user changes the X coordinate of the base point
|
|
// we update the variable
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void CDlgCone3D::On_Change_Edition_Zone_X_Base ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
m_pCone3D -> SetBasePointX ((float) atof (m_Edition_Zone_X_Base));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
RedrawBackground ();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method :CDlgCone3D - On_Change_Edition_Zone_Y_Base
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : this function is called when the user changes the Y coordinate of the base point
|
|
// we update the variable
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void CDlgCone3D::On_Change_Edition_Zone_Y_Base ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
m_pCone3D -> SetBasePointY ((float) atof (m_Edition_Zone_Y_Base));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
RedrawBackground ();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method :CDlgCone3D - On_Change_Edition_Zone_Z_Base
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : this function is called when the user changes the Z coordinate of the base point
|
|
// we update the variable
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void CDlgCone3D::On_Change_Edition_Zone_Z_Base ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
m_pCone3D -> SetBasePointZ ((float) atof (m_Edition_Zone_Z_Base));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
RedrawBackground ();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method :CDlgCone3D - On_Change_Edition_Zone_X_Top
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : this function is called when the user changes the X coordinate of the top point
|
|
// we update the variable
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void CDlgCone3D::On_Change_Edition_Zone_X_Top ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
m_pCone3D -> SetTopPointX ((float) atof (m_Edition_Zone_X_Top));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
RedrawBackground ();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method :CDlgCone3D - On_Change_Edition_Zone_Y_Top
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : this function is called when the user changes the Y coordinate of the top point
|
|
// we update the variable
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void CDlgCone3D::On_Change_Edition_Zone_Y_Top ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
m_pCone3D -> SetTopPointY ((float) atof (m_Edition_Zone_Y_Top));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
RedrawBackground ();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method :CDlgCone3D - On_Change_Edition_Zone_Z_Top
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : this function is called when the user changes the Z coordinate of the top point
|
|
// we update the variable
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void CDlgCone3D::On_Change_Edition_Zone_Z_Top ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
m_pCone3D -> SetTopPointZ ((float) atof (m_Edition_Zone_Z_Top));
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // The angle changes too
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
RedrawBackground ();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method :CDlgCone3D - On_Change_Edition_Zone_Radius
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : this function is called when the user changes the radius of the cone
|
|
// we update the variable
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void CDlgCone3D::On_Change_Edition_Zone_Radius ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Radius = (float) atof (m_Edition_Zone_Radius);
|
|
m_pCone3D -> SetRadius (& Radius);
|
|
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ()); // When one changes the radius, the angle changes too
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
RedrawBackground ();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method :CDlgCone3D - On_Change_Edition_Zone_Angle
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : this function is called when the user changes the angle of the cone
|
|
// we update the variable
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void CDlgCone3D::On_Change_Edition_Zone_Angle ()
|
|
{
|
|
UpdateData (TRUE); // Update variables from screen
|
|
float Angle = (float) atof (m_Edition_Zone_Angle);
|
|
m_pCone3D -> SetAngle (& Angle);
|
|
|
|
m_Edition_Zone_Radius . Format ("%.4g" , m_pCone3D -> GetRadius ()); // When one changes the angle, the radius changes too
|
|
UpdateData (FALSE); // Update the screen
|
|
|
|
RedrawBackground ();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method :CDlgCone3D - RefreshData
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : this function is called when the data need to be refreshed (because of a Undo, for instance)
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void CDlgCone3D::RefreshData ()
|
|
{
|
|
// Init the variables on the screen
|
|
MTH3D_tdstVector BasePoint = m_pCone3D -> GetBasePoint ();
|
|
m_Edition_Zone_X_Base . Format ("%.4g" , BasePoint . xX);
|
|
m_Edition_Zone_Y_Base . Format ("%.4g" , BasePoint . xY);
|
|
m_Edition_Zone_Z_Base . Format ("%.4g" , BasePoint . xZ);
|
|
|
|
MTH3D_tdstVector TopPoint = m_pCone3D -> GetTopPoint ();
|
|
m_Edition_Zone_X_Top . Format ("%.4g" , TopPoint . xX);
|
|
m_Edition_Zone_Y_Top . Format ("%.4g" , TopPoint . xY);
|
|
m_Edition_Zone_Z_Top . Format ("%.4g" , TopPoint . xZ);
|
|
|
|
m_Edition_Zone_Radius . Format ("%.4g" , m_pCone3D -> GetRadius ());
|
|
m_Edition_Zone_Angle . Format ("%.4g" , m_pCone3D -> GetAngle ());
|
|
|
|
UpdateData (FALSE); // Update the screen
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method :CDlgCone3D - OnCancel
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : set the initial radius value
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void CDlgCone3D::OnCancel()
|
|
{
|
|
m_pCone3D -> SetTopPoint (& m_InitialTop);
|
|
m_pCone3D -> SetBasePoint (& m_InitialBase);
|
|
m_pCone3D -> SetRadius (& m_InitialRadius);
|
|
m_pCone3D -> SetAngle (& m_InitialAngle);
|
|
|
|
CDialog::OnCancel();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Method : void CDlgCone3D::RedrawBackground
|
|
// Date : 97.11
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Description : redraws the main view.
|
|
// Author : Cristi Petrescu
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Modification :
|
|
// Date :
|
|
// By :
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
void CDlgCone3D::RedrawBackground (void)
|
|
{
|
|
(((DEV_MultiDevice*)g_oFrameGest.ma_p_oWinArray[2][2]->GetActiveView())->DrawObject());
|
|
}
|