d21f27ae2d
- migliorie a Zmap.
135 lines
6.7 KiB
C++
135 lines
6.7 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : VolZmap.h Data : 22.01.15 Versione : 1.6a4
|
|
// Contenuto : Dichiarazione della classe Volume Zmap.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 22.01.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "ObjGraphicsMgr.h"
|
|
#include "DllMain.h"
|
|
#include "GeoObjRW.h"
|
|
#include "/EgtDev/Include/EGkVolZmap.h"
|
|
#include "/EgtDev/Include/EGkPoint3d.h"
|
|
#include "/EgtDev/Include/EGkVector3d.h"
|
|
#include "CurveComposite.h"
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
class VolZmap : public IVolZmap, public IGeoObjRW
|
|
{
|
|
public : // IGeoObj
|
|
virtual ~VolZmap( void) ;
|
|
virtual VolZmap* 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, bool bMM = true, const char* szNewLine = "\n") const ;
|
|
virtual bool GetLocalBBox( BBox3d& b3Loc, int nFlag = BBF_STANDARD) const ;
|
|
virtual bool GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag = BBF_STANDARD) const ;
|
|
virtual bool Translate( const Vector3d& vtMove) ;
|
|
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg)
|
|
{ double dAngRad = dAngDeg * DEGTORAD ;
|
|
return Rotate( ptAx, vtAx, cos( dAngRad), sin( dAngRad)) ; }
|
|
virtual bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ;
|
|
virtual bool Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
|
|
virtual bool Mirror( const Point3d& ptOn, const Vector3d& vtNorm) ;
|
|
virtual bool Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& vtDir, double dCoeff) ;
|
|
virtual bool ToGlob( const Frame3d& frRef) ;
|
|
virtual bool ToLoc( const Frame3d& frRef) ;
|
|
virtual bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) ;
|
|
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() ; }
|
|
virtual void SetTempProp( int nProp)
|
|
{ m_nTempProp = nProp ; }
|
|
virtual int GetTempProp( void)
|
|
{ return m_nTempProp ; }
|
|
|
|
public : // IVolZmap
|
|
virtual bool CopyFrom( const IGeoObj* pGObjSrc) ;
|
|
virtual bool GetAllTriangles( TRIA3DLIST& lstTria) const ;
|
|
virtual bool GetDexelLines( int nDir, int nPos1, int nPos2, POLYLINELIST& lstPL) const ;
|
|
bool CreateMap( const Point3d& ptO, double dPrec, double dLengthX, double dLengthY, double dLengthZ) ;
|
|
bool SubtractIntervals( unsigned int nI, unsigned int nJ, double dMin, double dMax) ;
|
|
bool SubtractIntervals( const Point3d& ptP, double dMin, double dMax) ;
|
|
bool AddIntervals( unsigned int nI, unsigned int nJ, double dMin, double dMax) ;
|
|
bool AddIntervals( const Point3d& ptP, double dMin, double dMax) ;
|
|
bool SetTool( const std::string& pToolName, unsigned int nToolType, const CurveComposite* pToolOutline) ;
|
|
bool MillingStep( const Point3d& ptPs, const Point3d& ptPe, const Vector3d& vtDs, const Vector3d& vtDe) ;
|
|
|
|
public : // IGeoObjRW
|
|
virtual int GetNgeId( void) const ;
|
|
virtual bool Save( NgeWriter& ngeOut) const ;
|
|
virtual bool Load( NgeReader& ngeIn) ;
|
|
|
|
public :
|
|
VolZmap( void) ;
|
|
VolZmap( const VolZmap& stSrc)
|
|
{ if ( ! CopyFrom( stSrc))
|
|
LOG_ERROR( GetEGkLogger(), "VolZmap : copy constructor error") }
|
|
VolZmap& operator =( const VolZmap& stSrc)
|
|
{ if ( ! CopyFrom( stSrc))
|
|
LOG_ERROR( GetEGkLogger(), "VolZmap : copy error")
|
|
return *this ; }
|
|
|
|
private :
|
|
bool CopyFrom( const VolZmap& clSrc) ;
|
|
bool GetChunkPrisms( int nPos1, int nPos2, int nDim1, int nDim2, TRIA3DLIST& lstTria) const ;
|
|
bool CalcChunkPrisms( int nPos1, int nPos2, int nDim1, int nDim2, TRIA3DLIST& lstTria) const ;
|
|
bool CalcDexelPrisms( int nPos1, int nPos2, TRIA3DLIST& lstTria) const ;
|
|
bool AddDexelSideFace( int nPos, int nPosAdj, const Point3d& ptP, const Point3d& ptQ,
|
|
const Vector3d& vtZ, const Vector3d& vtNorm, TRIA3DLIST& lstTria) const ;
|
|
bool MillingDrill( const Point3d& ptLs, const Point3d& ptLe, double dHeight, double dRadius) ;
|
|
bool MillingPerp( Point3d& ptPs, Point3d& ptPe, double dHeight, double dRadius) ;
|
|
|
|
private :
|
|
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
|
|
|
private :
|
|
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
|
Status m_nStatus ; // stato
|
|
int m_nTempProp ; // proprietà temporanea
|
|
|
|
Frame3d m_LocalFrame ;//////FORSE E' MEGLIO CHIAMARLO INTRINSECO? E IN VISTA DEGLI ALTRI FORSE E' BENE AGGIUNGERE UN IDENTIFICATIVO?
|
|
double m_dStep ;
|
|
unsigned int m_nNx ; // i = 0, 1, ..., m_nNx - 1
|
|
unsigned int m_nNy ; // j = 0, 1, ..., m_nNy - 1
|
|
unsigned int m_nDim ;
|
|
std::vector <std::vector<double>> m_ZValues ;
|
|
|
|
CurveComposite m_ToolOutline ;
|
|
std::string m_sToolName ;
|
|
unsigned int m_nToolType ; // 0, 1, 2 per cylindrical mill, fresa ball-end, bull nose
|
|
} ;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
inline VolZmap* CreateBasicVolZmap( void)
|
|
{ return (static_cast<VolZmap*>( CreateGeoObj( VOL_ZMAP))) ; }
|
|
inline VolZmap* CloneBasicVolZmap( const IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != VOL_ZMAP)
|
|
return nullptr ;
|
|
return (static_cast<VolZmap*>(pGObj->Clone())) ; }
|
|
inline const VolZmap* GetBasicVolZmap( const IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != VOL_ZMAP)
|
|
return nullptr ;
|
|
return (static_cast<const VolZmap*>(pGObj)) ; }
|
|
inline VolZmap* GetBasicVolZmap( IGeoObj* pGObj)
|
|
{ if ( pGObj == nullptr || pGObj->GetType() != VOL_ZMAP)
|
|
return nullptr ;
|
|
return (static_cast<VolZmap*>(pGObj)) ; }
|