Include :
- modifiche a ICmdParser - aggiunta classe Color.
This commit is contained in:
+67
@@ -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 <stdlib.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
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] ;
|
||||
} ;
|
||||
@@ -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) ;
|
||||
|
||||
+1
-1
@@ -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 ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
#include "/EgtDev/Include/EGkPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkBBox3d.h"
|
||||
#include "/EgtDev/Include/EGkColor.h"
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
+1
-1
@@ -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 ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+4
-1
@@ -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 ;
|
||||
} ;
|
||||
|
||||
+10
-5
@@ -13,9 +13,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EgnStringBase.h"
|
||||
#include "/EgtDev/Include/EgnCmdExecutor.h"
|
||||
#include "/EgtDev/Include/EgtILogger.h"
|
||||
#include <string>
|
||||
|
||||
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 ;
|
||||
} ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user