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

View File

@@ -0,0 +1,98 @@
// AnimationApp.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "AnimationApp.h"
#include <OCC_MainFrame.h>
#include <OCC_3dChildFrame.h>
#include "AnimationDoc.h"
#include "AnimationView3D.h"
#include "..\..\Common\res\OCC_Resource.h"
BEGIN_MESSAGE_MAP(CAnimationApp, OCC_3dApp)
//{{AFX_MSG_MAP(CAnimationApp)
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
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAnimationApp construction
CAnimationApp::CAnimationApp()
{
SampleName = "Animation"; //for about dialog
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CAnimationApp object
CAnimationApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CAnimationApp initialization
BOOL CAnimationApp::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.
// Modified by CasCade :
SetRegistryKey(_T("Local CasCade 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* pDocTemplateForView3d;
pDocTemplateForView3d = new CMultiDocTemplate(
IDR_3DTYPE,
RUNTIME_CLASS(CAnimationDoc),
RUNTIME_CLASS(OCC_3dChildFrame), // custom MDI child frame
RUNTIME_CLASS(CAnimationView3D));
AddDocTemplate(pDocTemplateForView3d);
// create main MDI Frame window
OCC_MainFrame* pMainFrame = new OCC_MainFrame;
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;
}
void CAnimationApp::OnAppAbout()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CAnimationView3D *pView = (CAnimationView3D *) pChild->GetActiveView();
pView -> OnStop();
OCC_3dApp::OnAppAbout();
pView -> OnRestart();
}

View File

@@ -0,0 +1,38 @@
// AnimationApp.h : main header file for the Animation application
//
#if !defined(AFX_ANIMATION_H__79840E7E_1001_11D2_B8C1_0000F87A77C1__INCLUDED_)
#define AFX_ANIMATION_H__79840E7E_1001_11D2_B8C1_0000F87A77C1__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <OCC_3dApp.h>
class CAnimationApp : public OCC_3dApp
{
public:
CAnimationApp();
//{{AFX_MSG(CAnimationApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAnimationApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ANIMATION_H__79840E7E_1001_11D2_B8C1_0000F87A77C1__INCLUDED_)

View File

@@ -0,0 +1,437 @@
// AnimationDocApp.cpp : implementation of the CAnimationDoc class
//
#include "stdafx.h"
#include "AnimationApp.h"
#include "AnimationDoc.h"
#include "AnimationView3D.h"
#include "AISDialogs.h"
#include "ShadingDialog.h"
#include "ThreadDialog.h"
#include "Fonc.hxx"
#define DEFAULT_COLOR Quantity_NOC_CYAN1
#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
#define DEFAULT_DEVIATIONCOEFFICIENT 0.001
#define DEFAULT_HILIGHTCOLOR Quantity_NOC_YELLOW
#ifdef _DEBUG
//#define new DEBUG_NEW // by cascade
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAnimationDoc
IMPLEMENT_DYNCREATE(CAnimationDoc, CDocument)
BEGIN_MESSAGE_MAP(CAnimationDoc, CDocument)
//{{AFX_MSG_MAP(CAnimationDoc)
ON_COMMAND(ID_SHADING, OnShading)
ON_COMMAND(ID_Thread, OnThread)
ON_COMMAND(ID_FILE_LOADGRID, OnFileLoadgrid)
ON_UPDATE_COMMAND_UI(ID_WALK_WALKTHRU, OnUpdateWalkWalkthru)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAnimationDoc construction/destruction
CAnimationDoc::CAnimationDoc()
{
// TODO: add one-time construction code here
static Standard_Integer StaticCount=1;
StaticCount++;
myCount = StaticCount;
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
((CAnimationApp*)AfxGetApp())->GetGraphicDevice();
TCollection_ExtendedString a3DName("Visu3D");
myViewer = new V3d_Viewer(theGraphicDevice,a3DName.ToExtString(),"", 1000.0,
V3d_XposYnegZpos, Quantity_NOC_GRAY30,
V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
Standard_True, Standard_False);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myAISContext =new AIS_InteractiveContext(myViewer);
myDeviation = 0.0008;
thread = 4;
myAngle = 0;
BRep_Builder B;
TopoDS_Shape CrankArm;
TopoDS_Shape CylinderHead;
TopoDS_Shape Propeller;
TopoDS_Shape Piston;
TopoDS_Shape EngineBlock;
char AbloluteExecutableFileName[200];
HMODULE hModule = GetModuleHandle(NULL);
GetModuleFileName (hModule, AbloluteExecutableFileName, 200);
CString aString(AbloluteExecutableFileName);
int index = aString.ReverseFind('\\');
aString.Delete(index+1, aString.GetLength() - index - 1);
TCHAR tchBuf[80];
CString CASROOTValue = ((GetEnvironmentVariable("CASROOT", tchBuf, 80) > 0) ? tchBuf : NULL);
aString = (CASROOTValue + "\\..\\data\\occ");
char DataDirPath[200];
strcpy_s(DataDirPath, aString);
char temp[200];
strcpy_s(temp, DataDirPath);
strcat_s(temp,"\\CrankArm.rle");
BRepTools::Read(CrankArm, temp, B);
strcpy_s(temp, DataDirPath);
strcat_s(temp,"\\CylinderHead.rle");
BRepTools::Read(CylinderHead, temp, B);
strcpy_s(temp, DataDirPath);
strcat_s(temp,"\\Propeller.rle");
BRepTools::Read(Propeller, temp, B);
strcpy_s(temp, DataDirPath);
strcat_s(temp,"\\Piston.rle");
BRepTools::Read(Piston, temp, B);
strcpy_s(temp, DataDirPath);
strcat_s(temp,"\\EngineBlock.rle");
BRepTools::Read(EngineBlock, temp, B);
if (CrankArm.IsNull() || CylinderHead.IsNull() ||
Propeller.IsNull() || Piston.IsNull() || EngineBlock.IsNull())
{
int rep = MessageBox(NULL, "Shape(s) not found.\nCheck the Data directory path!", "Error",MB_OK | MB_ICONERROR);
if (rep == IDOK)
exit(0);
}
myAISContext->SetDeviationCoefficient(myDeviation);
myAisCylinderHead = new AIS_Shape (CylinderHead);
myAISContext->SetColor (myAisCylinderHead, Quantity_NOC_WHITE);
myAISContext->SetMaterial (myAisCylinderHead, Graphic3d_NOM_PLASTIC);
myAisEngineBlock = new AIS_Shape (EngineBlock);
myAISContext->SetColor(myAisEngineBlock, Quantity_NOC_WHITE);
myAISContext->SetMaterial(myAisEngineBlock,Graphic3d_NOM_PLASTIC);
myAISContext->Display(myAisCylinderHead ,1,-1,Standard_False,Standard_False);
myAISContext->Display(myAisEngineBlock ,1,-1,Standard_False,Standard_False);
myAisCrankArm = new AIS_Shape (CrankArm);
myAISContext->SetColor (myAisCrankArm, Quantity_NOC_HOTPINK);
myAISContext->SetMaterial(myAisCrankArm, Graphic3d_NOM_PLASTIC);
myAisPiston = new AIS_Shape (Piston);
myAISContext->SetColor (myAisPiston , Quantity_NOC_WHITE);
myAISContext->SetMaterial(myAisPiston , Graphic3d_NOM_PLASTIC);
myAisPropeller = new AIS_Shape (Propeller);
myAISContext->SetColor (myAisPropeller, Quantity_NOC_RED);
myAISContext->SetMaterial(myAisPropeller, Graphic3d_NOM_PLASTIC);
myAISContext->Display(myAisCrankArm ,1,-1,Standard_False,Standard_False);
myAISContext->Display(myAisPropeller ,1,-1,Standard_False,Standard_False);
myAISContext->Display(myAisPiston ,1,-1,Standard_True,Standard_False);
m_Xmin = -300. ;
m_Ymin = -300. ;
m_Zmin = -300. ;
m_Xmax = +300. ;
m_Ymax = +300. ;
m_Zmax = +300. ;
m_bIsGridLoaded = FALSE;
}
CAnimationDoc::~CAnimationDoc()
{
}
/////////////////////////////////////////////////////////////////////////////
// CAnimationDoc diagnostics
#ifdef _DEBUG
void CAnimationDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CAnimationDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CAnimationDoc commands
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CAnimationDoc::DragEvent(const Standard_Integer x ,
const Standard_Integer y ,
const Standard_Integer TheState ,
const Handle(V3d_View)& aView )
{
// TheState == -1 button down
// TheState == 0 move
// TheState == 1 button up
static Standard_Integer theButtonDownX=0;
static Standard_Integer theButtonDownY=0;
if (TheState == -1)
{
theButtonDownX=x;
theButtonDownY=y;
}
if (TheState == 0)
myAISContext->Select(theButtonDownX,theButtonDownY,x,y,aView);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CAnimationDoc::InputEvent(const Standard_Integer x ,
const Standard_Integer y ,
const Handle(V3d_View)& aView )
{
myAISContext->Select();
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CAnimationDoc::MoveEvent(const Standard_Integer x ,
const Standard_Integer y ,
const Handle(V3d_View)& aView )
{
myAISContext->MoveTo(x,y,aView);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CAnimationDoc::ShiftMoveEvent(const Standard_Integer x ,
const Standard_Integer y ,
const Handle(V3d_View)& aView )
{
myAISContext->MoveTo(x,y,aView);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CAnimationDoc::ShiftDragEvent(const Standard_Integer x ,
const Standard_Integer y ,
const Standard_Integer TheState ,
const Handle(V3d_View)& aView )
{
static Standard_Integer theButtonDownX=0;
static Standard_Integer theButtonDownY=0;
if (TheState == -1)
{
theButtonDownX=x;
theButtonDownY=y;
}
if (TheState == 0)
myAISContext->ShiftSelect(theButtonDownX,theButtonDownY,x,y,aView);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CAnimationDoc::ShiftInputEvent(const Standard_Integer x ,
const Standard_Integer y ,
const Handle(V3d_View)& aView )
{
myAISContext->ShiftSelect();
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CAnimationDoc::Popup(const Standard_Integer x,
const Standard_Integer y ,
const Handle(V3d_View)& aView )
{
}
void CAnimationDoc::OnMyTimer()
{
// TODO: Add your message handler code here and/or call default
Standard_Real angleA;
Standard_Real angleB;
Standard_Real X;
gp_Ax1 Ax1(gp_Pnt(0,0,0),gp_Vec(0,0,1));
myAngle++;
angleA = thread*myAngle*PI/180;
X = Sin(angleA)*3/8;
angleB = atan(X / Sqrt(-X * X + 1));
Standard_Real decal(25*0.6);
//Build a transformation on the display
gp_Trsf aPropellerTrsf;
aPropellerTrsf.SetRotation(Ax1,angleA);
myAISContext->SetLocation(myAisPropeller,aPropellerTrsf);
gp_Ax3 base(gp_Pnt(3*decal*(1-Cos(angleA)),-3*decal*Sin(angleA),0),gp_Vec(0,0,1),gp_Vec(1,0,0));
gp_Trsf aCrankArmTrsf;
aCrankArmTrsf.SetTransformation( base.Rotated(gp_Ax1(gp_Pnt(3*decal,0,0),gp_Dir(0,0,1)),angleB));
myAISContext->SetLocation(myAisCrankArm,aCrankArmTrsf);
gp_Trsf aPistonTrsf;
aPistonTrsf.SetTranslation(gp_Vec(-3*decal*(1-Cos(angleA))-8*decal*(1-Cos(angleB)),0,0));
myAISContext->SetLocation(myAisPiston,aPistonTrsf);
myAISContext->UpdateCurrentViewer();
}
void CAnimationDoc::OnShading()
{
POSITION position = GetFirstViewPosition();
CView* pCurrentView = (CView*)GetNextView(position);
((CAnimationView3D *)pCurrentView) ->OnStop();
CShadingDialog aDial(NULL);
aDial.myvalue=int((myDeviation-0.00003)/0.00003);
if (aDial.DoModal()==IDOK) {
Standard_Real dev(aDial.myvalue);
myDeviation = 0.00003+0.00003*dev;
myAISContext->SetDeviationCoefficient(myDeviation);
TopoDS_Shape Propeller=myAisPropeller->Shape();
BRepTools::Clean(Propeller);
myAisPropeller->Set(Propeller);
myAISContext->Deactivate(myAisPropeller);
myAISContext->Redisplay(myAisPropeller);
}
((CAnimationView3D *)pCurrentView)->OnRestart();
}
void CAnimationDoc::OnThread()
{
POSITION position = GetFirstViewPosition();
CView* pCurrentView = (CView*)GetNextView(position);
((CAnimationView3D *)pCurrentView) ->OnStop();
CThreadDialog aThreadDial(NULL);
if (aThreadDial.DoModal()==IDOK) {
thread = aThreadDial.m_Angle;
}
((CAnimationView3D *)pCurrentView)->OnRestart();
}
void CAnimationDoc::OnFileLoadgrid()
{
// TODO: Add your command handler code here
CFileDialog dlg(TRUE,
NULL,
NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"Points Files (*.pnt;*.pnts)|*.pnt; *.pnts|All Files (*.*)|*.*||",
NULL );
CString initdir(((OCC_BaseApp*) AfxGetApp())->GetInitDataDir());
initdir += "\\..\\..\\Data\\";
dlg.m_ofn.lpstrInitialDir = initdir;
if (dlg.DoModal() == IDOK)
{
CString C = dlg.GetPathName();
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
Handle_Geom_BSplineSurface mySurface;
if(grid2surf(C,mySurface ))
{
//To set the minimum value of the surface to Z=0
Standard_Real Tolerance = 0.0;
Bnd_Box B;
TopoDS_Face myFace;
GeomAdaptor_Surface GAS(mySurface);
BndLib_AddSurface::Add(GAS,Tolerance,B);
Standard_Real Xmin,Xmax,Ymin,Ymax,Zmin,Zmax;
B.Get(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);
TopoDS_Solid Box = BRepPrimAPI_MakeBox(gp_Pnt(Xmin,Ymin,0),Xmax-Xmin,Ymax-Ymin,50).Solid();
gp_Vec V(gp_Pnt(0,0,Zmin),gp_Pnt(0,0,0));
gp_Trsf T;
T.SetTranslation(V);
mySurface->Transform(T);
BRepBuilderAPI_MakeFace aMkFace(mySurface);
myFace = aMkFace.Face();
// Remove all other shapes
myAISContext->RemoveAll();
Handle(AIS_Shape) myAISSurface = new AIS_Shape(myFace);
myAISContext->Display(myAISSurface, Standard_False);
myAISContext->Deactivate(myAISSurface,Standard_False);
myAISContext->SetColor (myAISSurface,Quantity_NOC_WHITE,Standard_False);
myAISContext->SetMaterial (myAISSurface,Graphic3d_NOM_STONE,Standard_False);
myAISContext->SetDisplayMode (myAISSurface,1,Standard_False);
myAISContext->SetDeviationCoefficient (0.001);
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CAnimationView3D *pView = (CAnimationView3D *) pChild->GetActiveView();
pView->FitAll();
Bnd_Box Boite;
BRepBndLib::Add(myFace, Boite);
Boite.Get(m_Xmin, m_Ymin, m_Zmin, m_Xmax, m_Ymax, m_Zmax);
m_bIsGridLoaded = TRUE;
}
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
}
}
void CAnimationDoc::OnUpdateWalkWalkthru(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
int i ;
char szMsg [256] ;
i = GetEnvironmentVariable( "CSF_WALKTHROUGH" , szMsg , sizeof szMsg ) ;
if ( i )
pCmdUI->SetCheck ( 1 ) ;
else
pCmdUI->SetCheck ( 0 ) ;
}

View File

@@ -0,0 +1,116 @@
// Animation.h : interface of the CAnimationDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_ANIMATIONDOC_H__79840E86_1001_11D2_B8C1_0000F87A77C1__INCLUDED_)
#define AFX_ANIMATIONDOC_H__79840E86_1001_11D2_B8C1_0000F87A77C1__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "AIS_ConnectedInteractive.hxx"
#include "Geom_Transformation.hxx"
class CAnimationDoc : public CDocument
{
public:
void DragEvent (const Standard_Integer x ,
const Standard_Integer y ,
const Standard_Integer TheState,
const Handle(V3d_View)& aView );
void InputEvent (const Standard_Integer x ,
const Standard_Integer y ,
const Handle(V3d_View)& aView );
void MoveEvent (const Standard_Integer x ,
const Standard_Integer y ,
const Handle(V3d_View)& aView );
void ShiftMoveEvent (const Standard_Integer x ,
const Standard_Integer y ,
const Handle(V3d_View)& aView );
void ShiftDragEvent (const Standard_Integer x ,
const Standard_Integer y ,
const Standard_Integer TheState,
const Handle(V3d_View)& aView );
void ShiftInputEvent(const Standard_Integer x ,
const Standard_Integer y ,
const Handle(V3d_View)& aView );
void Popup (const Standard_Integer x ,
const Standard_Integer y ,
const Handle(V3d_View)& aView );
protected: // create from serialization only
CAnimationDoc();
DECLARE_DYNCREATE(CAnimationDoc)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAnimationDoc)
public:
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CAnimationDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CAnimationDoc)
afx_msg void OnShading();
afx_msg void OnThread();
afx_msg void OnFileLoadgrid();
afx_msg void OnUpdateWalkWalkthru(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public :
private:
Handle_V3d_Viewer myViewer;
Handle_AIS_InteractiveContext myAISContext;
public :
Handle_AIS_InteractiveContext& GetAISContext(){ return myAISContext; };
Handle_V3d_Viewer GetViewer() { return myViewer; };
private :
Handle_AIS_Shape myAisCrankArm ;
Handle_AIS_Shape myAisCylinderHead ;
Handle_AIS_Shape myAisPropeller ;
Handle_AIS_Shape myAisPiston ;
Handle_AIS_Shape myAisEngineBlock ;
Standard_Real myDeviation;
Standard_Integer myAngle;
public :
void OnMyTimer();
Standard_Integer myCount;
Standard_Integer thread;
double m_Xmin, m_Ymin, m_Zmin, m_Xmax, m_Ymax, m_Zmax;
BOOL m_bIsGridLoaded;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ANIMATIONDOC_H__79840E86_1001_11D2_B8C1_0000F87A77C1__INCLUDED_)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,172 @@
// AnimationView.h : interface of the CAnimationView3D class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_ANIMATIONVIEW3D_H__79840E88_1001_11D2_B8C1_0000F87A77C1_3D_INCLUDED_)
#define AFX_ANIMATIONVIEW3D_H__79840E88_1001_11D2_B8C1_0000F87A77C1_3D_INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "Tune.h"
#include "AnimationDoc.h"
#include "..\..\Common\res\OCC_Resource.h"
enum View3D_CurrentAction {
CurrentAction3d_Nothing,
CurrentAction3d_DynamicZooming,
CurrentAction3d_WindowZooming,
CurrentAction3d_DynamicPanning,
CurrentAction3d_GlobalPanning,
CurrentAction3d_DynamicRotation,
CurrentAction3d_Fly,
CurrentAction3d_Turn
};
class CAnimationView3D : public CView
{
protected: // create from serialization only
CAnimationView3D();
DECLARE_DYNCREATE(CAnimationView3D)
// Attributes
public:
CAnimationDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAnimationView3D)
public:
void FitAll() { if ( !myView.IsNull() ) myView->FitAll(); myView->ZFitAll(); };
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnInitialUpdate(); // CasCade
protected:
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CAnimationView3D();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
void SetDimensions ();
void ReloadData();
CTune m_Tune;
void SetFocal ( double dFocus , double dAngle );
void Fly (int x , int y);
void Turn (int x , int y);
void Roll (int x , int y);
void Twist (int x , int y);
protected:
double m_dAngle;
BOOL m_bShift;
int m_cx , m_cy ;
int m_curx , m_cury ;
// Generated message map functions
protected:
//{{AFX_MSG(CAnimationView3D)
afx_msg void OnBUTTONAxo();
afx_msg void OnBUTTONBack();
afx_msg void OnBUTTONBottom();
afx_msg void OnBUTTONFront();
afx_msg void OnBUTTONHlrOff();
afx_msg void OnBUTTONHlrOn();
afx_msg void OnBUTTONLeft();
afx_msg void OnBUTTONPan();
afx_msg void OnBUTTONPanGlo();
afx_msg void OnBUTTONReset();
afx_msg void OnBUTTONRight();
afx_msg void OnBUTTONRot();
afx_msg void OnBUTTONTop();
afx_msg void OnBUTTONZoomAll();
afx_msg void OnFileExportImage();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnBUTTONZoomProg();
afx_msg void OnBUTTONZoomWin();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
afx_msg void OnChangeBackground();
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnSensitivity();
afx_msg void OnBUTTONFly();
afx_msg void OnBUTTONTurn();
afx_msg void OnUpdateBUTTONFly(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONTurn(CCmdUI* pCmdUI);
afx_msg void OnViewDisplaystatus();
afx_msg void OnUpdateViewDisplaystatus(CCmdUI* pCmdUI);
//}}AFX_MSG
public :
afx_msg void OnStop();
afx_msg void OnRestart();
protected:
DECLARE_MESSAGE_MAP()
private:
Handle_V3d_View myView;
public:
Handle_V3d_View& GetView() { return myView;};
void DisplayTuneDialog();
private:
// CurrentAction3d myCurrentMode;
Standard_Integer myXmin;
Standard_Integer myYmin;
Standard_Integer myXmax;
Standard_Integer myYmax;
Quantity_Factor myCurZoom;
Standard_Boolean myDegenerateModeIsOn;
Handle_V3d_PerspectiveView myPView;
View3D_CurrentAction myCurrentMode;
double m_Atx , m_Aty , m_Atz ;
double m_Eyex , m_Eyey , m_Eyez ;
double m_FlySens ;
double m_TurnSens ;
double m_Focus ;
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 );
};
#ifndef _DEBUG // debug version in AnimationView.cpp
inline CAnimationDoc* CAnimationView3D::GetDocument()
{ return (CAnimationDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ANIMATIONVIEW3D_H__79840E88_1001_11D2_B8C1_0000F87A77C1_3D_INCLUDED_)

View File

@@ -0,0 +1,139 @@
#include "stdafx.h"
#include "Fonc.hxx"
//=======================================================================
//function : grid2surf
//purpose : grid2surf S FileName
// cf jm-oliva@paris3.matra-dtv.fr ( Merci JMO )
//=======================================================================
Standard_Boolean grid2surf(Standard_CString ShapeName,Handle(Geom_BSplineSurface)& S )
{
Handle(TColStd_HArray2OfReal) H;
Standard_Real xmin, ymin, Dx, Dy;
H = ReadRegularGrid(ShapeName, xmin, ymin, Dx, Dy);
GeomAPI_PointsToBSplineSurface MkSurf;
MkSurf.Interpolate(H->Array2(), xmin, Dx, ymin, Dy);
S = MkSurf.Surface();
return Standard_True;
}
//=======================================================================
//function : grid2surf
//purpose :
// cf jm-oliva@paris3.matra-dtv.fr ( Merci JMO )
//=======================================================================
Standard_Boolean grid2surf(const CString aCStringShapeName,
Handle(Geom_BSplineSurface)& S )
{
char tmp_char[256] ="";
strcpy_s(tmp_char,aCStringShapeName);
int i = 0, len = strlen(tmp_char);
while (i < len)
{
if (tmp_char[i] == '\\')
tmp_char[i] = '/';
i++;
}
Standard_CString aFileName = tmp_char;
return grid2surf(aFileName,S);
}
//=======================================================================
//function : ReadRegularGrid
//purpose :
// cf jm-oliva@paris3.matra-dtv.fr ( Merci JMO )
//=======================================================================
Handle(TColStd_HArray2OfReal) ReadRegularGrid(Standard_CString FileName,
Standard_Real& xmin,
Standard_Real& ymin,
Standard_Real& Deltax,
Standard_Real& Deltay)
{
Handle(TColStd_HArray2OfReal) H;
Standard_Integer R1 = 1, R2, C1 = 1, C2, R, C;
Standard_Real x, y, z;
xmin = ymin = 10000000;
FILE *fp = NULL;
fopen_s(&fp, FileName, "r");
if (fp)
{
fscanf_s(fp, "%d %d", &R2, &C2);
cout << "Reading Grid : ( " << R2 << " , " << C2 << " )." << endl;
H = new TColStd_HArray2OfReal(C1, C2, R1, R2);
Standard_Real FirstX;
Standard_Real FirstY;
for(R = R1; R <= R2; R++)
{
for(C = C1; C <= C2; C++)
{
fscanf_s(fp, "%lf %lf %lf ", &x, &y, &z);
if(R == 1 && C == 1)
{
FirstX=x;
FirstY=y;
}
// First step for X
if(R == 1 && C == 2)
Deltax = x - FirstX;
// First step for Y
if(R == 2 && C == 1)
Deltay = y - FirstY;
// H->SetValue(R, C, z);
H->SetValue(C, R, z);
if(x < xmin) xmin = x;
if(y < ymin) ymin = y;
}
}
cout << "Deltax = " << Deltax << endl;
cout << "Deltay = " << Deltay << endl;
fclose(fp);
}
else
{
cout << "cannot open file : " << FileName << endl;
}
return H;
}
//=======================================================================
//function : ReadRegularGrid
//purpose :
// cf jm-oliva@paris3.matra-dtv.fr ( Merci JMO )
//=======================================================================
Handle(TColStd_HArray2OfReal) ReadRegularGrid(const CString aCStringFileName,
Standard_Real& xmin,
Standard_Real& ymin,
Standard_Real& Deltax,
Standard_Real& Deltay)
{
char tmp_char[256] ="";
strcpy_s(tmp_char,aCStringFileName);
int i = 0, len = strlen(tmp_char);
while (i < len)
{
if (tmp_char[i] == '\\')
tmp_char[i] = '/';
i++;
}
Standard_CString aFileName = tmp_char;
Handle(TColStd_HArray2OfReal) H;
H = ReadRegularGrid(aFileName,xmin,ymin,Deltax,Deltay);
return H;
}

View File

@@ -0,0 +1,53 @@
// File: Functions.hxx
// Created: Tue Oct 07 09:23:55 1997
// Author: Stephane ROUTELOUS
// <s-routelous@muenchen.matra-dtv.fr>
#include "StdAfx.h"
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Pnt2d.hxx>
#include <Standard.hxx>
#include <Precision.hxx>
#include <Standard_Boolean.hxx>
#include <Geom_BSplineSurface.hxx>
#include <TColStd_HArray2OfReal.hxx>
#include "GeomAPI_PointsToBSplineSurface.hxx"
#include <stdio.h>
#include <TColStd_HArray2OfReal.hxx>
#include <Geom_BSplineCurve.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <Geom_CartesianPoint.hxx>
#include <AIS_Point.hxx>
#include <GeomAPI_PointsToBSpline.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <TopoDS_Solid.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepTools.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_InteractiveContext.hxx>
Standard_Boolean grid2surf(Standard_CString ShapeName,Handle(Geom_BSplineSurface)& S );
Standard_Boolean grid2surf(const CString aCStringShapeName,Handle(Geom_BSplineSurface)& S );
Handle(Geom_BSplineCurve) SetTransfo(Handle(Geom_BSplineCurve) aBSCurve);
Handle(Geom_BSplineCurve) BuildBSplineCurve(Standard_Boolean DisplayPoints = Standard_True);
Handle(TColStd_HArray2OfReal) ReadRegularGrid(Standard_CString FileName,
Standard_Real& xmin,
Standard_Real& ymin,
Standard_Real& Deltax,
Standard_Real& Deltay);
Handle(TColStd_HArray2OfReal) ReadRegularGrid(const CString aCStringFileName,
Standard_Real& xmin,
Standard_Real& ymin,
Standard_Real& Deltax,
Standard_Real& Deltay);

View File

@@ -0,0 +1,81 @@
// Sensitivity.cpp : implementation file
//
#include "stdafx.h"
#include "Sensitivity.h"
#include "AnimationApp.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSensitivity dialog
CSensitivity::CSensitivity(CWnd* pParent /*=NULL*/)
: CDialog(CSensitivity::IDD, pParent)
{
//{{AFX_DATA_INIT(CSensitivity)
m_SensFly = 0.0;
m_SensTurn = 0.0;
//}}AFX_DATA_INIT
}
void CSensitivity::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSensitivity)
DDX_Text(pDX, IDC_FLY, m_SensFly);
DDV_MinMaxDouble(pDX, m_SensFly, 0., 10000000.);
DDX_Text(pDX, IDC_TURN, m_SensTurn);
DDV_MinMaxDouble(pDX, m_SensTurn, 0., 10000000.);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSensitivity, CDialog)
//{{AFX_MSG_MAP(CSensitivity)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSpin1)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN2, OnDeltaposSpin2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSensitivity message handlers
void CSensitivity::OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
if ( pNMUpDown->iDelta > 0 ) {
m_SensFly /= 1.1 ;
}
else {
m_SensFly *= 1.1 ;
}
UpdateData ( FALSE ) ;
*pResult = 0;
}
void CSensitivity::OnDeltaposSpin2(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
if ( pNMUpDown->iDelta > 0 ) {
m_SensTurn /= 1.1 ;
}
else {
m_SensTurn *= 1.1 ;
}
UpdateData ( FALSE ) ;
*pResult = 0;
}

View File

@@ -0,0 +1,48 @@
#if !defined(AFX_SENSITIVITY_H__F3897393_7D55_11D2_8E5F_0800369C8A03__INCLUDED_)
#define AFX_SENSITIVITY_H__F3897393_7D55_11D2_8E5F_0800369C8A03__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// Sensitivity.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CSensitivity dialog
class CSensitivity : public CDialog
{
// Construction
public:
CSensitivity(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CSensitivity)
enum { IDD = IDD_SENS };
double m_SensFly;
double m_SensTurn;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSensitivity)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CSensitivity)
afx_msg void OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpin2(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SENSITIVITY_H__F3897393_7D55_11D2_8E5F_0800369C8A03__INCLUDED_)

View File

@@ -0,0 +1,97 @@
// ShadingDialog.cpp : implementation file
//
#include "stdafx.h"
#include "AnimationApp.h"
#include "ShadingDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CShadingDialog dialog
CShadingDialog::CShadingDialog(CWnd* pParent /*=NULL*/)
: CDialog(CShadingDialog::IDD, pParent)
{
// EnableAutomation();
//{{AFX_DATA_INIT(CShadingDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CShadingDialog::OnFinalRelease()
{
// When the last reference for an automation object is released
// OnFinalRelease is called. The base class will automatically
// deletes the object. Add additional cleanup required for your
// object before calling the base class.
CDialog::OnFinalRelease();
}
void CShadingDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CShadingDialog)
DDX_Control(pDX, IDC_SLIDER1, m_Slide);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CShadingDialog, CDialog)
//{{AFX_MSG_MAP(CShadingDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DISPATCH_MAP(CShadingDialog, CDialog)
//{{AFX_DISPATCH_MAP(CShadingDialog)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
// Note: we add support for IID_IShadingDialog to support typesafe binding
// from VBA. This IID must match the GUID that is attached to the
// dispinterface in the .ODL file.
// {02819A09-10F2-11D2-B8C4-0000F87A77C1}
static const IID IID_IShadingDialog =
{ 0x2819a09, 0x10f2, 0x11d2, { 0xb8, 0xc4, 0x0, 0x0, 0xf8, 0x7a, 0x77, 0xc1 } };
BEGIN_INTERFACE_MAP(CShadingDialog, CDialog)
INTERFACE_PART(CShadingDialog, IID_IShadingDialog, Dispatch)
END_INTERFACE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShadingDialog message handlers
BOOL CShadingDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_Slide.SetRange(0,100);
m_Slide.SetTicFreq(100);
m_Slide.SetPos(myvalue);
//UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CShadingDialog::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
// store the position in my variable
myvalue= m_Slide.GetPos();
CDialog::OnOK();
}

View File

@@ -0,0 +1,56 @@
#if !defined(AFX_SHADINGDIALOG_H__02819A0A_10F2_11D2_B8C4_0000F87A77C1__INCLUDED_)
#define AFX_SHADINGDIALOG_H__02819A0A_10F2_11D2_B8C4_0000F87A77C1__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ShadingDialog.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CShadingDialog dialog
class CShadingDialog : public CDialog
{
// Construction
public:
CShadingDialog(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CShadingDialog)
enum { IDD = IDD_ShadingBoxDialog };
CSliderCtrl m_Slide;
int myvalue;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CShadingDialog)
public:
virtual void OnFinalRelease();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CShadingDialog)
virtual BOOL OnInitDialog();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Generated OLE dispatch map functions
//{{AFX_DISPATCH(CShadingDialog)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SHADINGDIALOG_H__02819A0A_10F2_11D2_B8C4_0000F87A77C1__INCLUDED_)

View File

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

View File

@@ -0,0 +1,256 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__79840E80_1001_11D2_B8C1_0000F87A77C1__INCLUDED_)
#define AFX_STDAFX_H__79840E80_1001_11D2_B8C1_0000F87A77C1__INCLUDED_
#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
// CasCade :
#if !defined(WNT)
#error WNT precompiler directive is mandatory for CasCade
#endif
#if !defined(CSFDB)
#error CSFDB precompiler directive is mandatory for CasCade
#endif
enum CurrentAction3d {
CurAction3d_Nothing,
CurAction3d_DynamicZooming,
CurAction3d_WindowZooming,
CurAction3d_DynamicPanning,
CurAction3d_GlobalPanning,
CurAction3d_DynamicRotation
};
#define DEFAULT_DEVIATIONCOEFFICIENT 0.001
#define DEFAULT_DCBIG 0.005
#define DEFAULT_DCVBIG 0.01
#define DEFAULT_DCSMALL 0.0002
#define DEFAULT_DCVSMALL 0.00004
#define DEFAULT_COLOR Quantity_NOC_CYAN1
#define DEFAULT_MATERIAL Graphic3d_NOM_PLASTER
#define DEFAULT_BACKGROUNDCOLOR Quantity_NOC_MATRAGRAY
#define DEFAULT_HILIGHTCOLOR Quantity_NOC_YELLOW
#pragma warning( disable : 4244 ) // Issue warning 4244
#include <Standard_ShortReal.hxx>
#pragma warning( default : 4244 ) // Issue warning 4244
#include <Standard.hxx>
/*
#ifndef Version15B
# ifndef Version15D
# ifndef Version20
# define Version15B
# endif // Version20
# endif // Version15D
#endif // Version15B
#pragma message ("=============================")
#ifdef Version15B
# pragma message ("Set the libs for version 1.5B")
#endif // Version15B
#ifdef Version15D
# pragma message ("Set the libs for version 1.5D")
#endif // Version15D
#ifdef Version20
# pragma message ("Set the libs for version 2.0 ")
#endif // Version20
#pragma message ("=============================")
#ifdef Version15B
# pragma comment (lib,"TKTop.lib")
# pragma comment (lib,"TShort.lib")
# pragma comment (lib,"TColQuantity.lib")
#endif
#ifdef Version15D
# pragma comment (lib,"TKTop.lib")
#endif
#ifdef Version20
# pragma comment (lib,"TKTop1.lib")
# pragma comment (lib,"TKTop2.lib")
#endif
#pragma message ("Set the specific libs for the application")
# pragma comment (lib,"TKPrs.lib")
# pragma comment (lib,"TKGeom.lib")
# pragma comment (lib,"TKGlt.lib")
# pragma comment (lib,"TKGraphic.lib")
# pragma comment (lib,"TKPrsMgr.lib")
# pragma comment (lib,"TKViewers.lib")
# pragma comment (lib,"TKSession.lib")
# pragma comment (lib,"gp.lib")
# pragma comment (lib,"TKernel.lib")
# pragma comment (lib,"UnitsAPI.lib")
# pragma comment (lib,"PTColStd.lib")
# pragma comment (lib,"TKMgtShape.lib")
# pragma comment (lib,"TKPShape.lib")
# pragma comment (lib,"ShapeSchema.lib")
# pragma comment (lib,"FSD.lib")
# pragma comment (lib,"OSDriver.lib")
# pragma comment (lib,"ObjMgt.lib")
# pragma comment (lib,"TKXSBase.lib")
# pragma comment (lib,"TKXSIGES.lib")
# pragma comment (lib,"TKXS214.lib")
*/
#include <AIS_Drawer.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_Shape.hxx>
#include <AIS_Trihedron.hxx>
#include <Aspect_Background.hxx>
#include <Aspect_TypeOfline.hxx>
#include <Aspect_TypeOfText.hxx>
#include <Aspect_WidthOfline.hxx>
#include <Aspect_Window.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI.hxx>
#include <BRepTools.hxx>
#include <Standard_DefineHandle.hxx>
#include <DsgPrs_LengthPresentation.hxx>
#include <GCE2d_MakeSegment.hxx>
#include <GCPnts_TangentialDeflection.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom_Axis2Placement.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <GeomAbs_CurveType.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomTools_Curve2dSet.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec.hxx>
#include <gp_Vec2d.hxx>
#include <Graphic2d_Array1OfVertex.hxx>
#include <Graphic2d_Buffer.hxx>
#include <Graphic2d_CircleMarker.hxx>
#include <Graphic2d_DisplayList.hxx>
#include <Graphic2d_Drawer.hxx>
#include <Graphic2d_PolyLine.hxx>
#include <Graphic2d_Segment.hxx>
#include <Graphic2d_SetOfCurves.hxx>
#include <Graphic2d_SetOfSegments.hxx>
#include <Graphic2d_Text.hxx>
#include <Graphic2d_Vertex.hxx>
#include <Graphic2d_View.hxx>
#include <Graphic3d_WNTGraphicDevice.hxx>
#include <MMgt_TShared.hxx>
#include <OSD_Environment.hxx>
#include <Precision.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Text.hxx>
#include <PrsMgr_PresentationManager2d.hxx>
#include <Quantity_Factor.hxx>
#include <Quantity_Length.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Quantity_PhysicalQuantity.hxx>
#include <Quantity_PlaneAngle.hxx>
#include <Quantity_TypeOfColor.hxx>
#include <Select2D_SensitiveArc.hxx>
#include <Select2D_SensitiveBox.hxx>
#include <Select2D_SensitiveEntity.hxx>
#include <Select2D_SensitiveSegment.hxx>
#include <SelectBasics_BasicTool.hxx>
#include <SelectBasics_ListOfBox2d.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_SelectableObject.hxx>
#include <SelectMgr_Selection.hxx>
#include <SelectMgr_SelectionManager.hxx>
// had for opencascade
//#include <Session_Selection.hxx>
//#include <Session_Session.hxx>
//#include <ShapeSchema.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Integer.hxx>
#include <Standard_IStream.hxx>
#include <Standard_Macro.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_OStream.hxx>
#include <Standard_Real.hxx>
#include <StdPrs_Curve.hxx>
#include <StdPrs_Point.hxx>
#include <StdPrs_PoleCurve.hxx>
#include <StdSelect_SensitiveText2d.hxx>
#include <StdSelect_TextProjector2d.hxx>
#include <StdSelect_ViewerSelector2d.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColgp_HArray1OfPnt2d.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
#include <TColStd_MapOfTransient.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_ListIteratorOfListOfShape.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <UnitsAPI.hxx>
#include <V2d_View.hxx>
#include <V2d_Viewer.hxx>
#include <V3d_View.hxx>
#include <V3d_Viewer.hxx>
#include <WNT_WDriver.hxx>
#include <WNT_Window.hxx>
#include "HLRAlgo_Projector.hxx"
#include "Aspect_MarkMap.hxx"
#include <V3d_PerspectiveView.hxx>
#include <Geom_BSplineSurface.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Solid.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <BndLib_AddSurface.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBndLib.hxx>
#include "..\res\resource.h"
//End CasCade
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__79840E80_1001_11D2_B8C1_0000F87A77C1__INCLUDED_)

View File

@@ -0,0 +1,74 @@
// ThreadDialog.cpp : implementation file
//
#include "stdafx.h"
#include "AnimationApp.h"
#include "ThreadDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CThreadDialog dialog
CThreadDialog::CThreadDialog(CWnd* pParent /*=NULL*/)
: CDialog(CThreadDialog::IDD, pParent)
{
// EnableAutomation();
//{{AFX_DATA_INIT(CThreadDialog)
m_Angle = 4;
//}}AFX_DATA_INIT
}
void CThreadDialog::OnFinalRelease()
{
// When the last reference for an automation object is released
// OnFinalRelease is called. The base class will automatically
// deletes the object. Add additional cleanup required for your
// object before calling the base class.
CDialog::OnFinalRelease();
}
void CThreadDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CThreadDialog)
DDX_Text(pDX, IDC_Angle, m_Angle);
DDV_MinMaxUInt(pDX, m_Angle, 1, 60);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CThreadDialog, CDialog)
//{{AFX_MSG_MAP(CThreadDialog)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DISPATCH_MAP(CThreadDialog, CDialog)
//{{AFX_DISPATCH_MAP(CThreadDialog)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
// Note: we add support for IID_IThreadDialog to support typesafe binding
// from VBA. This IID must match the GUID that is attached to the
// dispinterface in the .ODL file.
// {539445D7-1182-11D2-B8C9-0000F87A77C1}
static const IID IID_IThreadDialog =
{ 0x539445d7, 0x1182, 0x11d2, { 0xb8, 0xc9, 0x0, 0x0, 0xf8, 0x7a, 0x77, 0xc1 } };
BEGIN_INTERFACE_MAP(CThreadDialog, CDialog)
INTERFACE_PART(CThreadDialog, IID_IThreadDialog, Dispatch)
END_INTERFACE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CThreadDialog message handlers

View File

@@ -0,0 +1,54 @@
#if !defined(AFX_THREADDIALOG_H__539445D8_1182_11D2_B8C9_0000F87A77C1__INCLUDED_)
#define AFX_THREADDIALOG_H__539445D8_1182_11D2_B8C9_0000F87A77C1__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ThreadDialog.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CThreadDialog dialog
class CThreadDialog : public CDialog
{
// Construction
public:
CThreadDialog(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CThreadDialog)
enum { IDD = IDD_ThreadBoxDialog };
UINT m_Angle;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CThreadDialog)
public:
virtual void OnFinalRelease();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CThreadDialog)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Generated OLE dispatch map functions
//{{AFX_DISPATCH(CThreadDialog)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_THREADDIALOG_H__539445D8_1182_11D2_B8C9_0000F87A77C1__INCLUDED_)

View File

@@ -0,0 +1,140 @@
// Tune.cpp : implementation file
//
#include "stdafx.h"
#include "Tune.h"
#include "AnimationApp.h"
#include "Animationdoc.h"
#include "AnimationView3D.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTune dialog
CTune::CTune(CWnd* pParent /*=NULL*/)
: CDialog(CTune::IDD, pParent)
{
//{{AFX_DATA_INIT(CTune)
m_dAngle = 0.0;
m_dFocus = 0.0;
//}}AFX_DATA_INIT
}
void CTune::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTune)
DDX_Text(pDX, IDC_APPERTURE, m_dAngle);
DDV_MinMaxDouble(pDX, m_dAngle, 5., 179.);
DDX_Text(pDX, IDC_FOCDIST, m_dFocus);
DDV_MinMaxDouble(pDX, m_dFocus, 1.e-003, 10000000.);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTune, CDialog)
//{{AFX_MSG_MAP(CTune)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINANG, OnDeltaposSpinang)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPINFOC, OnDeltaposSpinfoc)
ON_EN_CHANGE(IDC_APPERTURE, OnChangeApperture)
ON_EN_CHANGE(IDC_FOCDIST, OnChangeFocdist)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTune message handlers
void CTune::OnDeltaposSpinang(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
if ( pNMUpDown->iDelta > 0 ) {
if ( m_dAngle > 2. )
m_dAngle -= 1. ;
}
else {
if ( m_dAngle < 178. )
m_dAngle += 1 ;
}
UpdateData ( FALSE ) ;
OnChangeApperture() ;
*pResult = 0;
}
void CTune::OnDeltaposSpinfoc(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
if ( pNMUpDown->iDelta > 0 ) {
m_dFocus /= 1.1 ;
}
else {
m_dFocus *= 1.1 ;
}
UpdateData ( FALSE ) ;
OnChangeFocdist() ;
*pResult = 0;
}
void CTune::OnChangeApperture()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
( (CAnimationView3D *) m_pView) ->SetFocal ( m_dFocus , m_dAngle ) ;
}
void CTune::OnChangeFocdist()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
( (CAnimationView3D *) m_pView) ->SetFocal ( m_dFocus , m_dAngle ) ;
}
BOOL CTune::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::OnCommand(wParam, lParam);
}
BOOL CTune::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CTune::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::OnNotify(wParam, lParam, pResult);
}

View File

@@ -0,0 +1,54 @@
#if !defined(AFX_TUNE_H__D7E45B53_AAD2_11D2_9E97_0800362A0F04__INCLUDED_)
#define AFX_TUNE_H__D7E45B53_AAD2_11D2_9E97_0800362A0F04__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// Tune.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CTune dialog
class CTune : public CDialog
{
// Construction
public:
CTune(CWnd* pParent = NULL); // standard constructor
CView * m_pView;
// Dialog Data
//{{AFX_DATA(CTune)
enum { IDD = IDD_TUNE };
double m_dAngle;
double m_dFocus;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTune)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CTune)
afx_msg void OnDeltaposSpinang(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnDeltaposSpinfoc(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnChangeApperture();
afx_msg void OnChangeFocdist();
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_TUNE_H__D7E45B53_AAD2_11D2_9E97_0800362A0F04__INCLUDED_)