0b9c1a8fc5
- a Frame3d aggiunto metodo Set di tipo OCS - a GeoFrame3d e GeoVector3d aggiunto metodo per grafica - in GdbExecutor colore, nome e info applicabili su liste di entità.
169 lines
4.5 KiB
C++
169 lines
4.5 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2013-2013
|
|
//----------------------------------------------------------------------------
|
|
// 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 "GeoVector3d.h"
|
|
#include "GeoObjFactory.h"
|
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
|
#include "/EgtDev/Include/EGkPolyLine.h"
|
|
#include <new>
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
GEOOBJ_REGISTER( GEO_VECT3D, "G_VEC", GeoVector3d) ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
GeoVector3d::GeoVector3d( void)
|
|
: m_vtV()
|
|
{
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
GeoVector3d::~GeoVector3d( void)
|
|
{
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoVector3d::Set( const Vector3d& vtV)
|
|
{
|
|
// assegno i dati
|
|
m_vtV = vtV ;
|
|
|
|
// imposto ricalcolo della grafica
|
|
m_OGrMgr.Reset() ;
|
|
|
|
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::GetTitle( void) const
|
|
{
|
|
static const string sTitle = "Vector" ;
|
|
return sTitle ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoVector3d::Dump( string& sOut, const char* szNewLine) const
|
|
{
|
|
// parametri : vettore
|
|
sOut += "V(" + ToString( m_vtV) + ")" + szNewLine ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
const string&
|
|
GeoVector3d::GetKey( void) const
|
|
{
|
|
return GEOOBJ_GETKEY( GeoVector3d) ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoVector3d::Save( ostream& osOut) const
|
|
{
|
|
// parametri : vettore
|
|
osOut << ToString( m_vtV) << ";" << endl ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoVector3d::Load( Scanner& TheScanner)
|
|
{
|
|
// imposto ricalcolo della grafica
|
|
m_OGrMgr.Reset() ;
|
|
// leggo la prossima linea
|
|
string sLine ;
|
|
if ( ! TheScanner.GetLine( sLine))
|
|
return false ;
|
|
// 1 solo parametro : il vettore
|
|
TrimRight( sLine, ";") ;
|
|
// recupero il vettore
|
|
if ( ! FromString( sLine, m_vtV))
|
|
return false ;
|
|
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoVector3d::GetLocalBBox( BBox3d& b3Loc) const
|
|
{
|
|
// reset del box (un versore non occupa posizioni nello spazio)
|
|
b3Loc.Reset() ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoVector3d::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
|
|
{
|
|
// verifico validità del frame
|
|
if ( frRef.GetType() == Frame3d::ERR)
|
|
return false ;
|
|
// reset del box (un versore non occupa posizioni nello spazio)
|
|
b3Ref.Reset() ;
|
|
return true ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
bool
|
|
GeoVector3d::GetDrawWithArrowHead( double dFrazLenAH, PolyLine& PL) const
|
|
{
|
|
// vettore
|
|
PL.AddUPoint( 0, ORIG) ;
|
|
Point3d ptTip = ORIG + m_vtV ;
|
|
PL.AddUPoint( 1, ptTip) ;
|
|
// doppia freccia
|
|
double dLenAH = dFrazLenAH * m_vtV.Len() ;
|
|
Frame3d frF ;
|
|
frF.Set( ptTip, m_vtV) ;
|
|
Point3d ptP1 = ORIG + Vector3d( 0.5, 0, -1) * dLenAH ;
|
|
ptP1.ToGlob( frF) ;
|
|
PL.AddUPoint( 2, ptP1) ;
|
|
Point3d ptP2 = ORIG + Vector3d( -0.5, 0, -1) * dLenAH ;
|
|
ptP2.ToGlob( frF) ;
|
|
PL.AddUPoint( 3, ptP2) ;
|
|
PL.AddUPoint( 4, ptTip) ;
|
|
Point3d ptP3 = ORIG + Vector3d( 0, 0.5, -1) * dLenAH ;
|
|
ptP3.ToGlob( frF) ;
|
|
PL.AddUPoint( 5, ptP3) ;
|
|
Point3d ptP4 = ORIG + Vector3d( 0, -0.5, -1) * dLenAH ;
|
|
ptP4.ToGlob( frF) ;
|
|
PL.AddUPoint( 6, ptP4) ;
|
|
PL.AddUPoint( 7, ptTip) ;
|
|
|
|
return true ;
|
|
}
|