1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0024943: Port MFC samples to UNICODE for compatibility with VS2013

Add vc12 project files for MFC samples.

CMake - add Unicode option for MFC samples

CMake - do not set MFC option globally

Update description of Cmake building procedure for MFC sample

Correction of cmake.md and automake.md

0024943: Port MFC sample to UNICODE for compatibility with VS2013
The formatting of developer guides about OCCT building with various build systems has been improved.

automake article clean up
This commit is contained in:
kgv
2014-07-31 13:52:43 +04:00
committed by bugmaster
parent 9d0fc01b3f
commit 576f8b111b
140 changed files with 7640 additions and 1202 deletions

View File

@@ -26,7 +26,7 @@ END_MESSAGE_MAP()
CAnimationApp::CAnimationApp() : OCC_App()
{
SampleName = "Animation"; //for about dialog
SetSamplePath ("..\\..\\09_Animation");
SetSamplePath (L"..\\..\\09_Animation");
}
/////////////////////////////////////////////////////////////////////////////

View File

@@ -74,48 +74,58 @@ CAnimationDoc::CAnimationDoc()
TopoDS_Shape Piston;
TopoDS_Shape EngineBlock;
char AbloluteExecutableFileName[200];
HMODULE hModule = GetModuleHandle(NULL);
GetModuleFileName (hModule, AbloluteExecutableFileName, 200);
/*wchar_t AbloluteExecutableFileName[200];
HMODULE hModule = GetModuleHandleW (NULL);
GetModuleFileNameW (hModule, AbloluteExecutableFileName, 200);
CString aDataDirPath (AbloluteExecutableFileName);
int index = aDataDirPath.ReverseFind ('\\');
aDataDirPath.Delete (index + 1, aDataDirPath.GetLength() - index - 1);*/
CString aString(AbloluteExecutableFileName);
int index = aString.ReverseFind('\\');
CString CASROOTValue;
CASROOTValue.GetEnvironmentVariable (L"CASROOT");
CString aDataDirPath = (CASROOTValue + "\\data\\occ");
aString.Delete(index+1, aString.GetLength() - index - 1);
std::filebuf aFileBuf;
std::istream aStream (&aFileBuf);
CString aPathCrankArm = aDataDirPath + "\\CrankArm.rle";
if (aFileBuf.open (aPathCrankArm, ios::in))
{
BRepTools::Read (CrankArm, aStream, B);
aFileBuf.close();
}
TCHAR tchBuf[80];
CString aPathCylinderHead = aDataDirPath + "\\CylinderHead.rle";
if (aFileBuf.open (aPathCylinderHead, ios::in))
{
BRepTools::Read (CylinderHead, aStream, B);
aFileBuf.close();
}
CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL);
aString = (CASROOTValue + "\\data\\occ");
CString aPathPropeller = aDataDirPath + "\\Propeller.rle";
if (aFileBuf.open (aPathPropeller, ios::in))
{
BRepTools::Read (Propeller, aStream, B);
aFileBuf.close();
}
char DataDirPath[200];
strcpy_s(DataDirPath, aString);
char temp[200];
strcpy_s(temp, DataDirPath);
CString aPathPiston = aDataDirPath + "\\Piston.rle";
if (aFileBuf.open (aPathPiston, ios::in))
{
BRepTools::Read (Piston, aStream, B);
aFileBuf.close();
}
strcat_s(temp,"\\CrankArm.rle");
BRepTools::Read(CrankArm, temp, B);
strcpy_s(temp, DataDirPath);
strcat_s(temp,"\\CylinderHead.rle");
BRepTools::Read(CylinderHead, temp, B);
CString aPathEngineBlock = aDataDirPath + "\\EngineBlock.rle";
if (aFileBuf.open (aPathEngineBlock, ios::in))
{
BRepTools::Read (EngineBlock, aStream, B);
aFileBuf.close();
}
strcpy_s(temp, DataDirPath);
strcat_s(temp,"\\Propeller.rle");
BRepTools::Read(Propeller, temp, B);
strcpy_s(temp, DataDirPath);
strcat_s(temp,"\\Piston.rle");
BRepTools::Read(Piston, temp, B);
strcpy_s(temp, DataDirPath);
strcat_s(temp,"\\EngineBlock.rle");
BRepTools::Read(EngineBlock, temp, B);
if (CrankArm.IsNull() || CylinderHead.IsNull() ||
Propeller.IsNull() || Piston.IsNull() || EngineBlock.IsNull())
{
int rep = MessageBox(NULL, "Shape(s) not found.\nCheck the Data directory path!", "Error",MB_OK | MB_ICONERROR);
int rep = MessageBoxW (AfxGetApp()->m_pMainWnd->m_hWnd, L"Shape(s) not found.\nCheck the Data directory path!", L"Error", MB_OK | MB_ICONERROR);
if (rep == IDOK)
exit(0);
}
@@ -356,7 +366,7 @@ void CAnimationDoc::OnFileLoadgrid()
NULL,
NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"Points Files (*.pnt;*.pnts)|*.pnt; *.pnts|All Files (*.*)|*.*||",
L"Points Files (*.pnt;*.pnts)|*.pnt; *.pnts|All Files (*.*)|*.*||",
NULL );
CString initdir(((OCC_App*) AfxGetApp())->GetInitDataDir());
@@ -426,12 +436,6 @@ void CAnimationDoc::OnFileLoadgrid()
void CAnimationDoc::OnUpdateWalkWalkthru(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
int i ;
char szMsg [256] ;
i = GetEnvironmentVariable( "CSF_WALKTHROUGH" , szMsg , sizeof szMsg ) ;
if ( i )
pCmdUI->SetCheck ( 1 ) ;
else
pCmdUI->SetCheck ( 0 ) ;
CString aValue;
pCmdUI->SetCheck (aValue.GetEnvironmentVariable (L"CSF_WALKTHROUGH") ? 1 : 0);
}

View File

@@ -926,31 +926,27 @@ void CAnimationView3D::SetFocal (double theFocus, double theAngle)
void CAnimationView3D::ReloadData()
{
char szMsg [128] ;
double dTwist ;
myView->At ( m_Atx , m_Aty , m_Atz ) ;
myView->Eye ( m_Eyex , m_Eyey , m_Eyez ) ;
double dTwist = myView->Twist() * 180. / M_PI;
dTwist = myView->Twist () ;
dTwist = dTwist * 180. / M_PI ;
CString aMsg;
aMsg.Format (L"%lf", m_Atx);
m_Tune.GetDlgItem (IDC_XAT)->SetWindowText (aMsg);
aMsg.Format (L"%lf", m_Aty);
m_Tune.GetDlgItem (IDC_YAT)->SetWindowText (aMsg);
aMsg.Format (L"%lf", m_Atz);
m_Tune.GetDlgItem (IDC_ZAT)->SetWindowText (aMsg);
sprintf_s ( szMsg , "%lf" , m_Atx ) ;
(m_Tune.GetDlgItem ( IDC_XAT ))->SetWindowText ( szMsg ) ;
sprintf_s ( szMsg , "%lf" , m_Aty ) ;
(m_Tune.GetDlgItem ( IDC_YAT ))->SetWindowText ( szMsg ) ;
sprintf_s ( szMsg , "%lf" , m_Atz ) ;
(m_Tune.GetDlgItem ( IDC_ZAT ))->SetWindowText ( szMsg ) ;
aMsg.Format (L"%lf", m_Eyex);
m_Tune.GetDlgItem (IDC_XEYE)->SetWindowText (aMsg);
aMsg.Format (L"%lf", m_Eyey);
m_Tune.GetDlgItem (IDC_YEYE)->SetWindowText (aMsg);
aMsg.Format (L"%lf", m_Eyez);
m_Tune.GetDlgItem (IDC_ZEYE)->SetWindowText (aMsg);
sprintf_s ( szMsg , "%lf" , m_Eyex ) ;
(m_Tune.GetDlgItem ( IDC_XEYE ))->SetWindowText ( szMsg ) ;
sprintf_s ( szMsg , "%lf" , m_Eyey ) ;
(m_Tune.GetDlgItem ( IDC_YEYE ))->SetWindowText ( szMsg ) ;
sprintf_s ( szMsg , "%lf" , m_Eyez ) ;
(m_Tune.GetDlgItem ( IDC_ZEYE ))->SetWindowText ( szMsg ) ;
sprintf_s ( szMsg , "%lf" , dTwist ) ;
(m_Tune.GetDlgItem ( IDC_TWIST ))->SetWindowText ( szMsg ) ;
aMsg.Format (L"%lf", dTwist);
m_Tune.GetDlgItem (IDC_TWIST)->SetWindowText (aMsg);
double dx,dy,dz ;
dx = m_Atx - m_Eyex ;

View File

@@ -8,52 +8,35 @@
// cf jm-oliva@paris3.matra-dtv.fr ( Merci JMO )
//=======================================================================
Standard_Boolean grid2surf(Standard_CString ShapeName,Handle(Geom_BSplineSurface)& S )
Standard_Boolean grid2surf(CString ShapeName, Handle(Geom_BSplineSurface)& S)
{
CString aFileName = ShapeName;
aFileName.Replace(L'\\', L'/');
Handle(TColStd_HArray2OfReal) H;
Standard_Real xmin, ymin, Dx, Dy;
H = ReadRegularGrid(ShapeName, xmin, ymin, Dx, Dy);
H = ReadRegularGrid (aFileName, xmin, ymin, Dx, Dy);
GeomAPI_PointsToBSplineSurface MkSurf;
MkSurf.Interpolate(H->Array2(), xmin, Dx, ymin, Dy);
S = MkSurf.Surface();
return Standard_True;
}
//=======================================================================
//function : grid2surf
//purpose :
// cf jm-oliva@paris3.matra-dtv.fr ( Merci JMO )
//=======================================================================
Standard_Boolean grid2surf(const CString aCStringShapeName,
Handle(Geom_BSplineSurface)& S )
{
char tmp_char[256] ="";
strcpy_s(tmp_char,aCStringShapeName);
int i = 0, len = (int)strlen(tmp_char);
while (i < len)
{
if (tmp_char[i] == '\\')
tmp_char[i] = '/';
i++;
}
Standard_CString aFileName = tmp_char;
return grid2surf(aFileName,S);
}
//=======================================================================
//function : ReadRegularGrid
//purpose :
// cf jm-oliva@paris3.matra-dtv.fr ( Merci JMO )
//=======================================================================
Handle(TColStd_HArray2OfReal) ReadRegularGrid(Standard_CString FileName,
Handle(TColStd_HArray2OfReal) ReadRegularGrid(CString FileName,
Standard_Real& xmin,
Standard_Real& ymin,
Standard_Real& Deltax,
Standard_Real& Deltay)
{
CString aFileName = FileName;
aFileName.Replace (L'\\', L'/');
Handle(TColStd_HArray2OfReal) H;
Standard_Integer R1 = 1, R2, C1 = 1, C2, R, C;
Standard_Real x, y, z;
@@ -61,7 +44,7 @@ Handle(TColStd_HArray2OfReal) ReadRegularGrid(Standard_CString FileName,
xmin = ymin = 10000000;
FILE *fp = NULL;
fopen_s(&fp, FileName, "r");
_wfopen_s (&fp, aFileName, L"r");
if (fp)
{
@@ -111,29 +94,3 @@ Handle(TColStd_HArray2OfReal) ReadRegularGrid(Standard_CString FileName,
}
return H;
}
//=======================================================================
//function : ReadRegularGrid
//purpose :
// cf jm-oliva@paris3.matra-dtv.fr ( Merci JMO )
//=======================================================================
Handle(TColStd_HArray2OfReal) ReadRegularGrid(const CString aCStringFileName,
Standard_Real& xmin,
Standard_Real& ymin,
Standard_Real& Deltax,
Standard_Real& Deltay)
{
char tmp_char[256] ="";
strcpy_s(tmp_char,aCStringFileName);
int i = 0, len = (int)strlen(tmp_char);
while (i < len)
{
if (tmp_char[i] == '\\')
tmp_char[i] = '/';
i++;
}
Standard_CString aFileName = tmp_char;
Handle(TColStd_HArray2OfReal) H;
H = ReadRegularGrid(aFileName,xmin,ymin,Deltax,Deltay);
return H;
}

View File

@@ -36,18 +36,11 @@
#include <AIS_InteractiveContext.hxx>
Standard_Boolean grid2surf(Standard_CString ShapeName,Handle(Geom_BSplineSurface)& S );
Standard_Boolean grid2surf(const CString aCStringShapeName,Handle(Geom_BSplineSurface)& S );
Standard_Boolean grid2surf(CString ShapeName, Handle(Geom_BSplineSurface)& S);
Handle(Geom_BSplineCurve) SetTransfo(Handle(Geom_BSplineCurve) aBSCurve);
Handle(Geom_BSplineCurve) BuildBSplineCurve(Standard_Boolean DisplayPoints = Standard_True);
Handle(TColStd_HArray2OfReal) ReadRegularGrid(Standard_CString FileName,
Handle(TColStd_HArray2OfReal) ReadRegularGrid(CString FileName,
Standard_Real& xmin,
Standard_Real& ymin,
Standard_Real& Deltax,
Standard_Real& Deltay);
Handle(TColStd_HArray2OfReal) ReadRegularGrid(const CString aCStringFileName,
Standard_Real& xmin,
Standard_Real& ymin,
Standard_Real& Deltax,
Standard_Real& Deltay);