121 lines
3.0 KiB
C++
121 lines
3.0 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2013-2013
|
|
//----------------------------------------------------------------------------
|
|
// File : GeoPoint3d.cpp Data : 10.10.13 Versione : 1.2a3
|
|
// Contenuto : Implementazione della classe Punto geometrico.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 10.10.13 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include <new>
|
|
#include "\EgtDev\Include\EGkStringUtils3d.h"
|
|
#include "GeoPoint3d.h"
|
|
#include "GeoObjFactory.h"
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
GEOOBJ_REGISTER( GEO_PNT3D, "G_PNT", GeoPoint3d) ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
GeoPoint3d::GeoPoint3d( void)
|
|
: m_ptP()
|
|
{
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
GeoPoint3d::~GeoPoint3d( void)
|
|
{
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoPoint3d::Set( const Point3d& ptP)
|
|
{
|
|
m_ptP = ptP ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
GeoPoint3d*
|
|
GeoPoint3d::Clone( void) const
|
|
{
|
|
GeoPoint3d* pGPt ;
|
|
|
|
|
|
// alloco oggetto
|
|
pGPt = new(nothrow) GeoPoint3d ;
|
|
if ( pGPt != nullptr)
|
|
*pGPt = *(const_cast<GeoPoint3d*>(this)) ;
|
|
|
|
return pGPt ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
const string&
|
|
GeoPoint3d::GetKey( void) const
|
|
{
|
|
return GEOOBJ_GETKEY( GeoPoint3d) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoPoint3d::Save( ostream& osOut) const
|
|
{
|
|
// parametri : punto
|
|
osOut << ToString( m_ptP) << ";" << endl ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoPoint3d::Load( Scanner& TheScanner)
|
|
{
|
|
string sLine ;
|
|
|
|
|
|
// leggo la prossima linea
|
|
if ( ! TheScanner.GetLine( sLine))
|
|
return false ;
|
|
// 1 solo parametro : il punto
|
|
TrimRight( sLine, ";") ;
|
|
// recupero il punto
|
|
if ( ! FromString( sLine, m_ptP))
|
|
return false ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoPoint3d::GetLocalBBox( BBox3d& b3Loc) const
|
|
{
|
|
// assegno il box in locale
|
|
b3Loc.Set( m_ptP) ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoPoint3d::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
|
|
{
|
|
// verifico validità del frame
|
|
if ( frRef.GetType() == Frame3d::ERR)
|
|
return false ;
|
|
// porto il punto nel riferimento passato
|
|
Point3d ptP = m_ptP ;
|
|
ptP.ToGlob( frRef) ;
|
|
// assegno il box nel riferimento
|
|
b3Ref.Set( ptP) ;
|
|
|
|
return true ;
|
|
}
|