3908e11d18
- modifiche per permettere Mark di tipo 2.
105 lines
4.1 KiB
C++
105 lines
4.1 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : Attribs.h Data : 03.03.14 Versione : 1.5c1
|
|
// Contenuto : Dichiarazione della classe Attribs.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 03.03.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "/EgtDev/Include/EGkGdbConst.h"
|
|
#include "/EgtDev/Include/EGkColor.h"
|
|
#include "/EgtDev/Include/EgtStringBase.h"
|
|
#include "/EgtDev/Include/EgtNumUtils.h"
|
|
|
|
class NgeWriter ;
|
|
class NgeReader ;
|
|
class GeomDB ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
class Attribs
|
|
{
|
|
public :
|
|
Attribs( void)
|
|
{ m_Data[LEVEL] = GDB_LV_USER ; m_OldData[LEVEL] = m_Data[LEVEL] ;
|
|
m_Data[MODE] = GDB_MD_STD ; m_OldData[MODE] = m_Data[MODE] ;
|
|
m_Data[STATUS] = GDB_ST_ON ; m_OldData[STATUS] = m_Data[STATUS] ;
|
|
m_Data[MARK] = GDB_MK_OFF ; m_OldData[MARK] = m_Data[MARK] ;
|
|
m_Material = GDB_MT_PARENT ; m_Color.Set() ;}
|
|
Attribs* Clone( void) const
|
|
{ Attribs* pAttribs ;
|
|
// alloco oggetto
|
|
pAttribs = new( std::nothrow) Attribs ;
|
|
if ( pAttribs != nullptr)
|
|
*pAttribs = *this ;
|
|
return pAttribs ; }
|
|
bool Dump( const GeomDB& GDB, std::string& sOut, bool bMM = true, const char* szNewLine = "\n") const ;
|
|
bool Save( NgeWriter& ngeOut) const ;
|
|
bool Load( NgeReader& ngeIn) ;
|
|
void SetLevel( int nLev)
|
|
{ m_OldData[LEVEL] = m_Data[LEVEL] ;
|
|
m_Data[LEVEL] = Clamp( nLev, GDB_LV_USER, GDB_LV_TEMP) ; }
|
|
void RevertLevel( void)
|
|
{ std::swap( m_Data[LEVEL], m_OldData[LEVEL]) ; }
|
|
int GetLevel( void) const
|
|
{ return m_Data[LEVEL] ; }
|
|
void SetMode( int nMode)
|
|
{ m_OldData[MODE] = m_Data[MODE] ;
|
|
m_Data[MODE] = Clamp( nMode, GDB_MD_STD, GDB_MD_HIDDEN) ; }
|
|
void RevertMode( void)
|
|
{ std::swap( m_Data[MODE], m_OldData[MODE]) ; }
|
|
int GetMode( void) const
|
|
{ return m_Data[MODE] ; }
|
|
void SetStatus( int nStat)
|
|
{ if ( m_Data[STATUS] != GDB_ST_SEL)
|
|
m_OldData[STATUS] = m_Data[STATUS] ;
|
|
m_Data[STATUS] = Clamp( nStat, GDB_ST_OFF, GDB_ST_SEL) ; }
|
|
void RevertStatus( void)
|
|
{ SetStatus( m_OldData[STATUS]) ; }
|
|
int GetStatus( void) const
|
|
{ return m_Data[STATUS] ; }
|
|
void SetMark( int nMark)
|
|
{ m_Data[MARK] = Clamp( nMark, GDB_MK_OFF, GDB_MK_ON_2) ; }
|
|
void ResetMark( void)
|
|
{ m_Data[MARK] = GDB_MK_OFF ; }
|
|
int GetMark( void) const
|
|
{ return m_Data[MARK] ; }
|
|
void SetMaterial( int nMat)
|
|
{ if ( nMat >= GDB_MT_PARENT)
|
|
m_Material = nMat ; }
|
|
int GetMaterial( void) const
|
|
{ return m_Material ; }
|
|
void SetColor( Color cCol)
|
|
{ m_Material = GDB_MT_COLOR ; m_Color = cCol ; }
|
|
Color GetColor( void) const
|
|
{ return m_Color ; }
|
|
bool SetName( const std::string& sName) ;
|
|
bool GetName( std::string& sName) const ;
|
|
bool ExistsName( void) const ;
|
|
bool RemoveName( void) ;
|
|
bool SetInfo( const std::string& sKey, const std::string& sVal) ;
|
|
bool GetInfo( const std::string& sKey, std::string& sVal) const ;
|
|
bool ExistsInfo( const std::string& sKey) const ;
|
|
bool RemoveInfo( const std::string& sKey) ;
|
|
bool GetAllInfo( STRVECTOR& vsInfo) const ;
|
|
bool CopyAllInfoFrom( const Attribs& attrSou) ;
|
|
|
|
private :
|
|
enum { LEVEL = 0, MODE = 1, STATUS = 2, MARK = 3, DIM = 4} ;
|
|
|
|
private :
|
|
bool DataFromString( const std::string& sParam) ;
|
|
|
|
private :
|
|
unsigned char m_Data[DIM] ;
|
|
unsigned char m_OldData[DIM] ;
|
|
int m_Material ;
|
|
Color m_Color ;
|
|
STRLIST m_slInfo ;
|
|
} ; |