Files
TestEGk/TestEGk.cpp
T

133 lines
4.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : TestEGk.cpp Data : 20.11.13 Versione : 1.3a1
// Contenuto : Programma di test della libreria EgtGeomKernel.
//
//
//
// Modifiche : 20.11.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include <iostream>
#include <string>
#include "\EgtDev\Include\EGkVersion.h"
#include "\EgtDev\Include\EGnVersion.h"
#include "\EgtDev\Include\EGkGeoPoint3d.h"
#include "\EgtDev\Include\EGkGeoVector3d.h"
#include "\EgtDev\Include\EGnStringUtils.h"
//--------------------------- Define -----------------------------------------
#define STR_VER "1.3a1"
using namespace std ;
//----------------------------------------------------------------------------
int
wmain( int argc, wchar_t* argv[])
{
wstring sIn ;
// se debug, imposto stampe memory leaks all'uscita
#ifdef _DEBUG
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF) ;
#endif
// interpreto i parametri di linea
// nome file di comandi
if ( argc >= 2)
sIn = argv[1] ;
else
sIn = L"In.tsc" ;
// versione del programma
#if defined( _WIN64)
#if defined( NDEBUG)
cout << "TestEGkR64.exe v." STR_VER << endl ;
#else
cout << "TestEGkD64.exe v." STR_VER << endl ;
#endif
#else
#if defined( NDEBUG)
cout << "TestEGkR32.exe v." STR_VER << endl ;
#else
cout << "TestEGkD32.exe v." STR_VER << endl ;
#endif
#endif
// versione delle librerie
cout << GetEGkVersion() << endl ;
cout << GetEGnVersion() << endl ;
// test di Point3d, Vector3d e Frame3d
Point3d ptP ;
Vector3d vtV ;
Frame3d frF ;
ptP.Set( 0, 1, 2) ;
vtV.Set( 2, 1, 0) ;
frF.Set( Point3d( 2, 1, 0), Frame3d::TOP) ;
ptP.ToGlob( frF) ;
cout << "Point3d=" << ToString( ptP) << endl ;
cout << "Vector3d=" << ToString( vtV) << endl ;
cout << "Frame3d=" << ToString( frF.Orig()) << ';' <<
ToString( frF.VersX()) << ';' <<
ToString( frF.VersY()) << ';' <<
ToString( frF.VersZ()) << endl ;
// test di IGeoPoint3d
IGeoPoint3d* pGPt1 = CreateGeoPoint3d() ;
IGeoPoint3d* pGPt2 ;
IGeoPoint3d* pGPt3 = CreateGeoPoint3d() ;
if ( pGPt1 != nullptr) {
pGPt1->Set( ptP) ;
pGPt1->Translate( 8*Z_AX) ;
cout << "GeoPoint3d(1)=" << ToString( *(pGPt1->GetPoint())) << endl ;
if ( ( pGPt2 = CloneGeoPoint3d( pGPt1)) != nullptr) {
pGPt2->Rotate( ORIG, Z_AX, 180*DEGTORAD) ;
cout << "GeoPoint3d(2)=" << ToString( *(pGPt2->GetPoint())) << endl ;
if ( pGPt3 != nullptr && CopyGeoPoint3d( pGPt2, pGPt3)) {
pGPt3->Rotate( ORIG, Z_AX, 180*DEGTORAD) ;
cout << "GeoPoint3d(3)=" << ToString( *(pGPt3->GetPoint())) << endl ;
delete pGPt3 ;
}
delete pGPt2 ;
}
delete pGPt1 ;
}
// test di IGeoVector3d
IGeoVector3d* pGVt1 = CreateGeoVector3d() ;
IGeoVector3d* pGVt2 ;
IGeoVector3d* pGVt3 = CreateGeoVector3d() ;
if ( pGVt1 != nullptr) {
pGVt1->Set( vtV) ;
pGVt1->Rotate( ORIG, Z_AX, 90*DEGTORAD) ;
cout << "GeoVector3d(1)=" << ToString( *(pGVt1->GetVector())) << endl ;
if ( ( pGVt2 = CloneGeoVector3d( pGVt1)) != nullptr) {
pGVt2->Rotate( ORIG, X_AX, 90*DEGTORAD) ;
cout << "GeoVector3d(2)=" << ToString( *(pGVt2->GetVector())) << endl ;
if ( pGVt3 != nullptr && CopyGeoVector3d( pGVt2, pGVt3)) {
pGVt3->Rotate( ORIG, Y_AX, 90*DEGTORAD) ;
cout << "GeoVector3d(3)=" << ToString( *(pGVt3->GetVector())) << endl ;
delete pGVt3 ;
}
delete pGVt2 ;
}
delete pGVt1 ;
}
return 0 ;
}