Files
Include/EGkPolyLine.h
T
Dario Sassi fab1425710 Include :
- aggiornamenti vari.
2014-10-07 07:03:26 +00:00

117 lines
6.6 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : EGkPolyLine.h Data : 22.12.13 Versione : 1.4l3
// Contenuto : Dichiarazione della classe PolyLine.
//
//
//
// Modifiche : 22.12.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EGkPoint3d.h"
#include "/EgtDev/Include/EGkGeoCollection.h"
class Plane3d ;
//----------------------- Macro per import/export ----------------------------
#undef EGK_EXPORT
#if defined( I_AM_EGK) // da definirsi solo nella DLL
#define EGK_EXPORT __declspec( dllexport)
#else
#define EGK_EXPORT __declspec( dllimport)
#endif
//-----------------------------------------------------------------------------
class PolyLine
{
public :
EGK_EXPORT PolyLine( void) ;
EGK_EXPORT ~PolyLine( void) ;
EGK_EXPORT bool Clear( void) ;
EGK_EXPORT bool AddUPoint( double dPar, const Point3d& ptP) ;
EGK_EXPORT bool Close( void) ;
EGK_EXPORT bool EraseFirstUPoint( void) ;
EGK_EXPORT bool EraseLastUPoint( void) ;
EGK_EXPORT bool AddOffsetToU( double dOffset) ;
EGK_EXPORT bool Translate( const Vector3d& vtMove) ;
EGK_EXPORT bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
{ double dAngRad = dAngDeg * DEGTORAD ;
return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
EGK_EXPORT bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
EGK_EXPORT bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
EGK_EXPORT bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ;
EGK_EXPORT bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
EGK_EXPORT bool ToGlob( const Frame3d& frRef) ;
EGK_EXPORT bool ToLoc( const Frame3d& frRef) ;
EGK_EXPORT bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) ;
EGK_EXPORT bool Join( PolyLine& PL, double dOffsetPar = 0) ;
EGK_EXPORT bool Split( double dU, PolyLine& PL) ;
EGK_EXPORT bool IsClosed( void) const ;
EGK_EXPORT int GetRejectedNbr( void) const
{ return m_nRejected ; }
EGK_EXPORT int GetPointNbr( void) const
{ return m_nCount ; }
EGK_EXPORT bool GetFirstUPoint( double* pdPar, Point3d* pptP, bool bNotLast = false) const ;
EGK_EXPORT bool GetNextUPoint( double* pdPar, Point3d* pptP, bool bNotLast = false) const ;
EGK_EXPORT bool GetFirstU( double& dPar, bool bNotLast = false) const
{ return GetFirstUPoint( &dPar, nullptr, bNotLast) ; }
EGK_EXPORT bool GetNextU( double& dPar, bool bNotLast = false) const
{ return GetNextUPoint( &dPar, nullptr, bNotLast) ; }
EGK_EXPORT bool GetFirstPoint( Point3d& ptP, bool bNotLast = false) const
{ return GetFirstUPoint( nullptr, &ptP, bNotLast) ; }
EGK_EXPORT bool GetNextPoint( Point3d& ptP, bool bNotLast = false) const
{ return GetNextUPoint( nullptr, &ptP, bNotLast) ; }
EGK_EXPORT bool GetLastUPoint( double* pdPar, Point3d* pptP, bool bNotFirst = false) const ;
EGK_EXPORT bool GetPrevUPoint( double* pdPar, Point3d* pptP, bool bNotFirst = false) const ;
EGK_EXPORT bool GetLastU( double& dPar, bool bNotFirst = false) const
{ return GetLastUPoint( &dPar, nullptr, bNotFirst) ; }
EGK_EXPORT bool GetPrevU( double& dPar, bool bNotFirst = false) const
{ return GetPrevUPoint( &dPar, nullptr, bNotFirst) ; }
EGK_EXPORT bool GetLastPoint( Point3d& ptP, bool bNotFirst = false) const
{ return GetLastUPoint( nullptr, &ptP, bNotFirst) ; }
EGK_EXPORT bool GetPrevPoint( Point3d& ptP, bool bNotFirst = false) const
{ return GetPrevUPoint( nullptr, &ptP, bNotFirst) ; }
EGK_EXPORT bool GetCurrUPoint( double* pdPar, Point3d* pptP) const ;
EGK_EXPORT bool GetCurrU( double& dPar) const
{ return GetCurrUPoint( &dPar, nullptr) ; }
EGK_EXPORT bool GetCurrPoint( Point3d& ptP) const
{ return GetCurrUPoint( nullptr, &ptP) ; }
EGK_EXPORT int GetLineNbr( void) const
{ return ( m_nCount > 1 ? ( m_nCount - 1) : 0) ; }
EGK_EXPORT bool GetFirstULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const ;
EGK_EXPORT bool GetNextULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const ;
EGK_EXPORT bool GetFirstLine( Point3d& ptIni, Point3d& ptFin) const
{ return GetFirstULine( nullptr, &ptIni, nullptr, &ptFin) ; }
EGK_EXPORT bool GetNextLine( Point3d& ptIni, Point3d& ptFin) const
{ return GetNextULine( nullptr, &ptIni, nullptr, &ptFin) ; }
EGK_EXPORT bool GetLastULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const ;
EGK_EXPORT bool GetPrevULine( double* pdIni, Point3d* pptIni, double* pdFin, Point3d* pptFin) const ;
EGK_EXPORT bool GetLastLine( Point3d& ptIni, Point3d& ptFin) const
{ return GetLastULine( nullptr, &ptIni, nullptr, &ptFin) ; }
EGK_EXPORT bool GetPrevLine( Point3d& ptIni, Point3d& ptFin) const
{ return GetPrevULine( nullptr, &ptIni, nullptr, &ptFin) ; }
EGK_EXPORT bool IsFlat( int& nRank, Point3d& ptCen, Vector3d& vtDir, double dToler = EPS_SMALL) const ;
EGK_EXPORT bool IsClosedAndFlat( Plane3d& plPlane, double& dArea, double dToler = EPS_SMALL) const ;
EGK_EXPORT bool GetApproxLength( double& dLen) const ;
EGK_EXPORT bool GetLength( double& dLen) const ;
EGK_EXPORT bool GetAreaXY( double& dArea) const ;
EGK_EXPORT bool GetMaxDistanceFromLine( double& dMaxDist, const Point3d& ptAx,
const Vector3d& vtAx, double dLen, bool bIsSegment = true) const ;
private :
int m_nRejected ;
int m_nCount ;
PNTULIST m_lUPoints ;
mutable PNTULIST::const_iterator m_iter ;
} ;
//----------------------------------------------------------------------------
// Raccolte di PolyLine
typedef std::vector<PolyLine> POLYLINEVECTOR ; // vettore di PolyLine
typedef std::list<PolyLine> POLYLINELIST ; // lista di PolyLine