de9e442be8
- modifiche alla chiamata di ModifyJoint. - cambio nome alla ModifySingleCurve.
133 lines
7.9 KiB
C++
133 lines
7.9 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2013-2022
|
|
//----------------------------------------------------------------------------
|
|
// File : EGkCurveComposite.h Data : 24.03.22 Versione : 2.4c2
|
|
// Contenuto : Dichiarazione della interfaccia ICurveComposite.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 22.11.13 DS Creazione modulo.
|
|
// 21.07.21 LM Aggiunto parametro opzionale a Set/GetCurveTempProp.
|
|
// 23.01.22 DS Aggiunti metodi IsARectangle e IsATrapezoid.
|
|
// 24.03.22 DS Aggiunto metodo AddLineTg.
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "/EgtDev/Include/EGkCurve.h"
|
|
|
|
//----------------------------------------------------------------------------
|
|
class __declspec( novtable) ICurveComposite : public ICurve
|
|
{
|
|
public : // IGeoObj
|
|
ICurveComposite* Clone( void) const override = 0 ;
|
|
public :
|
|
virtual bool CopyFrom( const IGeoObj* pGObjSrc) = 0 ;
|
|
virtual bool Clear( void) = 0 ;
|
|
virtual bool AddCurve( const ICurve& cCrv, bool bEndOrStart = true, double dLinTol = EPS_SMALL) = 0 ;
|
|
virtual bool AddCurve( ICurve* pCrv, bool bEndOrStart = true, double dLinTol = EPS_SMALL) = 0 ;
|
|
virtual bool Close( void) = 0 ;
|
|
virtual bool FromSplit( const ICurve& cCrv, int nParts) = 0 ;
|
|
virtual bool FromPolyLine( const PolyLine& PL) = 0 ;
|
|
virtual bool FromPolyArc( const PolyArc& PA) = 0 ;
|
|
virtual bool PolygonCenterCorner( int nSides, const Point3d& ptCen, const Point3d& ptCorner, const Vector3d& vtN) = 0 ;
|
|
virtual bool PolygonCenterMidSide( int nSides, const Point3d& ptCen, const Point3d& ptMidSide, const Vector3d& vtN) = 0 ;
|
|
virtual bool PolygonSide( int nSides, const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtN) = 0 ;
|
|
virtual int GetCurveCount( void) const = 0 ;
|
|
virtual const ICurve* GetCurve( int nCrv) const = 0 ;
|
|
virtual const ICurve* GetFirstCurve( void) const = 0 ;
|
|
virtual const ICurve* GetNextCurve( void) const = 0 ;
|
|
virtual const ICurve* GetLastCurve( void) const = 0 ;
|
|
virtual const ICurve* GetPrevCurve( void) const = 0 ;
|
|
virtual bool IsParamAtJoint( double dU) const = 0 ;
|
|
virtual ICurve* RemoveFirstOrLastCurve( bool bLast = true) = 0 ;
|
|
virtual bool ChangeStartPoint( double dU) = 0 ;
|
|
virtual bool AddPoint( const Point3d& ptStart) = 0 ;
|
|
virtual bool AddLine( const Point3d& ptNew, bool bEndOrStart = true) = 0 ;
|
|
virtual bool AddLineTg( double dLen, bool bEndOrStart = true) = 0 ;
|
|
virtual bool AddArc2P( const Point3d& ptOther, const Point3d& ptNew, bool bEndOrStart = true) = 0 ;
|
|
virtual bool AddArcTg( const Point3d& ptNew, bool bEndOrStart = true) = 0 ;
|
|
virtual bool AddJoint( double dU) = 0 ;
|
|
virtual bool ModifyJoint( int nU, const Point3d& ptNewJoint) = 0 ;
|
|
virtual bool ModifyJoint( int nU, const Point3d& ptNewJoint, double dTol) = 0 ;
|
|
virtual bool RemoveJoint( int nU) = 0 ;
|
|
virtual bool MoveCurve( int nCrv, const Vector3d& vtMove) = 0 ;
|
|
virtual bool ModifyCurveToArc( int nCrv, const Point3d& ptMid) = 0 ;
|
|
virtual bool ModifyCurveToLine( int nCrv) = 0 ;
|
|
virtual bool ArcsToBezierCurves( void) = 0 ;
|
|
virtual bool ArcsBezierCurvesToArcsPerpExtr( double dLinTol, double dAngTolDeg) = 0 ;
|
|
virtual bool StraightArcsToLines( double dLinTol, double dAngTolDeg) = 0 ;
|
|
virtual bool MergeCurves( double dLinTol, double dAngTolDeg, bool bStartEnd = true, bool bNeedSameProp = false) = 0 ;
|
|
virtual bool RemoveSmallParts( double dLinTol, double dAngTolDeg) = 0 ;
|
|
virtual bool RemoveSmallDefects( double dLinTol, double dAngTolDeg, bool bAlsoSpikes = false) = 0 ;
|
|
virtual bool RemoveUndercutOnY( double dLinTol, double dAngTolDeg) = 0 ;
|
|
virtual bool IsAPoint( void) const = 0 ;
|
|
virtual bool IsALine( double dLinTol, Point3d& ptStart, Point3d& ptEnd) const = 0 ;
|
|
virtual bool IsACircle( double dLinTol, Point3d& ptCen, Vector3d& vtN, double& dRad, bool& bCCW) const = 0 ;
|
|
virtual bool IsARectangle( double dLinTol, Point3d& ptP, Vector3d& vtL1, Vector3d& vtL2) const = 0 ;
|
|
virtual bool IsATrapezoid( double dLinTol, Point3d& ptP, Vector3d& vtB1, Vector3d& vtL1, Vector3d& vtB2) const = 0 ;
|
|
virtual bool SetCurveTempProp( int nCrv, int nProp, int nPropInd = 0) = 0 ;
|
|
virtual bool GetCurveTempProp( int nCrv, int& nProp, int nPropInd = 0) const = 0 ;
|
|
virtual bool SetCurveTempParam( int nCrv, double dParam, int nParamInd = 0) = 0 ;
|
|
virtual bool GetCurveTempParam( int nCrv, double& dParam, int nParamInd = 0) const = 0 ;
|
|
virtual bool GetOnlyPoint( Point3d& ptStart) const = 0 ;
|
|
virtual bool ReplaceSingleCurve( int nSubCrv, ICurve* pNewCurve, double dTolStartEnd, double dTolAlong = INFINITO) = 0 ;
|
|
} ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
inline ICurveComposite* CreateCurveComposite( void)
|
|
{ return (static_cast<ICurveComposite*>( CreateGeoObj( CRV_COMPO))) ; }
|
|
inline ICurveComposite* CloneCurveComposite( const IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != CRV_COMPO)
|
|
return nullptr ;
|
|
return (static_cast<ICurveComposite*>(pGObj->Clone())) ; }
|
|
inline const ICurveComposite* GetCurveComposite( const IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != CRV_COMPO)
|
|
return nullptr ;
|
|
return (static_cast<const ICurveComposite*>(pGObj)) ; }
|
|
inline ICurveComposite* GetCurveComposite( IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != CRV_COMPO)
|
|
return nullptr ;
|
|
return (static_cast<ICurveComposite*>(pGObj)) ; }
|
|
inline ICurveComposite* ConvertCurveToComposite( IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || ( pGObj->GetType() & GEO_CURVE) == 0) {
|
|
delete pGObj ;
|
|
return nullptr ;
|
|
}
|
|
ICurveComposite* pCrvCo = GetCurveComposite( pGObj) ;
|
|
if ( pCrvCo != nullptr) {
|
|
return pCrvCo ;
|
|
}
|
|
else {
|
|
pCrvCo = CreateCurveComposite() ;
|
|
if ( pCrvCo == nullptr) {
|
|
delete pGObj ;
|
|
return nullptr ;
|
|
}
|
|
}
|
|
ICurve* pCrv = static_cast<ICurve*>( pGObj) ;
|
|
Vector3d vtExtr ;
|
|
if ( pCrv->GetExtrusion( vtExtr) && ! vtExtr.IsSmall())
|
|
pCrvCo->SetExtrusion( vtExtr) ;
|
|
double dThick ;
|
|
if ( pCrv->GetThickness( dThick) && abs( dThick) > EPS_SMALL)
|
|
pCrvCo->SetThickness( dThick) ;
|
|
for ( int i = 0 ; i < 2 ; ++ i) {
|
|
int nProp = pCrv->GetTempProp( i) ;
|
|
if ( nProp != 0)
|
|
pCrvCo->SetTempProp( nProp, i) ;
|
|
double dParam = pCrv->GetTempParam( i) ;
|
|
pCrvCo->SetTempParam( dParam, i) ;
|
|
}
|
|
pCrvCo->AddCurve( pCrv) ;
|
|
return pCrvCo ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Raccolte di puntatori a ICurveComposite
|
|
typedef std::vector<const ICurveComposite*> CICRVCOMPOVECTOR ; // vettore di puntatori a const ICurveComposite
|
|
typedef std::vector<ICurveComposite*> ICRVCOMPOPVECTOR ; // vettore di puntatori a ICurveComposite
|
|
typedef std::list<ICurveComposite*> ICRVCOMPOPLIST ; // lista di puntatori a ICurveComposite
|
|
typedef std::vector<PtrOwner<ICurveComposite>> ICRVCOMPOPOVECTOR ; // vettore di puntatori esclusivi a ICurveComposite
|