EgtGeomKernel 1.4l3 : Modifiche a ApproxWithLines anche per CurveComposite.
Aggiunta classe PolyLine.
This commit is contained in:
+177
@@ -0,0 +1,177 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2013-2013
|
||||
//----------------------------------------------------------------------------
|
||||
// File : DistPointLine.cpp Data : 22.12.13 Versione : 1.4l3
|
||||
// Contenuto : Implementazione dell'oggetto PolyLine.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 22.12.13 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "\EgtDev\Include\EGkPolyLine.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
PolyLine::PolyLine( void)
|
||||
{
|
||||
m_nCount = 0 ;
|
||||
m_iter = m_lUPoints.end() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
PolyLine::~PolyLine( void)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PolyLine::AddUPoint( double dPar, const Point3d& ptP)
|
||||
{
|
||||
try {
|
||||
m_lUPoints.push_back( UPOINT( dPar, ptP)) ;
|
||||
}
|
||||
catch (...) {
|
||||
return false ;
|
||||
}
|
||||
|
||||
m_nCount ++ ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PolyLine::EraseFirstUPoint( void)
|
||||
{
|
||||
if ( m_lUPoints.begin() == m_lUPoints.end())
|
||||
return false ;
|
||||
|
||||
m_lUPoints.pop_front() ;
|
||||
m_nCount -- ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PolyLine::AddOffsetToU( double dOffset)
|
||||
{
|
||||
UPNTLIST::iterator iter ;
|
||||
|
||||
|
||||
for ( iter = m_lUPoints.begin() ; iter != m_lUPoints.end() ; ++ iter)
|
||||
iter->first += dOffset ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PolyLine::Splice( PolyLine& PL)
|
||||
{
|
||||
m_lUPoints.splice( m_lUPoints.end(), PL.m_lUPoints) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PolyLine::GetFirstUPoint( double* pdPar, Point3d* pptP)
|
||||
{
|
||||
m_iter = m_lUPoints.begin() ;
|
||||
if ( m_iter == m_lUPoints.end())
|
||||
return false ;
|
||||
|
||||
if ( pdPar != nullptr)
|
||||
*pdPar = m_iter->first ;
|
||||
if ( pptP != nullptr)
|
||||
*pptP = m_iter->second ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PolyLine::GetNextUPoint( double* pdPar, Point3d* pptP)
|
||||
{
|
||||
++ m_iter ;
|
||||
if ( m_iter == m_lUPoints.end())
|
||||
return false ;
|
||||
|
||||
if ( pdPar != nullptr)
|
||||
*pdPar = m_iter->first ;
|
||||
if ( pptP != nullptr)
|
||||
*pptP = m_iter->second ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PolyLine::GetLastUPoint( double* pdPar, Point3d* pptP)
|
||||
{
|
||||
if ( m_lUPoints.begin() == m_lUPoints.end())
|
||||
return false ;
|
||||
|
||||
if ( pdPar != nullptr)
|
||||
*pdPar = m_lUPoints.back().first ;
|
||||
if ( pptP != nullptr)
|
||||
*pptP = m_lUPoints.back().second ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PolyLine::GetFirstULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin)
|
||||
{
|
||||
// parametro e punto iniziali
|
||||
m_iter = m_lUPoints.begin() ;
|
||||
if ( m_iter == m_lUPoints.end())
|
||||
return false ;
|
||||
if ( pdIni != nullptr)
|
||||
*pdIni = m_iter->first ;
|
||||
if ( pptIni != nullptr)
|
||||
*pptIni = m_iter->second ;
|
||||
|
||||
// parametro e punto finali
|
||||
++ m_iter ;
|
||||
if ( m_iter == m_lUPoints.end())
|
||||
return false ;
|
||||
if ( pdFin != nullptr)
|
||||
*pdFin = m_iter->first ;
|
||||
if ( pptFin != nullptr)
|
||||
*pptFin = m_iter->second ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
PolyLine::GetNextULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin)
|
||||
{
|
||||
// parametro e punto iniziali (è il precedente finale)
|
||||
if ( m_iter == m_lUPoints.end())
|
||||
return false ;
|
||||
if ( pdIni != nullptr)
|
||||
*pdIni = m_iter->first ;
|
||||
if ( pptIni != nullptr)
|
||||
*pptIni = m_iter->second ;
|
||||
|
||||
// parametro e punto finali
|
||||
++ m_iter ;
|
||||
if ( m_iter == m_lUPoints.end())
|
||||
return false ;
|
||||
if ( pdFin != nullptr)
|
||||
*pdFin = m_iter->first ;
|
||||
if ( pptFin != nullptr)
|
||||
*pptFin = m_iter->second ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user