//---------------------------------------------------------------------------- // EgalTech 2015-2024 //---------------------------------------------------------------------------- // File : EGkSurfFlatRegion.h Data : 18.07.24 Versione : 2.6g5 // Contenuto : Dichiarazione della interfaccia ISurfFlatRegion. // // // // Modifiche : 05.08.15 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include "/EgtDev/Include/EGkSurf.h" #include "/EgtDev/Include/EGkIntersCurves.h" #include "/EgtDev/Include/EgkCurveComposite.h" #include "/EgtDev/Include/EgtPointerOwner.h" class ISurfTriMesh ; //---------------------------------------------------------------------------- class __declspec( novtable) ISurfFlatRegion : public ISurf { public : // IGeoObj ISurfFlatRegion* Clone( void) const override = 0 ; public : virtual bool CopyFrom( const IGeoObj* pGObjSrc) = 0 ; virtual bool Clear( void) = 0 ; virtual bool AddExtLoop( const ICurve& cCrv) = 0 ; virtual bool AddExtLoop( ICurve* pCrv) = 0 ; virtual bool AddIntLoop( const ICurve& cCrv) = 0 ; virtual bool AddIntLoop( ICurve* pCrv) = 0 ; virtual bool Add( const ISurfFlatRegion& Other) = 0 ; virtual bool Subtract( const ISurfFlatRegion& Other) = 0 ; virtual bool Intersect( const ISurfFlatRegion& Other) = 0 ; virtual bool Offset( double dDist, int nType) = 0 ; virtual ISurfFlatRegion* CreateOffsetSurf( double dDist, int nType) const = 0 ; virtual bool GetGrossArea( double& dArea) const = 0 ; virtual const Point3d& GetPlanePoint( void) const = 0 ; virtual const Vector3d& GetNormVersor( void) const = 0 ; virtual bool CalcVoronoiDiagram( ICURVEPOVECTOR& vCrvs, int nBound = 3) const = 0 ; virtual void ResetVoronoiObject( void) const = 0 ; virtual bool GetMaxOffset( double& dOffs) const = 0 ; virtual bool CalcMedialAxis( ICURVEPOVECTOR& vCrvs, int nSide = 1) const = 0 ; virtual const ISurfTriMesh* GetAuxSurf( void) const = 0 ; virtual bool GetCurveClassification( const ICurve& Crv, double dLenMin, CRVCVECTOR& ccClass) const = 0 ; virtual int GetChunkCount( void) const = 0 ; virtual ISurfFlatRegion* CloneChunk( int nChunk) const = 0 ; virtual bool EraseChunk(int nChunk) = 0 ; virtual bool GetChunkCentroid( int nChunk, Point3d& ptCen) const = 0 ; virtual bool GetChunkArea( int nChunk, double& dArea) const = 0 ; virtual bool GetChunkPerimeter( int nChunk, double& dLen) const = 0 ; virtual int GetChunkSimpleClassification( int nChunk, const ISurfFlatRegion& Other, int nOthChunk) const = 0 ; // compare only outsides virtual bool CheckChunkInterference( int nChunk, const ISurfFlatRegion& Other, int nOthChunk, bool& bInterference) const = 0 ; virtual bool GetChunkMaxOffset( int nChunk, double& dOffs) const = 0 ; virtual int GetLoopCount( int nChunk) const = 0 ; virtual int GetLoopCurveCount( int nChunk, int nLoop) const = 0 ; virtual ICurve* GetLoop( int nChunk, int nLoop) const = 0 ; // nChunk 0-based, nLoop 0-based (1°esterno, successivi interni) virtual bool ApproxLoopWithLines( int nChunk, int nLoop, double dLinTol, double dAngTolDeg, int nType, PolyLine& PL) const = 0 ; virtual bool SetCurveTempProp( int nChunk, int nLoop, int nCrv, int nProp, int nPropInd = 0) = 0 ; virtual bool GetCurveTempProp( int nChunk, int nLoop, int nCrv, int& nProp, int nPropInd = 0) const = 0 ; virtual bool ResetAllCurveTempProps( void) = 0 ; virtual bool SetCurveTempParam( int nChunk, int nLoop, int nCrv, double dParam, int nParamInd = 0) = 0 ; virtual bool GetCurveTempParam( int nChunk, int nLoop, int nCrv, double& dParam, int nParamInd = 0) const = 0 ; virtual bool ResetAllCurveTempParams( void) = 0 ; } ; //----------------------------------------------------------------------------- inline ISurfFlatRegion* CreateSurfFlatRegion( void) { return (static_cast( CreateGeoObj( SRF_FLATRGN))) ; } inline ISurfFlatRegion* CloneSurfFlatRegion( const IGeoObj* pGObj) { if ( pGObj == nullptr || pGObj->GetType() != SRF_FLATRGN) return nullptr ; return (static_cast(pGObj->Clone())) ; } inline const ISurfFlatRegion* GetSurfFlatRegion( const IGeoObj* pGObj) { if ( pGObj == nullptr || pGObj->GetType() != SRF_FLATRGN) return nullptr ; return (static_cast(pGObj)) ; } inline ISurfFlatRegion* GetSurfFlatRegion( IGeoObj* pGObj) { if ( pGObj == nullptr || pGObj->GetType() != SRF_FLATRGN) return nullptr ; return (static_cast(pGObj)) ; } //---------------------------------------------------------------------------- // Raccolte di puntatori a ISurfFlatRegion typedef std::vector CISURFFRPVECTOR ; // vettore di puntatori a const ISurfFlatRegion typedef std::vector ISURFFRPVECTOR ; // vettore di puntatori a ISurfFlatRegion typedef std::list ISURFFRPLIST ; // lista di puntatori a ISurfFlatRegion typedef std::vector> ISURFFRPOVECTOR ; // vettore di puntatori esclusivi a ISurfFlatRegion //----------------------------------------------------------------------------- // Costanti per classificazione di regioni const int REGC_NULL = 0 ; //!< Non classificabili const int REGC_IN1 = 1 ; //!< La prima regione č inclusa nella seconda const int REGC_IN2 = 2 ; //!< La seconda regione č inclusa nella prima const int REGC_SAME = 3 ; //!< Le due regioni coincidono const int REGC_OUT = 4 ; //!< Le due regioni sono esterne const int REGC_INTERS = 5 ; //!< Le due regioni si intersecano //----------------------------------------------------------------------------- // Costanti per zona calcolo medial axis della regione const int WMAT_IN_OUT = 0 ; const int WMAT_IN = 1 ; const int WMAT_OUT = 2 ;