//---------------------------------------------------------------------------- // EgalTech 2013-2013 //---------------------------------------------------------------------------- // File : CurveComposite.h Data : 23.11.13 Versione : 1.3a1 // Contenuto : Dichiarazione della classe Curva composita. // // // // Modifiche : 16.04.13 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include "ObjGraphicsMgr.h" #include "CurveAux.h" #include "DllMain.h" #include "GeoObjRW.h" #include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EgtLogger.h" #include //---------------------------------------------------------------------------- class CurveComposite : public ICurveComposite, public IGeoObjRW { public : // IGeoObj virtual ~CurveComposite( void) ; virtual CurveComposite* Clone( void) const ; virtual GeoObjType GetType( void) const ; virtual bool IsValid( void) const { return ( m_nStatus == OK) ; } virtual const std::string& GetTitle( void) const ; virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const ; virtual bool GetLocalBBox( BBox3d& b3Loc) const ; virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const ; virtual bool Translate( const Vector3d& vtMove) ; virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ; virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) { return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; } virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ; virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ; virtual bool ToGlob( const Frame3d& frRef) ; virtual bool ToLoc( const Frame3d& frRef) ; virtual void SetObjGraphics( IObjGraphics* pOGr) { m_OGrMgr.SetObjGraphics( pOGr) ; } virtual IObjGraphics* GetObjGraphics( void) { return m_OGrMgr.GetObjGraphics() ; } virtual const IObjGraphics* GetObjGraphics( void) const { return m_OGrMgr.GetObjGraphics() ; } public : // ICurve virtual bool IsSimple( void) const { return false ; } virtual bool IsClosed( void) const { return ::IsClosed( *this) ; } virtual bool GetStartPoint( Point3d& ptStart) const ; virtual bool GetEndPoint( Point3d& ptEnd) const ; virtual bool GetDomain( double& dStart, double& dEnd) const ; virtual bool GetLength( double& dLen) const ; virtual bool GetPointD1D2( double dU, Side nS, Point3d& ptPos, Vector3d* pvtDer1 = nullptr, Vector3d* pvtDer2 = nullptr) const ; virtual bool GetPointTang( double dU, Side nS, Point3d& ptPos, Vector3d& vtTang) const { return ::GetPointTang( *this, dU, nS, ptPos, vtTang) ; } virtual bool GetPointDiffGeom( double dU, Side nS, CrvPointDiffGeom& oDiffG) const { oDiffG.nFlag = ( IsParamAtJoint( dU) ? CrvPointDiffGeom::TO_VERIFY : CrvPointDiffGeom::STD) ; return ::GetPointDiffGeom( *this, dU, nS, oDiffG) ; } virtual bool Invert( void) ; virtual bool ApproxWithLines( double dLinTol, double dAngTolDeg, PolyLine& PL) const ; virtual bool TrimStartAtParam( double dUTrim) ; virtual bool TrimEndAtParam( double dUTrim) ; virtual bool TrimStartAtLen( double dLenTrim) ; virtual bool TrimEndAtLen( double dLenTrim) ; public : // ICurveComposite virtual bool Copy( const IGeoObj* pGObjSrc) ; virtual bool Clear( void) ; virtual bool AddCurve( const ICurve& cCrv) ; virtual bool FromSplit( const ICurve& cCrv, int nParts) ; virtual int GetCurveNumber( void) const { return m_nCounter ; } virtual const ICurve* GetFirstCurve( void) const ; virtual const ICurve* GetNextCurve( void) const ; virtual bool IsParamAtJoint( double dU) const ; virtual bool ArcsToBezierCurves( void) ; public : // IGeoObjRW virtual int GetNgeId( void) const ; virtual bool Save( NgeWriter& ngeOut) const ; virtual bool Load( NgeReader& ngeIn) ; public : CurveComposite( void) ; const CurveComposite& operator =( const CurveComposite& ccSrc) { if ( ! Copy( ccSrc)) LOG_ERROR( GetEGkLogger(), "CurveComposite : copy error") return *this ; } private : bool Copy( const CurveComposite& ccSrc) ; bool Validate( void) ; bool AddSimpleCurve( ICurve* pSmplCrv) ; private : enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ; private : typedef std::list< ICurve*> PCRVSMPL_LIST ; private : ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto Status m_nStatus ; // stato int m_nCounter ; // contatore del numero di curve PCRVSMPL_LIST m_CrvSmplS ; // lista di curve semplici Point3d m_PtStart ; // punto iniziale Point3d m_PtEnd ; // punto finale bool m_bClosed ; // flag per indicare che la curva è chiusa PCRVSMPL_LIST::const_iterator m_Iter ; // iteratore } ;