From 253fda33f3063e8554c228cf1f347d9dc7a1fbe1 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 25 Feb 2014 16:41:46 +0000 Subject: [PATCH] Include : - modifiche a ICmdParser - aggiunta classe Color. --- EGkColor.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ EGnDllMain.h | 4 +++ EGrSceExecutor.h | 2 +- EGrScene.h | 2 ++ EgkGdbExecutor.h | 2 +- EgnCmdExecutor.h | 5 +++- EgnCmdParser.h | 15 +++++++---- 7 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 EGkColor.h diff --git a/EGkColor.h b/EGkColor.h new file mode 100644 index 0000000..17bfdd4 --- /dev/null +++ b/EGkColor.h @@ -0,0 +1,67 @@ +//---------------------------------------------------------------------------- +// EgalTech 2014-2014 +//---------------------------------------------------------------------------- +// File : EGkColor.h Data : 24.02.14 Versione : 1.5b6 +// Contenuto : Implementazione della classe Color. +// +// +// +// Modifiche : 24.02.14 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include + +//----------------------------------------------------------------------------- +class Color +{ + public : + Color( void) + { m_Col[RED] = 0 ; m_Col[GREEN] = 0 ; m_Col[BLUE] = 0 ; m_Col[ALPHA] = 0 ; } + Color( int nRed, int nGreen, int nBlue, int nAlpha = MAX_ALPHA) + { Set( nRed, nGreen, nBlue, nAlpha) ; } + Color( double dRed, double dGreen, double dBlue, double dAlpha = 1) + { Set( dRed, dGreen, dBlue, dAlpha) ; } + void Set( int nRed, int nGreen, int nBlue, int nAlpha = MAX_ALPHA) + { m_Col[RED] = (( nRed < 0) ? 0 : (( nRed > MAX_RGB) ? MAX_RGB : nRed)) ; + m_Col[GREEN] = (( nGreen < 0) ? 0 : (( nGreen > MAX_RGB) ? MAX_RGB : nGreen)) ; + m_Col[BLUE] = (( nBlue < 0) ? 0 : (( nBlue > MAX_RGB) ? MAX_RGB : nBlue)) ; + m_Col[ALPHA] = (( nAlpha < 0) ? 0 : (( nAlpha > MAX_ALPHA) ? MAX_ALPHA : nAlpha)) ; } + void Set( double dRed, double dGreen, double dBlue, double dAlpha = 1) + { m_Col[RED] = (( dRed < 0) ? 0 : (( dRed > 1) ? MAX_RGB : int( dRed * MAX_RGB))) ; + m_Col[GREEN] = (( dGreen < 0) ? 0 : (( dGreen > 1) ? MAX_RGB : int( dGreen * MAX_RGB))) ; + m_Col[BLUE] = (( dBlue < 0) ? 0 : (( dBlue > 1) ? MAX_RGB : int( dBlue * MAX_RGB))) ; + m_Col[ALPHA] = (( dAlpha < 0) ? 0 : (( dAlpha > 1) ? MAX_ALPHA : int( dAlpha * MAX_ALPHA))) ; } + int GetIntRed( void) + { return m_Col[RED] ; } + int GetIntGreen( void) + { return m_Col[GREEN] ; } + int GetIntBlue( void) + { return m_Col[BLUE] ; } + int GetIntAlpha( void) + { return m_Col[ALPHA] ; } + float GetRed( void) + { return ( (float) m_Col[RED] / MAX_RGB) ; } + float GetGreen( void) + { return ( (float) m_Col[GREEN] / MAX_RGB) ; } + float GetBlue( void) + { return ( (float) m_Col[BLUE] / MAX_RGB) ; } + float GetAlpha( void) + { return ( (float) m_Col[ALPHA] / MAX_ALPHA) ; } + bool operator == ( const Color& other) + { return ( m_Col[RED] == other.m_Col[RED] && + m_Col[GREEN] == other.m_Col[GREEN] && + m_Col[BLUE] == other.m_Col[BLUE] && + m_Col[ALPHA] == other.m_Col[ALPHA]) ; } + + private : + enum { RED = 0, GREEN = 1, BLUE = 2, ALPHA = 3, DIM = 4} ; + static const int MAX_RGB = 255 ; + static const int MAX_ALPHA = 100 ; + + private : + unsigned char m_Col[DIM] ; +} ; diff --git a/EGnDllMain.h b/EGnDllMain.h index 46d3fd7..f54a95c 100644 --- a/EGnDllMain.h +++ b/EGnDllMain.h @@ -13,6 +13,7 @@ #pragma once +class ILogger ; //----------------------- Macro per import/export ---------------------------- #undef EGN_EXPORT @@ -23,4 +24,7 @@ #endif //----------------------------------------------------------------------------- +// restituisce la versione della Dll (stringa del tipo EgtGeneralR32.dll ver. 1.4a5) EGN_EXPORT const char* GetEGnVersion( void) ; +// permette di impostare il logger per la Dll +EGN_EXPORT void SetEGnLogger( ILogger* pLogger) ; diff --git a/EGrSceExecutor.h b/EGrSceExecutor.h index 732f594..f60baed 100644 --- a/EGrSceExecutor.h +++ b/EGrSceExecutor.h @@ -31,7 +31,7 @@ class __declspec( novtable) ISceExecutor : public ICmdExecutor { public : virtual ~ISceExecutor( void) {} - virtual bool Init( IEGrScene* pScene) = 0 ; + virtual bool SetScene( IEGrScene* pScene) = 0 ; } ; //---------------------------------------------------------------------------- diff --git a/EGrScene.h b/EGrScene.h index 085d130..90d5979 100644 --- a/EGrScene.h +++ b/EGrScene.h @@ -16,6 +16,7 @@ //---------------------------------------------------------------------------- #include "/EgtDev/Include/EGkPoint3d.h" #include "/EgtDev/Include/EGkBBox3d.h" +#include "/EgtDev/Include/EGkColor.h" #include #include @@ -45,6 +46,7 @@ class IEGrScene virtual bool RedrawWindow( void) = 0 ; virtual bool SetExtension( const BBox3d& b3Ext) = 0 ; virtual bool Reshape( int nW, int nH) = 0 ; + virtual bool SetBackground( Color BackTop, Color BackBottom) = 0 ; virtual bool Prepare( void) = 0 ; virtual bool Draw( void) = 0 ; virtual bool Project( const Point3d& ptWorld, Point3d& ptView) = 0 ; diff --git a/EgkGdbExecutor.h b/EgkGdbExecutor.h index 97b6194..e711146 100644 --- a/EgkGdbExecutor.h +++ b/EgkGdbExecutor.h @@ -30,7 +30,7 @@ class __declspec( novtable) IGdbExecutor : public ICmdExecutor { public : virtual ~IGdbExecutor( void) {} - virtual bool Init( IGeomDB* pGdb) = 0 ; + virtual bool SetGeomDB( IGeomDB* pGdb) = 0 ; } ; //---------------------------------------------------------------------------- diff --git a/EgnCmdExecutor.h b/EgnCmdExecutor.h index 9f3b216..ad70f5f 100644 --- a/EgnCmdExecutor.h +++ b/EgnCmdExecutor.h @@ -15,10 +15,13 @@ #include "/EgtDev/Include/EgnStringBase.h" +class ICmdParser ; + //---------------------------------------------------------------------------- class __declspec( novtable) ICmdExecutor { public : - virtual bool Execute( const std::string& sCmd1, const std::string& sCmd2, const STRVECTOR& vsParams) = 0 ; + virtual bool SetCmdParser( ICmdParser* pParser) = 0 ; virtual bool AddExecutor( ICmdExecutor* pOtherExec) = 0 ; + virtual bool Execute( const std::string& sCmd1, const std::string& sCmd2, const STRVECTOR& vsParams) = 0 ; } ; diff --git a/EgnCmdParser.h b/EgnCmdParser.h index 7573aec..92fdebf 100644 --- a/EgnCmdParser.h +++ b/EgnCmdParser.h @@ -13,9 +13,10 @@ #pragma once -#include "/EgtDev/Include/EgnStringBase.h" -#include "/EgtDev/Include/EgnCmdExecutor.h" -#include "/EgtDev/Include/EgtILogger.h" +#include + +class ICmdExecutor ; +class ILogger ; //----------------------- Macro per import/export ----------------------------- #undef EGN_EXPORT @@ -30,8 +31,12 @@ class __declspec( novtable) ICmdParser { public : virtual ~ICmdParser( void) {} - virtual bool Init( std::string sCmdFile, ICmdExecutor* pCmdExec, ILogger* pLogger, int nLev = 0) = 0 ; - virtual bool Run( void) = 0 ; + virtual bool Init( ICmdExecutor* pCmdExec, int nLev = 0) = 0 ; + virtual bool Run( const std::string& sCmdFile) = 0 ; + virtual bool AddVariable( const std::string& sName, int nVal) = 0 ; + virtual bool SetVariable( const std::string& sName, int nVal) = 0 ; + virtual bool GetVariable( const std::string& sName, int& nVal) = 0 ; + virtual bool EraseVariable( const std::string& sName) = 0 ; } ; //-----------------------------------------------------------------------------