X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=samples%2Fmfc%2Fstandard%2F09_Animation%2Fsrc%2FAnimationDoc.cpp;h=ecb0f0b6a72f710ecb448b660339bc1ccaf0322d;hb=64f128c1117c91c5e41a83b0ae2d14e64ed71f64;hpb=08b7a39f75899eb36147b38d86a1aed654917c2d diff --git a/samples/mfc/standard/09_Animation/src/AnimationDoc.cpp b/samples/mfc/standard/09_Animation/src/AnimationDoc.cpp index 2d35a3109f..ecb0f0b6a7 100755 --- a/samples/mfc/standard/09_Animation/src/AnimationDoc.cpp +++ b/samples/mfc/standard/09_Animation/src/AnimationDoc.cpp @@ -45,10 +45,6 @@ CAnimationDoc::CAnimationDoc() { // TODO: add one-time construction code here - static Standard_Integer StaticCount=1; - StaticCount++; - myCount = StaticCount; - Handle(Graphic3d_GraphicDriver) aGraphicDriver = ((CAnimationApp*)AfxGetApp())->GetGraphicDriver(); @@ -60,7 +56,6 @@ CAnimationDoc::CAnimationDoc() myDeviation = 0.0008; thread = 4; - myAngle = 0; BRep_Builder B; TopoDS_Shape CrankArm; @@ -184,90 +179,6 @@ void CAnimationDoc::Dump(CDumpContext& dc) const //----------------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------------- -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 == 1) - myAISContext->Select (theButtonDownX, theButtonDownY, x, y, aView, Standard_True); -} - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -void CAnimationDoc::InputEvent(const Standard_Integer /*x*/, - const Standard_Integer /*y*/, - const Handle(V3d_View)& /*aView*/ ) -{ - myAISContext->Select (Standard_True); -} - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -void CAnimationDoc::MoveEvent(const Standard_Integer x , - const Standard_Integer y , - const Handle(V3d_View)& aView ) -{ - myAISContext->MoveTo (x, y, aView, Standard_True); -} - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -void CAnimationDoc::ShiftMoveEvent(const Standard_Integer x , - const Standard_Integer y , - const Handle(V3d_View)& aView ) -{ - myAISContext->MoveTo (x, y, aView, Standard_True); -} - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -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, Standard_True); -} - - -//----------------------------------------------------------------------------------------- -// -//----------------------------------------------------------------------------------------- -void CAnimationDoc::ShiftInputEvent(const Standard_Integer /*x*/, - const Standard_Integer /*y*/, - const Handle(V3d_View)& /*aView*/) -{ - myAISContext->ShiftSelect (Standard_True); -} //----------------------------------------------------------------------------------------- // @@ -278,7 +189,7 @@ void CAnimationDoc::Popup(const Standard_Integer /*x*/, { } -void CAnimationDoc::OnMyTimer() +void CAnimationDoc::OnMyTimer (double theTimeSec) { // TODO: Add your message handler code here and/or call default @@ -287,9 +198,7 @@ void CAnimationDoc::OnMyTimer() Standard_Real X; gp_Ax1 Ax1(gp_Pnt(0,0,0),gp_Vec(0,0,1)); - myAngle++; - - angleA = thread*myAngle*M_PI/180; + angleA = thread * theTimeSec; X = Sin(angleA)*3/8; angleB = atan(X / Sqrt(-X * X + 1)); Standard_Real decal(25*0.6); @@ -308,8 +217,6 @@ void CAnimationDoc::OnMyTimer() 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()