diff --git a/EGkFrame3d.h b/EGkFrame3d.h index b3401db..bf6fdcb 100644 --- a/EGkFrame3d.h +++ b/EGkFrame3d.h @@ -37,19 +37,21 @@ class EGK_EXPORT Frame3d bool Set( const Point3d& ptOrig, Type nType) ; bool Reset( void) ; void Translate( const Vector3d& vtMove) ; + bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) ; bool Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dAngRad) ; // Scale non possibile (non previsti fattori di scala) // Mirror non possibile (cambia il senso destrorso in sinistrorso) bool ToGlob( const Frame3d& frRef) ; bool ToLoc( const Frame3d& frRef) ; - inline const Frame3d operator*=( const Frame3d& frRef) { this->ToGlob( frRef) ; return *this ;} - inline const Frame3d operator/=( const Frame3d& frRef) { this->ToLoc( frRef) ; return *this ;} - inline int GetType( void) const { return m_nType ;} - inline int GetZType( void) const { return m_nZType ;} - inline const Point3d& Orig( void) const { return m_ptOrig ;} - inline const Vector3d& VersX( void) const { return m_vtVersX ;} - inline const Vector3d& VersY( void) const { return m_vtVersY ;} - inline const Vector3d& VersZ( void) const { return m_vtVersZ ;} + const Frame3d operator*=( const Frame3d& frRef) { this->ToGlob( frRef) ; return *this ;} + const Frame3d operator/=( const Frame3d& frRef) { this->ToLoc( frRef) ; return *this ;} + int GetType( void) const { return m_nType ;} + int GetZType( void) const { return m_nZType ;} + const Point3d& Orig( void) const { return m_ptOrig ;} + const Vector3d& VersX( void) const { return m_vtVersX ;} + const Vector3d& VersY( void) const { return m_vtVersY ;} + const Vector3d& VersZ( void) const { return m_vtVersZ ;} + bool GetRotationsCAC1( double& dAngC, double& dAngA, double& dAngC1) const ; private : void CalculateType( void) ; @@ -64,6 +66,11 @@ class EGK_EXPORT Frame3d } ; +//---------------------------------------------------------------------------- +// Riferimenti notevoli +//---------------------------------------------------------------------------- +const Frame3d GLOB_FRM ; + //---------------------------------------------------------------------------- // Prodotto di due frame (porta il primo dal secondo nel globale) //---------------------------------------------------------------------------- diff --git a/EGkGdbConst.h b/EGkGdbConst.h new file mode 100644 index 0000000..e3a81f2 --- /dev/null +++ b/EGkGdbConst.h @@ -0,0 +1,25 @@ +//---------------------------------------------------------------------------- +// EgalTech 2013-2013 +//---------------------------------------------------------------------------- +// File : EgkGdbConst.h Data : 04.12.13 Versione : 1.4a3 +// Contenuto : Costanti generali per DB geometrico. +// +// +// +// Modifiche : 04.12.13 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + + +//----------------- Costanti generali ---------------------------------------- +const int GDB_ID_ROOT = 0 ; +const int GDB_ID_NULL = -1 ; + + +//----------------- Costanti tipo nodi del DB geometrico ---------------------- +enum GdbType { GDB_NONE = 0, + GDB_GEO = 1, + GDB_GROUP = 2} ; diff --git a/EGkGdbIterator.h b/EGkGdbIterator.h new file mode 100644 index 0000000..1b05303 --- /dev/null +++ b/EGkGdbIterator.h @@ -0,0 +1,47 @@ +//---------------------------------------------------------------------------- +// EgalTech 2013-2013 +//---------------------------------------------------------------------------- +// File : EGkGdbIterator.h Data : 04.12.13 Versione : 1.4a3 +// Contenuto : Dichiarazione della interfaccia IGdbIterator. +// +// +// +// Modifiche : 04.12.13 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkGeomDB.h" + +//----------------------- 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 _declspec( novtable) IGdbIterator +{ + public : + virtual ~IGdbIterator( void) {} + virtual bool SetGDB( IGeomDB* pGDB) = 0 ; + virtual bool GoTo( int nId) = 0 ; + virtual bool GoToFirstInGroup( int nIdGroup) = 0 ; + virtual bool GoToNext( void) = 0 ; + virtual bool GoToLastInGroup( int nIdGroup) = 0 ; + virtual bool GoToPrev( void) = 0 ; + + virtual GdbType GetGdbType( void) const = 0 ; + virtual IGeoObj* GetGeoObj( void) = 0 ; + virtual Frame3d* GetGroupFrame( void) = 0 ; + virtual bool GetGroupGlobFrame( Frame3d& frGlob) = 0 ; + virtual int GetId( void) = 0 ; + virtual int GetParentId( void) = 0 ; +} ; + +//----------------------------------------------------------------------------- +EGK_EXPORT IGdbIterator* CreateGdbIterator( void) ; \ No newline at end of file diff --git a/EGkGeoFrame3d.h b/EGkGeoFrame3d.h new file mode 100644 index 0000000..fe1e24e --- /dev/null +++ b/EGkGeoFrame3d.h @@ -0,0 +1,46 @@ +//---------------------------------------------------------------------------- +// EgalTech 2013-2013 +//---------------------------------------------------------------------------- +// File : EGkGeoFrame3d.h Data : 02.12.13 Versione : 1.4a3 +// Contenuto : Dichiarazione della interfaccia IGeoFrame3d. +// +// +// +// Modifiche : 02.12.13 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkGeoObj.h" + +//----------------------------------------------------------------------------- +class _declspec( novtable) IGeoFrame3d : public IGeoObj +{ + public : + virtual bool Set( const Point3d& ptOrig, const Vector3d& vtDirX, + const Vector3d& vtDirY, const Vector3d& vtDirZ) = 0 ; + virtual bool Set( const Frame3d& frF) = 0 ; + virtual const Frame3d& GetFrame( void) const = 0 ; +} ; + +//----------------------------------------------------------------------------- +inline IGeoFrame3d* CreateGeoFrame3d( void) + { return (static_cast( CreateGeoObj( GEO_FRAME3D))) ; } +inline IGeoFrame3d* CloneGeoFrame3d( const IGeoObj* pGObj) + { if ( pGObj == nullptr || pGObj->GetType() != GEO_FRAME3D) + return nullptr ; + return (static_cast(pGObj->Clone())) ; } +inline bool CopyGeoFrame3d( const IGeoFrame3d* pGFSou, IGeoFrame3d* pGFDest) + { if ( pGFSou == nullptr || pGFDest == nullptr) + return false ; + return pGFDest->Set( pGFSou->GetFrame()) ; } +inline const IGeoFrame3d* GetGeoFrame3d( const IGeoObj* pGObj) + { if ( pGObj == nullptr || pGObj->GetType() != GEO_FRAME3D) + return nullptr ; + return (static_cast(pGObj)) ; } +inline IGeoFrame3d* GetGeoFrame3d( IGeoObj* pGObj) + { if ( pGObj == nullptr || pGObj->GetType() != GEO_FRAME3D) + return nullptr ; + return (static_cast(pGObj)) ; } diff --git a/EGkGeoObjType.h b/EGkGeoObjType.h index 1e9ebbe..75a7b3c 100644 --- a/EGkGeoObjType.h +++ b/EGkGeoObjType.h @@ -23,6 +23,7 @@ const int GEO_SURF = 0x400 ; enum GeoObjType { GEO_NONE = 0, GEO_VECT3D = ( GEO_ZERODIM + 0), GEO_PNT3D = ( GEO_ZERODIM + 1), + GEO_FRAME3D = ( GEO_ZERODIM + 2), CRV_LINE = ( GEO_CURVE + 0), CRV_ARC = ( GEO_CURVE + 1), CRV_BEZ = ( GEO_CURVE + 2), diff --git a/EGkGeomDB.h b/EGkGeomDB.h index 57ec962..6eef7cc 100644 --- a/EGkGeomDB.h +++ b/EGkGeomDB.h @@ -14,6 +14,7 @@ #pragma once #include +#include "/EgtDev/Include/EGkGdbConst.h" #include "/EgtDev/Include/EGkGeoObj.h" //----------------------- Macro per import/export ---------------------------- @@ -34,11 +35,14 @@ class _declspec( novtable) IGeomDB virtual bool Load( std::ifstream& osIn) = 0 ; virtual bool Save( std::ofstream& osOut) const = 0 ; virtual bool ExistsNode( int nId) const = 0 ; - virtual bool AddGroup( int nId, int nParentId) = 0 ; - virtual bool AddGeoObj( int nId, int nParentId, IGeoObj* pGeoObj) = 0 ; - virtual GeoObjType GetObjType( int nId) const = 0 ; + virtual int AddGroup( int nId, int nParentId, const Frame3d& frFrame) = 0 ; + virtual int AddGeoObj( int nId, int nParentId, IGeoObj* pGeoObj) = 0 ; + virtual GdbType GetGdbType( int nId) const = 0 ; virtual IGeoObj* GetGeoObj( int nId) = 0 ; - virtual bool Copy(int nIdSou, int nIdDest, int nParentIdDest) = 0 ; + virtual Frame3d* GetGroupFrame( int nId) = 0 ; + virtual bool GetGroupGlobFrame( int nId, Frame3d& frGlob) = 0 ; + virtual int GetParentId( int nId) = 0 ; + virtual int Copy( int nIdSou, int nIdDest, int nParentIdDest) = 0 ; virtual bool Erase( int nId) = 0 ; virtual bool Translate( int nId, const Vector3d& vtMove) = 0 ; virtual bool Rotate( int nId, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) = 0 ; diff --git a/EGkVector3d.h b/EGkVector3d.h index f365984..82c6c39 100644 --- a/EGkVector3d.h +++ b/EGkVector3d.h @@ -30,14 +30,14 @@ class Frame3d ; class EGK_EXPORT Vector3d { public : - inline Vector3d( double dX, double dY, double dZ) { x = dX ; y = dY ; z = dZ ;} - inline Vector3d( double dX, double dY) { x = dX ; y = dY ; z = 0 ;} - inline Vector3d( void) { x = 0 ; y = 0 ; z = 0 ;} - inline void Set( double dX, double dY, double dZ) { x = dX ; y = dY ; z = dZ ;} - inline const Vector3d& operator =( const Vector3d& vtSrc) - { if ( &vtSrc != this) { - x = vtSrc.x , y = vtSrc.y , z = vtSrc.z ; } - return *this ; } + Vector3d( double dX, double dY, double dZ) { x = dX ; y = dY ; z = dZ ;} + Vector3d( double dX, double dY) { x = dX ; y = dY ; z = 0 ;} + Vector3d( void) { x = 0 ; y = 0 ; z = 0 ;} + void Set( double dX, double dY, double dZ) { x = dX ; y = dY ; z = dZ ;} + const Vector3d& operator =( const Vector3d& vtSrc) + { if ( &vtSrc != this) { + x = vtSrc.x , y = vtSrc.y , z = vtSrc.z ; } + return *this ; } void FromSpherical( double dLen, double dAngVertDeg, double dAngOrizzDeg) ; void FromPolar( double dLen, double dAngDeg) ; @@ -62,6 +62,7 @@ class EGK_EXPORT Vector3d bool Mirror( const Vector3d& vtNorm) ; bool ToGlob( const Frame3d& frRef) ; bool ToLoc( const Frame3d& frRef) ; + bool GetRotation( const Vector3d& vtEnd, const Vector3d& vtAx, double& dAngDeg, bool& bDet) ; public : double x ; diff --git a/EgtReleasePointer.h b/EgtPointerOwner.h similarity index 66% rename from EgtReleasePointer.h rename to EgtPointerOwner.h index 2daa6aa..16a6886 100644 --- a/EgtReleasePointer.h +++ b/EgtPointerOwner.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- // EgalTech 2013-2013 //---------------------------------------------------------------------------- -// File : EgtReleasePointer.h Data : 25.11.13 Versione : 1.3a1 +// File : EgtPointerOwner.h Data : 04.12.13 Versione : 1.4a3 // Contenuto : Dichiarazione classe template per puntatore con auto rilascio. // // @@ -16,26 +16,26 @@ //---------------------------------------------------------------------------- template -class ReleasePtr +class PtrOwner { public : - explicit ReleasePtr( T* pT) { m_pT = pT ; } - ~ReleasePtr( void) { if ( m_pT != nullptr) delete m_pT ; m_pT = nullptr ; } + explicit PtrOwner( T* pT) { m_pT = pT ; } + ~PtrOwner( void) { if ( m_pT != nullptr) delete m_pT ; m_pT = nullptr ; } T& operator*() const { return *m_pT ; } T* operator->() const { return m_pT ; } private : T* m_pT ; - template friend bool IsValid( ReleasePtr& RPT) ; - template friend T* Get( ReleasePtr& RPT) ; - template friend T* Release( ReleasePtr& RPT) ; + template friend bool IsValid( PtrOwner& RPT) ; + template friend T* Get( PtrOwner& RPT) ; + template friend T* Release( PtrOwner& RPT) ; } ; //---------------------------------------------------------------------------- template bool -IsValid( ReleasePtr& RPT) +IsValid( PtrOwner& RPT) { return ( RPT.m_pT != nullptr) ; } @@ -43,7 +43,7 @@ IsValid( ReleasePtr& RPT) //---------------------------------------------------------------------------- template T* -Get( ReleasePtr& RPT) +Get( PtrOwner& RPT) { return RPT.m_pT ; } @@ -51,7 +51,7 @@ Get( ReleasePtr& RPT) //---------------------------------------------------------------------------- template T* -Release( ReleasePtr& RPT) +Release( PtrOwner& RPT) { T* pT = RPT.m_pT ; RPT.m_pT = nullptr ;