TestEgr 1.5d5 :
- aggiunto stato a bottoni di Vista e di Modo di Visualizzazione.
This commit is contained in:
BIN
Binary file not shown.
+80
-1
@@ -228,6 +228,21 @@ CTestEGrDlg::OnInitDialog( void)
|
||||
m_View.GetScene()->SetBackground( ColorTop, ColorBottom) ;
|
||||
}
|
||||
|
||||
// recupero il tipo di visualizzazione e lo imposto
|
||||
if ( m_View.GetScene() != nullptr) {
|
||||
int nShMode = GetPrivateProfileInt( "Scene", "ShowMode", 0, AfxGetApp()->m_pszProfileName) ;
|
||||
m_View.GetScene()->SetShowMode( nShMode) ;
|
||||
UpdateShowModeButtons() ;
|
||||
}
|
||||
|
||||
// recupero gli angoli di vista e li imposto
|
||||
if ( m_View.GetScene() != nullptr) {
|
||||
double dAngVdeg = 0, dAngOdeg = 0 ;
|
||||
GetViewAngles( "Scene", "View", dAngVdeg, dAngOdeg) ;
|
||||
m_View.GetScene()->SetCamera( dAngVdeg, dAngOdeg, 0) ;
|
||||
UpdateViewButtons() ;
|
||||
}
|
||||
|
||||
// recupero gli attributi del rettangolo per ZoomWin e li imposto
|
||||
if ( m_View.GetScene() != nullptr) {
|
||||
bool bOutline = true ;
|
||||
@@ -291,6 +306,24 @@ CTestEGrDlg::OnInitDialog( void)
|
||||
return TRUE ; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CTestEGrDlg::GetViewAngles( const char* szSection, const char* szKey, double& dAngVdeg, double& dAngOdeg)
|
||||
{
|
||||
string sTmp = GetPrivateProfileStringUtf8( szSection, szKey, "", AfxGetApp()->m_pszProfileName) ;
|
||||
if ( ! sTmp.empty()) {
|
||||
STRVECTOR vsParams ;
|
||||
Tokenize( sTmp, ",", vsParams) ;
|
||||
if ( vsParams.size() >= 2) {
|
||||
FromString( vsParams[0], dAngVdeg) ;
|
||||
FromString( vsParams[1], dAngOdeg) ;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CTestEGrDlg::GetIniColor( const char* szSection, const char* szKey, Color& cCol)
|
||||
@@ -583,6 +616,16 @@ CTestEGrDlg::OnClose( void)
|
||||
if ( ! ManageModified())
|
||||
return ;
|
||||
|
||||
// salvo il tipo di visualizzazione
|
||||
int nShMode = m_View.GetScene()->GetShowMode() ;
|
||||
WritePrivateProfileInt( "Scene", "ShowMode", nShMode, AfxGetApp()->m_pszProfileName) ;
|
||||
|
||||
// salvo gli angoli di vista
|
||||
double dAngVdeg, dAngOdeg ;
|
||||
m_View.GetScene()->GetCamera( &dAngVdeg, &dAngOdeg) ;
|
||||
string sOut = ToString( dAngVdeg, 1) + "," + ToString( dAngOdeg, 1) ;
|
||||
WritePrivateProfileStringUtf8( "Scene", "View", sOut.c_str(), AfxGetApp()->m_pszProfileName) ;
|
||||
|
||||
// salvo lo stato della finestra del dialogo
|
||||
WINDOWPLACEMENT winPlace ;
|
||||
if ( GetWindowPlacement( &winPlace)) {
|
||||
@@ -724,6 +767,17 @@ void
|
||||
CTestEGrDlg::OnShowMode( UINT nID)
|
||||
{
|
||||
m_View.ShowMode( nID) ;
|
||||
UpdateShowModeButtons() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
CTestEGrDlg::UpdateShowModeButtons( void)
|
||||
{
|
||||
int nSM = m_View.GetScene()->GetShowMode() ;
|
||||
(( CButton*) GetDlgItem( IDC_WIREFRAME))->SetCheck( ( nSM == SM_WIREFRAME ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||
(( CButton*) GetDlgItem( IDC_HIDDENLINE))->SetCheck( ( nSM == SM_HIDDENLINE ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||
(( CButton*) GetDlgItem( IDC_SHADING))->SetCheck( ( nSM == SM_SHADING ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -738,6 +792,20 @@ void
|
||||
CTestEGrDlg::OnView( UINT nID)
|
||||
{
|
||||
m_View.View( nID) ;
|
||||
UpdateViewButtons() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
CTestEGrDlg::UpdateViewButtons( void)
|
||||
{
|
||||
int nVw = m_View.GetScene()->GetCameraDir() ;
|
||||
(( CButton*) GetDlgItem( IDC_VIEW_TOP))->SetCheck( ( nVw == CT_TOP ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||
(( CButton*) GetDlgItem( IDC_VIEW_FRONT))->SetCheck( ( nVw == CT_FRONT ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||
(( CButton*) GetDlgItem( IDC_VIEW_BACK))->SetCheck( ( nVw == CT_BACK ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||
(( CButton*) GetDlgItem( IDC_VIEW_LEFT))->SetCheck( ( nVw == CT_LEFT ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||
(( CButton*) GetDlgItem( IDC_VIEW_RIGHT))->SetCheck( ( nVw == CT_RIGHT ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||
(( CButton*) GetDlgItem( IDC_VIEW_ISO))->SetCheck( ( nVw == CT_ISO_SW ? BST_CHECKED : BST_UNCHECKED)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -939,8 +1007,11 @@ CTestEGrDlg::FileSave( const string& sFilePath)
|
||||
string sInfo = "Save File = " + sFilePath ;
|
||||
LOG_INFO( m_pLogGen, sInfo.c_str())
|
||||
|
||||
// recupero flag per salvatggio binario
|
||||
bool bBin = ( GetPrivateProfileInt( "GeomDB", "BinarySave", 0, AfxGetApp()->m_pszProfileName) == 1) ;
|
||||
|
||||
// salvo il file
|
||||
if ( ! m_pGeomDB->Save( sFilePath))
|
||||
if ( ! m_pGeomDB->Save( sFilePath, bBin))
|
||||
return false ;
|
||||
// log dei comandi
|
||||
LOG_INFO( m_pLogCmd, ( "SAVE( " + sFilePath + ")").c_str())
|
||||
@@ -985,6 +1056,10 @@ CTestEGrDlg::FileExec( const string& sFilePath)
|
||||
// aggiorno l'albero delle entità
|
||||
LoadTree() ;
|
||||
|
||||
// aggiorno stato bottoni
|
||||
UpdateShowModeButtons() ;
|
||||
UpdateViewButtons() ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -1020,6 +1095,10 @@ CTestEGrDlg::LineExec( const string& sLine)
|
||||
! SelectIdOnTree( nIdOld))
|
||||
m_View.Redraw() ;
|
||||
|
||||
// aggiorno stato bottoni
|
||||
UpdateShowModeButtons() ;
|
||||
UpdateViewButtons() ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ class CTestEGrDlg : public CDialog
|
||||
bool GetSceneInfo( std::string& sInfo)
|
||||
{ return m_View.GetSceneInfo( sInfo) ; }
|
||||
bool LineExec( const std::string& sLine) ;
|
||||
void UpdateShowModeButtons( void) ;
|
||||
void UpdateViewButtons( void) ;
|
||||
|
||||
protected :
|
||||
virtual BOOL OnInitDialog( void) ;
|
||||
@@ -61,6 +63,7 @@ class CTestEGrDlg : public CDialog
|
||||
enum ItemReshape { IR_W = 1, IR_H, IR_WH} ;
|
||||
|
||||
private :
|
||||
bool GetViewAngles( const char* szSection, const char* szKey, double& dAngVdeg, double& dAngOdeg) ;
|
||||
bool GetIniColor( const char* szSection, const char* szKey, Color& cCol) ;
|
||||
bool GetIniZoomWinAttrib( const char* szSection, const char* szKey,
|
||||
bool& bOutline, Color& colRect) ;
|
||||
|
||||
+9
-1
@@ -43,4 +43,12 @@ bool
|
||||
LineExec( const string& sLine)
|
||||
{
|
||||
return ((CTestEGrDlg*)AfxGetMainWnd())->LineExec( sLine) ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
UpdateButtons( void)
|
||||
{
|
||||
((CTestEGrDlg*)AfxGetMainWnd())->UpdateShowModeButtons() ;
|
||||
((CTestEGrDlg*)AfxGetMainWnd())->UpdateViewButtons() ;
|
||||
}
|
||||
|
||||
@@ -19,3 +19,5 @@
|
||||
void OutInfo( const std::string& sOut, bool bLog = true) ;
|
||||
bool GetSceneInfo( std::string& sInfo) ;
|
||||
bool LineExec( const std::string& sLine) ;
|
||||
void UpdateButtons( void) ;
|
||||
|
||||
|
||||
@@ -319,6 +319,8 @@ TestEGrView::OnMouseMove( UINT nFlags, CPoint point)
|
||||
m_pScene->RotateCamera( Point3d( m_PrevPoint.x, m_PrevPoint.y), Point3d( point.x, point.y)) ;
|
||||
// aggiorno il disegno
|
||||
RedrawWindow() ;
|
||||
// aggiorno i bottoni
|
||||
UpdateButtons() ;
|
||||
// salvo il punto di riferimento
|
||||
m_PrevPoint = point ;
|
||||
}
|
||||
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user