1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,61 @@
// BoxRadius.cpp : implementation file
//
#include "stdafx.h"
#include "Viewer3dApp.h"
#include "BoxRadius.h"
/////////////////////////////////////////////////////////////////////////////
BoxRadius::BoxRadius(CWnd* pParent,
double rad)
: CDialog(BoxRadius::IDD, pParent)
{
//{{AFX_DATA_INIT(BoxRadius)
m_radius = rad;
//}}AFX_DATA_INIT
}
void BoxRadius::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(BoxRadius)
DDX_Control(pDX, IDC_SPIN_RADIUS, m_spinradius);
DDX_Text(pDX, IDC_EDIT_RADIUS, m_radius);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(BoxRadius, CDialog)
//{{AFX_MSG_MAP(BoxRadius)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_RADIUS, OnDeltaposSpinRadius)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// BoxRadius message handlers
BOOL BoxRadius::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_spinradius.SetRange(-10000,10000);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void BoxRadius::OnDeltaposSpinRadius(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
if (pNMUpDown->iDelta == 1)
pNMUpDown->iDelta = 1;
else
pNMUpDown->iDelta = -1;
m_radius = m_radius + pNMUpDown->iDelta;
UpdateData(FALSE);
*pResult = 0;
}

View File

@@ -0,0 +1,49 @@
// BoxRadius.h : header file
//
#if !defined(AFX_BOXRADIUS_H__AD263FF3_54F3_11D1_8C40_00AA00D10994__INCLUDED_)
#define AFX_BOXRADIUS_H__AD263FF3_54F3_11D1_8C40_00AA00D10994__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
/////////////////////////////////////////////////////////////////////////////
// BoxRadius dialog
class BoxRadius : public CDialog
{
// Construction
public:
BoxRadius(CWnd* pParent,double rad); // standard constructor
// Dialog Data
//{{AFX_DATA(BoxRadius)
enum { IDD = IDD_RADIUS };
CSpinButtonCtrl m_spinradius;
double m_radius;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(BoxRadius)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(BoxRadius)
afx_msg void OnDeltaposSpinRadius(NMHDR* pNMHDR, LRESULT* pResult);
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_BOXRADIUS_H__AD263FF3_54F3_11D1_8C40_00AA00D10994__INCLUDED_)

View File

@@ -0,0 +1,27 @@
#include <stdafx.h>
gp_Pnt ConvertClickToPoint(Standard_Real x, Standard_Real y, Handle(V3d_View) aView)
{
V3d_Coordinate XEye,YEye,ZEye,XAt,YAt,ZAt;
aView->Eye(XEye,YEye,ZEye);
aView->At(XAt,YAt,ZAt);
gp_Pnt EyePoint(XEye,YEye,ZEye);
gp_Pnt AtPoint(XAt,YAt,ZAt);
gp_Vec EyeVector(EyePoint,AtPoint);
gp_Dir EyeDir(EyeVector);
gp_Pln PlaneOfTheView = gp_Pln(AtPoint,EyeDir);
Standard_Real X,Y,Z;
aView->Convert((int)x,(int)y,X,Y,Z);
gp_Pnt ConvertedPoint(X,Y,Z);
gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView,ConvertedPoint);
gp_Pnt ResultPoint = ElSLib::Value(ConvertedPointOnPlane.X(),
ConvertedPointOnPlane.Y(),
PlaneOfTheView);
return ResultPoint;
}

View File

@@ -0,0 +1,332 @@
// DlgAttributes.cpp : implementation file
//
#include "stdafx.h"
#include "DlgAttributes.h"
#include "AISDisplayModeApp.h"
#include <AISDialogs.h>
#include <OCC_3dView.h>
#include <Graphic3d_MaterialAspect.hxx>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// DlgAttributes dialog
DlgAttributes::DlgAttributes(CWnd* pParent)
: CDialog(DlgAttributes::IDD, pParent)
{
//{{AFX_DATA_INIT(DlgAttributes)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void DlgAttributes::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DlgAttributes)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DlgAttributes, CDialog)
//{{AFX_MSG_MAP(DlgAttributes)
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)
ON_BN_CLICKED(ID_OBJECT_COLOR, OnColor)
ON_BN_CLICKED(ID_OBJECT_SHADING, OnShading)
ON_BN_CLICKED(ID_OBJECT_WIREFRAME, OnWireframe)
ON_COMMAND(ID_OBJECT_TRANSPARENCY, OnTransparency)
ON_UPDATE_COMMAND_UI(ID_OBJECT_TRANSPARENCY, OnUpdateObjectTransparency)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DlgAttributes message handlers
void DlgAttributes::OnColor()
{
Handle_AIS_InteractiveObject Current ;
Quantity_Color CSFColor ;
COLORREF MSColor ;
myAISContext->InitCurrent();
if (myAISContext->MoreCurrent()) {
Current = myAISContext->Current() ;
if ( Current->HasColor () ) {
CSFColor = Current->Color () ;
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->InitCurrent();
myAISContext->MoreCurrent ();
myAISContext->NextCurrent ())
myAISContext->SetColor (myAISContext->Current(),
CSFColor.Name());
}
}
TCollection_AsciiString Message ("\
\n\
for (myAISContext->InitCurrent(); myAISContext->MoreCurrent (); \n\
myAISContext->NextCurrent ()) \n\
myAISContext->SetColor (myAISContext->Current(), CSFColor.Name()); \n\
\n");
CString text(Message.ToCString());
(*myCResultDialog).SetTitle(CString("Setting Color"));
(*myCResultDialog).SetText(text);
}
void DlgAttributes::OnWireframe()
{
for(myAISContext->InitCurrent(); myAISContext->MoreCurrent();
myAISContext->NextCurrent())
myAISContext->SetDisplayMode(myAISContext->Current(), 0);
TCollection_AsciiString Message ("\
\n\
for (myAISContext->InitCurrent(); myAISContext->MoreCurrent (); \n\
myAISContext->NextCurrent ()) \n\
myAISContext->SetDisplayMode(myAISContext->Current(), 0); \n\
\n");
CString text(Message.ToCString());
(*myCResultDialog).SetTitle(CString("Wireframe"));
(*myCResultDialog).SetText(text);
}
void DlgAttributes::Set(Handle ( AIS_InteractiveContext ) & acontext, CResultDialog& aResultDialog)
{
myAISContext = acontext;
myCResultDialog=&aResultDialog;
}
void DlgAttributes::OnTransparency()
{
/*
for (myAISContext->InitCurrent(); myAISContext->MoreCurrent ();
myAISContext->NextCurrent ()) {
int ival = (int) ((double) myAISContext->Current()->Transparency()*10.) ;
double rval = ((double) ival)/10.;
CDialogTransparency Dlg(NULL, rval);
if(Dlg.DoModal()== IDOK)
myAISContext->SetTransparency (myAISContext->Current(),Dlg.m_transvalue);
}
*/
/*
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();
*/
myAISContext->InitCurrent();
if(myAISContext->NbCurrents() > 0){
CDialogTransparency DialBox(myAISContext, AfxGetMainWnd());
DialBox.DoModal();
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
OCC_3dView *pView = (OCC_3dView *) pChild->GetActiveView();
pView->Redraw();
}
TCollection_AsciiString Message ("\
\n\
for (myAISContext->InitCurrent(); myAISContext->MoreCurrent (); \n\
myAISContext->NextCurrent ()) \n\
myAISContext->SetTransparency (myAISContext->Current(),Dlg.m_transvalue); \n\
\n");
CString text(Message.ToCString());
(*myCResultDialog).SetTitle(CString("Setting Transparency"));
(*myCResultDialog).SetText(text);
}
void DlgAttributes::OnObjectMaterialAluminium () { SetMaterial ( Graphic3d_NOM_ALUMINIUM ) ; }
void DlgAttributes::OnObjectMaterialBrass () { SetMaterial ( Graphic3d_NOM_BRASS ) ; }
void DlgAttributes::OnObjectMaterialBronze () { SetMaterial ( Graphic3d_NOM_BRONZE ) ; }
void DlgAttributes::OnObjectMaterialChrome () { SetMaterial ( Graphic3d_NOM_CHROME ) ; }
void DlgAttributes::OnObjectMaterialCopper () { SetMaterial ( Graphic3d_NOM_COPPER ) ; }
void DlgAttributes::OnObjectMaterialGold () { SetMaterial ( Graphic3d_NOM_GOLD ) ; }
void DlgAttributes::OnObjectMaterialJade () { SetMaterial ( Graphic3d_NOM_JADE ) ; }
void DlgAttributes::OnObjectMaterialMetalized () { SetMaterial ( Graphic3d_NOM_METALIZED ) ; }
void DlgAttributes::OnObjectMaterialNeonGNC () { SetMaterial ( Graphic3d_NOM_NEON_GNC ) ; }
void DlgAttributes::OnObjectMaterialNeonPHC () { SetMaterial ( Graphic3d_NOM_NEON_PHC ) ; }
void DlgAttributes::OnObjectMaterialObsidian () { SetMaterial ( Graphic3d_NOM_OBSIDIAN ) ; }
void DlgAttributes::OnObjectMaterialPewter () { SetMaterial ( Graphic3d_NOM_PEWTER ) ; }
void DlgAttributes::OnObjectMaterialPlaster () { SetMaterial ( Graphic3d_NOM_PLASTER ) ; }
void DlgAttributes::OnObjectMaterialPlastic () { SetMaterial ( Graphic3d_NOM_PLASTIC ) ; }
void DlgAttributes::OnObjectMaterialSatin () { SetMaterial ( Graphic3d_NOM_SATIN ) ; }
void DlgAttributes::OnObjectMaterialShinyPlastic () { SetMaterial ( Graphic3d_NOM_SHINY_PLASTIC ) ; }
void DlgAttributes::OnObjectMaterialSilver () { SetMaterial ( Graphic3d_NOM_SILVER ) ; }
void DlgAttributes::OnObjectMaterialSteel () { SetMaterial ( Graphic3d_NOM_STEEL ) ; }
void DlgAttributes::OnObjectMaterialStone () { SetMaterial ( Graphic3d_NOM_STONE ) ; }
void DlgAttributes::OnObjectMaterialDefault () { SetMaterial ( Graphic3d_NOM_DEFAULT ) ; }
void DlgAttributes::SetMaterial(Graphic3d_NameOfMaterial Material)
{
for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ())
myAISContext->SetMaterial (myAISContext->Current(),
(Graphic3d_NameOfMaterial)(Material));
TCollection_AsciiString aString;
TCollection_AsciiString Message1 ("\
\n\
for (myAISContext->InitCurrent(); myAISContext->MoreCurrent (); \n\
myAISContext->NextCurrent ()) \n\
myAISContext->SetMaterial (myAISContext->Current(), ");
TCollection_AsciiString Message2("); \n\
\n");
switch (Material){
case 0:
aString = "Graphic3d_NOM_BRASS";
break;
case 1:
aString = "Graphic3d_NOM_BRONZE";
break;
case 2:
aString = "Graphic3d_NOM_COPPER";
break;
case 3:
aString = "Graphic3d_NOM_GOLD";
break;
case 4:
aString = "Graphic3d_NOM_PEWTER";
break;
case 5:
aString = "Graphic3d_NOM_PLASTER";
break;
case 6:
aString = "Graphic3d_NOM_PLASTIC";
break;
case 7:
aString = "Graphic3d_NOM_SILVER";
break;
case 8:
aString = "Graphic3d_NOM_STEEL";
break;
case 9:
aString = "Graphic3d_NOM_STONE";
break;
case 10:
aString = "Graphic3d_NOM_SHINY_PLASTIC";
break;
case 11:
aString = "Graphic3d_NOM_SATIN";
break;
case 12:
aString = "Graphic3d_NOM_METALIZED";
break;
case 13:
aString = "Graphic3d_NOM_NEON_GNC";
break;
case 14:
aString = "Graphic3d_NOM_CHROME";
break;
case 15:
aString = "Graphic3d_NOM_ALUMINIUM";
break;
case 16:
aString = "Graphic3d_NOM_OBSIDIAN";
break;
case 17:
aString = "Graphic3d_NOM_NEON_PHC";
break;
case 18:
aString = "Graphic3d_NOM_JADE";
break;
case 19:
aString = "Graphic3d_NOM_DEFAULT";
break;
default:
break;
}
Message1 = Message1 +aString +Message2;
//Graphic3d_MaterialAspect aAspect (Material);
//Standard_CString aString = aAspect.MaterialName();
CString text(Message1.ToCString());
(*myCResultDialog).SetTitle(CString("Setting Material"));
(*myCResultDialog).SetText(text);
}
void DlgAttributes::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 DlgAttributes::OnShading()
{
for(myAISContext->InitCurrent(); myAISContext->MoreCurrent();
myAISContext->NextCurrent())
myAISContext->SetDisplayMode(myAISContext->Current(), 1);
TCollection_AsciiString Message ("\
\n\
for (myAISContext->InitCurrent(); myAISContext->MoreCurrent (); \n\
myAISContext->NextCurrent ()) \n\
myAISContext->SetDisplayMode(myAISContext->Current(), 1); \n\
\n");
CString text(Message.ToCString());
(*myCResultDialog).SetTitle(CString("Shading"));
(*myCResultDialog).SetText(text);
}

View File

@@ -0,0 +1,83 @@
// DlgAttributes.h : header file
//
#if !defined(AFX_DLGATTRIBUTES_H__AF548353_9EF6_11D1_A47D_00C095ECDA78__INCLUDED_)
#define AFX_DLGATTRIBUTES_H__AF548353_9EF6_11D1_A47D_00C095ECDA78__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <AIS_InteractiveContext.hxx>
#include <ResultDialog.h>
/////////////////////////////////////////////////////////////////////////////
// DlgAttributes dialog
class DlgAttributes : public CDialog
{
// Construction
public:
void Set(Handle(AIS_InteractiveContext)& acontext, CResultDialog& aResultDialog);
DlgAttributes(CWnd* pParent=NULL);
// Dialog Data
//{{AFX_DATA(DlgAttributes)
enum { IDD = IDD_ATTRIBUTES };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(DlgAttributes)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(DlgAttributes)
afx_msg void OnColor();
afx_msg void OnWireframe();
afx_msg void OnTransparency() ;
afx_msg void OnShading();
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 void OnUpdateObjectTransparency(CCmdUI* pCmdUI) ;
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
void SetMaterial (Graphic3d_NameOfMaterial Material);
private:
Handle_AIS_InteractiveContext myAISContext;
CResultDialog* myCResultDialog;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGATTRIBUTES_H__AF548353_9EF6_11D1_A47D_00C095ECDA78__INCLUDED_)

View File

@@ -0,0 +1,49 @@
// DlgIsos.cpp : implementation file
//
#include "stdafx.h"
#include "DlgIsos.h"
#include "Viewer3dApp.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// DlgIsos dialog
DlgIsos::DlgIsos(CWnd* pParent,
int nisou,
int nisov)
: CDialog(DlgIsos::IDD, pParent)
{
//{{AFX_DATA_INIT(DlgIsos)
m_isou = nisou;
m_isov = nisov;
//}}AFX_DATA_INIT
}
void DlgIsos::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DlgIsos)
DDX_Text(pDX, IDC_EDIT_ISOU, m_isou);
DDX_Text(pDX, IDC_EDIT_ISOV, m_isov);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DlgIsos, CDialog)
//{{AFX_MSG_MAP(DlgIsos)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DlgIsos message handlers

View File

@@ -0,0 +1,52 @@
// DlgIsos.h : header file
//
#include "stdafx.h"
#if !defined(AFX_DLGISOS_H__AD159C33_9EDC_11D1_A47D_00C095ECDA78__INCLUDED_)
#define AFX_DLGISOS_H__AD159C33_9EDC_11D1_A47D_00C095ECDA78__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
/////////////////////////////////////////////////////////////////////////////
// DlgIsos dialog
class DlgIsos : public CDialog
{
// Construction
public:
DlgIsos(CWnd* pParent,
int nisou,
int nisov); // standard constructor
// Dialog Data
//{{AFX_DATA(DlgIsos)
enum { IDD = IDD_ISOS };
int m_isou;
int m_isov;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(DlgIsos)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(DlgIsos)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGISOS_H__AD159C33_9EDC_11D1_A47D_00C095ECDA78__INCLUDED_)

View File

@@ -0,0 +1,59 @@
// ISession_Curve.cpp: implementation of the ISession_Curve class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ISession_Curve.h"
#include <Prs3d_LineAspect.hxx>
#include <StdPrs_Curve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <AIS_Drawer.hxx>
#include <Prs3d_ArrowAspect.hxx>
IMPLEMENT_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTIEXT(ISession_Curve,AIS_InteractiveObject)
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ISession_Curve::ISession_Curve(const Handle(Geom_Curve)& aCurve)
:AIS_InteractiveObject(),myCurve(aCurve)
{
}
ISession_Curve::~ISession_Curve()
{
}
void ISession_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer /*aMode*/)
{
GeomAdaptor_Curve anAdaptorCurve(myCurve);
if (hasOwnColor)
myDrawer->LineAspect()->SetColor(myOwnColor);
myDrawer->Link()->SetDiscretisation(100);
myDrawer->Link()->SetMaximalParameterValue(500);
StdPrs_Curve::Add (aPresentation, anAdaptorCurve, myDrawer);
}
void ISession_Curve::Compute(const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation)
{
}
void ISession_Curve::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode)
{
}

View File

@@ -0,0 +1,33 @@
// ISession_Curve.h: interface for the ISession_Curve class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ISESSION_CURVE_H__F981CB93_A3CC_11D1_8DA3_0800369C8A03__INCLUDED_)
#define AFX_ISESSION_CURVE_H__F981CB93_A3CC_11D1_8DA3_0800369C8A03__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
#include <AIS_InteractiveObject.hxx>
#include <Geom_Curve.hxx>
DEFINE_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject)
class ISession_Curve : public AIS_InteractiveObject
{
public:
ISession_Curve(const Handle(Geom_Curve)& aCurve);
virtual ~ISession_Curve();
DEFINE_STANDARD_RTTI(ISession_Curve)
private:
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
Standard_EXPORT virtual void Compute(const Handle(Prs3d_Projector)& aProjector,const Handle(Prs3d_Presentation)& aPresentation) ;
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
Handle(Geom_Curve) myCurve;
};
#endif // !defined(AFX_ISESSION_CURVE_H__F981CB93_A3CC_11D1_8DA3_0800369C8A03__INCLUDED_)

View File

@@ -0,0 +1,210 @@
// ModelClippingDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Viewer3dApp.h"
#include "ModelClippingDlg.h"
#include "Viewer3dDoc.h"
#include "offsetdlg.h" // Added by ClassView
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CModelClippingDlg dialog
CModelClippingDlg::CModelClippingDlg(Handle(V3d_View) aView, Handle(V3d_Plane) aPlane,
Handle(AIS_Shape) aShape, CViewer3dDoc* pDoc, CWnd* pParent /*=NULL*/)
: CDialog(CModelClippingDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CModelClippingDlg)
m_ModelClipping_Z = 0.0;
myView=aView;
myPlane=aPlane;
myShape=aShape;
myDoc=pDoc;
m_ModelClippingONOFF = FALSE;
//}}AFX_DATA_INIT
}
void CModelClippingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CModelClippingDlg)
DDX_Control(pDX, IDC_SLIDER_MODELCLIPPING_Z, m_ModelClippingZSlidCtrl);
DDX_Text(pDX, IDC_EDIT_MODELCLIPPING_Z, m_ModelClipping_Z);
DDX_Check(pDX, IDC_CHECK_MODELCLIPPINGONOFF, m_ModelClippingONOFF);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CModelClippingDlg, CDialog)
//{{AFX_MSG_MAP(CModelClippingDlg)
ON_WM_HSCROLL()
ON_EN_CHANGE(IDC_EDIT_MODELCLIPPING_Z, OnChangeEditModelclippingZ)
ON_BN_CLICKED(IDC_CHECK_MODELCLIPPINGONOFF, OnCheckModelclippingonoff)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CModelClippingDlg message handlers
void CModelClippingDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
UpdateData(TRUE);
m_ModelClipping_Z = m_ModelClippingZSlidCtrl.GetPos();
UpdateData(FALSE);
// Setting the ZClipping depth at m_ZClippingDepth value
gp_Pln clipPln(gp_Pnt(-m_ModelClipping_Z,0,0),gp_Dir(1,0,0));
Standard_Real A,B,C,D;
clipPln.Coefficients(A,B,C,D);
myPlane->SetPlane(A,B,C,D);
if(m_ModelClippingONOFF)
myView->SetPlaneOn(myPlane);
gp_Trsf myTrsf;
myTrsf.SetTranslation(gp_Pnt(m_ModelClipping_Z,0,0), gp_Pnt(myModelClipping_Z,0,0));
myDoc->GetAISContext()->SetLocation(myShape,TopLoc_Location(myTrsf)) ;
myDoc->GetAISContext()->Redisplay(myShape);
myView->Update();
TCollection_AsciiString Message("\
gp_Pln clipPln(gp_Pnt(-m_ModelClippingZSlidCtrl.GetPos(),0,0),gp_Dir(1,0,0));\n\
Standard_Real A,B,C,D;\n\
clipPln.Coefficients(A,B,C,D);\n\
myPlane->SetPlane(A,B,C,D);\n\
myView->SetPlaneOn(myPlane); \n\
");
// Update The Result Message Dialog
myDoc->UpdateResultMessageDlg("SetPlaneOn",Message);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
BOOL CModelClippingDlg::OnInitDialog()
{
CDialog::OnInitDialog();
Standard_Real A,B,C,D;
myPlane->Plane(A,B,C,D);
m_ModelClipping_Z = D;
m_ModelClippingZSlidCtrl.SetRange(-750, 750, TRUE);
m_ModelClippingZSlidCtrl.SetPos( (int) floor(m_ModelClipping_Z));
Handle(V3d_Plane) thePlane;
for( myView->InitActivePlanes() ;
myView->MoreActivePlanes() ; myView->NextActivePlanes() ) {
thePlane = myView->ActivePlane() ;
if( thePlane == myPlane ) m_ModelClippingONOFF = TRUE;
}
if(m_ModelClippingONOFF)
if(!myShape.IsNull())
myDoc->GetAISContext()->Display(myShape);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
} //V3d_Plane.hxx
void CModelClippingDlg::OnChangeEditModelclippingZ()
{
UpdateData(TRUE);
// Setting the m_ZClippingDepthSlidCtrl position at floor(m_ZClippingDepth) value (because slider position is an integer)
m_ModelClippingZSlidCtrl.SetPos( (int) floor(m_ModelClipping_Z));
// Setting the ZClipping depth at m_ZClippingDepth value
gp_Pln clipPln(gp_Pnt(-m_ModelClipping_Z,0,0),gp_Dir(1,0,0));
Standard_Real A,B,C,D;
clipPln.Coefficients(A,B,C,D);
myPlane->SetPlane(A,B,C,D);
if(m_ModelClippingONOFF)
myView->SetPlaneOn(myPlane);
gp_Trsf myTrsf;
myTrsf.SetTranslation(gp_Pnt(m_ModelClipping_Z,0,0), gp_Pnt(myModelClipping_Z,0,0));
myDoc->GetAISContext()->SetLocation(myShape,TopLoc_Location(myTrsf)) ;
myDoc->GetAISContext()->Redisplay(myShape);
myView->Update();
myModelClipping_Z = m_ModelClipping_Z;
TCollection_AsciiString Message("\
gp_Pln clipPln(gp_Pnt(-m_ModelClipping_Z,0,0),gp_Dir(1,0,0));\n\
Standard_Real A,B,C,D;\n\
clipPln.Coefficients(A,B,C,D);\n\
myPlane->SetPlane(A,B,C,D);\n\
myView->SetPlaneOn(myPlane); \n\
");
// Update The Result Message Dialog
myDoc->UpdateResultMessageDlg("SetPlaneOn",Message);
}
void CModelClippingDlg::OnCheckModelclippingonoff()
{
UpdateData(TRUE);
//activate the plane
if(m_ModelClippingONOFF)
{
//activate the plane
myView->SetPlaneOn(myPlane);
myDoc->GetAISContext()->Display(myShape);
}
else
//deactivate the plane
{
myView->SetPlaneOff(myPlane);
myDoc->GetAISContext()->Erase(myShape);
}
myView->Update();
TCollection_AsciiString Message("\
gp_Pln clipPln(gp_Pnt(-m_ModelClippingZSlidCtrl.GetPos(),0,0),gp_Dir(1,0,0));\n\
Standard_Real A,B,C,D;\n\
clipPln.Coefficients(A,B,C,D);\n\
myPlane->SetPlane(A,B,C,D);\n\
if(m_ModelClippingONOFF) \n\
myView->SetPlaneOn(myPlane); \n\
else \n\
myView->SetPlaneOff(myPlane); \n\
");
// Update The Result Message Dialog
myDoc->UpdateResultMessageDlg("SetPlaneOn",Message);
}
void CModelClippingDlg::OnCancel()
{
UpdateData(TRUE);
if(m_ModelClippingONOFF)
//deactivate the plane
myView->SetPlaneOff(myPlane);
m_ModelClippingONOFF=FALSE;
if(!myShape.IsNull())
myDoc->GetAISContext()->Erase(myShape);
myView->Update();
CDialog::OnCancel();
}
void CModelClippingDlg::OnOK()
{
if(!myShape.IsNull())
myDoc->GetAISContext()->Erase(myShape);
CDialog::OnOK();
}

View File

@@ -0,0 +1,62 @@
#if !defined(AFX_MODELCLIPPINGDLG_H__E206D99D_646E_11D3_8D0A_00AA00D10994__INCLUDED_)
#define AFX_MODELCLIPPINGDLG_H__E206D99D_646E_11D3_8D0A_00AA00D10994__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ModelClippingDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CModelClippingDlg dialog
#include "Viewer3dDoc.h"
class CModelClippingDlg : public CDialog
{
// Construction
public:
CModelClippingDlg(Handle(V3d_View) aView, Handle(V3d_Plane) aPlane,
Handle(AIS_Shape) aShape, CViewer3dDoc* pDoc, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CModelClippingDlg)
enum { IDD = IDD_MODELCLIPPING };
CSliderCtrl m_ModelClippingZSlidCtrl;
double m_ModelClipping_Z;
BOOL m_ModelClippingONOFF;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CModelClippingDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CModelClippingDlg)
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
virtual BOOL OnInitDialog();
afx_msg void OnChangeEditModelclippingZ();
afx_msg void OnCheckModelclippingonoff();
virtual void OnCancel();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
Handle_V3d_View myView;
Handle_AIS_Shape myShape;
Handle_V3d_Plane myPlane;
CViewer3dDoc* myDoc;
double myModelClipping_Z;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MODELCLIPPINGDLG_H__E206D99D_646E_11D3_8D0A_00AA00D10994__INCLUDED_)

View File

@@ -0,0 +1,329 @@
// OCCDemo_Presentation.cpp: implementation of the OCCDemo_Presentation class.
// This is a base class for all presentations
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "OCCDemo_Presentation.h"
#include "Viewer3dView.h"
#include "ISession_Curve.h"
#include <AIS_InteractiveObject.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <Quantity_Color.hxx>
#include <AIS_Shape.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <Precision.hxx>
#include <Geom_Line.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <AIS_Drawer.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <AIS_Point.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom2d_OffsetCurve.hxx>
#include <GeomAPI.hxx>
#include <gp_Pln.hxx>
#include <Geom_OffsetCurve.hxx>
#define MAX_PARAM 1000 // if a surface parameter is infinite, it is assingned
// this value in order to display the "infinit" object in the viewer.
Standard_Boolean OCCDemo_Presentation::WaitForInput (unsigned long aMilliSeconds)
{
//::WaitForSingleObject(::CreateEvent (NULL, FALSE, FALSE, NULL), aMilliSeconds);
if (::MsgWaitForMultipleObjects(0, NULL, FALSE, aMilliSeconds,
QS_KEY | QS_MOUSEBUTTON) != WAIT_TIMEOUT)
{
MSG msg;
if (::PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (msg.message == WM_KEYUP)
{
::PeekMessage (&msg, NULL, 0, 0, PM_REMOVE);
return WaitForInput (aMilliSeconds);
}
else
return Standard_True;
}
}
return Standard_False;
}
//================================================================
// Function : fixParam
// Purpose : assings a finite value to theParam if it intinite
// (equal to +- Precision::Infinite())
//================================================================
static Standard_Boolean fixParam(Standard_Real& theParam)
{
Standard_Boolean aResult = Standard_False;
if (Precision::IsNegativeInfinite(theParam))
{
theParam = -MAX_PARAM;
aResult = Standard_True;
}
if (Precision::IsPositiveInfinite(theParam))
{
theParam = MAX_PARAM;
aResult = Standard_True;
}
return aResult;
}
//================================================================
// Function : DrawSurface
// Purpose : displays a given geometric surface in 3d viewer
// (creates a finite face and displays it)
//================================================================
Handle_AIS_InteractiveObject OCCDemo_Presentation::drawSurface
(const Handle_Geom_Surface& theSurface,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay)
{
Standard_Real u1, u2, v1, v2;
theSurface->Bounds(u1,u2,v1,v2);
fixParam(u1);
fixParam(u2);
fixParam(v1);
fixParam(v2);
Handle_AIS_Shape aGraphicSurface =
new AIS_Shape(BRepBuilderAPI_MakeFace (theSurface, u1, u2, v1, v2));
getAISContext()->SetMaterial(aGraphicSurface, Graphic3d_NOM_PLASTIC, toDisplay);
getAISContext()->SetColor(aGraphicSurface, theColor, toDisplay);
if (toDisplay) {
if (FitMode){
getAISContext()->Display (aGraphicSurface, Standard_False);
CViewer3dDoc::Fit();
}
else
getAISContext()->Display (aGraphicSurface);
}
return aGraphicSurface;
}
//================================================================
// Function : DrawCurve
// Purpose : displays a given curve 3d
//================================================================
Handle_AIS_InteractiveObject OCCDemo_Presentation::drawCurve
(const Handle_Geom_Curve& theCurve,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay)
{
Handle(ISession_Curve) aGraphicCurve = new ISession_Curve (theCurve);
getAISContext()->SetColor (aGraphicCurve, theColor, toDisplay);
aGraphicCurve->Attributes()->Link()->SetLineArrowDraw(Standard_False);
if (toDisplay){
if (FitMode){
getAISContext()->Display (aGraphicCurve, Standard_False);
CViewer3dDoc::Fit();
}
else
getAISContext()->Display (aGraphicCurve);
}
return aGraphicCurve;
}
//================================================================
// Function : DrawCurve
// Purpose : displays a given curve 2d
//================================================================
Handle_AIS_InteractiveObject OCCDemo_Presentation::drawCurve
(const Handle_Geom2d_Curve& theCurve,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay,
const gp_Ax2& aPosition)
{
// create 3D curve in plane
Handle(Geom_Curve) aCurve3d;
if (theCurve->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve)))
{
Handle(Geom2d_OffsetCurve) aOffCurve =
Handle(Geom2d_OffsetCurve)::DownCast(theCurve);
Handle(Geom_Curve) aBasCurve3d =
GeomAPI::To3d (aOffCurve->BasisCurve(), gp_Pln(aPosition));
Standard_Real aDist = aOffCurve->Offset();
aCurve3d = new Geom_OffsetCurve (aBasCurve3d, aDist, aPosition.Direction());
}
else
{
aCurve3d = GeomAPI::To3d (theCurve, gp_Pln(aPosition));
}
return drawCurve (aCurve3d, theColor, toDisplay);
}
//================================================================
// Function : drawPoint
// Purpose : displays a given point
//================================================================
Handle_AIS_Point OCCDemo_Presentation::drawPoint
(const gp_Pnt& aPnt,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay)
{
Handle(AIS_Point) aGraphicPoint = new AIS_Point (new Geom_CartesianPoint(aPnt));
getAISContext()->SetColor (aGraphicPoint, theColor, toDisplay);
if (toDisplay) {
getAISContext()->Display (aGraphicPoint);
//COCCDemoDoc::Fit();
}
return aGraphicPoint;
}
//================================================================
// Function : drawVector
// Purpose : displays a given vector in 3d viewer
// (segment of line starting at thePnt with the arrow at the end,
// the length of segment is the length of the vector)
//================================================================
Handle_AIS_InteractiveObject OCCDemo_Presentation::drawVector
(const gp_Pnt& thePnt,
const gp_Vec& theVec,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay)
{
Standard_Real aLength = theVec.Magnitude();
if (aLength < Precision::Confusion())
return Handle(AIS_InteractiveObject)();
Handle(Geom_Curve) aCurve = new Geom_Line (thePnt, theVec);
aCurve = new Geom_TrimmedCurve (aCurve, 0, aLength);
Handle(ISession_Curve) aGraphicCurve = new ISession_Curve (aCurve);
getAISContext()->SetColor (aGraphicCurve, theColor, toDisplay);
Handle(Prs3d_Drawer) aDrawer = aGraphicCurve->Attributes()->Link();
aDrawer->SetLineArrowDraw(Standard_True);
aDrawer->ArrowAspect()->SetLength(aLength/10);
if (toDisplay) {
if (FitMode){
getAISContext()->Display (aGraphicCurve, Standard_False);
CViewer3dDoc::Fit();
}
else
getAISContext()->Display (aGraphicCurve);
}
return aGraphicCurve;
}
Handle_AIS_Shape OCCDemo_Presentation::drawShape
(const TopoDS_Shape& theShape,const Quantity_Color& theColor,
const Standard_Boolean toDisplay)
{
Handle_AIS_Shape aGraphicShape = new AIS_Shape(theShape);
getAISContext()->SetMaterial(aGraphicShape, Graphic3d_NOM_PLASTIC, toDisplay);
getAISContext()->SetColor (aGraphicShape, theColor, toDisplay);
if (toDisplay){
if (FitMode){
getAISContext()->Display (aGraphicShape, Standard_False);
CViewer3dDoc::Fit();
}
else
getAISContext()->Display (aGraphicShape);
}
return aGraphicShape;
}
Handle_AIS_Shape OCCDemo_Presentation::drawShape
(const TopoDS_Shape& theShape,
const Graphic3d_NameOfMaterial theMaterial,
const Standard_Boolean toDisplay)
{
Handle_AIS_Shape aGraphicShape = new AIS_Shape(theShape);
getAISContext()->SetMaterial(aGraphicShape, theMaterial, toDisplay);
if (toDisplay) {
if (FitMode){
getAISContext()->Display (aGraphicShape, Standard_False);
CViewer3dDoc::Fit();
}
else
getAISContext()->Display (aGraphicShape);
}
return aGraphicShape;
}
void OCCDemo_Presentation::GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->GetViewCenter(Xc,Yc);
}
void OCCDemo_Presentation::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->SetViewCenter(Xc,Yc);
}
void OCCDemo_Presentation::GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->GetViewEye(X,Y,Z);
}
void OCCDemo_Presentation::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->SetViewEye(X,Y,Z);
}
Quantity_Factor OCCDemo_Presentation::GetViewScale()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
return pView->GetViewScale();
}
void OCCDemo_Presentation::SetViewScale(Quantity_Factor Coef)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->SetViewScale(Coef);
}
void OCCDemo_Presentation::ResetView()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
pView->Reset();
}
Handle_AIS_InteractiveContext OCCDemo_Presentation::getAISContext() const
{
return myDoc->GetAISContext();
}
Handle_V3d_Viewer OCCDemo_Presentation::getViewer() const
{
return myDoc->GetViewer();
}
Standard_CString OCCDemo_Presentation::GetDataDir()
{
return myDoc->GetDataDir();
}

View File

@@ -0,0 +1,135 @@
// OCCDemo_Presentation.h: interface for the OCCDemo_Presentation class.
// This is a base class for all presentations
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_OCCDEMO_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)
#define AFX_OCCDEMO_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Viewer3dDoc.h"
#define WAIT_A_LITTLE WaitForInput(500)
#define WAIT_A_SECOND WaitForInput(1000)
class CViewer3dDoc;
class Handle_AIS_InteractiveObject;
class Handle_AIS_Point;
class Handle_Geom_Surface;
class Handle_Geom_Curve;
class Handle_Geom2d_Curve;
class Quantity_Color;
class OCCDemo_Presentation
{
public:
// Construction
OCCDemo_Presentation() : myIndex(0), myNbSamples(0), FitMode(false){}
virtual ~OCCDemo_Presentation() {}
public:
static OCCDemo_Presentation* Current;
// this pointer must be initialized when realize a derivable class;
// it is used by application to access to a presentation class instance
void SetDocument (CViewer3dDoc* theDoc) {myDoc = theDoc;}
// document must be set by the user of this class before first use of iterations
public:
// Titling
const CString& GetName() const {return myName;}
public:
// Iteration on samples
void FirstSample() {myIndex=0;}
void LastSample() {myIndex=myNbSamples-1;}
Standard_Boolean AtFirstSample() const {return myIndex <= 0;}
Standard_Boolean AtLastSample() const {return myIndex >= myNbSamples-1;}
void NextSample() {myIndex++;}
void PrevSample() {myIndex--;}
virtual void DoSample() = 0;
static void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
static void SetViewCenter(const V3d_Coordinate Xc, const V3d_Coordinate Yc);
static void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
static void SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z);
static Quantity_Factor GetViewScale();
static void SetViewScale(Quantity_Factor Coef);
static void ResetView();
CViewer3dDoc* getDocument() { return myDoc; }
// place one-time initialization code in this function
virtual void Init() {}
protected:
// Methods to call from a derivable class
void setName (const char* theName) {myName = CString(theName);}
Handle_AIS_InteractiveContext getAISContext() const;
Handle_V3d_Viewer getViewer() const;
// void setResultTitle (const char* theTitle) {myDoc->GetResultDialog()->SetTitle(theTitle);}
// void setResultText (const char* theText) {myDoc->GetResultDialog()->SetText(theText);}
Standard_CString GetDataDir();
Standard_Boolean WaitForInput (unsigned long aMilliSeconds);
// Waits for a user input or a period of time has been elapsed
Handle_AIS_InteractiveObject drawSurface (const Handle_Geom_Surface& theSurface,
const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_LEMONCHIFFON3),
const Standard_Boolean toDisplay = Standard_True);
// creates a finite face based on the given geometric surface
// and displays it in the viewer if toDisplay = Standard_True
Handle_AIS_InteractiveObject drawCurve (const Handle_Geom_Curve& theCurve,
const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_RED),
const Standard_Boolean toDisplay = Standard_True);
// creates an ISession_Curve based on the given geometric curve
// and displays it in the viewer if toDisplay = Standard_True
Handle_AIS_InteractiveObject drawCurve (const Handle_Geom2d_Curve& theCurve,
const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_RED),
const Standard_Boolean toDisplay = Standard_True,
const gp_Ax2& aPosition = gp::XOY());
// converts a given curve to 3d using aPosition and calls the previous method
Handle_AIS_Point drawPoint (const gp_Pnt& thePnt,
const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_GREEN),
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given point
// and displays it in the viewer if toDisplay = Standard_True
Handle_AIS_InteractiveObject drawVector (const gp_Pnt& thePnt,
const gp_Vec& theVec,
const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_YELLOW),
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given vector
// and displays it in the viewer if toDisplay = Standard_True
Handle_AIS_Shape drawShape (const TopoDS_Shape& theShape,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given shape
// with material PLASTIC and a given color
// and displays it in the viewer if toDisplay = Standard_True
Handle_AIS_Shape drawShape (const TopoDS_Shape& theShape,
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_BRASS,
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given shape with the given material
// (color is default for a given material)
// and displays it in the viewer if toDisplay = Standard_True
protected:
// Fields to use in a derivable class
BOOL FitMode;
int myIndex;
int myNbSamples;
private:
CViewer3dDoc* myDoc;
CString myName;
};
#endif // !defined(AFX_OCCDEMO_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)

View File

@@ -0,0 +1,298 @@
// OffsetDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "offsetdlg.h"
#include "Viewer3dView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define FactorMinValue 0
#define FactorMaxValue 20
#define UnitsMinValue 0
#define UnitsMaxValue 20
/////////////////////////////////////////////////////////////////////////////
// COffsetDlg dialog
COffsetDlg::COffsetDlg(CViewer3dDoc* theDoc, CWnd* pParent /*=NULL*/)
: CDialog(COffsetDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(COffsetDlg)
m_Factor = 1.;
m_Units = 0.;
//}}AFX_DATA_INIT
myDoc = theDoc;
}
void COffsetDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COffsetDlg)
DDX_Control(pDX, IDC_SLIDER_OFFSETUNITS, m_UnitsSlidCtrl);
DDX_Control(pDX, IDC_SLIDER_OFFSETFACTOR, m_FactorSlidCtrl);
DDX_Text(pDX, IDC_EDIT_OFFSETFACTOR, m_Factor);
DDV_MinMaxDouble(pDX, m_Factor, FactorMinValue, FactorMaxValue);
DDX_Text(pDX, IDC_EDIT_OFFSETUNITS, m_Units);
DDV_MinMaxDouble(pDX, m_Units, UnitsMinValue, UnitsMaxValue);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COffsetDlg, CDialog)
//{{AFX_MSG_MAP(COffsetDlg)
ON_WM_HSCROLL()
ON_EN_CHANGE(IDC_EDIT_OFFSETFACTOR, OnChangeEditOffsetFactor)
ON_EN_CHANGE(IDC_EDIT_OFFSETUNITS, OnChangeEditOffsetUnits)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COffsetDlg message handlers
BOOL COffsetDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Initializing the ComboBox
SetOffsets(m_Factor,m_Units);
// Setting the m_FactorSlidCtrl position at floor(m_Factor) value (because slider position is an integer)
m_FactorSlidCtrl.SetRange(FactorMinValue, FactorMaxValue, TRUE);
m_FactorSlidCtrl.SetPos( (int) floor(m_Factor));
// Setting the m_UnitsSlidCtrl position at floor(m_Units) value (because slider position is an integer)
m_UnitsSlidCtrl.SetRange(UnitsMinValue, UnitsMaxValue, TRUE);
m_UnitsSlidCtrl.SetPos( (int) floor(m_Units));
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void COffsetDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// Setting the m_Factor value at m_FactorSlidCtrl position
m_Factor = m_FactorSlidCtrl.GetPos();
// Setting the m_Units value at m_UnitsSlidCtrl position
m_Units = m_UnitsSlidCtrl.GetPos();
UpdateData(FALSE);
SetOffsets(m_Factor,m_Units);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
void COffsetDlg::OnChangeEditOffsetFactor()
{
UpdateData();
m_FactorSlidCtrl.SetPos(int(m_Units));
SetOffsets(m_Factor,m_Units);
}
void COffsetDlg::OnChangeEditOffsetUnits()
{
UpdateData();
m_UnitsSlidCtrl.SetPos(int(m_Units));
SetOffsets(m_Factor,m_Units);
}
void COffsetDlg::SetOffsets(Standard_Real theFactor, Standard_Real theUnits)
{
Handle(AIS_InteractiveContext) aAISContext = myDoc->GetAISContext();
Handle(AIS_Shape) aOverlappedBox = myDoc->GetOverlappedBox();
Handle(AIS_Shape) aOverlappedCylinder = myDoc->GetOverlappedCylinder();
Handle(AIS_Shape) aOverlappedSphere = myDoc->GetOverlappedSphere();
Handle(AIS_Shape) aBox = myDoc->GetBox();
Handle(User_Cylinder) aCylinder = myDoc->GetCylinder();
Handle(AIS_Shape) aSphere = myDoc->GetSphere();
myDoc->SetDialogTitle("Set offsets");
TCollection_AsciiString Message;
Standard_Boolean OneOrMoreCurrentIsDisplayed=false;
for (aAISContext->InitCurrent();aAISContext->MoreCurrent ();aAISContext->NextCurrent ())
if (aAISContext->IsDisplayed(aAISContext->Current())) OneOrMoreCurrentIsDisplayed=true;
if(OneOrMoreCurrentIsDisplayed){
if((aAISContext->IsCurrent(aOverlappedBox) || aAISContext->IsCurrent(aBox))
&& aAISContext->IsDisplayed(aOverlappedBox)){
aOverlappedBox->SetPolygonOffsets(Aspect_POM_Fill,theFactor,theUnits);
Message = "Box2 -> SetPolygonOffsets(Aspect_POM_Fill, Factor, Units);\n";
//myDoc -> AddTextInDialog(Message);
}
if((aAISContext->IsCurrent(aOverlappedCylinder) || aAISContext->IsCurrent(aCylinder))
&& aAISContext->IsDisplayed(aOverlappedCylinder)){
aOverlappedCylinder->SetPolygonOffsets(Aspect_POM_Fill,theFactor,theUnits);
Message = Message + "Cylinder2 -> SetPolygonOffsets(Aspect_POM_Fill, Factor, Units);\n";
//myDoc -> AddTextInDialog(Message);
}
if((aAISContext->IsCurrent(aOverlappedSphere) || aAISContext->IsCurrent(aSphere))
&& aAISContext->IsDisplayed(aOverlappedSphere)){
aOverlappedSphere->SetPolygonOffsets(Aspect_POM_Fill,theFactor,theUnits);
Message = Message + "Sphere2 -> SetPolygonOffsets(Aspect_POM_Fill, Factor, Units);\n";
//myDoc -> AddTextInDialog(Message);
}
}
else{
if(aAISContext->IsDisplayed(aOverlappedBox)){
aOverlappedBox->SetPolygonOffsets(Aspect_POM_Fill,theFactor,theUnits);
Message = Message + "Box2 -> SetPolygonOffsets(Aspect_POM_Fill, Factor, Units);\n";
//myDoc -> AddTextInDialog(Message);
}
if(aAISContext->IsDisplayed(aOverlappedCylinder)){
aOverlappedCylinder->SetPolygonOffsets(Aspect_POM_Fill,theFactor,theUnits);
Message = Message + "Cylinder2 -> SetPolygonOffsets(Aspect_POM_Fill, Factor, Units);\n";
//myDoc -> AddTextInDialog(Message);
}
if(aAISContext->IsDisplayed(aOverlappedSphere)){
aOverlappedSphere->SetPolygonOffsets(Aspect_POM_Fill,theFactor,theUnits);
Message = Message + "Sphere2 -> SetPolygonOffsets(Aspect_POM_Fill, Factor, Units);\n";
//myDoc -> AddTextInDialog(Message);
}
}
CString aTextInDialog = myDoc -> GetDialogText();
if (strcmp(aTextInDialog, Message.ToCString()))
myDoc -> UpdateResultMessageDlg("Set offsets", Message);
aAISContext->UpdateCurrentViewer();
}
void COffsetDlg::UpdateValues()
{
Standard_Integer aOffsetMode;
Standard_Real aBoxFactor = 0;
Standard_Real aCylFactor = 0;
Standard_Real aSphereFactor = 0;
Standard_Real aCylUnits = 0;
Standard_Real aSphereUnits = 0;
Standard_Real aBoxUnits = 0;
Handle(AIS_InteractiveContext) aAISContext = myDoc->GetAISContext();
Handle(AIS_Shape) aOverlappedBox = myDoc->GetOverlappedBox();
Handle(AIS_Shape) aOverlappedCylinder = myDoc->GetOverlappedCylinder();
Handle(AIS_Shape) aOverlappedSphere = myDoc->GetOverlappedSphere();
Handle(AIS_Shape) aBox = myDoc->GetBox();
Handle(User_Cylinder) aCylinder = myDoc->GetCylinder();
Handle(AIS_Shape) aSphere = myDoc->GetSphere();
BOOL IsOverlappedCylinderDisplayed = aAISContext->IsDisplayed(aOverlappedCylinder);
BOOL IsOverlappedSphereDisplayed = aAISContext->IsDisplayed(aOverlappedSphere);
BOOL IsOverlappedBoxDisplayed = aAISContext->IsDisplayed(aOverlappedBox);
BOOL IsOverlappedCylinderCurrent = aAISContext->IsCurrent(aOverlappedCylinder);
BOOL IsOverlappedSphereCurrent = aAISContext->IsCurrent(aOverlappedSphere);
BOOL IsOverlappedBoxCurrent = aAISContext->IsCurrent(aOverlappedBox);
BOOL IsAnyOverlappedObjectCurrent =
IsOverlappedCylinderCurrent || IsOverlappedSphereCurrent || IsOverlappedBoxCurrent;
BOOL IsCylinderCurrent = aAISContext->IsCurrent(aCylinder);
BOOL IsSphereCurrent = aAISContext->IsCurrent(aSphere);
BOOL IsBoxCurrent = aAISContext->IsCurrent(aBox);
BOOL IsAnyObjectCurrent =
IsOverlappedCylinderCurrent || IsOverlappedSphereCurrent || IsOverlappedBoxCurrent
|| IsCylinderCurrent || IsSphereCurrent || IsBoxCurrent;
BOOL IsAnyOverlappedObjectDisplayed =
IsOverlappedCylinderDisplayed || IsOverlappedSphereDisplayed || IsOverlappedBoxDisplayed;
Standard_Boolean OneOrMoreCurrentIsDisplayed=false;
for (aAISContext->InitCurrent();aAISContext->MoreCurrent ();aAISContext->NextCurrent ())
if (aAISContext->IsDisplayed(aAISContext->Current())) OneOrMoreCurrentIsDisplayed=true;
if(OneOrMoreCurrentIsDisplayed){
if(IsOverlappedBoxDisplayed && (IsBoxCurrent || IsOverlappedBoxCurrent)){
aOverlappedBox->PolygonOffsets(aOffsetMode,aBoxFactor,aBoxUnits);
}
if(IsOverlappedCylinderDisplayed && (IsCylinderCurrent || IsOverlappedCylinderCurrent)){
aOverlappedCylinder->PolygonOffsets(aOffsetMode,aCylFactor,aCylUnits);
}
if(IsOverlappedSphereDisplayed && (IsSphereCurrent || IsOverlappedSphereCurrent)){
aOverlappedSphere->PolygonOffsets(aOffsetMode,aSphereFactor,aSphereUnits);
}
}
else{
if(IsOverlappedBoxDisplayed){
aOverlappedBox->PolygonOffsets(aOffsetMode,aBoxFactor,aBoxUnits);
}
if(IsOverlappedCylinderDisplayed){
aOverlappedCylinder->PolygonOffsets(aOffsetMode,aCylFactor,aCylUnits);
}
if(IsOverlappedSphereDisplayed){
aOverlappedSphere->PolygonOffsets(aOffsetMode,aSphereFactor,aSphereUnits);
}
}
Standard_Real Max = aBoxFactor;
if (Max < aCylFactor) Max = aCylFactor;
if (Max < aSphereFactor) Max = aSphereFactor;
m_Factor = Max;
Max = aBoxUnits;
if (Max < aCylUnits) Max = aCylUnits;
if (Max < aSphereUnits) Max = aSphereUnits;
m_Units = Max;
m_FactorSlidCtrl.SetPos( (int) floor(m_Factor));
m_UnitsSlidCtrl.SetPos( (int) floor(m_Units));
UpdateData(FALSE);
if( (IsOverlappedBoxCurrent || (IsBoxCurrent && IsOverlappedBoxDisplayed)) ||
(IsOverlappedCylinderCurrent || (IsCylinderCurrent && IsOverlappedCylinderDisplayed)) ||
(IsOverlappedSphereCurrent || (IsSphereCurrent && IsOverlappedSphereDisplayed)) ||
(!IsAnyObjectCurrent && IsAnyOverlappedObjectDisplayed)
)
{
m_FactorSlidCtrl.EnableWindow();
m_UnitsSlidCtrl.EnableWindow();
GetDlgItem(IDC_EDIT_OFFSETFACTOR)->EnableWindow();
GetDlgItem(IDC_EDIT_OFFSETUNITS)->EnableWindow();
}
else{
m_FactorSlidCtrl.EnableWindow(false);
m_UnitsSlidCtrl.EnableWindow(false);
GetDlgItem(IDC_EDIT_OFFSETFACTOR)->EnableWindow(false);
GetDlgItem(IDC_EDIT_OFFSETUNITS)->EnableWindow(false);
}
}

View File

@@ -0,0 +1,60 @@
#if !defined(AFX_OFFSETDLG_H__9E963234_B2CB_11D8_8CF3_00047571ABCA__INCLUDED_)
#define AFX_OFFSETDLG_H__9E963234_B2CB_11D8_8CF3_00047571ABCA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// offsetdlg.h : header file
//
#include "Viewer3dDoc.h"
class CViewer3dDoc;
/////////////////////////////////////////////////////////////////////////////
// COffsetDlg dialog
class COffsetDlg : public CDialog
{
// Construction
public:
void UpdateValues();
void SetOffsets(Standard_Real theFactor, Standard_Real theUnits);
COffsetDlg( CViewer3dDoc* theDoc, CWnd* pParent = NULL);
// Dialog Data
//{{AFX_DATA(COffsetDlg)
enum { IDD = IDD_SETOFFSETS };
CSliderCtrl m_UnitsSlidCtrl;
CSliderCtrl m_FactorSlidCtrl;
Standard_Real m_Factor;
Standard_Real m_Units;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(COffsetDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(COffsetDlg)
virtual BOOL OnInitDialog();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnChangeEditOffsetFactor();
afx_msg void OnChangeEditOffsetUnits();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
CViewer3dDoc* myDoc;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_OFFSETDLG_H__9E963234_B2CB_11D8_8CF3_00047571ABCA__INCLUDED_)

View File

@@ -0,0 +1,188 @@
// ScaleDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ScaleDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ScaleDlg dialog
ScaleDlg::ScaleDlg(Handle_V3d_View Current_V3d_View, CViewer3dView* pView, CWnd* pParent /*=NULL*/)
: CDialog(ScaleDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(ScaleDlg)
myCurrent_V3d_View = Current_V3d_View;
myView=pView;
m_ScaleX = 0;
m_ScaleY = 0;
m_ScaleZ = 0;
//}}AFX_DATA_INIT
}
void ScaleDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ScaleDlg)
DDX_Control(pDX, IDC_SLIDER_SCALEX, m_ScaleXSlidCtrl);
DDX_Control(pDX, IDC_SLIDER_SCALEY, m_ScaleYSlidCtrl);
DDX_Control(pDX, IDC_SLIDER_SCALEZ, m_ScaleZSlidCtrl);
DDX_Text(pDX, IDC_EDIT_SCALEX, m_ScaleX);
DDV_MinMaxInt(pDX, m_ScaleX, 1, 100);
DDX_Text(pDX, IDC_EDIT_SCALEY, m_ScaleY);
DDV_MinMaxInt(pDX, m_ScaleY, 1, 100);
DDX_Text(pDX, IDC_EDIT_SCALEZ, m_ScaleZ);
DDV_MinMaxInt(pDX, m_ScaleZ, 1, 100);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(ScaleDlg, CDialog)
//{{AFX_MSG_MAP(ScaleDlg)
ON_EN_CHANGE(IDC_EDIT_SCALEX, OnChangeEditScaleX)
ON_EN_CHANGE(IDC_EDIT_SCALEY, OnChangeEditScaleY)
ON_EN_CHANGE(IDC_EDIT_SCALEZ, OnChangeEditScaleZ)
ON_WM_HSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// ScaleDlg message handlers
BOOL ScaleDlg::OnInitDialog()
{
CDialog::OnInitDialog();
int ScaleX = myView->scaleX;
int ScaleY = myView->scaleY;
int ScaleZ = myView->scaleZ;
m_ScaleX=ScaleX;
m_ScaleXSlidCtrl.SetRange(0, 100, TRUE);
m_ScaleXSlidCtrl.SetPos( ScaleX );
m_ScaleY=ScaleY;
m_ScaleYSlidCtrl.SetRange(0, 100, TRUE);
m_ScaleYSlidCtrl.SetPos( ScaleY );
m_ScaleZ=ScaleZ;
m_ScaleZSlidCtrl.SetRange(0, 100, TRUE);
m_ScaleZSlidCtrl.SetPos( ScaleZ );
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void ScaleDlg::OnChangeEditScaleX()
{
UpdateData(TRUE);
m_ScaleXSlidCtrl.SetPos( m_ScaleX );
myView->scaleX = m_ScaleX;
myCurrent_V3d_View->SetAxialScale( m_ScaleX, m_ScaleY, m_ScaleZ );
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
myCurrent_V3d_View->SetAxialScale( m_ScaleX, m_ScaleY, m_ScaleZ);\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myView->GetDocument()->UpdateResultMessageDlg("SetAxialScale",Message);
}
void ScaleDlg::OnChangeEditScaleY()
{
UpdateData(TRUE);
m_ScaleYSlidCtrl.SetPos( m_ScaleY );
myView->scaleY = m_ScaleY;
myCurrent_V3d_View->SetAxialScale( m_ScaleX, m_ScaleY, m_ScaleZ );
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
myCurrent_V3d_View->SetAxialScale( m_ScaleX, m_ScaleY, m_ScaleZ);\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myView->GetDocument()->UpdateResultMessageDlg("SetAxialScale",Message);
}
void ScaleDlg::OnChangeEditScaleZ()
{
UpdateData(TRUE);
m_ScaleZSlidCtrl.SetPos( m_ScaleZ );
myView->scaleZ = m_ScaleZ;
myCurrent_V3d_View->SetAxialScale( m_ScaleX, m_ScaleY, m_ScaleZ );
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
myCurrent_V3d_View->SetAxialScale( m_ScaleX, m_ScaleY, m_ScaleZ);\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myView->GetDocument()->UpdateResultMessageDlg("SetAxialScale",Message);
}
void ScaleDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
m_ScaleX = m_ScaleXSlidCtrl.GetPos();
m_ScaleY = m_ScaleYSlidCtrl.GetPos();
m_ScaleZ = m_ScaleZSlidCtrl.GetPos();
if(m_ScaleX<=0)
{
m_ScaleX=1;
m_ScaleXSlidCtrl.SetPos( 1 );
}
if(m_ScaleY<=0)
{
m_ScaleY=1;
m_ScaleYSlidCtrl.SetPos( 1 );
}
if(m_ScaleZ<=0)
{
m_ScaleZ=1;
m_ScaleZSlidCtrl.SetPos( 1 );
}
UpdateData(FALSE);
myView->scaleX = m_ScaleX;
myView->scaleY = m_ScaleY;
myView->scaleZ = m_ScaleZ;
myCurrent_V3d_View->SetAxialScale( m_ScaleX, m_ScaleY, m_ScaleZ );
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
myCurrent_V3d_View->SetAxialScale( m_ScaleX, m_ScaleY, m_ScaleZ);\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myView->GetDocument()->UpdateResultMessageDlg("SetAxialScale",Message);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}

View File

@@ -0,0 +1,63 @@
#if !defined(AFX_ScaleDlg_H__1796AA04_63B7_4E46_B00A_D2DAC975CAF1__INCLUDED_)
#define AFX_ScaleDlg_H__1796AA04_63B7_4E46_B00A_D2DAC975CAF1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ScaleDlg.h : header file
//
#include "resource.h"
#include "Viewer3dView.h"
/////////////////////////////////////////////////////////////////////////////
// ScaleDlg dialog
class ScaleDlg : public CDialog
{
// Construction
public:
ScaleDlg(Handle_V3d_View Current_V3d_View, CViewer3dView* pView, CWnd* pParent = NULL);
// Dialog Data
//{{AFX_DATA(ScaleDlg)
enum { IDD = IDD_SCALE };
CSliderCtrl m_ScaleXSlidCtrl;
CSliderCtrl m_ScaleYSlidCtrl;
CSliderCtrl m_ScaleZSlidCtrl;
int m_ScaleX;
int m_ScaleY;
int m_ScaleZ;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ScaleDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(ScaleDlg)
virtual BOOL OnInitDialog();
afx_msg void OnChangeEditScaleX();
afx_msg void OnChangeEditScaleY();
afx_msg void OnChangeEditScaleZ();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
Handle_V3d_View myCurrent_V3d_View;
CViewer3dView* myView;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ScaleDlg_H__1796AA04_63B7_4E46_B00A_D2DAC975CAF1__INCLUDED_)

View File

@@ -0,0 +1,64 @@
// ShadingModelDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Viewer3dApp.h"
#include "ShadingModelDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CShadingModelDlg dialog
CShadingModelDlg::CShadingModelDlg(Handle_V3d_View Current_V3d_View, CWnd* pParent /*=NULL*/)
: CDialog(CShadingModelDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CShadingModelDlg)
myCurrent_V3d_View=Current_V3d_View;
//}}AFX_DATA_INIT
}
void CShadingModelDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CShadingModelDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CShadingModelDlg, CDialog)
//{{AFX_MSG_MAP(CShadingModelDlg)
ON_BN_CLICKED(IDC_SHADINGMODEL_COLOR, OnShadingmodelColor)
ON_BN_CLICKED(IDC_SHADINGMODEL_FLAT, OnShadingmodelFlat)
ON_BN_CLICKED(IDC_SHADINGMODEL_GOURAUD, OnShadingmodelGouraud)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShadingModelDlg message handlers
void CShadingModelDlg::OnShadingmodelColor()
{
myCurrent_V3d_View->SetShadingModel(V3d_COLOR);
myCurrent_V3d_View->Update();
}
void CShadingModelDlg::OnShadingmodelFlat()
{
myCurrent_V3d_View->SetShadingModel(V3d_FLAT);
myCurrent_V3d_View->Update();
}
void CShadingModelDlg::OnShadingmodelGouraud()
{
myCurrent_V3d_View->SetShadingModel(V3d_GOURAUD);
myCurrent_V3d_View->Update();
}

View File

@@ -0,0 +1,52 @@
// ShadingModelDlg.h : header file
//
#if !defined(AFX_SHADINGMODELDLG_H__4DEFD9F9_61FC_11D3_8D0A_00AA00D10994__INCLUDED_)
#define AFX_SHADINGMODELDLG_H__4DEFD9F9_61FC_11D3_8D0A_00AA00D10994__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
// CShadingModelDlg dialog
class CShadingModelDlg : public CDialog
{
// Construction
public:
CShadingModelDlg(Handle_V3d_View Current_V3d_View, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CShadingModelDlg)
enum { IDD = IDD_SHADINGMODEL };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CShadingModelDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CShadingModelDlg)
afx_msg void OnShadingmodelColor();
afx_msg void OnShadingmodelFlat();
afx_msg void OnShadingmodelGouraud();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
Handle_V3d_View myCurrent_V3d_View;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SHADINGMODELDLG_H__4DEFD9F9_61FC_11D3_8D0A_00AA00D10994__INCLUDED_)

View File

@@ -0,0 +1,3 @@
enum STATE {
FACE_COLOR
};

View File

@@ -0,0 +1,5 @@
// stdafx.cpp : source file that includes just the standard includes
// SampleViewer3d.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,75 @@
// 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
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC OLE automation classes
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // 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 <Standard.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
#include <Graphic3d_WNTGraphicDevice.hxx>
#include <V3d_Viewer.hxx>
#include <V3d_View.hxx>
#include <WNT_Window.hxx>
#include <Standard_ErrorHandler.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepPrimAPI_MakeSphere.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepPrimAPI_MakeCone.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <gp_Trsf.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Ax2.hxx>
#include <ProjLib.hxx>
#include <ElSLib.hxx>
#include <gp_Pln.hxx>
#include <V3d_Plane.hxx>
#include <gp_Trsf.hxx>
#include <UnitsAPI.hxx>
#include <BRepBuilderAPI_NurbsConvert.hxx>
#include <Aspect_PolygonOffsetMode.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <BRepFilletAPI_MakeFillet.hxx>
#include <Geom_Circle.hxx>
#include <AIS_Circle.hxx>
#include <AIS_Line.hxx>
#include <Geom_Line.hxx>
#include <Prs3d_Drawer.hxx>
#include <TopoDS.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Plane.hxx>
#include <BRep_Tool.hxx>
#include "State.h"
#include <resource.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

View File

@@ -0,0 +1,457 @@
// TexturesExt_Presentation.cpp: implementation of the TexturesExt_Presentation class.
// Creation of textural presentation of shape
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "TexturesExt_Presentation.h"
#include "Viewer3dApp.h"
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <AIS_TexturedShape.hxx>
#include <BRepTools.hxx>
#include <Graphic3d_Texture2D.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <Geom_Surface.hxx>
#include <TopoDS_Face.hxx>
#include <V3d_DirectionalLight.hxx>
#define DISP(OBJ) getAISContext()->Display((OBJ), Standard_False)
// Initialization of global variable with an instance of this class
OCCDemo_Presentation* OCCDemo_Presentation::Current = new TexturesExt_Presentation;
// Initialization of array of samples
const TexturesExt_Presentation::PSampleFuncType TexturesExt_Presentation::SampleFuncs[] =
{
&TexturesExt_Presentation::sampleBottle,
&TexturesExt_Presentation::sampleTerrain,
&TexturesExt_Presentation::sampleKitchen
};
#ifdef WNT
#define EOL "\r\n"
#else
#define EOL "\n"
#endif
#define ZVIEW_SIZE 100
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
TexturesExt_Presentation::TexturesExt_Presentation()
{
myNbSamples = sizeof(SampleFuncs)/sizeof(PSampleFuncType);
setName ("Textured Shapes");
}
//////////////////////////////////////////////////////////////////////
// Sample execution
//////////////////////////////////////////////////////////////////////
void TexturesExt_Presentation::DoSample()
{
((CViewer3dApp*) AfxGetApp())->SetSampleName("Viewer3d");
((CViewer3dApp*) AfxGetApp())->SetSamplePath("..\\..\\04_Viewer3d");
getAISContext()->EraseAll();
if (myIndex >=0 && myIndex < myNbSamples)
{
// turn lights on for terrain sample
lightsOnOff(myIndex==1);
(this->*SampleFuncs[myIndex])();
}
}
void TexturesExt_Presentation::Init()
{
// initialize v3d_view so it displays TexturesExt well
getViewer()->InitActiveViews();
Handle_V3d_View aView = getViewer()->ActiveView();
aView->SetSurfaceDetail(V3d_TEX_ALL);
aView->SetSize(ZVIEW_SIZE);
// getDocument()->UpdateResultMessageDlg("Textured Shape",
TCollection_AsciiString Message ("Textured Shape",
" TopoDS_Shape aShape;" EOL
"" EOL
" // initialize aShape" EOL
" // aShape = ..." EOL
"" EOL
" // create a textured presentation object for aShape" EOL
" Handle_AIS_TexturedShape aTShape = new AIS_TexturedShape(aShape);" EOL
"" EOL
" TCollection_AsciiString aTFileName;" EOL
"" EOL
" // initialize aTFileName with an existing texture file name" EOL
" // (gif, bmp, xwd, rgb, and other formats are supported)" EOL
" // OR with an integer value string (max = Graphic3d_Texture2D::NumberOfTexturesExt())" EOL
" // which will indicate use of predefined texture of this number" EOL
" // aTFileName = ..." EOL
"" EOL
" aTShape->SetTextureFileName(aTFileName);" EOL
"" EOL
" // do other initialization of AIS_TexturedShape" EOL
" Standard_Real nRepeat;" EOL
" Standard_Boolean toRepeat;" EOL
" Standard_Boolean toScale;" EOL
" // initialize aRepeat, toRepeat, toScale ..." EOL
"" EOL
" aTShape->SetTextureMapOn();" EOL
" aTShape->SetTextureRepeat(toRepeat, nRepeat, nRepeat);" EOL
" aTShape->SetTexturesExtcale(toScale);" EOL
" " EOL
" // mode 3 is \"textured\" mode of AIS_TexturedShape, " EOL
" // other modes will display the \"normal\", non-textured shape," EOL
" // in wireframe(1) or shaded(2) modes correspondingly" EOL
" aTShape->SetDisplayMode(3); " EOL
"" EOL
" // V3d_TEX_ALL constant must be set as surface detail" EOL
" // for current view to see AIS_TexturedShape" EOL
" myCurrentView->SetSurfaceDetail(V3d_TEX_ALL);" EOL);
// CString text(Message.ToCString());
getDocument()->ClearDialog();
getDocument()->SetDialogTitle("Change face color");
getDocument()->AddTextInDialog(Message);
}
//////////////////////////////////////////////////////////////////////
// Sample functions
//////////////////////////////////////////////////////////////////////
//================================================================
// Function : TexturesExt_Presentation::Texturize
// display an AIS_TexturedShape based on a given shape with texture with given filename
// filename can also be an integer value ("2", "5", etc.), in this case
// a predefined texture from Graphic3d_NameOfTexture2D with number = this value
// is loaded.
//================================================================
Handle_AIS_TexturedShape TexturesExt_Presentation::Texturize(const TopoDS_Shape& aShape,
TCollection_AsciiString aTFileName,
Standard_Real toScaleU,
Standard_Real toScaleV,
Standard_Real toRepeatU,
Standard_Real toRepeatV,
Standard_Real originU,
Standard_Real originV)
{
// create a textured presentation object for aShape
Handle_AIS_TexturedShape aTShape = new AIS_TexturedShape(aShape);
TCollection_AsciiString TFileName;
// load texture from file if it is not an integer value
// integer value indicates a number of texture in predefined TexturesExt enumeration
CString initfile(((OCC_BaseApp*) AfxGetApp())->GetInitDataDir());
initfile += "\\Data\\";
if (!aTFileName.IsIntegerValue())
{
initfile += aTFileName.ToCString();
}
aTShape->SetTextureFileName((Standard_CString)(LPCTSTR)initfile);
// do other initialization of AIS_TexturedShape
aTShape->SetTextureMapOn();
aTShape->SetTextureScale(Standard_True, toScaleU, toScaleV);
aTShape->SetTextureRepeat(Standard_True, toRepeatU, toRepeatV);
aTShape->SetTextureOrigin(Standard_True, originU, originV);
aTShape->SetDisplayMode(3); // mode 3 is "textured" mode
return aTShape;
}
//================================================================
// Function : TexturesExt_Presentation::loadShape
// loads a shape from a given brep file from data dir into a given TopoDS_Shape object
//================================================================
Standard_Boolean TexturesExt_Presentation::loadShape(TopoDS_Shape& aShape,
TCollection_AsciiString aFileName)
{
// create a TopoDS_Shape -> read from a brep file
CString initfile(((OCC_BaseApp*) AfxGetApp())->GetInitDataDir());
initfile += "\\Data\\";
initfile += aFileName.ToCString();
TCollection_AsciiString Path((Standard_CString)(LPCTSTR)initfile);
BRep_Builder aBld;
//Standard_Boolean isRead = BRepTools::Read (aShape, aPath.ToCString(), aBld);
//if (!isRead)
// isRead = BRepTools::Read (aShape, bPath.ToCString(), aBld);
Standard_Boolean isRead = BRepTools::Read (aShape, Path.ToCString(), aBld);
if (!isRead)
{
Path += " was not found. The sample can not be shown.";
getDocument()->UpdateResultMessageDlg("Textured Shape", Path.ToCString());
return Standard_False;
}
return Standard_True;
}
//================================================================
// Function : lightsOnOff
// Purpose : 6 lights are used for a brighter demonstration of textured shapes
// call lightsOnOff(false) before showing normal shape
// call lightsOnOff(true) before showing textured shape
//================================================================
void TexturesExt_Presentation::lightsOnOff(Standard_Boolean isOn)
{
static Handle_V3d_Light aLight1 = new V3d_DirectionalLight(getViewer(), V3d_XnegYposZneg);
static Handle_V3d_Light aLight2 = new V3d_DirectionalLight(getViewer(), V3d_XnegYnegZpos);
static Handle_V3d_Light aLight3 = new V3d_DirectionalLight(getViewer(), V3d_XposYnegZpos);
static Handle_V3d_Light aLight4 = new V3d_DirectionalLight(getViewer(), V3d_XnegYnegZneg);
static Handle_V3d_Light aLight5 = new V3d_DirectionalLight(getViewer(), V3d_XnegYposZpos);
static Handle_V3d_Light aLight6 = new V3d_DirectionalLight(getViewer(), V3d_XposYposZpos);
if (isOn)
{
getViewer()->SetLightOn(aLight1);
getViewer()->SetLightOn(aLight2);
getViewer()->SetLightOn(aLight3);
getViewer()->SetLightOn(aLight4);
getViewer()->SetLightOn(aLight5);
getViewer()->SetLightOn(aLight6);
}
else
{
getViewer()->SetLightOff(aLight1);
getViewer()->SetLightOff(aLight2);
getViewer()->SetLightOff(aLight3);
getViewer()->SetLightOff(aLight4);
getViewer()->SetLightOff(aLight5);
getViewer()->SetLightOff(aLight6);
}
}
//================================================================
// Function : TexturesExt_Presentation::sampleBottle
// Purpose :
//================================================================
void TexturesExt_Presentation::sampleBottle()
{
TopoDS_Shape aShape;
if (!loadShape(aShape, "bottle.brep"))
return;
// resize and move the shape to the center of the viewer
gp_Trsf aTrsf1, aTrsf2;
aTrsf1.SetScale(gp_Pnt(0,0,0), 0.8);
aTrsf2.SetTranslation(gp_Pnt(0,0,0),gp_Pnt(0,0,-20));
aTrsf1.Multiply(aTrsf2);
BRepBuilderAPI_Transform Transformer(aTrsf1);
Transformer.Perform(aShape);
aShape = Transformer.Shape();
TopTools_IndexedMapOfShape aFaces;
TopExp::MapShapes(aShape, TopAbs_FACE, aFaces);
// display original shape in shaded display mode
Handle_AIS_Shape aShapeIO = drawShape(aShape, Graphic3d_NOM_BRASS, Standard_False);
getAISContext()->SetDisplayMode(aShapeIO, AIS_Shaded, Standard_False);
DISP(aShapeIO);
Handle_AIS_TexturedShape aTFace1 = Texturize(aFaces(16), "carrelage1.gif", 1, 1, 3, 2);
//offset visual shape to avoid overlapping
aTFace1->SetPolygonOffsets(Aspect_POM_Fill, 0.99, -2.0);
DISP(aTFace1);
Handle_AIS_TexturedShape aTFace2 = Texturize(aFaces(21), "carrelage1.gif", 1, 1, 3, 2);
//offset a visual shape to avoid overlapping
aTFace2->SetPolygonOffsets(Aspect_POM_Fill, 0.99, -2.0);
DISP(aTFace2);
getViewer()->Update();
}
//================================================================
// Function : TexturesExt_Presentation::sampleLand
// Purpose :
//================================================================
void TexturesExt_Presentation::sampleTerrain()
{
TopoDS_Shape aShape;
if (!loadShape(aShape, "terrain.brep"))
return;
// a part of the landscape is textured
TopTools_IndexedMapOfShape aFaces;
TopExp::MapShapes(aShape, TopAbs_FACE, aFaces);
// TopLoc_Location aLoc;
// Handle_Geom_Surface aSur = BRep_Tool::Surface(TopoDS::Face(aFaces(1)), aLoc);
// Standard_Real u1,u2,v1,v2;
// aSur->Bounds(u1,u2,v1,v2);
// gp_Pnt aPnt = aSur->Value(u1, v1);
gp_Pnt aPnt(82100,80300,10940);// point at u1,v1
// resize and move the shape to the center of the viewer
gp_Trsf aMoveTrsf;
gp_Ax3 New(gp_Pnt(-30,-30, 0),gp_Dir(0,0,1));
gp_Ax3 Current(aPnt,gp_Dir(0,0,1));
aMoveTrsf.SetDisplacement(Current, New);
gp_Trsf aScaleTrsf;
aScaleTrsf.SetScale(aPnt,0.0075);
BRepBuilderAPI_Transform aTransform(aMoveTrsf*aScaleTrsf);
aTransform.Perform(aFaces(1));
aShape = aTransform;
getAISContext()->Display(Texturize(aShape, "terrain.gif"));
}
//================================================================
// Function : moveScale
// Purpose : move a shape a little left and scale it to 15%.
//================================================================
static void moveScale(TopoDS_Shape& aShape)
{
gp_Trsf aMoveTrsf;
gp_Ax3 New(gp_Pnt(-30,-30, -10),gp_Dir(0,0,1));
gp_Ax3 Current(gp_Pnt(0,0,0),gp_Dir(0,0,1));
aMoveTrsf.SetDisplacement(Current, New);
gp_Trsf aScaleTrsf;
aScaleTrsf.SetScale(gp_Pnt(0,0,0),0.15);
BRepBuilderAPI_Transform aTransform(aMoveTrsf*aScaleTrsf);
aTransform.Perform(aShape);
aShape = aTransform;
}
//================================================================
// Function : TexturesExt_Presentation::sampleKitchen
// Purpose : kitchen with texturized items in it.
//================================================================
void TexturesExt_Presentation::sampleKitchen()
{
TopoDS_Shape aShape;
if (!loadShape(aShape, "Kitchen\\Room.brep"))
return;
gp_Trsf aTrsf;
gp_Ax3 NewCoordSystem (gp_Pnt(-1,-1, -1),gp_Dir(0,0,1));
gp_Ax3 CurrentCoordSystem(gp_Pnt(0,0,0),gp_Dir(0,0,1));
aTrsf.SetDisplacement(CurrentCoordSystem, NewCoordSystem);
aShape.Location(TopLoc_Location(aTrsf));
moveScale(aShape);
// draw kitchen room whithout one wall (to better see the insides)
TopTools_IndexedMapOfShape aFaces;
TopExp::MapShapes(aShape, TopAbs_FACE, aFaces);
Standard_Integer nbFaces = aFaces.Extent();
// create a wooden kitchen floor
// the floor's face will be textured with texture from chataignier.gif
DISP(Texturize(aFaces(5),"plancher.gif",1,1,2,1));
// texturize other faces of the room with texture from wallpaper.gif (walls)
DISP(Texturize(aFaces(1),"wallpaper.gif",1,1,8,6));
DISP(Texturize(aFaces(3),"wallpaper.gif",1,1,8,6));
DISP(Texturize(aFaces(4),"wallpaper.gif",1,1,8,6));
// DISP(drawShape(aFaces(1), Quantity_NOC_LIGHTPINK, Standard_False));
// DISP(drawShape(aFaces(3), Quantity_NOC_LIGHTPINK, Standard_False));
// DISP(drawShape(aFaces(4), Quantity_NOC_LIGHTPINK, Standard_False));
// texturize furniture items with "wooden" texture
if (loadShape(aShape, "Kitchen\\MODERN_Table_1.brep"))
{
moveScale(aShape);
DISP(Texturize(aShape, "chataignier.gif"));
}
if (loadShape(aShape, "Kitchen\\MODERN_Chair_1.brep"))
{
moveScale(aShape);
DISP(Texturize(aShape, "chataignier.gif"));
}
if (loadShape(aShape, "Kitchen\\MODERN_Cooker_1.brep"))
{
moveScale(aShape);
aFaces.Clear();
TopExp::MapShapes(aShape, TopAbs_FACE, aFaces);
nbFaces = aFaces.Extent();
for (Standard_Integer i = 1; i <= nbFaces; i++)
{
if (i >= 59)
DISP(drawShape(aFaces(i), Graphic3d_NOM_STEEL, Standard_False));
else if (i >= 29)
DISP(drawShape(aFaces(i), Graphic3d_NOM_ALUMINIUM, Standard_False));
else if (i == 28)
DISP(Texturize(aFaces(i), "cookerplate.gif"));
else
DISP(Texturize(aFaces(i), "chataignier.gif"));
}
}
if (loadShape(aShape, "Kitchen\\MODERN_Cooker_1_opened.brep"))
{
moveScale(aShape);
DISP(Texturize(aShape, "chataignier.gif"));
}
if (loadShape(aShape, "Kitchen\\MODERN_Exhaust_1.brep"))
{
moveScale(aShape);
DISP(drawShape(aShape, Graphic3d_NOM_STONE, Standard_False));
}
if (loadShape(aShape, "Kitchen\\MODERN_MVCooker_1.brep"))
{
moveScale(aShape);
DISP(drawShape(aShape, Graphic3d_NOM_SILVER, Standard_False));
}
if (loadShape(aShape, "Kitchen\\MODERN_MVCooker_1_opened.brep"))
{
moveScale(aShape);
DISP(drawShape(aShape, Graphic3d_NOM_SILVER, Standard_False));
}
if (loadShape(aShape, "Kitchen\\MODERN_Sink_1.brep"))
{
moveScale(aShape);
aFaces.Clear();
TopExp::MapShapes(aShape, TopAbs_FACE, aFaces);
nbFaces = aFaces.Extent();
for (Standard_Integer i = 1; i <= nbFaces; i++)
{
if (i < 145)
DISP(drawShape(aFaces(i), Graphic3d_NOM_ALUMINIUM, Standard_False));
else if (i == 145)
DISP(Texturize(aFaces(i), "cookerplate.gif"));
else
DISP(Texturize(aFaces(i), "chataignier.gif"));
}
}
if (loadShape(aShape, "Kitchen\\MODERN_Sink_1_opened.brep"))
{
moveScale(aShape);
DISP(Texturize(aShape, "chataignier.gif"));
}
if (loadShape(aShape, "Kitchen\\MODERN_Refrigerator_1.brep"))
{
moveScale(aShape);
DISP(drawShape(aShape, Graphic3d_NOM_CHROME, Standard_False));
}
if (loadShape(aShape, "Kitchen\\MODERN_Refrigerator_1_opened.brep"))
{
moveScale(aShape);
DISP(drawShape(aShape, Graphic3d_NOM_CHROME, Standard_False));
}
getViewer()->Update();
}

View File

@@ -0,0 +1,59 @@
// TexturesExt_Presentation.h: interface for the TexturesExt_Presentation class.
// Creation of textural presentation of shape
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_TexturesExt_Presentation_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)
#define AFX_TexturesExt_Presentation_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "OCCDemo_Presentation.h"
class TopoDS_Shape;
class TCollection_AsciiString;
class Handle_AIS_TexturedShape;
class TexturesExt_Presentation : public OCCDemo_Presentation
{
public:
// Construction
TexturesExt_Presentation();
public:
// Iteration on samples
virtual void DoSample();
// one phase of iterations
virtual void Init();
private:
// display an AIS_TexturedShape based on a given shape with texture with given filename
// filename can also be an integer value ("2", "5", etc.), in this case
// a predefined texture from Graphic3d_NameOfTexture2D with number = this value
// is loaded.
Handle_AIS_TexturedShape Texturize(
const TopoDS_Shape& aShape, TCollection_AsciiString aTFileName,
Standard_Real toScaleU=1.0, Standard_Real toScaleV=1.0,
Standard_Real toRepeatU=1.0, Standard_Real toRepeatV=1.0,
Standard_Real originU=0.0, Standard_Real originV=0.0);
// loads a shape from a given brep file from data dir into a given TopoDS_Shape object
Standard_Boolean loadShape(TopoDS_Shape&, TCollection_AsciiString);
// turns 6 diretional lights on/off for brighter demonstration
void lightsOnOff(Standard_Boolean isOn);
// Sample functions
void sampleBottle();
void sampleTerrain();
void sampleKitchen();
private:
// Array of pointers to sample functions
typedef void (TexturesExt_Presentation::*PSampleFuncType)();
static const PSampleFuncType SampleFuncs[];
};
#endif // !defined(AFX_TexturesExt_Presentation_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)

View File

@@ -0,0 +1,291 @@
// TrihedronDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Viewer3dApp.h"
#include "Viewer3dView.h"
#include "TrihedronDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
void round(double &value, unsigned char digits)
{
char neg = 1;
if(value < 0){
neg = (-1);
value *= (-1);
}
double inc(1.0);
while(digits){ inc*=10; --digits; }
double dg(value*inc*100);
value = floor(floor(dg)/100);
if((dg-(value*100)) > 49.9) value+=1;
value = (value*neg)/inc;
}
/////////////////////////////////////////////////////////////////////////////
// CTrihedronDlg dialog
//CTrihedronDlg::CTrihedronDlg(CWnd* pParent /*=NULL*/)
//: CDialog(CTrihedronDlg::IDD, pParent)
CTrihedronDlg::CTrihedronDlg(Handle_V3d_View Current_V3d_View, CViewer3dDoc* pDoc, CWnd* pParent /*=NULL*/)
: CDialog(CTrihedronDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CTrihedronDlg)
m_TrihedronScale = 0.1;
myDoc=pDoc;
myCurrent_V3d_View = Current_V3d_View;
/*m_*/Color = Quantity_NOC_WHITE;
/*m_*/Position = Aspect_TOTP_LEFT_UPPER;
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CTrihedronDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTrihedronDlg)
DDX_Control(pDX, IDC_COMBOTRIHEDRPOS, m_ComboTrihedronPosList);
DDX_Control(pDX, IDC_COMBOTRIHEDRCOLOR, m_ComboTrihedronColorList);
DDX_Text(pDX, IDC_EDITTRIHEDRSCALE, m_TrihedronScale);
DDV_MinMaxDouble(pDX, m_TrihedronScale, 0., 1.);
DDX_Control(pDX, IDC_SPINTRIHEDRSCALE, m_SpinTrihedronScale);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTrihedronDlg, CDialog)
//{{AFX_MSG_MAP(CTrihedronDlg)
ON_CBN_SELCHANGE(IDC_COMBOTRIHEDRCOLOR, OnSelchangeCombotrihedrcolor)
ON_CBN_SELCHANGE(IDC_COMBOTRIHEDRPOS, OnSelchangeCombotrihedrpos)
ON_EN_CHANGE(IDC_EDITTRIHEDRSCALE, OnChangeEdittrihedrscale)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINTRIHEDRSCALE, OnDeltaposSpintrihedrscale)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTrihedronDlg message handlers
void CTrihedronDlg::OnSelchangeCombotrihedrcolor()
{
UpdateData(TRUE);
int a = m_ComboTrihedronColorList.GetCurSel();
if( a==0)
Color=Quantity_NOC_BLACK;
else if(a==1)
Color=Quantity_NOC_MATRABLUE;
else if(a==2)
Color=Quantity_NOC_MATRAGRAY;
// else if(a==3)
// Color=Quantity_NOC_ALICEBLUE;
else if(a==3)
Color=Quantity_NOC_ANTIQUEWHITE;
//else if(a==4)
// Color=Quantity_NOC_BISQUE;
UpdateData(FALSE);
myCurrent_V3d_View->TriedronDisplay(Position, Color, m_TrihedronScale);
myCurrent_V3d_View->Update();
}
void CTrihedronDlg::OnSelchangeCombotrihedrpos()
{
UpdateData(TRUE);
int b = m_ComboTrihedronPosList.GetCurSel();
if( b==0)
Position=Aspect_TOTP_CENTER;
else if(b==1)
Position=Aspect_TOTP_LEFT_LOWER;
else if(b==2)
Position=Aspect_TOTP_LEFT_UPPER;
else if(b==3)
Position=Aspect_TOTP_RIGHT_LOWER;
else if(b==4)
Position=Aspect_TOTP_RIGHT_UPPER;
UpdateData(FALSE);
myCurrent_V3d_View->TriedronDisplay(Position, Color, m_TrihedronScale);
myCurrent_V3d_View->Update();
}
BOOL CTrihedronDlg::OnInitDialog()
{
CDialog::OnInitDialog();
UpdateData(TRUE);
// Initializing the ComboBox : Position
m_ComboTrihedronPosList.InsertString(-1,"Center");
m_ComboTrihedronPosList.InsertString(-1,"Left Lower");
m_ComboTrihedronPosList.InsertString(-1,"Left Upper");
m_ComboTrihedronPosList.InsertString(-1,"Right Lower");
m_ComboTrihedronPosList.InsertString(-1,"Right Upper");
// Initializing the ComboBox : Color
/*
m_ComboTrihedronColorList.InsertString(-1,"BLACK");
m_ComboTrihedronColorList.InsertString(-1,"MATRABLUE");
m_ComboTrihedronColorList.InsertString(-1,"MATRAGRAY");
m_ComboTrihedronColorList.InsertString(-1,"ALICE BLUE");
m_ComboTrihedronColorList.InsertString(-1,"WHITE");
m_ComboTrihedronColorList.InsertString(-1,"BISQUE");
*/
m_ComboTrihedronColorList.InsertString(-1,"Black");
m_ComboTrihedronColorList.InsertString(-1,"Blue");
m_ComboTrihedronColorList.InsertString(-1,"Gray");
m_ComboTrihedronColorList.InsertString(-1,"White");
//m_ComboTrihedronColorList.InsertString(-1,"Bisque");
UpdateData(FALSE);
/* if (CDemoVisualizationView::slinitialisation())
{
AfxMessageBox("debut");
if(m_Position==Aspect_TOTP_CENTER)
m_ComboTrihedronPosList.SetCurSel(0);
else if(m_Position==Aspect_TOTP_LEFT_LOWER)
m_ComboTrihedronPosList.SetCurSel(1);
else if(m_Position==Aspect_TOTP_LEFT_UPPER)
m_ComboTrihedronPosList.SetCurSel(2);
else if(m_Position==Aspect_TOTP_RIGHT_LOWER)
m_ComboTrihedronPosList.SetCurSel(3);
else if(m_Position==Aspect_TOTP_RIGHT_UPPER)
m_ComboTrihedronPosList.SetCurSel(4);
if(m_Color==Quantity_NOC_BLACK)
m_ComboTrihedronColorList.SetCurSel(0);
else if(m_Color==Quantity_NOC_MATRABLUE)
m_ComboTrihedronColorList.SetCurSel(1);
else if(m_Color==Quantity_NOC_MATRAGRAY)
m_ComboTrihedronColorList.SetCurSel(2);
else if(m_Color==Quantity_NOC_ALICEBLUE)
m_ComboTrihedronColorList.SetCurSel(3);
else if(m_Color==Quantity_NOC_WHITE)
m_ComboTrihedronColorList.SetCurSel(4);
else if(m_Color==Quantity_NOC_BISQUE)
m_ComboTrihedronColorList.SetCurSel(5);
Position = m_Position;
Color = m_Color;
myCurrent_V3d_View->TriedronDisplay(Position, Color, m_TrihedronScale);
myCurrent_V3d_View->Update();
Initialisation = Standard_False;
}
else
{*/
if(Position==Aspect_TOTP_CENTER)
m_ComboTrihedronPosList.SetCurSel(0);
else if(Position==Aspect_TOTP_LEFT_LOWER)
m_ComboTrihedronPosList.SetCurSel(1);
else if(Position==Aspect_TOTP_LEFT_UPPER)
m_ComboTrihedronPosList.SetCurSel(2);
else if(Position==Aspect_TOTP_RIGHT_LOWER)
m_ComboTrihedronPosList.SetCurSel(3);
else if(Position==Aspect_TOTP_RIGHT_UPPER)
m_ComboTrihedronPosList.SetCurSel(4);
if(Color==Quantity_NOC_BLACK)
m_ComboTrihedronColorList.SetCurSel(0);
else if(Color==Quantity_NOC_MATRABLUE)
m_ComboTrihedronColorList.SetCurSel(1);
else if(Color==Quantity_NOC_MATRAGRAY)
m_ComboTrihedronColorList.SetCurSel(2);
// else if(Color==Quantity_NOC_ALICEBLUE)
// m_ComboTrihedronColorList.SetCurSel(3);
else if(Color==Quantity_NOC_WHITE)
m_ComboTrihedronColorList.SetCurSel(3);
//else if(Color==Quantity_NOC_BISQUE)
// m_ComboTrihedronColorList.SetCurSel(4);
myCurrent_V3d_View->TriedronDisplay(Position, Color, m_TrihedronScale);
myCurrent_V3d_View->Update();
// }
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CTrihedronDlg::OnDeltaposSpintrihedrscale(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
if (pNMUpDown->iDelta >= 1)
pNMUpDown->iDelta = 1;
else
pNMUpDown->iDelta = -1;
if ((pNMUpDown->iDelta > 0) && (m_TrihedronScale > 0))
m_TrihedronScale = m_TrihedronScale - (pNMUpDown->iDelta)*0.01;
if ((pNMUpDown->iDelta < 0) && (m_TrihedronScale < 1))
m_TrihedronScale = m_TrihedronScale - (pNMUpDown->iDelta)*0.01;
m_TrihedronScale = m_TrihedronScale*100;
m_TrihedronScale = floor(m_TrihedronScale );
m_TrihedronScale = m_TrihedronScale /100;
// round(m_TrihedronScale,2);
if (fabs(m_TrihedronScale) < 0.001)
m_TrihedronScale =0;
UpdateData(FALSE);
myCurrent_V3d_View->TriedronDisplay(Position, Color, m_TrihedronScale);
*pResult = 0;
myCurrent_V3d_View->Update();
}
void CTrihedronDlg::OnChangeEdittrihedrscale()
{
if (UpdateData()){
myCurrent_V3d_View->TriedronDisplay(Position, Color, m_TrihedronScale);
myCurrent_V3d_View->Update();
}
}
void CTrihedronDlg::OnCancel()
{
myCurrent_V3d_View->TriedronErase();
myCurrent_V3d_View->Update();
myDoc -> SetMyStaticTrihedronAxisIsDisplayed(FALSE);
// Initialisation = Standard_True;
CDialog::OnCancel();
}
void CTrihedronDlg::OnOK()
{
myDoc -> SetMyStaticTrihedronAxisIsDisplayed(TRUE);
CDialog::OnOK();
}

View File

@@ -0,0 +1,83 @@
#if !defined(AFX_TRIHEDRONDLG_H__1917B30F_3102_11D6_BD0D_00A0C982B46F__INCLUDED_)
#define AFX_TRIHEDRONDLG_H__1917B30F_3102_11D6_BD0D_00A0C982B46F__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// TrihedronDlg.h : header file
//
#include "Viewer3dDoc.h"
#include <V3d_View.hxx>
#include <Aspect.hxx>
#include <Quantity_NameOfColor.hxx>
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
// CTrihedronDlg dialog
class CTrihedronDlg : public CDialog
{
// Construction
public:
CTrihedronDlg(CWnd* pParent = NULL); // standard constructor
CTrihedronDlg(Handle_V3d_View Current_V3d_View, CViewer3dDoc* pDoc, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CTrihedronDlg)
enum { IDD = IDD_TRIHEDRON };
CComboBox m_ComboTrihedronPosList;
CComboBox m_ComboTrihedronColorList;
double m_TrihedronScale;
CSpinButtonCtrl m_SpinTrihedronScale;
Quantity_NameOfColor m_Color;
Aspect_TypeOfTriedronPosition m_Position;
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTrihedronDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CTrihedronDlg)
afx_msg void OnSelchangeCombotrihedrcolor();
afx_msg void OnSelchangeCombotrihedrpos();
afx_msg void OnChangeEdittrihedrscale();
afx_msg void OnDeltaposSpintrihedrscale(NMHDR* pNMHDR, LRESULT* pResult);
virtual BOOL OnInitDialog();
virtual void OnCancel();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
Handle_V3d_View myCurrent_V3d_View;
CViewer3dDoc* myDoc;
Quantity_NameOfColor Color ;
Aspect_TypeOfTriedronPosition Position;
/*
public:
static Standard_Boolean Initialisation;
static Standard_Boolean GetInitialisation() {return Initialisation;};
*/
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_TRIHEDRONDLG_H__1917B30F_3102_11D6_BD0D_00A0C982B46F__INCLUDED_)

Binary file not shown.

View File

@@ -0,0 +1,598 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
// Generated Help ID header file
#define APSTUDIO_HIDDEN_SYMBOLS
#include "resource.hm"
#undef APSTUDIO_HIDDEN_SYMBOLS
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "..\..\Common\res\OCC_Resource.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Russian resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_SETOFFSETS DIALOGEX 442, 45, 187, 60
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW
CAPTION "Set offsets"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "Slider2",IDC_SLIDER_OFFSETFACTOR,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,39,14,100,15
LTEXT "Factor:",IDC_STATIC,13,17,23,15
LTEXT "Units:",IDC_STATIC,13,35,19,8
CONTROL "Slider3",IDC_SLIDER_OFFSETUNITS,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,39,32,100,15
GROUPBOX "Offset parameters",IDC_STATIC,7,6,173,47
EDITTEXT IDC_EDIT_OFFSETFACTOR,148,14,22,14,ES_AUTOHSCROLL | ES_NUMBER
EDITTEXT IDC_EDIT_OFFSETUNITS,148,32,22,14,ES_AUTOHSCROLL | ES_NUMBER
END
IDD_TRIHEDRON DIALOG 0, 0, 138, 95
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Triedron settings"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,21,75,50,14
PUSHBUTTON "Cancel",IDCANCEL,73,75,50,14
COMBOBOX IDC_COMBOTRIHEDRPOS,38,8,92,60,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBOTRIHEDRCOLOR,38,29,92,78,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_EDITTRIHEDRSCALE,38,51,33,12,ES_CENTER | ES_AUTOHSCROLL
LTEXT "Color:",IDC_STATIC,8,31,20,8
LTEXT "Position:",IDC_STATIC,8,10,28,8
LTEXT "Scale:",IDC_STATIC,8,53,24,10
CONTROL "Spin1",IDC_SPINTRIHEDRSCALE,"msctls_updown32",UDS_AUTOBUDDY | UDS_ARROWKEYS,70,51,11,12
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_SETOFFSETS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 180
TOPMARGIN, 6
BOTTOMMARGIN, 53
END
END
#endif // APSTUDIO_INVOKED
#endif // Russian resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ZCLIPPING DIALOG 0, 0, 180, 95
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "ZClipping"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,13,68,50,14
PUSHBUTTON "Cancel",IDCANCEL,70,68,50,14
CONTROL "Slider1",IDC_SLIDER_ZCLIPPINGDEPTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,6,97,15
LTEXT "Depth:",IDC_STATIC,13,9,22,8
GROUPBOX "",IDC_STATIC,7,0,166,44
EDITTEXT IDC_EDIT_ZCLIPPINGDEPTH,131,7,34,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Slider2",IDC_SLIDER_ZCLIPPINGWIDTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,25,97,15
LTEXT "Width:",IDC_STATIC,13,28,22,8
EDITTEXT IDC_EDIT_ZCLIPPINGWIDTH,131,26,34,14,ES_AUTOHSCROLL | ES_NUMBER
COMBOBOX IDC_COMBO_ZCLIPPINGTYPE,39,47,80,55,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Type:",IDC_STATIC,13,49,19,8
GROUPBOX "",IDC_STATIC,7,59,166,29
END
IDD_ZCUEING DIALOG 0, 0, 180, 95
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "ZCueing"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,13,68,50,14
PUSHBUTTON "Cancel",IDCANCEL,70,68,50,14
CONTROL "Slider1",IDC_SLIDER_ZCUEINGDEPTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,6,97,15
LTEXT "Depth:",-1,13,9,22,8
GROUPBOX "",-1,7,0,166,44
EDITTEXT IDC_EDIT_ZCUEINGDEPTH,131,7,34,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Slider2",IDC_SLIDER_ZCUEINGWIDTH,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,25,97,15
LTEXT "Width:",-1,13,28,22,8
EDITTEXT IDC_EDIT_ZCUEINGWIDTH,131,26,34,14,ES_AUTOHSCROLL | ES_NUMBER
GROUPBOX "",-1,7,59,166,29
CONTROL "Cueing ON/OFF",IDC_CHECK_CUEINGONOFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,49,67,10
END
IDD_SHADINGMODEL DIALOG 0, 0, 60, 66
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "ShadingModel"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "COLOR",IDC_SHADINGMODEL_COLOR,7,7,46,16
PUSHBUTTON "FLAT",IDC_SHADINGMODEL_FLAT,7,25,46,15
PUSHBUTTON "GOURAUD",IDC_SHADINGMODEL_GOURAUD,7,43,46,16
END
IDD_MODELCLIPPING DIALOG 0, 0, 180, 74
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Model clipping"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,13,47,50,14
PUSHBUTTON "Cancel",IDCANCEL,70,47,50,14
CONTROL "Slider1",IDC_SLIDER_MODELCLIPPING_Z,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,21,6,97,15
LTEXT "Z:",-1,12,10,8,8
GROUPBOX "",-1,7,0,166,25
EDITTEXT IDC_EDIT_MODELCLIPPING_Z,118,7,34,14,ES_AUTOHSCROLL | ES_NUMBER
GROUPBOX "",-1,7,38,166,29
CONTROL "Model clipping ON/OFF",IDC_CHECK_MODELCLIPPINGONOFF,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,28,91,10
END
IDD_RADIUS DIALOGEX 0, 0, 151, 82
STYLE DS_SETFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Radius"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,61,50,14
PUSHBUTTON "Cancel",IDCANCEL,94,61,50,14
CONTROL "Spin1",IDC_SPIN_RADIUS,"msctls_updown32",UDS_ARROWKEYS,98,43,11,14
EDITTEXT IDC_EDIT_RADIUS,48,42,45,13,ES_AUTOHSCROLL | NOT WS_TABSTOP
CTEXT "Radius Fillet",IDC_RadiusFillet,33,20,94,18,0,WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE,HIDC_RadiusFillet
END
IDD_ISOS DIALOG 0, 0, 161, 66
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Isos"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,44,50,14
PUSHBUTTON "Cancel",IDCANCEL,104,44,50,14
LTEXT "U Isos Number",IDC_ISOU,31,13,48,8
LTEXT "V Isos Number",IDC_ISOV,31,28,47,8
EDITTEXT IDC_EDIT_ISOU,93,7,40,14,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_ISOV,93,24,40,12,ES_AUTOHSCROLL
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""..\\..\\Common\\res\\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
//
IDR_MAINFRAME BITMAP "..//res//Toolbar.bmp"
IDR_TB_AIS BITMAP "..//res//AIS_TB.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//
IDR_MAINFRAME TOOLBAR 20, 20
BEGIN
BUTTON ID_FILE_NEW
SEPARATOR
BUTTON ID_CIRCLE
BUTTON ID_LINE
BUTTON ID_BOX
BUTTON ID_Cylinder
BUTTON ID_SPHERE
SEPARATOR
BUTTON ID_OVERLAPPED_BOX
BUTTON ID_OVERLAPPED_CYLINDER
BUTTON ID_OVERLAPPED_SPHERE
BUTTON ID_POLYGON_OFFSETS
SEPARATOR
BUTTON ID_ERASEALL
SEPARATOR
BUTTON ID_SPOT_LIGHT
BUTTON ID_POSITIONAL_LIGHT
BUTTON ID_DIRECTIONAL_LIGHT
BUTTON ID_AMBIENT_LIGHT
BUTTON ID_CLEAR_LIGHTS
SEPARATOR
BUTTON ID_ZCLIPPING
BUTTON ID_ZCUEING
BUTTON ID_SCALE
SEPARATOR
BUTTON ID_NBISOS
BUTTON ID_SHADINGMODEL
BUTTON ID_ANTIALIASINGONOFF
SEPARATOR
BUTTON ID_MODELCLIPPING
SEPARATOR
BUTTON ID_VERTICES
BUTTON ID_EDGES
BUTTON ID_FACES
BUTTON ID_NEUTRAL
SEPARATOR
BUTTON ID_FILLET3D
SEPARATOR
BUTTON ID_TEXTURE_ON
BUTTON ID_BUTTONStart
BUTTON ID_BUTTONPrev
BUTTON ID_BUTTONRepeat
BUTTON ID_BUTTONNext
BUTTON ID_BUTTONEnd
SEPARATOR
BUTTON ID_DUMP_VIEW
SEPARATOR
BUTTON ID_APP_ABOUT
END
IDR_TB_AIS TOOLBAR 20, 20
BEGIN
BUTTON ID_OBJECT_WIREFRAME
BUTTON ID_OBJECT_SHADING
BUTTON ID_OBJECT_COLORED_MESH
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_MAINFRAME MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New\tCtrl+N", ID_FILE_NEW
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
END
POPUP "&Help"
BEGIN
MENUITEM "&About Viewer3d...", ID_APP_ABOUT
END
END
IDR_3DTYPE MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New\tCtrl+N", ID_FILE_NEW
MENUITEM "&Close", ID_FILE_CLOSE
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
END
POPUP "&Options"
BEGIN
POPUP "&Trihedron"
BEGIN
MENUITEM "&Static Trihedron...", ID_OPTIONS_TRIHEDRON_STATIC_TRIHEDRON
MENUITEM "&Dynamic Trihedron", ID_OPTIONS_TRIHEDRON_DYNAMIC_TRIHEDRON
END
END
POPUP "&Window"
BEGIN
MENUITEM "&New Window", ID_WINDOW_NEW
MENUITEM "&Cascade", ID_WINDOW_CASCADE
MENUITEM "&Tile", ID_WINDOW_TILE_HORZ
MENUITEM "&Arrange Icons", ID_WINDOW_ARRANGE
END
POPUP "&Help"
BEGIN
MENUITEM "&About Viewer3d...", ID_APP_ABOUT
END
END
IDR_Popup3D MENU
BEGIN
POPUP "BackGround"
BEGIN
MENUITEM "Background Color...", ID_Modify_ChangeBackground
END
POPUP "User cylinder"
BEGIN
MENUITEM "Change face color", ID_USERCYLINDER_CHANGEFACECOLOR
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
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Viewer MFC Application"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "Viewer"
VALUE "LegalCopyright", "Copyright (C) 1997"
VALUE "OriginalFilename", "Viewer.EXE"
VALUE "ProductName", "SampleViewer3d Application"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDR_MAINFRAME "Viewer3d"
IDR_3DTYPE "\nViewer3d\n\n\n\n.Document\n Document"
END
STRINGTABLE
BEGIN
ID_BOX "Create and display a box\nBox"
ID_Cylinder "Create and display a cylinder\nCylinder"
ID_SPHERE "Create and display a sphere\nSphere"
ID_ERASEALL "Remove all\nRemove all"
ID_AMBIENT_LIGHT "Create an ambient light source\nAmbient light"
ID_DIRECTIONAL_LIGHT "Create an directional light source\nDirectional light"
ID_POSITIONAL_LIGHT "Create an positional light source\nPositional light"
ID_SPOT_LIGHT "Create an spot light source\nSpot light"
ID_LIGHTOFF "Delete lights\nDelete lights"
ID_ZCLIPPING "ZClipping\nZClipping"
ID_ZCUEING "ZCueing\nZCueing"
ID_SHADINGMODEL "Define shading model\nShadingModel"
ID_ANTIALIASINGONOFF "Antialiasing ON/OFF\nAntialiasing"
END
STRINGTABLE
BEGIN
ID_CLEAR_LIGHTS "Clear all the light sources\nClear lights"
ID_MODELCLIPPING "ModelClipping\nModelClipping"
ID_OVERLAPPED_BOX "Create and display two overlapped boxes\nOverlapped boxes"
ID_BUTTON819 "Create and display two overlapped spheres\nOverlapped spheres"
ID_OVERLAPPED_SPHERE "Create and display two overlapped spheres\nOverlapped spheres"
ID_BUTTON821 "Create and display two overlapped boxes\nOverlapped boxes"
ID_OVERLAPPED_CYLINDER "Create and display two overlapped cylinders\nOverlapped cylinders"
ID_POLYGON_OFFSETS "Set/unset offsets\nSet/unset offsets"
ID_OBJECT_COLORED_MESH "Puts cylinder in colored mesh\nColored mesh"
ID_SCALE "Scale\nScale"
END
STRINGTABLE
BEGIN
ID_CIRCLE "Clear all the light sources\nClear lights"
ID_LINE "Create and display a line with standard tools\nLine"
ID_VERTICES "Set the selection mode to vertices\nVertices"
ID_EDGES "Set the selection mode to edges\nEdges"
ID_FACES "Set the selection modes to faces\nFaces"
ID_NEUTRAL "Neutral point for selection\nNeutral point"
ID_FILLET3D "Make a fillet between faces\nFillet"
ID_NBISOS "Set global isos number\nIsos"
ID_BUTTONStart "Press to go to the first sample\nFirst sample (Home)"
ID_BUTTONPrev "Press to go to the previous sample\nPrevious sample (PgUp)"
ID_BUTTONRepeat "Press to repeat the current sample\nRepeat sample (Space)"
ID_BUTTONNext "Press to go to the next sample\nNext sample (PgDn)"
ID_BUTTONEnd "Press to go to the last sample\nLast sample (End)"
END
STRINGTABLE
BEGIN
ID_DUMP_VIEW "Save current frame into a GIF file\nExport view to GIF (F12)"
ID_TEXTURE_ON "Run texture example\nRun texture example"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_SCALE DIALOG 0, 0, 186, 103
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Heterogeneous Scale"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,13,78,50,14
PUSHBUTTON "Cancel",IDCANCEL,70,78,50,14
GROUPBOX "",IDC_STATIC,7,69,166,29
GROUPBOX "",IDC_STATIC,7,0,166,65
CONTROL "Slider1",IDC_SLIDER_SCALEX,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,6,97,15
LTEXT "X:",IDC_STATIC,13,9,8,8
EDITTEXT IDC_EDIT_SCALEX,131,7,34,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Slider2",IDC_SLIDER_SCALEY,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,25,97,15
LTEXT "Y:",IDC_STATIC,13,28,8,8
EDITTEXT IDC_EDIT_SCALEY,131,26,34,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Slider2",IDC_SLIDER_SCALEZ,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,34,45,97,15
LTEXT "Z:",IDC_STATIC,13,48,8,8
EDITTEXT IDC_EDIT_SCALEZ,131,46,34,14,ES_AUTOHSCROLL | ES_NUMBER
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_SCALE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 96
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.K.) 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

View File

@@ -0,0 +1,92 @@
// Viewer3dApp.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Viewer3dApp.h"
#include <OCC_MainFrame.h>
#include <OCC_3dChildFrame.h>
#include "Viewer3dDoc.h"
#include "Viewer3dView.h"
/////////////////////////////////////////////////////////////////////////////
// CViewer3dApp
BEGIN_MESSAGE_MAP(CViewer3dApp, CWinApp)
//{{AFX_MSG_MAP(CViewer3dApp)
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()
/////////////////////////////////////////////////////////////////////////////
// CViewer3dApp construction
CViewer3dApp::CViewer3dApp()
{
SampleName = "Viewer3d"; //for about dialog
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CViewer3dApp object
CViewer3dApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CViewer3dApp initialization
BOOL CViewer3dApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
// Change the registry key under which our settings are stored.
// You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_3DTYPE,
RUNTIME_CLASS(CViewer3dDoc),
RUNTIME_CLASS(OCC_3dChildFrame), // custom MDI child frame
RUNTIME_CLASS(CViewer3dView));
AddDocTemplate(pDocTemplate);
// create main MDI Frame window
OCC_MainFrame* pMainFrame = new OCC_MainFrame(with_AIS_TB);
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The main window has been initialized, so show and update it.
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CViewer3dApp commands

View File

@@ -0,0 +1,34 @@
// Viewer3dApp.h : main header file for the Viewer3d application
//
#if !defined(AFX_VIEWER3DAPP_H__3045338E_3E75_11D7_8611_0060B0EE281E__INCLUDED_)
#define AFX_VIEWER3DAPP_H__3045338E_3E75_11D7_8611_0060B0EE281E__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <OCC_3dApp.h>
class CViewer3dApp : public OCC_3dApp
{
public:
CViewer3dApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CViewer3dApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VIEWER3DAPP_H__3045338E_3E75_11D7_8611_0060B0EE281E__INCLUDED_)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,155 @@
// Viewer3dDoc.h : interface of the CViewer3dDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_VIEWERDOC_H__4EF39FBA_4EBB_11D1_8D67_0800369C8A03__INCLUDED_)
#define AFX_VIEWERDOC_H__4EF39FBA_4EBB_11D1_8D67_0800369C8A03__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "OCCDemo_Presentation.h"
#include "OffsetDlg.h"
#include "OCC_3dDoc.h"
#include "ResultDialog.h"
#include "User_Cylinder.hxx"
#include <AIS_Trihedron.hxx>
#include <AIS_InteractiveContext.hxx>
#include <V3d_Viewer.hxx>
class COffsetDlg;
class OCCDemo_Presentation;
class CViewer3dDoc : public OCC_3dDoc
{
DECLARE_DYNCREATE(CViewer3dDoc)
protected: // create from serialization only
CViewer3dDoc();
void InitViewButtons();
void DoSample();
public:
void SetMyStaticTrihedronAxisIsDisplayed(BOOL IsDisplayed);
Handle_AIS_Shape GetBox();
Handle_AIS_Shape GetSphere();
Handle_User_Cylinder GetCylinder();
Handle_AIS_Shape GetOverlappedBox();
Handle_AIS_Shape GetOverlappedSphere();
Handle_AIS_Shape GetOverlappedCylinder();
void Start();
Standard_CString GetDataDir() {return myDataDir;}
static void Fit();
virtual ~CViewer3dDoc();
void UpdateResultMessageDlg(CString Title, TCollection_AsciiString aMessage);
virtual BOOL OnNewDocument();
virtual void Popup (const Standard_Integer x ,
const Standard_Integer y ,
const Handle(V3d_View)& aView );
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 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 );
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
BOOL myStaticTrihedronAxisIsDisplayed;
//{{AFX_MSG(CViewer3dDoc)
afx_msg void OnBox();
afx_msg void OnCylinder();
afx_msg void OnSphere();
afx_msg void OnRemoveAll();
afx_msg void OnNbisos();
afx_msg void OnFaces();
afx_msg void OnEdges();
afx_msg void OnVertices();
afx_msg void OnNeutral();
afx_msg void OnUsercylinderChangefacecolor();
afx_msg void OnFillet3d();
afx_msg void OnCircle();
afx_msg void OnLine();
afx_msg void OnOverlappedBox();
afx_msg void OnOverlappedCylinder();
afx_msg void OnOverlappedSphere();
afx_msg void OnPolygonOffsets();
afx_msg void OnUpdatePolygonOffsets(CCmdUI* pCmdUI);
afx_msg void OnUpdateCylinder(CCmdUI* pCmdUI);
afx_msg void OnUpdateSphere(CCmdUI* pCmdUI);
afx_msg void OnUpdateBox(CCmdUI* pCmdUI);
afx_msg void OnUpdateOverlappedCylinder(CCmdUI* pCmdUI);
afx_msg void OnUpdateOverlappedSphere(CCmdUI* pCmdUI);
afx_msg void OnUpdateOverlappedBox(CCmdUI* pCmdUI);
afx_msg void OnObjectRemove();
afx_msg void OnObjectErase();
afx_msg void OnObjectDisplayall();
afx_msg void OnObjectColoredMesh();
afx_msg void OnUpdateObjectColoredMesh(CCmdUI* pCmdUI);
afx_msg void OnUpdateObjectShading(CCmdUI* pCmdUI);
afx_msg void OnUpdateObjectWireframe(CCmdUI* pCmdUI);
afx_msg void OnOptionsTrihedronDynamicTrihedron();
afx_msg void OnUpdateOptionsTrihedronDynamicTrihedron(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsTrihedronStaticTrihedron(CCmdUI* pCmdUI);
afx_msg void OnTextureOn();
afx_msg void OnBUTTONNext();
afx_msg void OnBUTTONStart();
afx_msg void OnBUTTONRepeat();
afx_msg void OnBUTTONPrev();
afx_msg void OnBUTTONEnd();
afx_msg void OnUpdateBUTTONNext(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONPrev(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONStart(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONRepeat(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONEnd(CCmdUI* pCmdUI);
afx_msg void OnFileNew();
afx_msg void OnBUTTONShowResult();
afx_msg void OnDumpView();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
//Attributes
protected:
int myState;
private:
COffsetDlg* myOffsetDlg;
Handle_User_Cylinder myCylinder;
Handle_AIS_Shape mySphere;
Handle_AIS_Shape myBox;
Handle_AIS_Shape myOverlappedCylinder;
Handle_AIS_Shape myOverlappedSphere;
Handle_AIS_Shape myOverlappedBox;
Handle_AIS_Trihedron myTrihedron;
OCCDemo_Presentation *myPresentation;
char myDataDir[5]; // for "Data\0"
char myLastPath[MAX_PATH]; // directory of lastly saved file in DumpView()
bool isTextureSampleStarted;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VIEWERDOC_H__4EF39FBA_4EBB_11D1_8D67_0800369C8A03__INCLUDED_)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,176 @@
// Viewer3dView.h : interface of the CViewer3dView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_VIEWERVIEW_H__4EF39FBC_4EBB_11D1_8D67_0800369C8A03__INCLUDED_)
#define AFX_VIEWERVIEW_H__4EF39FBC_4EBB_11D1_8D67_0800369C8A03__INCLUDED_
#include <Viewer3dDoc.h>
#include <V3d_DirectionalLight.hxx>
#include <V3d_PositionalLight.hxx>
#include <V3d_AmbientLight.hxx>
#include <V3d_SpotLight.hxx>
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
enum View3D_CurrentAction {
CurAction3d_Nothing,
CurAction3d_DynamicZooming,
CurAction3d_WindowZooming,
CurAction3d_DynamicPanning,
CurAction3d_GlobalPanning,
CurAction3d_DynamicRotation,
CurAction3d_BeginSpotLight,
CurAction3d_TargetSpotLight,
CurAction3d_EndSpotLight,
CurAction3d_BeginPositionalLight,
CurAction3d_BeginDirectionalLight,
CurAction3d_EndDirectionalLight
};
class CViewer3dView : public CView
{
protected: // create from serialization only
CViewer3dView();
DECLARE_DYNCREATE(CViewer3dView)
public:
CViewer3dDoc* GetDocument();
void Redraw() { myView->Redraw(); };
void InitButtons();
void Reset();
void GetViewCenter(V3d_Coordinate& Xc, V3d_Coordinate& Yc);
void CViewer3dView::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc);
void GetViewEye(V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z);
void SetViewEye(const V3d_Coordinate X,const V3d_Coordinate Y,const V3d_Coordinate Z);
Quantity_Factor GetViewScale();
void SetViewScale(const Quantity_Factor Coef);
void FitAll() { myView->FitAll(); myView->ZFitAll(); };
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CViewer3dView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnInitialUpdate();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CViewer3dView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
int scaleX;
int scaleY;
int scaleZ;
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CViewer3dView)
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 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 OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
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 void OnDirectionalLight();
afx_msg void OnSpotLight();
afx_msg void OnPositionalLight();
afx_msg void OnAmbientLight();
afx_msg void OnZcueing();
afx_msg void OnScale();
afx_msg void OnZclipping();
afx_msg void OnShadingmodel();
afx_msg void OnAntialiasingonoff();
afx_msg void OnClearLights();
afx_msg void OnModelclipping();
afx_msg void OnOptionsTrihedronStaticTrihedron();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
enum VisMode { VIS_WIREFRAME, VIS_SHADE, VIS_HLR };
VisMode myVisMode;
Handle_V3d_View myView;
Handle_Graphic3d_GraphicDriver myGraphicDriver;
View3D_CurrentAction myCurrentMode;
Standard_Integer myXmin;
Standard_Integer myYmin;
Standard_Integer myXmax;
Standard_Integer myYmax;
Standard_Integer myWidth;
Standard_Integer myHeight;
Standard_Integer NbActiveLights;
Quantity_Factor myCurZoom;
Standard_Boolean myDegenerateModeIsOn;
Handle_V3d_AmbientLight myCurrent_AmbientLight;
Handle_V3d_SpotLight myCurrent_SpotLight;
Handle_V3d_PositionalLight myCurrent_PositionalLight;
Handle_V3d_DirectionalLight myCurrent_DirectionalLight;
Handle_V3d_Plane myPlane;
Handle_AIS_Shape myShape;
private:
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 );
UINT myAxisKey;
UINT myScaleDirection;
void RedrawVisMode();
};
#ifndef _DEBUG // debug version in Viewer3dView.cpp
inline CViewer3dDoc* CViewer3dView::GetDocument()
{ return (CViewer3dDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VIEWERVIEW_H__4EF39FBC_4EBB_11D1_8D67_0800369C8A03__INCLUDED_)

View File

@@ -0,0 +1,195 @@
// ZClippingDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Viewer3dApp.h"
#include "Viewer3dDoc.h"
#include "ZClippingDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ZClippingDlg dialog
ZClippingDlg::ZClippingDlg(Handle_V3d_View Current_V3d_View, CViewer3dDoc* pDoc, CWnd* pParent /*=NULL*/)
: CDialog(ZClippingDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(ZClippingDlg)
m_ZClippingDepth = 0.0;
m_ZClippingWidth = 0.0;
myDoc=pDoc;
myCurrent_V3d_View = Current_V3d_View;
//}}AFX_DATA_INIT
}
void ZClippingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ZClippingDlg)
DDX_Control(pDX, IDC_SLIDER_ZCLIPPINGWIDTH, m_ZClippingWidthSlidCtrl);
DDX_Control(pDX, IDC_SLIDER_ZCLIPPINGDEPTH, m_ZClippingDepthSlidCtrl);
DDX_Control(pDX, IDC_COMBO_ZCLIPPINGTYPE, m_ZClippingTypeList);
DDX_Text(pDX, IDC_EDIT_ZCLIPPINGDEPTH, m_ZClippingDepth);
DDV_MinMaxDouble(pDX, m_ZClippingDepth, -1500., 1500.);
DDX_Text(pDX, IDC_EDIT_ZCLIPPINGWIDTH, m_ZClippingWidth);
DDV_MinMaxDouble(pDX, m_ZClippingWidth, 0., 1500.);
//}}AFX_DATA_MAP
}
BOOL ZClippingDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Initializing the ComboBox
m_ZClippingTypeList.InsertString(-1,"OFF");
m_ZClippingTypeList.InsertString(-1,"BACK");
m_ZClippingTypeList.InsertString(-1,"FRONT");
m_ZClippingTypeList.InsertString(-1,"SLICE");
// Getting the type of ZClipping and select it in the ComboBox
Quantity_Length Depth, Width;
V3d_TypeOfZclipping myTypeOfZclipping=myCurrent_V3d_View->ZClipping(Depth, Width);
if(myTypeOfZclipping==V3d_OFF)
m_ZClippingTypeList.SetCurSel(0);
else if(myTypeOfZclipping==V3d_BACK)
m_ZClippingTypeList.SetCurSel(1);
else if(myTypeOfZclipping==V3d_FRONT)
m_ZClippingTypeList.SetCurSel(2);
else if(myTypeOfZclipping==V3d_SLICE)
m_ZClippingTypeList.SetCurSel(3);
// Setting the m_ZClippingWidth value at ZClipping width
m_ZClippingWidth=Width;
// Setting the m_ZClippingWidthSlidCtrl position at floor(Width) value (because slider position is an integer)
m_ZClippingWidthSlidCtrl.SetRange(0, 1500, TRUE);
m_ZClippingWidthSlidCtrl.SetPos( (int) floor(Width));
// Setting the m_ZClippingDepth value at ZClipping depth
m_ZClippingDepth=Depth;
// Setting the m_ZClippingDepthSlidCtrl position at floor(Depth) value (because slider position is an integer)
m_ZClippingDepthSlidCtrl.SetRange(-1500, 1500, TRUE);
m_ZClippingDepthSlidCtrl.SetPos( (int) floor(Depth));
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BEGIN_MESSAGE_MAP(ZClippingDlg, CDialog)
//{{AFX_MSG_MAP(ZClippingDlg)
ON_EN_CHANGE(IDC_EDIT_ZCLIPPINGDEPTH, OnChangeEditZclippingdepth)
ON_EN_CHANGE(IDC_EDIT_ZCLIPPINGWIDTH, OnChangeEditZclippingwidth)
ON_CBN_SELCHANGE(IDC_COMBO_ZCLIPPINGTYPE, OnSelchangeComboZclippingtype)
ON_WM_HSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// ZClippingDlg message handlers
void ZClippingDlg::OnChangeEditZclippingdepth()
{
UpdateData(TRUE);
// Setting the m_ZClippingDepthSlidCtrl position at floor(m_ZClippingDepth) value (because slider position is an integer)
m_ZClippingDepthSlidCtrl.SetPos( (int) floor(m_ZClippingDepth));
// Setting the ZClipping depth at m_ZClippingDepth value
myCurrent_V3d_View->SetZClippingDepth( (const Quantity_Length) m_ZClippingDepth);
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
myCurrent_V3d_View->SetZClippingDepth( (const Quantity_Length) m_ZClippingDepth);\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myDoc->UpdateResultMessageDlg("SetZClippingDepth",Message);
}
void ZClippingDlg::OnChangeEditZclippingwidth()
{
UpdateData(TRUE);
// ZClipping width must be >0
if(m_ZClippingWidth<=0)
{
m_ZClippingWidth=1;
UpdateData(FALSE);
}
// Setting the m_ZClippingWidthSlidCtrl position at floor(m_ZClippingWidth) value (because slider position is an integer)
m_ZClippingWidthSlidCtrl.SetPos( (int) floor(m_ZClippingWidth));
// Setting the ZClipping width at m_ZClippingWidth value
myCurrent_V3d_View->SetZClippingWidth( (const Quantity_Length) m_ZClippingWidth);
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
myCurrent_V3d_View->SetZClippingWidth( (const Quantity_Length) m_ZClippingWidth);\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myDoc->UpdateResultMessageDlg("SetZClippingDepth",Message);
}
void ZClippingDlg::OnSelchangeComboZclippingtype()
{
// Setting the ZClipping type as selected in the ComboBox
myCurrent_V3d_View->SetZClippingType(V3d_TypeOfZclipping(m_ZClippingTypeList.GetCurSel()));
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
myCurrent_V3d_View->SetZClippingType(V3d_TypeOfZclipping myTypeOfZclipping);\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myDoc->UpdateResultMessageDlg("SetZClippingType",Message);
}
void ZClippingDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// Setting the m_ZClippingDepth value at m_ZClippingDepthSlidCtrl position
m_ZClippingDepth = m_ZClippingDepthSlidCtrl.GetPos();
// Setting the m_ZClippingWidth value at m_ZClippingWidthSlidCtrl position
m_ZClippingWidth = m_ZClippingWidthSlidCtrl.GetPos();
if(m_ZClippingWidth<=0)
{
m_ZClippingWidth=1;
m_ZClippingWidthSlidCtrl.SetPos( 1 );
}
UpdateData(FALSE);
// Setting the ZClipping depth at m_ZClippingDepth value
myCurrent_V3d_View->SetZClippingDepth( (const Quantity_Length) m_ZClippingDepth);
// Setting the ZClipping width at m_ZClippingWidth value
myCurrent_V3d_View->SetZClippingWidth( (const Quantity_Length) m_ZClippingWidth);
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
myCurrent_V3d_View->SetZClippingWidth( (const Quantity_Length) m_ZClippingWidth);\n\
\n\
myCurrent_V3d_View->SetZClippingDepth( (const Quantity_Length) m_ZClippingDepth);\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myDoc->UpdateResultMessageDlg("SetZClippingDepth/SetZClippingWidth",Message);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}

View File

@@ -0,0 +1,60 @@
#if !defined(AFX_ZCLIPPINGDLG_H__B8439A01_61FB_11D3_8D0A_00AA00D10994__INCLUDED_)
#define AFX_ZCLIPPINGDLG_H__B8439A01_61FB_11D3_8D0A_00AA00D10994__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ZClippingDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// ZClippingDlg dialog
class ZClippingDlg : public CDialog
{
// Construction
public:
ZClippingDlg(Handle_V3d_View Current_V3d_View, CViewer3dDoc* pDoc, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(ZClippingDlg)
enum { IDD = IDD_ZCLIPPING };
CSliderCtrl m_ZClippingWidthSlidCtrl;
CSliderCtrl m_ZClippingDepthSlidCtrl;
CComboBox m_ZClippingTypeList;
double m_ZClippingDepth;
double m_ZClippingWidth;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ZClippingDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(ZClippingDlg)
afx_msg void OnChangeEditZclippingdepth();
afx_msg void OnChangeEditZclippingwidth();
afx_msg void OnSelchangeComboZclippingtype();
virtual BOOL OnInitDialog();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
Handle(V3d_View) myCurrent_V3d_View;
CViewer3dDoc* myDoc;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ZCLIPPINGDLG_H__B8439A01_61FB_11D3_8D0A_00AA00D10994__INCLUDED_)

View File

@@ -0,0 +1,204 @@
// ZCueingDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Viewer3dApp.h"
#include "Viewer3dDoc.h"
#include "ZCueingDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ZCueingDlg dialog
ZCueingDlg::ZCueingDlg(Handle_V3d_View Current_V3d_View, CViewer3dDoc* pDoc, CWnd* pParent /*=NULL*/)
: CDialog(ZCueingDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(ZCueingDlg)
myCurrent_V3d_View = Current_V3d_View;
myDoc=pDoc;
m_Cueing = FALSE;
m_ZCueingDepth = 0.0;
m_ZCueingWidth = 0.0;
//}}AFX_DATA_INIT
}
void ZCueingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ZCueingDlg)
DDX_Control(pDX, IDC_SLIDER_ZCUEINGWIDTH, m_ZCueingWidthSlidCtrl);
DDX_Control(pDX, IDC_SLIDER_ZCUEINGDEPTH, m_ZCueingDepthSlidCtrl);
DDX_Check(pDX, IDC_CHECK_CUEINGONOFF, m_Cueing);
DDX_Text(pDX, IDC_EDIT_ZCUEINGDEPTH, m_ZCueingDepth);
DDV_MinMaxDouble(pDX, m_ZCueingDepth, -1500., 1500.);
DDX_Text(pDX, IDC_EDIT_ZCUEINGWIDTH, m_ZCueingWidth);
DDV_MinMaxDouble(pDX, m_ZCueingWidth, 0., 1500.);
//}}AFX_DATA_MAP
}
BOOL ZCueingDlg::OnInitDialog()
{
CDialog::OnInitDialog();
Quantity_Length Depth, Width;
// Getting the ZCueing state (ON or OFF) and check (or not) the check button
if(myCurrent_V3d_View->ZCueing(Depth, Width))
m_Cueing=TRUE;
else
m_Cueing=FALSE;
// Setting the m_ZCueingWidth value at ZCueing Width
m_ZCueingWidth=Width;
m_ZCueingWidthSlidCtrl.SetRange(0, 1500, TRUE);
// Setting the m_ZCueingWidthSlidCtrl position at floor(Width) value (because slider position is an integer)
m_ZCueingWidthSlidCtrl.SetPos( (int) floor(Width));
// Setting the m_ZCueingWidth value at ZCueing Width
m_ZCueingDepth=Depth;
m_ZCueingDepthSlidCtrl.SetRange(-1500, 1500, TRUE);
// Setting the m_ZCueingDepthSlidCtrl position at floor(Depth) value (because slider position is an integer)
m_ZCueingDepthSlidCtrl.SetPos( (int) floor(Depth));
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BEGIN_MESSAGE_MAP(ZCueingDlg, CDialog)
//{{AFX_MSG_MAP(ZCueingDlg)
ON_BN_CLICKED(IDC_CHECK_CUEINGONOFF, OnCheckCueingonoff)
ON_EN_CHANGE(IDC_EDIT_ZCUEINGDEPTH, OnChangeEditZcueingdepth)
ON_EN_CHANGE(IDC_EDIT_ZCUEINGWIDTH, OnChangeEditZcueingwidth)
ON_WM_HSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// ZCueingDlg message handlers
void ZCueingDlg::OnCheckCueingonoff()
{
Quantity_Length Depth, Width;
UpdateData(TRUE);
if(m_Cueing)
{
if(!myCurrent_V3d_View->ZCueing(Depth, Width))
// Setting the ZCueing on if it's not yet
myCurrent_V3d_View->SetZCueingOn();
}
else
{
if(myCurrent_V3d_View->ZCueing(Depth, Width))
// Setting the ZCueing off if it's not yet
myCurrent_V3d_View->SetZCueingOff();
}
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
if(!myCurrent_V3d_View->ZCueing(Depth, Width));\n\
myCurrent_V3d_View->SetZCueingOn();\n\
else\n\
myCurrent_V3d_View->SetZCueingOff();\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myDoc->UpdateResultMessageDlg("SetZCueingWidth",Message);
}
void ZCueingDlg::OnChangeEditZcueingdepth()
{
UpdateData(TRUE);
// Setting the m_ZCueingDepthSlidCtrl position at floor(m_ZCueingDepth) value (because slider position is an integer)
m_ZCueingDepthSlidCtrl.SetPos( (int) floor(m_ZCueingDepth));
// Setting the ZCueing depth at m_ZCueingDepth value
myCurrent_V3d_View->SetZCueingDepth( (const Quantity_Length) m_ZCueingDepth);
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
myCurrent_V3d_View->SetZCueingDepth( (const Quantity_Length) m_ZCueingDepth);\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myDoc->UpdateResultMessageDlg("SetZCueingDepth",Message);
}
void ZCueingDlg::OnChangeEditZcueingwidth()
{
UpdateData(TRUE);
if(m_ZCueingWidth<=0)
{
m_ZCueingWidth=1;
UpdateData(FALSE);
}
// Setting the m_ZCueingWidthSlidCtrl position at floor(m_ZCueingWidth) value (because slider position is an integer)
m_ZCueingWidthSlidCtrl.SetPos( (int) floor(m_ZCueingWidth));
// Setting the ZCueing width at m_ZCueingWidth value
myCurrent_V3d_View->SetZCueingWidth( (const Quantity_Length) m_ZCueingWidth);
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
myCurrent_V3d_View->SetZCueingWidth( (const Quantity_Length) m_ZCueingWidth);\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myDoc->UpdateResultMessageDlg("SetZCueingWidth",Message);
}
void ZCueingDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// Setting the m_ZCueingDepth value at m_ZCueingDepthSlidCtrl position
m_ZCueingDepth = m_ZCueingDepthSlidCtrl.GetPos();
// Setting the m_ZCueingWidth value at m_ZCueingWidthSlidCtrl position
m_ZCueingWidth = m_ZCueingWidthSlidCtrl.GetPos();
if(m_ZCueingWidth<=0)
{
m_ZCueingWidth=1;
m_ZCueingWidthSlidCtrl.SetPos( 1 );
}
UpdateData(FALSE);
// Setting the ZCueing depth at m_ZCueingDepth value
myCurrent_V3d_View->SetZCueingDepth( (const Quantity_Length) m_ZCueingDepth);
// Setting the ZCueing width at m_ZCueingWidth value
myCurrent_V3d_View->SetZCueingWidth( (const Quantity_Length) m_ZCueingWidth);
myCurrent_V3d_View->Update();
TCollection_AsciiString Message("\
myCurrent_V3d_View->SetZCueingDepth( (const Quantity_Length) m_ZCueingDepth);\n\
\n\
myCurrent_V3d_View->SetZCueingWidth( (const Quantity_Length) m_ZCueingWidth);\n\
\n\
myCurrent_V3d_View->Update();\n\
");
// Update The Result Message Dialog
myDoc->UpdateResultMessageDlg("SetZCueingDepth/SetZCueingWidth",Message);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}

View File

@@ -0,0 +1,59 @@
#if !defined(AFX_ZCUEINGDLG_H__B8439A02_61FB_11D3_8D0A_00AA00D10994__INCLUDED_)
#define AFX_ZCUEINGDLG_H__B8439A02_61FB_11D3_8D0A_00AA00D10994__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ZCueingDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// ZCueingDlg dialog
class ZCueingDlg : public CDialog
{
// Construction
public:
ZCueingDlg(Handle_V3d_View Current_V3d_View, CViewer3dDoc* pDoc, CWnd* pParent = NULL);
// Dialog Data
//{{AFX_DATA(ZCueingDlg)
enum { IDD = IDD_ZCUEING };
CSliderCtrl m_ZCueingWidthSlidCtrl;
CSliderCtrl m_ZCueingDepthSlidCtrl;
BOOL m_Cueing;
double m_ZCueingDepth;
double m_ZCueingWidth;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ZCueingDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(ZCueingDlg)
afx_msg void OnCheckCueingonoff();
virtual BOOL OnInitDialog();
afx_msg void OnChangeEditZcueingdepth();
afx_msg void OnChangeEditZcueingwidth();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
Handle_V3d_View myCurrent_V3d_View;
CViewer3dDoc* myDoc;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ZCUEINGDLG_H__B8439A02_61FB_11D3_8D0A_00AA00D10994__INCLUDED_)

View File

@@ -0,0 +1,107 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Viewer3d.rc
//
#define IDD_SHADINGMODEL 131
#define IDD_SETOFFSETS 134
#define IDD_SCALE 139
#define IDD_RADIUS 144
#define IDD_ZCLIPPING 152
#define IDD_ZCUEING 153
#define IDD_TRIHEDRON 542
#define ID_BOX 802
#define ID_Cylinder 803
#define ID_SPHERE 804
#define ID_ERASEALL 805
#define ID_AMBIENT_LIGHT 806
#define ID_DIRECTIONAL_LIGHT 807
#define ID_POSITIONAL_LIGHT 808
#define ID_SPOT_LIGHT 809
#define ID_LIGHTOFF 810
#define ID_USERCYLINDER_CHANGEFACECOLOR 810
#define ID_ZCLIPPING 812
#define ID_ZCUEING 813
#define ID_SHADINGMODEL 814
#define ID_ANTIALIASINGONOFF 815
#define ID_CLEAR_LIGHTS 816
#define ID_MODELCLIPPING 817
#define ID_OVERLAPPED_BOX 818
#define ID_BUTTON819 819
#define ID_OVERLAPPED_SPHERE 820
#define ID_BUTTON821 821
#define ID_OVERLAPPED_CYLINDER 822
#define ID_POLYGON_OFFSETS 823
#define ID_OBJECT_COLORED_MESH 827
#define ID_OPTIONS_TRIHEDRON_STATIC_TRIHEDRON 829
#define ID_OPTIONS_TRIHEDRON_DYNAMIC_TRIHEDRON 830
#define ID_SCALE 831
#define ID_CIRCLE 833
#define ID_LINE 834
#define ID_VERTICES 837
#define ID_EDGES 838
#define ID_FACES 839
#define ID_NEUTRAL 840
#define ID_FILLET3D 841
#define ID_NBISOS 842
#define ID_BUTTONStart 843
#define ID_BUTTONPrev 844
#define ID_BUTTONRepeat 845
#define ID_BUTTONNext 846
#define ID_BUTTONEnd 847
#define ID_DUMP_VIEW 848
#define ID_TEXTURE_ON 849
#define IDC_SPIN_RADIUS 1000
#define IDC_EDIT_RADIUS 1001
#define IDC_SHADINGMODEL_COLOR 1002
#define IDC_EDIT_ISOU 1002
#define IDC_SHADINGMODEL_MULTICOLOR 1003
#define IDC_SLIDER_MODELCLIPPING_Z 1003
#define IDC_SHADINGMODEL_FLAT 1004
#define IDC_ISOU 1004
#define IDC_SHADINGMODEL_HIDDEN 1005
#define IDC_EDIT_MODELCLIPPING_Z 1005
#define IDC_ISOV 1005
#define IDC_SHADINGMODEL_GOURAUD 1006
#define IDC_EDIT_ISOV 1006
#define IDC_CHECK_MODELCLIPPINGONOFF 1008
#define IDC_SLIDER_OFFSETFACTOR 1010
#define IDC_SLIDER_OFFSETUNITS 1011
#define IDC_EDIT_OFFSETFACTOR 1012
#define IDC_EDIT_OFFSETUNITS 1013
#define IDC_COMBO_OFFSETTYPE 1023
#define IDC_SLIDER_SCALEX 1028
#define IDC_SLIDER_SCALEY 1029
#define IDC_EDIT_SCALEX 1030
#define IDC_EDIT_SCALEY 1031
#define IDC_RadiusFillet 1031
#define IDC_SLIDER_SCALEZ 1032
#define IDC_EDIT_SCALEZ 1033
#define IDD_RESULTMESSAGEDLG 1500
#define IDD_MODELCLIPPING 1501
#define IDD_ISOS 1502
#define IDC_COMBO_ZCLIPPINGTYPE 1650
#define IDC_CHECK_CUEINGONOFF 1651
#define IDC_EDITTRIHEDRSCALE 1686
#define IDC_SPINTRIHEDRSCALE 1737
#define IDC_COMBOTRIHEDRPOS 1739
#define IDC_COMBOTRIHEDRCOLOR 1740
#define IDC_SLIDER_ZCLIPPINGDEPTH 2004
#define IDC_SLIDER_ZCLIPPINGWIDTH 2005
#define IDC_EDIT_ZCLIPPINGDEPTH 2006
#define IDC_EDIT_ZCLIPPINGWIDTH 2007
#define IDC_SLIDER_ZCUEINGDEPTH 2009
#define IDC_SLIDER_ZCUEINGWIDTH 2010
#define IDC_EDIT_ZCUEINGDEPTH 2011
#define IDC_EDIT_ZCUEINGWIDTH 2012
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 140
#define _APS_NEXT_COMMAND_VALUE 850
#define _APS_NEXT_CONTROL_VALUE 1032
#define _APS_NEXT_SYMED_VALUE 104
#endif
#endif

View File

@@ -0,0 +1,4 @@
// Microsoft Visual C++ generated Help ID include file.
// Used by Viewer3d.rc
//
#define HIDC_RadiusFillet 0x808f0407 // IDD_RADIUS