EgtGeomKernel 1.5c9 :
- migliorata gestione colori standard - aggiunta gestione attributi Mark - aggiunta gestione degli oggetti selezionati - modifiche ad esecutore per selezionati e variabile $SEL.
This commit is contained in:
+11
-11
@@ -45,9 +45,9 @@ Attribs::Dump( string& sOut, const char* szNewLine) const
|
||||
// stato
|
||||
sOut += " Sta=" ;
|
||||
switch ( m_Data[STATUS]) {
|
||||
case GDB_ST_OFF : sOut += "off" ; break ;
|
||||
default : /* GDB_ST_ON */ sOut += "on" ; break ;
|
||||
case GDB_ST_SEL : sOut += "sel" ; break ;
|
||||
case GDB_ST_OFF : sOut += "off" ; break ;
|
||||
}
|
||||
sOut += szNewLine ;
|
||||
// materiale
|
||||
@@ -90,11 +90,11 @@ Attribs::Save( ostream& osOut) const
|
||||
osOut << ToString( m_Data[LEVEL]) << "," ;
|
||||
// modo
|
||||
osOut << ToString( m_Data[MODE]) << "," ;
|
||||
// stato (se SEL viene convertito in ON)
|
||||
int nStat = (( m_Data[STATUS] == GDB_ST_SEL) ? GDB_ST_ON : m_Data[STATUS]) ;
|
||||
// stato (se SEL è convertito in ON)
|
||||
int nStat = (( m_Data[STATUS] > GDB_ST_ON) ? GDB_ST_ON : m_Data[STATUS]) ;
|
||||
osOut << ToString( nStat) << "," ;
|
||||
// altro
|
||||
osOut << ToString( m_Data[OTHER]) << ";" ;
|
||||
// marcatura (sempre OFF)
|
||||
osOut << ToString( GDB_MK_OFF) << ";" ;
|
||||
// materiale
|
||||
osOut << ToString( m_Material) << ";" ;
|
||||
// colore
|
||||
@@ -173,16 +173,16 @@ Attribs::DataFromString( const string& sParam)
|
||||
if ( ! FromString( vsParams[1], nMode))
|
||||
return false ;
|
||||
m_Data[MODE] = CLIP( nMode, GDB_MD_STD, GDB_MD_HIDDEN) ;
|
||||
// stato
|
||||
// stato (ammessi solo OFF e ON)
|
||||
int nStat ;
|
||||
if ( ! FromString( vsParams[2], nStat))
|
||||
return false ;
|
||||
m_Data[STATUS] = CLIP( nStat, GDB_ST_ON, GDB_ST_OFF) ;
|
||||
// altro
|
||||
int nOldStatus ;
|
||||
if ( ! FromString( vsParams[3], nOldStatus))
|
||||
m_Data[STATUS] = CLIP( nStat, GDB_ST_OFF, GDB_ST_ON) ;
|
||||
// marcatura (ammesso solo OFF)
|
||||
int nMark ;
|
||||
if ( ! FromString( vsParams[3], nMark))
|
||||
return false ;
|
||||
m_Data[OTHER] = CLIP( nOldStatus, 0, 255) ;
|
||||
m_Data[MARK] = CLIP( nMark, GDB_MK_OFF, GDB_MK_OFF) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class Attribs
|
||||
{ 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[OTHER] = 0 ; m_OldData[OTHER] = m_Data[OTHER] ;
|
||||
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 ;
|
||||
@@ -56,17 +56,19 @@ class Attribs
|
||||
{ std::swap( m_Data[MODE], m_OldData[MODE]) ; }
|
||||
int GetMode( void) const
|
||||
{ return m_Data[MODE] ; }
|
||||
void SetStatus( int nStat) // non si conserva il selezionato
|
||||
{ if ( m_Data[STATUS] != GDB_ST_SEL)
|
||||
m_OldData[STATUS] = m_Data[STATUS] ;
|
||||
m_Data[STATUS] = CLIP( nStat, GDB_ST_ON, GDB_ST_OFF) ; }
|
||||
void SetStatus( int nStat)
|
||||
{ m_OldData[STATUS] = m_Data[STATUS] ;
|
||||
m_Data[STATUS] = CLIP( nStat, GDB_ST_OFF, GDB_ST_SEL) ; }
|
||||
void RevertStatus( void)
|
||||
{ if ( m_Data[STATUS] != GDB_ST_SEL)
|
||||
std::swap( m_Data[STATUS], m_OldData[STATUS]) ;
|
||||
else
|
||||
m_Data[STATUS] = m_OldData[STATUS] ; }
|
||||
{ std::swap( m_Data[STATUS], m_OldData[STATUS]) ; }
|
||||
int GetStatus( void) const
|
||||
{ return m_Data[STATUS] ; }
|
||||
void SetMark( void)
|
||||
{ m_Data[MARK] = GDB_MK_ON ; }
|
||||
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 ; }
|
||||
@@ -84,7 +86,7 @@ class Attribs
|
||||
bool RemoveInfo( const std::string& sKey) ;
|
||||
|
||||
private :
|
||||
enum { LEVEL = 0, MODE = 1, STATUS = 2, OTHER = 3, DIM = 4} ;
|
||||
enum { LEVEL = 0, MODE = 1, STATUS = 2, MARK = 3, DIM = 4} ;
|
||||
|
||||
private :
|
||||
bool DataFromString( const std::string& sParam) ;
|
||||
|
||||
@@ -19,24 +19,24 @@
|
||||
using namespace std ;
|
||||
|
||||
//------------------------- Constants ----------------------------------------
|
||||
static const char* SZ_BLACK = "BLACK" ;
|
||||
static const char* SZ_GRAY = "GRAY" ;
|
||||
static const char* SZ_LGRAY = "LGRAY" ;
|
||||
static const char* SZ_WHITE = "WHITE" ;
|
||||
static const char* SZ_LGRAY = "LGRAY" ;
|
||||
static const char* SZ_GRAY = "GRAY" ;
|
||||
static const char* SZ_BLACK = "BLACK" ;
|
||||
static const char* SZ_RED = "RED" ;
|
||||
static const char* SZ_GREEN = "GREEN" ;
|
||||
static const char* SZ_BLUE = "BLUE" ;
|
||||
static const char* SZ_CYAN = "CYAN" ;
|
||||
static const char* SZ_MAGENTA = "MAGENTA" ;
|
||||
static const char* SZ_MAROON = "MAROON" ;
|
||||
static const char* SZ_YELLOW = "YELLOW" ;
|
||||
static const char* SZ_BROWN = "BROWN" ;
|
||||
static const char* SZ_OLIVE = "OLIVE" ;
|
||||
static const char* SZ_LIME = "LIME" ;
|
||||
static const char* SZ_GREEN = "GREEN" ;
|
||||
static const char* SZ_AQUA = "AQUA" ;
|
||||
static const char* SZ_TEAL = "TEAL" ;
|
||||
static const char* SZ_BLUE = "BLUE" ;
|
||||
static const char* SZ_NAVY = "NAVY" ;
|
||||
static const char* SZ_FUCHSIA = "FUCHSIA" ;
|
||||
static const char* SZ_PURPLE = "PURPLE" ;
|
||||
static const char* SZ_ORANGE = "ORANGE" ;
|
||||
static const char* SZ_LRED = "LRED" ;
|
||||
static const char* SZ_LGREEN = "LGREEN" ;
|
||||
static const char* SZ_LBLUE = "LBLUE" ;
|
||||
static const char* SZ_LCYAN = "LCYAN" ;
|
||||
static const char* SZ_LMAGENTA = "LMAGENTA" ;
|
||||
static const char* SZ_BROWN = "BROWN" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
@@ -44,42 +44,42 @@ GetStdColor( const string& sName, Color& cCol)
|
||||
{
|
||||
string sCol = sName ;
|
||||
ToUpper( sCol) ;
|
||||
if ( sCol == SZ_BLACK)
|
||||
cCol = BLACK ;
|
||||
else if ( sCol == SZ_GRAY)
|
||||
cCol = GRAY ;
|
||||
if ( sCol == SZ_WHITE)
|
||||
cCol = WHITE ;
|
||||
else if ( sCol == SZ_LGRAY)
|
||||
cCol = LGRAY ;
|
||||
else if ( sCol == SZ_WHITE)
|
||||
cCol = WHITE ;
|
||||
else if ( sCol == SZ_GRAY)
|
||||
cCol = GRAY ;
|
||||
else if ( sCol == SZ_BLACK)
|
||||
cCol = BLACK ;
|
||||
else if ( sCol == SZ_RED)
|
||||
cCol = RED ;
|
||||
else if ( sCol == SZ_GREEN)
|
||||
cCol = GREEN ;
|
||||
else if ( sCol == SZ_BLUE)
|
||||
cCol = BLUE ;
|
||||
else if ( sCol == SZ_CYAN)
|
||||
cCol = CYAN ;
|
||||
else if ( sCol == SZ_MAGENTA)
|
||||
cCol = MAGENTA ;
|
||||
else if ( sCol == SZ_MAROON)
|
||||
cCol = MAROON ;
|
||||
else if ( sCol == SZ_YELLOW)
|
||||
cCol = YELLOW ;
|
||||
else if ( sCol == SZ_BROWN)
|
||||
cCol = BROWN ;
|
||||
else if ( sCol == SZ_OLIVE)
|
||||
cCol = OLIVE ;
|
||||
else if ( sCol == SZ_LIME)
|
||||
cCol = LIME ;
|
||||
else if ( sCol == SZ_GREEN)
|
||||
cCol = GREEN ;
|
||||
else if ( sCol == SZ_AQUA)
|
||||
cCol = AQUA ;
|
||||
else if ( sCol == SZ_TEAL)
|
||||
cCol = TEAL ;
|
||||
else if ( sCol == SZ_BLUE)
|
||||
cCol = BLUE ;
|
||||
else if ( sCol == SZ_NAVY)
|
||||
cCol = NAVY ;
|
||||
else if ( sCol == SZ_FUCHSIA)
|
||||
cCol = FUCHSIA ;
|
||||
else if ( sCol == SZ_PURPLE)
|
||||
cCol = PURPLE ;
|
||||
else if ( sCol == SZ_ORANGE)
|
||||
cCol = ORANGE ;
|
||||
else if ( sCol == SZ_LRED)
|
||||
cCol = LRED ;
|
||||
else if ( sCol == SZ_LGREEN)
|
||||
cCol = LGREEN ;
|
||||
else if ( sCol == SZ_LBLUE)
|
||||
cCol = LBLUE ;
|
||||
else if ( sCol == SZ_LCYAN)
|
||||
cCol = LCYAN ;
|
||||
else if ( sCol == SZ_LMAGENTA)
|
||||
cCol = LMAGENTA ;
|
||||
else if ( sCol == SZ_BROWN)
|
||||
cCol = BROWN ;
|
||||
else
|
||||
return false ;
|
||||
|
||||
@@ -88,46 +88,56 @@ GetStdColor( const string& sName, Color& cCol)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GetNameOfStdColor( const Color& cCol, string& sName)
|
||||
GetNameOfStdColor( Color cCol, string& sName)
|
||||
{
|
||||
if ( cCol == BLACK)
|
||||
sName = SZ_BLACK ;
|
||||
else if ( cCol == GRAY)
|
||||
sName = SZ_GRAY ;
|
||||
if ( cCol == WHITE)
|
||||
sName = SZ_WHITE ;
|
||||
else if ( cCol == LGRAY)
|
||||
sName = SZ_LGRAY ;
|
||||
else if ( cCol == WHITE)
|
||||
sName = SZ_WHITE ;
|
||||
else if ( cCol == GRAY)
|
||||
sName = SZ_GRAY ;
|
||||
else if ( cCol == BLACK)
|
||||
sName = SZ_BLACK ;
|
||||
else if ( cCol == RED)
|
||||
sName = SZ_RED ;
|
||||
else if ( cCol == GREEN)
|
||||
sName = SZ_GREEN ;
|
||||
else if ( cCol == BLUE)
|
||||
sName = SZ_BLUE ;
|
||||
else if ( cCol == CYAN)
|
||||
sName = SZ_CYAN ;
|
||||
else if ( cCol == MAGENTA)
|
||||
sName = SZ_MAGENTA ;
|
||||
else if ( cCol == MAROON)
|
||||
sName = SZ_MAROON ;
|
||||
else if ( cCol == YELLOW)
|
||||
sName = SZ_YELLOW ;
|
||||
else if ( cCol == BROWN)
|
||||
sName = SZ_BROWN ;
|
||||
else if ( cCol == OLIVE)
|
||||
sName = SZ_OLIVE ;
|
||||
else if ( cCol == LIME)
|
||||
sName = SZ_LIME ;
|
||||
else if ( cCol == GREEN)
|
||||
sName = SZ_GREEN ;
|
||||
else if ( cCol == AQUA)
|
||||
sName = SZ_AQUA ;
|
||||
else if ( cCol == TEAL)
|
||||
sName = SZ_TEAL ;
|
||||
else if ( cCol == BLUE)
|
||||
sName = SZ_BLUE ;
|
||||
else if ( cCol == NAVY)
|
||||
sName = SZ_NAVY ;
|
||||
else if ( cCol == FUCHSIA)
|
||||
sName = SZ_FUCHSIA ;
|
||||
else if ( cCol == PURPLE)
|
||||
sName = SZ_PURPLE ;
|
||||
else if ( cCol == ORANGE)
|
||||
sName = SZ_ORANGE ;
|
||||
else if ( cCol == LRED)
|
||||
sName = SZ_LRED ;
|
||||
else if ( cCol == LGREEN)
|
||||
sName = SZ_LGREEN ;
|
||||
else if ( cCol == LBLUE)
|
||||
sName = SZ_LBLUE ;
|
||||
else if ( cCol == LCYAN)
|
||||
sName = SZ_LCYAN ;
|
||||
else if ( cCol == LMAGENTA)
|
||||
sName = SZ_LMAGENTA ;
|
||||
else if ( cCol == BROWN)
|
||||
sName = SZ_BROWN ;
|
||||
else
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Color
|
||||
GetOppositeColor( Color cCol)
|
||||
{
|
||||
return Color( MAX_RGB - cCol.GetIntRed(),
|
||||
MAX_RGB - cCol.GetIntGreen(),
|
||||
MAX_RGB - cCol.GetIntBlue(),
|
||||
cCol.GetIntAlpha()) ;
|
||||
}
|
||||
+2
-2
@@ -1171,7 +1171,7 @@ CurveBezier::TrimStartAtParam( double dUTrim)
|
||||
m_aPtCtrl[i] = ( 1 - dUTrim) * m_aPtCtrl[i] + dUTrim * m_aPtCtrl[i+1] ;
|
||||
}
|
||||
else {
|
||||
m_aPtCtrl[i] = ( 1 - dUTrim) * m_aPtCtrl[i] * m_aWeCtrl[i] + dUTrim * m_aPtCtrl[i+1] * m_aWeCtrl[i+1] ;
|
||||
m_aPtCtrl[i] = ( 1 - dUTrim) * m_aWeCtrl[i] * m_aPtCtrl[i] + dUTrim * m_aWeCtrl[i+1] * m_aPtCtrl[i+1] ;
|
||||
m_aWeCtrl[i] = ( 1 - dUTrim) * m_aWeCtrl[i] + dUTrim * m_aWeCtrl[i+1] ;
|
||||
m_aPtCtrl[i] = m_aPtCtrl[i] * ( 1 / m_aWeCtrl[i]) ;
|
||||
}
|
||||
@@ -1205,7 +1205,7 @@ CurveBezier::TrimEndAtParam( double dUTrim)
|
||||
m_aPtCtrl[i] = ( 1 - dUTrim) * m_aPtCtrl[i-1] + dUTrim * m_aPtCtrl[ i] ;
|
||||
}
|
||||
else {
|
||||
m_aPtCtrl[i] = ( 1 - dUTrim) * m_aPtCtrl[i-1] * m_aWeCtrl[i-1] + dUTrim * m_aPtCtrl[ i] * m_aWeCtrl[ i] ;
|
||||
m_aPtCtrl[i] = ( 1 - dUTrim) * m_aWeCtrl[i-1] * m_aPtCtrl[i-1] + dUTrim * m_aWeCtrl[ i] * m_aPtCtrl[ i] ;
|
||||
m_aWeCtrl[i] = ( 1 - dUTrim) * m_aWeCtrl[i-1] + dUTrim * m_aWeCtrl[ i] ;
|
||||
m_aPtCtrl[i] = m_aPtCtrl[i] * ( 1 / m_aWeCtrl[i]) ;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -330,6 +330,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<ClInclude Include="OutScl.h" />
|
||||
<ClInclude Include="PolynomialPoint3d.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="SelManager.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -332,6 +332,9 @@
|
||||
<ClInclude Include="..\Include\EGkGdbFunct.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SelManager.h">
|
||||
<Filter>File di intestazione</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="EgtGeomKernel.rc">
|
||||
|
||||
+336
-233
File diff suppressed because it is too large
Load Diff
+18
-13
@@ -16,18 +16,21 @@
|
||||
#include "OutScl.h"
|
||||
#include "/EgtDev/Include/EgkGdbExecutor.h"
|
||||
#include "/EgtDev/Include/EgtPerfCounter.h"
|
||||
#include "/EgtDev/Include/EgtExecMgr.h"
|
||||
|
||||
class Vector3d ;
|
||||
class Color ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
typedef std::vector<int> INTVECTOR ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class GdbExecutor : public IGdbExecutor
|
||||
{
|
||||
public : // ICmdExecutor
|
||||
virtual bool SetCmdParser( ICmdParser* pParser) ;
|
||||
virtual bool AddExecutor( ICmdExecutor* pOtherExec) ;
|
||||
virtual bool AddStandardVariables( void) ;
|
||||
virtual bool Execute( const std::string& sCmd1, const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
virtual int Execute( const std::string& sCmd1, const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
|
||||
public : // IGdbExecutor
|
||||
~GdbExecutor( void) ;
|
||||
@@ -39,12 +42,12 @@ class GdbExecutor : public IGdbExecutor
|
||||
private :
|
||||
bool AddGeoObj( const std::string& sId, const std::string& sIdParent, IGeoObj* pGeoObj) ;
|
||||
int GetIdParam( const std::string& sParam, bool bNewAllowed = false) ;
|
||||
bool GetNamesParam( const std::string& sParam, STRVECTOR& vsNames) ;
|
||||
bool GetNamesParam( const std::string& sParam, INTVECTOR& vnNames) ;
|
||||
bool GetVectorParam( const std::string& sParam, Vector3d& vtV) ;
|
||||
bool GetPointParam( const std::string& sParam, Point3d& ptP) ;
|
||||
bool GetPointWParam( const std::string& sParam, Point3d& ptP, double& dW) ;
|
||||
bool GetFrameParam( const std::string& sParam, Frame3d& frF) ;
|
||||
bool GetColorParam( const std::string& sParam, Color& cCol) ;
|
||||
bool GetColorParam( const std::string& sParam, bool& bByParent, Color& cCol) ;
|
||||
bool ExecuteGroup( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecutePoint( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteVector( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
@@ -56,26 +59,28 @@ class GdbExecutor : public IGdbExecutor
|
||||
bool ExecuteLevel( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteMode( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteStatus( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteSelect( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteDeselect( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteMaterial( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteName( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteInfo( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteCopy( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteErase( const STRVECTOR& vsParams) ;
|
||||
bool ExecuteErase( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteTranslate( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteRotate( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteScale( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteMirror( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteInvertCurve( const STRVECTOR& vsParams) ;
|
||||
bool ExecuteInvertCurve( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteTrimCurve( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteNew( const STRVECTOR& vsParams) ;
|
||||
bool ExecuteLoad( const STRVECTOR& vsParams) ;
|
||||
bool ExecuteSave( const STRVECTOR& vsParams) ;
|
||||
bool ExecuteNew( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteLoad( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteSave( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool ExecuteOutScl( const std::string& sCmd2, const STRVECTOR& vsParams) ;
|
||||
bool OutGroupScl( int nId, int nFlag) ;
|
||||
|
||||
private :
|
||||
IGeomDB* m_pGDB ;
|
||||
ICmdParser* m_pParser ;
|
||||
ICmdExecutor* m_pOtherExec ;
|
||||
OutScl m_OutScl ;
|
||||
IGeomDB* m_pGDB ;
|
||||
ICmdParser* m_pParser ;
|
||||
ExecManager<GdbExecutor> m_ExecMgr ;
|
||||
OutScl m_OutScl ;
|
||||
} ;
|
||||
|
||||
+48
-4
@@ -444,8 +444,8 @@ GdbIterator::SetStatus( int nStat)
|
||||
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// assegno lo stato
|
||||
return m_pCurrObj->SetStatus( nStat) ;
|
||||
// la funzione chiamata gestisce l'aggiornamento della lista dei selezionati
|
||||
return m_pGDB->SetStatus( m_pCurrObj, nStat) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -455,8 +455,8 @@ GdbIterator::RevertStatus( void)
|
||||
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// ripristino lo stato precedente
|
||||
return m_pCurrObj->RevertStatus() ;
|
||||
// la funzione chiamata gestisce l'aggiornamento della lista dei selezionati
|
||||
return m_pGDB->RevertStatus( m_pCurrObj) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -481,6 +481,50 @@ GdbIterator::GetCalcStatus( int& nStat) const
|
||||
return m_pCurrObj->GetCalcStatus( nStat) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbIterator::SetMark( void)
|
||||
{
|
||||
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// imposto la marcatura
|
||||
return m_pCurrObj->SetMark() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbIterator::ResetMark( void)
|
||||
{
|
||||
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// cancello la marcatura
|
||||
return m_pCurrObj->ResetMark() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbIterator::GetMark( int& nMark) const
|
||||
{
|
||||
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// recupero la marcatura
|
||||
return m_pCurrObj->GetMark( nMark) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbIterator::GetCalcMark( int& nMark) const
|
||||
{
|
||||
if ( m_pGDB == nullptr || m_pCurrObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// recupero la marcatura calcolata
|
||||
return m_pCurrObj->GetCalcMark( nMark) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbIterator::SetMaterial( int nMat)
|
||||
|
||||
@@ -55,6 +55,10 @@ class GdbIterator : public IGdbIterator
|
||||
virtual bool RevertStatus( void) ;
|
||||
virtual bool GetStatus( int& nStat) const ;
|
||||
virtual bool GetCalcStatus( int& nStat) const ;
|
||||
virtual bool SetMark( void) ;
|
||||
virtual bool ResetMark( void) ;
|
||||
virtual bool GetMark( int& nMark) const ;
|
||||
virtual bool GetCalcMark( int& nMark) const ;
|
||||
virtual bool SetMaterial( int nMat) ;
|
||||
virtual bool SetMaterial( Color cCol) ;
|
||||
virtual bool GetMaterial( int& nMat) const ;
|
||||
|
||||
+100
@@ -391,6 +391,42 @@ GdbObj::RevertStatus( void)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::IsOff( void) const
|
||||
{
|
||||
// se non ci sono attributi
|
||||
if ( m_pAttribs == nullptr)
|
||||
return false ;
|
||||
|
||||
// lo stato è definito
|
||||
return ( m_pAttribs->GetStatus() == GDB_ST_OFF) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::IsOn( void) const
|
||||
{
|
||||
// se non ci sono attributi (On di default)
|
||||
if ( m_pAttribs == nullptr)
|
||||
return true ;
|
||||
|
||||
// lo stato è definito
|
||||
return ( m_pAttribs->GetStatus() == GDB_ST_ON) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::IsSelected( void) const
|
||||
{
|
||||
// se non ci sono attributi
|
||||
if ( m_pAttribs == nullptr)
|
||||
return false ;
|
||||
|
||||
// lo stato è definito
|
||||
return ( m_pAttribs->GetStatus() == GDB_ST_SEL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::GetStatus( int& nStat) const
|
||||
@@ -437,6 +473,70 @@ GdbObj::GetCalcStatus( int& nStat, int nLev) const
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::SetMark( void)
|
||||
{
|
||||
// verifico esistenza (con eventuale creazione) degli attributi
|
||||
if ( GetSafeAttribs() == nullptr)
|
||||
return false ;
|
||||
|
||||
// assegno la marcatura
|
||||
m_pAttribs->SetMark() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::ResetMark( void)
|
||||
{
|
||||
// se non ci sono attributi non fa alcunchè
|
||||
if ( m_pAttribs == nullptr)
|
||||
return true ;
|
||||
|
||||
// cancello la marcatura
|
||||
m_pAttribs->ResetMark() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::GetMark( int& nMark) const
|
||||
{
|
||||
// se non ci sono attributi
|
||||
if ( m_pAttribs == nullptr)
|
||||
return false ;
|
||||
|
||||
// la marcatura è definito
|
||||
nMark = m_pAttribs->GetMark() ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::GetCalcMark( int& nMark) const
|
||||
{
|
||||
// recupero la marcatura dell'oggetto
|
||||
int nObjMark = GDB_MK_OFF ;
|
||||
if ( m_pAttribs != nullptr)
|
||||
nObjMark = m_pAttribs->GetMark() ;
|
||||
|
||||
// se la marcatura è ON, non ho bisogno di sapere altro
|
||||
if ( nObjMark == GDB_MK_ON) {
|
||||
nMark = GDB_MK_ON ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// recupero la marcatura dell'eventuale padre
|
||||
int nParentMark = GDB_MK_OFF ;
|
||||
if ( GetParent() != nullptr)
|
||||
GetParent()->GetCalcMark( nParentMark) ;
|
||||
|
||||
// calcolo la marcatura
|
||||
nMark = ::CalcMark( nObjMark, nParentMark) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::SetMaterial( int nMat)
|
||||
|
||||
@@ -63,8 +63,15 @@ class GdbObj
|
||||
bool GetCalcMode( int& nMode) const ;
|
||||
bool SetStatus( int nStat) ;
|
||||
bool RevertStatus( void) ;
|
||||
bool IsOff( void) const ;
|
||||
bool IsOn( void) const ;
|
||||
bool IsSelected( void) const ;
|
||||
bool GetStatus( int& nStat) const ;
|
||||
bool GetCalcStatus( int& nStat, int nLev = 0) const ;
|
||||
bool SetMark( void) ;
|
||||
bool ResetMark( void) ;
|
||||
bool GetMark( int& nMark) const ;
|
||||
bool GetCalcMark( int& nMark) const ;
|
||||
bool SetMaterial( int nMat) ;
|
||||
bool SetMaterial( Color cCol) ;
|
||||
bool GetMaterial( int& nMat) const ;
|
||||
|
||||
+231
-9
@@ -50,6 +50,8 @@ GeomDB::~GeomDB( void)
|
||||
bool
|
||||
GeomDB::Init( void)
|
||||
{
|
||||
// pulizia
|
||||
Clear() ;
|
||||
// imposto numero minimo buckets del map degli Id
|
||||
m_IdManager.Init( 1024) ;
|
||||
// imposto materiale di default
|
||||
@@ -62,9 +64,10 @@ GeomDB::Init( void)
|
||||
bool
|
||||
GeomDB::Clear( void)
|
||||
{
|
||||
// elimino mappa degli identificatori
|
||||
// pulisco mappa degli identificatori
|
||||
m_IdManager.Clear() ;
|
||||
|
||||
// pulisco lista dei selezionati
|
||||
m_SelManager.Clear() ;
|
||||
// disalloco i gruppi e gli oggetti
|
||||
m_GrpRadix.Clear() ;
|
||||
|
||||
@@ -247,7 +250,7 @@ GeomDB::SaveHeader( ostream& osOut) const
|
||||
{
|
||||
// intestazione
|
||||
osOut << "START" << endl ;
|
||||
osOut << "GeomDB,1.5.3.7;" << endl ;
|
||||
osOut << "GeomDB,1.5.3.8;" << endl ;
|
||||
|
||||
// materiale di default come colore
|
||||
osOut << "MAT_DEF" << endl ;
|
||||
@@ -607,15 +610,12 @@ GeomDB::CopyGlob( int nIdSou, int nIdDest, int nParentIdDest)
|
||||
bool
|
||||
GeomDB::Erase( int nId)
|
||||
{
|
||||
INTPGDBO_UMAP::const_iterator Iter ;
|
||||
GdbObj* pGdbObj ;
|
||||
|
||||
|
||||
// non si può cancellare il gruppo radice (escludo anche Id non validi)
|
||||
if ( nId <= GDB_ID_ROOT)
|
||||
return false ;
|
||||
|
||||
// recupero l'oggetto
|
||||
GdbObj* pGdbObj ;
|
||||
pGdbObj = m_IdManager.FindObj( nId) ;
|
||||
if ( pGdbObj == nullptr)
|
||||
return false ;
|
||||
@@ -623,6 +623,9 @@ GeomDB::Erase( int nId)
|
||||
// elimino da mappa dei nomi
|
||||
m_IdManager.RemoveObj( nId) ;
|
||||
|
||||
// eliminazione eventuale da lista dei selezionati
|
||||
m_SelManager.RemoveObj( pGdbObj) ;
|
||||
|
||||
// lo tolgo dalla lista
|
||||
pGdbObj->Remove() ;
|
||||
|
||||
@@ -766,6 +769,130 @@ GeomDB::MirrorGlob( int nId, const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
return pGdbObj->Mirror( ptOnLoc, vtNormLoc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Selection
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::SelectObj( int nId)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
return SetStatus( pGdbObj, GDB_ST_SEL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::DeselectObj( int nId)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// se selezionato, lo deseleziono
|
||||
if ( pGdbObj->IsSelected())
|
||||
return SetStatus( pGdbObj, GDB_ST_ON) ;
|
||||
// altrimenti, va già bene
|
||||
else
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::SelectGroupObjs( int nId)
|
||||
{
|
||||
// recupero il gruppo Gdb
|
||||
GdbGroup* pGdbGroup ;
|
||||
if ( ( pGdbGroup = GetGdbGroup( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// ciclo sugli oggetti del gruppo e li seleziono
|
||||
GdbObj* pGdbObj = pGdbGroup->GetFirstObj() ;
|
||||
while ( pGdbObj != nullptr) {
|
||||
if ( ! SetStatus( pGdbObj, GDB_ST_SEL))
|
||||
return false ;
|
||||
pGdbObj = pGdbObj->GetNext() ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::DeselectGroupObjs( int nId)
|
||||
{
|
||||
// recupero il gruppo Gdb
|
||||
GdbGroup* pGdbGroup ;
|
||||
if ( ( pGdbGroup = GetGdbGroup( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// ciclo sugli oggetti del gruppo e li seleziono
|
||||
GdbObj* pGdbObj = pGdbGroup->GetFirstObj() ;
|
||||
while ( pGdbObj != nullptr) {
|
||||
// se selezionato, lo deseleziono
|
||||
if ( pGdbObj->IsSelected()) {
|
||||
if ( ! SetStatus( pGdbObj, GDB_ST_ON))
|
||||
return false ;
|
||||
}
|
||||
pGdbObj = pGdbObj->GetNext() ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::IsSelectedObj( int nId) const
|
||||
{
|
||||
// recupero l'oggetto
|
||||
const GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = (const_cast<GeomDB*>(this))->GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// recupero lo stato
|
||||
return pGdbObj->IsSelected() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
GeomDB::GetSelectedObjNbr( void) const
|
||||
{
|
||||
return m_SelManager.GetSize() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
GeomDB::GetFirstSelectedObj( void) const
|
||||
{
|
||||
GdbObj* pGObj = m_SelManager.GetFirstObj() ;
|
||||
|
||||
return (( pGObj == nullptr) ? GDB_ID_NULL : pGObj->m_nId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
GeomDB::GetNextSelectedObj( void) const
|
||||
{
|
||||
GdbObj* pGObj = m_SelManager.GetNextObj() ;
|
||||
|
||||
return (( pGObj == nullptr) ? GDB_ID_NULL : pGObj->m_nId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::ClearSelection( void)
|
||||
{
|
||||
GdbObj* pGObj = m_SelManager.GetFirstObj() ;
|
||||
while ( pGObj != nullptr) {
|
||||
m_SelManager.RemoveObj( pGObj) ;
|
||||
pGObj->SetStatus( GDB_ST_ON) ;
|
||||
pGObj = m_SelManager.GetFirstObj() ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Attributes
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -899,8 +1026,29 @@ GeomDB::SetStatus( int nId, int nStat)
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
return SetStatus( pGdbObj, nStat) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::SetStatus( GdbObj* pGdbObj, int nStat)
|
||||
{
|
||||
// verifico validità oggetto
|
||||
if ( pGdbObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// assegno lo stato
|
||||
return pGdbObj->SetStatus( nStat) ;
|
||||
if ( ! pGdbObj->SetStatus( nStat))
|
||||
return false ;
|
||||
|
||||
// se il nuovo stato è selezionato, inserisco oggetto in lista selezionati
|
||||
if ( nStat == GDB_ST_SEL)
|
||||
m_SelManager.AddObj( pGdbObj) ;
|
||||
// altrimenti provo a toglierlo
|
||||
else
|
||||
m_SelManager.RemoveObj( pGdbObj) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -912,8 +1060,30 @@ GeomDB::RevertStatus( int nId)
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
return RevertStatus( pGdbObj) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::RevertStatus( GdbObj* pGdbObj)
|
||||
{
|
||||
// verifico validità oggetto
|
||||
if ( pGdbObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// ripristino lo stato precedente
|
||||
return pGdbObj->RevertStatus() ;
|
||||
if ( ! pGdbObj->RevertStatus())
|
||||
return false ;
|
||||
|
||||
// se il nuovo stato è selezionato, inserisco oggetto in lista selezionati
|
||||
int nStat = GDB_ST_ON ;
|
||||
if ( pGdbObj->GetStatus( nStat) && nStat == GDB_ST_SEL)
|
||||
m_SelManager.AddObj( pGdbObj) ;
|
||||
// altrimenti provo a toglierlo
|
||||
else
|
||||
m_SelManager.RemoveObj( pGdbObj) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -942,6 +1112,58 @@ GeomDB::GetCalcStatus( int nId, int& nStat) const
|
||||
return pGdbObj->GetCalcStatus( nStat) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::SetMark( int nId)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// imposto la marcatura
|
||||
return pGdbObj->SetMark() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::ResetMark( int nId)
|
||||
{
|
||||
// recupero l'oggetto
|
||||
GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// cancello la marcatura
|
||||
return pGdbObj->ResetMark() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::GetMark( int nId, int& nMark) const
|
||||
{
|
||||
// recupero l'oggetto
|
||||
const GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = (const_cast<GeomDB*>(this))->GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// recupero la marcatura
|
||||
return pGdbObj->GetMark( nMark) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::GetCalcMark( int nId, int& nMark) const
|
||||
{
|
||||
// recupero l'oggetto
|
||||
const GdbObj* pGdbObj ;
|
||||
if ( ( pGdbObj = (const_cast<GeomDB*>(this))->GetGdbObj( nId)) == nullptr)
|
||||
return false ;
|
||||
|
||||
// recupero la marcatura calcolata
|
||||
return pGdbObj->GetCalcMark( nMark) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GeomDB::SetDefaultMaterial( Color cCol)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "GdbGeo.h"
|
||||
#include "GdbGroup.h"
|
||||
#include "IdManager.h"
|
||||
#include "SelManager.h"
|
||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||
#include <string>
|
||||
|
||||
@@ -66,6 +67,17 @@ class GeomDB : public IGeomDB
|
||||
virtual bool ScaleGlob( int nId, const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ) ;
|
||||
virtual bool Mirror( int nId, const Point3d& ptOn, const Vector3d& vtNorm) ;
|
||||
virtual bool MirrorGlob( int nId, const Point3d& ptOn, const Vector3d& vtNorm) ;
|
||||
// selection
|
||||
virtual bool SelectObj( int nId) ;
|
||||
virtual bool DeselectObj( int nId) ;
|
||||
virtual bool SelectGroupObjs( int nId) ;
|
||||
virtual bool DeselectGroupObjs( int nId) ;
|
||||
virtual bool IsSelectedObj( int nId) const ;
|
||||
virtual int GetSelectedObjNbr( void) const ;
|
||||
virtual int GetFirstSelectedObj( void) const ;
|
||||
virtual int GetNextSelectedObj( void) const ;
|
||||
virtual bool ClearSelection( void) ;
|
||||
// attributes
|
||||
virtual bool DumpAttributes( int nId, std::string& sOut, const char* szNewLine) const ;
|
||||
virtual bool SetLevel( int nId, int nLevel) ;
|
||||
virtual bool RevertLevel( int nId) ;
|
||||
@@ -79,6 +91,10 @@ class GeomDB : public IGeomDB
|
||||
virtual bool RevertStatus( int nId) ;
|
||||
virtual bool GetStatus( int nId, int& nStat) const ;
|
||||
virtual bool GetCalcStatus( int nId, int& nStat) const ;
|
||||
virtual bool SetMark( int nId) ;
|
||||
virtual bool ResetMark( int nId) ;
|
||||
virtual bool GetMark( int nId, int& nMark) const ;
|
||||
virtual bool GetCalcMark( int nId, int& nMark) const ;
|
||||
virtual bool SetDefaultMaterial( Color cCol) ;
|
||||
virtual bool GetDefaultMaterial( Color& cCol) const ;
|
||||
virtual bool SetMaterial( int nId, int nMat) ;
|
||||
@@ -107,8 +123,11 @@ class GeomDB : public IGeomDB
|
||||
bool LoadHeader( Scanner& TheScanner) ;
|
||||
bool LoadOneObj( Scanner& TheScanner, bool& bEnd) ;
|
||||
bool SaveHeader( std::ostream& osOut) const ;
|
||||
bool SetStatus( GdbObj* pGdbObj, int nStat) ;
|
||||
bool RevertStatus( GdbObj* pGdbObj) ;
|
||||
|
||||
private :
|
||||
GdbGroup m_GrpRadix ; // gruppo radice di tutto il DB
|
||||
IdManager m_IdManager ; // gestore del nuovo Id
|
||||
GdbGroup m_GrpRadix ; // gruppo radice di tutto il DB
|
||||
IdManager m_IdManager ; // gestore del nuovo Id
|
||||
SelManager m_SelManager ; // gestore lista oggetti selezionati
|
||||
} ;
|
||||
|
||||
+3
-3
@@ -16,9 +16,6 @@
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
typedef std::unordered_map< int, GdbObj*> INTPGDBO_UMAP ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class IdManager
|
||||
{
|
||||
@@ -47,6 +44,9 @@ class IdManager
|
||||
void UpdateMaxId( int nId)
|
||||
{ if ( nId > m_nMaxId) m_nMaxId = nId ; }
|
||||
|
||||
private :
|
||||
typedef std::unordered_map< int, GdbObj*> INTPGDBO_UMAP ;
|
||||
|
||||
private :
|
||||
int m_nMaxId ;
|
||||
INTPGDBO_UMAP m_GdbIdMap ; // map basato sugli identificatori
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2014
|
||||
//----------------------------------------------------------------------------
|
||||
// File : SelManager.h Data : 19.03.14 Versione : 1.5c8
|
||||
// Contenuto : Dichiarazione e implementazione della classe SelManager.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 19.03.14 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GdbObj.h"
|
||||
#include <list>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
typedef std::list<GdbObj*> PGDBO_LIST ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class SelManager
|
||||
{
|
||||
public :
|
||||
SelManager( void)
|
||||
{ m_Iter = m_SelList.end() ; }
|
||||
void Clear( void)
|
||||
{ m_SelList.clear() ;
|
||||
m_Iter = m_SelList.end() ; }
|
||||
int GetSize( void) const
|
||||
{ return int ( m_SelList.size()) ; }
|
||||
bool IsObjInList( GdbObj* pGObj)
|
||||
{ PGDBO_LIST::const_iterator Iter ;
|
||||
for ( Iter = m_SelList.begin() ; Iter != m_SelList.end() ; ++ Iter) {
|
||||
if ( *Iter == pGObj)
|
||||
return true ;
|
||||
}
|
||||
return false ; }
|
||||
bool AddObj( GdbObj* pGObj)
|
||||
{ if ( pGObj == nullptr)
|
||||
return false ;
|
||||
if ( IsObjInList( pGObj))
|
||||
return true ;
|
||||
try { m_SelList.push_back( pGObj) ; }
|
||||
catch (...) { return false ;}
|
||||
return true ; }
|
||||
bool RemoveObj( GdbObj* pGObj)
|
||||
{ PGDBO_LIST::iterator Iter ;
|
||||
for ( Iter = m_SelList.begin() ; Iter != m_SelList.end() ; ++ Iter) {
|
||||
if ( *Iter == pGObj) {
|
||||
if ( Iter == m_Iter)
|
||||
m_Iter = m_SelList.end() ;
|
||||
m_SelList.erase( Iter) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
return true ; }
|
||||
GdbObj* GetFirstObj( void) const
|
||||
{ m_Iter = m_SelList.begin() ;
|
||||
if ( m_Iter == m_SelList.end())
|
||||
return nullptr ;
|
||||
return (*m_Iter) ; }
|
||||
GdbObj* GetNextObj( void) const
|
||||
{ if ( m_Iter == m_SelList.end())
|
||||
return nullptr ;
|
||||
++ m_Iter ;
|
||||
if ( m_Iter == m_SelList.end())
|
||||
return nullptr ;
|
||||
return (*m_Iter) ; }
|
||||
|
||||
private :
|
||||
PGDBO_LIST m_SelList ;
|
||||
mutable PGDBO_LIST::const_iterator m_Iter ;
|
||||
} ;
|
||||
Reference in New Issue
Block a user