From a75ded90feaf8a9be22f5939bb545eccb2b2d96e Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sat, 6 Jun 2015 17:57:02 +0000 Subject: [PATCH] Include : - aggiunto EgtUUID e Writer - Scan diventato Scanner. --- EGkCurve.h | 1 + EGnEgtUUID.h | 56 +++++++++++++++++++++++++++++++++++++++ EGnFileUtils.h | 2 ++ EGnScan.h => EGnScanner.h | 4 +-- EGnWriter.h | 42 +++++++++++++++++++++++++++++ EInAPI.h | 4 ++- EXeExecutor.h | 4 ++- 7 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 EGnEgtUUID.h rename EGnScan.h => EGnScanner.h (90%) create mode 100644 EGnWriter.h diff --git a/EGkCurve.h b/EGkCurve.h index 30362d8..48e4d37 100644 --- a/EGkCurve.h +++ b/EGkCurve.h @@ -64,6 +64,7 @@ class __declspec( novtable) ICurve : public IGeoObj virtual bool IsPointOn( const Point3d& ptP, double dTol = EPS_SMALL) const = 0 ; virtual bool GetParamAtPoint( const Point3d& ptP, double& dPar, double dTol = EPS_SMALL) const = 0 ; virtual bool GetLengthAtPoint( const Point3d& ptP, double& dLen, double dTol = EPS_SMALL) const = 0 ; + virtual bool GetNearestExtremityToPoint( const Point3d& ptP, bool& bStart) const = 0 ; virtual bool GetAreaXY( double& dArea) const = 0 ; virtual bool ApproxWithLines( double dLinTol, double dAngTolDeg, PolyLine& PL) const = 0 ; virtual bool ApproxWithArcs( double dLinTol, double dAngTolDeg, PolyArc& PA) const = 0 ; diff --git a/EGnEgtUUID.h b/EGnEgtUUID.h new file mode 100644 index 0000000..95352a8 --- /dev/null +++ b/EGnEgtUUID.h @@ -0,0 +1,56 @@ +//---------------------------------------------------------------------------- +// EgalTech 2015-2015 +//---------------------------------------------------------------------------- +// File : EGnEgtUUID.h Data : 01.06.15 Versione : 1.6f1 +// Contenuto : Dichiarazione struttura EgtUUID e sue funzioni. +// +// +// +// Modifiche : 01.06.15 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include + +//----------------------- Macro per import/export ---------------------------- +#undef EGN_EXPORT +#if defined( I_AM_EGN) // da definirsi solo nella DLL + #define EGN_EXPORT __declspec( dllexport) +#else + #define EGN_EXPORT __declspec( dllimport) +#endif + +//---------------------------------------------------------------------------- +struct EgtUUID { + unsigned int Data1 ; + unsigned short Data2 ; + unsigned short Data3 ; + unsigned char Data4[8] ; + EgtUUID( void) + { Data1 = 0 ; Data2 = 0; Data3 = 0 ; memset( Data4, 0, 8) ; } + bool operator ==( const EgtUUID& other) const + { return ( Data1 == other.Data1 && Data2 == other.Data2 && Data3 == other.Data3 && + memcmp( Data4, other.Data4, 8) == 0) ; } + bool operator !=( const EgtUUID& other) const + { return ! operator ==( other) ; } +} ; + +//---------------------------------------------------------------------------- +EGN_EXPORT std::string ToString( const EgtUUID& uuId) ; +EGN_EXPORT bool FromString( const std::string& sVal, EgtUUID& uuId) ; + +//---------------------------------------------------------------------------- +namespace std { + template <> + struct hash + { + typedef EgtUUID argument_type ; + typedef std::size_t result_type ; + std::size_t operator()( EgtUUID key) const { + return ( key.Data1 + key.Data2 + key.Data3 + key.Data4[0] + key.Data4[7]) ; + } + }; +} diff --git a/EGnFileUtils.h b/EGnFileUtils.h index 3e4ed41..59d822a 100644 --- a/EGnFileUtils.h +++ b/EGnFileUtils.h @@ -26,6 +26,8 @@ //----------------------------------------------------------------------------- EGN_EXPORT bool ExistsFile( const std::string& sFile) ; +EGN_EXPORT bool CopyFileEgt( const std::string& sFile, const std::string& sNewFile) ; +EGN_EXPORT bool RenameFile( const std::string& sFile, const std::string& sNewFile) ; EGN_EXPORT bool EraseFile( const std::string& sFile) ; EGN_EXPORT std::string ChangeFileExtension( const std::string& sFile, const std::string& sNewExt) ; EGN_EXPORT bool FileExtensionMatches( const std::string& sFile, const std::string& sExt) ; diff --git a/EGnScan.h b/EGnScanner.h similarity index 90% rename from EGnScan.h rename to EGnScanner.h index 5cb42a2..fe57be1 100644 --- a/EGnScan.h +++ b/EGnScanner.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- // EgalTech 2013-2014 //---------------------------------------------------------------------------- -// File : EgnScan.h Data : 06.03.14 Versione : 1.5c1 +// File : EgnScanner.h Data : 06.03.14 Versione : 1.5c1 // Contenuto : Dichiarazione della classe CScan. // // @@ -33,7 +33,7 @@ class Scanner : m_InFile( nullptr), m_bSkipEmptyLine( true), m_nLineNbr( 0), m_bUnget( false), m_nDeltaLineUnget(0) {} EGN_EXPORT ~Scanner( void) { Terminate() ; } - EGN_EXPORT bool Init( const std::string& sCmdFile, + EGN_EXPORT bool Init( const std::string& sFile, const char* szRemInit = "//", bool bSkipEmptyLine = true) ; EGN_EXPORT bool Terminate( void) ; EGN_EXPORT bool GetLine( std::string& sLine) ; diff --git a/EGnWriter.h b/EGnWriter.h new file mode 100644 index 0000000..0097f95 --- /dev/null +++ b/EGnWriter.h @@ -0,0 +1,42 @@ +//---------------------------------------------------------------------------- +// EgalTech 2015-2015 +//---------------------------------------------------------------------------- +// File : EgnWriter.h Data : 02.06.15 Versione : 1.6f1 +// Contenuto : Dichiarazione della classe Writer. +// +// +// +// Modifiche : 02.06.15 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include + +struct gzFile_s ; + +//----------------------- Macro per import/export ----------------------------- +#undef EGN_EXPORT +#if defined( I_AM_EGN) // da definirsi solo nella DLL + #define EGN_EXPORT __declspec( dllexport) +#else + #define EGN_EXPORT __declspec( dllimport) +#endif + +//---------------------------------------------------------------------------- +class Writer +{ + public : + EGN_EXPORT Writer( void) + : m_OutFile( nullptr) {} + EGN_EXPORT ~Writer( void) + { Close() ; } + EGN_EXPORT bool Init( const std::string& sFile, bool bCompressed = false) ; + EGN_EXPORT bool Close( void) ; + EGN_EXPORT bool OutText( const std::string& sText, bool bEndL = true) ; + + private : + gzFile_s* m_OutFile ; +} ; diff --git a/EInAPI.h b/EInAPI.h index f0329ad..c6c269e 100644 --- a/EInAPI.h +++ b/EInAPI.h @@ -347,11 +347,13 @@ EIN_EXPORT BOOL __stdcall EgtMidVector( int nId, int nRefId, double vtV[3]) ; EIN_EXPORT BOOL __stdcall EgtAtParamVector( int nId, double dU, int nSide, int nRefId, double vtV[3]) ; EIN_EXPORT BOOL __stdcall EgtFrame( int nId, int nRefId, double ptOrig[3], double vtX[3], double vtY[3], double vtZ[3]) ; +EIN_EXPORT BOOL __stdcall EgtCurveDomain( int nId, double* pdStart, double* pdEnd) ; EIN_EXPORT BOOL __stdcall EgtCurveLength( int nId, double* pdLen) ; EIN_EXPORT BOOL __stdcall EgtCurveLengthAtPoint( int nId, const double ptOn[3], double dExtend, double* pdLen) ; +EIN_EXPORT BOOL __stdcall EgtCurveNearestExtremityToPoint( int nId, const double ptP[3], BOOL* pbStart) ; EIN_EXPORT BOOL __stdcall EgtCurveExtrusion( int nId, int nRefId, double vtExtr[3]) ; EIN_EXPORT BOOL __stdcall EgtCurveThickness( int nId, double* pdThick) ; -EIN_EXPORT BOOL __stdcall EgtGetMinDistPointCurve( const double ptP[3], int nId, double* pdDist) ; +EIN_EXPORT BOOL __stdcall EgtGetMinDistPointCurve( const double ptP[3], int nId, double* pdDist, double* pdU) ; EIN_EXPORT BOOL __stdcall EgtGetMinDistPntSidePointCurve( const double ptP[3], int nId, const double vtN[3], double* pdDist, double ptMin[3], int* pnSide) ; EIN_EXPORT BOOL __stdcall EgtCurveArcRadius( int nId, double* pdRad) ; diff --git a/EXeExecutor.h b/EXeExecutor.h index d196814..4c3ae5e 100644 --- a/EXeExecutor.h +++ b/EXeExecutor.h @@ -342,11 +342,13 @@ EXE_EXPORT bool ExeEndVector( int nId, int nRefId, Vector3d& vtV) ; EXE_EXPORT bool ExeMidVector( int nId, int nRefId, Vector3d& vtV) ; EXE_EXPORT bool ExeAtParamVector( int nId, double dU, int nSide, int nRefId, Vector3d& vtV) ; EXE_EXPORT bool ExeFrame( int nId, int nRefId, Frame3d& frFrame) ; +EXE_EXPORT bool ExeCurveDomain( int nId, double* pdStart, double* pdEnd) ; EXE_EXPORT bool ExeCurveLength( int nId, double* pdLen) ; EXE_EXPORT bool ExeCurveLengthAtPoint( int nId, const Point3d& ptOn, double dExtend, double* pdLen) ; +EXE_EXPORT bool ExeCurveNearestExtremityToPoint( int nId, const Point3d& ptP, bool& bStart) ; EXE_EXPORT bool ExeCurveExtrusion( int nId, int nRefId, Vector3d& vtExtr) ; EXE_EXPORT bool ExeCurveThickness( int nId, double* pdThick) ; -EXE_EXPORT bool ExeGetMinDistPointCurve( const Point3d& ptP, int nId, double* pdDist) ; +EXE_EXPORT bool ExeGetMinDistPointCurve( const Point3d& ptP, int nId, double* pdDist, double* pdU) ; EXE_EXPORT bool ExeGetMinDistPntSidePointCurve( const Point3d& ptP, int nId, const Vector3d& vtN, double* pdDist, Point3d& ptMin, int* pnSide) ; EXE_EXPORT bool ExeCurveArcRadius( int nId, double* pdRad) ;