cc2db726db
aggiunto map da sKey a nType.
101 lines
2.6 KiB
C++
101 lines
2.6 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalS
|
|
//----------------------------------------------------------------------------
|
|
// File : GeoVector3d.cpp Data : 10.10.13 Versione : 1.2a3
|
|
// Contenuto : Implementazione della classe Vettore geometrico.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 10.10.13 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include <new>
|
|
#include "\EgtDev\Include\EGnStringUtils.h"
|
|
#include "GeoVector3d.h"
|
|
#include "GeoObjFactory.h"
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
GEOOBJ_REGISTER( GEO_VECT3D, "G_VEC", GeoVector3d) ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
GeoVector3d::GeoVector3d( void)
|
|
{
|
|
m_vtV.Set( 0, 0, 0) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
GeoVector3d::~GeoVector3d( void)
|
|
{
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoVector3d::Set( const Vector3d& vtV)
|
|
{
|
|
m_vtV = vtV ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
GeoVector3d*
|
|
GeoVector3d::Clone( void) const
|
|
{
|
|
GeoVector3d* pGVt ;
|
|
|
|
// alloco oggetto
|
|
pGVt = new(nothrow) GeoVector3d ;
|
|
if ( pGVt != nullptr)
|
|
*pGVt = *(const_cast<GeoVector3d*>(this)) ;
|
|
|
|
return pGVt ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
const string&
|
|
GeoVector3d::GetKey( void) const
|
|
{
|
|
return GEOOBJ_GETKEY( GeoVector3d) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoVector3d::Save( ostream& osOut) const
|
|
{
|
|
// parametri : punto
|
|
osOut << ToString( m_vtV) << endl ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoVector3d::Load( CScan& TheScanner)
|
|
{
|
|
string sLine ;
|
|
STRVECTOR vsParams ;
|
|
|
|
|
|
// leggo la prossima linea
|
|
if ( ! TheScanner.GetLine( sLine))
|
|
return false ;
|
|
// la divido in parametri
|
|
Tokenize( sLine, ",", vsParams) ;
|
|
// 3 parametri : le coordinate
|
|
if ( vsParams.size() != 3)
|
|
return false ;
|
|
// recupero le tre coordinate
|
|
if ( ! FromString( vsParams[0], m_vtV.x) ||
|
|
! FromString( vsParams[1], m_vtV.y) ||
|
|
! FromString( vsParams[2], m_vtV.z))
|
|
return false ;
|
|
|
|
return true ;
|
|
}
|