diff --git a/TAG_MFC-TIGLViewer/.cproject b/TAG_MFC-TIGLViewer/.cproject new file mode 100644 index 000000000..cc73d1d67 --- /dev/null +++ b/TAG_MFC-TIGLViewer/.cproject @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TAG_MFC-TIGLViewer/.project b/TAG_MFC-TIGLViewer/.project new file mode 100644 index 000000000..ee313e3df --- /dev/null +++ b/TAG_MFC-TIGLViewer/.project @@ -0,0 +1,77 @@ + + + TIGLViewer + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + debug + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + build_VC_7_1.bat + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + true + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + debug + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + false + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/TAG_MFC-TIGLViewer/Common/AISDialogs.cpp b/TAG_MFC-TIGLViewer/Common/AISDialogs.cpp new file mode 100644 index 000000000..367eeb7a4 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/AISDialogs.cpp @@ -0,0 +1,446 @@ +// AISDialogs.cpp : implementation file +// + +#include "stdafx.h" + +#include "AISDialogs.h" + +#define DEFAULT_DEVIATIONCOEFFICIENT 0.001 +#define DEFAULT_DCBIG 0.005 +#define DEFAULT_DCVBIG 0.01 +#define DEFAULT_DCSMALL 0.0002 +#define DEFAULT_DCVSMALL 0.00004 +#define DEFAULT_COLOR Quantity_NOC_CYAN1 +#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER +#define DEFAULT_BACKGROUNDCOLOR Quantity_NOC_MATRAGRAY +#define DEFAULT_HILIGHTCOLOR Quantity_NOC_YELLOW + + +///////////////////////////////////////////////////////////////////////////// +// CAISNbrIsosDialog dialog + +//CAISNbrIsosDialog::CAISNbrIsosDialog(Handle_AIS_InteractiveContext CurrentIC, +// CWnd* pParent /*=NULL*/) +// : CDialog(CAISNbrIsosDialog::IDD, pParent) +/* +{ + //{{AFX_DATA_INIT(CAISNbrIsosDialog) + m_Isosu = 0; + m_Isosv = 0; + //}}AFX_DATA_INIT + + myCurrentIC = CurrentIC; + Handle (Prs3d_Drawer) ICDrawer = myCurrentIC->DefaultDrawer(); + m_Isosu = ICDrawer->UIsoAspect()->Number(); + m_Isosv = ICDrawer->VIsoAspect()->Number(); + +} + + +void CAISNbrIsosDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAISNbrIsosDialog) + DDX_Text(pDX, IDC_EDITAISISOSU, m_Isosu); + DDX_Text(pDX, IDC_EDITAISISOSV, m_Isosv); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CAISNbrIsosDialog, CDialog) + //{{AFX_MSG_MAP(CAISNbrIsosDialog) + ON_NOTIFY(UDN_DELTAPOS, IDC_SPINAISISOSU, OnDeltaposSpinaisisosu) + ON_NOTIFY(UDN_DELTAPOS, IDC_SPINAISISOSV, OnDeltaposSpinaisisosv) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CAISNbrIsosDialog message handlers + +void CAISNbrIsosDialog::OnDeltaposSpinaisisosu(NMHDR* pNMHDR, LRESULT* pResult) +{ + NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; + // TODO: Add your control notification handler code here + + if ((pNMUpDown->iDelta < 0)) + m_Isosu = m_Isosu + 1; + if ((pNMUpDown->iDelta > 0) && (m_Isosu > 0)) + m_Isosu = m_Isosu - 1; + + UpdateIsos (); + + *pResult = 0; +} + +void CAISNbrIsosDialog::OnDeltaposSpinaisisosv(NMHDR* pNMHDR, LRESULT* pResult) +{ + NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; + // TODO: Add your control notification handler code here + + if ((pNMUpDown->iDelta < 0)) + m_Isosv = m_Isosv + 1; + if ((pNMUpDown->iDelta > 0) && (m_Isosu > 0)) + m_Isosv = m_Isosv - 1; + + UpdateIsos (); + + *pResult = 0; +} + + +#include +#include + +void CAISNbrIsosDialog::UpdateIsos () +{ + UpdateData (false); + + for (myCurrentIC->InitCurrent(); + myCurrentIC->MoreCurrent (); + myCurrentIC->NextSelected ()) + { + Handle (AIS_InteractiveObject) CurObject; + Handle (AIS_Drawer) CurDrawer; + + + CurObject = myCurrentIC->Current(); + CurDrawer = CurObject->Attributes(); + + CurDrawer->UIsoAspect()->SetNumber(m_Isosu); + CurDrawer->VIsoAspect()->SetNumber(m_Isosv); + + myCurrentIC->SetLocalAttributes(CurObject, CurDrawer); + + myCurrentIC->Redisplay(CurObject); + } + +} +*/ +///////////////////////////////////////////////////////////////////////////// +// CDevCoeffDialog dialog + + +//CDevCoeffDialog::CDevCoeffDialog(Handle_AIS_InteractiveContext CurrentIC, +// CWnd* pParent /*=NULL*/) +// : CDialog(CDevCoeffDialog::IDD, pParent) +/* +{ + //{{AFX_DATA_INIT(CDevCoeffDialog) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + myCurrentIC = CurrentIC; +} + + +void CDevCoeffDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CDevCoeffDialog) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CDevCoeffDialog, CDialog) + //{{AFX_MSG_MAP(CDevCoeffDialog) + ON_BN_CLICKED(IDC_DC_BIG, OnDcBig) + ON_BN_CLICKED(IDC_DC_DEFAULT, OnDcDefault) + ON_BN_CLICKED(IDC_DC_SMALL, OnDcSmall) + ON_BN_DOUBLECLICKED(IDC_DC_BIG, OnDoubleclickedDcBig) + ON_BN_DOUBLECLICKED(IDC_DC_DEFAULT, OnDoubleclickedDcDefault) + ON_BN_DOUBLECLICKED(IDC_DC_SMALL, OnDoubleclickedDcSmall) + ON_BN_CLICKED(IDC_DC_VBIG, OnDcVbig) + ON_BN_DOUBLECLICKED(IDC_DC_VBIG, OnDoubleclickedDcVbig) + ON_BN_CLICKED(IDC_DC_VSMALL, OnDcVsmall) + ON_BN_DOUBLECLICKED(IDC_DC_VSMALL, OnDoubleclickedDcVsmall) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDevCoeffDialog message handlers + + + +void CDevCoeffDialog::OnDcDefault() +{ + // TODO: Add your control notification handler code here + myCurrentIC->SetDeviationCoefficient (DEFAULT_DEVIATIONCOEFFICIENT); +} + +void CDevCoeffDialog::OnDcSmall() +{ + // TODO: Add your control notification handler code here + myCurrentIC->SetDeviationCoefficient (DEFAULT_DCSMALL); +} + +void CDevCoeffDialog::OnDcVsmall() +{ + // TODO: Add your control notification handler code here + myCurrentIC->SetDeviationCoefficient (DEFAULT_DCVSMALL); +} + + +void CDevCoeffDialog::OnDcBig() +{ + // TODO: Add your control notification handler code here + myCurrentIC->SetDeviationCoefficient (DEFAULT_DCBIG); +} + +void CDevCoeffDialog::OnDcVbig() +{ + // TODO: Add your control notification handler code here + myCurrentIC->SetDeviationCoefficient (DEFAULT_DCVBIG); +} + + + +void CDevCoeffDialog::OnDoubleclickedDcDefault() +{ + // TODO: Add your control notification handler code here + myCurrentIC->SetDeviationCoefficient (DEFAULT_DEVIATIONCOEFFICIENT); + RedisplaySelected(); +} + +void CDevCoeffDialog::OnDoubleclickedDcSmall() +{ + // TODO: Add your control notification handler code here + myCurrentIC->SetDeviationCoefficient (DEFAULT_DCSMALL); + RedisplaySelected(); +} + +void CDevCoeffDialog::OnDoubleclickedDcVsmall() +{ + // TODO: Add your control notification handler code here + myCurrentIC->SetDeviationCoefficient (DEFAULT_DCVSMALL); + RedisplaySelected(); +} + +void CDevCoeffDialog::OnDoubleclickedDcBig() +{ + // TODO: Add your control notification handler code here + myCurrentIC->SetDeviationCoefficient (DEFAULT_DCBIG); + RedisplaySelected(); +} + +void CDevCoeffDialog::OnDoubleclickedDcVbig() +{ + // TODO: Add your control notification handler code here + myCurrentIC->SetDeviationCoefficient (DEFAULT_DCVBIG); + RedisplaySelected(); +} + + + +void CDevCoeffDialog::RedisplaySelected () +{ + for (myCurrentIC->InitCurrent(); + myCurrentIC->MoreCurrent (); + myCurrentIC->NextSelected ()) + { + myCurrentIC->Redisplay(myCurrentIC->Current()); + } +} + +*/ + +///////////////////////////////////////////////////////////////////////////// +// CDialogMaterial dialog + + +CDialogMaterial::CDialogMaterial(Handle_AIS_InteractiveContext CurrentIC, + CWnd* pParent /*=NULL*/) + : CDialog(CDialogMaterial::IDD, pParent) +{ + //{{AFX_DATA_INIT(CDialogMaterial) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT + myCurrentIC = CurrentIC; +/* + for (myCurrentIC->InitCurrent();myCurrentIC->MoreCurrent ();myCurrentIC->NextCurrent ()){ + for(int i = ID_OBJECT_MATERIAL_BRASS; i <= ID_OBJECT_MATERIAL_DEFAULT; i++){ + if (myCurrentIC->Current()->Material() - (i - ID_OBJECT_MATERIAL_BRASS) == 0) + //GotoDlgCtrl(GetDlgItem(i)); + } + } +*/ + +} + + +void CDialogMaterial::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CDialogMaterial) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CDialogMaterial, CDialog) + //{{AFX_MSG_MAP(CDialogMaterial) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_ALUMINIUM, OnObjectMaterialAluminium) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_BRASS, OnObjectMaterialBrass) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_BRONZE, OnObjectMaterialBronze) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_CHROME, OnObjectMaterialChrome) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_COPPER, OnObjectMaterialCopper) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_GOLD, OnObjectMaterialGold) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_JADE, OnObjectMaterialJade) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_METALIZED, OnObjectMaterialMetalized) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_NEON_GNC, OnObjectMaterialNeonGNC) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_NEON_PHC, OnObjectMaterialNeonPHC) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_OBSIDIAN, OnObjectMaterialObsidian) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_PEWTER, OnObjectMaterialPewter) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_PLASTER, OnObjectMaterialPlaster) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_PLASTIC, OnObjectMaterialPlastic) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_SATIN, OnObjectMaterialSatin) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_SHINY_PLASTIC, OnObjectMaterialShinyPlastic) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_SILVER, OnObjectMaterialSilver) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_STEEL, OnObjectMaterialSteel) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_STONE, OnObjectMaterialStone) + ON_BN_CLICKED(ID_OBJECT_MATERIAL_DEFAULT, OnObjectMaterialDefault) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDialogMaterial message handlers +/* +void CDialogMaterial::OnMaterial(UINT nID) +{ + SetMaterial ((Graphic3d_NameOfMaterial)(nID-ID_OBJECT_MATERIAL_BRASS)); +} +*/ +void CDialogMaterial::SetMaterial(Graphic3d_NameOfMaterial Material) +{ + Standard_Real aTransparency; + for (myCurrentIC->InitCurrent();myCurrentIC->MoreCurrent ();myCurrentIC->NextCurrent ()){ + aTransparency = myCurrentIC->Current()->Transparency(); + myCurrentIC->SetMaterial (myCurrentIC->Current(),(Graphic3d_NameOfMaterial)(Material)); + myCurrentIC->SetTransparency (myCurrentIC->Current(),aTransparency); + } +} + +void CDialogMaterial::OnObjectMaterialAluminium () { SetMaterial ( Graphic3d_NOM_ALUMINIUM ) ; } +void CDialogMaterial::OnObjectMaterialBrass () { SetMaterial ( Graphic3d_NOM_BRASS ) ; } +void CDialogMaterial::OnObjectMaterialBronze () { SetMaterial ( Graphic3d_NOM_BRONZE ) ; } +void CDialogMaterial::OnObjectMaterialChrome () { SetMaterial ( Graphic3d_NOM_CHROME ) ; } +void CDialogMaterial::OnObjectMaterialCopper () { SetMaterial ( Graphic3d_NOM_COPPER ) ; } +void CDialogMaterial::OnObjectMaterialGold () { SetMaterial ( Graphic3d_NOM_GOLD ) ; } +void CDialogMaterial::OnObjectMaterialJade () { SetMaterial ( Graphic3d_NOM_JADE ) ; } +void CDialogMaterial::OnObjectMaterialMetalized () { SetMaterial ( Graphic3d_NOM_METALIZED ) ; } +void CDialogMaterial::OnObjectMaterialNeonGNC () { SetMaterial ( Graphic3d_NOM_NEON_GNC ) ; } +void CDialogMaterial::OnObjectMaterialNeonPHC () { SetMaterial ( Graphic3d_NOM_NEON_PHC ) ; } +void CDialogMaterial::OnObjectMaterialObsidian () { SetMaterial ( Graphic3d_NOM_OBSIDIAN ) ; } +void CDialogMaterial::OnObjectMaterialPewter () { SetMaterial ( Graphic3d_NOM_PEWTER ) ; } +void CDialogMaterial::OnObjectMaterialPlaster () { SetMaterial ( Graphic3d_NOM_PLASTER ) ; } +void CDialogMaterial::OnObjectMaterialPlastic () { SetMaterial ( Graphic3d_NOM_PLASTIC ) ; } +void CDialogMaterial::OnObjectMaterialSatin () { SetMaterial ( Graphic3d_NOM_SATIN ) ; } +void CDialogMaterial::OnObjectMaterialShinyPlastic () { SetMaterial ( Graphic3d_NOM_SHINY_PLASTIC ) ; } +void CDialogMaterial::OnObjectMaterialSilver () { SetMaterial ( Graphic3d_NOM_SILVER ) ; } +void CDialogMaterial::OnObjectMaterialSteel () { SetMaterial ( Graphic3d_NOM_STEEL ) ; } +void CDialogMaterial::OnObjectMaterialStone () { SetMaterial ( Graphic3d_NOM_STONE ) ; } +void CDialogMaterial::OnObjectMaterialDefault () { SetMaterial ( Graphic3d_NOM_DEFAULT ) ; } + + +///////////////////////////////////////////////////////////////////////////// +// CDialogTransparency dialog + +CDialogTransparency::CDialogTransparency(Handle_AIS_InteractiveContext CurrentIC, + CWnd* pParent /*=NULL*/) + : CDialog(CDialogTransparency::IDD, pParent) +{ + + //{{AFX_DATA_INIT(CDialogTransparency) + m_TransValue = 0; + //}}AFX_DATA_INIT + + myCurrentIC = CurrentIC; + + Standard_Real temp = 10; + Standard_Real t; + + for (myCurrentIC->InitCurrent(); + myCurrentIC->MoreCurrent (); + myCurrentIC->NextCurrent ()) + { + t = CurrentIC->Current()->Transparency(); + if (temp > t) + temp = t; + //myCurrentIC->SetTransparency (myCurrentIC->Current(), m_TransValue); + } + + m_TransValue = int (temp * 10); + if (Abs(m_TransValue - temp * 10) > 0.01) + m_TransValue = int (temp * 10) + 1; + + for (myCurrentIC->InitCurrent(); + myCurrentIC->MoreCurrent (); + myCurrentIC->NextCurrent ()) + { + myCurrentIC->SetTransparency (myCurrentIC->Current(), temp); + } + + +} + + +void CDialogTransparency::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CDialogTransparency) + DDX_Text(pDX, IDC_EDITAISTRANSP, m_TransValue); + DDV_MinMaxInt(pDX, m_TransValue, 0, 10); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CDialogTransparency, CDialog) + //{{AFX_MSG_MAP(CDialogTransparency) + ON_NOTIFY(UDN_DELTAPOS, IDC_SPINAISTRANSP, OnDeltaposSpinaistransp) + ON_EN_CHANGE(IDC_EDITAISTRANSP, OnChangeEditaistransp) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDialogTransparency message handlers + +void CDialogTransparency::OnDeltaposSpinaistransp(NMHDR* pNMHDR, LRESULT* pResult) +{ + NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; + // TODO: Add your control notification handler code here + if ((pNMUpDown->iDelta < 0) && (m_TransValue < 10)) + m_TransValue = m_TransValue + 1; + if ((pNMUpDown->iDelta > 0) && (m_TransValue > 0)) + m_TransValue = m_TransValue - 1; + + UpdateData (false); + + for (myCurrentIC->InitCurrent(); + myCurrentIC->MoreCurrent (); + myCurrentIC->NextCurrent()) + { + myCurrentIC->SetTransparency (myCurrentIC->Current(), m_TransValue/10.0); + } + + *pResult = 0; + +} + + +void CDialogTransparency::OnChangeEditaistransp() +{ + // TODO: Add your control notification handler code here + int temp = m_TransValue; + if (UpdateData (true)){ + for (myCurrentIC->InitCurrent(); + myCurrentIC->MoreCurrent (); + myCurrentIC->NextCurrent()) + { + myCurrentIC->SetTransparency (myCurrentIC->Current(), m_TransValue/10.0); + } + } + else{ + m_TransValue = temp; + UpdateData (false); + } + +} diff --git a/TAG_MFC-TIGLViewer/Common/AISDialogs.h b/TAG_MFC-TIGLViewer/Common/AISDialogs.h new file mode 100644 index 000000000..d8cf561e0 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/AISDialogs.h @@ -0,0 +1,207 @@ +// AISDialogs.h : header file +// + +#if !defined(AFX_AISNBRISOSDIALOG_H__AAD52722_6A63_11D1_8C62_00AA00D10994__INCLUDED_) +#define AFX_AISNBRISOSDIALOG_H__AAD52722_6A63_11D1_8C62_00AA00D10994__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +///////////////////////////////////////////////////////////////////////////// +// CAISNbrIsosDialog dialog + +#include +#include "res\OCC_Resource.h" +#include + +/* +class CAISNbrIsosDialog : public CDialog +{ +// Construction +public: + CAISNbrIsosDialog(Handle_AIS_InteractiveContext CurrentIC, + CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CAISNbrIsosDialog) + enum { IDD = IDD_AISNBRISOS }; + int m_Isosu; + int m_Isosv; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAISNbrIsosDialog) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CAISNbrIsosDialog) + afx_msg void OnDeltaposSpinaisisosu(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnDeltaposSpinaisisosv(NMHDR* pNMHDR, LRESULT* pResult); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +private: + void UpdateIsos (); + + Handle(AIS_InteractiveContext) myCurrentIC; + +}; + + +///////////////////////////////////////////////////////////////////////////// +// CDevCoeffDialog dialog + +#include + +class CDevCoeffDialog : public CDialog +{ +// Construction +public: + CDevCoeffDialog(Handle(AIS_InteractiveContext) CurrentIC, + CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CDevCoeffDialog) + enum { IDD = IDD_AISDC }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CDevCoeffDialog) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CDevCoeffDialog) + afx_msg void OnDcBig(); + afx_msg void OnDcDefault(); + afx_msg void OnDcSmall(); + afx_msg void OnDoubleclickedDcBig(); + afx_msg void OnDoubleclickedDcDefault(); + afx_msg void OnDoubleclickedDcSmall(); + afx_msg void OnDcVbig(); + afx_msg void OnDoubleclickedDcVbig(); + afx_msg void OnDcVsmall(); + afx_msg void OnDoubleclickedDcVsmall(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +private: + void RedisplaySelected (); + + Handle_AIS_InteractiveContext myCurrentIC; +}; + +*/ +class Standard_EXPORT CDialogMaterial : public CDialog +{ +// Construction +public: + CDialogMaterial(Handle(AIS_InteractiveContext) CurrentIC, + CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CDialogMaterial) + enum { IDD = IDD_AISMATERIAL }; + // NOTE: the ClassWizard will add data members here + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CDialogMaterial) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CDialogMaterial) + //afx_msg void OnMaterial(UINT nID); + afx_msg void OnObjectMaterialAluminium(); + afx_msg void OnObjectMaterialBrass(); + afx_msg void OnObjectMaterialBronze(); + afx_msg void OnObjectMaterialChrome(); + afx_msg void OnObjectMaterialCopper(); + afx_msg void OnObjectMaterialGold(); + afx_msg void OnObjectMaterialJade(); + afx_msg void OnObjectMaterialMetalized(); + afx_msg void OnObjectMaterialNeonGNC(); + afx_msg void OnObjectMaterialNeonPHC(); + afx_msg void OnObjectMaterialObsidian(); + afx_msg void OnObjectMaterialPewter(); + afx_msg void OnObjectMaterialPlastic(); + afx_msg void OnObjectMaterialPlaster(); + afx_msg void OnObjectMaterialSatin(); + afx_msg void OnObjectMaterialShinyPlastic(); + afx_msg void OnObjectMaterialSilver(); + afx_msg void OnObjectMaterialSteel(); + afx_msg void OnObjectMaterialStone(); + afx_msg void OnObjectMaterialDefault(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +private: + void SetMaterial (Graphic3d_NameOfMaterial Material); + + Handle_AIS_InteractiveContext myCurrentIC; + +}; + +class Standard_EXPORT CDialogTransparency : public CDialog +{ +// Construction +public: + CDialogTransparency(Handle_AIS_InteractiveContext CurrentIC, + CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CDialogTransparency) + enum { IDD = IDD_AISTRANSPARENCY }; + int m_TransValue; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CDialogTransparency) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CDialogTransparency) + afx_msg void OnDeltaposSpinaistransp(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnChangeEditaistransp(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +private: + Handle_AIS_InteractiveContext myCurrentIC; + +}; + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_AISNBRISOSDIALOG_H__AAD52722_6A63_11D1_8C62_00AA00D10994__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/ImportExport/ImportExport.cpp b/TAG_MFC-TIGLViewer/Common/ImportExport/ImportExport.cpp new file mode 100644 index 000000000..81a08f788 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/ImportExport/ImportExport.cpp @@ -0,0 +1,1046 @@ +// ImportExport.cpp: implementation of the CImportExport class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ImportExport.h" +#include + +#include "SaveCSFDBDlg.h" + +#include "SaveSTEPDlg.h" + +#include "TColStd_SequenceOfAsciiString.hxx" +#include "TColStd_SequenceOfExtendedString.hxx" +#include "OSD_Timer.hxx" + +#include "IGESControl_Reader.hxx" +#include "STEPControl_Controller.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include +#include +#include +#include + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +//#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +Handle(TopTools_HSequenceOfShape) CImportExport::BuildSequenceFromContext(const Handle(AIS_InteractiveContext)& anInteractiveContext) +{ + Handle(TopTools_HSequenceOfShape) aSequence = new TopTools_HSequenceOfShape(); + Handle(AIS_InteractiveObject) picked; + for(anInteractiveContext->InitCurrent();anInteractiveContext->MoreCurrent();anInteractiveContext->NextCurrent()) + { + picked = anInteractiveContext->Current(); + if (anInteractiveContext->Current()->IsKind(STANDARD_TYPE(AIS_Shape))) + { + TopoDS_Shape aShape = Handle(AIS_Shape)::DownCast(picked)->Shape(); + aSequence->Append(aShape); + } + } + return aSequence; +} + +//====================================================================== +//= = +//= BREP = +//= = +//====================================================================== + +int CImportExport::ReadBREP(const Handle_AIS_InteractiveContext& anInteractiveContext,LPCTSTR InitialDir /* = NULL*/) +{ + Handle(TopTools_HSequenceOfShape) aSequence = CImportExport::ReadBREP(InitialDir); + if(aSequence->IsEmpty()) + return 1; + Handle_AIS_Shape aShape; + for(int i=1;i<= aSequence->Length();i++){ + aShape = new AIS_Shape(aSequence->Value(i)); + anInteractiveContext->SetDisplayMode(aShape, 1, Standard_False); + anInteractiveContext->Display(aShape, Standard_False); + anInteractiveContext->SetCurrentObject(aShape, Standard_False); + } + return 0; +} + +Handle(TopTools_HSequenceOfShape) CImportExport::ReadBREP(LPCTSTR InitialDir /* = NULL*/) // not by reference --> the sequence is created here !! +{ + CFileDialog dlg(TRUE, + NULL, + NULL, + OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "BREP Files (*.brep , *.rle)|*.brep; *.BREP; *.rle; *.RLE; |All Files (*.*)|*.*||", + NULL ); + +TCHAR tchBuf[80]; + +CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL); +CString initdir = (CASROOTValue + "\\..\\data\\occ"); + +dlg.m_ofn.lpstrInitialDir = initdir; + + Handle(TopTools_HSequenceOfShape) aSequence= new TopTools_HSequenceOfShape(); + + if (dlg.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + CString filename = dlg.GetPathName(); + TopoDS_Shape aShape; + Standard_CString aFileName = (Standard_CString)(LPCTSTR)filename; + Standard_Boolean result = ReadBREP(aFileName,aShape); + if (result) + { + if (!BRepAlgo::IsValid(aShape)) + MessageBox(AfxGetMainWnd()->m_hWnd,"Warning: The shape is not valid!","Cascade Warning",MB_ICONWARNING); + aSequence->Append(aShape); + } + else + MessageBox(AfxGetMainWnd()->m_hWnd,"Error: The file was not read","Cascade Error",MB_ICONERROR); + + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + } + + return aSequence; +} +//---------------------------------------------------------------------- + +Standard_Boolean CImportExport::ReadBREP(const Standard_CString& aFileName, + TopoDS_Shape& aShape) +{ + BRep_Builder aBuilder; + Standard_Boolean result = BRepTools::Read(aShape,aFileName,aBuilder); + return result; +} + +void CImportExport::SaveBREP(const Handle_AIS_InteractiveContext& anInteractiveContext) +{ + anInteractiveContext->InitCurrent(); + if (anInteractiveContext->NbCurrents() == 0){ + AfxMessageBox("No shape selected for export!"); + return; + } + Handle(TopTools_HSequenceOfShape) aHSequenceOfShape; + aHSequenceOfShape = BuildSequenceFromContext(anInteractiveContext); + int aLength = aHSequenceOfShape->Length(); + if (aLength == 1){ + TopoDS_Shape RES = aHSequenceOfShape->Value(1); + CImportExport::SaveBREP(RES); + } else { + TopoDS_Compound RES; + BRep_Builder MKCP; + MKCP.MakeCompound(RES); + for (Standard_Integer i=1;i<=aLength;i++) + { + TopoDS_Shape aShape= aHSequenceOfShape->Value(i); + if ( aShape.IsNull() ) + { + continue; + } + MKCP.Add(RES, aShape); + } + CImportExport::SaveBREP(RES); + } +} + +Standard_Boolean CImportExport::SaveBREP(const TopoDS_Shape& aShape) +{ + CFileDialog dlg(FALSE,_T("*.brep"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "BREP Files (*.brep)|*.brep;|BREP Files (*.BREP)|*.BREP;||", NULL ); + +TCHAR tchBuf[80]; + +CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL); +CString initdir = (CASROOTValue + "\\..\\data\\occ"); + +dlg.m_ofn.lpstrInitialDir = initdir; + + Standard_Boolean result = Standard_False; + if (dlg.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + CString filename = dlg.GetPathName(); + Standard_CString aFileName = (Standard_CString)(LPCTSTR)filename; + result = SaveBREP(aFileName,aShape); + if (!result) + MessageBox(0,"Error : The shape or shapes were not saved.", + "CasCade Error",MB_ICONERROR); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + } + return result; +} + +//---------------------------------------------------------------------------------------- +Standard_Boolean CImportExport::SaveBREP(const Standard_CString& aFileName, + const TopoDS_Shape& aShape) +{ + Standard_Boolean result = BRepTools::Write(aShape,aFileName); + return result; +} + + +//====================================================================== +//= = +//= CSFDB = +//= = +//====================================================================== + + +TCollection_AsciiString CImportExport::BuildStorageErrorMessage( Storage_Error anError) + +{ + TCollection_AsciiString aMessage("Storage Status :"); + switch ( anError ) { + case Storage_VSOk : + aMessage += "no problem \n"; + break; + case Storage_VSOpenError : + aMessage += "OpenError while opening the stream \n"; + break; + case Storage_VSModeError : + aMessage += "the stream is opened with a wrong mode for operation \n"; + break; + case Storage_VSCloseError : + aMessage += "CloseError while closing the stream \n"; + break; + case Storage_VSAlreadyOpen : + aMessage += "stream is already opened \n"; + break; + case Storage_VSNotOpen : + aMessage += "stream not opened \n"; + break; + case Storage_VSSectionNotFound : + aMessage += "the section is not found \n"; + break; + case Storage_VSWriteError : + aMessage += "error during writing \n"; + break; + case Storage_VSFormatError : + aMessage += "wrong format error occured while reading \n"; + break; + case Storage_VSUnknownType : + aMessage += "try to read an unknown type \n"; + break; + case Storage_VSTypeMismatch : + aMessage += "try to read a wrong primitive type (read a char while expecting a real) \n"; + break; + case Storage_VSInternalError : + aMessage += "internal error \n "; + break; + case Storage_VSExtCharParityError : + aMessage += "problem with 16bit characters, may be an 8bit character is inserted inside a 16bit string \n"; + break; + default : + aMessage += "Unknown Status "; + aMessage += anError; + aMessage += " \n"; + break; + } + return aMessage; +} + +void CImportExport::ReadCSFDB(const Handle(AIS_InteractiveContext)& anInteractiveContext) +{ + Handle(TopTools_HSequenceOfShape) aSequence = CImportExport::ReadCSFDB(); + for(int i=1;i<= aSequence->Length();i++) + anInteractiveContext->Display(new AIS_Shape(aSequence->Value(i)), Standard_False); +} + +Handle(TopTools_HSequenceOfShape) CImportExport::ReadCSFDB() // not by reference --> the sequence is created here !! +{ + CFileDialog dlg(TRUE, + NULL, + NULL, + OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "CSFDB Files (*.CSFDB , *.csf)|*.csfdb; *.csf; |All Files (*.*)|*.*||", + NULL ); + +TCHAR tchBuf[80]; + +CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL); +CString initdir = (CASROOTValue + "\\..\\data\\csfdb"); + +dlg.m_ofn.lpstrInitialDir = initdir; + + Handle(TopTools_HSequenceOfShape) aSequence = new TopTools_HSequenceOfShape();; + if (dlg.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + CString filename = dlg.GetPathName(); + Standard_CString aFileName = (Standard_CString)(LPCTSTR)filename; + TCollection_AsciiString Message; + Standard_Boolean result = ReadCSFDB(aFileName,aSequence,Message); + if (result) + { + // Display The Message : + MessageBox(0,Message.ToCString(),"CasCade ",MB_OK); + + + } + else + MessageBox(0,Message.ToCString(),"CasCade Error",MB_ICONERROR); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + } + return aSequence; +} + +Standard_Boolean CImportExport::ReadCSFDB(const Standard_CString& aFileName, + Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, // out parameter + TCollection_AsciiString& ReturnMessage) // out parameter +{ + // an I/O driver + FSD_File f; + + // the applicative Schema + Handle(ShapeSchema) s = new ShapeSchema; + + // a Read/Write data object + Handle(Storage_Data) d = new Storage_Data; + + d->ClearErrorStatus(); + + // Check file type + if ( FSD_File::IsGoodFileType( aFileName ) != Storage_VSOk) { + ReturnMessage = "Bad file type for "; + ReturnMessage += aFileName; + ReturnMessage += " \n"; + return Standard_False; + } + + // Open the archive, Read mode + Storage_Error err = f.Open(aFileName, Storage_VSRead); + // Read all the persistent object in the file with the schema + if ( err != Storage_VSOk ) { + ReturnMessage += BuildStorageErrorMessage(d->ErrorStatus()); + return Standard_False; + } + + d = s->Read( f ); + err = d->ErrorStatus() ; + + if ( err != Storage_VSOk ) { + ReturnMessage += BuildStorageErrorMessage(d->ErrorStatus()); + return Standard_False; + } + // Close the file driver + f.Close(); + + ReturnMessage += "Application Name :"; ReturnMessage += d->ApplicationName();ReturnMessage += "\n"; + ReturnMessage += "Application Version :"; ReturnMessage += d->ApplicationVersion();ReturnMessage += "\n"; + ReturnMessage += "Data type :"; ReturnMessage += d->DataType();ReturnMessage += "\n"; + ReturnMessage += "== User Infos : ==\n"; + const TColStd_SequenceOfAsciiString& UserInfo = d->UserInfo(); + for (int i=1;i<=UserInfo.Length();i++) + {ReturnMessage += UserInfo(i);ReturnMessage += "\n";} + ReturnMessage += "== Comments : ==\n"; + const TColStd_SequenceOfExtendedString& Comments=d->Comments(); + for (int i=1;i<=Comments.Length();i++) + {ReturnMessage += Comments(i);ReturnMessage += "\n";} + ReturnMessage += "----------------\n"; + + + // Read all the root objects + // Get the root list + Handle(Storage_HSeqOfRoot) roots = d->Roots(); + Handle(Standard_Persistent) p; + Handle(Storage_Root) r; + Handle(PTopoDS_HShape) aPShape; + for (int i = 1; i <= roots->Length() ; i++ ) + { + // Get the root + r = roots->Value(i); + + // Get the persistent application object from the root + p = r->Object(); + + // Display information + ReturnMessage += "Persistent Object "; ReturnMessage += i; ReturnMessage += "\n"; + ReturnMessage += "Name :"; ReturnMessage += r->Name(); ReturnMessage += "\n"; + ReturnMessage += "Type :"; ReturnMessage += r->Type(); ReturnMessage += "\n"; + + aPShape = Handle(PTopoDS_HShape)::DownCast(p); + + if ( !aPShape.IsNull() ) + { + // To Be ReWriten to suppress the cout, + // and provide a CallBack method for dynamic information. + // Get the persistent shape + PTColStd_PersistentTransientMap aMap; + TopoDS_Shape aTShape; + MgtBRep::Translate(aPShape,aMap,aTShape, + MgtBRep_WithTriangle); + aHSequenceOfShape->Append(aTShape); + } + else + { + ReturnMessage += "Error -> Unable to read\n"; + } + } + return Standard_True; +} +//---------------------------------------------------------------------- +void CImportExport::SaveCSFDB(const Handle(AIS_InteractiveContext)& anInteractiveContext) +{ + anInteractiveContext->InitCurrent(); + if (anInteractiveContext->NbCurrents() == 0){ + AfxMessageBox("No shape selected for export!"); + return; + } + CImportExport::SaveCSFDB(BuildSequenceFromContext(anInteractiveContext)); +} + +Standard_Boolean CImportExport::SaveCSFDB(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) +{ + Standard_Boolean result = Standard_False; + CFileSaveCSFDBDialog aDlg(NULL); + aDlg.m_TriangleMode = MgtBRep_WithTriangle; + if (aDlg.DoModal() == IDOK) { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + CString filename = aDlg.GetPathName(); + Standard_CString aFileName = (Standard_CString)(LPCTSTR)filename; + TCollection_AsciiString Message; + MgtBRep_TriangleMode selection = aDlg.m_TriangleMode; + Standard_Boolean result = SaveCSFDB(aFileName,aHSequenceOfShape,Message); + if (result) + { + // Display The Message : + MessageBox(0,Message.ToCString(),"CasCade ",MB_OK); + } + else + MessageBox(0,Message.ToCString(),"CasCade Error",MB_ICONERROR); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + } + return result; +} + +Standard_Boolean CImportExport::SaveCSFDB(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, + TCollection_AsciiString& ReturnMessage,// out parameter + MgtBRep_TriangleMode aTriangleMode /* = MgtBRep_WithTriangle */) +{ + Standard_Boolean ReturnValue = Standard_True; + if (aHSequenceOfShape->Length() == 0) + { + MessageBox(0,"No Shape in the HSequence!!","CasCade Warning",MB_ICONWARNING); + return Standard_False; + } + + // an I/O driver + FSD_File f; + + // the applicative Schema containing + // Pesistent Topology and Geometry + Handle(ShapeSchema) s = new ShapeSchema; + + // a Read/Write data object + Handle(Storage_Data) d = new Storage_Data; + + d->ClearErrorStatus(); + + // To Be ReWriten to suppress the Strings, + // and provide a CallBack method for dynamic information. + + d->SetApplicationName (TCollection_ExtendedString("SampleImportExport")); + d->SetApplicationVersion("1"); + d->SetDataType(TCollection_ExtendedString("Shapes")); + d->AddToUserInfo("Try to store a Persistent set of Shapes in a flat file"); + d->AddToComments(TCollection_ExtendedString("application is based on CasCade 2.0")); + + // Open the archive, Write mode + Storage_Error err = f.Open(aFileName, Storage_VSWrite); + + if ( err != Storage_VSOk ) { + ReturnMessage += BuildStorageErrorMessage(err); + return Standard_False; + } + + PTColStd_TransientPersistentMap aMap; + ReturnMessage += "The Object have be saved in the file "; + ReturnMessage += aFileName; + ReturnMessage += "\n with the names : "; + + for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++) + { + TopoDS_Shape aTShape= aHSequenceOfShape->Value(i); + TCollection_AsciiString anObjectName("anObjectName_"); + anObjectName += i; + ReturnMessage += anObjectName; + ReturnMessage += " \n"; + + if ( aTShape.IsNull() ) + { + ReturnMessage += " Error : Invalid shape \n"; + ReturnValue = Standard_False; + continue; + } + + //Create the persistent Shape + + Handle(PTopoDS_HShape) aPShape = + MgtBRep::Translate(aTShape, aMap, MgtBRep_WithTriangle); + + + // Add the object in the data structure as root + // To Be ReWriten to suppress the cout, + // and provide a CallBack method for dynamic information. + d->AddRoot(anObjectName, aPShape); + } + + // Write the object in the file with the schema + s->Write( f, d); + + // Close the driver + f.Close(); + + if ( d->ErrorStatus() != Storage_VSOk ) + { + ReturnMessage += BuildStorageErrorMessage(d->ErrorStatus()); + return Standard_False; + } + return ReturnValue; +} + + +//====================================================================== +//= = +//= IGES = +//= = +//====================================================================== + + + +void CImportExport::ReadIGES(const Handle(AIS_InteractiveContext)& anInteractiveContext) +{ + Handle(TopTools_HSequenceOfShape) aSequence = CImportExport::ReadIGES(); + for(int i=1;i<= aSequence->Length();i++) + anInteractiveContext->Display(new AIS_Shape(aSequence->Value(i))); + +} + +Handle(TopTools_HSequenceOfShape) CImportExport::ReadIGES()// not by reference --> the sequence is created here !! +{ + CFileDialog dlg(TRUE, + NULL, + NULL, + OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "IGES Files (*.iges , *.igs)|*.iges; *.igs|All Files (*.*)|*.*||", + NULL ); + +TCHAR tchBuf[80]; + +CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL); +CString initdir = (CASROOTValue + "\\..\\data\\iges"); + +dlg.m_ofn.lpstrInitialDir = initdir; + + Handle(TopTools_HSequenceOfShape) aSequence = new TopTools_HSequenceOfShape(); + if (dlg.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + CString C = dlg.GetPathName(); + Standard_CString aFileName = (Standard_CString)(LPCTSTR)C; + Standard_Integer status = ReadIGES(aFileName,aSequence); + if (status != IFSelect_RetDone) + { + MessageBox(0,"Error : The file is not read","CasCade Error",MB_ICONERROR); + } + + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + } + return aSequence; +} +//---------------------------------------------------------------------- + +Standard_Integer CImportExport::ReadIGES(const Standard_CString& aFileName, + Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) +{ + + IGESControl_Reader Reader; + + Standard_Integer status = Reader.ReadFile(aFileName); + + if (status != IFSelect_RetDone) return status; + Reader.TransferRoots(); + TopoDS_Shape aShape = Reader.OneShape(); + aHSequenceOfShape->Append(aShape); + + return status; +} +//---------------------------------------------------------------------- + +void CImportExport::SaveIGES(const Handle(AIS_InteractiveContext)& anInteractiveContext) +{ + anInteractiveContext->InitCurrent(); + if (anInteractiveContext->NbCurrents() == 0){ + AfxMessageBox("No shape selected for export!"); + return; + } + CImportExport::SaveIGES(BuildSequenceFromContext(anInteractiveContext)); +} + +Standard_Boolean CImportExport::SaveIGES(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) +{ + if (aHSequenceOfShape->Length() == 0) + { + MessageBox(0,"No Shape in the HSequence!!","CasCade Warning",MB_ICONWARNING); + return Standard_False; + } + + CFileDialog dlg(FALSE,_T("*.iges"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "IGES Files (*.iges )|*.iges;|IGES Files (*.igs )| *.igs;||", NULL ); + +TCHAR tchBuf[80]; + +CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL); +CString initdir = (CASROOTValue + "\\..\\data\\iges"); + +dlg.m_ofn.lpstrInitialDir = initdir; + + Standard_Boolean result=Standard_False; + if (dlg.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + CString C = dlg.GetPathName(); + Standard_CString aFileName = (Standard_CString)(LPCTSTR)C; + + + result = SaveIGES(aFileName,aHSequenceOfShape); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + } + return result; +} +//---------------------------------------------------------------------- + +Standard_Boolean CImportExport::SaveIGES(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) +{ + + IGESControl_Controller::Init(); + IGESControl_Writer ICW (Interface_Static::CVal("XSTEP.iges.unit"), + Interface_Static::IVal("XSTEP.iges.writebrep.mode")); + + for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++) + ICW.AddShape (aHSequenceOfShape->Value(i)); + + ICW.ComputeModel(); + Standard_Boolean result = ICW.Write(aFileName ); + return result; +} + +//====================================================================== + +//====================================================================== +//= = +//= STEP = +//= = +//====================================================================== + +void CImportExport::ReadSTEP(const Handle(AIS_InteractiveContext)& anInteractiveContext) +{ + Handle(TopTools_HSequenceOfShape) aSequence = CImportExport::ReadSTEP(); + if (!aSequence.IsNull()) { + for(int i=1;i<= aSequence->Length();i++) + anInteractiveContext->Display(new AIS_Shape(aSequence->Value(i)), Standard_False); + } +} + +Handle(TopTools_HSequenceOfShape) CImportExport::ReadSTEP()// not by reference --> the sequence is created here !! +{ + CFileDialog dlg(TRUE, + NULL, + NULL, + OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "STEP Files (*.stp;*.step)|*.stp; *.step|All Files (*.*)|*.*||", + NULL ); + +TCHAR tchBuf[80]; + +CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL); +CString initdir = (CASROOTValue + "\\..\\data\\step"); + +dlg.m_ofn.lpstrInitialDir = initdir; + + Handle(TopTools_HSequenceOfShape) aSequence= new TopTools_HSequenceOfShape(); + if (dlg.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + CString C = dlg.GetPathName(); + Standard_CString aFileName = (Standard_CString)(LPCTSTR)C; + IFSelect_ReturnStatus ReturnStatus = ReadSTEP(aFileName,aSequence); + switch (ReturnStatus) + { + case IFSelect_RetError : + MessageBox(0,"Not a valid Step file","ERROR",MB_ICONWARNING); + break; + case IFSelect_RetFail : + MessageBox(0,"Reading has failed","ERROR",MB_ICONWARNING); + break; + case IFSelect_RetVoid : + MessageBox(0,"Nothing to transfer","ERROR",MB_ICONWARNING); + break; + } + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + } + return aSequence; +} + +IFSelect_ReturnStatus CImportExport::ReadSTEP(const Standard_CString& aFileName, + Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) +{ + + TopoDS_Shape aShape; + + STEPControl_Reader aReader; + + IFSelect_ReturnStatus status = aReader.ReadFile(aFileName); + if (status == IFSelect_RetDone){ + Standard_CString LogFileName = "ReadStepFile.log"; + + //Interface_TraceFile::SetDefault(2,LogFileName,Standard_True); + + Standard_Boolean failsonly = Standard_False; + aReader.PrintCheckLoad + (failsonly, IFSelect_ItemsByEntity); + // Root transfers + Standard_Integer nbr = aReader.NbRootsForTransfer(); + aReader.PrintCheckTransfer (failsonly, IFSelect_ItemsByEntity); + for ( Standard_Integer n = 1; n<= nbr; n++) + {Standard_Boolean ok = aReader.TransferRoot(n); + // Collecting resulting entities + Standard_Integer nbs = aReader.NbShapes(); + if (nbs == 0) { + aHSequenceOfShape.Nullify(); + return IFSelect_RetVoid; + } else { + for (Standard_Integer i =1; i<=nbs; i++) { + aShape=aReader.Shape(i); + aHSequenceOfShape->Append(aShape); + }}}} + else{ + aHSequenceOfShape.Nullify(); + } + return status; + + +} +//---------------------------------------------------------------------- +void CImportExport::SaveSTEP(const Handle(AIS_InteractiveContext)& anInteractiveContext) +{ + anInteractiveContext->InitCurrent(); + if (anInteractiveContext->NbCurrents() == 0){ + AfxMessageBox("No shape selected for export!"); + return; + } + CImportExport::SaveSTEP(BuildSequenceFromContext(anInteractiveContext)); +} + +// Return True if no error +Standard_Boolean TestFacetedBrep(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) +{ + Standard_Boolean OneErrorFound = Standard_False; + for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++) + { + TopoDS_Shape aShape= aHSequenceOfShape->Value(i); + + TopExp_Explorer Ex(aShape,TopAbs_FACE); + while (Ex.More() && !OneErrorFound) + { + // Get the Geom_Surface outside the TopoDS_Face + Handle(Geom_Surface) aSurface = BRep_Tool::Surface(TopoDS::Face(Ex.Current())); + // check if it is a plane. + if (!aSurface->IsKind(STANDARD_TYPE(Geom_Plane))) + OneErrorFound=Standard_True; + Ex.Next(); + } + TopExp_Explorer Ex2(aShape,TopAbs_EDGE); + while (Ex2.More() && !OneErrorFound) + { + // Get the Geom_Curve outside the TopoDS_Face + Standard_Real FirstDummy,LastDummy; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(Ex2.Current()),FirstDummy,LastDummy); + // check if it is a line. + if (!aCurve->IsKind(STANDARD_TYPE(Geom_Line))) + OneErrorFound=Standard_True; + Ex2.Next(); + } + } + return !OneErrorFound; +} + +IFSelect_ReturnStatus CImportExport::SaveSTEP(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) +{ + if (aHSequenceOfShape->Length() == 0) + { + MessageBox(0,"No Shape in the HSequence!!","CasCade Warning",MB_ICONWARNING); + return IFSelect_RetError; + } + + IFSelect_ReturnStatus status; + + CFileSaveSTEPDialog aDlg(NULL); + + aDlg.m_Cc1ModelType = STEPControl_ManifoldSolidBrep; + + if (aDlg.DoModal() == IDOK) { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + CString C = aDlg.GetPathName(); + Standard_CString aFileName = (Standard_CString)(LPCTSTR)C; + + STEPControl_StepModelType selection = aDlg.m_Cc1ModelType; + + if(selection == STEPControl_FacetedBrep) + + if (!TestFacetedBrep(aHSequenceOfShape)) + { + MessageBox(0,"At least one shape doesn't contain facetes","CasCade Warning",MB_ICONWARNING); + return IFSelect_RetError; + } + + + status = SaveSTEP(aFileName,aHSequenceOfShape,selection); + switch (status) + { + case IFSelect_RetError: + MessageBox(0,"Incorrect Data","ERROR",MB_ICONWARNING); + break; + case IFSelect_RetFail: + MessageBox(0,"Writing has failed","ERROR",MB_ICONWARNING); + break; + case IFSelect_RetVoid: + MessageBox(0,"Nothing to transfer","ERROR",MB_ICONWARNING); + break; + } + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + } + return status; +} +//---------------------------------------------------------------------------------------- +IFSelect_ReturnStatus CImportExport::SaveSTEP(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, + +const STEPControl_StepModelType aValue /* =TopoDSToCc1Act_ManifoldSolidBrep */ ) + +{ + // CREATE THE WRITER + + STEPControl_Writer aWriter; + + IFSelect_ReturnStatus status; + for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++) + { + status = aWriter.Transfer(aHSequenceOfShape->Value(i), aValue); + if ( status != IFSelect_RetDone ) return status; + } + status = aWriter.Write(aFileName); + return status; +} + + + +//====================================================================== +//= = +//= STL = +//= = +//====================================================================== + +void CImportExport::SaveSTL(const Handle(AIS_InteractiveContext)& anInteractiveContext) +{ + anInteractiveContext->InitCurrent(); + if (anInteractiveContext->NbCurrents() == 0){ + AfxMessageBox("No shape selected for export!"); + return; + } + CImportExport::SaveSTL(BuildSequenceFromContext(anInteractiveContext)); +} + +Standard_Boolean CImportExport::SaveSTL(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) +{ + CFileDialog dlg(FALSE,_T("*.stl"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "stl Files (*.stl)|*.stl;|STL Files (*.STL)|*.STL;||", NULL ); + +TCHAR tchBuf[80]; + +CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL); +CString initdir = (CASROOTValue + "\\..\\data\\stl"); + +dlg.m_ofn.lpstrInitialDir = initdir; + + Standard_Boolean result; + + if (dlg.DoModal() == IDOK) { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + CString C = dlg.GetPathName(); + Standard_CString aFileName = (Standard_CString)(LPCTSTR)C; + TCollection_AsciiString Message; + result = SaveSTL(aFileName,aHSequenceOfShape,Message); + if (result) + { + // Display The Message : + MessageBox(0,Message.ToCString(),"CasCade ",MB_OK); + } + else + MessageBox(0,Message.ToCString(),"CasCade Error",MB_ICONERROR); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + } + return result; +} + +Standard_Boolean CImportExport::SaveSTL(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, + TCollection_AsciiString& ReturnMessage) +{ + Standard_Boolean ReturnValue = Standard_True; + if (aHSequenceOfShape->Length() == 0) + { + MessageBox(0,"No Shape in the HSequence!!","CasCade Warning",MB_ICONWARNING); + return Standard_False; + } + + PTColStd_TransientPersistentMap aMap; + ReturnMessage += "The Object have be saved in the file "; + ReturnMessage += aFileName; + ReturnMessage += "\n with the names : "; + + TopoDS_Compound RES; + BRep_Builder MKCP; + MKCP.MakeCompound(RES); + + for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++) + { + TopoDS_Shape aShape= aHSequenceOfShape->Value(i); + TCollection_AsciiString anObjectName("anObjectName_"); + anObjectName += i; + ReturnMessage += anObjectName; + ReturnMessage += " \n"; + + if ( aShape.IsNull() ) + { + ReturnMessage += " Error : Invalid shape \n"; + ReturnValue = Standard_False; + continue; + } + + MKCP.Add(RES, aShape); + } + + StlAPI_Writer myStlWriter; + myStlWriter.Write(RES, aFileName); + + return ReturnValue; +} + + +//====================================================================== +//= = +//= VRML = +//= = +//====================================================================== + +void CImportExport::SaveVRML(const Handle(AIS_InteractiveContext)& anInteractiveContext) +{ + anInteractiveContext->InitCurrent(); + if (anInteractiveContext->NbCurrents() == 0){ + AfxMessageBox("No shape selected for export!"); + return; + } + CImportExport::SaveVRML(BuildSequenceFromContext(anInteractiveContext)); +} + +Standard_Boolean CImportExport::SaveVRML(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape) +{ + CFileDialog dlg(FALSE,_T("*.vrml"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "vrml Files (*.vrml)|*.vrml;|vrm Files (*.vrm)|*.vrm;||", NULL ); + +TCHAR tchBuf[80]; + +CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL); +CString initdir = (CASROOTValue + "\\..\\data\\vrml"); + +dlg.m_ofn.lpstrInitialDir = initdir; + + Standard_Boolean result; + + if (dlg.DoModal() == IDOK) { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + CString C = dlg.GetPathName(); + Standard_CString aFileName = (Standard_CString)(LPCTSTR)C; + TCollection_AsciiString Message; + result = SaveVRML(aFileName,aHSequenceOfShape,Message); + if (result) + { + // Display The Message : + MessageBox(0,Message.ToCString(),"CasCade ",MB_OK); + } + else + MessageBox(0,Message.ToCString(),"CasCade Error",MB_ICONERROR); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + } + return result; +} + +Standard_Boolean CImportExport::SaveVRML(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, + TCollection_AsciiString& ReturnMessage) +{ + Standard_Boolean ReturnValue = Standard_True; + if (aHSequenceOfShape->Length() == 0) + { + MessageBox(0,"No Shape in the HSequence!!","CasCade Warning",MB_ICONWARNING); + return Standard_False; + } + + PTColStd_TransientPersistentMap aMap; + ReturnMessage += "The Object have be saved in the file "; + ReturnMessage += aFileName; + ReturnMessage += "\n with the names : "; + + TopoDS_Compound RES; + BRep_Builder MKCP; + MKCP.MakeCompound(RES); + + for (Standard_Integer i=1;i<=aHSequenceOfShape->Length();i++) + { + TopoDS_Shape aShape= aHSequenceOfShape->Value(i); + TCollection_AsciiString anObjectName("anObjectName_"); + anObjectName += i; + ReturnMessage += anObjectName; + ReturnMessage += " \n"; + + if ( aShape.IsNull() ) + { + ReturnMessage += " Error : Invalid shape \n"; + ReturnValue = Standard_False; + continue; + } + + MKCP.Add(RES, aShape); + } + + VrmlAPI_Writer myVrmlWriter; + myVrmlWriter.Write(RES, aFileName); + + return ReturnValue; +} + + diff --git a/TAG_MFC-TIGLViewer/Common/ImportExport/ImportExport.h b/TAG_MFC-TIGLViewer/Common/ImportExport/ImportExport.h new file mode 100644 index 000000000..ffc138283 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/ImportExport/ImportExport.h @@ -0,0 +1,105 @@ +// ImportExport.h: interface for the CImportExport class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_IMPORTEXPORT_H__BAA02E6B_A948_11D1_8DA6_0800369C8A03__INCLUDED_) +#define AFX_IMPORTEXPORT_H__BAA02E6B_A948_11D1_8DA6_0800369C8A03__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include +#include +#include +#include + +#include + +class Standard_EXPORT CImportExport +{ +public: + + CImportExport() {}; + virtual ~CImportExport(){}; + +private : + static Handle(TopTools_HSequenceOfShape) BuildSequenceFromContext(const Handle(AIS_InteractiveContext)& anInteractiveContext); + +public : + + //====================================================================== + // return is HSequence to be able to select a set of files + static int ReadBREP(const Handle_AIS_InteractiveContext& anInteractiveContext, LPCTSTR InitialDir = NULL); + static Handle_TopTools_HSequenceOfShape ReadBREP(LPCTSTR InitialDir = NULL); // not by reference --> the sequence is created here !! + static Standard_Boolean ReadBREP(const Standard_CString& aFileName, + TopoDS_Shape& aShape); + + //---------------------------------------------------------------------- + static void SaveBREP(const Handle_AIS_InteractiveContext& anInteractiveContext); + static Standard_Boolean SaveBREP(const TopoDS_Shape& aShape); + static Standard_Boolean SaveBREP(const Standard_CString& aFileName, + const TopoDS_Shape& aShape); + + + static TCollection_AsciiString BuildStorageErrorMessage( Storage_Error anError); + + static void ReadCSFDB(const Handle(AIS_InteractiveContext)& anInteractiveContext); + static Handle(TopTools_HSequenceOfShape) ReadCSFDB(); // not by reference --> the sequence is created here !! + static Standard_Boolean ReadCSFDB(const Standard_CString& aFileName, + Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, // out parameter + TCollection_AsciiString& ReturnMessage);// out parameter + //---------------------------------------------------------------------- + + static void SaveCSFDB(const Handle(AIS_InteractiveContext)& anInteractiveContext); + static Standard_Boolean SaveCSFDB(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + static Standard_Boolean SaveCSFDB(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, + TCollection_AsciiString& ReturnMessage, // out parameter + const MgtBRep_TriangleMode aTriangleMode = MgtBRep_WithTriangle); + //====================================================================== + + static void ReadIGES(const Handle(AIS_InteractiveContext)& anInteractiveContext); + static Handle(TopTools_HSequenceOfShape) ReadIGES(); // not by reference --> the sequence is created here !! + static Standard_Integer ReadIGES(const Standard_CString& aFileName, + Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + //---------------------------------------------------------------------- + static void SaveIGES(const Handle(AIS_InteractiveContext)& anInteractiveContext); + static Standard_Boolean SaveIGES(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + static Standard_Boolean SaveIGES(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + + //====================================================================== + + static void ReadSTEP(const Handle(AIS_InteractiveContext)& anInteractiveContext); + static Handle(TopTools_HSequenceOfShape) ReadSTEP(); // not by reference --> the sequence is created here !! + static IFSelect_ReturnStatus ReadSTEP(const Standard_CString& aFileName, + Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + //---------------------------------------------------------------------- + static void SaveSTEP(const Handle(AIS_InteractiveContext)& anInteractiveContext); + static IFSelect_ReturnStatus SaveSTEP(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + static IFSelect_ReturnStatus SaveSTEP(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, + + const STEPControl_StepModelType aValue = STEPControl_ManifoldSolidBrep); + + static void ReadSAT(const Handle(AIS_InteractiveContext)& anInteractiveContext); + static Handle(TopTools_HSequenceOfShape) ReadSAT(); // not by reference --> the sequence is created here !! + static IFSelect_ReturnStatus ReadSAT(const Standard_CString& aFileName, + Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + //---------------------------------------------------------------------- + static Standard_Boolean SaveSTL(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, + TCollection_AsciiString& ReturnMessage); + static Standard_Boolean SaveSTL(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + static void SaveSTL(const Handle(AIS_InteractiveContext)& anInteractiveContext); + //---------------------------------------------------------------------- + static Standard_Boolean SaveVRML(const Standard_CString& aFileName, + const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape, + TCollection_AsciiString& ReturnMessage); + static Standard_Boolean SaveVRML(const Handle(TopTools_HSequenceOfShape)& aHSequenceOfShape); + static void SaveVRML(const Handle(AIS_InteractiveContext)& anInteractiveContext); + +}; + +#endif // !defined(AFX_IMPORTEXPORT_H__BAA02E6B_A948_11D1_8DA6_0800369C8A03__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/ImportExport/SaveCSFDBDlg.cpp b/TAG_MFC-TIGLViewer/Common/ImportExport/SaveCSFDBDlg.cpp new file mode 100644 index 000000000..c305aadd3 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/ImportExport/SaveCSFDBDlg.cpp @@ -0,0 +1,76 @@ +// FileSaveIgesDialog.cpp : implementation file +// + +#include "stdafx.h" + +#include "SaveCSFDBDlg.h" + +#include + +///////////////////////////////////////////////////////////////////////////// +// CFileSaveCSFDBDialog dialog + + +CFileSaveCSFDBDialog::CFileSaveCSFDBDialog(CWnd* pParent /*=NULL*/) + : CFileDialog(FALSE,_T("*.csfdb"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + _T("CSFDB Files (*.csfdb)|*.csfdb;|CSFDB Files (*.csf)|*.csf;||"), + pParent) + +{ + //{{AFX_DATA_INIT(CFileSaveCSFDBDialog) + m_TriangleMode = MgtBRep_WithTriangle; + //}}AFX_DATA_INIT + TCHAR tchBuf[80]; + +CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL); +CString initdir = (CASROOTValue + "\\..\\data\\csfdb"); + + m_ofn.lpstrInitialDir = initdir; + + m_ofn.Flags |= OFN_ENABLETEMPLATE; + m_ofn.lpTemplateName = MAKEINTRESOURCE(CFileSaveCSFDBDialog::IDD); + m_ofn.lpstrTitle = _T("Save as CSFDB File"); + +} + + +void CFileSaveCSFDBDialog::DoDataExchange(CDataExchange* pDX) +{ + CFileDialog::DoDataExchange(pDX); + int TheTriangleMode = (int)m_TriangleMode; + + //{{AFX_DATA_MAP(CFileSaveCSFDBDialog) + DDX_Control(pDX, IDC_FSaveCSFDB_Type, m_SaveTypeCombo); + DDX_CBIndex(pDX, IDC_FSaveCSFDB_Type, TheTriangleMode); + //}}AFX_DATA_MAP + +} + + +BEGIN_MESSAGE_MAP(CFileSaveCSFDBDialog, CFileDialog) + //{{AFX_MSG_MAP(CFileSaveCSFDBDialog) + ON_WM_CLOSE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CFileSaveCSFDBDialog message handlers + +BOOL CFileSaveCSFDBDialog::OnInitDialog() +{ + + BOOL bRet = CFileDialog::OnInitDialog(); + m_SaveTypeCombo.InsertString(-1,"WithTriangle"); + m_SaveTypeCombo.InsertString(-1,"WithoutTriangle"); + m_SaveTypeCombo.SetCurSel(m_TriangleMode); + + return bRet; +} + +BOOL CFileSaveCSFDBDialog::OnFileNameOK() +{ + ASSERT_VALID(this); + UpdateData(TRUE); + // Do not call Default() if you override + return FALSE; +} diff --git a/TAG_MFC-TIGLViewer/Common/ImportExport/SaveCSFDBDlg.h b/TAG_MFC-TIGLViewer/Common/ImportExport/SaveCSFDBDlg.h new file mode 100644 index 000000000..99c6a0c9c --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/ImportExport/SaveCSFDBDlg.h @@ -0,0 +1,53 @@ +// FileSaveIgesDialog.h : header file +// + +#if !defined(AFX_FILESAVECSFDBDIALOG_H__B7D13C78_AB88_11D1_B97B_444553540000__INCLUDED_) +#define AFX_FILESAVECSFDBDIALOG_H__B7D13C78_AB88_11D1_B97B_444553540000__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include "MgtBRep_TriangleMode.hxx" +#include + +#include + +///////////////////////////////////////////////////////////////////////////// +// CFileSaveCSFDBDialog dialog + +class Standard_EXPORT CFileSaveCSFDBDialog : public CFileDialog +{ +// Construction +public: + CFileSaveCSFDBDialog(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CFileSaveCSFDBDialog) + enum { IDD = IDD_FILESAVECSFDB }; + CComboBox m_SaveTypeCombo; + MgtBRep_TriangleMode m_TriangleMode; + //}}AFX_DATA + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CFileSaveCSFDBDialog) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual BOOL OnFileNameOK(); + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CFileSaveCSFDBDialog) + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_FILESAVECSFDBDIALOG_H__B7D13C78_AB88_11D1_B97B_444553540000__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/ImportExport/SaveSTEPDlg.cpp b/TAG_MFC-TIGLViewer/Common/ImportExport/SaveSTEPDlg.cpp new file mode 100644 index 000000000..1fe0e561c --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/ImportExport/SaveSTEPDlg.cpp @@ -0,0 +1,89 @@ +// FileSaveStepDialog.cpp : implementation file +// + +#include "stdafx.h" + +#include "SaveSTEPDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// CFileSaveSTEPDialog dialog + + +CFileSaveSTEPDialog::CFileSaveSTEPDialog(CWnd* pParent /*=NULL*/) + : CFileDialog(FALSE,_T("*.STEP"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + _T("STEP Files (*.step)|*.step;|STEP Files (*.stp)|*.stp;||"), + pParent) +{ + + //{{AFX_DATA_INIT(CFileSaveSTEPDialog) + m_Cc1ModelType = STEPControl_ManifoldSolidBrep; + //}}AFX_DATA_INIT + m_ofn.Flags |= OFN_ENABLETEMPLATE; + m_ofn.lpTemplateName = MAKEINTRESOURCE(CFileSaveSTEPDialog::IDD); + m_ofn.lpstrTitle = _T("Save as STEP File"); +} + +void CFileSaveSTEPDialog::DoDataExchange(CDataExchange* pDX) +{ + CFileDialog::DoDataExchange(pDX); + if (!pDX->m_bSaveAndValidate) + { + + if (m_Cc1ModelType==STEPControl_ManifoldSolidBrep) m_DialogType=0; + if (m_Cc1ModelType==STEPControl_BrepWithVoids) Standard_Failure::Raise("unsupported enumeration terme"); + if (m_Cc1ModelType==STEPControl_FacetedBrep) m_DialogType=1; + if (m_Cc1ModelType==STEPControl_FacetedBrepAndBrepWithVoids) Standard_Failure::Raise("unsupported enumeration terme"); + if (m_Cc1ModelType==STEPControl_ShellBasedSurfaceModel) m_DialogType=2; + if (m_Cc1ModelType==STEPControl_GeometricCurveSet) m_DialogType=3; + + } + //{{AFX_DATA_MAP(CFileSaveSTEPDialog) + DDX_Control(pDX, IDC_FSaveSTEP_Type, m_SaveTypeCombo); + DDX_CBIndex(pDX, IDC_FSaveSTEP_Type, m_DialogType ); + //}}AFX_DATA_MAP + + if (pDX->m_bSaveAndValidate) + { + + if (m_DialogType==0) m_Cc1ModelType=STEPControl_ManifoldSolidBrep; + + if (m_DialogType==1) m_Cc1ModelType=STEPControl_FacetedBrep; + + if (m_DialogType==2) m_Cc1ModelType=STEPControl_ShellBasedSurfaceModel; + if (m_DialogType==3) m_Cc1ModelType=STEPControl_GeometricCurveSet; + + } +} + +BEGIN_MESSAGE_MAP(CFileSaveSTEPDialog, CFileDialog) + //{{AFX_MSG_MAP(CFileSaveSTEPDialog) + ON_WM_CLOSE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CFileSaveSTEPDialog message handlers + +BOOL CFileSaveSTEPDialog::OnInitDialog() +{ + + BOOL bRet = CFileDialog::OnInitDialog(); + m_SaveTypeCombo.InsertString(-1,"ManifoldSolidBrep"); + + m_SaveTypeCombo.InsertString(-1,"FacetedBrep"); + + m_SaveTypeCombo.InsertString(-1,"ShellBasedSurfaceModel"); + m_SaveTypeCombo.InsertString(-1,"GeometricCurveSet"); + m_SaveTypeCombo.SetCurSel(m_DialogType); + + return bRet; +} + +BOOL CFileSaveSTEPDialog::OnFileNameOK() +{ + ASSERT_VALID(this); + UpdateData(TRUE); + + // Do not call Default() if you override + return FALSE; +} diff --git a/TAG_MFC-TIGLViewer/Common/ImportExport/SaveSTEPDlg.h b/TAG_MFC-TIGLViewer/Common/ImportExport/SaveSTEPDlg.h new file mode 100644 index 000000000..a0b81f488 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/ImportExport/SaveSTEPDlg.h @@ -0,0 +1,56 @@ +#if !defined(AFX_FILESAVESTEPDIALOG_H__B7D13C78_AB88_11D1_B97B_444553540000__INCLUDED_) +#define AFX_FILESAVESTEPDIALOG_H__B7D13C78_AB88_11D1_B97B_444553540000__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 +// FileSaveIgesDialog.h : header file +// + +#include "STEPControl_StepModelType.hxx" + +#include + +#include + +///////////////////////////////////////////////////////////////////////////// +// CFileSaveSTEPDialog dialog + +class Standard_EXPORT CFileSaveSTEPDialog : public CFileDialog +{ +// Construction +public: + CFileSaveSTEPDialog(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CFileSaveSTEPDialog) + enum { IDD = IDD_FILESAVESTEP }; + CComboBox m_SaveTypeCombo; + + STEPControl_StepModelType m_Cc1ModelType; + + int m_DialogType; + //}}AFX_DATA + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CFileSaveSTEPDialog) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual BOOL OnFileNameOK(); + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CFileSaveSTEPDialog) + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_FILESAVESTEPDIALOG_H__B7D13C78_AB88_11D1_B97B_444553540000__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/OCC_3dApp.cpp b/TAG_MFC-TIGLViewer/Common/OCC_3dApp.cpp new file mode 100644 index 000000000..41000051a --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_3dApp.cpp @@ -0,0 +1,26 @@ +// OCC_3dApp.cpp: implementation of the OCC_3dApp class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "OCC_3dApp.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +OCC_3dApp::OCC_3dApp() +{ + try + {myGraphicDevice = new Graphic3d_WNTGraphicDevice();} + catch(Standard_Failure) + { + AfxMessageBox("Fatal error during graphic initialization",MB_ICONSTOP); + ExitProcess(1); + } +} + +OCC_3dApp::~OCC_3dApp() +{ + +} diff --git a/TAG_MFC-TIGLViewer/Common/OCC_3dApp.h b/TAG_MFC-TIGLViewer/Common/OCC_3dApp.h new file mode 100644 index 000000000..7bb73db4a --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_3dApp.h @@ -0,0 +1,27 @@ +// OCC_3dApp.h: interface for the OCC_3dApp class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OCC_3DAPP_H__FC7278BF_390D_11D7_8611_0060B0EE281E__INCLUDED_) +#define AFX_OCC_3DAPP_H__FC7278BF_390D_11D7_8611_0060B0EE281E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "OCC_BaseApp.h" +#include + +class Standard_EXPORT OCC_3dApp : public OCC_BaseApp +{ +public: + OCC_3dApp(); + virtual ~OCC_3dApp(); + + Handle_Graphic3d_WNTGraphicDevice GetGraphicDevice() const { return myGraphicDevice; } ; + +protected : + Handle_Graphic3d_WNTGraphicDevice myGraphicDevice; +}; + +#endif // !defined(AFX_OCC_3DAPP_H__FC7278BF_390D_11D7_8611_0060B0EE281E__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/OCC_3dBaseDoc.cpp b/TAG_MFC-TIGLViewer/Common/OCC_3dBaseDoc.cpp new file mode 100644 index 000000000..f83d87acb --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_3dBaseDoc.cpp @@ -0,0 +1,402 @@ +// OCC_3dBaseDoc.cpp: implementation of the OCC_3dBaseDoc class. +// +////////////////////////////////////////////////////////////////////// + +#include + +#include "OCC_3dBaseDoc.h" + +#include "OCC_3dView.h" +#include "OCC_3dApp.h" +#include +#include "ImportExport/ImportExport.h" +#include "AISDialogs.h" +#include +#include + +BEGIN_MESSAGE_MAP(OCC_3dBaseDoc, OCC_BaseDoc) + //{{AFX_MSG_MAP(OCC_3dBaseDoc) + ON_COMMAND(ID_FILE_IMPORT_BREP, OnFileImportBrep) + ON_COMMAND(ID_FILE_EXPORT_BREP, OnFileExportBrep) + ON_COMMAND(ID_OBJECT_ERASE, OnObjectErase) + ON_UPDATE_COMMAND_UI(ID_OBJECT_ERASE, OnUpdateObjectErase) + ON_COMMAND(ID_OBJECT_COLOR, OnObjectColor) + ON_UPDATE_COMMAND_UI(ID_OBJECT_COLOR, OnUpdateObjectColor) + ON_COMMAND(ID_OBJECT_SHADING, OnObjectShading) + ON_UPDATE_COMMAND_UI(ID_OBJECT_SHADING, OnUpdateObjectShading) + ON_COMMAND(ID_OBJECT_WIREFRAME, OnObjectWireframe) + ON_UPDATE_COMMAND_UI(ID_OBJECT_WIREFRAME, OnUpdateObjectWireframe) + ON_COMMAND(ID_OBJECT_TRANSPARENCY, OnObjectTransparency) + ON_UPDATE_COMMAND_UI(ID_OBJECT_TRANSPARENCY, OnUpdateObjectTransparency) + ON_COMMAND(ID_OBJECT_MATERIAL, OnObjectMaterial) + ON_UPDATE_COMMAND_UI(ID_OBJECT_MATERIAL, OnUpdateObjectMaterial) + ON_COMMAND(ID_OBJECT_DISPLAYALL, OnObjectDisplayall) + ON_UPDATE_COMMAND_UI(ID_OBJECT_DISPLAYALL, OnUpdateObjectDisplayall) + ON_COMMAND(ID_OBJECT_REMOVE, OnObjectRemove) + ON_UPDATE_COMMAND_UI(ID_OBJECT_REMOVE, OnUpdateObjectRemove) + //}}AFX_MSG_MAP + ON_COMMAND_EX_RANGE(ID_OBJECT_MATERIAL_BRASS,ID_OBJECT_MATERIAL_DEFAULT, OnObjectMaterialRange) + ON_UPDATE_COMMAND_UI_RANGE(ID_OBJECT_MATERIAL_BRASS,ID_OBJECT_MATERIAL_DEFAULT, OnUpdateObjectMaterialRange) + +END_MESSAGE_MAP() + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +OCC_3dBaseDoc::OCC_3dBaseDoc() +{ + AfxInitRichEdit(); + + Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice = + ((OCC_3dApp*)AfxGetApp())->GetGraphicDevice(); + + myViewer = new V3d_Viewer(theGraphicDevice,(short *) "Visu3D"); + myViewer->SetDefaultLights(); + myViewer->SetLightOn(); + myAISContext =new AIS_InteractiveContext(myViewer); +} + +OCC_3dBaseDoc::~OCC_3dBaseDoc() +{ + +} + + +void OCC_3dBaseDoc::DragEvent(const Standard_Integer x , + const Standard_Integer y , + const Standard_Integer TheState , + const Handle(V3d_View)& aView ) +{ + + // TheState == -1 button down + // TheState == 0 move + // TheState == 1 button up + + static Standard_Integer theButtonDownX=0; + static Standard_Integer theButtonDownY=0; + + if (TheState == -1) + { + theButtonDownX=x; + theButtonDownY=y; + } + + if (TheState == 0) + myAISContext->Select(theButtonDownX,theButtonDownY,x,y,aView); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- +void OCC_3dBaseDoc::InputEvent(const Standard_Integer x , + const Standard_Integer y , + const Handle(V3d_View)& aView ) +{ + myAISContext->Select(); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- +void OCC_3dBaseDoc::MoveEvent(const Standard_Integer x , + const Standard_Integer y , + const Handle(V3d_View)& aView ) +{ + myAISContext->MoveTo(x,y,aView); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- +void OCC_3dBaseDoc::ShiftMoveEvent(const Standard_Integer x , + const Standard_Integer y , + const Handle(V3d_View)& aView ) +{ + myAISContext->MoveTo(x,y,aView); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- +void OCC_3dBaseDoc::ShiftDragEvent(const Standard_Integer x , + const Standard_Integer y , + const Standard_Integer TheState , + const Handle(V3d_View)& aView ) +{ + static Standard_Integer theButtonDownX=0; + static Standard_Integer theButtonDownY=0; + + if (TheState == -1) + { + theButtonDownX=x; + theButtonDownY=y; + } + + if (TheState == 0) + myAISContext->ShiftSelect(theButtonDownX,theButtonDownY,x,y,aView); +} + + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- +void OCC_3dBaseDoc::ShiftInputEvent(const Standard_Integer x , + const Standard_Integer y , + const Handle(V3d_View)& aView ) +{ + myAISContext->ShiftSelect(); +} + +//----------------------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------------------- +void OCC_3dBaseDoc::Popup(const Standard_Integer x, + const Standard_Integer y , + const Handle(V3d_View)& aView ) +{ + Standard_Integer PopupMenuNumber=0; + myAISContext->InitCurrent(); + if (myAISContext->MoreCurrent()) + PopupMenuNumber=1; + + CMenu menu; + VERIFY(menu.LoadMenu(IDR_Popup3D)); + CMenu* pPopup = menu.GetSubMenu(PopupMenuNumber); + + ASSERT(pPopup != NULL); + if (PopupMenuNumber == 1) // more than 1 object. + { + bool OneOrMoreInShading = false; + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + if (myAISContext->IsDisplayed(myAISContext->Current(),1)) OneOrMoreInShading=true; + if(!OneOrMoreInShading) + pPopup->EnableMenuItem(5, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); + } + + POINT winCoord = { x , y }; + Handle(WNT_Window) aWNTWindow= + Handle(WNT_Window)::DownCast(aView->Window()); + ClientToScreen ( (HWND)(aWNTWindow->HWindow()),&winCoord); + pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON , winCoord.x, winCoord.y , + AfxGetMainWnd()); +} + +void OCC_3dBaseDoc::Fit() +{ + CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; + CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); + OCC_3dView *pView = (OCC_3dView *) pChild->GetActiveView(); + pView->FitAll(); +} + +int OCC_3dBaseDoc::OnFileImportBrep_WithInitDir(LPCTSTR InitialDir) +{ + if(CImportExport::ReadBREP(myAISContext, InitialDir) == 1) + return 1; + Fit(); + return 0; +} + +void OCC_3dBaseDoc::OnFileImportBrep() +{ + if(CImportExport::ReadBREP(myAISContext) == 1) +// return 1; + Fit(); + //return 0; +} + +void OCC_3dBaseDoc::OnFileExportBrep() +{ CImportExport::SaveBREP(myAISContext);} + +void OCC_3dBaseDoc::OnObjectColor() +{ + Handle_AIS_InteractiveObject Current ; + COLORREF MSColor ; + Quantity_Color CSFColor ; + + myAISContext->InitCurrent(); + Current = myAISContext->Current(); + if ( Current->HasColor () ) { + CSFColor = myAISContext->Color(myAISContext->Current()); + MSColor = RGB (CSFColor.Red()*255.,CSFColor.Green()*255.,CSFColor.Blue()*255.); + } + else { + MSColor = RGB (255,255,255) ; + } + + CColorDialog dlgColor(MSColor); + if (dlgColor.DoModal() == IDOK) + { + MSColor = dlgColor.GetColor(); + CSFColor = Quantity_Color (GetRValue(MSColor)/255.,GetGValue(MSColor)/255., + GetBValue(MSColor)/255.,Quantity_TOC_RGB); + for (;myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + myAISContext->SetColor (myAISContext->Current(),CSFColor.Name()); + } +} +void OCC_3dBaseDoc::OnUpdateObjectColor(CCmdUI* pCmdUI) +{ + /* + bool OneOrMoreIsDisplayed = false; + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + if (myAISContext->IsDisplayed(myAISContext->Current())) OneOrMoreIsDisplayed=true; + pCmdUI->Enable (OneOrMoreIsDisplayed); + */ + bool OneOrMoreIsShadingOrWireframe = false; + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + if (myAISContext->IsDisplayed(myAISContext->Current(),0) + ||myAISContext->IsDisplayed(myAISContext->Current(),1)) + OneOrMoreIsShadingOrWireframe=true; + pCmdUI->Enable (OneOrMoreIsShadingOrWireframe); + + +} + +void OCC_3dBaseDoc::OnObjectErase() +{ + for(myAISContext->InitCurrent();myAISContext->MoreCurrent();myAISContext->NextCurrent()) + myAISContext->Erase(myAISContext->Current(),Standard_True,Standard_False); + myAISContext->ClearCurrents(); +} +void OCC_3dBaseDoc::OnUpdateObjectErase(CCmdUI* pCmdUI) +{ + bool OneOrMoreIsDisplayed = false; + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + if (myAISContext->IsDisplayed(myAISContext->Current())) OneOrMoreIsDisplayed=true; + pCmdUI->Enable (OneOrMoreIsDisplayed); +} + +void OCC_3dBaseDoc::OnObjectWireframe() +{ + for(myAISContext->InitCurrent();myAISContext->MoreCurrent();myAISContext->NextCurrent()) + myAISContext->SetDisplayMode(myAISContext->Current(),0); +} +void OCC_3dBaseDoc::OnUpdateObjectWireframe(CCmdUI* pCmdUI) +{ + bool OneOrMoreInShading = false; + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + if (myAISContext->IsDisplayed(myAISContext->Current(),1)) OneOrMoreInShading=true; + pCmdUI->Enable (OneOrMoreInShading); +} + +void OCC_3dBaseDoc::OnObjectShading() +{ + for(myAISContext->InitCurrent();myAISContext->MoreCurrent();myAISContext->NextCurrent()) + myAISContext->SetDisplayMode(myAISContext->Current(),1); +} + +void OCC_3dBaseDoc::OnUpdateObjectShading(CCmdUI* pCmdUI) +{ + bool OneOrMoreInWireframe = false; + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + if (myAISContext->IsDisplayed(myAISContext->Current(),0)) OneOrMoreInWireframe=true; + pCmdUI->Enable (OneOrMoreInWireframe); +} + +void OCC_3dBaseDoc::OnObjectMaterial() +{ + CDialogMaterial DialBox(myAISContext); + DialBox.DoModal(); + CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; + CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); + OCC_3dView *pView = (OCC_3dView *) pChild->GetActiveView(); + pView->Redraw(); + +} + +void OCC_3dBaseDoc::OnUpdateObjectMaterial(CCmdUI* pCmdUI) +{ + bool OneOrMoreInShading = false; + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + if (myAISContext->IsDisplayed(myAISContext->Current(),1)) OneOrMoreInShading=true; + pCmdUI->Enable (OneOrMoreInShading); +} + +BOOL OCC_3dBaseDoc::OnObjectMaterialRange(UINT nID) +{ + // the range ID_OBJECT_MATERIAL_BRASS to ID_OBJECT_MATERIAL_SILVER is + // continue with the same values as enumeration Type Of Material + Standard_Real aTransparency; + + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()){ + aTransparency = myAISContext->Current()->Transparency(); + myAISContext->SetMaterial (myAISContext->Current(),(Graphic3d_NameOfMaterial)(nID-ID_OBJECT_MATERIAL_BRASS)); + myAISContext->SetTransparency (myAISContext->Current(),aTransparency); + } + return true; + +} + +void OCC_3dBaseDoc::OnUpdateObjectMaterialRange(CCmdUI* pCmdUI) +{ + bool OneOrMoreInShading = false; + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + if (myAISContext->IsDisplayed(myAISContext->Current(),1)) OneOrMoreInShading=true; + pCmdUI->Enable (OneOrMoreInShading); + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + if (myAISContext->Current()->Material() - (pCmdUI->m_nID - ID_OBJECT_MATERIAL_BRASS) == 0) + pCmdUI->SetCheck(1); +} + + +void OCC_3dBaseDoc::OnObjectTransparency() +{ + CDialogTransparency DialBox(myAISContext); + DialBox.DoModal(); + CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; + CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); + OCC_3dView *pView = (OCC_3dView *) pChild->GetActiveView(); + pView->Redraw(); +} + +void OCC_3dBaseDoc::OnUpdateObjectTransparency(CCmdUI* pCmdUI) +{ + bool OneOrMoreInShading = false; + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + if (myAISContext->IsDisplayed(myAISContext->Current(),1)) OneOrMoreInShading=true; + pCmdUI->Enable (OneOrMoreInShading); +} + + +void OCC_3dBaseDoc::OnObjectDisplayall() +{ + myAISContext->DisplayAll(Standard_True); +} + +void OCC_3dBaseDoc::OnUpdateObjectDisplayall(CCmdUI* pCmdUI) +{ + + AIS_ListOfInteractive aList; + myAISContext->ObjectsInside(aList,AIS_KOI_Shape); + AIS_ListIteratorOfListOfInteractive aLI; + Standard_Boolean IS_ANY_OBJECT_ERASED=FALSE; + for (aLI.Initialize(aList);aLI.More();aLI.Next()){ + if(!myAISContext->IsDisplayed(aLI.Value())) + IS_ANY_OBJECT_ERASED=TRUE; + } + pCmdUI->Enable (IS_ANY_OBJECT_ERASED); + +} + +void OCC_3dBaseDoc::OnObjectRemove() +{ + for(myAISContext->InitCurrent();myAISContext->MoreCurrent();myAISContext->NextCurrent()) + myAISContext->Remove(myAISContext->Current(),Standard_True); +} + +void OCC_3dBaseDoc::OnUpdateObjectRemove(CCmdUI* pCmdUI) +{ + bool OneOrMoreIsDisplayed = false; + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + if (myAISContext->IsDisplayed(myAISContext->Current())) OneOrMoreIsDisplayed=true; + pCmdUI->Enable (OneOrMoreIsDisplayed); +} + +void OCC_3dBaseDoc::SetMaterial(Graphic3d_NameOfMaterial Material) +{ + for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ()) + myAISContext->SetMaterial (myAISContext->Current(), + (Graphic3d_NameOfMaterial)(Material)); +} diff --git a/TAG_MFC-TIGLViewer/Common/OCC_3dBaseDoc.h b/TAG_MFC-TIGLViewer/Common/OCC_3dBaseDoc.h new file mode 100644 index 000000000..e93a6bff8 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_3dBaseDoc.h @@ -0,0 +1,85 @@ +// OCC_3dBaseDoc.h: interface for the OCC_3dBaseDoc class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OCC_3DBASEDOC_H__02CE7BD9_39BE_11D7_8611_0060B0EE281E__INCLUDED_) +#define AFX_OCC_3DBASEDOC_H__02CE7BD9_39BE_11D7_8611_0060B0EE281E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "OCC_BaseDoc.h" +#include + +class AFX_EXT_CLASS OCC_3dBaseDoc : public OCC_BaseDoc +{ +public: + OCC_3dBaseDoc(); + virtual ~OCC_3dBaseDoc(); + + Handle_AIS_InteractiveContext& GetAISContext(){ return myAISContext; }; + Handle_V3d_Viewer GetViewer() { return myViewer; }; + void SetMaterial(Graphic3d_NameOfMaterial Material); + + + virtual void DragEvent (const Standard_Integer x , + const Standard_Integer y , + const Standard_Integer TheState, + const Handle(V3d_View)& aView ); + virtual void InputEvent (const Standard_Integer x , + const Standard_Integer y , + const Handle(V3d_View)& aView ); + virtual void MoveEvent (const Standard_Integer x , + const Standard_Integer y , + const Handle(V3d_View)& aView ); + virtual void ShiftMoveEvent (const Standard_Integer x , + const Standard_Integer y , + const Handle(V3d_View)& aView ); + virtual void ShiftDragEvent (const Standard_Integer x , + const Standard_Integer y , + const Standard_Integer TheState, + const Handle(V3d_View)& aView ); + virtual void ShiftInputEvent(const Standard_Integer x , + const Standard_Integer y , + const Handle(V3d_View)& aView ); + virtual void Popup (const Standard_Integer x , + const Standard_Integer y , + const Handle(V3d_View)& aView ); + static void Fit(); + int OnFileImportBrep_WithInitDir(LPCTSTR InitialDir); + +// Generated message map functions +protected: + //{{AFX_MSG(OCC_3dBaseDoc) + afx_msg void OnFileImportBrep(); + afx_msg void OnFileExportBrep(); + afx_msg void OnObjectErase(); + afx_msg void OnUpdateObjectErase(CCmdUI* pCmdUI); + afx_msg void OnObjectColor(); + afx_msg void OnUpdateObjectColor(CCmdUI* pCmdUI); + afx_msg void OnObjectShading(); + afx_msg void OnUpdateObjectShading(CCmdUI* pCmdUI); + afx_msg void OnObjectWireframe(); + afx_msg void OnUpdateObjectWireframe(CCmdUI* pCmdUI); + afx_msg void OnObjectTransparency(); + afx_msg void OnUpdateObjectTransparency(CCmdUI* pCmdUI) ; + afx_msg void OnObjectMaterial(); + afx_msg void OnUpdateObjectMaterial(CCmdUI* pCmdUI); + afx_msg BOOL OnObjectMaterialRange(UINT nID); + afx_msg void OnUpdateObjectMaterialRange(CCmdUI* pCmdUI); + afx_msg void OnObjectDisplayall(); + afx_msg void OnUpdateObjectDisplayall(CCmdUI* pCmdUI); + afx_msg void OnObjectRemove(); + afx_msg void OnUpdateObjectRemove(CCmdUI* pCmdUI); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +//Attributes +protected: + Handle_V3d_Viewer myViewer; + Handle_AIS_InteractiveContext myAISContext; + +}; + +#endif // !defined(AFX_OCC_3dBaseDoc_H__02CE7BD9_39BE_11D7_8611_0060B0EE281E__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/OCC_3dChildFrame.cpp b/TAG_MFC-TIGLViewer/Common/OCC_3dChildFrame.cpp new file mode 100644 index 000000000..aa39f762f --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_3dChildFrame.cpp @@ -0,0 +1,49 @@ +// OCC_3dChildFrame.cpp: implementation of the OCC_3dChildFrame class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" + +#include "OCC_3dChildFrame.h" + +#include "res\OCC_Resource.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + + +IMPLEMENT_DYNCREATE (OCC_3dChildFrame, CMDIChildWnd) + +BEGIN_MESSAGE_MAP(OCC_3dChildFrame, CMDIChildWnd) + //{{AFX_MSG_MAP(OCC_3dChildFrame) + ON_WM_CREATE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +OCC_3dChildFrame::OCC_3dChildFrame() +{ +} + +OCC_3dChildFrame::~OCC_3dChildFrame() +{ +} + +int OCC_3dChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_3dCHILDFRAME)) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar); + + return 0; +} \ No newline at end of file diff --git a/TAG_MFC-TIGLViewer/Common/OCC_3dChildFrame.h b/TAG_MFC-TIGLViewer/Common/OCC_3dChildFrame.h new file mode 100644 index 000000000..239466126 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_3dChildFrame.h @@ -0,0 +1,38 @@ +// OCC_3dChildFrame.h: interface for the OCC_3dChildFrame class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OCC_3DCHILDFRAME_H__84879CFC_7EE3_11D7_8632_0060B0EE281E__INCLUDED_) +#define AFX_OCC_3DCHILDFRAME_H__84879CFC_7EE3_11D7_8632_0060B0EE281E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include + +class AFX_EXT_CLASS OCC_3dChildFrame : public CMDIChildWnd +{ + DECLARE_DYNCREATE(OCC_3dChildFrame) +public: + OCC_3dChildFrame(); + virtual ~OCC_3dChildFrame(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(OCC_3dChildFrame) + //}}AFX_VIRTUAL + +// Generated message map functions + //{{AFX_MSG(OCC_3dChildFrame) + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + //}}AFX_MSG + +protected: + CToolBar m_wndToolBar; + + DECLARE_MESSAGE_MAP() + +}; + +#endif // !defined(AFX_OCC_3DCHILDFRAME_H__84879CFC_7EE3_11D7_8632_0060B0EE281E__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/OCC_3dView.cpp b/TAG_MFC-TIGLViewer/Common/OCC_3dView.cpp new file mode 100644 index 000000000..74e651fc4 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_3dView.cpp @@ -0,0 +1,600 @@ +// OCC_3dView.cpp: implementation of the OCC_3dView class. +// + +#include "stdafx.h" + +#include "OCC_3dView.h" +#include "OCC_3dApp.h" +#include "OCC_3dBaseDoc.h" +#include + +#define ValZWMin 1 + +IMPLEMENT_DYNCREATE(OCC_3dView, CView) + +BEGIN_MESSAGE_MAP(OCC_3dView, CView) + //{{AFX_MSG_MAP(OCC_3dView) + ON_COMMAND(ID_BUTTONAxo, OnBUTTONAxo) + ON_COMMAND(ID_BUTTONBack, OnBUTTONBack) + ON_COMMAND(ID_BUTTONBottom, OnBUTTONBottom) + ON_COMMAND(ID_BUTTONFront, OnBUTTONFront) + ON_COMMAND(ID_BUTTONHlrOff, OnBUTTONHlrOff) + ON_COMMAND(ID_BUTTONHlrOn, OnBUTTONHlrOn) + ON_COMMAND(ID_BUTTONLeft, OnBUTTONLeft) + ON_COMMAND(ID_BUTTONPan, OnBUTTONPan) + ON_COMMAND(ID_BUTTONPanGlo, OnBUTTONPanGlo) + ON_COMMAND(ID_BUTTONReset, OnBUTTONReset) + ON_COMMAND(ID_BUTTONRight, OnBUTTONRight) + ON_COMMAND(ID_BUTTONRot, OnBUTTONRot) + ON_COMMAND(ID_BUTTONTop, OnBUTTONTop) + ON_COMMAND(ID_BUTTONZoomAll, OnBUTTONZoomAll) + ON_WM_SIZE() + ON_COMMAND(ID_FILE_EXPORT_IMAGE, OnFileExportImage) + ON_COMMAND(ID_BUTTONZoomProg, OnBUTTONZoomProg) + ON_COMMAND(ID_BUTTONZoomWin, OnBUTTONZoomWin) + ON_WM_LBUTTONDOWN() + ON_WM_LBUTTONUP() + ON_WM_MBUTTONDOWN() + ON_WM_MBUTTONUP() + ON_WM_MOUSEMOVE() + ON_WM_RBUTTONDOWN() + ON_WM_RBUTTONUP() + ON_UPDATE_COMMAND_UI(ID_BUTTONHlrOff, OnUpdateBUTTONHlrOff) + ON_UPDATE_COMMAND_UI(ID_BUTTONHlrOn, OnUpdateBUTTONHlrOn) + ON_UPDATE_COMMAND_UI(ID_BUTTONPanGlo, OnUpdateBUTTONPanGlo) + ON_UPDATE_COMMAND_UI(ID_BUTTONPan, OnUpdateBUTTONPan) + ON_UPDATE_COMMAND_UI(ID_BUTTONZoomProg, OnUpdateBUTTONZoomProg) + ON_UPDATE_COMMAND_UI(ID_BUTTONZoomWin, OnUpdateBUTTONZoomWin) + ON_UPDATE_COMMAND_UI(ID_BUTTONRot, OnUpdateBUTTONRot) + ON_COMMAND(ID_Modify_ChangeBackground , OnModifyChangeBackground) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// OCC_3dView construction/destruction + +OCC_3dView::OCC_3dView() +{ + // TODO: add construction code here + myXmin=0; + myYmin=0; + myXmax=0; + myYmax=0; + myCurZoom=0; + // will be set in OnInitial update, but, for more security : + myCurrentMode = CurAction3d_Nothing; + myDegenerateModeIsOn=Standard_True; + m_Pen = 0; + +} + +OCC_3dView::~OCC_3dView() +{ + try { + myView->Remove(); + } + catch (...) { } + + if (m_Pen) delete m_Pen; +} + +BOOL OCC_3dView::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CView::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// OCC_3dView drawing +void OCC_3dView::OnInitialUpdate() +{ + CView::OnInitialUpdate(); + + myView = GetDocument()->GetViewer()->CreateView(); + + // set the default mode in wireframe ( not hidden line ! ) + myView->SetDegenerateModeOn(); + // store for restore state after rotation (witch is in Degenerated mode) + myDegenerateModeIsOn = Standard_True; + + + Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice = + ((OCC_3dApp*)AfxGetApp())->GetGraphicDevice(); + + Handle(WNT_Window) aWNTWindow = new WNT_Window(theGraphicDevice,GetSafeHwnd ()); + myView->SetWindow(aWNTWindow); + if (!aWNTWindow->IsMapped()) aWNTWindow->Map(); + + // store the mode ( nothing , dynamic zooming, dynamic ... ) + myCurrentMode = CurAction3d_Nothing; + +} + +void OCC_3dView::OnDraw(CDC* pDC) +{ + myView->Redraw(); +} + +///////////////////////////////////////////////////////////////////////////// +// OCC_3dView diagnostics + +#ifdef _DEBUG +void OCC_3dView::AssertValid() const +{ + CView::AssertValid(); +} + +void OCC_3dView::Dump(CDumpContext& dc) const +{ + CView::Dump(dc); +} + +OCC_3dBaseDoc* OCC_3dView::GetDocument() // non-debug version is inline +{ +// ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(OCC_3dBaseDoc))); + return (OCC_3dBaseDoc*)m_pDocument; +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// OCC_3dView message handlers +void OCC_3dView::OnFileExportImage() +{ + CFileDialog dlg(FALSE,_T("*.BMP"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + _T("BMP Files (*.BMP)|*.bmp |GIF Files (*.GIF)|*.gif | XWD Files (*.XWD)|*.xwd||"), + NULL ); + + if (dlg.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + CString filename = dlg.GetPathName(); + Handle(Aspect_Window) anAspectWindow = myView->Window(); + Handle(WNT_Window) aWNTWindow = Handle(WNT_Window)::DownCast(anAspectWindow); + CString ext = dlg.GetFileExt(); + if (ext == "bmp") aWNTWindow->SetOutputFormat ( WNT_TOI_BMP ); + if (ext == "gif") aWNTWindow->SetOutputFormat ( WNT_TOI_GIF ); + if (ext == "xwd") aWNTWindow->SetOutputFormat ( WNT_TOI_XWD ); + aWNTWindow->Dump ((Standard_CString)(LPCTSTR)filename); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + } +} + +void OCC_3dView::OnSize(UINT nType, int cx, int cy) +{ + if (!myView.IsNull()) { + myView->MustBeResized(); + } +} + +void OCC_3dView::OnBUTTONBack() +{ myView->SetProj(V3d_Xneg); } // See the back View +void OCC_3dView::OnBUTTONFront() +{ myView->SetProj(V3d_Xpos); } // See the front View + +void OCC_3dView::OnBUTTONBottom() +{ myView->SetProj(V3d_Zneg); } // See the bottom View +void OCC_3dView::OnBUTTONTop() +{ myView->SetProj(V3d_Zpos); } // See the top View + +void OCC_3dView::OnBUTTONLeft() +{ myView->SetProj(V3d_Ypos); } // See the left View +void OCC_3dView::OnBUTTONRight() +{ myView->SetProj(V3d_Yneg); } // See the right View + +void OCC_3dView::OnBUTTONAxo() +{ myView->SetProj(V3d_XposYnegZpos); } // See the axonometric View + +void OCC_3dView::OnBUTTONHlrOff() +{ + myView->SetDegenerateModeOn(); + myDegenerateModeIsOn = Standard_True; +} + +void OCC_3dView::OnBUTTONHlrOn() +{ + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + myView->SetDegenerateModeOff(); + myDegenerateModeIsOn = Standard_False; + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); +} + +void OCC_3dView::OnBUTTONPan() +{ myCurrentMode = CurAction3d_DynamicPanning; } + +void OCC_3dView::OnBUTTONPanGlo() +{ + // save the current zoom value + myCurZoom = myView->Scale(); + // Do a Global Zoom + //myView->FitAll(); + // Set the mode + myCurrentMode = CurAction3d_GlobalPanning; +} + +void OCC_3dView::OnBUTTONReset() +{ myView->Reset(); } + +void OCC_3dView::OnBUTTONRot() +{ myCurrentMode = CurAction3d_DynamicRotation; } + + +void OCC_3dView::OnBUTTONZoomAll() +{ + myView->FitAll(); + myView->ZFitAll(); +} + +void OCC_3dView::OnBUTTONZoomProg() +{ myCurrentMode = CurAction3d_DynamicZooming; } + +void OCC_3dView::OnBUTTONZoomWin() +{ myCurrentMode = CurAction3d_WindowZooming; } + +void OCC_3dView::OnLButtonDown(UINT nFlags, CPoint point) +{ + // save the current mouse coordinate in min + myXmin=point.x; myYmin=point.y; + myXmax=point.x; myYmax=point.y; + + if ( nFlags & MK_CONTROL ) + { + // Button MB1 down Control :start zomming + // SetCursor(AfxGetApp()->LoadStandardCursor()); + } + else // if ( Ctrl ) + { + switch (myCurrentMode) + { + case CurAction3d_Nothing : // start a drag + if (nFlags & MK_SHIFT) + GetDocument()->ShiftDragEvent(myXmax,myYmax,-1,myView); + else + GetDocument()->DragEvent(myXmax,myYmax,-1,myView); + break; + break; + case CurAction3d_DynamicZooming : // noting + break; + case CurAction3d_WindowZooming : // noting + break; + case CurAction3d_DynamicPanning :// noting + break; + case CurAction3d_GlobalPanning :// noting + break; + case CurAction3d_DynamicRotation : + if (!myDegenerateModeIsOn) + myView->SetDegenerateModeOn(); + myView->StartRotation(point.x,point.y); + break; + default : + Standard_Failure::Raise(" incompatible Current Mode "); + break; + } + } +} + +void OCC_3dView::OnLButtonUp(UINT nFlags, CPoint point) +{ + if ( nFlags & MK_CONTROL ) + { + return; + } + else // if ( Ctrl ) + { + switch (myCurrentMode) + { + case CurAction3d_Nothing : + if (point.x == myXmin && point.y == myYmin) + { // no offset between down and up --> selectEvent + myXmax=point.x; + myYmax=point.y; + if (nFlags & MK_SHIFT ) + GetDocument()->ShiftInputEvent(point.x,point.y,myView); + else + GetDocument()->InputEvent (point.x,point.y,myView); + } else + { + myXmax=point.x; myYmax=point.y; + DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False); + if (nFlags & MK_SHIFT) + GetDocument()->ShiftDragEvent(point.x,point.y,1,myView); + else + GetDocument()->DragEvent(point.x,point.y,1,myView); + } + break; + case CurAction3d_DynamicZooming : + // SetCursor(AfxGetApp()->LoadStandardCursor()); + myCurrentMode = CurAction3d_Nothing; + break; + case CurAction3d_WindowZooming : + myXmax=point.x; myYmax=point.y; + DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False); + if ((abs(myXmin-myXmax)>ValZWMin) || (abs(myYmin-myYmax)>ValZWMin)) + // Test if the zoom window is greater than a minimale window. + { + // Do the zoom window between Pmin and Pmax + myView->WindowFitAll(myXmin,myYmin,myXmax,myYmax); + } + myCurrentMode = CurAction3d_Nothing; + break; + case CurAction3d_DynamicPanning : + myCurrentMode = CurAction3d_Nothing; + break; + case CurAction3d_GlobalPanning : + myView->Place(point.x,point.y,myCurZoom); + myCurrentMode = CurAction3d_Nothing; + break; + case CurAction3d_DynamicRotation : + myCurrentMode = CurAction3d_Nothing; + if (!myDegenerateModeIsOn) + { + CWaitCursor aWaitCursor; + myView->SetDegenerateModeOff(); + myDegenerateModeIsOn = Standard_False; + } + else + { + myView->SetDegenerateModeOn(); + myDegenerateModeIsOn = Standard_True; + } + break; + default : + Standard_Failure::Raise(" incompatible Current Mode "); + break; + } //switch (myCurrentMode) + } // else // if ( Ctrl ) +} + +void OCC_3dView::OnMButtonDown(UINT nFlags, CPoint point) +{ + if ( nFlags & MK_CONTROL ) + { + // Button MB2 down Control : panning init + // SetCursor(AfxGetApp()->LoadStandardCursor()); + } +} + +void OCC_3dView::OnMButtonUp(UINT nFlags, CPoint point) +{ + if ( nFlags & MK_CONTROL ) + { + // Button MB2 down Control : panning init + // SetCursor(AfxGetApp()->LoadStandardCursor()); + } +} + +void OCC_3dView::OnRButtonDown(UINT nFlags, CPoint point) +{ + if ( nFlags & MK_CONTROL ) + { + // SetCursor(AfxGetApp()->LoadStandardCursor()); + if (!myDegenerateModeIsOn) + myView->SetDegenerateModeOn(); + myView->StartRotation(point.x,point.y); + } + else // if ( Ctrl ) + { + GetDocument()->Popup(point.x,point.y,myView); + } +} + +void OCC_3dView::OnRButtonUp(UINT nFlags, CPoint point) +{ + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + if (!myDegenerateModeIsOn) + { + myView->SetDegenerateModeOff(); + myDegenerateModeIsOn = Standard_False; + } else + { + myView->SetDegenerateModeOn(); + myDegenerateModeIsOn = Standard_True; + } + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); +} + +void OCC_3dView::OnMouseMove(UINT nFlags, CPoint point) +{ + // ============================ LEFT BUTTON ======================= + if ( nFlags & MK_LBUTTON) + { + if ( nFlags & MK_CONTROL ) + { + // move with MB1 and Control : on the dynamic zooming + // Do the zoom in function of mouse's coordinates + myView->Zoom(myXmax,myYmax,point.x,point.y); + // save the current mouse coordinate in min + myXmax = point.x; + myYmax = point.y; + } + else // if ( Ctrl ) + { + switch (myCurrentMode) + { + case CurAction3d_Nothing : + myXmax = point.x; myYmax = point.y; + DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False); + if (nFlags & MK_SHIFT) + GetDocument()->ShiftDragEvent(myXmax,myYmax,0,myView); + else + GetDocument()->DragEvent(myXmax,myYmax,0,myView); + DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_True); + + break; + case CurAction3d_DynamicZooming : + myView->Zoom(myXmax,myYmax,point.x,point.y); + // save the current mouse coordinate in min \n"; + myXmax=point.x; myYmax=point.y; + break; + case CurAction3d_WindowZooming : + myXmax = point.x; myYmax = point.y; + DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False,LongDash); + DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_True,LongDash); + break; + case CurAction3d_DynamicPanning : + myView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning + myXmax = point.x; myYmax = point.y; + break; + case CurAction3d_GlobalPanning : // nothing + break; + case CurAction3d_DynamicRotation : + myView->Rotation(point.x,point.y); + myView->Redraw(); + break; + default : + Standard_Failure::Raise(" incompatible Current Mode "); + break; + }// switch (myCurrentMode) + }// if ( nFlags & MK_CONTROL ) else + } else // if ( nFlags & MK_LBUTTON) + // ============================ MIDDLE BUTTON ======================= + if ( nFlags & MK_MBUTTON) + { + if ( nFlags & MK_CONTROL ) + { + myView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning + myXmax = point.x; myYmax = point.y; + + } + } else // if ( nFlags & MK_MBUTTON) + // ============================ RIGHT BUTTON ======================= + if ( nFlags & MK_RBUTTON) + { + if ( nFlags & MK_CONTROL ) + { + myView->Rotation(point.x,point.y); + } + }else //if ( nFlags & MK_RBUTTON) + // ============================ NO BUTTON ======================= + { // No buttons + myXmax = point.x; myYmax = point.y; + if (nFlags & MK_SHIFT) + GetDocument()->ShiftMoveEvent(point.x,point.y,myView); + else + GetDocument()->MoveEvent(point.x,point.y,myView); + } +} + +void OCC_3dView::DrawRectangle(const Standard_Integer MinX , + const Standard_Integer MinY , + const Standard_Integer MaxX , + const Standard_Integer MaxY , + const Standard_Boolean Draw , + const LineStyle aLineStyle) +{ + static int m_DrawMode; + if (!m_Pen && aLineStyle ==Solid ) + {m_Pen = new CPen(PS_SOLID, 1, RGB(0,0,0)); m_DrawMode = R2_MERGEPENNOT;} + else if (!m_Pen && aLineStyle ==Dot ) + {m_Pen = new CPen(PS_DOT, 1, RGB(0,0,0)); m_DrawMode = R2_XORPEN;} + else if (!m_Pen && aLineStyle == ShortDash) + {m_Pen = new CPen(PS_DASH, 1, RGB(255,0,0)); m_DrawMode = R2_XORPEN;} + else if (!m_Pen && aLineStyle == LongDash) + {m_Pen = new CPen(PS_DASH, 1, RGB(0,0,0)); m_DrawMode = R2_NOTXORPEN;} + else if (aLineStyle == Default) { + if (m_Pen) { + delete m_Pen; + m_Pen = NULL; + } + m_DrawMode = R2_MERGEPENNOT; + } + + CPen* aOldPen; + CClientDC clientDC(this); + if (m_Pen) aOldPen = clientDC.SelectObject(m_Pen); + clientDC.SetROP2(m_DrawMode); + + static Standard_Integer StoredMinX, StoredMaxX, StoredMinY, StoredMaxY; + static Standard_Boolean m_IsVisible; + + if ( m_IsVisible && !Draw) // move or up : erase at the old position + { + clientDC.MoveTo(StoredMinX,StoredMinY); clientDC.LineTo(StoredMinX,StoredMaxY); + clientDC.LineTo(StoredMaxX,StoredMaxY); + clientDC.LineTo(StoredMaxX,StoredMinY); clientDC.LineTo(StoredMinX,StoredMinY); + m_IsVisible = false; + } + + StoredMinX = min ( MinX, MaxX ); + StoredMinY = min ( MinY, MaxY ); + StoredMaxX = max ( MinX, MaxX ); + StoredMaxY = max ( MinY, MaxY); + + if (Draw) // move : draw + { + clientDC.MoveTo(StoredMinX,StoredMinY); clientDC.LineTo(StoredMinX,StoredMaxY); + clientDC.LineTo(StoredMaxX,StoredMaxY); + clientDC.LineTo(StoredMaxX,StoredMinY); clientDC.LineTo(StoredMinX,StoredMinY); + m_IsVisible = true; + } + + if (m_Pen) clientDC.SelectObject(aOldPen); +} + + + +void OCC_3dView::OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck (myDegenerateModeIsOn); + pCmdUI->Enable (!myDegenerateModeIsOn); +} + +void OCC_3dView::OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck (!myDegenerateModeIsOn); + pCmdUI->Enable (myDegenerateModeIsOn); +} + +void OCC_3dView::OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck (myCurrentMode == CurAction3d_GlobalPanning); + pCmdUI->Enable (myCurrentMode != CurAction3d_GlobalPanning); + +} + +void OCC_3dView::OnUpdateBUTTONPan(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicPanning); + pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicPanning ); +} + +void OCC_3dView::OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicZooming ); + pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicZooming); +} + +void OCC_3dView::OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck (myCurrentMode == CurAction3d_WindowZooming); + pCmdUI->Enable (myCurrentMode != CurAction3d_WindowZooming); +} + +void OCC_3dView::OnUpdateBUTTONRot(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicRotation); + pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicRotation); +} + +void OCC_3dView::OnModifyChangeBackground() +{ + Standard_Real R1; + Standard_Real G1; + Standard_Real B1; + myView->BackgroundColor(Quantity_TOC_RGB,R1,G1,B1); + COLORREF m_clr ; + m_clr = RGB(R1*255,G1*255,B1*255); + + CColorDialog dlgColor(m_clr); + if (dlgColor.DoModal() == IDOK) + { + m_clr = dlgColor.GetColor(); + R1 = GetRValue(m_clr)/255.; + G1 = GetGValue(m_clr)/255.; + B1 = GetBValue(m_clr)/255.; + myView->SetBackgroundColor(Quantity_TOC_RGB,R1,G1,B1); + } + myView->Redraw(); +} diff --git a/TAG_MFC-TIGLViewer/Common/OCC_3dView.h b/TAG_MFC-TIGLViewer/Common/OCC_3dView.h new file mode 100644 index 000000000..d9b628612 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_3dView.h @@ -0,0 +1,117 @@ +// OCC_3dView.h: interface for the OCC_3dView class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OCC_3DVIEW_H__1F4065AE_39C4_11D7_8611_0060B0EE281E__INCLUDED_) +#define AFX_OCC_3DVIEW_H__1F4065AE_39C4_11D7_8611_0060B0EE281E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "OCC_BaseView.h" +#include "OCC_3dBaseDoc.h" +#include + +enum CurAction3d { + CurAction3d_Nothing, + CurAction3d_DynamicZooming, + CurAction3d_WindowZooming, + CurAction3d_DynamicPanning, + CurAction3d_GlobalPanning, + CurAction3d_DynamicRotation +}; + +class AFX_EXT_CLASS OCC_3dView : public OCC_BaseView +{ + DECLARE_DYNCREATE(OCC_3dView) +public: + OCC_3dView(); + virtual ~OCC_3dView(); + + OCC_3dBaseDoc* GetDocument(); + void FitAll() { myView->FitAll(); myView->ZFitAll(); }; + void Redraw() { myView->Redraw(); }; + + void SetZoom ( const Quantity_Factor& Coef ) { myView->SetZoom ( Coef ); }; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(OCC_3dView) + public: + virtual void OnDraw(CDC* pDC); // overridden to draw this view + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual void OnInitialUpdate(); + //}}AFX_VIRTUAL + +// Generated message map functions +protected: + //{{AFX_MSG(OCC_3dView) + afx_msg void OnBUTTONAxo(); + afx_msg void OnBUTTONBack(); + afx_msg void OnBUTTONBottom(); + afx_msg void OnBUTTONFront(); + afx_msg void OnBUTTONHlrOff(); + afx_msg void OnBUTTONHlrOn(); + afx_msg void OnBUTTONLeft(); + afx_msg void OnBUTTONPan(); + afx_msg void OnBUTTONPanGlo(); + afx_msg void OnBUTTONReset(); + afx_msg void OnBUTTONRight(); + afx_msg void OnBUTTONRot(); + afx_msg void OnBUTTONTop(); + afx_msg void OnBUTTONZoomAll(); + afx_msg void OnFileExportImage(); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnBUTTONZoomProg(); + afx_msg void OnBUTTONZoomWin(); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnLButtonUp(UINT nFlags, CPoint point); + afx_msg void OnMButtonDown(UINT nFlags, CPoint point); + afx_msg void OnMButtonUp(UINT nFlags, CPoint point); + afx_msg void OnMouseMove(UINT nFlags, CPoint point); + afx_msg void OnRButtonDown(UINT nFlags, CPoint point); + afx_msg void OnRButtonUp(UINT nFlags, CPoint point); + afx_msg void OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI); + afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI); + afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI); + afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI); + afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI); + afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI); + afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI); + afx_msg void OnModifyChangeBackground(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + Handle_V3d_View myView; + CurAction3d myCurrentMode; + Standard_Integer myXmin; + Standard_Integer myYmin; + Standard_Integer myXmax; + Standard_Integer myYmax; + Quantity_Factor myCurZoom; + Standard_Boolean myDegenerateModeIsOn; + + enum LineStyle { Solid, Dot, ShortDash, LongDash, Default }; + CPen* m_Pen; + + virtual void DrawRectangle (const Standard_Integer MinX , + const Standard_Integer MinY , + const Standard_Integer MaxX , + const Standard_Integer MaxY , + const Standard_Boolean Draw , + const LineStyle aLineStyle = Default ); +}; + +#ifndef _DEBUG // debug version in OCC_3dView.cpp +inline OCC_3dBaseDoc* OCC_3dView::GetDocument() + { return (OCC_3dBaseDoc*)m_pDocument; } +#endif + +#endif // !defined(AFX_OCC_3DVIEW_H__1F4065AE_39C4_11D7_8611_0060B0EE281E__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/OCC_BaseApp.cpp b/TAG_MFC-TIGLViewer/Common/OCC_BaseApp.cpp new file mode 100644 index 000000000..059b5d50b --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_BaseApp.cpp @@ -0,0 +1,141 @@ +// OCC_BaseApp.cpp: implementation of the OCC_BaseApp class. +// +////////////////////////////////////////////////////////////////////// + +#include + +#include "OCC_BaseApp.h" + +#include + +#include + +///////////////////////////////////////////////////////////////////////////// +// OCC_BaseApp + +BEGIN_MESSAGE_MAP(OCC_BaseApp, CWinApp) + //{{AFX_MSG_MAP(OCC_BaseApp) + ON_COMMAND(ID_APP_ABOUT, OnAppAbout) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG_MAP + // Standard file based document commands + ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) + ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// OCC_BaseApp construction + +OCC_BaseApp::OCC_BaseApp() +{ + SampleName = ""; + SetSamplePath(NULL); +} + + +void OCC_BaseApp::SetSamplePath(LPCTSTR aPath) +{ + char AbsoluteExecutableFileName[MAX_PATH+1]; + HMODULE hModule = GetModuleHandle(NULL); + GetModuleFileName(hModule, AbsoluteExecutableFileName, MAX_PATH); + + SamplePath = CString(AbsoluteExecutableFileName); + int index = SamplePath.ReverseFind('\\'); + SamplePath.Delete(index+1, SamplePath.GetLength() - index - 1); + if (aPath == NULL) + SamplePath += ".."; + else{ + CString aCInitialDir(aPath); + SamplePath += "..\\" + aCInitialDir; + } +} +///////////////////////////////////////////////////////////////////////////// +// CAboutDlgStd dialog used for App About + +class CAboutDlgStd : public CDialog +{ +public: + CAboutDlgStd(); + BOOL OnInitDialog(); + +// Dialog Data + //{{AFX_DATA(CAboutDlgStd) + enum { IDD = IDD_OCC_ABOUTBOX }; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAboutDlgStd) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + +// Implementation +protected: + //{{AFX_MSG(CAboutDlgStd) + // No message handlers + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +CAboutDlgStd::CAboutDlgStd() : CDialog(CAboutDlgStd::IDD) +{ + //{{AFX_DATA_INIT(CAboutDlgStd) + //}}AFX_DATA_INIT +} + +void CAboutDlgStd::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAboutDlgStd) + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CAboutDlgStd, CDialog) + //{{AFX_MSG_MAP(CAboutDlgStd) + // No message handlers + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +BOOL CAboutDlgStd::OnInitDialog(){ + CWnd* Title = GetDlgItem(IDC_ABOUTBOX_TITLE); + + CString About = "About "; + CString Sample = "Sample "; + CString SampleName = ((OCC_BaseApp*)AfxGetApp())->GetSampleName(); + CString Cascade = ", Open CASCADE Technology "; + CString Version = OCC_VERSION_STRING; + + CString strTitle = Sample + SampleName + Cascade + Version; + CString dlgTitle = About + SampleName; + + Title->SetWindowText(strTitle); + SetWindowText(dlgTitle); + + CenterWindow(); + + return TRUE; +} + +// App command to run the dialog +void OCC_BaseApp::OnAppAbout() +{ + CAboutDlgStd aboutDlg; + aboutDlg.DoModal(); +} + +LPCTSTR OCC_BaseApp::GetSampleName() +{ + return SampleName; +} + +LPCTSTR OCC_BaseApp::GetInitDataDir() +{ + return (LPCTSTR) SamplePath; +} + +void OCC_BaseApp::SetSampleName(LPCTSTR Name) +{ + SampleName = Name; +} diff --git a/TAG_MFC-TIGLViewer/Common/OCC_BaseApp.h b/TAG_MFC-TIGLViewer/Common/OCC_BaseApp.h new file mode 100644 index 000000000..4ab373215 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_BaseApp.h @@ -0,0 +1,37 @@ +// OCC_BaseApp.h: interface for the OCC_BaseApp class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OCC_BASEAPP_H__425A6447_38ED_11D7_8611_0060B0EE281E__INCLUDED_) +#define AFX_OCC_BASEAPP_H__425A6447_38ED_11D7_8611_0060B0EE281E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "res\OCC_Resource.h" +#include + +class AFX_EXT_CLASS OCC_BaseApp : public CWinApp +{ +public: + void SetSampleName(LPCTSTR Name); + virtual LPCTSTR GetSampleName(); + LPCTSTR GetInitDataDir(); + void SetSamplePath(LPCTSTR aPath); + OCC_BaseApp(); + +// Implementation + //{{AFX_MSG(OCC_BaseApp) + afx_msg void OnAppAbout(); + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +protected: +public: + LPCTSTR SampleName; + CString SamplePath; +}; + +#endif // !defined(AFX_OCC_BASEAPP_H__425A6447_38ED_11D7_8611_0060B0EE281E__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/OCC_BaseDoc.cpp b/TAG_MFC-TIGLViewer/Common/OCC_BaseDoc.cpp new file mode 100644 index 000000000..f6c29917e --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_BaseDoc.cpp @@ -0,0 +1,20 @@ +// OCC_BaseDoc.cpp: implementation of the OCC_BaseDoc class. +// +////////////////////////////////////////////////////////////////////// + +#include +#include "OCC_BaseDoc.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +OCC_BaseDoc::OCC_BaseDoc() +{ + +} + +OCC_BaseDoc::~OCC_BaseDoc() +{ + +} diff --git a/TAG_MFC-TIGLViewer/Common/OCC_BaseDoc.h b/TAG_MFC-TIGLViewer/Common/OCC_BaseDoc.h new file mode 100644 index 000000000..c692365c0 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_BaseDoc.h @@ -0,0 +1,22 @@ +// OCC_BaseDoc.h: interface for the OCC_BaseDoc class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OCC_BASEDOC_H__2E048CC8_38F9_11D7_8611_0060B0EE281E__INCLUDED_) +#define AFX_OCC_BASEDOC_H__2E048CC8_38F9_11D7_8611_0060B0EE281E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include + +class OCC_BaseDoc : public CDocument +{ +public: + OCC_BaseDoc(); + virtual ~OCC_BaseDoc(); + +}; + +#endif // !defined(AFX_OCC_BASEDOC_H__2E048CC8_38F9_11D7_8611_0060B0EE281E__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/OCC_BaseView.cpp b/TAG_MFC-TIGLViewer/Common/OCC_BaseView.cpp new file mode 100644 index 000000000..ea1be2878 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_BaseView.cpp @@ -0,0 +1,20 @@ +// OCC_BaseView.cpp: implementation of the OCC_BaseView class. +// +////////////////////////////////////////////////////////////////////// + +#include +#include "OCC_BaseView.h" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +OCC_BaseView::OCC_BaseView() +{ + +} + +OCC_BaseView::~OCC_BaseView() +{ + +} diff --git a/TAG_MFC-TIGLViewer/Common/OCC_BaseView.h b/TAG_MFC-TIGLViewer/Common/OCC_BaseView.h new file mode 100644 index 000000000..07d65900b --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_BaseView.h @@ -0,0 +1,22 @@ +// OCC_BaseView.h: interface for the OCC_BaseView class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OCC_BASEVIEW_H__2E048CCA_38F9_11D7_8611_0060B0EE281E__INCLUDED_) +#define AFX_OCC_BASEVIEW_H__2E048CCA_38F9_11D7_8611_0060B0EE281E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include + +class AFX_EXT_CLASS OCC_BaseView : public CView +{ +public: + OCC_BaseView(); + virtual ~OCC_BaseView(); + +}; + +#endif // !defined(AFX_OCC_BASEVIEW_H__2E048CCA_38F9_11D7_8611_0060B0EE281E__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/OCC_ChildFrame.cpp b/TAG_MFC-TIGLViewer/Common/OCC_ChildFrame.cpp new file mode 100644 index 000000000..741e6031f --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_ChildFrame.cpp @@ -0,0 +1,89 @@ +// OCC_BaseChildFrame.cpp: implementation of the OCC_BaseChildFrame class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" + +#include "OCC_BaseChildFrame.h" + +#include + +///////////////////////////////////////////////////////////////////////////// +// OCC_BaseChildFrame + +IMPLEMENT_DYNCREATE (OCC_BaseChildFrame, CMDIChildWnd) + +BEGIN_MESSAGE_MAP(OCC_BaseChildFrame, CMDIChildWnd) + //{{AFX_MSG_MAP(OCC_BaseChildFrame) + ON_WM_CREATE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// OCC_BaseChildFrame construction/destruction + +OCC_BaseChildFrame::OCC_BaseChildFrame() +{ +} + +OCC_BaseChildFrame::~OCC_BaseChildFrame() +{ +} + +BOOL OCC_BaseChildFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CMDIChildWnd::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// OCC_BaseChildFrame diagnostics + +#ifdef _DEBUG +void OCC_BaseChildFrame::AssertValid() const +{ + CMDIChildWnd::AssertValid(); +} + +void OCC_BaseChildFrame::Dump(CDumpContext& dc) const +{ + CMDIChildWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// OCC_BaseChildFrame message handlers + +int OCC_BaseChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_CHILDFRAME)) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar); + + return 0; +} + + +void OCC_BaseChildFrame::ActivateFrame(int nCmdShow) +{ + POSITION pos=AfxGetApp()->GetFirstDocTemplatePosition(); + CDocTemplate* DocT=AfxGetApp()->GetNextDocTemplate(pos); + POSITION p=DocT->GetFirstDocPosition(); + DocT->GetNextDoc(p); + if(p==NULL) + nCmdShow = SW_SHOWMAXIMIZED; + CMDIChildWnd::ActivateFrame(nCmdShow); +} diff --git a/TAG_MFC-TIGLViewer/Common/OCC_ChildFrame.h b/TAG_MFC-TIGLViewer/Common/OCC_ChildFrame.h new file mode 100644 index 000000000..2e95e5fd1 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_ChildFrame.h @@ -0,0 +1,47 @@ +// OCC_BaseChildFrame.h: interface for the OCC_BaseChildFrame class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OCC_BaseChildFrame_H__230F9547_3905_11D7_8611_0060B0EE281E__INCLUDED_) +#define AFX_OCC_BaseChildFrame_H__230F9547_3905_11D7_8611_0060B0EE281E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class OCC_BaseChildFrame : public CMDIChildWnd +{ + DECLARE_DYNCREATE(OCC_BaseChildFrame) +public: + OCC_BaseChildFrame(); + virtual ~OCC_BaseChildFrame(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(OCC_BaseChildFrame) + public: + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + virtual void ActivateFrame(int nCmdShow = -1); + //}}AFX_VIRTUAL + +// Generated message map functions + //{{AFX_MSG(OCC_BaseChildFrame) + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + //}}AFX_MSG + +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +//Attributes +protected: + CToolBar m_wndToolBar; + + DECLARE_MESSAGE_MAP() + +}; + +///////////////////////////////////////////////////////////////////////////// + +#endif // !defined(AFX_OCC_BaseChildFrame_H__230F9547_3905_11D7_8611_0060B0EE281E__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/OCC_MainFrame.cpp b/TAG_MFC-TIGLViewer/Common/OCC_MainFrame.cpp new file mode 100644 index 000000000..1832c6f2a --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_MainFrame.cpp @@ -0,0 +1,185 @@ +// OCC_MainFrame.cpp: implementation of the OCC_MainFrame class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" + +#include "OCC_MainFrame.h" + +#include + +///////////////////////////////////////////////////////////////////////////// +// OCC_MainFrame + +IMPLEMENT_DYNAMIC(OCC_MainFrame, CMDIFrameWnd) + +BEGIN_MESSAGE_MAP(OCC_MainFrame, CMDIFrameWnd) + //{{AFX_MSG_MAP(OCC_MainFrame) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code ! + ON_WM_CREATE() + //}}AFX_MSG_MAP + ON_COMMAND(ID_HELP_FINDER, CMDIFrameWnd::OnHelpFinder) +END_MESSAGE_MAP() + +static UINT indicators[] = +{ + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + +///////////////////////////////////////////////////////////////////////////// +// OCC_MainFrame construction/destruction + +OCC_MainFrame::OCC_MainFrame(BOOL withAISToolBar /*=false*/) +{ + m_withAISToolBar=withAISToolBar; + if(withAISToolBar){ + m_AISToolBar = new CToolBar; +// m_AISToolBar->m_bAutoDelete = 1; + } +} + +OCC_MainFrame::~OCC_MainFrame() +{ + delete m_AISToolBar; +} + +/* +int FindMenuItem(CMenu* Menu, LPCTSTR MenuString) +{ + ASSERT(Menu); + ASSERT(::IsMenu(Menu->GetSafeHmenu())); + + int count = Menu->GetMenuItemCount(); + for (int i = 0; i < count; i++) + { + CString str; + if (Menu->GetMenuString(i, str, MF_BYPOSITION) && + (strcmp(str, MenuString) == 0)) + return i; + } + + return -1; +} +*/ + +int OCC_MainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.Create(this) || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + if (m_withAISToolBar){ + if (!m_AISToolBar->Create(this) || + !m_AISToolBar->LoadToolBar(IDR_TB_AIS)) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + } + + if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators)/sizeof(UINT))) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + + // TODO: Remove this if you don't want tool tips or a resizeable toolbar + m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | + CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); + + // TODO: Delete these three lines if you don't want the toolbar to + // be dockable + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar,AFX_IDW_DOCKBAR_TOP); + if (m_withAISToolBar){ + m_AISToolBar->SetBarStyle(m_AISToolBar->GetBarStyle() | + CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); + m_AISToolBar->EnableDocking(CBRS_ALIGN_ANY); + DockControlBarLeftOf(m_AISToolBar,&m_wndToolBar); + } + +/* + CMenu* menu = GetMenu(); + CMenu* SubMenu = menu->GetSubMenu(2); + int pos = FindMenuItem(SubMenu, "&About SampleName..."); + if (pos > -1) + { + UINT id = SubMenu->GetMenuItemID(pos); + LPCTSTR SampleName = ((OCC_BaseApp* )AfxGetApp())->GetSampleName(); + char* str=""; + strcpy(str,SampleName); + strcat(str,"..."); + char* about = "About "; + strcat(about,str); + SubMenu->ModifyMenu(id, MF_BYCOMMAND, id, about); + } +*/ + return 0; +} + +///////////////////////////////////////////////////////////////////////////// +// OCC_MainFrame diagnostics + +#ifdef _DEBUG +void OCC_MainFrame::AssertValid() const +{ + CMDIFrameWnd::AssertValid(); +} + +void OCC_MainFrame::Dump(CDumpContext& dc) const +{ + CMDIFrameWnd::Dump(dc); +} + +#endif //_DEBUG + +void OCC_MainFrame::SetStatusMessage(const CString & message) +{ + m_wndStatusBar.SetWindowText(message); +} + + +BOOL OCC_MainFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CMDIFrameWnd::PreCreateWindow(cs); +} + +void OCC_MainFrame::DockControlBarLeftOf(CToolBar* Bar,CToolBar* LeftOf) +{ + CRect rect; + DWORD dw; + UINT n; + + // get MFC to adjust the dimensions of all docked ToolBars + // so that GetWindowRect will be accurate + RecalcLayout(); + LeftOf->GetWindowRect(&rect); + rect.OffsetRect(1,0); + dw=LeftOf->GetBarStyle(); + n = 0; + n = (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n; + n = (dw&CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n; + n = (dw&CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n; + n = (dw&CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n; + + // When we take the default parameters on rect, DockControlBar will dock + // each Toolbar on a seperate line. By calculating a rectangle, we in effect + // are simulating a Toolbar being dragged to that location and docked. + DockControlBar(Bar,n,&rect); +} diff --git a/TAG_MFC-TIGLViewer/Common/OCC_MainFrame.h b/TAG_MFC-TIGLViewer/Common/OCC_MainFrame.h new file mode 100644 index 000000000..0f63d92fb --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/OCC_MainFrame.h @@ -0,0 +1,68 @@ +// OCC_MainFrame.h: interface for the OCC_MainFrame class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_OCC_MAINFRAME_H__B7D6F369_38DA_11D7_8611_0060B0EE281E__INCLUDED_) +#define AFX_OCC_MAINFRAME_H__B7D6F369_38DA_11D7_8611_0060B0EE281E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include + +enum OCC_MainFrm{ + without_AIS_TB, + with_AIS_TB +}; + +class Standard_EXPORT OCC_MainFrame : public CMDIFrameWnd +{ + DECLARE_DYNAMIC(OCC_MainFrame) +public: + OCC_MainFrame(BOOL withAISToolBar = false); + virtual ~OCC_MainFrame(); + + void SetStatusMessage(const CString & message); + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CCommonMainFrame) + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + + +// Implementation + +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + void DockControlBarLeftOf(CToolBar* Bar,CToolBar* LeftOf); + + + +// Attributes +protected: // control bar embedded members + CStatusBar m_wndStatusBar; + CToolBar m_wndToolBar; + CToolBar* m_AISToolBar; + BOOL m_withAISToolBar; + + +// Generated message map functions +protected: + //{{AFX_MSG(OCC_MainFrame) + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +#endif // !defined(AFX_OCC_MAINFRAME_H__B7D6F369_38DA_11D7_8611_0060B0EE281E__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/Common/StdAfx.h b/TAG_MFC-TIGLViewer/Common/StdAfx.h new file mode 100644 index 000000000..71ef4e004 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/StdAfx.h @@ -0,0 +1,78 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#ifndef WINVER // Lassen Sie die Verwendung von Features spezifisch für Windows 95 und Windows NT 4 oder später zu. +#define WINVER 0x0400 // Ändern Sie den entsprechenden Wert, um auf Windows 98 und mindestens Windows 2000 abzuzielen. +#endif + +#include // MFC core and standard components +#include // MFC extensions +#include // MFC OLE automation classes +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#if !defined(WNT) + #error WNT precompiler directive is mandatory for CasCade +#endif + +#pragma warning( disable : 4244 ) // Issue warning 4244 +#include "Standard_ShortReal.hxx" +#pragma warning( default : 4244 ) // Issue warning 4244 + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. + diff --git a/TAG_MFC-TIGLViewer/Common/Winmain.cpp b/TAG_MFC-TIGLViewer/Common/Winmain.cpp new file mode 100644 index 000000000..15204f3ec --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/Winmain.cpp @@ -0,0 +1,141 @@ +// This is a part of the Microsoft Foundation Classes C++ library. +// Copyright (C) 1992-1995 Microsoft Corporation +// All rights reserved. +// +// This source code is only intended as a supplement to the +// Microsoft Foundation Classes Reference and related +// electronic documentation provided with the library. +// See these sources for detailed information regarding the +// Microsoft Foundation Classes product. + +#include "stdafx.h" + +#include +#include + +#ifdef AFX_CORE1_SEG +#pragma code_seg(AFX_CORE1_SEG) +#endif + +///////////////////////////////////////////////////////////////////////////// +// Standard WinMain implementation +// Can be replaced as long as 'AfxWinInit' is called first + +// for cout redefinition : +#include // for _open_osfhandle +#include // for _O_TEXT + +#ifdef _DEBUG +#if 0 +#define DISPLAYCONSOLE 1 //please contact bugmaster@opencascade.com if you succeed with porting this mode to the STLPort mode +#endif +#endif + +int AFXAPI AfxWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, int nCmdShow) +{ +#ifdef DISPLAYCONSOLE // By Matra + + + // Redirection of standard output in a consol + int hCrt; BOOL rep; FILE *hf; + _SYSTEM_INFO lps; + GetSystemInfo(&lps); + rep = AllocConsole(); + hCrt = _open_osfhandle((long) GetStdHandle(STD_OUTPUT_HANDLE),_O_TEXT); + hf = _fdopen( hCrt, "w" ); + *stdout = *hf; + // stop the buffer on stdout + int i = setvbuf( stdout, NULL, _IONBF, 0 ); + filebuf ff(hCrt); + cout = &ff; + cout<<"This Debug Window is defined in WinMain.cpp and will disappear in release mode"<InitApplication()) + goto InitFailure; + ASSERT_VALID(pApp); + + // Perform specific initializations + if (!pApp->InitInstance()) + { + if (pApp->m_pMainWnd != NULL) + { + TRACE0("Warning: Destroying non-NULL m_pMainWnd\n"); + pApp->m_pMainWnd->DestroyWindow(); + } + nReturnCode = pApp->ExitInstance(); + goto InitFailure; + } + ASSERT_VALID(pApp); + + +#ifdef _DEBUG // By Matra +Application: + +// new in 2.0 CAS.CADE uses the standard C++ exception mechanism + + // if(DoesNotAbort(_Function)) + try + { + nReturnCode = pApp->Run(); + } +// if(_Function.Catches(STANDARD_TYPE(Standard_Failure))) + catch(Standard_Failure) + { + Standard_SStream ostr; + ostr<Run(); +#endif // _DEBUG // By Matra + + + ASSERT_VALID(pApp); + +InitFailure: +#ifdef _DEBUG + // Check for missing AfxLockTempMap calls + if (AfxGetModuleThreadState()->m_nTempMapLock != 0) + { + TRACE1("Warning: Temp map lock count non-zero (%ld).\n", + AfxGetModuleThreadState()->m_nTempMapLock); + } + + AfxLockTempMaps(); + AfxUnlockTempMaps(); +#endif + + AfxWinTerm(); + +#ifdef DISPLAYCONSOLE // By Matra + // ferme la console pour le cout + fclose( stdout ); + hCrt = _fcloseall(); rep = FreeConsole(); +#endif // DISPLAYCONSOLE // By Matra + + + return nReturnCode; +} + +///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/TAG_MFC-TIGLViewer/Common/res/2dChildFrameTB.bmp b/TAG_MFC-TIGLViewer/Common/res/2dChildFrameTB.bmp new file mode 100644 index 000000000..f46b32744 Binary files /dev/null and b/TAG_MFC-TIGLViewer/Common/res/2dChildFrameTB.bmp differ diff --git a/TAG_MFC-TIGLViewer/Common/res/2dType.ico b/TAG_MFC-TIGLViewer/Common/res/2dType.ico new file mode 100644 index 000000000..73960be96 Binary files /dev/null and b/TAG_MFC-TIGLViewer/Common/res/2dType.ico differ diff --git a/TAG_MFC-TIGLViewer/Common/res/3dChildFrameTB.bmp b/TAG_MFC-TIGLViewer/Common/res/3dChildFrameTB.bmp new file mode 100644 index 000000000..417f228e5 Binary files /dev/null and b/TAG_MFC-TIGLViewer/Common/res/3dChildFrameTB.bmp differ diff --git a/TAG_MFC-TIGLViewer/Common/res/3dType.ico b/TAG_MFC-TIGLViewer/Common/res/3dType.ico new file mode 100644 index 000000000..61335c1c2 Binary files /dev/null and b/TAG_MFC-TIGLViewer/Common/res/3dType.ico differ diff --git a/TAG_MFC-TIGLViewer/Common/res/AIS_TB.bmp b/TAG_MFC-TIGLViewer/Common/res/AIS_TB.bmp new file mode 100644 index 000000000..e509bd08a Binary files /dev/null and b/TAG_MFC-TIGLViewer/Common/res/AIS_TB.bmp differ diff --git a/TAG_MFC-TIGLViewer/Common/res/MainFrame.ico b/TAG_MFC-TIGLViewer/Common/res/MainFrame.ico new file mode 100644 index 000000000..99dbceb63 Binary files /dev/null and b/TAG_MFC-TIGLViewer/Common/res/MainFrame.ico differ diff --git a/TAG_MFC-TIGLViewer/Common/res/OCC_Resource.h b/TAG_MFC-TIGLViewer/Common/res/OCC_Resource.h new file mode 100644 index 000000000..cc797c4cb --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/res/OCC_Resource.h @@ -0,0 +1,138 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by OCC_Resource.rc +// +#define IDR_POPUP 116 +#define IDR_MAINFRAME 128 +#define IDR_2DTYPE 129 +#define IDR_3DTYPE 131 +#define ID_FILE_EXPORT_IMAGE 132 +#define IDR_Popup2D 136 +#define IDR_2dCHILDFRAME 137 +#define IDR_3dCHILDFRAME 138 +#define IDD_ResultDialog 143 +#define IDD_FILESAVECSFDB 144 +#define IDD_FILESAVESTEP 145 +#define IDR_Popup3D 146 +#define IDR_TB_AIS 149 +#define IDD_GrilleRectangulaire 150 +#define IDD_GrilleCirculaire 151 +#define IDD_COLORMESH 552 +#define IDB_coloredmesh 554 +#define IDC_RICHEDIT_ResultDialog 1001 +#define ID_WINDOW_NEW3D 1151 +#define ID_OBJECT_DISPLAYALL 1201 +#define ID_OBJECT_MATERIAL 1205 +#define ID_OBJECT_TRANSPARENCY 1214 +#define IDB_OCC_LOGO 1300 +#define IDC_RectGrid_XOrigin 1400 +#define IDC_RectGrid_Yorigin 1401 +#define IDC_RectGrid_XStep 1402 +#define IDC_RectGrid_YStep 1403 +#define IDC_RectGrid_Rotationangle 1404 +#define IDC_CircGrid_XOrigin 1405 +#define IDC_CircGrid_Yorigin 1406 +#define IDC_CirctGrid_RadiusStep 1407 +#define IDC_CircGrid_DivNumber 1408 +#define IDC_CircGrid_RotationAngle 1409 +#define IDC_CopySelectionToClipboard 1502 +#define IDC_CopyAllToClipboard 1503 +#define IDC_CHECK_XRed 1761 +#define IDC_CHECK_XGreen 1762 +#define IDC_CHECK_YRed 1763 +#define IDC_CHECK_YGreen 1764 +#define IDC_CHECK_YBlue 1765 +#define IDC_CHECK_ZRed 1766 +#define IDC_RADIO1 1767 +#define IDC_RADIO2 1768 +#define IDC_RADIO3 1769 +#define IDC_CHECK_ZGreen 1770 +#define IDC_CHECK_ZBlue 1771 +#define IDC_CHECK_XBlue 1772 +#define IDC_CHECK_X1 1773 +#define IDC_CHECK_Y1 1774 +#define IDC_CHECK_Z1 1775 +#define IDC_FSaveCSFDB_Type 3001 +#define IDC_FSaveSTEP_Type 3002 +#define IDD_AISMATERIAL 7544 +#define IDD_AISMATERIAL1 7545 +#define IDD_AISTRANSPARENCY 7546 +#define IDD_OCC_ABOUTBOX 10000 +#define IDC_ABOUTBOX_TITLE 10001 +#define IDD_AISMATERIAL2 10001 +#define ID_BUTTON2DFitAll 32770 +#define ID_BUTTON2DZoomWin 32771 +#define ID_BUTTON2DZoomProg 32772 +#define ID_BUTTON2DPanning 32773 +#define ID_BUTTON2DGlobPanning 32774 +#define ID_BUTTON2DGridValues 32775 +#define ID_BUTTON2DGridCircPoints 32776 +#define ID_BUTTON2DGridCancel 32777 +#define ID_BUTTON2DGridRectLines 32778 +#define ID_BUTTON2DGridRectPoints 32779 +#define ID_BUTTON2DGridCircLines 32780 +#define ID_OBJECT_REMOVE 32796 +#define ID_BUTTONZoomAll 40000 +#define ID_OBJECT_ERASE 40001 +#define ID_BUTTONZoomWin 40002 +#define ID_BUTTONZoomProg 40003 +#define ID_BUTTONPan 40004 +#define ID_BUTTONPanGlo 40005 +#define ID_BUTTONFront 40006 +#define ID_BUTTONLeft 40007 +#define ID_BUTTONBack 40008 +#define ID_BUTTONRight 40009 +#define ID_BUTTONBottom 40010 +#define ID_BUTTONRot 40011 +#define ID_BUTTONReset 40012 +#define ID_BUTTONHlrOff 40013 +#define ID_BUTTONHlrOn 40014 +#define ID_BUTTONAxo 40015 +#define ID_BUTTONTop 40016 +#define ID_BUTTON40017 40017 +#define ID_BUTTON40033 40033 +#define ID_FILE_IMPORT_CSFDB 40100 +#define ID_FILE_IMPORT_BREP 40101 +#define ID_FILE_IMPORT_STEP 40102 +#define ID_FILE_IMPORT_IGES 40103 +#define ID_FILE_EXPORT_CSFDB 40104 +#define ID_FILE_EXPORT_BREP 40105 +#define ID_FILE_EXPORT_STEP 40106 +#define ID_FILE_EXPORT_IGES 40107 +#define ID_OBJECT_COLOR 40201 +#define ID_OBJECT_SHADING 40202 +#define ID_OBJECT_WIREFRAME 40203 +#define ID_OBJECT_MATERIAL_BRASS 40210 +#define ID_OBJECT_MATERIAL_BRONZE 40211 +#define ID_OBJECT_MATERIAL_COPPER 40212 +#define ID_OBJECT_MATERIAL_GOLD 40213 +#define ID_OBJECT_MATERIAL_PEWTER 40214 +#define ID_OBJECT_MATERIAL_PLASTER 40215 +#define ID_OBJECT_MATERIAL_PLASTIC 40216 +#define ID_OBJECT_MATERIAL_SILVER 40217 +#define ID_OBJECT_MATERIAL_STEEL 40218 +#define ID_OBJECT_MATERIAL_STONE 40219 +#define ID_OBJECT_MATERIAL_SHINY_PLASTIC 40220 +#define ID_OBJECT_MATERIAL_SATIN 40221 +#define ID_OBJECT_MATERIAL_METALIZED 40222 +#define ID_OBJECT_MATERIAL_NEON_GNC 40223 +#define ID_OBJECT_MATERIAL_CHROME 40224 +#define ID_OBJECT_MATERIAL_ALUMINIUM 40225 +#define ID_OBJECT_MATERIAL_OBSIDIAN 40226 +#define ID_OBJECT_MATERIAL_NEON_PHC 40227 +#define ID_OBJECT_MATERIAL_JADE 40228 +#define ID_OBJECT_MATERIAL_DEFAULT 40229 +#define ID_Modify_ChangeBackground 40230 +#define IDC_EDITAISTRANSP 40309 +#define IDC_SPINAISTRANSP 40310 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 119 +#define _APS_NEXT_COMMAND_VALUE 40034 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/TAG_MFC-TIGLViewer/Common/res/OCC_Resource.rc b/TAG_MFC-TIGLViewer/Common/res/OCC_Resource.rc new file mode 100644 index 000000000..ef5dc40c4 --- /dev/null +++ b/TAG_MFC-TIGLViewer/Common/res/OCC_Resource.rc @@ -0,0 +1,577 @@ +// Microsoft Visual C++ generated resource script. +// +#include "OCC_Resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" +#include "OCC_Resource.h" +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Englisch (USA) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "OCC_Resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "#include ""OCC_Resource.h""\0" +END + +3 TEXTINCLUDE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_OCC_LOGO BITMAP "occ_logo.bmp" +IDR_2dCHILDFRAME BITMAP "2dChildFrameTB.bmp" +IDR_3dCHILDFRAME BITMAP "3dChildFrameTB.bmp" +IDR_TB_AIS BITMAP "AIS_TB.bmp" +IDB_coloredmesh BITMAP "coloredm.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OCC_ABOUTBOX DIALOGEX 34, 22, 201, 161 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CTEXT "Sample SampleName, Open CASCADE Technology OCC_Version", + IDC_ABOUTBOX_TITLE,3,8,195,8 + CTEXT "Copyright (C) 2001-2004, Open CASCADE Company", + IDC_STATIC,18,99,165,8,SS_CENTERIMAGE + DEFPUSHBUTTON "OK",IDOK,56,135,88,14,WS_GROUP + CTEXT "http://www.opencascade.com",IDC_STATIC,51,115,98,8, + SS_CENTERIMAGE + CONTROL 1300,IDC_STATIC,"Static",SS_BITMAP,36,27,132,62, + WS_EX_CLIENTEDGE +END + +IDD_ResultDialog DIALOG 0, 0, 212, 202 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "",IDC_RICHEDIT_ResultDialog,"RICHEDIT",TCS_HOTTRACK | + TCS_VERTICAL | TCS_RAGGEDRIGHT | TCS_MULTISELECT | + WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,0,10, + 210,160 + PUSHBUTTON "Copy selection to clipboard", + IDC_CopySelectionToClipboard,5,176,100,15 + PUSHBUTTON "Copy all to clipboard",IDC_CopyAllToClipboard,107,176, + 100,15 +END + +IDD_GrilleRectangulaire DIALOG 0, 0, 124, 145 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Rectangular Grid" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,38,107,50,14 + PUSHBUTTON "Cancel",IDCANCEL,38,124,50,14 + EDITTEXT IDC_RectGrid_XOrigin,73,5,45,15,ES_AUTOHSCROLL + EDITTEXT IDC_RectGrid_Yorigin,73,25,45,15,ES_AUTOHSCROLL + EDITTEXT IDC_RectGrid_XStep,73,45,45,15,ES_AUTOHSCROLL + EDITTEXT IDC_RectGrid_YStep,73,65,45,15,ES_AUTOHSCROLL + EDITTEXT IDC_RectGrid_Rotationangle,73,85,45,15,ES_AUTOHSCROLL + LTEXT "X Origin",IDC_STATIC,14,7,45,15 + LTEXT "Y Origin",IDC_STATIC,14,27,45,15 + LTEXT "X Step",IDC_STATIC,14,47,45,15 + LTEXT "Y Step ",IDC_STATIC,14,67,45,15 + LTEXT "Rotation angle ",IDC_STATIC,14,87,51,15 +END + +IDD_GrilleCirculaire DIALOG 0, 0, 124, 145 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Circular Grid" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,38,107,50,14 + PUSHBUTTON "Cancel",IDCANCEL,38,124,50,14 + EDITTEXT IDC_CircGrid_XOrigin,73,5,45,15,ES_AUTOHSCROLL + EDITTEXT IDC_CircGrid_Yorigin,73,25,45,15,ES_AUTOHSCROLL + EDITTEXT IDC_CirctGrid_RadiusStep,73,45,45,15,ES_AUTOHSCROLL + EDITTEXT IDC_CircGrid_DivNumber,73,65,45,15,ES_AUTOHSCROLL | + ES_NUMBER + EDITTEXT IDC_CircGrid_RotationAngle,73,85,45,15,ES_AUTOHSCROLL + LTEXT "X Origin",IDC_STATIC,0,7,55,15 + LTEXT "Y Origin",IDC_STATIC,0,27,55,15 + LTEXT "RadiusStep",IDC_STATIC,0,47,55,15 + LTEXT "Division number",IDC_STATIC,0,67,55,15 + LTEXT "Rotation angle ",IDC_STATIC,0,87,55,15 +END + +IDD_AISTRANSPARENCY DIALOG 0, 0, 68, 28 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Transparency" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_EDITAISTRANSP,15,6,27,12,ES_AUTOHSCROLL | ES_NUMBER | + WS_GROUP + CONTROL "Spin1",IDC_SPINAISTRANSP,"msctls_updown32", + UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_GROUP,41,6,11,12 +END + +IDD_AISMATERIAL DIALOG 0, 0, 71, 221 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Material" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "",IDC_STATIC,15,211,8,8 + CONTROL "Copper",ID_OBJECT_MATERIAL_COPPER,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,43,56,10 + CONTROL "Aluminium",ID_OBJECT_MATERIAL_ALUMINIUM,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,3,56,10 + CONTROL "Chrome",ID_OBJECT_MATERIAL_CHROME,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,33,56,10 + CONTROL "Bronze",ID_OBJECT_MATERIAL_BRONZE,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,23,56,10 + CONTROL "Metilized",ID_OBJECT_MATERIAL_METALIZED,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,73,56,10 + CONTROL "Brass",ID_OBJECT_MATERIAL_BRASS,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,13,56,10 + CONTROL "Gold",ID_OBJECT_MATERIAL_GOLD,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,53,56,10 + CONTROL "Pewter",ID_OBJECT_MATERIAL_PEWTER,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,112,56,10 + CONTROL "Silver",ID_OBJECT_MATERIAL_SILVER,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,162,56,10 + CONTROL "Steel",ID_OBJECT_MATERIAL_STEEL,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,172,56,10 + CONTROL "Neon PHC",ID_OBJECT_MATERIAL_NEON_PHC,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,93,56,10 + CONTROL "Stone",ID_OBJECT_MATERIAL_STONE,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,182,56,10 + CONTROL "Obsidian",ID_OBJECT_MATERIAL_OBSIDIAN,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,103,56,10 + CONTROL "Jade",ID_OBJECT_MATERIAL_JADE,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,63,56,10 + CONTROL "Plastic",ID_OBJECT_MATERIAL_PLASTIC,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,122,56,10 + CONTROL "Plaster",ID_OBJECT_MATERIAL_PLASTER,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,132,56,10 + CONTROL "Shiny Plastic",ID_OBJECT_MATERIAL_SHINY_PLASTIC,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,152,56,10 + CONTROL "Satin",ID_OBJECT_MATERIAL_SATIN,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,142,56,10 + CONTROL "Neon GNC",ID_OBJECT_MATERIAL_NEON_GNC,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,83,56,10 + CONTROL "Default",ID_OBJECT_MATERIAL_DEFAULT,"Button", + BS_AUTORADIOBUTTON | BS_PUSHLIKE,5,201,56,10 +END + +IDD_COLORMESH DIALOG 0, 0, 167, 194 +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION +CAPTION "Colored mesh" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,58,171,50,14 + GROUPBOX "Altitude",IDC_STATIC,7,7,153,58 + CONTROL "green to brown",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON, + 19,22,132,16 + CONTROL "blue to white",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON, + 19,42,132,16 + CONTROL "Custom :",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,20,70, + 39,16 + LTEXT "Red",IDC_STATIC,53,95,16,10 + LTEXT "Green",IDC_STATIC,71,95,21,10 + LTEXT "Blue",IDC_STATIC,96,95,17,10 + LTEXT "X",IDC_STATIC,26,115,10,10 + LTEXT "Y",IDC_STATIC,26,130,10,10 + LTEXT "Z",IDC_STATIC,26,145,10,10 + CONTROL "",IDC_CHECK_XRed,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 53,115,10,8 + CONTROL "",IDC_CHECK_XGreen,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,75,115,10,8 + CONTROL "",IDC_CHECK_YRed,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 53,130,10,8 + CONTROL "",IDC_CHECK_YGreen,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,75,130,10,8 + CONTROL "",IDC_CHECK_YBlue,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 96,130,10,8 + CONTROL "",IDC_CHECK_ZRed,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 53,145,10,8 + CONTROL "",IDC_CHECK_ZGreen,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,75,145,10,8 + CONTROL "",IDC_CHECK_ZBlue,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 96,145,10,8 + CONTROL "",IDC_CHECK_XBlue,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + 96,115,10,8 + LTEXT "-1",IDC_STATIC,128,95,10,10,NOT WS_VISIBLE + CONTROL "",IDC_CHECK_X1,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,128,115,10,8 + CONTROL "",IDC_CHECK_Y1,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,128,130,10,8 + CONTROL "",IDC_CHECK_Z1,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,128,145,10,8 + GROUPBOX "",IDC_STATIC,21,104,120,9 + GROUPBOX "",IDC_STATIC,40,86,8,73 + GROUPBOX "",IDC_STATIC,115,86,8,73 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON "MainFrame.ico" +IDR_2DTYPE ICON "2dType.ico" +IDR_3DTYPE ICON "3dType.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_2dCHILDFRAME TOOLBAR 20, 20 +BEGIN + BUTTON ID_BUTTON2DFitAll + BUTTON ID_BUTTON2DZoomWin + BUTTON ID_BUTTON2DZoomProg + SEPARATOR + BUTTON ID_BUTTON2DPanning + BUTTON ID_BUTTON2DGlobPanning + SEPARATOR + BUTTON ID_BUTTON2DGridRectLines + BUTTON ID_BUTTON2DGridRectPoints + BUTTON ID_BUTTON2DGridCircLines + BUTTON ID_BUTTON2DGridCircPoints + BUTTON ID_BUTTON2DGridValues + BUTTON ID_BUTTON2DGridCancel +END + +IDR_3dCHILDFRAME TOOLBAR 20, 20 +BEGIN + BUTTON ID_BUTTONZoomAll + BUTTON ID_BUTTONZoomWin + BUTTON ID_BUTTONZoomProg + SEPARATOR + BUTTON ID_BUTTONPan + BUTTON ID_BUTTONPanGlo + SEPARATOR + BUTTON ID_BUTTONFront + BUTTON ID_BUTTONTop + BUTTON ID_BUTTONLeft + BUTTON ID_BUTTONBack + BUTTON ID_BUTTONRight + BUTTON ID_BUTTONBottom + BUTTON ID_BUTTONAxo + SEPARATOR + BUTTON ID_BUTTONRot + BUTTON ID_BUTTONReset + SEPARATOR + BUTTON ID_BUTTONHlrOff + BUTTON ID_BUTTONHlrOn +END + +IDR_TB_AIS TOOLBAR 20, 20 +BEGIN + BUTTON ID_OBJECT_WIREFRAME + BUTTON ID_OBJECT_SHADING + SEPARATOR + BUTTON ID_OBJECT_COLOR + BUTTON ID_OBJECT_MATERIAL + BUTTON ID_OBJECT_TRANSPARENCY + SEPARATOR + BUTTON ID_OBJECT_ERASE + BUTTON ID_OBJECT_DISPLAYALL + SEPARATOR + BUTTON ID_OBJECT_REMOVE +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_Popup2D MENU +BEGIN + POPUP "Entry1" + BEGIN + MENUITEM "Background Color...", ID_Modify_ChangeBackground + END +END + +IDR_Popup3D MENU +BEGIN + POPUP "Background" + BEGIN + MENUITEM "Background Color...", ID_Modify_ChangeBackground + END + POPUP "Object(s)" + BEGIN + MENUITEM "Erase", ID_OBJECT_ERASE + MENUITEM "Shading", ID_OBJECT_SHADING + MENUITEM "Wireframe", ID_OBJECT_WIREFRAME + MENUITEM "Color...", ID_OBJECT_COLOR + MENUITEM "Material...", ID_OBJECT_MATERIAL + POPUP "Material" + BEGIN + MENUITEM "Aluminium", ID_OBJECT_MATERIAL_ALUMINIUM + + MENUITEM "Brass", ID_OBJECT_MATERIAL_BRASS + MENUITEM "Bronze", ID_OBJECT_MATERIAL_BRONZE + + MENUITEM "Chrome", ID_OBJECT_MATERIAL_CHROME + + MENUITEM "Copper", ID_OBJECT_MATERIAL_COPPER + + MENUITEM "Gold", ID_OBJECT_MATERIAL_GOLD + MENUITEM "Jade", ID_OBJECT_MATERIAL_JADE + MENUITEM "Metalized", ID_OBJECT_MATERIAL_METALIZED + + MENUITEM "Neon GNC", ID_OBJECT_MATERIAL_NEON_GNC + + MENUITEM "Neon PHC", ID_OBJECT_MATERIAL_NEON_PHC + + MENUITEM "Obsidian", ID_OBJECT_MATERIAL_OBSIDIAN + + MENUITEM "Pewter", ID_OBJECT_MATERIAL_PEWTER + + MENUITEM "Plaster", ID_OBJECT_MATERIAL_PLASTER + + MENUITEM "Plastic", ID_OBJECT_MATERIAL_PLASTIC + + MENUITEM "Satin", ID_OBJECT_MATERIAL_SATIN + MENUITEM "Shiny plastic", ID_OBJECT_MATERIAL_SHINY_PLASTIC + + MENUITEM "Silver", ID_OBJECT_MATERIAL_SILVER + + MENUITEM "Steel", ID_OBJECT_MATERIAL_STEEL + MENUITEM "Stone", ID_OBJECT_MATERIAL_STONE + MENUITEM SEPARATOR + MENUITEM "Default", ID_OBJECT_MATERIAL_DEFAULT + + END + MENUITEM "Transparency...", ID_OBJECT_TRANSPARENCY + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINFRAME ACCELERATORS +BEGIN + "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ResultDialog, DIALOG + BEGIN + BOTTOMMARGIN, 201 + END + + IDD_AISMATERIAL, DIALOG + BEGIN + RIGHTMARGIN, 67 + BOTTOMMARGIN, 219 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + ID_FILE_NEW "Create a new document\nNew" + ID_FILE_CLOSE "Close the active document\nClose" +END + +STRINGTABLE +BEGIN + ID_FILE_EXPORT_IMAGE "Export image \n Export image" +END + +STRINGTABLE +BEGIN + ID_APP_ABOUT "Display program information\nAbout" + ID_APP_EXIT "Quit the application\nExit" +END + +STRINGTABLE +BEGIN + ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar" + ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar" +END + +STRINGTABLE +BEGIN + ID_WINDOW_NEW "Open another window for the active document\nNew Window" + ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons" + ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows" + ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows" +END + +STRINGTABLE +BEGIN + ID_BUTTON2DFitAll "Press to zoom the application objects in the view\nFitAll" + ID_BUTTON2DZoomWin "Press and drag MB1 to select a zoom window\nZoom Window" + ID_BUTTON2DZoomProg "Press and drag MB1 to zoom\nDynamic Zooming" + ID_BUTTON2DPanning "Press and drag MB1 to pan\nDynamic Panning" + ID_BUTTON2DGlobPanning "Press and select a new view center\nGlobal Panning" + ID_BUTTON2DGridValues "Press to edit the grid value\nEdit" + ID_BUTTON2DGridCircPoints + "Press to activate circular grid with points\nCircular grid with points" + ID_BUTTON2DGridCancel "Press to erase the grid\nErase" + ID_BUTTON2DGridRectLines + "Press to activate rectangular grid with lines\nRectangular Grid with lines" + ID_BUTTON2DGridRectPoints + "Press to activate rectangular grid with points\nRectangular Grid with points" + ID_BUTTON2DGridCircLines + "Press to activate circular grid with lines\nCircular grid with lines" +END + +STRINGTABLE +BEGIN + AFX_IDS_SCSIZE "Change the window size" + AFX_IDS_SCMOVE "Change the window position" + AFX_IDS_SCMINIMIZE "Reduce the window to an icon" + AFX_IDS_SCMAXIMIZE "Enlarge the window to full size" + AFX_IDS_SCCLOSE "Close the active window" +END + +STRINGTABLE +BEGIN + AFX_IDS_SCRESTORE "Restore the window to normal size" +END + +STRINGTABLE +BEGIN + ID_INDICATOR_EXT "EXT" + ID_INDICATOR_CAPS "CAP" + ID_INDICATOR_NUM "NUM" + ID_INDICATOR_SCRL "SCRL" + ID_INDICATOR_OVR "OVR" + ID_INDICATOR_REC "REC" +END + +STRINGTABLE +BEGIN + ID_BUTTONZoomAll "Press to zoom the application objects in the view\nFitAll" + ID_OBJECT_ERASE "Erase selected shape\nErase" + ID_BUTTONZoomWin "Press and drag MB1 to select a zoom window\nZoom Window" + ID_BUTTONZoomProg "Press and drag MB1 to zoom\nDynamic Zooming" + ID_BUTTONPan "Press and drag MB1 to pan\nDynamic Panning" + ID_BUTTONPanGlo "Press and select a new view center\nGlobal Panning" + ID_BUTTONFront "Press to select a front View\nFront " + ID_BUTTONLeft "Press to select a left View\nLeft" + ID_BUTTONBack "Press to select a back View\nBack" + ID_BUTTONRight "Press to select a right View\nRight" + ID_BUTTONBottom "Press to select a bottom View\nBottom" + ID_BUTTONRot "Press and drag MB1 to rotate\nDynamic Rotation" + ID_BUTTONReset "Press to reset view\nReset" + ID_BUTTONHlrOff "Press to switch hidden lines mode off\nHidden off" + ID_BUTTONHlrOn "Press to switch hidden lines mode on\nHidden On" + ID_BUTTONAxo "Press to select axonometric View\nAxo" +END + +STRINGTABLE +BEGIN + ID_BUTTONTop "Press to select a top View\nTop" +END + +STRINGTABLE +BEGIN + ID_OBJECT_REMOVE "Remove selected shape\nRemove" +END + +STRINGTABLE +BEGIN + ID_OBJECT_DISPLAYALL "Display all erased shapes\nDisplay" + ID_OBJECT_MATERIAL "Change object material\nMaterial..." + ID_OBJECT_TRANSPARENCY "Change object transparency\nTransparency..." +END + +STRINGTABLE +BEGIN + ID_OBJECT_COLOR "Change object color\nColor..." + ID_OBJECT_SHADING "Put selection in shading\nShading" + ID_OBJECT_WIREFRAME "Put selection in wireframe\nWireframe" +END + +#endif // Englisch (USA) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif +#include "afxres.rc" // Standard components +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/TAG_MFC-TIGLViewer/Common/res/coloredm.bmp b/TAG_MFC-TIGLViewer/Common/res/coloredm.bmp new file mode 100644 index 000000000..93937ae64 Binary files /dev/null and b/TAG_MFC-TIGLViewer/Common/res/coloredm.bmp differ diff --git a/TAG_MFC-TIGLViewer/Common/res/occ_logo.bmp b/TAG_MFC-TIGLViewer/Common/res/occ_logo.bmp new file mode 100644 index 000000000..443a7de61 Binary files /dev/null and b/TAG_MFC-TIGLViewer/Common/res/occ_logo.bmp differ diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/ConfigurationDialog.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/ConfigurationDialog.cpp new file mode 100644 index 000000000..8975391bf --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/ConfigurationDialog.cpp @@ -0,0 +1,72 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdafx.h" +#include "TIGLViewer.h" +#include "ConfigurationDialog.h" +#include "CCPACSFuselage.h" +#include "TIGLViewerDoc.h" +#include "CCPACSConfiguration.h" + +IMPLEMENT_DYNAMIC(CConfigurationDialog, CDialog) + +BEGIN_MESSAGE_MAP(CConfigurationDialog, CDialog) +END_MESSAGE_MAP() + +CConfigurationDialog::CConfigurationDialog(std::vector* configVector) + : CDialog(CConfigurationDialog::IDD, 0) +{ + configurations = configVector; +} + +CConfigurationDialog::~CConfigurationDialog() +{ +} + +void CConfigurationDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_CONFIGURATION_LIST, m_configurationList); +} + +int CConfigurationDialog::GetConfigurationIndex(void) const +{ + return index; +} + +void CConfigurationDialog::OnOK() +{ + UpdateData(TRUE); + index = m_configurationList.GetCurSel(); + CDialog::OnOK(); +} + +BOOL CConfigurationDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + + + for (std::vector::size_type i = 0; i < configurations->size(); i++) + { + m_configurationList.InsertString(i - 1, configurations->at(i)); + } + return TRUE; // return TRUE unless you set the focus to a control +} diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/ConfigurationDialog.h b/TAG_MFC-TIGLViewer/TIGLViewer/ConfigurationDialog.h new file mode 100644 index 000000000..f11953c46 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/ConfigurationDialog.h @@ -0,0 +1,55 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once + +#include "afxwin.h" +#include + +class CTIGLViewerDoc; +namespace tigl +{ + class CCPACSConfiguration; +} + +// CWingDialog-Dialogfeld +class CConfigurationDialog : public CDialog +{ +public: + + CConfigurationDialog(std::vector* configVector); + virtual ~CConfigurationDialog(); + virtual BOOL OnInitDialog(); + int GetConfigurationIndex(void) const; + + enum { IDD = IDD_CONFIGURATION_DIALOG }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung + virtual void OnOK(); + +private: + CListBox m_configurationList; + int index; + std::vector* configurations; + + DECLARE_DYNAMIC(CConfigurationDialog) + DECLARE_MESSAGE_MAP() +}; diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/FuselageDialog.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageDialog.cpp new file mode 100644 index 000000000..0511c50cc --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageDialog.cpp @@ -0,0 +1,92 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdafx.h" +#include "TIGLViewer.h" +#include "FuselageDialog.h" +#include "CCPACSFuselage.h" +#include "TIGLViewerDoc.h" +#include "CCPACSConfiguration.h" +#include ".\fuselagedialog.h" + +IMPLEMENT_DYNAMIC(CFuselageDialog, CDialog) + +BEGIN_MESSAGE_MAP(CFuselageDialog, CDialog) + ON_LBN_SELCHANGE(IDC_FUSELAGE_LIST, OnLbnSelchangeFuselageList) +END_MESSAGE_MAP() + +CFuselageDialog::CFuselageDialog(CTIGLViewerDoc& document) + : CDialog(CFuselageDialog::IDD, 0) + , m_document(document) +{ +} + +CFuselageDialog::~CFuselageDialog() +{ +} + +void CFuselageDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_FUSELAGE_LIST, m_fuselageList); +} + +int CFuselageDialog::GetFuselageIndex(void) const +{ + return index; +} + +std::string CFuselageDialog::GetFuselageName(void) const +{ + return fuselageName; +} + +void CFuselageDialog::OnOK() +{ + CString strTemp; + UpdateData(TRUE); + index = m_fuselageList.GetCurSel(); + m_fuselageList.GetText(index, strTemp); + fuselageName = (char*)(LPCSTR)strTemp; + CDialog::OnOK(); +} + +BOOL CFuselageDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Initialize wing list + tigl::CCPACSConfiguration& config = m_document.GetConfiguration(); + int fuselageCount = config.GetFuselageCount(); + for (int i = 1; i <= fuselageCount; i++) + { + tigl::CCPACSFuselage& fuselage = config.GetFuselage(i); + std::string name = fuselage.GetName(); + if (name == "") name = "Unknown fuselage"; + m_fuselageList.InsertString(i - 1, _T(name.c_str())); + } + return TRUE; // return TRUE unless you set the focus to a control +} + +void CFuselageDialog::OnLbnSelchangeFuselageList() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. +} diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/FuselageDialog.h b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageDialog.h new file mode 100644 index 000000000..ff5368d80 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageDialog.h @@ -0,0 +1,58 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once + +#include "afxwin.h" + +class CTIGLViewerDoc; +namespace tigl +{ + class CCPACSConfiguration; +} + +// CWingDialog-Dialogfeld +class CFuselageDialog : public CDialog +{ +public: + + CFuselageDialog(CTIGLViewerDoc& document); + virtual ~CFuselageDialog(); + virtual BOOL OnInitDialog(); + int GetFuselageIndex(void) const; + std::string GetFuselageName(void) const; + + enum { IDD = IDD_FUSELAGE_DIALOG }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung + virtual void OnOK(); + +private: + CTIGLViewerDoc& m_document; + CListBox m_fuselageList; + int index; + std::string fuselageName; + + DECLARE_DYNAMIC(CFuselageDialog) + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnLbnSelchangeFuselageList(); +}; diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/FuselageProfileDialog.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageProfileDialog.cpp new file mode 100644 index 000000000..7a87882f0 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageProfileDialog.cpp @@ -0,0 +1,80 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdafx.h" +#include "TIGLViewer.h" +#include "FuselageProfileDialog.h" +#include "TIGLViewerDoc.h" +#include "CCPACSConfiguration.h" +#include "CCPACSFuselageProfile.h" + + +IMPLEMENT_DYNAMIC(CFuselageProfileDialog, CDialog) + +BEGIN_MESSAGE_MAP(CFuselageProfileDialog, CDialog) +END_MESSAGE_MAP() + +CFuselageProfileDialog::CFuselageProfileDialog(CTIGLViewerDoc& document) + : CDialog(CFuselageProfileDialog::IDD, 0) + , m_document(document) +{ +} + +CFuselageProfileDialog::~CFuselageProfileDialog() +{ +} + +int CFuselageProfileDialog::GetProfileIndex(void) const +{ + return m_profileIndex; +} + +void CFuselageProfileDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_FUSELAGE_PROFILE_LIST, m_profileList); +} + +BOOL CFuselageProfileDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Initialize fuselage profile list + tigl::CCPACSConfiguration& config = m_document.GetConfiguration(); + int profileCount = config.GetFuselageProfileCount(); + for (int i = 1; i <= profileCount; i++) + { + tigl::CCPACSFuselageProfile& profile = config.GetFuselageProfile(i); + std::string filename = profile.GetFileName(); + std::string name = profile.GetName(); + if (name == "") name = "---"; + std::string entry = filename + " (" + name + ")"; + m_profileList.InsertString(i - 1, _T(entry.c_str())); + } + return TRUE; // return TRUE unless you set the focus to a control +} + +void CFuselageProfileDialog::OnOK() +{ + UpdateData(TRUE); + m_profileIndex = m_profileList.GetCurSel(); + CDialog::OnOK(); +} diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/FuselageProfileDialog.h b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageProfileDialog.h new file mode 100644 index 000000000..ed68053a6 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageProfileDialog.h @@ -0,0 +1,53 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once +#include "afxwin.h" + +class CTIGLViewerDoc; +namespace tigl +{ + class CCPACSConfiguration; +} + +class CFuselageProfileDialog : public CDialog +{ +public: + CFuselageProfileDialog(CTIGLViewerDoc& document); + virtual ~CFuselageProfileDialog(); + virtual BOOL OnInitDialog(); + int GetProfileIndex(void) const; + + // Dialogfelddaten + enum { IDD = IDD_FUSELAGE_PROFILE_DIALOG }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung + virtual void OnOK(); + +private: + CTIGLViewerDoc& m_document; + CListBox m_profileList; + int m_profileIndex; + + DECLARE_DYNAMIC(CFuselageProfileDialog) + DECLARE_MESSAGE_MAP() + +}; diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/FuselageUIDDialog.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageUIDDialog.cpp new file mode 100644 index 000000000..ffb1cb00f --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageUIDDialog.cpp @@ -0,0 +1,92 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdafx.h" +#include "TIGLViewer.h" +#include "FuselageUIDDialog.h" +#include "CCPACSFuselage.h" +#include "TIGLViewerDoc.h" +#include "CCPACSConfiguration.h" +#include ".\fuselageuiddialog.h" + +IMPLEMENT_DYNAMIC(CFuselageUIDDialog, CDialog) + +BEGIN_MESSAGE_MAP(CFuselageUIDDialog, CDialog) + ON_LBN_SELCHANGE(IDC_FUSELAGE_LIST, OnLbnSelchangeFuselageList) +END_MESSAGE_MAP() + +CFuselageUIDDialog::CFuselageUIDDialog(CTIGLViewerDoc& document) + : CDialog(CFuselageUIDDialog::IDD, 0) + , m_document(document) +{ +} + +CFuselageUIDDialog::~CFuselageUIDDialog() +{ +} + +void CFuselageUIDDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_FUSELAGE_LIST, m_fuselageList); +} + +int CFuselageUIDDialog::GetFuselageIndex(void) const +{ + return index; +} + +std::string CFuselageUIDDialog::GetFuselageUID(void) const +{ + return fuselageUID; +} + +void CFuselageUIDDialog::OnOK() +{ + CString strTemp; + UpdateData(TRUE); + index = m_fuselageList.GetCurSel(); + m_fuselageList.GetText(index, strTemp); + fuselageUID = (char*)(LPCSTR)strTemp; + CDialog::OnOK(); +} + +BOOL CFuselageUIDDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Initialize wing list + tigl::CCPACSConfiguration& config = m_document.GetConfiguration(); + int fuselageCount = config.GetFuselageCount(); + for (int i = 1; i <= fuselageCount; i++) + { + tigl::CCPACSFuselage& fuselage = config.GetFuselage(i); + std::string name = fuselage.GetUID(); + if (name == "") name = "Unknown fuselage"; + m_fuselageList.InsertString(i - 1, _T(name.c_str())); + } + return TRUE; // return TRUE unless you set the focus to a control +} + +void CFuselageUIDDialog::OnLbnSelchangeFuselageList() +{ + // TODO: Fügen Sie hier Ihren Kontrollbehandlungscode für die Benachrichtigung ein. +} diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/FuselageUIDDialog.h b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageUIDDialog.h new file mode 100644 index 000000000..f3a643f53 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/FuselageUIDDialog.h @@ -0,0 +1,58 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once + +#include "afxwin.h" + +class CTIGLViewerDoc; +namespace tigl +{ + class CCPACSConfiguration; +} + +// CWingDialog-Dialogfeld +class CFuselageUIDDialog : public CDialog +{ +public: + + CFuselageUIDDialog(CTIGLViewerDoc& document); + virtual ~CFuselageUIDDialog(); + virtual BOOL OnInitDialog(); + int GetFuselageIndex(void) const; + std::string GetFuselageUID(void) const; + + enum { IDD = IDD_FUSELAGE_DIALOG }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung + virtual void OnOK(); + +private: + CTIGLViewerDoc& m_document; + CListBox m_fuselageList; + int index; + std::string fuselageUID; + + DECLARE_DYNAMIC(CFuselageUIDDialog) + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnLbnSelchangeFuselageList(); +}; diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Point.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Point.cpp new file mode 100644 index 000000000..5b52b2a3a --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Point.cpp @@ -0,0 +1,93 @@ +// ISession_Point.cpp: implementation of the ISession_Point class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ISession_Point.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +//#define new DEBUG_NEW +#endif +IMPLEMENT_STANDARD_HANDLE(ISession_Point,AIS_InteractiveObject) +IMPLEMENT_STANDARD_RTTI(ISession_Point,AIS_InteractiveObject) +// +// Foreach ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and +// a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro. +// We must respect the order: from the direct ancestor class +// to the base class. +// +IMPLEMENT_STANDARD_TYPE(ISession_Point) + IMPLEMENT_STANDARD_SUPERTYPE(AIS_InteractiveObject) + IMPLEMENT_STANDARD_SUPERTYPE(SelectMgr_SelectableObject) + IMPLEMENT_STANDARD_SUPERTYPE(PrsMgr_PresentableObject) + IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared) + IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(AIS_InteractiveObject) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(SelectMgr_SelectableObject) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(PrsMgr_PresentableObject) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(ISession_Point) + + +#include "Graphic2d_CircleMarker.hxx" +#include "StdPrs_Point.hxx" +#include "Geom_CartesianPoint.hxx" +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// +ISession_Point::ISession_Point(Standard_Real X,Standard_Real Y ,Standard_Real Z) +:myPoint(gp_Pnt(X,Y,Z)) +{ + +} + +ISession_Point::ISession_Point(gp_Pnt2d& aPoint,Standard_Real Elevation) +:myPoint(gp_Pnt(aPoint.X(),aPoint.Y(),Elevation)) +{ + +} + +ISession_Point::ISession_Point(gp_Pnt& aPoint) +:myPoint(aPoint) +{ + +} + +ISession_Point::~ISession_Point() +{ + +} + +void ISession_Point::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, + const Handle(Prs3d_Presentation)& aPresentation, + const Standard_Integer aMode) +{ + Handle(Geom_CartesianPoint) aGeomPoint = new Geom_CartesianPoint(myPoint); + + StdPrs_Point::Add(aPresentation,aGeomPoint,myDrawer); + } + + +void ISession_Point::Compute(const Handle(Prs3d_Projector)& aProjector, + const Handle(Prs3d_Presentation)& aPresentation) + { + } + +void ISession_Point::Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager, + const Handle(Graphic2d_GraphicObject)& aGrObj, + const Standard_Integer unMode) +{ + Handle(Graphic2d_CircleMarker) aCircleMarker; + aCircleMarker = new Graphic2d_CircleMarker(aGrObj,myPoint.X(),myPoint.Y(),0,0,1); +} + +void ISession_Point::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, + const Standard_Integer unMode) +{ +} + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Point.h b/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Point.h new file mode 100644 index 000000000..d774fa6b3 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Point.h @@ -0,0 +1,45 @@ +// ISession_Point.h: interface for the ISession_Point class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_ISESSION_POINT_H__A9B277C3_A69E_11D1_8DA4_0800369C8A03__INCLUDED_) +#define AFX_ISESSION_POINT_H__A9B277C3_A69E_11D1_8DA4_0800369C8A03__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include +#include + + +DEFINE_STANDARD_HANDLE(ISession_Point,AIS_InteractiveObject) +class ISession_Point : public AIS_InteractiveObject +{ +public: + ISession_Point(); + ISession_Point(Standard_Real X,Standard_Real Y ,Standard_Real Z); + ISession_Point(gp_Pnt2d& aPoint,Standard_Real Elevation = 0); + ISession_Point(gp_Pnt& aPoint); + + virtual ~ISession_Point(); + DEFINE_STANDARD_RTTI(ISession_Point) + +private : + +void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, + const Handle(Prs3d_Presentation)& aPresentation, + const Standard_Integer aMode); +void Compute (const Handle(Prs3d_Projector)& aProjector, + const Handle(Prs3d_Presentation)& aPresentation) ; +void Compute (const Handle(PrsMgr_PresentationManager2d)& aPresentationManager, + const Handle(Graphic2d_GraphicObject)& aGrObj, + const Standard_Integer unMode = 0) ; +void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, + const Standard_Integer unMode) ; + +gp_Pnt myPoint; + +}; + +#endif // !defined(AFX_ISESSION_POINT_H__A9B277C3_A69E_11D1_8DA4_0800369C8A03__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Text.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Text.cpp new file mode 100644 index 000000000..19cac7d8a --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Text.cpp @@ -0,0 +1,133 @@ +// ISession_Text.cpp: implementation of the ISession_Text class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "ISession_Text.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +//#define new DEBUG_NEW +#endif +IMPLEMENT_STANDARD_HANDLE(ISession_Text,AIS_InteractiveObject) +IMPLEMENT_STANDARD_RTTI(ISession_Text,AIS_InteractiveObject) +// +// Foreach ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and +// a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro. +// We must respect the order: from the direct ancestor class +// to the base class. +// +IMPLEMENT_STANDARD_TYPE(ISession_Text) + IMPLEMENT_STANDARD_SUPERTYPE(AIS_InteractiveObject) + IMPLEMENT_STANDARD_SUPERTYPE(SelectMgr_SelectableObject) + IMPLEMENT_STANDARD_SUPERTYPE(PrsMgr_PresentableObject) + IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared) + IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY() + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(AIS_InteractiveObject) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(SelectMgr_SelectableObject) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(PrsMgr_PresentableObject) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient) + IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END() +IMPLEMENT_STANDARD_TYPE_END(ISession_Text) + + +#include +#include +#include +#include +#include +#include +#include "PrsMgr_PresentationManager2d.hxx" +#include "SelectMgr_Selection.hxx" +#include "Graphic2d_Array1OfVertex.hxx" +#include "Graphic2d_Polyline.hxx" +#include "Graphic2d_Vertex.hxx" +#include "Graphic2d_DisplayList.hxx" +#include "Prs3d_Text.hxx" + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +ISession_Text::ISession_Text() +{ + +} + + +ISession_Text::ISession_Text + (const TCollection_AsciiString& aText, + const Standard_Real anX , // = 0 + const Standard_Real anY , // = 0 + const Standard_Real aZ , // = 0 + const Aspect_TypeOfText aType, // = SOLID, + const Quantity_PlaneAngle anAngle, // = 0.0 + const Standard_Real aslant, // = 0.0 + const Standard_Integer aColorIndex, // = 0 + const Standard_Integer aFontIndex, // = 1 + const Quantity_Factor aScale) // = 1 + :AIS_InteractiveObject(),MyText(aText),MyX(anX),MyY(anY),MyZ(aZ), + MyTypeOfText(aType),MyAngle(anAngle),MySlant(aslant),MyFontIndex(aFontIndex), + MyColorIndex(aColorIndex),MyScale(aScale),MyWidth(0),MyHeight(0) +{} + +ISession_Text::ISession_Text + (const TCollection_AsciiString& aText, + gp_Pnt& aPoint, + const Aspect_TypeOfText aType, // = SOLID, + const Quantity_PlaneAngle anAngle, // = 0.0 + const Standard_Real aslant, // = 0.0 + const Standard_Integer aColorIndex, // = 0 + const Standard_Integer aFontIndex, // = 1 + const Quantity_Factor aScale) // = 1 + :AIS_InteractiveObject(),MyText(aText),MyX(aPoint.X()),MyY(aPoint.Y()),MyZ(aPoint.Z()), + MyTypeOfText(aType),MyAngle(anAngle),MySlant(aslant),MyFontIndex(aFontIndex), + MyColorIndex(aColorIndex),MyScale(aScale),MyWidth(0),MyHeight(0) +{} + + + +ISession_Text::~ISession_Text() +{ + +} + +void ISession_Text::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, + const Handle(Prs3d_Presentation)& aPresentation, + const Standard_Integer aMode) +{ + Prs3d_Text::Draw(aPresentation,myDrawer,MyText,gp_Pnt( MyX ,MyY,MyZ )); +} + +void ISession_Text::Compute(const Handle(Prs3d_Projector)& aProjector, + const Handle(Prs3d_Presentation)& aPresentation) + { + } + +void ISession_Text::Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager, + const Handle(Graphic2d_GraphicObject)& aGrObj, + const Standard_Integer unMode) +{ + Handle(Graphic2d_Text) text; + text = new Graphic2d_Text(aGrObj, MyText, MyX, MyY, MyAngle,MyTypeOfText,MyScale); + text->SetFontIndex(MyFontIndex); + + text->SetColorIndex(MyColorIndex); + + text->SetSlant(MySlant); + text->SetUnderline(Standard_False); + text->SetZoomable(Standard_True); + aGrObj->Display(); + Quantity_Length anXoffset,anYoffset; + text->TextSize(MyWidth, MyHeight,anXoffset,anYoffset); + +} + +void ISession_Text::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, + const Standard_Integer unMode) +{ +} + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Text.h b/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Text.h new file mode 100644 index 000000000..a5392db1d --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/ISession_Text.h @@ -0,0 +1,180 @@ +// ISession_Text.h: interface for the ISession_Text class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_ISESSION_TEXT_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_) +#define AFX_ISESSION_TEXT_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_ + +#if _MSC_VER >= 1000 +#pragma once +#endif // _MSC_VER >= 1000 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class TCollection_AsciiString; +class PrsMgr_PresentationManager2d; +class Graphic2d_GraphicObject; +class SelectMgr_Selection; + +DEFINE_STANDARD_HANDLE(ISession_Text,AIS_InteractiveObject) +class ISession_Text : public AIS_InteractiveObject +{ +public: + ISession_Text(); + + ISession_Text (const TCollection_AsciiString& aText, + const Standard_Real anX = 0 , + const Standard_Real anY = 0 , + const Standard_Real aZ = 0 , + const Aspect_TypeOfText aType = Aspect_TOT_SOLID, + const Quantity_PlaneAngle anAngle = 0.0 , + const Standard_Real aSlant = 0.0 , + const Standard_Integer aColorIndex = 1 , + const Standard_Integer aFontIndex = 1 , + const Quantity_Factor aScale = 0.1 ); + ISession_Text + (const TCollection_AsciiString& aText, + gp_Pnt& aPoint, + const Aspect_TypeOfText aType = Aspect_TOT_SOLID, + const Quantity_PlaneAngle anAngle = 0.0 , + const Standard_Real aSlant = 0.0 , + const Standard_Integer aColorIndex = 1 , + const Standard_Integer aFontIndex = 1 , + const Quantity_Factor aScale = 0.1 ); + + virtual ~ISession_Text(); + +inline Standard_Integer NbPossibleSelection() const; +inline TCollection_AsciiString GetText() const; +inline void SetText(const TCollection_AsciiString& atext) ; +inline void GetCoord(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const ; +inline void SetCoord(const Standard_Real X, const Standard_Real Y, const Standard_Real Z=0); +inline Aspect_TypeOfText GetTypeOfText() const; +inline void SetTypeOfText(const Aspect_TypeOfText aNewTypeOfText) ; +inline Standard_Real GetAngle() const; +inline void SetAngle(const Standard_Real aNewAngle) ; +inline Standard_Real GetSlant() const; +inline void SetSlant(const Standard_Real aNewSlant) ; +inline Standard_Integer GetColorIndex() const; +inline void SetColorIndex(const Standard_Integer aNewColorIndex) ; +inline Standard_Integer GetFontIndex() const; +inline void SetFontIndex(const Standard_Integer aNewFontIndex) ; +inline Quantity_Factor GetScale() const; +inline void SetScale (const Quantity_Factor aNewScale) ; + + +DEFINE_STANDARD_RTTI(ISession_Text) + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + +void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, + const Handle(Prs3d_Presentation)& aPresentation, + const Standard_Integer aMode); +void Compute (const Handle(Prs3d_Projector)& aProjector, + const Handle(Prs3d_Presentation)& aPresentation); +void Compute (const Handle(PrsMgr_PresentationManager2d)& aPresentationManager, + const Handle(Graphic2d_GraphicObject)& aGrObj, + const Standard_Integer unMode = 0) ; +void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, + const Standard_Integer unMode) ; + + + // Fields PRIVATE + // +TCollection_AsciiString MyText ; +Standard_Real MyX ; +Standard_Real MyY ; +Standard_Real MyZ ; +Aspect_TypeOfText MyTypeOfText ; +Standard_Real MyAngle ; +Standard_Real MySlant ; +Standard_Integer MyColorIndex ; +Standard_Integer MyFontIndex ; +Quantity_Factor MyScale ; +Standard_Real MyWidth ; +Standard_Real MyHeight ; + + +}; + + inline Standard_Integer ISession_Text::NbPossibleSelection() const +{ return 1; } + +inline TCollection_AsciiString ISession_Text::GetText() const +{ return MyText ; } + +inline void ISession_Text::SetText(const TCollection_AsciiString& atext) +{ MyText = atext; } + +inline void ISession_Text::GetCoord(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const +{ X = MyX; Y = MyY; Z = MyZ;} + +inline void ISession_Text::SetCoord(const Standard_Real X, const Standard_Real Y, const Standard_Real Z) +{ MyX = X ; MyY = Y ; MyZ = Z ;} + +inline Aspect_TypeOfText ISession_Text::GetTypeOfText() const +{ return MyTypeOfText; } + +inline void ISession_Text::SetTypeOfText(const Aspect_TypeOfText aNewTypeOfText) +{ MyTypeOfText = aNewTypeOfText; } + +inline Standard_Real ISession_Text::GetAngle() const +{ return MyAngle; } + +inline void ISession_Text::SetAngle(const Standard_Real aNewAngle) +{ MyAngle = aNewAngle; } + +inline Standard_Real ISession_Text::GetSlant() const +{ return MySlant; } + +inline void ISession_Text::SetSlant(const Standard_Real aNewSlant) +{ MySlant = aNewSlant; } + +inline Standard_Integer ISession_Text::GetColorIndex() const +{ return MyColorIndex; } + +inline void ISession_Text::SetColorIndex(const Standard_Integer aNewColorIndex) +{ MyColorIndex = aNewColorIndex; } + +inline Standard_Integer ISession_Text::GetFontIndex() const +{ return MyFontIndex; } + +inline void ISession_Text::SetFontIndex(const Standard_Integer aNewFontIndex) +{ MyFontIndex = aNewFontIndex; } + +inline Quantity_Factor ISession_Text::GetScale() const +{ return MyScale; } + +inline void ISession_Text::SetScale(const Quantity_Factor aNewScale) +{ MyScale = aNewScale; } + +#endif // !defined(AFX_ISESSION_TEXT_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_) diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/InputBox.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/InputBox.cpp new file mode 100644 index 000000000..0488baff3 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/InputBox.cpp @@ -0,0 +1,258 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#include "stdafx.h" +#include "InputBox.h" + +HFONT InputBoxHelper::m_hFont = NULL; +HWND InputBoxHelper::m_hWndInputBox = NULL; +HWND InputBoxHelper::m_hWndParent = NULL; +HWND InputBoxHelper::m_hWndEdit = NULL; +HWND InputBoxHelper::m_hWndOK = NULL; +HWND InputBoxHelper::m_hWndCancel = NULL; +HWND InputBoxHelper::m_hWndPrompt = NULL; + +HINSTANCE InputBoxHelper::m_hInst = NULL; + + +////////////////////////////////////////////////////////////////////// +// InputBoxHelper Class +////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +InputBoxHelper::InputBoxHelper(HWND hWndParent) +{ + HINSTANCE hInst = GetModuleHandle(NULL); + + WNDCLASSEX wcex; + + if (!GetClassInfoEx(hInst, "InputBox", &wcex)) + { + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInst; + wcex.hIcon = NULL;//LoadIcon(hInst, (LPCTSTR)IDI_MYINPUTBOX); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW); + wcex.lpszMenuName = NULL; + wcex.lpszClassName = "InputBox"; + wcex.hIconSm = NULL; + + if (RegisterClassEx(&wcex) == 0) + MessageBox(NULL, "Can't create InputBoxHelper!", "Error", MB_OK); + } + + m_hWndParent = hWndParent; + + Text = NULL; + +} + +InputBoxHelper::~InputBoxHelper() +{ + if (Text) delete[] Text; +} + + +LRESULT CALLBACK InputBoxHelper::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LOGFONT lfont; + + switch (message) + { + case WM_CREATE: + // font + memset(&lfont, 0, sizeof(lfont)); + lstrcpy(lfont.lfFaceName, _T("Arial")); + lfont.lfHeight = 16; + lfont.lfWeight = FW_NORMAL;//FW_BOLD; + lfont.lfItalic = FALSE; + lfont.lfCharSet = DEFAULT_CHARSET; + lfont.lfOutPrecision = OUT_DEFAULT_PRECIS; + lfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lfont.lfQuality = DEFAULT_QUALITY; + lfont.lfPitchAndFamily = DEFAULT_PITCH; + m_hFont = CreateFontIndirect(&lfont); + + m_hInst = GetModuleHandle(NULL); + + // creating Edit + m_hWndEdit = CreateWindowEx(WS_EX_STATICEDGE, + "edit","", + WS_VISIBLE | WS_CHILD | WS_TABSTOP | ES_AUTOHSCROLL, + 5, INPUTBOX_HEIGHT - 50, INPUTBOX_WIDTH - 16, 20, + hWnd, + NULL, + m_hInst, + NULL); + + // setting font + SendMessage(m_hWndEdit, WM_SETFONT, (WPARAM)m_hFont, 0); + + // button OK + m_hWndOK = CreateWindowEx(WS_EX_STATICEDGE, + "button","OK", + WS_VISIBLE | WS_CHILD | WS_TABSTOP, + INPUTBOX_WIDTH - 100, 10, 90, 25, + hWnd, + NULL, + m_hInst, + NULL); + + // setting font + SendMessage(m_hWndOK, WM_SETFONT, (WPARAM)m_hFont, 0); + + // button Cancel + m_hWndCancel = CreateWindowEx(WS_EX_STATICEDGE, + "button","Cancel", + WS_VISIBLE | WS_CHILD | WS_TABSTOP, + INPUTBOX_WIDTH - 100, 40, 90, 25, + hWnd, + NULL, + m_hInst, + NULL); + + // setting font + SendMessage(m_hWndCancel, WM_SETFONT, (WPARAM)m_hFont, 0); + + // static Propmpt + m_hWndPrompt = CreateWindowEx(WS_EX_STATICEDGE, + "static","", + WS_VISIBLE | WS_CHILD, + 5, 10, INPUTBOX_WIDTH - 110, INPUTBOX_HEIGHT - 70, + hWnd, + NULL, + m_hInst, + NULL); + + // setting font + SendMessage(m_hWndPrompt, WM_SETFONT, (WPARAM)m_hFont, 0); + + SetFocus(m_hWndEdit); + break; + case WM_DESTROY: + + DeleteObject(m_hFont); + + + EnableWindow(m_hWndParent, TRUE); + SetForegroundWindow(m_hWndParent); + DestroyWindow(hWnd); + PostQuitMessage(0); + + break; + case WM_COMMAND: + switch (HIWORD(wParam)) + { + case BN_CLICKED: + if ((HWND)lParam == m_hWndOK) + PostMessage(m_hWndInputBox, WM_KEYDOWN, VK_RETURN, 0); + if ((HWND)lParam == m_hWndCancel) + PostMessage(m_hWndInputBox, WM_KEYDOWN, VK_ESCAPE, 0); + break; + } + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + + +BOOL InputBoxHelper::DoModal(LPCTSTR szCaption, LPCTSTR szPrompt) +{ + RECT r; + GetWindowRect(GetDesktopWindow(), &r); + + m_hWndInputBox = CreateWindowEx(WS_EX_TOOLWINDOW, + "InputBox", + szCaption, + WS_POPUPWINDOW | WS_CAPTION | WS_TABSTOP, + (r.right - INPUTBOX_WIDTH) / 2, (r.bottom - INPUTBOX_HEIGHT) / 2, + INPUTBOX_WIDTH, INPUTBOX_HEIGHT, + m_hWndParent, + NULL, + m_hInst, + NULL); + if(m_hWndInputBox == NULL) + return FALSE; + + + SetWindowText(m_hWndPrompt, szPrompt); + + SetForegroundWindow(m_hWndInputBox); + + EnableWindow(m_hWndParent, FALSE); + + ShowWindow(m_hWndInputBox, SW_SHOW); + UpdateWindow(m_hWndInputBox); + + BOOL ret = 0; + + MSG msg; + + HWND hWndFocused; + + while (GetMessage(&msg, NULL, 0, 0)) + { + if (msg.message == WM_KEYDOWN) + { + if (msg.wParam == VK_ESCAPE) + { + SendMessage(m_hWndInputBox, WM_DESTROY, 0, 0); + ret = 0; + } + if (msg.wParam == VK_RETURN) + { + int nCount = GetWindowTextLength(m_hWndEdit); + nCount++; + if (Text) + { + delete[] Text; + Text = NULL; + } + Text = new TCHAR[nCount]; + GetWindowText(m_hWndEdit, Text, nCount); + SendMessage(m_hWndInputBox, WM_DESTROY, 0, 0); + ret = 1; + } + if (msg.wParam == VK_TAB) + { + hWndFocused = GetFocus(); + if (hWndFocused == m_hWndEdit) SetFocus(m_hWndOK); + if (hWndFocused == m_hWndOK) SetFocus(m_hWndCancel); + if (hWndFocused == m_hWndCancel) SetFocus(m_hWndEdit); + } + + } + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return ret; +} diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/InputBox.h b/TAG_MFC-TIGLViewer/TIGLViewer/InputBox.h new file mode 100644 index 000000000..519ce8b15 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/InputBox.h @@ -0,0 +1,53 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +#define INPUTBOX_WIDTH 400 +#define INPUTBOX_HEIGHT 125 + + +class InputBoxHelper +{ + static HFONT m_hFont; + static HWND m_hWndInputBox; + static HWND m_hWndParent; + static HWND m_hWndEdit; + static HWND m_hWndOK; + static HWND m_hWndCancel; + static HWND m_hWndPrompt; + + static HINSTANCE m_hInst; + + static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +public: + // text from InputBox + LPTSTR Text; + BOOL DoModal(LPCTSTR szCaption, LPCTSTR szPrompt); + + InputBoxHelper(HWND hWndParent); + virtual ~InputBoxHelper(); + +}; + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer - VS2003.vcproj b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer - VS2003.vcproj new file mode 100644 index 000000000..7bcbc64c4 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer - VS2003.vcproj @@ -0,0 +1,299 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.cpp new file mode 100644 index 000000000..02d23edb6 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.cpp @@ -0,0 +1,178 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdafx.h" +#include "TIGLViewer.h" + +#include "TIGLViewerDoc.h" +#include "OCC_MainFrame.h" +#include "OSD_Environment.hxx" +#include "TIGLViewerChildFrame.h" +#include "TIGLViewerView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CTIGLViewerApp + +BEGIN_MESSAGE_MAP(CTIGLViewerApp, CWinApp) + ON_COMMAND(ID_APP_ABOUT, OnAppAbout) + // Standarddruckbefehl "Seite einrichten" + ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) + ON_COMMAND(ID_FILE_OPEN, OnFileOpen) +END_MESSAGE_MAP() + + +// CTIGLViewerApp-Erstellung +CTIGLViewerApp::CTIGLViewerApp() +{ + //OSD_Environment theEnv("CALL_OPENGL_ANTIALIASING_MODE", "0"); + //theEnv.Build(); +} + +// Das einzige CTIGLViewerApp-Objekt +CTIGLViewerApp theApp; + +// CTIGLViewerApp Initialisierung +BOOL CTIGLViewerApp::InitInstance() +{ + // InitCommonControls() ist für Windows XP erforderlich, wenn ein Anwendungsmanifest + // die Verwendung von ComCtl32.dll Version 6 oder höher zum Aktivieren + // von visuellen Stilen angibt. Ansonsten treten beim Erstellen von Fenstern Fehler auf. + InitCommonControls(); + + CWinApp::InitInstance(); + + // OLE-Bibliotheken initialisieren + if (!AfxOleInit()) + { + AfxMessageBox(IDP_OLE_INIT_FAILED); + return FALSE; + } + AfxEnableControlContainer(); + // Standardinitialisierung + // Wenn Sie diese Features nicht verwenden und die Größe + // der ausführbaren Datei verringern möchten, entfernen Sie + // die nicht erforderlichen Initialisierungsroutinen. + // Ändern Sie den Registrierungsschlüssel unter dem Ihre Einstellungen gespeichert sind. + // TODO: Ändern Sie diese Zeichenfolge entsprechend, + // z.B. zum Namen Ihrer Firma oder Organisation. + SetRegistryKey(_T("TIGLViewer")); + LoadStdProfileSettings(4); // Standard INI-Dateioptionen laden (einschließlich MRU) + + // Dokumentvorlagen der Anwendung registrieren. Dokumentvorlagen + // dienen als Verbindung zwischen Dokumenten, Rahmenfenstern und Ansichten. + m_ptrTIGLView = new CMultiDocTemplate( + IDR_TIGLCHILDFRAME, + RUNTIME_CLASS(CTIGLViewerDoc), + RUNTIME_CLASS(CTIGLViewerChildFrame), + RUNTIME_CLASS(CTIGLViewerView)); + if (m_ptrTIGLView == 0) + return FALSE; + AddDocTemplate(m_ptrTIGLView); + + // create main MDI Frame window + OCC_MainFrame* pMainFrame = new OCC_MainFrame(with_AIS_TB); + if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) + return FALSE; + m_pMainWnd = pMainFrame; + + // Befehlszeile parsen, um zu prüfen auf Standardumgebungsbefehle DDE, Datei offen + CCommandLineInfo cmdInfo; + + // Turn off default OnFileNew() call + cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; + + ParseCommandLine(cmdInfo); + // Verteilung der in der Befehlszeile angegebenen Befehle. Es wird FALSE zurückgegeben, wenn + // die Anwendung mit /RegServer, /Register, /Unregserver oder /Unregister gestartet wurde. + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + + // Das einzige Fenster ist initialisiert und kann jetzt angezeigt und aktualisiert werden. + m_pMainWnd->ShowWindow(SW_SHOW); + m_pMainWnd->UpdateWindow(); + // Rufen Sie DragAcceptFiles nur auf, wenn eine Suffix vorhanden ist. + // In einer SDI-Anwendung ist dies nach ProcessShellCommand erforderlich + + return TRUE; +} + +// CTIGLViewerApp File Open Meldungshandler +void CTIGLViewerApp::OnFileOpen() +{ + TCHAR szFilters[] = _T("CPACS files (*.xml)|*.xml|All files (*.*)|*.*||"); + + CFileDialog dlg (TRUE, _T("xml"), _T("*.xml"), OFN_FILEMUSTEXIST, szFilters); + if (dlg.DoModal () == IDOK) { + CString filename = dlg.GetPathName (); + OpenDocumentFile(filename); + } +} + + +//****************************************************************************************************** + +// CAboutDlg-Dialogfeld für Anwendungsbefehl 'Info' +class CAboutDlg : public CDialog +{ +public: + CAboutDlg(); + + // Dialogfelddaten + enum { IDD = IDD_ABOUTBOX }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung + + // Implementierung +protected: + DECLARE_MESSAGE_MAP() +public: + afx_msg void OnCpacsDrawfusedall(); +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) + ON_COMMAND(ID_CPACS_DRAWFUSEDALL, OnCpacsDrawfusedall) +END_MESSAGE_MAP() + +// Anwendungsbefehl zum Ausführen des Dialogfelds +void CTIGLViewerApp::OnAppAbout() +{ + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + +void CAboutDlg::OnCpacsDrawfusedall() +{ + // TODO: Fügen Sie hier Ihren Befehlsbehandlungscode ein. +} diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.h b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.h new file mode 100644 index 000000000..7b3de080a --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.h @@ -0,0 +1,48 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once + +#ifndef __AFXWIN_H__ +#error 'stdafx.h' muss vor dieser Datei in PCH eingeschlossen werden. +#endif + +#include "resource.h" +#include "OCC_3dApp.h" + + +class CTIGLViewerApp : public OCC_3dApp +{ + +public: + CTIGLViewerApp(); + + virtual BOOL InitInstance(); + + afx_msg void OnAppAbout(); + afx_msg void OnFileOpen(); + +public: + CMultiDocTemplate* m_ptrTIGLView; + + DECLARE_MESSAGE_MAP() +}; + +extern CTIGLViewerApp theApp; diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.rc b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.rc new file mode 100644 index 000000000..b4de3739e --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.rc @@ -0,0 +1,624 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Deutsch (Deutschland) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) +#ifdef _WIN32 +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)\r\n" + "LANGUAGE 7, 1\r\n" + "#pragma code_page(1252)\r\n" + "#include ""res\\TIGLViewer.rc2"" // Nicht mit Microsoft Visual C++ bearbeitete Ressourcen\r\n" + "#include ""afxres.rc"" // Standardkomponenten\r\n" + "#include ""afxprint.rc"" // Ressourcen für Drucken/Seitenansicht\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON "res\\TIGLViewer.ico" +IDR_TIGLCHILDFRAME ICON "res\\cpacs.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_MAINFRAME BITMAP "res\\Toolbar.bmp" +IDR_TIGLCHILDFRAME BITMAP "res\\toolbar_tigl_childframe.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_MAINFRAME TOOLBAR 16, 15 +BEGIN + BUTTON ID_FILE_OPEN + SEPARATOR + BUTTON ID_APP_ABOUT +END + +IDR_TIGLCHILDFRAME TOOLBAR 16, 15 +BEGIN + BUTTON ID_SHOW_WING_PROFILES + BUTTON ID_SHOW_WINGS + BUTTON ID_SHOW_WING_TRIANGULATION + BUTTON ID_SHOW_WING_POINTS + SEPARATOR + BUTTON ID_SHOW_FUSELAGE_PROFILES + BUTTON ID_SHOW_FUSELAGES + BUTTON ID_SHOW_FUSELAGE_TRIANGULATION + BUTTON ID_SHOW_FUSELAGE_POINTS + SEPARATOR + BUTTON ID_SHOW_ALL_POINTS + BUTTON ID_SHOW_ALL + SEPARATOR + BUTTON ID_EXPORT_AS_IGES +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINFRAME MENU +BEGIN + POPUP "&Datei" + BEGIN + MENUITEM "Ö&ffnen...\tStrg+O", ID_FILE_OPEN + MENUITEM SEPARATOR + MENUITEM "&Beenden", ID_APP_EXIT + END + POPUP "&Ansicht" + BEGIN + MENUITEM "&Symbolleiste", ID_VIEW_TOOLBAR + MENUITEM "Status&leiste", ID_VIEW_STATUS_BAR + END + POPUP "&Hilfe" + BEGIN + MENUITEM "&Info über TIGLViewer...", ID_APP_ABOUT + END +END + +IDR_TIGLCHILDFRAME MENU +BEGIN + POPUP "&Datei" + BEGIN + MENUITEM "Ö&ffnen...\tStrg+O", ID_FILE_OPEN + MENUITEM SEPARATOR + MENUITEM "Export fused parts as IGES", ID_EXPORT_FUSED_IGES + MENUITEM "Export as IGES...", ID_EXPORT_AS_IGES + POPUP "Export as STL" + BEGIN + MENUITEM "Wing by Index...", ID_EXPORTASSTL_WINGBYINDEX + + MENUITEM "Wing by uID...", ID_EXPORTASSTL_WINGBYUID + MENUITEM "Fuselage by Index...", ID_EXPORTASSTL_FUSELAGEBYINDEX + + MENUITEM "Fuselage by uID...", ID_EXPORTASSTL_FUSELAGEBYUID + + MENUITEM "Complete Geometry...", ID_EXPORTASSTL_COMPLETEGEOMETRY + + END + POPUP "Export as VTK" + BEGIN + MENUITEM "Wing with CPACS information", ID_EXPORTASVTK_WINGBYINDEX + + MENUITEM "Wing simple", ID_EXPORTASVTK_WINGBYUID + MENUITEM "Fuselage with CPACS information", + ID_EXPORTASVTK_FUSELAGEBYINDEX + + MENUITEM "Fuselage simple", ID_EXPORTASVTK_FUSELAGEBYUID + + MENUITEM "Complete Geometry...", ID_EXPORTASVTK_COMPLETEGEOMETRY + + END + MENUITEM SEPARATOR + MENUITEM "&Beenden", ID_APP_EXIT + END + POPUP "&Ansicht" + BEGIN + MENUITEM "&Symbolleiste", ID_VIEW_TOOLBAR + MENUITEM "Status&leiste", ID_VIEW_STATUS_BAR + END + POPUP "&CPACS" + BEGIN + MENUITEM "Draw wing profiles", ID_SHOW_WING_PROFILES + MENUITEM "Draw wings", ID_SHOW_WINGS + MENUITEM "Draw wing triangulation", ID_SHOW_WING_TRIANGULATION + MENUITEM "Draw wing surface points", ID_SHOW_WING_POINTS + MENUITEM "Draw overlay CPACS profile points", + ID_CPACS_DRAWOVERLAYCPACSPROFILEPOINTS + + MENUITEM SEPARATOR + MENUITEM "Draw fuselage profiles", ID_SHOW_FUSELAGE_PROFILES + MENUITEM "Draw fuselages", ID_SHOW_FUSELAGES + MENUITEM "Draw fuselage triangulation", ID_SHOW_FUSELAGE_TRIANGULATION + + MENUITEM "Draw fuselage surface points", ID_SHOW_FUSELAGE_POINTS + MENUITEM "Draw fuselage surface point at 45°", + ID_SHOW_FUSELAGE_POINTS_ANGLE + + MENUITEM "Draw Minumum Distance to Ground", + ID_CPACS_DRAW_MINIMUM_DISTANCE_GROUND + + MENUITEM SEPARATOR + MENUITEM "Draw all", ID_SHOW_ALL + MENUITEM "Draw all surface points", ID_SHOW_ALL_POINTS + MENUITEM SEPARATOR + MENUITEM "Draw fused fuselages", ID_CPACS_DRAWFUSEDFUSELAGES + MENUITEM "Draw fused wings", ID_CPACS_DRAWFUSEDWINGS + MENUITEM "Draw all parts fused ", ID_CPACS_DRAWFUSEDALL + MENUITEM SEPARATOR + MENUITEM "Show intersection line", ID_CPACS_SHOWINTERSECTIONLINE + + END + POPUP "A&lgorithm" + BEGIN + MENUITEM "Wire bspline interpolation", ID_INTERPOLATE_BSPLINE_WIRE + MENUITEM "Wire linear interpolation", ID_INTERPOLATE_LINEAR_WIRE + MENUITEM "Wire bspline approximation", ID_APPROXIMATE_BSPLINE_WIRE + END + POPUP "&Fenster" + BEGIN + MENUITEM "&Neues Fenster", ID_WINDOW_NEW + MENUITEM "Ü&berlappend", ID_WINDOW_CASCADE + MENUITEM "&Nebeneinander", ID_WINDOW_TILE_HORZ + MENUITEM "&Symbole anordnen", ID_WINDOW_ARRANGE + END + POPUP "&Hilfe" + BEGIN + MENUITEM "&Info über TIGLViewer...", ID_APP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINFRAME ACCELERATORS +BEGIN + "N", ID_FILE_NEW, VIRTKEY, CONTROL + "O", ID_FILE_OPEN, VIRTKEY, CONTROL + "S", ID_FILE_SAVE, VIRTKEY, CONTROL + "P", ID_FILE_PRINT, VIRTKEY, CONTROL + "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL + "X", ID_EDIT_CUT, VIRTKEY, CONTROL + "C", ID_EDIT_COPY, VIRTKEY, CONTROL + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL + VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT + VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT + VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL + VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT + VK_F6, ID_NEXT_PANE, VIRTKEY + VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOGEX 0, 0, 235, 81 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "Info über TIGLViewer" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "TIGLViewer Version 0.9",IDC_STATIC,21,13,119,8, + SS_NOPREFIX + LTEXT "Copyright (c) 2006-2011",IDC_STATIC,21,45,119,8 + DEFPUSHBUTTON "OK",IDOK,178,58,50,16,WS_GROUP + LTEXT "Simulation- and Softwaretecnology (SC)",IDC_STATIC,21, + 25,177,8 + LTEXT "German Aerospace Center (DLR)",IDC_STATIC,21,35,186,8 +END + +IDD_WING_PROFILE_DIALOG DIALOGEX 0, 0, 259, 165 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | + WS_CAPTION | WS_SYSMENU +CAPTION "Select wing profile" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LISTBOX IDC_WING_PROFILE_LIST,15,18,228,110,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP, + WS_EX_STATICEDGE + DEFPUSHBUTTON "OK",IDOK,65,143,50,14 + GROUPBOX "Available wing profiles",IDC_WING_GROUP_TEXT,7,7,244, + 128 + PUSHBUTTON "Abbruch",IDCANCEL,143,143,50,14 +END + +IDD_WING_DIALOG DIALOGEX 0, 0, 259, 165 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | + WS_CAPTION | WS_SYSMENU +CAPTION "Select Wing" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LISTBOX IDC_WING_LIST,15,18,228,110,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP, + WS_EX_STATICEDGE + DEFPUSHBUTTON "OK",IDOK,69,144,50,14 + GROUPBOX "Available wings",IDC_STATIC,7,7,244,128 + PUSHBUTTON "Abbruch",IDCANCEL,141,144,50,14 +END + +IDD_FUSELAGE_PROFILE_DIALOG DIALOGEX 0, 0, 259, 165 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | + WS_CAPTION | WS_SYSMENU +CAPTION "Select fuselage profile" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LISTBOX IDC_FUSELAGE_PROFILE_LIST,15,18,228,110,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP, + WS_EX_STATICEDGE + DEFPUSHBUTTON "OK",IDOK,65,143,50,14 + GROUPBOX "Available fuselage profiles",IDC_FUSELAGE_GROUP_TEXT,7, + 7,244,128 + PUSHBUTTON "Abbruch",IDCANCEL,143,143,50,14 +END + +IDD_FUSELAGE_DIALOG DIALOGEX 0, 0, 259, 165 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | + WS_CAPTION | WS_SYSMENU +CAPTION "Select Fuselage" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LISTBOX IDC_FUSELAGE_LIST,15,18,228,110,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP, + WS_EX_STATICEDGE + DEFPUSHBUTTON "OK",IDOK,69,144,50,14 + GROUPBOX "Available fuselages",IDC_STATIC,7,7,244,128 + PUSHBUTTON "Abbruch",IDCANCEL,141,144,50,14 +END + +IDD_CONFIGURATION_DIALOG DIALOGEX 0, 0, 259, 165 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | + WS_CAPTION | WS_SYSMENU +CAPTION "Select CPACS Configuration" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LISTBOX IDC_CONFIGURATION_LIST,15,18,228,110,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP, + WS_EX_STATICEDGE + DEFPUSHBUTTON "OK",IDOK,69,144,50,14 + GROUPBOX "Available Configurations",IDC_STATIC,7,7,244,128 + PUSHBUTTON "Abbruch",IDCANCEL,141,144,50,14 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,7,0,0 + PRODUCTVERSION 1,7,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040704e4" + BEGIN + VALUE "CompanyName", "Simulation- and Softwaretecnology (SC), German Aerospace Center (DLR)" + VALUE "Copyright (C) 2005", "(c) Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR). Alle Rechte vorbehalten." + VALUE "FileDescription", "Viewer Application for the TIVA Geometry Library (TIGL)" + VALUE "FileVersion", "0.9.0" + VALUE "InternalName", "TIGLViewer.exe" + VALUE "OriginalFilename", "TIGLViewer.exe" + VALUE "ProductName", "TIGLViewer" + VALUE "ProductVersion", "0.9.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x407, 1252 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 228 + TOPMARGIN, 6 + BOTTOMMARGIN, 74 + END + + IDD_WING_PROFILE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 251 + TOPMARGIN, 7 + BOTTOMMARGIN, 158 + END + + IDD_WING_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 251 + TOPMARGIN, 7 + BOTTOMMARGIN, 158 + END + + IDD_FUSELAGE_PROFILE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 251 + TOPMARGIN, 7 + BOTTOMMARGIN, 158 + END + + IDD_FUSELAGE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 251 + TOPMARGIN, 7 + BOTTOMMARGIN, 158 + END + + IDD_CONFIGURATION_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 251 + TOPMARGIN, 7 + BOTTOMMARGIN, 158 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDR_MAINFRAME "TIGLViewer\n\nTIGLViewer\n\n\nTIGLViewer.Document\nTIGLViewer.Document" +END + +STRINGTABLE +BEGIN + AFX_IDS_APP_TITLE "TIGLViewer" + AFX_IDS_IDLEMESSAGE "Bereit" +END + +STRINGTABLE +BEGIN + ID_INDICATOR_EXT "ER" + ID_INDICATOR_CAPS "UF" + ID_INDICATOR_NUM "NUM" + ID_INDICATOR_SCRL "RF" + ID_INDICATOR_OVR "ÜB" + ID_INDICATOR_REC "MA" +END + +STRINGTABLE +BEGIN + ID_FILE_NEW "Erstellt ein neues Dokument.\nNeu" + ID_FILE_OPEN "Öffnet ein vorhandenes Dokument.\nÖffnen" + ID_FILE_CLOSE "Schließt das aktive Dokument.\nSchließen" + ID_FILE_SAVE "Speichert das aktive Dokument.\nSpeichern" + ID_FILE_SAVE_AS "Speichert das aktive Dokument unter einem neuem Namen.\nSpeichern unter" + ID_FILE_PAGE_SETUP "Ändert die Druckoptionen.\nSeite einrichten" + ID_FILE_PRINT_SETUP "Ändert den Drucker und die Druckoptionen.\nDruckereinrichtung" + ID_FILE_PRINT "Druckt das aktive Dokument.\nDrucken" + ID_FILE_PRINT_PREVIEW "Zeigt ganze Seiten an.\nSeitenansicht" +END + +STRINGTABLE +BEGIN + ID_APP_ABOUT "Zeigt Programm-, Versions- und Copyrightinformationen an.\nInfo" + ID_APP_EXIT "Beendet die Anwendung und fordert zum Speichern der Dokumente auf.\nBeenden" +END + +STRINGTABLE +BEGIN + ID_FILE_MRU_FILE1 "Öffnet das Dokument." + ID_FILE_MRU_FILE2 "Öffnet das Dokument." + ID_FILE_MRU_FILE3 "Öffnet das Dokument." + ID_FILE_MRU_FILE4 "Öffnet das Dokument." + ID_FILE_MRU_FILE5 "Öffnet das Dokument." + ID_FILE_MRU_FILE6 "Öffnet das Dokument." + ID_FILE_MRU_FILE7 "Öffnet das Dokument." + ID_FILE_MRU_FILE8 "Öffnet das Dokument." + ID_FILE_MRU_FILE9 "Öffnet das Dokument." + ID_FILE_MRU_FILE10 "Öffnet das Dokument." + ID_FILE_MRU_FILE11 "Öffnet das Dokument." + ID_FILE_MRU_FILE12 "Öffnet das Dokument." + ID_FILE_MRU_FILE13 "Öffnet das Dokument." + ID_FILE_MRU_FILE14 "Öffnet das Dokument." + ID_FILE_MRU_FILE15 "Öffnet das Dokument." + ID_FILE_MRU_FILE16 "Öffnet das Dokument." +END + +STRINGTABLE +BEGIN + ID_NEXT_PANE "Wechselt zum nächsten Fensterbereich.\nNächster Bereich" + ID_PREV_PANE "Wechselt zum vorherigen Fensterbereich.\nVorheriger Bereich" +END + +STRINGTABLE +BEGIN + ID_WINDOW_NEW "Öffnet ein weiteres Fenster für das aktive Dokument.\nNeues Fenster" + ID_WINDOW_ARRANGE "Ordnet die Symbole im unteren Fensterrand an.\nSymbole anordnen" + ID_WINDOW_CASCADE "Ordnet die Fenster überlappend an.\nÜberlappende Fenster" + ID_WINDOW_TILE_HORZ "Ordnet die Fenster nebeneinander an.\nFenster nebeneinander" + ID_WINDOW_TILE_VERT "Ordnet die Fenster nebeneinander an.\nFenster nebeneinander" + ID_WINDOW_SPLIT "Teilt das aktive Fenster in Bereiche.\nTeilen" +END + +STRINGTABLE +BEGIN + ID_EDIT_CLEAR "Löscht die Auswahl.\nLöschen" + ID_EDIT_CLEAR_ALL "Löscht alles.\nAlles löschen" + ID_EDIT_COPY "Kopiert die Auswahl in die Zwischenablage.\nKopieren" + ID_EDIT_CUT "Überträgt die Auswahl in die Zwischenablage.\nAusschneiden" + ID_EDIT_FIND "Sucht den angegebenen Text.\nSuchen" + ID_EDIT_PASTE "Fügt den Inhalt der Zwischenablage ein.\nEinfügen" + ID_EDIT_REPEAT "Wiederholt den letzten Vorgang.\nWiederholen" + ID_EDIT_REPLACE "Ersetzt den angegebenen Text.\nErsetzen" + ID_EDIT_SELECT_ALL "Markiert das gesamte Dokument.\nAlles auswählen" + ID_EDIT_UNDO "Macht den letzten Vorgang rückgängig.\nRückgängig" + ID_EDIT_REDO "Wiederholt den zuletzt rückgängig gemachten Vorgang.\nWiederherstellen" +END + +STRINGTABLE +BEGIN + ID_VIEW_TOOLBAR "Blendet die Symbolleiste ein oder aus.\nSymbolleiste" + ID_VIEW_STATUS_BAR "Blendet die Statusleiste ein oder aus.\nStatusleiste" +END + +STRINGTABLE +BEGIN + AFX_IDS_SCSIZE "Ändert die Fenstergröße." + AFX_IDS_SCMOVE "Ändert die Position des Fensters." + AFX_IDS_SCMINIMIZE "Minimiert das Fenster." + AFX_IDS_SCMAXIMIZE "Maximiert das Fenster." + AFX_IDS_SCNEXTWINDOW "Wechselt zum nächsten Dokumentfenster." + AFX_IDS_SCPREVWINDOW "Wechselt zum vorherigen Dokumentfenster." + AFX_IDS_SCCLOSE "Schließt das aktive Fenster und fordert zum Speichern des Dokuments auf." +END + +STRINGTABLE +BEGIN + AFX_IDS_SCRESTORE "Stellt die ursprüngliche Fenstergröße wieder her." + AFX_IDS_SCTASKLIST "Aktiviert die Taskliste." +END + +STRINGTABLE +BEGIN + AFX_IDS_PREVIEW_CLOSE "Beendet die Seitenansicht.\nSeitenansicht beenden" +END + +STRINGTABLE +BEGIN + ID_SHOW_ALL "Show complete CPACS configuration\nComplete CPACS" +END + +STRINGTABLE +BEGIN + ID_INTERPOLATE_BSPLINE_WIRE + "Build wire from points via bspline interpolation\nBspline interpolation" + ID_INTERPOLATE_LINEAR_WIRE + "Build wire from points via linear interpolation\nLinear interpolation" + ID_APPROXIMATE_BSPLINE_WIRE + "Build wire from points via bspline approximation\nBspline approximation" + ID_SHOW_WINGS "Show single wings\nSingle wings" + ID_SHOW_WING_POINTS "Draw single wings by showing surface points\nWing surface points" + ID_SHOW_WING_MESHES "Show triangulation of the wings\nShow triangulation" + ID_SHOW_WING_TRIANGULATION + "Show wing triangulation\nShow wing triangulation" +END + +STRINGTABLE +BEGIN + ID_SHOW_ALL_POINTS "Show complete CPACS configuration by drawing surface points\nShow all surface points" + ID_DATEI_EXPORTASIGES "Export CPACS configuration as IGES file\nExport as IGES file" + ID_EXPORT_AS_IGES "Export CPACS configuration as IGES\nExport as IGES" + ID_SHOW_WING_PROFILES "Draw only wing profiles\nWing profiles" + ID_SHOW_FUSELAGE_PROFILES "Draw fuselage profiles\nFuselage profiles" + ID_SHOW_FUSELAGES "Draw single fuselages\nFuselages" + ID_SHOW_FUSELAGE_TRIANGULATION + "Draw fuselage triangulation\nFuselage triangulation" + ID_SHOW_FUSELAGE_POINTS "Draw fuselage surface points\nFuselage surface points" +END + +#endif // Deutsch (Deutschland) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) +LANGUAGE 7, 1 +#pragma code_page(1252) +#include "res\TIGLViewer.rc2" // Nicht mit Microsoft Visual C++ bearbeitete Ressourcen +#include "afxres.rc" // Standardkomponenten +#include "afxprint.rc" // Ressourcen für Drucken/Seitenansicht +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.vcproj b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.vcproj new file mode 100644 index 000000000..7bcbc64c4 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewer.vcproj @@ -0,0 +1,299 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerChildFrame.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerChildFrame.cpp new file mode 100644 index 000000000..e31fcb5d7 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerChildFrame.cpp @@ -0,0 +1,62 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdafx.h" +#include "TIGLViewer.h" +#include "TIGLViewerChildFrame.h" + +IMPLEMENT_DYNCREATE(CTIGLViewerChildFrame, OCC_3dChildFrame) + +BEGIN_MESSAGE_MAP(CTIGLViewerChildFrame, OCC_3dChildFrame) + ON_WM_CREATE() +END_MESSAGE_MAP() + +CTIGLViewerChildFrame::CTIGLViewerChildFrame() +{ +} + +CTIGLViewerChildFrame::~CTIGLViewerChildFrame() +{ +} + +int CTIGLViewerChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (OCC_3dChildFrame::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_tiglToolBar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP | IDR_TIGLCHILDFRAME) || + !m_tiglToolBar.LoadToolBar(IDR_TIGLCHILDFRAME)) + { + TRACE("Failed to create new toolbar\n"); + return -1; + } + + m_tiglToolBar.SetBarStyle(m_tiglToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); + m_tiglToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_tiglToolBar, AFX_IDW_DOCKBAR_LEFT); + + return 0; +} + + + + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerChildFrame.h b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerChildFrame.h new file mode 100644 index 000000000..43f3212c0 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerChildFrame.h @@ -0,0 +1,43 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once + +#include + +// CTIGLViewerChildFrame + +class CTIGLViewerChildFrame : public OCC_3dChildFrame +{ + +public: + CTIGLViewerChildFrame(); + virtual ~CTIGLViewerChildFrame(); + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + +protected: + CToolBar m_tiglToolBar; + + DECLARE_DYNCREATE(CTIGLViewerChildFrame) + + DECLARE_MESSAGE_MAP() +}; + + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerDoc.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerDoc.cpp new file mode 100644 index 000000000..d55deb934 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerDoc.cpp @@ -0,0 +1,1519 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdafx.h" +#include "TIGLViewer.h" +#include "TIGLViewerDoc.h" +#include "TIGLViewerView.h" +#include "WingProfileDialog.h" +#include "FuselageProfileDialog.h" +#include "WingDialog.h" +#include "WingUIDDialog.h" +#include "FuselageDialog.h" +#include "FuselageUIDDialog.h" +#include "ConfigurationDialog.h" +#include "InputBox.h" +#include "ISession_Point.h" +#include "CTiglIntersectionCalculation.h" +#include "ISession_Text.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "TopoDS.hxx" +#include "gp_Pnt2d.hxx" +#include "gp_Vec2d.hxx" +#include "gp_Dir2d.hxx" +#include "Geom2d_TrimmedCurve.hxx" +#include "GCE2d_MakeSegment.hxx" +#include "Geom2d_Line.hxx" +#include "TopExp_Explorer.hxx" +#include "TopAbs_ShapeEnum.hxx" +#include "TopoDS_Edge.hxx" +#include "BRep_Tool.hxx" +#include "Geom2dAPI_InterCurveCurve.hxx" +#include "GeomAPI.hxx" +#include "gp_Pln.hxx" +#include "gce_MakeDir.hxx" +#include "gce_MakePln.hxx" +#include "TopLoc_Location.hxx" +#include "Poly_Triangulation.hxx" +#include "BRep_Builder.hxx" +#include "Poly_Array1OfTriangle.hxx" +#include "gp_Trsf.hxx" +#include "BRepBuilderAPI_MakeEdge.hxx" +#include "ShapeFix_Wireframe.hxx" +#include "BRepBuilderAPI_MakeWire.hxx" +#include "BRepBuilderAPI_MakeFace.hxx" +#include "BRepMesh.hxx" +#include "BRepTools.hxx" +#include "ShapeFix_Shape.hxx" +#include "BRepBuilderAPI_MakePolygon.hxx" +#include "BRepCheck_Analyzer.hxx" +#include "TopoDS_Compound.hxx" +#include "CTiglTransformation.h" +#include "TopoDS_Solid.hxx" +#include "ShapeAnalysis_ShapeContents.hxx" +#include "BRepBuilderAPI_Transform.hxx" + + +// CTIGLViewerDoc +IMPLEMENT_DYNCREATE(CTIGLViewerDoc, CDocument) + +BEGIN_MESSAGE_MAP(CTIGLViewerDoc, OCC_3dBaseDoc) + ON_COMMAND(ID_SHOW_WING_PROFILES, OnShowWingProfiles) + ON_COMMAND(ID_SHOW_WINGS, OnShowWings) + ON_COMMAND(ID_SHOW_WING_TRIANGULATION, OnShowWingTriangulation) + ON_COMMAND(ID_SHOW_WING_POINTS, OnShowWingPoints) + ON_COMMAND(ID_SHOW_ALL_POINTS, OnShowAllPoints) + ON_COMMAND(ID_CPACS_DRAWOVERLAYCPACSPROFILEPOINTS, OnDrawOverlayCPACSProfilePoints) + ON_COMMAND(ID_SHOW_ALL, OnShowAll) + ON_COMMAND(ID_EXPORT_AS_IGES, OnExportAsIges) + ON_COMMAND(ID_EXPORT_FUSED_IGES, OnExportAsFusedIges) + ON_COMMAND(ID_EXPORTASSTL_WINGBYINDEX, OnExportMeshedWingSTL) + ON_COMMAND(ID_EXPORTASSTL_FUSELAGEBYINDEX, OnExportMeshedFuselageSTL) + ON_COMMAND(ID_EXPORTASVTK_WINGBYINDEX, OnExportMeshedWingVTKIndex) + ON_COMMAND(ID_EXPORTASVTK_WINGBYUID, OnExportMeshedWingVTKSimple) + ON_COMMAND(ID_EXPORTASVTK_FUSELAGEBYINDEX, OnExportMeshedFuselageVTKIndex) + ON_COMMAND(ID_EXPORTASVTK_FUSELAGEBYUID, OnExportMeshedFuselageVTKSimple) + ON_COMMAND(ID_INTERPOLATE_BSPLINE_WIRE, OnInterpolateBsplineWire) + ON_COMMAND(ID_INTERPOLATE_LINEAR_WIRE, OnInterpolateLinearWire) + ON_COMMAND(ID_APPROXIMATE_BSPLINE_WIRE, OnApproximateBsplineWire) + ON_UPDATE_COMMAND_UI(ID_INTERPOLATE_BSPLINE_WIRE, OnUpdateInterpolateBsplineWire) + ON_UPDATE_COMMAND_UI(ID_INTERPOLATE_LINEAR_WIRE, OnUpdateInterpolateLinearWire) + ON_UPDATE_COMMAND_UI(ID_APPROXIMATE_BSPLINE_WIRE, OnUpdateApproximateBsplineWire) + ON_COMMAND(ID_SHOW_FUSELAGE_PROFILES, OnShowFuselageProfiles) + ON_COMMAND(ID_SHOW_FUSELAGES, OnShowFuselages) + ON_COMMAND(ID_SHOW_FUSELAGE_TRIANGULATION, OnShowFuselageTriangulation) + ON_COMMAND(ID_SHOW_FUSELAGE_POINTS, OnShowFuselagePoints) + ON_COMMAND(ID_SHOW_FUSELAGE_POINTS_ANGLE, OnShowFuselagePointsAngle) + ON_COMMAND(ID_CPACS_DRAW_MINIMUM_DISTANCE_GROUND, OnDrawMinumumDistanceToGround) + ON_COMMAND(ID_CPACS_DRAWFUSEDFUSELAGES, OnShowFusedFuselages) + ON_COMMAND(ID_CPACS_DRAWFUSEDALL, OnShowFusedAll) + ON_COMMAND(ID_CPACS_DRAWFUSEDWINGS, OnShowFusedWings) + ON_COMMAND(ID_CPACS_SHOWINTERSECTIONLINE, OnShowIntersectionLine) +END_MESSAGE_MAP() + + +#define CPACS_XPATH_AIRCRAFT "/cpacs/vehicles/aircraft" +#define CPACS_XPATH_ROTORCRAFT "/cpacs/vehicles/rotorcraft" +#define CPACS_XPATH_AIRCRAFT_MODEL "/cpacs/vehicles/aircraft/model" +#define CPACS_XPATH_ROTORCRAFT_MODEL "/cpacs/vehicles/rotorcraft/model" + +CTIGLViewerDoc::CTIGLViewerDoc() +{ + myAISContext->SetDisplayMode(AIS_Shaded,Standard_False); + m_cpacsHandle = -1; +} + +CTIGLViewerDoc::~CTIGLViewerDoc() +{ +} + +// CTIGLViewerDoc-Befehle +BOOL CTIGLViewerDoc::OnOpenDocument(LPCTSTR lpszPathName) +{ + if (!OCC_3dBaseDoc::OnOpenDocument(lpszPathName)) + return FALSE; + + TixiDocumentHandle tixiHandle = -1; + + std::cerr << "Used TIXI version: " << tixiGetVersion() << std::endl; + std::cerr << "Used TIGL version: " << tiglGetVersion() << std::endl; + + ReturnCode tixiRet = tixiOpenDocument(static_cast(const_cast(lpszPathName)), &tixiHandle); + if (tixiRet != SUCCESS) + return FALSE; + + // read configuration names + int countAircrafts = 0; + int countRotorcrafts = 0; + tixiRet = tixiGetNamedChildrenCount( tixiHandle, CPACS_XPATH_AIRCRAFT, "model", &countAircrafts ); + tixiRet = tixiGetNamedChildrenCount( tixiHandle, CPACS_XPATH_ROTORCRAFT, "model", &countRotorcrafts ); + std::vector configurationsVector(countAircrafts + countRotorcrafts); + int listIndex = 0; + for(int i=0; iEraseAll(Standard_False); + + try { + if (m_cpacsHandle != -1) + { + tigl::CCPACSConfiguration& config = GetConfiguration(); + TixiDocumentHandle tixiHandle = config.GetTixiDocumentHandle(); + tiglCloseCPACSConfiguration(m_cpacsHandle); + tixiCloseDocument(tixiHandle); + m_cpacsHandle = -1; + } + } + catch (...) { } + + OCC_3dBaseDoc::DeleteContents(); +} + + +// Popups wings selection dialog and draws the profile point from the CPACS file +void CTIGLViewerDoc::OnDrawOverlayCPACSProfilePoints() +{ + CWingDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetWingIndex() + 1; + if (index < 1) + return; + + tigl::CCPACSWing& wing = GetConfiguration().GetWing(index); + + for (int i = 1; i <= wing.GetSegmentCount(); i++) + { + // Draw inner profile points + tigl::CCPACSWingSegment& segment = (tigl::CCPACSWingSegment &) wing.GetSegment(i); + std::vector innerPoints = segment.GetRawInnerProfilePoints(); + for (std::vector::size_type i = 0; i < innerPoints.size(); i++) + { + gp_Pnt pnt = innerPoints[i]->Get_gp_Pnt(); + pnt = wing.GetWingTransformation().Transform(pnt); + Handle(ISession_Point) aGraphicPoint = new ISession_Point(pnt.X(), pnt.Y(), pnt.Z()); + myAISContext->Display(aGraphicPoint, Standard_False); + } + + // Draw outer profile points + std::vector outerPoints = segment.GetRawOuterProfilePoints(); + for (std::vector::size_type i = 0; i < outerPoints.size(); i++) + { + gp_Pnt pnt = outerPoints[i]->Get_gp_Pnt(); + pnt = wing.GetWingTransformation().Transform(pnt); + Handle(ISession_Point) aGraphicPoint = new ISession_Point(pnt.X(), pnt.Y(), pnt.Z()); + myAISContext->Display(aGraphicPoint, Standard_False); + } + } +} + + +void CTIGLViewerDoc::OnShowWingProfiles() +{ + CWingProfileDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetProfileIndex() + 1; + if (index < 1) + return; + + myAISContext->EraseAll(Standard_False); + + tigl::CCPACSWingProfile& profile = GetConfiguration().GetWingProfile(index); + TopoDS_Wire wire = profile.GetWire(true); + Handle(AIS_Shape) shape = new AIS_Shape(wire); + shape->SetColor(Quantity_NOC_WHITE); + myAISContext->Display(shape, Standard_True); + + // Leading/trailing edges + gp_Pnt lePoint = profile.GetLEPoint(); + gp_Pnt tePoint = profile.GetTEPoint(); + + std::ostringstream text; + text << "LE(" << lePoint.X() << ", " << lePoint.Y() << ", " << lePoint.Z() << ")"; + DisplayPoint(lePoint, const_cast(text.str().c_str()), Standard_False, 0.0, 0.0, 0.0, 2.0); + text.str(""); + text << "TE(" << tePoint.X() << ", " << tePoint.Y() << ", " << tePoint.Z() << ")"; + DisplayPoint(tePoint, const_cast(text.str().c_str()), Standard_False, 0.0, 0.0, 0.0, 2.0); + text.str(""); + + gp_Lin gpline = gce_MakeLin(lePoint, tePoint); + // Handle(Geom_Line) geomLine = new Geom_Line(gpline); // unlimited line, which can be used in intersection calcs + + // Lets make a limited line for display reasons + Standard_Real length = lePoint.Distance(tePoint); + if (length > 0.0) + { + Handle(Geom_TrimmedCurve) trimmedLine = GC_MakeSegment(gpline, -length * 0.2, length * 1.2); + TopoDS_Edge le_te_edge = BRepBuilderAPI_MakeEdge(trimmedLine); + Handle(AIS_Shape) lineShape = new AIS_Shape(le_te_edge); + lineShape->SetColor(Quantity_NOC_GOLD /*Quantity_NOC_WHITE*/); + myAISContext->Display(lineShape, Standard_True); + } + + // Draw some points on the wing profile + for (double xsi = 0.0; xsi <= 1.0; xsi = xsi + 0.2) + { + try { + gp_Pnt chordPoint = profile.GetChordPoint(xsi); + text << "CPT(" << xsi << ")"; + text << "(" << chordPoint.X() << ", " << chordPoint.Y() << ", " << chordPoint.Z() << ")"; + DisplayPoint(chordPoint, const_cast(text.str().c_str()), Standard_False, 0.0, 0.0, 0.0, 2.0); + text.str(""); + } + catch (tigl::CTiglError& ex) { + std::cerr << ex.getError() << std::endl; + } + + try { + gp_Pnt upperPoint = profile.GetUpperPoint(xsi); + text << "UPT(" << xsi << ")"; + text << "(" << upperPoint.X() << ", " << upperPoint.Y() << ", " << upperPoint.Z() << ")"; + DisplayPoint(upperPoint, const_cast(text.str().c_str()), Standard_False, 0.0, 0.0, 0.0, 2.0); + text.str(""); + } + catch (tigl::CTiglError& ex) { + std::cerr << ex.getError() << std::endl; + } + + try { + gp_Pnt lowerPoint = profile.GetLowerPoint(xsi); + text << "LPT(" << xsi << ")"; + text << "(" << lowerPoint.X() << ", " << lowerPoint.Y() << ", " << lowerPoint.Z() << ")"; + DisplayPoint(lowerPoint, const_cast(text.str().c_str()), Standard_False, 0.0, 0.0, 0.0, 2.0); + text.str(""); + } + catch (tigl::CTiglError& ex) { + std::cerr << ex.getError() << std::endl; + } + } + + DrawXYZAxis(); + +} + +void CTIGLViewerDoc::OnShowFuselageProfiles() +{ + CFuselageProfileDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetProfileIndex() + 1; + if (index < 1) + return; + + myAISContext->EraseAll(Standard_False); + + tigl::CCPACSFuselageProfile& profile = GetConfiguration().GetFuselageProfile(index); + TopoDS_Wire wire = profile.GetWire(false); + Handle(AIS_Shape) shape = new AIS_Shape(wire); + shape->SetColor(Quantity_NOC_WHITE); + myAISContext->Display(shape, Standard_True); + + for (double zeta = 0.0; zeta <= 1.0; zeta += 0.1) + { + try { + gp_Pnt wirePoint = profile.GetPoint(zeta); + std::ostringstream text; + text << "PT(" << zeta << ")"; + DisplayPoint(wirePoint, const_cast(text.str().c_str()), Standard_False, 0.0, 0.0, 0.0, 2.0); + text.str(""); + } + catch (tigl::CTiglError& ex) { + std::cerr << ex.getError() << std::endl; + } + } + + DrawXYZAxis(); +} + +void CTIGLViewerDoc::OnShowWings() +{ + CWingDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetWingIndex() + 1; + if (index < 1) + return; + + myAISContext->EraseAll(Standard_False); + + tigl::CCPACSWing& wing = GetConfiguration().GetWing(index); + + for (int i = 1; i <= wing.GetSegmentCount(); i++) + { + // Draw segment loft + tigl::CCPACSWingSegment& segment = (tigl::CCPACSWingSegment &) wing.GetSegment(i); + TopoDS_Shape loft = segment.GetLoft(); + // Transform by wing transformation + loft = wing.GetWingTransformation().Transform(loft); + Handle(AIS_Shape) shape = new AIS_Shape(loft); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_False); + } + + DrawXYZAxis(); +} + +void CTIGLViewerDoc::OnShowFuselages() +{ + CFuselageDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetFuselageIndex() + 1; + if (index < 1) + return; + + myAISContext->EraseAll(Standard_False); + + tigl::CCPACSFuselage& fuselage = GetConfiguration().GetFuselage(index); + + + for (int i = 1; i <= fuselage.GetSegmentCount(); i++) + { + // Draw segment loft + tigl::CCPACSFuselageSegment& segment = (tigl::CCPACSFuselageSegment &) fuselage.GetSegment(i); + TopoDS_Shape loft = segment.GetLoft(); + // Transform by fuselage transformation + loft = fuselage.GetFuselageTransformation().Transform(loft); + Handle(AIS_Shape) shape = new AIS_Shape(loft); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_False); + } + + DrawXYZAxis(); +} + +void CTIGLViewerDoc::OnShowWingTriangulation() +{ + CWingDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetWingIndex() + 1; + if (index < 1) + return; + + //clear screen + myAISContext->EraseAll(Standard_False); + + tigl::CCPACSWing& wing = GetConfiguration().GetWing(index); + tigl::CCPACSWingSegment& firstSegment = (tigl::CCPACSWingSegment &) wing.GetSegment(1); + TopoDS_Shape fusedWing = firstSegment.GetLoft(); + + for (int i = 2; i <= wing.GetSegmentCount(); i++) + { + tigl::CCPACSWingSegment& segment = (tigl::CCPACSWingSegment &) wing.GetSegment(i); + TopoDS_Shape loft = segment.GetLoft(); + + TopExp_Explorer shellExplorer; + TopExp_Explorer faceExplorer; + + fusedWing = BRepAlgoAPI_Fuse(fusedWing, loft); + } + + BRepMesh::Mesh(fusedWing, 0.01); + + BRep_Builder builder; + TopoDS_Compound compound; + builder.MakeCompound(compound); + + TopExp_Explorer shellExplorer; + TopExp_Explorer faceExplorer; + for (shellExplorer.Init(fusedWing, TopAbs_SHELL); shellExplorer.More(); shellExplorer.Next()) + { + TopoDS_Shell shell = TopoDS::Shell(shellExplorer.Current()); + + for (faceExplorer.Init(shell, TopAbs_FACE); faceExplorer.More(); faceExplorer.Next()) + { + TopoDS_Face face = TopoDS::Face(faceExplorer.Current()); + TopLoc_Location location; + Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation(face, location); + if (triangulation.IsNull()) + continue; + + gp_Trsf nodeTransformation = location; + const TColgp_Array1OfPnt& nodes = triangulation->Nodes(); + + int index1, index2, index3; + const Poly_Array1OfTriangle& triangles = triangulation->Triangles(); + for (int j = triangles.Lower(); j <= triangles.Upper(); j++) + { + const Poly_Triangle& triangle = triangles(j); + triangle.Get(index1, index2, index3); + gp_Pnt point1 = nodes(index1).Transformed(nodeTransformation); + gp_Pnt point2 = nodes(index2).Transformed(nodeTransformation); + gp_Pnt point3 = nodes(index3).Transformed(nodeTransformation); + + // Transform by wing transformation + point1 = wing.GetWingTransformation().Transform(point1); + point2 = wing.GetWingTransformation().Transform(point2); + point3 = wing.GetWingTransformation().Transform(point3); + + BRepBuilderAPI_MakePolygon poly; + poly.Add(point1); + poly.Add(point2); + poly.Add(point3); + poly.Close(); + + TopoDS_Face triangleFace = BRepBuilderAPI_MakeFace(poly.Wire()); + builder.Add(compound, triangleFace); + + BRepBuilderAPI_MakeEdge edge1(point1, point2); + BRepBuilderAPI_MakeEdge edge2(point2, point3); + BRepBuilderAPI_MakeEdge edge3(point3, point1); + builder.Add(compound, edge1); + builder.Add(compound, edge2); + builder.Add(compound, edge3); + } + } + } + Handle(AIS_Shape) triangulation = new AIS_Shape(compound); + myAISContext->SetDisplayMode(triangulation, 1); + myAISContext->SetColor(triangulation, Quantity_NOC_BLUE2); + myAISContext->Display(triangulation); + + DrawXYZAxis(); +} + + + +void CTIGLViewerDoc::OnShowFuselageTriangulation() +{ + CFuselageDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetFuselageIndex() + 1; + if (index < 1) + return; + + // clean screen + myAISContext->EraseAll(Standard_False); + + tigl::CCPACSFuselage& fuselage = GetConfiguration().GetFuselage(index); + tigl::CCPACSFuselageSegment& segment = (tigl::CCPACSFuselageSegment &) fuselage.GetSegment(1); + TopoDS_Shape fusedFuselage = segment.GetLoft(); + + for (int i = 2; i <= fuselage.GetSegmentCount(); i++) + { + tigl::CCPACSFuselageSegment& segment = (tigl::CCPACSFuselageSegment &) fuselage.GetSegment(i); + // Draw segment loft + const TopoDS_Shape loft = segment.GetLoft(); + fusedFuselage = BRepAlgoAPI_Fuse(fusedFuselage, loft); + } + + BRepMesh::Mesh(fusedFuselage, 0.01); + + // Draw segment loft + BRep_Builder builder; + TopoDS_Compound compound; + builder.MakeCompound(compound); + + TopExp_Explorer shellExplorer; + TopExp_Explorer faceExplorer; + for (shellExplorer.Init(fusedFuselage, TopAbs_SHELL); shellExplorer.More(); shellExplorer.Next()) + { + TopoDS_Shell shell = TopoDS::Shell(shellExplorer.Current()); + + for (faceExplorer.Init(shell, TopAbs_FACE); faceExplorer.More(); faceExplorer.Next()) + { + TopoDS_Face face = TopoDS::Face(faceExplorer.Current()); + TopLoc_Location location; + Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation(face, location); + if (triangulation.IsNull()) + continue; + + gp_Trsf nodeTransformation = location; + const TColgp_Array1OfPnt& nodes = triangulation->Nodes(); + + int index1, index2, index3; + const Poly_Array1OfTriangle& triangles = triangulation->Triangles(); + for (int j = triangles.Lower(); j <= triangles.Upper(); j++) + { + const Poly_Triangle& triangle = triangles(j); + triangle.Get(index1, index2, index3); + gp_Pnt point1 = nodes(index1).Transformed(nodeTransformation); + gp_Pnt point2 = nodes(index2).Transformed(nodeTransformation); + gp_Pnt point3 = nodes(index3).Transformed(nodeTransformation); + + // Transform by fuselage transformation + point1 = fuselage.GetFuselageTransformation().Transform(point1); + point2 = fuselage.GetFuselageTransformation().Transform(point2); + point3 = fuselage.GetFuselageTransformation().Transform(point3); + + BRepBuilderAPI_MakePolygon poly; + poly.Add(point1); + poly.Add(point2); + poly.Add(point3); + poly.Close(); + + TopoDS_Face triangleFace = BRepBuilderAPI_MakeFace(poly.Wire()); + builder.Add(compound, triangleFace); + + BRepBuilderAPI_MakeEdge edge1(point1, point2); + BRepBuilderAPI_MakeEdge edge2(point2, point3); + BRepBuilderAPI_MakeEdge edge3(point3, point1); + builder.Add(compound, edge1); + builder.Add(compound, edge2); + builder.Add(compound, edge3); + } + } + } + Handle(AIS_Shape) triangulation = new AIS_Shape(compound); + myAISContext->SetDisplayMode(triangulation, 1); + myAISContext->SetColor(triangulation, Quantity_NOC_BLUE2); + myAISContext->Display(triangulation); + + DrawXYZAxis(); +} + +void CTIGLViewerDoc::OnShowWingPoints() +{ + CWingDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int wingIndex = dlg.GetWingIndex() + 1; + if (wingIndex < 1) + return; + + myAISContext->EraseAll(Standard_False); + + tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingIndex); + + for (int segmentIndex = 1; segmentIndex <= wing.GetSegmentCount(); segmentIndex++) + { + // Draw segment loft + tigl::CCPACSWingSegment& segment = (tigl::CCPACSWingSegment &) wing.GetSegment(segmentIndex); + TopoDS_Shape loft = segment.GetLoft(); + // Transform by wing transformation + loft = wing.GetWingTransformation().Transform(loft); + Handle(AIS_Shape) shape = new AIS_Shape(loft); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_True); + + // Draw some points on the wing segment + for (double eta = 0.0; eta <= 1.0; eta += 0.1) + { + for (double xsi = 0.0; xsi <= 1.0; xsi += 0.1) + { + double x, y, z; + TiglReturnCode res = tiglWingGetUpperPoint( + m_cpacsHandle, + wingIndex, + segmentIndex, + eta, + xsi, + &x, + &y, + &z); + if (res != TIGL_SUCCESS) + TRACE("tiglWingGetUpperPoint failed, Error code = %d\n", res); + + Handle(ISession_Point) aGraphicPoint = new ISession_Point(x, y, z); + myAISContext->Display(aGraphicPoint, Standard_False); + + res = tiglWingGetLowerPoint( + m_cpacsHandle, + wingIndex, + segmentIndex, + eta, + xsi, + &x, + &y, + &z); + if (res != TIGL_SUCCESS) + TRACE("tiglWingGetLowerPoint failed, Error code = %d\n", res); + + aGraphicPoint = new ISession_Point(x, y, z); + myAISContext->Display(aGraphicPoint, Standard_False); + } + } + } + + DrawXYZAxis(); +} + +void CTIGLViewerDoc::OnShowFuselagePoints() +{ + CFuselageDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int fuselageIndex = dlg.GetFuselageIndex() + 1; + if (fuselageIndex < 1) + return; + + myAISContext->EraseAll(Standard_False); + + tigl::CCPACSFuselage& fuselage = GetConfiguration().GetFuselage(fuselageIndex); + + for (int segmentIndex = 1; segmentIndex <= fuselage.GetSegmentCount(); segmentIndex++) + { + // Draw segment loft + tigl::CCPACSFuselageSegment& segment = (tigl::CCPACSFuselageSegment &) fuselage.GetSegment(segmentIndex); + TopoDS_Shape loft = segment.GetLoft(); + // Transform by fuselage transformation + loft = fuselage.GetFuselageTransformation().Transform(loft); + Handle(AIS_Shape) shape = new AIS_Shape(loft); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_True); + + // Draw some points on the fuselage segment + for (double eta = 0.0; eta <= 1.0; eta += 0.25) + { + for (double zeta = 0.0; zeta <= 1.0; zeta += 0.1) + { + double x, y, z; + TiglReturnCode res = tiglFuselageGetPoint( + m_cpacsHandle, + fuselageIndex, + segmentIndex, + eta, + zeta, + &x, + &y, + &z); + if (res != TIGL_SUCCESS) + TRACE("tiglFuselageGetPoint failed, Error code = %d\n", res); + + Handle(ISession_Point) aGraphicPoint = new ISession_Point(x, y, z); + myAISContext->Display(aGraphicPoint, Standard_False); + } + } + } + + DrawXYZAxis(); +} + + + +void CTIGLViewerDoc::OnShowFuselagePointsAngle() +{ + int fuselageIndex = 1; + int segmentIndex = 15; + double y_cs = 0.0; + double z_cs = 0.0; + double angle = 45.0; // turn through 45 degrees + double x, y, z; + + myAISContext->EraseAll(Standard_False); + tigl::CCPACSFuselage& fuselage = GetConfiguration().GetFuselage(fuselageIndex); + + // Draw segment loft + tigl::CCPACSFuselageSegment& segment = (tigl::CCPACSFuselageSegment &) fuselage.GetSegment(segmentIndex); + TopoDS_Shape loft = segment.GetLoft(); + // Transform by fuselage transformation + loft = fuselage.GetFuselageTransformation().Transform(loft); + Handle(AIS_Shape) shape = new AIS_Shape(loft); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_True); + + // Display the intersection point + TiglReturnCode res2 = tiglFuselageGetPointAngle( + m_cpacsHandle, + fuselageIndex, + segmentIndex, + 0.5, + angle, + &x, + &y, + &z); + if (res2 != TIGL_SUCCESS) + TRACE("tiglFuselageGetPointAngle failed, Error code = %d\n", res2); + + Handle(ISession_Point) aGraphicPoint = new ISession_Point(x, y, z); + myAISContext->Display(aGraphicPoint, Standard_False); + + DrawXYZAxis(); +} + +void CTIGLViewerDoc::OnInterpolateBsplineWire() +{ + tiglUseAlgorithm(TIGL_INTERPOLATE_BSPLINE_WIRE); +} + +void CTIGLViewerDoc::OnInterpolateLinearWire() +{ + tiglUseAlgorithm(TIGL_INTERPOLATE_LINEAR_WIRE); +} + +void CTIGLViewerDoc::OnApproximateBsplineWire() +{ + tiglUseAlgorithm(TIGL_APPROXIMATE_BSPLINE_WIRE); +} + +void CTIGLViewerDoc::OnUpdateInterpolateBsplineWire(CCmdUI *pCmdUI) +{ + tigl::CTiglAlgorithmManager& manager = tigl::CTiglAlgorithmManager::GetInstance(); + const tigl::ITiglWireAlgorithm& algorithm = manager.GetWireAlgorithm(); + pCmdUI->SetCheck(algorithm.GetAlgorithmCode() == TIGL_INTERPOLATE_BSPLINE_WIRE); +} + +void CTIGLViewerDoc::OnUpdateInterpolateLinearWire(CCmdUI *pCmdUI) +{ + tigl::CTiglAlgorithmManager& manager = tigl::CTiglAlgorithmManager::GetInstance(); + const tigl::ITiglWireAlgorithm& algorithm = manager.GetWireAlgorithm(); + pCmdUI->SetCheck(algorithm.GetAlgorithmCode() == TIGL_INTERPOLATE_LINEAR_WIRE); +} + +void CTIGLViewerDoc::OnUpdateApproximateBsplineWire(CCmdUI *pCmdUI) +{ + tigl::CTiglAlgorithmManager& manager = tigl::CTiglAlgorithmManager::GetInstance(); + const tigl::ITiglWireAlgorithm& algorithm = manager.GetWireAlgorithm(); + pCmdUI->SetCheck(algorithm.GetAlgorithmCode() == TIGL_APPROXIMATE_BSPLINE_WIRE); +} + +// Returns the CPACS configuration +tigl::CCPACSConfiguration& CTIGLViewerDoc::GetConfiguration(void) const +{ + tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); + return manager.GetConfiguration(m_cpacsHandle); +} + +// Displays a point on the screen +void CTIGLViewerDoc::DisplayPoint(gp_Pnt& aPoint, + char* aText, + Standard_Boolean UpdateViewer, + Standard_Real anXoffset, + Standard_Real anYoffset, + Standard_Real aZoffset, + Standard_Real TextScale) +{ + Handle(ISession_Point) aGraphicPoint = new ISession_Point(aPoint); + myAISContext->Display(aGraphicPoint,UpdateViewer); + Handle(ISession_Text) aGraphicText = new ISession_Text(aText,aPoint.X()+anXoffset,aPoint.Y()+anYoffset,aPoint.Z()+aZoffset); + aGraphicText->SetScale(TextScale); + myAISContext->Display(aGraphicText,UpdateViewer); +} + +void CTIGLViewerDoc::DrawXYZAxis(void) +{ + // X + Handle(Geom_TrimmedCurve) line = GC_MakeSegment(gp_Pnt(0.0, 0.0, 0.0), gp_Pnt(1.0, 0.0, 0.0)); + TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(line); + Handle(AIS_Shape) lineShape = new AIS_Shape(edge); + lineShape->SetColor(Quantity_NOC_WHITE); + myAISContext->Display(lineShape, Standard_True); + DisplayPoint(gp_Pnt(1.0, 0.0, 0.0), "X", Standard_True, 0.0, 0.0, 0.0, 2.0); + + // Y + line = GC_MakeSegment(gp_Pnt(0.0, 0.0, 0.0), gp_Pnt(0.0, 1.0, 0.0)); + edge = BRepBuilderAPI_MakeEdge(line); + lineShape = new AIS_Shape(edge); + lineShape->SetColor(Quantity_NOC_WHITE); + myAISContext->Display(lineShape, Standard_True); + DisplayPoint(gp_Pnt(0.0, 1.0, 0.0), "Y", Standard_True, 0.0, 0.0, 0.0, 2.0); + + // Z + line = GC_MakeSegment(gp_Pnt(0.0, 0.0, 0.0), gp_Pnt(0.0, 0.0, 1.0)); + edge = BRepBuilderAPI_MakeEdge(line); + lineShape = new AIS_Shape(edge); + lineShape->SetColor(Quantity_NOC_WHITE); + myAISContext->Display(lineShape, Standard_True); + DisplayPoint(gp_Pnt(0.0, 0.0, 1.0), "Z", Standard_True, 0.0, 0.0, 0.0, 2.0); +} + + +void CTIGLViewerDoc::OnShowAllPoints() +{ + myAISContext->EraseAll(Standard_False); + std::ostringstream text; + + // Draw all wings + for (int wingIndex = 1; wingIndex <= GetConfiguration().GetWingCount(); wingIndex++) + { + tigl::CCPACSWing& wing = GetConfiguration().GetWing(wingIndex); + + for (int segmentIndex = 1; segmentIndex <= wing.GetSegmentCount(); segmentIndex++) + { + tigl::CCPACSWingSegment& segment = (tigl::CCPACSWingSegment &) wing.GetSegment(segmentIndex); + TopoDS_Shape loft = segment.GetLoft(); + // Transform by wing transformation + loft = wing.GetWingTransformation().Transform(loft); + Handle(AIS_Shape) shape = new AIS_Shape(loft); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_True); + + for (double eta = 0.0; eta <= 1.0; eta += 0.1) + { + for (double xsi = 0.0; xsi <= 1.0; xsi += 0.1) + { + double x, y, z; + TiglReturnCode res = tiglWingGetUpperPoint( + m_cpacsHandle, + wingIndex, + segmentIndex, + eta, + xsi, + &x, + &y, + &z); + if (res != TIGL_SUCCESS) + TRACE("tiglWingGetUpperPoint failed, Error code = %d\n", res); + + Handle(ISession_Point) aGraphicPoint = new ISession_Point(x, y, z); + myAISContext->Display(aGraphicPoint,Standard_False); + //text << "PT(" << xsi << ", " << eta << ")"; + //text << "(" << x << ", " << y << ", " << z << ")"; + //DisplayPoint(gp_Pnt(x, y, z), const_cast(text.str().c_str()), Standard_False, 0.0, 0.0, 0.0, 2.0); + //text.str(""); + + res = tiglWingGetLowerPoint( + m_cpacsHandle, + wingIndex, + segmentIndex, + eta, + xsi, + &x, + &y, + &z); + if (res != TIGL_SUCCESS) + TRACE("tiglWingGetLowerPoint failed, Error code = %d\n", res); + + aGraphicPoint = new ISession_Point(x, y, z); + myAISContext->Display(aGraphicPoint,Standard_False); + //text << "PT(" << xsi << ", " << eta << ")"; + //text << "(" << x << ", " << y << ", " << z << ")"; + //DisplayPoint(gp_Pnt(x, y, z), const_cast(text.str().c_str()), Standard_False, 0.0, 0.0, 0.0, 2.0); + //text.str(""); + } + } + } + } + + // Draw all fuselages + for (int fuselageIndex = 1; fuselageIndex <= GetConfiguration().GetFuselageCount(); fuselageIndex++) + { + tigl::CCPACSFuselage& fuselage = GetConfiguration().GetFuselage(fuselageIndex); + + for (int segmentIndex = 1; segmentIndex <= fuselage.GetSegmentCount(); segmentIndex++) + { + // Draw segment loft + tigl::CCPACSFuselageSegment& segment = (tigl::CCPACSFuselageSegment &) fuselage.GetSegment(segmentIndex); + TopoDS_Shape loft = segment.GetLoft(); + // Transform by fuselage transformation + loft = fuselage.GetFuselageTransformation().Transform(loft); + Handle(AIS_Shape) shape = new AIS_Shape(loft); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_True); + + // Draw some points on the fuselage segment + for (double eta = 0.0; eta <= 1.0; eta += 0.25) + { + for (double zeta = 0.0; zeta <= 1.0; zeta += 0.1) + { + double x, y, z; + TiglReturnCode res = tiglFuselageGetPoint( + m_cpacsHandle, + fuselageIndex, + segmentIndex, + eta, + zeta, + &x, + &y, + &z); + if (res != TIGL_SUCCESS) + TRACE("tiglFuselageGetPoint failed, Error code = %d\n", res); + + Handle(ISession_Point) aGraphicPoint = new ISession_Point(x, y, z); + myAISContext->Display(aGraphicPoint,Standard_False); + } + } + } + } + + DrawXYZAxis(); +} + + +void CTIGLViewerDoc::OnShowAll() +{ + myAISContext->EraseAll(Standard_False); + + // Draw all wings + for (int w = 1; w <= GetConfiguration().GetWingCount(); w++) + { + tigl::CCPACSWing& wing = GetConfiguration().GetWing(w); + + for (int i = 1; i <= wing.GetSegmentCount(); i++) + { + tigl::CCPACSWingSegment& segment = (tigl::CCPACSWingSegment &) wing.GetSegment(i); + TopoDS_Shape loft = segment.GetLoft(); + + // Transform by wing transformation + loft = wing.GetWingTransformation().Transform(loft); + + Handle(AIS_Shape) shape = new AIS_Shape(loft); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_True); + } + } + + // Draw all fuselages + for (int f = 1; f <= GetConfiguration().GetFuselageCount(); f++) + { + tigl::CCPACSFuselage& fuselage = GetConfiguration().GetFuselage(f); + + for (int i = 1; i <= fuselage.GetSegmentCount(); i++) + { + tigl::CCPACSFuselageSegment& segment = (tigl::CCPACSFuselageSegment &) fuselage.GetSegment(i); + TopoDS_Shape loft = segment.GetLoft(); + + // Transform by fuselage transformation + loft = fuselage.GetFuselageTransformation().Transform(loft); + + Handle(AIS_Shape) shape = new AIS_Shape(loft); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_True); + } + } + + DrawXYZAxis(); +} + + +void CTIGLViewerDoc::OnExportAsIges() +{ + CFileDialog dlg(FALSE,_T("*.iges"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "IGES Files (*.iges )|*.iges;|IGES Files (*.igs )| *.igs;||", NULL ); + + if (dlg.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + std::string filename(dlg.GetPathName()); + char* filenamePtr = const_cast(filename.c_str()); + TiglReturnCode err = tiglExportIGES(m_cpacsHandle, filenamePtr); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + if (err != TIGL_SUCCESS) + { + std::ostringstream str; + str << "Error while exporting as IGES, Error code = " << err; + AfxMessageBox(str.str().c_str(), MB_ICONERROR | MB_OK); + } + } +} + + + +void CTIGLViewerDoc::OnExportMeshedWingSTL() +{ + CWingDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetWingIndex() + 1; + if (index < 1) + return; + + CFileDialog dlgF(FALSE,_T("*.iges"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "STL Files (*.stl )|*.stl;||", NULL ); + + if (dlgF.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + std::string filename(dlgF.GetPathName()); + char* filenamePtr = const_cast(filename.c_str()); + TiglReturnCode err = tiglExportMeshedWingSTL(m_cpacsHandle, index, filenamePtr, 0.01); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + if (err != TIGL_SUCCESS) + { + std::ostringstream str; + str << "Error while exporting wing as STL, Error code = " << err; + AfxMessageBox(str.str().c_str(), MB_ICONERROR | MB_OK); + } + } +} + +void CTIGLViewerDoc::OnExportMeshedFuselageSTL() +{ + CFuselageDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetFuselageIndex() + 1; + if (index < 1) + return; + + CFileDialog dlgF(FALSE,_T("*.iges"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "STL Files (*.stl )|*.stl;||", NULL ); + + if (dlgF.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + std::string filename(dlgF.GetPathName()); + char* filenamePtr = const_cast(filename.c_str()); + TiglReturnCode err = tiglExportMeshedFuselageSTL(m_cpacsHandle, index, filenamePtr, 0.01); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + if (err != TIGL_SUCCESS) + { + std::ostringstream str; + str << "Error while exporting fuselage as STL, Error code = " << err; + AfxMessageBox(str.str().c_str(), MB_ICONERROR | MB_OK); + } + } +} + + + +void CTIGLViewerDoc::OnExportMeshedWingVTKIndex() +{ + CWingDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetWingIndex() + 1; + if (index < 1) + return; + + CFileDialog dlgF(FALSE,_T("*.iges"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "VTK Files (*.vtp )|*.vtp;||", NULL ); + + if (dlgF.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + std::string filename(dlgF.GetPathName()); + char* filenamePtr = const_cast(filename.c_str()); + TiglReturnCode err = tiglExportMeshedWingVTKByIndex(m_cpacsHandle, index, filenamePtr, 0.1); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + if (err != TIGL_SUCCESS) + { + std::ostringstream str; + str << "Error while exporting wing as VTK, Error code = " << err; + AfxMessageBox(str.str().c_str(), MB_ICONERROR | MB_OK); + } + } +} + + + + +void CTIGLViewerDoc::OnExportMeshedWingVTKSimple() +{ + CWingUIDDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + std::string uid = dlg.GetWingUID(); + + CFileDialog dlgF(FALSE,_T("*.iges"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "VTK Files (*.vtp )|*.vtp;||", NULL ); + + if (dlgF.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + std::string filename(dlgF.GetPathName()); + char* filenamePtr = const_cast(filename.c_str()); + char* uidPtr = const_cast(uid.c_str()); + TiglReturnCode err = tiglExportMeshedWingVTKSimpleByUID(m_cpacsHandle, uidPtr, filenamePtr, 0.1); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + if (err != TIGL_SUCCESS) + { + std::ostringstream str; + str << "Error while exporting wing as VTK, Error code = " << err; + AfxMessageBox(str.str().c_str(), MB_ICONERROR | MB_OK); + } + } +} + +void CTIGLViewerDoc::OnExportMeshedFuselageVTKIndex() +{ + CFuselageDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetFuselageIndex() + 1; + if (index < 1) + return; + + CFileDialog dlgF(FALSE,_T("*.iges"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "VTK Files (*.vtp )|*.vtp;||", NULL ); + + if (dlgF.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + std::string filename(dlgF.GetPathName()); + char* filenamePtr = const_cast(filename.c_str()); + TiglReturnCode err = tiglExportMeshedFuselageVTKByIndex(m_cpacsHandle, index, filenamePtr, 0.1); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + if (err != TIGL_SUCCESS) + { + std::ostringstream str; + str << "Error while exporting fuselage as VTK, Error code = " << err; + AfxMessageBox(str.str().c_str(), MB_ICONERROR | MB_OK); + } + } +} + + + +void CTIGLViewerDoc::OnExportMeshedFuselageVTKSimple() +{ + CFuselageUIDDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + std::string uid = dlg.GetFuselageUID(); + + CFileDialog dlgF(FALSE,_T("*.iges"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "VTK Files (*.vtp )|*.vtp;||", NULL ); + + if (dlgF.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + std::string filename(dlgF.GetPathName()); + char* filenamePtr = const_cast(filename.c_str()); + char* uidPtr = const_cast(uid.c_str()); + TiglReturnCode err = tiglExportMeshedFuselageVTKSimpleByUID(m_cpacsHandle, uidPtr, filenamePtr, 0.1); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + if (err != TIGL_SUCCESS) + { + std::ostringstream str; + str << "Error while exporting fuselage as VTK, Error code = " << err; + AfxMessageBox(str.str().c_str(), MB_ICONERROR | MB_OK); + } + } +} + + + +void CTIGLViewerDoc::OnExportAsFusedIges() +{ + CFileDialog dlg(FALSE,_T("*.iges"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + "IGES Files (*.iges )|*.iges;|IGES Files (*.igs )| *.igs;||", NULL ); + + if (dlg.DoModal() == IDOK) + { + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); + std::string filename(dlg.GetPathName()); + char* filenamePtr = const_cast(filename.c_str()); + TiglReturnCode err = tiglExportFusedWingFuselageIGES(m_cpacsHandle, filenamePtr); + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); + if (err != TIGL_SUCCESS) + { + std::ostringstream str; + str << "Error while exporting as IGES, Error code = " << err; + AfxMessageBox(str.str().c_str(), MB_ICONERROR | MB_OK); + } + } +} + +void CTIGLViewerDoc::PrintContents (TopoDS_Shape geom) +{ + ShapeAnalysis_ShapeContents cont; + cont.Clear(); + cont.Perform(geom); + + cout << "OCC CONTENTS" << endl; + cout << "============" << endl; + cout << "SOLIDS : " << cont.NbSolids() << endl; + cout << "SHELLS : " << cont.NbShells() << endl; + cout << "FACES : " << cont.NbFaces() << endl; + cout << "WIRES : " << cont.NbWires() << endl; + cout << "EDGES : " << cont.NbEdges() << endl; + cout << "VERTICES : " << cont.NbVertices() << endl; + + TopExp_Explorer e; + int count = 0; + for (e.Init(geom, TopAbs_COMPOUND); e.More(); e.Next()) + count++; + cout << "Compounds: " << count << endl; + + count = 0; + for (e.Init(geom, TopAbs_COMPSOLID); e.More(); e.Next()) + count++; + cout << "CompSolids: " << count << endl; + + cout << endl; + +} + + +void CTIGLViewerDoc::OnShowFusedFuselages() +{ + CFuselageDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetFuselageIndex() + 1; + if (index < 1) + return; + + myAISContext->EraseAll(Standard_False); + tigl::CCPACSFuselage& fuselage = GetConfiguration().GetFuselage(index); + TopoDS_Shape fusedFuselage = fuselage.GetLoft(); + + Handle(AIS_Shape) shape = new AIS_Shape(fusedFuselage); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_False); + + DrawXYZAxis(); +} + + +void CTIGLViewerDoc::OnShowFusedWings() +{ + CWingDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + + int index = dlg.GetWingIndex() + 1; + if (index < 1) + return; + + myAISContext->EraseAll(Standard_False); + tigl::CCPACSWing& wing = GetConfiguration().GetWing(index); + TopoDS_Shape fusedWing = wing.GetLoft(); + + Handle(AIS_Shape) shape = new AIS_Shape(fusedWing); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_False); + + DrawXYZAxis(); +} + + +void CTIGLViewerDoc::OnShowFusedAll() +{ + myAISContext->EraseAll(Standard_False); + TopoDS_Shape airplane = GetConfiguration().GetFusedAirplane(); + + Handle(AIS_Shape) shape = new AIS_Shape(airplane); + shape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(shape, Standard_False); + + DrawXYZAxis(); +} + + + +// Draws a point where the distance between the selected fuselage and the ground is at minimum. +// The Fuselage could be turned with a given angle at at given axis, specified by a point and a direction. +void CTIGLViewerDoc::OnDrawMinumumDistanceToGround() +{ + double axisPntX = 0.0; + double axisPntY = 0.0; + double axisPntZ = 0.0; + double axisDirX = 0.0; + double axisDirY = 0.0; + double axisDirZ = 0.0; + double angle = 0.0; + + myAISContext->EraseAll(Standard_False); + + // Get the right fuselage + CFuselageUIDDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + std::string uid = dlg.GetFuselageUID(); + tigl::CCPACSFuselage& fuselage = GetConfiguration().GetFuselage(uid); + TopoDS_Shape fusedFuselage = fuselage.GetLoft(); + + // get all values for the axis + InputBoxHelper ibox(AfxGetMainWnd()->m_hWnd); + + if (ibox.DoModal("DrawMinumumDistanceToGround", "Please specifiy the X-value of the axis on which the aircraft should be rotated.")) { + axisPntX = atof(ibox.Text); + } + + if (ibox.DoModal("DrawMinumumDistanceToGround", "Please specifiy the Y-value of the axis on which the aircraft should be rotated.")) { + axisPntY = atof(ibox.Text); + } + + if (ibox.DoModal("DrawMinumumDistanceToGround", "Please specifiy the Z-value of the axis on which the aircraft should be rotated.")) { + axisPntZ = atof(ibox.Text); + } + + // get direction + if (ibox.DoModal("DrawMinumumDistanceToGround", "Please specifiy the X-value of the direction of the axis on which the aircraft should be rotated.")) { + axisDirX = atof(ibox.Text); + } + + if (ibox.DoModal("DrawMinumumDistanceToGround", "Please specifiy the Y-value of the direction of the axis on which the aircraft should be rotated.")) { + axisDirY = atof(ibox.Text); + } + + if (ibox.DoModal("DrawMinumumDistanceToGround", "Please specifiy the Z-value of the direction of the axis on which the aircraft should be rotated.")) { + axisDirZ = atof(ibox.Text); + } + + // get the angle + if (ibox.DoModal("DrawMinumumDistanceToGround", "Please specifiy the angle (in degree) on which the aircraft should be rotated.")) { + angle = atof(ibox.Text); + } + + + + // Definition of the axis of rotation + gp_Ax1 RAxis(gp_Pnt(axisPntX, axisPntY, axisPntZ), gp_Dir(axisDirX, axisDirY, axisDirZ)); + + Handle(Geom_Line) aGeomAxis= new Geom_Line(RAxis); + Handle(Geom_TrimmedCurve) trimmedLine = GC_MakeSegment(RAxis, -20 * 0.2, 20 * 1.2); + TopoDS_Edge le_te_edge = BRepBuilderAPI_MakeEdge(trimmedLine); + Handle(AIS_Shape) lineShape = new AIS_Shape(le_te_edge); + lineShape->SetColor(Quantity_NOC_GOLD /*Quantity_NOC_WHITE*/); + myAISContext->Display(lineShape, Standard_True); + + + // now rotate fuselage + gp_Trsf myTrsf; + myTrsf.SetRotation(RAxis, angle *PI / 180); + BRepBuilderAPI_Transform xform(fusedFuselage, myTrsf); + fusedFuselage = xform.Shape(); + + // draw rotated fuselage + Handle(AIS_Shape) fuselageShape = new AIS_Shape(fusedFuselage); + fuselageShape->SetColor(Quantity_NOC_BLUE2); + myAISContext->Display(fuselageShape, Standard_False); + + + //build cutting plane for intersection + gp_Pnt p1(-25, -25, -8); + gp_Pnt p2( 45, -25, -8); + gp_Pnt p3( 45, 25, -8); + gp_Pnt p4(-25, 25, -8); + + Handle(Geom_TrimmedCurve) shaft_line1 = GC_MakeSegment(p1,p2); + Handle(Geom_TrimmedCurve) shaft_line2 = GC_MakeSegment(p2,p3); + Handle(Geom_TrimmedCurve) shaft_line3 = GC_MakeSegment(p3,p4); + Handle(Geom_TrimmedCurve) shaft_line4 = GC_MakeSegment(p4,p1); + + TopoDS_Edge shaft_edge1 = BRepBuilderAPI_MakeEdge(shaft_line1); + TopoDS_Edge shaft_edge2 = BRepBuilderAPI_MakeEdge(shaft_line2); + TopoDS_Edge shaft_edge3 = BRepBuilderAPI_MakeEdge(shaft_line3); + TopoDS_Edge shaft_edge4 = BRepBuilderAPI_MakeEdge(shaft_line4); + + TopoDS_Wire shaft_wire = BRepBuilderAPI_MakeWire(shaft_edge1, shaft_edge2, shaft_edge3, shaft_edge4); + TopoDS_Face shaft_face = BRepBuilderAPI_MakeFace(shaft_wire); + + Handle(AIS_Shape) shape = new AIS_Shape(shaft_face); + shape->SetColor(Quantity_NOC_BROWN); + myAISContext->Display(shape, Standard_False); + + + gp_Pnt closest_pnt = fuselage.GetMinumumDistanceToGround(RAxis, angle); + + // display point on fuselage + std::ostringstream text; + text << "LE(" << closest_pnt.X() << ", " << closest_pnt.Y() << ", " << closest_pnt.Z() << ")"; + DisplayPoint(closest_pnt, const_cast(text.str().c_str()), Standard_False, 0.0, 0.0, 0.0, 2.0); + +} + + + + + +/** +* unvollständig: es musst geklärt werden wie mit den 2 Schnittkurven +* zwischen Flügel und Rumpf umgegangen werden muss oder ob diese eine +* Ungenauigkeit in unserer Beispiel CPACS Datei ist. +* Danach muss das Problem gelöst werden das diese Hilfsklasse nicht +* jedes mal neu erzeugt und berechnet wird. +*/ +void CTIGLViewerDoc::OnShowIntersectionLine() +{ + // Get Wing UID + CWingUIDDialog dlgW(*this); + if (dlgW.DoModal() != IDOK) + return; + std::string wingUid = dlgW.GetWingUID(); + + // Get Fuselage UID + CFuselageUIDDialog dlg(*this); + if (dlg.DoModal() != IDOK) + return; + std::string fuselageUid = dlg.GetFuselageUID(); + + + /* now calculate intersection and display single points */ + for (double eta = 0.0; eta <= 1.0; eta += 0.1) + { + double x, y, z; + + TiglReturnCode res = tiglComponentIntersectionPoint( + m_cpacsHandle, + const_cast(fuselageUid.c_str()), //fuselage UID + const_cast(wingUid.c_str()), //wing uid + 1, // wireID + eta, + &x, + &y, + &z); + if (res != TIGL_SUCCESS) + TRACE("tiglComponentIntersectionPoint failed, Error code = %d\n", res); + + ISession_Point* aGraphicPoint = new ISession_Point(x, y, z); + myAISContext->Display(aGraphicPoint,Standard_False); + } + DrawXYZAxis(); +} + + + + + + + +// CTIGLViewerDoc Diagnose +#ifdef _DEBUG +void CTIGLViewerDoc::AssertValid() const +{ + CDocument::AssertValid(); +} + +void CTIGLViewerDoc::Dump(CDumpContext& dc) const +{ + CDocument::Dump(dc); +} +#endif //_DEBUG + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerDoc.h b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerDoc.h new file mode 100644 index 000000000..90f550724 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerDoc.h @@ -0,0 +1,145 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once + +#include +#include "tigl.h" +#include "CTiglError.h" +#include "CCPACSConfiguration.h" +#include "CCPACSConfigurationManager.h" +#include "CTiglAlgorithmManager.h" +#include +#include + +class CTIGLViewerDoc : public OCC_3dBaseDoc +{ + +public: + // Called on opening of a document + virtual BOOL OnOpenDocument(LPCTSTR lpszPathName); + + // Destructor + virtual ~CTIGLViewerDoc(); + + // Called by the MFC framework before destroying or reusing a document. + virtual void DeleteContents(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + + // Popups wing profile selection dialog + afx_msg void OnShowWingProfiles(); + + // Popups wing selection dialog and draws a wing + afx_msg void OnShowWings(); + + // Popups wings selection dialog and draws a wing with its triangulation overlayed + afx_msg void OnShowWingTriangulation(); + + // Popups wings selection dialog and draws a wing by drawing some surface points + afx_msg void OnShowWingPoints(); + + // Popups wings selection dialog and draws the profile point from the CPACS file + afx_msg void OnDrawOverlayCPACSProfilePoints(); + + // Popups fuselage profile selection dialog + afx_msg void OnShowFuselageProfiles(); + + // Popups fuselage selection dialog and draws a fuselage + afx_msg void OnShowFuselages(); + + // Popups fuselage selection dialog and draws a fuselage with its triangulation overlayed + afx_msg void OnShowFuselageTriangulation(); + + // Popups fuselage selection dialog and draws a fuselage by drawing some surface points + afx_msg void OnShowFuselagePoints(); + + // Draws a fuselage intersection point at 45° degrees + afx_msg void OnShowFuselagePointsAngle(); + + // Draws a point where the distance between the selected fuselage and the ground is at minimum. + // The Fuselage could be turned with a given angle at at given axis, specified by a point and a direction. + afx_msg void OnDrawMinumumDistanceToGround(); + + // Draws whole CPACS configuration by drawing some surface points + afx_msg void OnShowAllPoints(); + + // Draws whole CPACS configuration + afx_msg void OnShowAll(); + + // Draws wing/fuselage intersection line + afx_msg void OnShowIntersectionLine(); + + // Export CPACS configuration as IGES/STL file + afx_msg void OnExportAsIges(); + afx_msg void OnExportAsFusedIges(); + afx_msg void OnExportMeshedWingSTL(); + afx_msg void OnExportMeshedFuselageSTL(); + afx_msg void OnExportMeshedWingVTKIndex(); + afx_msg void OnExportMeshedWingVTKSimple(); + afx_msg void OnExportMeshedFuselageVTKIndex(); + afx_msg void OnExportMeshedFuselageVTKSimple(); + + // Change wire building algorithm + afx_msg void OnInterpolateBsplineWire(); + afx_msg void OnInterpolateLinearWire(); + afx_msg void OnApproximateBsplineWire(); + afx_msg void OnUpdateInterpolateBsplineWire(CCmdUI *pCmdUI); + afx_msg void OnUpdateInterpolateLinearWire(CCmdUI *pCmdUI); + afx_msg void OnUpdateApproximateBsplineWire(CCmdUI *pCmdUI); + + // fuse operations + afx_msg void OnShowFusedFuselages(); + afx_msg void OnShowFusedWings(); + afx_msg void OnShowFusedAll(); + + // Returns the CPACS configuration + tigl::CCPACSConfiguration& GetConfiguration(void) const; + + // Draws a point + void DisplayPoint(gp_Pnt& aPoint, + char* aText, + Standard_Boolean UpdateViewer, + Standard_Real anXoffset, + Standard_Real anYoffset, + Standard_Real aZoffset, + Standard_Real TextScale); + + // Draw xyz axis + void DrawXYZAxis(void); + + //debug functon to count sub-shapes + void PrintContents (TopoDS_Shape geom); + +protected: + // Constructor + CTIGLViewerDoc(); + +private: + TiglCPACSConfigurationHandle m_cpacsHandle; + + DECLARE_DYNCREATE(CTIGLViewerDoc) + DECLARE_MESSAGE_MAP() + +}; + + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerView.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerView.cpp new file mode 100644 index 000000000..553a182d1 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerView.cpp @@ -0,0 +1,89 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdafx.h" +#include "TIGLViewer.h" +#include "TIGLViewerView.h" +#include ".\tiglviewerview.h" + + +BEGIN_MESSAGE_MAP(CTIGLViewerView, OCC_3dView) + ON_COMMAND(ID_FILE_PRINT, OCC_3dView::OnFilePrint) + ON_COMMAND(ID_FILE_PRINT_DIRECT, OCC_3dView::OnFilePrint) + ON_COMMAND(ID_FILE_PRINT_PREVIEW, OCC_3dView::OnFilePrintPreview) +END_MESSAGE_MAP() + +IMPLEMENT_DYNCREATE(CTIGLViewerView, OCC_3dView) + +CTIGLViewerView::CTIGLViewerView() + : OCC_3dView() +{ +} + +CTIGLViewerView::~CTIGLViewerView() +{ +} + +void CTIGLViewerView::OnDraw(CDC* pDC) +{ + OCC_3dView::OnDraw(pDC); +} + +BOOL CTIGLViewerView::OnPreparePrinting(CPrintInfo* pInfo) +{ + return DoPreparePrinting(pInfo); +} + +void CTIGLViewerView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo) +{ + OCC_3dView::OnBeginPrinting(pDC, pInfo); +} + +void CTIGLViewerView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo) +{ + OCC_3dView::OnEndPrinting(pDC, pInfo); +} + +void CTIGLViewerView::OnInitialUpdate() +{ + OCC_3dView::OnInitialUpdate(); + OCC_3dView::FitAll(); +} + +#ifdef _DEBUG +void CTIGLViewerView::AssertValid() const +{ + CView::AssertValid(); +} + +void CTIGLViewerView::Dump(CDumpContext& dc) const +{ + CView::Dump(dc); +} + +CTIGLViewerDoc* CTIGLViewerView::GetDocument() const // Nicht-Debugversion ist inline +{ + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTIGLViewerDoc))); + return (CTIGLViewerDoc*)m_pDocument; +} + +#endif //_DEBUG + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerView.h b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerView.h new file mode 100644 index 000000000..afab83b85 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/TIGLViewerView.h @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once + +#include "OCC_3dView.h" +#include "TIGLViewerDoc.h" + +class CTIGLViewerView : public OCC_3dView +{ + +public: + CTIGLViewerDoc* GetDocument() const; + virtual void OnDraw(CDC* pDC); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + + virtual void OnInitialUpdate(); + +protected: + CTIGLViewerView(); + virtual ~CTIGLViewerView(); + + virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); + virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); + virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); + + DECLARE_DYNCREATE(CTIGLViewerView) + DECLARE_MESSAGE_MAP() + +}; + +#ifndef _DEBUG // Debugversion in TIGLViewerView.cpp +inline CTIGLViewerDoc* CTIGLViewerView::GetDocument() const + { return reinterpret_cast(m_pDocument); } +#endif + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/WingDialog.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/WingDialog.cpp new file mode 100644 index 000000000..7293d06db --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/WingDialog.cpp @@ -0,0 +1,84 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdafx.h" +#include "TIGLViewer.h" +#include "WingDialog.h" +#include "CCPACSWing.h" +#include "TIGLViewerDoc.h" +#include "CCPACSConfiguration.h" + +IMPLEMENT_DYNAMIC(CWingDialog, CDialog) + +BEGIN_MESSAGE_MAP(CWingDialog, CDialog) +END_MESSAGE_MAP() + +CWingDialog::CWingDialog(CTIGLViewerDoc& document) + : CDialog(CWingDialog::IDD, 0) + , m_document(document) +{ +} + +CWingDialog::~CWingDialog() +{ +} + +void CWingDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_WING_LIST, m_wingList); +} + +int CWingDialog::GetWingIndex(void) const +{ + return index; +} + +std::string CWingDialog::GetWingName(void) const +{ + return wingName; +} +void CWingDialog::OnOK() +{ + CString strTemp; + UpdateData(TRUE); + index = m_wingList.GetCurSel(); + m_wingList.GetText(index, strTemp); + wingName = (char*)(LPCSTR)strTemp; + CDialog::OnOK(); +} + +BOOL CWingDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Initialize wing list + tigl::CCPACSConfiguration& config = m_document.GetConfiguration(); + int wingCount = config.GetWingCount(); + for (int i = 1; i <= wingCount; i++) + { + tigl::CCPACSWing& wing = config.GetWing(i); + std::string name = wing.GetName(); + if (name == "") name = "Unknown wing"; + m_wingList.InsertString(i - 1, _T(name.c_str())); + } + return TRUE; // return TRUE unless you set the focus to a control +} diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/WingDialog.h b/TAG_MFC-TIGLViewer/TIGLViewer/WingDialog.h new file mode 100644 index 000000000..884a5ef59 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/WingDialog.h @@ -0,0 +1,53 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once + +#include "afxwin.h" + +class CTIGLViewerDoc; +namespace tigl { class CCPACSConfiguration; } + +// CWingDialog-Dialogfeld +class CWingDialog : public CDialog +{ +public: + + CWingDialog(CTIGLViewerDoc& document); + virtual ~CWingDialog(); + virtual BOOL OnInitDialog(); + int GetWingIndex(void) const; + std::string GetWingName(void) const; + + enum { IDD = IDD_WING_DIALOG }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung + virtual void OnOK(); + +private: + CTIGLViewerDoc& m_document; + CListBox m_wingList; + int index; + std::string wingName; + + DECLARE_DYNAMIC(CWingDialog) + DECLARE_MESSAGE_MAP() +}; diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/WingProfileDialog.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/WingProfileDialog.cpp new file mode 100644 index 000000000..cb8e2cb2f --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/WingProfileDialog.cpp @@ -0,0 +1,80 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdafx.h" +#include "TIGLViewer.h" +#include "WingProfileDialog.h" +#include "TIGLViewerDoc.h" +#include "CCPACSConfiguration.h" +#include "CCPACSWingProfile.h" + + +IMPLEMENT_DYNAMIC(CWingProfileDialog, CDialog) + +BEGIN_MESSAGE_MAP(CWingProfileDialog, CDialog) +END_MESSAGE_MAP() + +CWingProfileDialog::CWingProfileDialog(CTIGLViewerDoc& document) + : CDialog(CWingProfileDialog::IDD, 0) + , m_document(document) +{ +} + +CWingProfileDialog::~CWingProfileDialog() +{ +} + +int CWingProfileDialog::GetProfileIndex(void) const +{ + return m_profileIndex; +} + +void CWingProfileDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_WING_PROFILE_LIST, m_profileList); +} + +BOOL CWingProfileDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Initialize wing profile list + tigl::CCPACSConfiguration& config = m_document.GetConfiguration(); + int profileCount = config.GetWingProfileCount(); + for (int i = 1; i <= profileCount; i++) + { + tigl::CCPACSWingProfile& profile = config.GetWingProfile(i); + std::string filename = profile.GetUID(); + std::string name = profile.GetName(); + if (name == "") name = "---"; + std::string entry = filename + " (" + name + ")"; + m_profileList.InsertString(i - 1, _T(entry.c_str())); + } + return TRUE; // return TRUE unless you set the focus to a control +} + +void CWingProfileDialog::OnOK() +{ + UpdateData(TRUE); + m_profileIndex = m_profileList.GetCurSel(); + CDialog::OnOK(); +} diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/WingProfileDialog.h b/TAG_MFC-TIGLViewer/TIGLViewer/WingProfileDialog.h new file mode 100644 index 000000000..384a23a0b --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/WingProfileDialog.h @@ -0,0 +1,50 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once +#include "afxwin.h" + +class CTIGLViewerDoc; +namespace tigl { class CCPACSConfiguration; } + +class CWingProfileDialog : public CDialog +{ +public: + CWingProfileDialog(CTIGLViewerDoc& document); + virtual ~CWingProfileDialog(); + virtual BOOL OnInitDialog(); + int GetProfileIndex(void) const; + + // Dialogfelddaten + enum { IDD = IDD_WING_PROFILE_DIALOG }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung + virtual void OnOK(); + +private: + CTIGLViewerDoc& m_document; + CListBox m_profileList; + int m_profileIndex; + + DECLARE_DYNAMIC(CWingProfileDialog) + DECLARE_MESSAGE_MAP() + +}; diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/WingUIDDialog.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/WingUIDDialog.cpp new file mode 100644 index 000000000..b39e41be3 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/WingUIDDialog.cpp @@ -0,0 +1,84 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "stdafx.h" +#include "TIGLViewer.h" +#include "WingUIDDialog.h" +#include "CCPACSWing.h" +#include "TIGLViewerDoc.h" +#include "CCPACSConfiguration.h" + +IMPLEMENT_DYNAMIC(CWingUIDDialog, CDialog) + +BEGIN_MESSAGE_MAP(CWingUIDDialog, CDialog) +END_MESSAGE_MAP() + +CWingUIDDialog::CWingUIDDialog(CTIGLViewerDoc& document) + : CDialog(CWingUIDDialog::IDD, 0) + , m_document(document) +{ +} + +CWingUIDDialog::~CWingUIDDialog() +{ +} + +void CWingUIDDialog::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_WING_LIST, m_wingList); +} + +int CWingUIDDialog::GetWingIndex(void) const +{ + return index; +} + +std::string CWingUIDDialog::GetWingUID(void) const +{ + return wingUID; +} +void CWingUIDDialog::OnOK() +{ + CString strTemp; + UpdateData(TRUE); + index = m_wingList.GetCurSel(); + m_wingList.GetText(index, strTemp); + wingUID = (char*)(LPCSTR)strTemp; + CDialog::OnOK(); +} + +BOOL CWingUIDDialog::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Initialize wing list + tigl::CCPACSConfiguration& config = m_document.GetConfiguration(); + int wingCount = config.GetWingCount(); + for (int i = 1; i <= wingCount; i++) + { + tigl::CCPACSWing& wing = config.GetWing(i); + std::string name = wing.GetUID(); + if (name == "") name = "Unknown wing"; + m_wingList.InsertString(i - 1, _T(name.c_str())); + } + return TRUE; // return TRUE unless you set the focus to a control +} diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/WingUIDDialog.h b/TAG_MFC-TIGLViewer/TIGLViewer/WingUIDDialog.h new file mode 100644 index 000000000..b9be16d37 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/WingUIDDialog.h @@ -0,0 +1,53 @@ +/* +* Copyright (C) 2007-2011 German Aerospace Center (DLR/SC) +* +* Created: 2010-08-13 Markus Litz +* Changed: $Id$ +* +* Version: $Revision$ +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +#pragma once + +#include "afxwin.h" + +class CTIGLViewerDoc; +namespace tigl { class CCPACSConfiguration; } + +// CWingDialog-Dialogfeld +class CWingUIDDialog : public CDialog +{ +public: + + CWingUIDDialog(CTIGLViewerDoc& document); + virtual ~CWingUIDDialog(); + virtual BOOL OnInitDialog(); + int GetWingIndex(void) const; + std::string GetWingUID(void) const; + + enum { IDD = IDD_WING_DIALOG }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung + virtual void OnOK(); + +private: + CTIGLViewerDoc& m_document; + CListBox m_wingList; + int index; + std::string wingUID; + + DECLARE_DYNAMIC(CWingUIDDialog) + DECLARE_MESSAGE_MAP() +}; diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewer.ico b/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewer.ico new file mode 100644 index 000000000..b311cdfc6 Binary files /dev/null and b/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewer.ico differ diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewer.manifest b/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewer.manifest new file mode 100644 index 000000000..fab50aa34 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewer.manifest @@ -0,0 +1,22 @@ + + + +TIGLViewer is a MFC viewer that uses TIGL and visulize CPACS geometries. + + + + + + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewer.rc2 b/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewer.rc2 new file mode 100644 index 000000000..181830b7a --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewer.rc2 @@ -0,0 +1,13 @@ +// +// TIGLViewer.RC2 - Ressourcen, die Microsoft Visual C++ nicht direkt bearbeitet +// + +#ifdef APSTUDIO_INVOKED +#error Diese Datei kann nicht in Microsoft Visual C++ bearbeitet werden. +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Fügen Sie hier manuell bearbeitete Ressourcen hinzu... + +///////////////////////////////////////////////////////////////////////////// diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewerDoc.ico b/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewerDoc.ico new file mode 100644 index 000000000..2a1f1ae6e Binary files /dev/null and b/TAG_MFC-TIGLViewer/TIGLViewer/res/TIGLViewerDoc.ico differ diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/res/Toolbar.bmp b/TAG_MFC-TIGLViewer/TIGLViewer/res/Toolbar.bmp new file mode 100644 index 000000000..f26da41bf Binary files /dev/null and b/TAG_MFC-TIGLViewer/TIGLViewer/res/Toolbar.bmp differ diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/res/cpacs.ico b/TAG_MFC-TIGLViewer/TIGLViewer/res/cpacs.ico new file mode 100644 index 000000000..97f7b93a9 Binary files /dev/null and b/TAG_MFC-TIGLViewer/TIGLViewer/res/cpacs.ico differ diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/res/toolbar_tigl_childframe.bmp b/TAG_MFC-TIGLViewer/TIGLViewer/res/toolbar_tigl_childframe.bmp new file mode 100644 index 000000000..f65b6bdb1 Binary files /dev/null and b/TAG_MFC-TIGLViewer/TIGLViewer/res/toolbar_tigl_childframe.bmp differ diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/resource.h b/TAG_MFC-TIGLViewer/TIGLViewer/resource.h new file mode 100644 index 000000000..368ae0947 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/resource.h @@ -0,0 +1,67 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by TIGLViewer.rc +// +#define IDP_OLE_INIT_FAILED 100 +#define IDR_MAINFRAME 128 +#define IDD_ABOUTBOX 600 +#define IDR_TIGLCHILDFRAME 629 +#define IDD_WING_PROFILE_DIALOG 631 +#define IDD_WING_DIALOG 632 +#define IDD_FUSELAGE_PROFILE_DIALOG 633 +#define IDD_FUSELAGE_DIALOG 634 +#define IDD_CONFIGURATION_DIALOG 635 +#define IDC_WING_PROFILE_LIST 2000 +#define IDC_WING_LIST 2001 +#define IDC_FUSELAGE_GROUP_TEXT 2004 +#define IDC_FUSELAGE_PROFILE_LIST 2005 +#define IDC_WING_GROUP_TEXT 2006 +#define IDC_FUSELAGE_LIST 2007 +#define IDC_CONFIGURATION_LIST 2008 +#define ID_SHOW_ALL 50771 +#define ID_INTERPOLATE_BSPLINE_WIRE 50787 +#define ID_INTERPOLATE_LINEAR_WIRE 50788 +#define ID_APPROXIMATE_BSPLINE_WIRE 50789 +#define ID_SHOW_WINGS 50791 +#define ID_SHOW_WING_POINTS 50794 +#define ID_SHOW_WING_MESHES 50797 +#define ID_SHOW_WING_TRIANGULATION 50798 +#define ID_SHOW_ALL_POINTS 50801 +#define ID_DATEI_EXPORTASIGES 50803 +#define ID_EXPORT_AS_IGES 50804 +#define ID_SHOW_WING_PROFILES 50806 +#define ID_SHOW_FUSELAGE_PROFILES 50808 +#define ID_SHOW_FUSELAGES 50810 +#define ID_SHOW_FUSELAGE_TRIANGULATION 50812 +#define ID_SHOW_FUSELAGE_POINTS 50814 +#define ID_CPACS_DRAWFUSEDWINGS 50822 +#define ID_CPACS_DRAWFUSEDFUSELAGES 50823 +#define ID_CPACS_SHOWINTERSECTIONLINE 50825 +#define ID_EXPORT_FUSED_IGES 50829 +#define ID_CPACS_DRAWFUSEDALL 50832 +#define ID_EXPORT_MESHED_WING_STL 50835 +#define ID_EXPORT_MESHED_VTK 50837 +#define ID_EXPORTASSTL_WINGBYINDEX 50843 +#define ID_EXPORTASSTL_WINGBYUID 50844 +#define ID_EXPORTASSTL_FUSELAGEBYINDEX 50845 +#define ID_EXPORTASSTL_FUSELAGEBYUID 50846 +#define ID_EXPORTASSTL_COMPLETEGEOMETRY 50847 +#define ID_EXPORTASVTK_WINGBYINDEX 50848 +#define ID_EXPORTASVTK_FUSELAGEBYINDEX 50849 +#define ID_EXPORTASVTK_FUSELAGEBYUID 50850 +#define ID_EXPORTASVTK_COMPLETEGEOMETRY 50852 +#define ID_SHOW_FUSELAGE_POINTS_ANGLE 50854 +#define ID_CPACS_DRAWOVERLAYCPACSPROFILEPOINTS 50855 +#define ID_EXPORTASVTK_WINGBYUID 50856 +#define ID_CPACS_DRAW_MINIMUM_DISTANCE_GROUND 50858 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 636 +#define _APS_NEXT_COMMAND_VALUE 50859 +#define _APS_NEXT_CONTROL_VALUE 2008 +#define _APS_NEXT_SYMED_VALUE 206 +#endif +#endif diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/stdafx.cpp b/TAG_MFC-TIGLViewer/TIGLViewer/stdafx.cpp new file mode 100644 index 000000000..f23f1ddb0 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/stdafx.cpp @@ -0,0 +1,7 @@ +// stdafx.cpp : Quelltextdatei, die nur die Standard-Includes einbindet +// TIGLViewer.pch ist der vorcompilierte Header +// stdafx.obj enthält die vorcompilierte Typinformation + +#include "stdafx.h" + + diff --git a/TAG_MFC-TIGLViewer/TIGLViewer/stdafx.h b/TAG_MFC-TIGLViewer/TIGLViewer/stdafx.h new file mode 100644 index 000000000..ad4296a62 --- /dev/null +++ b/TAG_MFC-TIGLViewer/TIGLViewer/stdafx.h @@ -0,0 +1,92 @@ +// stdafx.h : Includedatei für Standardsystem-Includedateien, +// oder häufig verwendete, projektspezifische Includedateien, +// die nur in unregelmäßigen Abständen geändert werden. + +#pragma once + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Selten verwendete Teile der Windows-Header nicht einbinden +#endif + +// Ändern Sie folgende Definitionen für Plattformen, die älter als die unten angegebenen sind. +// Unter MSDN finden Sie die neuesten Informationen über die entsprechenden Werte für die unterschiedlichen Plattformen. +#ifndef WINVER // Lassen Sie die Verwendung von Features spezifisch für Windows 95 und Windows NT 4 oder später zu. +#define WINVER 0x0400 // Ändern Sie den entsprechenden Wert, um auf Windows 98 und mindestens Windows 2000 abzuzielen. +#endif + +#ifndef _WIN32_WINNT // Lassen Sie die Verwendung von Features spezifisch für Windows NT 4 oder später zu. +#define _WIN32_WINNT 0x0400 // Ändern Sie den entsprechenden Wert, um auf Windows 98 und mindestens Windows 2000 abzuzielen. +#endif + +#ifndef _WIN32_WINDOWS // Lassen Sie die Verwendung von Features spezifisch für Windows 98 oder später zu. +#define _WIN32_WINDOWS 0x0410 // Ändern Sie den entsprechenden Wert, um auf mindestens Windows Me abzuzielen. +#endif + +#ifndef _WIN32_IE // Lassen Sie die Verwendung von Features spezifisch für IE 4.0 oder später zu. +#define _WIN32_IE 0x0400 // Ändern Sie den entsprechenden Wert, um auf mindestens IE 5.0 abzuzielen. +#endif + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // einige CString-Konstruktoren sind explizit + +// Deaktiviert das Ausblenden von einigen häufigen und oft ignorierten Warnungen +#define _AFX_ALL_WARNINGS + +#include // MFC-Kern- und -Standardkomponenten +#include // MFC-Erweiterungen +#include // MFC-Automatisierungsklassen + +#include // MFC-Unterstützung für allgemeine Steuerelemente von Internet Explorer 4 +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC-Unterstützung für allgemeine Windows-Steuerelemente +#endif // _AFX_NO_AFXCMN_SUPPORT + +#if !defined(WNT) + #error WNT precompiler directive is mandatory for CasCade +#endif + +#pragma warning( disable : 4244 ) // Issue warning 4244 +#include "Standard_ShortReal.hxx" +#pragma warning( default : 4244 ) // Issue warning 4244 + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + diff --git a/TAG_MFC-TIGLViewer/build_VC_7_1.bat b/TAG_MFC-TIGLViewer/build_VC_7_1.bat new file mode 100644 index 000000000..6a5ea0718 --- /dev/null +++ b/TAG_MFC-TIGLViewer/build_VC_7_1.bat @@ -0,0 +1 @@ +devenv TIGLViewer\TIGLViewer.vcproj /project TIGLViewer /build %1 \ No newline at end of file diff --git a/TAG_MFC-TIGLViewer/mfcsample/StdAfx.cpp b/TAG_MFC-TIGLViewer/mfcsample/StdAfx.cpp new file mode 100644 index 000000000..02fe1200f --- /dev/null +++ b/TAG_MFC-TIGLViewer/mfcsample/StdAfx.cpp @@ -0,0 +1,2 @@ +#include "..\Common\stdafx.h" + diff --git a/TAG_MFC-TIGLViewer/mfcsample/mfcsample - VS2003.vcproj b/TAG_MFC-TIGLViewer/mfcsample/mfcsample - VS2003.vcproj new file mode 100644 index 000000000..51f0f430d --- /dev/null +++ b/TAG_MFC-TIGLViewer/mfcsample/mfcsample - VS2003.vcproj @@ -0,0 +1,939 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TAG_MFC-TIGLViewer/mfcsample/mfcsample.cpp b/TAG_MFC-TIGLViewer/mfcsample/mfcsample.cpp new file mode 100644 index 000000000..d88a18eb4 --- /dev/null +++ b/TAG_MFC-TIGLViewer/mfcsample/mfcsample.cpp @@ -0,0 +1,51 @@ +// mfcsample.cpp : Defines the initialization routines for the DLL. +// + +#include "stdafx.h" +#include + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + +static AFX_EXTENSION_MODULE mfcsampleDLL = { NULL, NULL }; + +extern "C" int APIENTRY +DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) +{ + // Remove this if you use lpReserved + UNREFERENCED_PARAMETER(lpReserved); + + if (dwReason == DLL_PROCESS_ATTACH) + { + TRACE0("MFCSAMPLEDLL.DLL Initializing!\n"); + + // Extension DLL one-time initialization + if (!AfxInitExtensionModule(mfcsampleDLL, hInstance)) + return 0; + + // Insert this DLL into the resource chain + // NOTE: If this Extension DLL is being implicitly linked to by + // an MFC Regular DLL (such as an ActiveX Control) + // instead of an MFC application, then you will want to + // remove this line from DllMain and put it in a separate + // function exported from this Extension DLL. The Regular DLL + // that uses this Extension DLL should then explicitly call that + // function to initialize this Extension DLL. Otherwise, + // the CDynLinkLibrary object will not be attached to the + // Regular DLL's resource chain, and serious problems will + // result. + + new CDynLinkLibrary(mfcsampleDLL); + } + else if (dwReason == DLL_PROCESS_DETACH) + { + TRACE0("MFCSAMPLEDLL.DLL Terminating!\n"); + // Terminate the library before destructors are called + AfxTermExtensionModule(mfcsampleDLL); + } + return 1; // ok +} \ No newline at end of file diff --git a/TAG_MFC-TIGLViewer/mfcsample/mfcsample.vcproj b/TAG_MFC-TIGLViewer/mfcsample/mfcsample.vcproj new file mode 100644 index 000000000..51f0f430d --- /dev/null +++ b/TAG_MFC-TIGLViewer/mfcsample/mfcsample.vcproj @@ -0,0 +1,939 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +