0028389: Data Exchange - Import of STEP Saved Views and Clipping Planes
[occt.git] / samples / mfc / standard / 04_Viewer3d / src / Viewer3dDoc.cpp
CommitLineData
7fd59977 1// Viewer3dDoc.cpp : implementation of the CViewer3dDoc class
2//
3
4#include "stdafx.h"
5#include "Viewer3dApp.h"
6#include "BoxRadius.h"
7#include "DlgIsos.h"
8
9#include "Viewer3dDoc.h"
10#include "Viewer3dView.h"
11#include "OffsetDlg.h"
12#include "ResultDialog.h"
13#include "User_Cylinder.hxx"
14
15#include "AIS_Trihedron.hxx"
16#include "Geom_Axis2Placement.hxx"
17
18/////////////////////////////////////////////////////////////////////////////
19// CViewer3dDoc
20
21IMPLEMENT_DYNCREATE(CViewer3dDoc, CDocument)
22
47162471 23BEGIN_MESSAGE_MAP(CViewer3dDoc, OCC_3dDoc)
24 //{{AFX_MSG_MAP(CViewer3dDoc)
25 ON_COMMAND(ID_BOX, OnBox)
26 ON_COMMAND(ID_Cylinder, OnCylinder)
27 ON_COMMAND(ID_SPHERE, OnSphere)
28 ON_COMMAND(ID_ERASEALL, OnRemoveAll)
29 ON_COMMAND(ID_NBISOS, OnNbisos)
30 ON_COMMAND(ID_FACES, OnFaces)
31 ON_COMMAND(ID_EDGES, OnEdges)
32 ON_COMMAND(ID_VERTICES, OnVertices)
33 ON_COMMAND(ID_NEUTRAL, OnNeutral)
34 ON_COMMAND(ID_USERCYLINDER_CHANGEFACECOLOR, OnUsercylinderChangefacecolor)
35 ON_COMMAND(ID_FILLET3D, OnFillet3d)
36 ON_COMMAND(ID_CIRCLE, OnCircle)
37 ON_COMMAND(ID_LINE, OnLine)
38 ON_COMMAND(ID_OVERLAPPED_BOX, OnOverlappedBox)
39 ON_COMMAND(ID_OVERLAPPED_CYLINDER, OnOverlappedCylinder)
40 ON_COMMAND(ID_OVERLAPPED_SPHERE, OnOverlappedSphere)
41 ON_COMMAND(ID_POLYGON_OFFSETS, OnPolygonOffsets)
42 ON_UPDATE_COMMAND_UI(ID_POLYGON_OFFSETS, OnUpdatePolygonOffsets)
43 ON_UPDATE_COMMAND_UI(ID_Cylinder, OnUpdateCylinder)
44 ON_UPDATE_COMMAND_UI(ID_SPHERE, OnUpdateSphere)
45 ON_UPDATE_COMMAND_UI(ID_BOX, OnUpdateBox)
46 ON_UPDATE_COMMAND_UI(ID_OVERLAPPED_CYLINDER, OnUpdateOverlappedCylinder)
47 ON_UPDATE_COMMAND_UI(ID_OVERLAPPED_SPHERE, OnUpdateOverlappedSphere)
48 ON_UPDATE_COMMAND_UI(ID_OVERLAPPED_BOX, OnUpdateOverlappedBox)
49 ON_COMMAND(ID_OBJECT_REMOVE, OnObjectRemove)
50 ON_COMMAND(ID_OBJECT_ERASE, OnObjectErase)
51 ON_COMMAND(ID_OBJECT_DISPLAYALL, OnObjectDisplayall)
52 ON_COMMAND(ID_OBJECT_COLORED_MESH, OnObjectColoredMesh)
53 ON_UPDATE_COMMAND_UI(ID_OBJECT_COLORED_MESH, OnUpdateObjectColoredMesh)
54 ON_UPDATE_COMMAND_UI(ID_OBJECT_SHADING, OnUpdateObjectShading)
55 ON_UPDATE_COMMAND_UI(ID_OBJECT_WIREFRAME, OnUpdateObjectWireframe)
56 ON_COMMAND(ID_OPTIONS_TRIHEDRON_DYNAMIC_TRIHEDRON, OnOptionsTrihedronDynamicTrihedron)
57 ON_UPDATE_COMMAND_UI(ID_OPTIONS_TRIHEDRON_DYNAMIC_TRIHEDRON, OnUpdateOptionsTrihedronDynamicTrihedron)
58 ON_UPDATE_COMMAND_UI(ID_OPTIONS_TRIHEDRON_STATIC_TRIHEDRON, OnUpdateOptionsTrihedronStaticTrihedron)
59 ON_COMMAND(ID_OBJECT_MATERIAL, OnObjectMaterial)
60 ON_COMMAND(ID_TEXTURE_ON, OnTextureOn)
61 ON_COMMAND(ID_BUTTONNext, OnBUTTONNext)
62 ON_COMMAND(ID_BUTTONStart, OnBUTTONStart)
63 ON_COMMAND(ID_BUTTONRepeat, OnBUTTONRepeat)
64 ON_COMMAND(ID_BUTTONPrev, OnBUTTONPrev)
65 ON_COMMAND(ID_BUTTONEnd, OnBUTTONEnd)
66 ON_UPDATE_COMMAND_UI(ID_BUTTONNext, OnUpdateBUTTONNext)
67 ON_UPDATE_COMMAND_UI(ID_BUTTONPrev, OnUpdateBUTTONPrev)
68 ON_UPDATE_COMMAND_UI(ID_BUTTONStart, OnUpdateBUTTONStart)
69 ON_UPDATE_COMMAND_UI(ID_BUTTONRepeat, OnUpdateBUTTONRepeat)
70 ON_UPDATE_COMMAND_UI(ID_BUTTONEnd, OnUpdateBUTTONEnd)
71 ON_COMMAND(ID_FILE_NEW, OnFileNew)
72 ON_COMMAND(ID_DUMP_VIEW, OnDumpView)
73 //}}AFX_MSG_MAP
7fd59977 74END_MESSAGE_MAP()
75
76/////////////////////////////////////////////////////////////////////////////
77// CViewer3dDoc construction/destruction
78
79CViewer3dDoc::CViewer3dDoc()
a6eb515f 80:OCC_3dDoc()
7fd59977 81{
47162471 82 myCylinder.Nullify();
83 mySphere.Nullify();
84 myBox.Nullify();
85 myOverlappedCylinder.Nullify();
86 myOverlappedSphere.Nullify();
87 myOverlappedBox.Nullify();
88 myOffsetDlg = NULL;
89 myStaticTrihedronAxisIsDisplayed = FALSE;
90 myState = -1;
7fd59977 91
47162471 92 isTextureSampleStarted = FALSE;
7fd59977 93
47162471 94 myPresentation = OCCDemo_Presentation::Current;
95 myPresentation->SetDocument(this);
7fd59977 96
97
47162471 98 myAISContext->DefaultDrawer()->ShadingAspect()->SetColor(Quantity_NOC_CHARTREUSE1);
99 myAISContext->DefaultDrawer()->ShadingAspect()->SetMaterial(Graphic3d_NOM_SILVER);
7fd59977 100
47162471 101 strcpy_s(myDataDir, "Data");
102 strcpy_s(myLastPath, ".");
7fd59977 103
47162471 104 /*
105 Handle(AIS_Trihedron) myTrihedron;
106 Handle(Geom_Axis2Placement) myTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
107 myTrihedron=new AIS_Trihedron(myTrihedronAxis);
108 myAISContext->Display(myTrihedron);
109 */
7fd59977 110}
111
112CViewer3dDoc::~CViewer3dDoc()
113{
114}
115
116/////////////////////////////////////////////////////////////////////////////
117// CViewer3dDoc diagnostics
118
119#ifdef _DEBUG
120void CViewer3dDoc::AssertValid() const
121{
47162471 122 CDocument::AssertValid();
7fd59977 123}
124
125void CViewer3dDoc::Dump(CDumpContext& dc) const
126{
47162471 127 CDocument::Dump(dc);
7fd59977 128}
129#endif //_DEBUG
130
131/////////////////////////////////////////////////////////////////////////////
132// CViewer3dDoc commands
133
576f8b11 134void CViewer3dDoc::UpdateResultMessageDlg (CString theTitle, const TCollection_AsciiString& theMessage)
7fd59977 135{
47162471 136 CString aText (theMessage.ToCString());
137 myCResultDialog.SetText (aText);
138 myCResultDialog.SetTitle(theTitle);
576f8b11 139}
7fd59977 140
576f8b11 141void CViewer3dDoc::UpdateResultMessageDlg(CString theTitle, CString theMessage)
142{
143 myCResultDialog.SetText (theMessage);
144 myCResultDialog.SetTitle(theTitle);
7fd59977 145}
146
47162471 147void CViewer3dDoc::OnBox()
7fd59977 148{
47162471 149 if(myBox.IsNull())
150 {
151 BRepPrimAPI_MakeBox B(gp_Pnt(0,-400,-100), 200.,150.,100.);
7fd59977 152
153
47162471 154 myBox = new AIS_Shape(B.Shape());
7fd59977 155
0577ae8c 156 myAISContext->SetMaterial (myBox, Graphic3d_NOM_PEWTER, Standard_False);
157 myAISContext->SetDisplayMode (myBox, 1, Standard_False);
7fd59977 158
0577ae8c 159 myAISContext->Display (myBox, Standard_True);
47162471 160 TCollection_AsciiString Message("\
7fd59977 161BRepPrimAPI_MakeBox Box1(gp_Pnt(0,-400,-100), 200.,150.,100.);\n\
47162471 162 ");
7fd59977 163
47162471 164 UpdateResultMessageDlg("Create Box",Message);
165 }
7fd59977 166}
167
47162471 168void CViewer3dDoc::OnCylinder()
7fd59977 169{
47162471 170 if(myCylinder.IsNull())
171 {
172 gp_Ax2 CylAx2(gp_Pnt(0,0,-100), gp_Dir(gp_Vec(gp_Pnt(0,0,-100),gp_Pnt(0,0,100))));
173 myCylinder = new User_Cylinder(CylAx2, 80.,200.);
7fd59977 174
0577ae8c 175 myAISContext->SetDisplayMode (myCylinder, 1, Standard_False);
7fd59977 176
0577ae8c 177 myAISContext->Display (myCylinder, Standard_True);
7fd59977 178
47162471 179 TCollection_AsciiString Message("\
7fd59977 180gp_Ax2 CylAx2(gp_Pnt(0,0,-100), gp_Dir(gp_Vec(gp_Pnt(0,0,-100),gp_Pnt(0,0,100))));\n\
181C = new User_Cylinder(CylAx2, 80.,200.);;\n\
47162471 182 ");
7fd59977 183
47162471 184 UpdateResultMessageDlg("Create Cylinder",Message);
185 }
7fd59977 186}
187
47162471 188void CViewer3dDoc::OnSphere()
7fd59977 189{
47162471 190 if(mySphere.IsNull())
191 {
192 BRepPrimAPI_MakeSphere S(gp_Pnt(0,300,0), 100.);
7fd59977 193
47162471 194 mySphere = new AIS_Shape(S.Shape());
7fd59977 195
0577ae8c 196 myAISContext->SetMaterial (mySphere, Graphic3d_NOM_BRONZE, Standard_False);
197 myAISContext->SetDisplayMode (mySphere, 1, Standard_False);
47162471 198
0577ae8c 199 myAISContext->Display (mySphere, Standard_False);
47162471 200 TCollection_AsciiString Message("\
7fd59977 201BRepPrimAPI_MakeSphere S(gp_Pnt(0,300,0), 100.);\n\
47162471 202 ");
203 UpdateResultMessageDlg("Create Sphere",Message);
204 }
7fd59977 205}
206
47162471 207void CViewer3dDoc::OnRemoveAll()
7fd59977 208
209{
47162471 210 AIS_ListOfInteractive aListOfObjects;
211 myAISContext->ObjectsInside(aListOfObjects,AIS_KOI_Shape);
7fd59977 212
47162471 213 AIS_ListIteratorOfListOfInteractive aListIterator;
214 for(aListIterator.Initialize(aListOfObjects);aListIterator.More();aListIterator.Next()){
0577ae8c 215 myAISContext->Remove (aListIterator.Value(), Standard_False);
47162471 216 }
7fd59977 217
0577ae8c 218 myAISContext->Remove (myCylinder, Standard_True);
7fd59977 219
220
47162471 221 myCylinder.Nullify();
222 mySphere.Nullify();
223 myBox.Nullify();
224 myOverlappedCylinder.Nullify();
225 myOverlappedSphere.Nullify();
226 myOverlappedBox.Nullify();
227 if(myOffsetDlg && myOffsetDlg->IsWindowVisible())
228 myOffsetDlg->UpdateValues();
7fd59977 229}
230
231void CViewer3dDoc::OnOverlappedBox()
232{
47162471 233 OnBox();
234 if(myOverlappedBox.IsNull()){
235 BRepPrimAPI_MakeBox B(gp_Pnt(0,-400,-100), 200.,150.,100.);
7fd59977 236
47162471 237 BRepBuilderAPI_NurbsConvert aNurbsConvert(B.Shape());
238 TopoDS_Shape aBoxShape2 = aNurbsConvert.Shape();
7fd59977 239
240
47162471 241 myOverlappedBox = new AIS_Shape(aBoxShape2);
7fd59977 242
0577ae8c 243 myAISContext->SetMaterial (myOverlappedBox, Graphic3d_NOM_GOLD, Standard_False);
244 myAISContext->SetDisplayMode (myOverlappedBox, 1, Standard_False);
7fd59977 245
0577ae8c 246 myAISContext->Display (myOverlappedBox, Standard_True);
47162471 247 TCollection_AsciiString Message("\
7fd59977 248BRepPrimAPI_MakeBox Box1(gp_Pnt(0,-400,-100), 200.,150.,100.);\n\
249\n\
250BRepPrimAPI_MakeBox Box2(gp_Pnt(0,-400,-100), 200.,150.,100.);\n\
251BRepBuilderAPI_NurbsConvert aNurbsConvert(Box2.Shape());\n\
47162471 252 ");
253 UpdateResultMessageDlg("Create overlapped boxes",Message);
254 if(myOffsetDlg && myOffsetDlg->IsWindowVisible())
255 myOffsetDlg->UpdateValues();
256 }
7fd59977 257}
258
47162471 259void CViewer3dDoc::OnOverlappedCylinder()
7fd59977 260{
47162471 261 OnCylinder();
262
263 if(myOverlappedCylinder.IsNull()){
264 gp_Ax2 CylAx2(gp_Pnt(0,0,-100), gp_Dir(gp_Vec(gp_Pnt(0,0,-100),gp_Pnt(0,0,100))));
265 BRepPrimAPI_MakeCylinder C(CylAx2, 80.,200.);
7fd59977 266
47162471 267 BRepBuilderAPI_NurbsConvert aNurbsConvert(C.Shape());
268 TopoDS_Shape aCylShape2 = aNurbsConvert.Shape();
7fd59977 269
47162471 270 myOverlappedCylinder = new AIS_Shape(aCylShape2);
7fd59977 271
7fd59977 272
0577ae8c 273 myAISContext->SetMaterial (myOverlappedCylinder, Graphic3d_NOM_GOLD, Standard_False);
274 myAISContext->SetDisplayMode (myOverlappedCylinder, 1, Standard_False);
7fd59977 275
0577ae8c 276 myAISContext->Display (myOverlappedCylinder, Standard_True);
7fd59977 277
47162471 278 TCollection_AsciiString Message("\
7fd59977 279gp_Ax2 CylAx2(gp_Pnt(0,0,-100), gp_Dir(gp_Vec(gp_Pnt(0,0,-100),gp_Pnt(0,0,100))));\n\
280Cylinder1 = new User_Cylinder(CylAx2, 80.,200.);\n\
281\n\
282BRepPrimAPI_MakeCylinder Cylinder2(CylAx2, 80.,200.);\n\
283BRepBuilderAPI_NurbsConvert aNurbsConvert(Cylinder2.Shape());\n\
47162471 284 ");
285 UpdateResultMessageDlg("Create overlapped cylinders",Message);
286 if (myOffsetDlg && myOffsetDlg->IsWindowVisible())
287 {
288 myOffsetDlg->UpdateValues();
289 }
290 }
7fd59977 291}
292
47162471 293void CViewer3dDoc::OnOverlappedSphere()
7fd59977 294{
47162471 295 OnSphere();
296 if(myOverlappedSphere.IsNull()){
297 BRepPrimAPI_MakeSphere S(gp_Pnt(0,300,0), 100.);
7fd59977 298
47162471 299 BRepBuilderAPI_NurbsConvert aNurbsConvert(S.Shape());
300 TopoDS_Shape aSphereShape2 = aNurbsConvert.Shape();
7fd59977 301
47162471 302 myOverlappedSphere = new AIS_Shape(aSphereShape2);
7fd59977 303
0577ae8c 304 myAISContext->SetMaterial (myOverlappedSphere, Graphic3d_NOM_GOLD, Standard_False);
7fd59977 305
0577ae8c 306 myAISContext->SetDisplayMode (myOverlappedSphere, 1, Standard_False);
7fd59977 307
0577ae8c 308 myAISContext->Display (myOverlappedSphere, Standard_True);
7fd59977 309
47162471 310 TCollection_AsciiString Message("\
7fd59977 311BRepPrimAPI_MakeSphere Sphere1(gp_Pnt(0,300,0), 100.);\n\
312\n\
313BRepPrimAPI_MakeSphere Sphere2(gp_Pnt(0,300,0), 100.);\n\
314BRepBuilderAPI_NurbsConvert aNurbsConvert(Sphere2.Shape());\n\
47162471 315 ");
316 UpdateResultMessageDlg("Create overlapped spheres",Message);
317 if (myOffsetDlg && myOffsetDlg->IsWindowVisible())
318 {
319 myOffsetDlg->UpdateValues();
320 }
321 }
7fd59977 322}
323
47162471 324void CViewer3dDoc::OnPolygonOffsets()
7fd59977 325{
47162471 326 myOffsetDlg = new COffsetDlg(this);
327 myOffsetDlg->Create(COffsetDlg::IDD,NULL);
328 myAISContext->UpdateCurrentViewer();
7fd59977 329}
330
331void CViewer3dDoc::OnUpdatePolygonOffsets(CCmdUI* pCmdUI)
332{
47162471 333 Standard_Integer aOffsetMode;
334 Standard_ShortReal aFactor;
335 Standard_ShortReal aCylUnits = 0;
336 Standard_ShortReal aSphereUnits = 0;
337 Standard_ShortReal aBoxUnits = 0;
7fd59977 338
47162471 339 BOOL IsOverlappedCylinderDisplayed = myAISContext->IsDisplayed(myOverlappedCylinder);
340 BOOL IsOverlappedSphereDisplayed = myAISContext->IsDisplayed(myOverlappedSphere);
341 BOOL IsOverlappedBoxDisplayed = myAISContext->IsDisplayed(myOverlappedBox);
342 BOOL IsAnyOverlappedObjectDisplayed =
343 IsOverlappedCylinderDisplayed || IsOverlappedSphereDisplayed || IsOverlappedBoxDisplayed;
7fd59977 344
47162471 345 if(!myOverlappedCylinder.IsNull() && IsOverlappedCylinderDisplayed){
346 myOverlappedCylinder->PolygonOffsets(aOffsetMode,aFactor,aCylUnits);
347 }
7fd59977 348
47162471 349 if(!myOverlappedSphere.IsNull() && IsOverlappedSphereDisplayed){
350 myOverlappedSphere->PolygonOffsets(aOffsetMode,aFactor,aSphereUnits);
351 }
352
353 if(!myOverlappedBox.IsNull() && IsOverlappedBoxDisplayed){
354 myOverlappedBox->PolygonOffsets(aOffsetMode,aFactor,aBoxUnits);
355 }
356
357 if(myOffsetDlg && myOffsetDlg->IsWindowVisible())
358 pCmdUI->SetCheck(TRUE);
359 else
360 pCmdUI->SetCheck(FALSE);
361 if (IsAnyOverlappedObjectDisplayed)
362 if(myOffsetDlg)
363 pCmdUI->Enable(!myOffsetDlg->IsWindowVisible());
364 else
365 pCmdUI->Enable(TRUE);
366 else
367 pCmdUI->Enable(FALSE);
7fd59977 368}
369
47162471 370void CViewer3dDoc::OnUpdateCylinder(CCmdUI* pCmdUI)
7fd59977 371{
47162471 372 pCmdUI->Enable(myCylinder.IsNull());
7fd59977 373}
374
47162471 375void CViewer3dDoc::OnUpdateSphere(CCmdUI* pCmdUI)
7fd59977 376{
47162471 377 pCmdUI->Enable(mySphere.IsNull());
7fd59977 378}
379
47162471 380void CViewer3dDoc::OnUpdateBox(CCmdUI* pCmdUI)
7fd59977 381{
47162471 382 pCmdUI->Enable(myBox.IsNull());
7fd59977 383}
384
47162471 385void CViewer3dDoc::OnUpdateOverlappedCylinder(CCmdUI* pCmdUI)
7fd59977 386{
47162471 387 pCmdUI->Enable (myOverlappedCylinder.IsNull()
388 || myCylinder.IsNull());
389
7fd59977 390}
391
47162471 392void CViewer3dDoc::OnUpdateOverlappedSphere(CCmdUI* pCmdUI)
7fd59977 393{
47162471 394 pCmdUI->Enable (myOverlappedSphere.IsNull()
395 || mySphere.IsNull());
7fd59977 396}
397
47162471 398void CViewer3dDoc::OnUpdateOverlappedBox(CCmdUI* pCmdUI)
7fd59977 399{
47162471 400 pCmdUI->Enable (myOverlappedBox.IsNull()
401 || myBox.IsNull());
7fd59977 402}
403
47162471 404void CViewer3dDoc::OnObjectRemove()
7fd59977 405{
404c8936 406 // A small trick to avoid complier error (C2668).
407 const Handle(AIS_InteractiveObject)& aBox = myBox;
408 if(myAISContext->IsSelected (aBox))
47162471 409 myBox.Nullify();
7fd59977 410
404c8936 411 const Handle(AIS_InteractiveObject)& aCylinder = myCylinder;
412 if(myAISContext->IsSelected (aCylinder))
47162471 413 myCylinder.Nullify();
7fd59977 414
404c8936 415 const Handle(AIS_InteractiveObject)& aSphere = mySphere;
416 if(myAISContext->IsSelected (aSphere))
47162471 417 mySphere.Nullify();
7fd59977 418
404c8936 419 const Handle(AIS_InteractiveObject)& anOverlappedBox = myOverlappedBox;
420 if(myAISContext->IsSelected (anOverlappedBox))
47162471 421 myOverlappedBox.Nullify();
7fd59977 422
404c8936 423 const Handle(AIS_InteractiveObject)& anOverlappedCylinder = myOverlappedCylinder;
424 if(myAISContext->IsSelected (anOverlappedCylinder))
47162471 425 myOverlappedCylinder.Nullify();
7fd59977 426
404c8936 427 const Handle(AIS_InteractiveObject)& anOverlappedSphere = myOverlappedSphere;
428 if(myAISContext->IsSelected (anOverlappedSphere))
47162471 429 myOverlappedSphere.Nullify();
7fd59977 430
7fd59977 431
404c8936 432 for(myAISContext->InitSelected();myAISContext->MoreSelected();myAISContext->InitSelected())
433 myAISContext->Remove(myAISContext->SelectedInteractive(),Standard_True);
7fd59977 434
47162471 435 if(myOffsetDlg && myOffsetDlg->IsWindowVisible())
436 myOffsetDlg->UpdateValues();
7fd59977 437}
438
47162471 439void CViewer3dDoc::OnObjectErase()
7fd59977 440
441{
47162471 442 OCC_3dBaseDoc::OnObjectErase();
443 if(myOffsetDlg && myOffsetDlg->IsWindowVisible())
444 myOffsetDlg->UpdateValues();
7fd59977 445}
446
47162471 447void CViewer3dDoc::OnObjectDisplayall()
7fd59977 448
449{
47162471 450 OCC_3dBaseDoc::OnObjectDisplayall();
451 if(myOffsetDlg && myOffsetDlg->IsWindowVisible())
452 myOffsetDlg->UpdateValues();
7fd59977 453}
454
92efcf78 455Handle(User_Cylinder) CViewer3dDoc::GetCylinder()
7fd59977 456{
47162471 457 return myCylinder;
7fd59977 458}
459
460
92efcf78 461Handle(AIS_Shape) CViewer3dDoc::GetSphere()
7fd59977 462{
47162471 463 return mySphere;
7fd59977 464}
465
92efcf78 466Handle(AIS_Shape) CViewer3dDoc::GetBox()
7fd59977 467{
47162471 468 return myBox;
7fd59977 469}
470
92efcf78 471Handle(AIS_Shape) CViewer3dDoc::GetOverlappedCylinder()
7fd59977 472{
47162471 473 return myOverlappedCylinder;
7fd59977 474}
475
476
92efcf78 477Handle(AIS_Shape) CViewer3dDoc::GetOverlappedSphere()
7fd59977 478{
47162471 479 return myOverlappedSphere;
7fd59977 480}
481
92efcf78 482Handle(AIS_Shape) CViewer3dDoc::GetOverlappedBox()
7fd59977 483{
47162471 484 return myOverlappedBox;
7fd59977 485}
486
47162471 487void CViewer3dDoc::DragEvent (const Standard_Integer theX,
488 const Standard_Integer theY,
489 const Standard_Integer theState,
490 const Handle(V3d_View)& theView)
7fd59977 491{
47162471 492 OCC_3dBaseDoc::DragEvent (theX, theY, theState, theView);
493 if(myOffsetDlg && myOffsetDlg->IsWindowVisible())
494 myOffsetDlg->UpdateValues();
7fd59977 495}
496
497//-----------------------------------------------------------------------------------------
498//
499//-----------------------------------------------------------------------------------------
5c573e69 500void CViewer3dDoc::InputEvent(const Standard_Integer /*x*/,
501 const Standard_Integer /*y*/,
502 const Handle(V3d_View)& /*aView*/ )
7fd59977 503{
5c1f974e 504 if (myOffsetDlg && myOffsetDlg->IsWindowVisible())
505 myOffsetDlg->UpdateValues();
7fd59977 506
5c1f974e 507 Quantity_Color CSFColor;
508 COLORREF MSColor;
0577ae8c 509 myAISContext->Select (Standard_True);
7fd59977 510
5c1f974e 511 // Change the color of a selected face in a user cylinder
512 if (myState == FACE_COLOR)
513 {
514 myAISContext->InitSelected();
515 if (myAISContext->MoreSelected())
516 {
92efcf78 517 Handle(AIS_InteractiveObject) Current = myAISContext->SelectedInteractive();
5c1f974e 518 if (Current->HasColor())
519 {
520 CSFColor = myAISContext->Color (Current);
521 MSColor = RGB (CSFColor.Red()*255.0, CSFColor.Green()*255.0, CSFColor.Blue()*255.0);
522 }
523 else
524 {
525 MSColor = RGB (255, 255, 255);
526 }
527
528 CColorDialog dlgColor(MSColor);
529 if (dlgColor.DoModal() == IDOK)
530 {
531 MSColor = dlgColor.GetColor();
532 CSFColor = Quantity_Color (GetRValue (MSColor)/255.0,
533 GetGValue (MSColor)/255.0,
534 GetBValue (MSColor)/255.0,
535 Quantity_TOC_RGB);
536
4208cf18 537 Handle(AIS_InteractiveObject) aSelectedObject = myAISContext->SelectedInteractive();
538 Handle(User_Cylinder)::DownCast (aSelectedObject)->SetColor (CSFColor.Name());
539
0577ae8c 540 myAISContext->Redisplay (aSelectedObject, Standard_True);
5c1f974e 541 myState = -1;
5c1f974e 542 }
543 }
544
5c573e69 545 myCResultDialog.SetTitle("Change face color");
546 myCResultDialog.SetText(" TopoDS_Shape S = myAISContext->SelectedShape(); \n"
5c1f974e 547 " \n"
548 " Handle(Geom_Surface) Surface = BRep_Tool::Surface(TopoDS::Face(S));"
549 " if (Surface->IsKind(STANDARD_TYPE(Geom_Plane))) \n"
550 " Handle(User_Cylinder)::DownCast(myAISContext->Current())->SetPlanarFaceColor(CSFColor.Name()); \n"
551 " else \n"
552 " Handle(User_Cylinder)::DownCast(myAISContext->Current())->SetCylindricalFaceColor(CSFColor.Name()); \n"
553 " \n"
554 " myAISContext->Redisplay(myAISContext->Current()); \n"
555 " \n"
556 " myAISContext->CloseLocalContext(); \n"
557 " \n"
558 " \n"
559 " NOTE: a User_Cylinder is an object defined by the user. \n"
560 " The User_Cylinder class inherit from the AIS_InteractiveObject \n"
561 " Cascade class, it's use is the same as an AIS_InteractiveObject. \n"
562 " Methods SetPlanarFaceColor and SetCylindricalFaceColor are also \n"
563 " defined in the User_Cylinder class. \n"
564 " \n");
576f8b11 565 SetTitle (L"Change face color");
5c1f974e 566 }
567}
7fd59977 568
569//-----------------------------------------------------------------------------------------
570//
571//-----------------------------------------------------------------------------------------
47162471 572void CViewer3dDoc::ShiftDragEvent (const Standard_Integer theX,
573 const Standard_Integer theY,
574 const Standard_Integer theState,
575 const Handle(V3d_View)& theView)
7fd59977 576{
47162471 577 OCC_3dBaseDoc::ShiftDragEvent(theX, theY, theState, theView);
5c1f974e 578 if(myOffsetDlg && myOffsetDlg->IsWindowVisible())
579 myOffsetDlg->UpdateValues();
7fd59977 580}
581
582
583//-----------------------------------------------------------------------------------------
584//
585//-----------------------------------------------------------------------------------------
47162471 586void CViewer3dDoc::ShiftInputEvent (const Standard_Integer theX,
587 const Standard_Integer theY,
588 const Handle(V3d_View)& theView)
7fd59977 589{
47162471 590 OCC_3dBaseDoc::ShiftInputEvent (theX, theY, theView);
5c1f974e 591 if(myOffsetDlg && myOffsetDlg->IsWindowVisible())
592 myOffsetDlg->UpdateValues();
7fd59977 593}
594
47162471 595void CViewer3dDoc::OnObjectColoredMesh()
7fd59977 596{
404c8936 597 for(myAISContext->InitSelected();myAISContext->MoreSelected();myAISContext->NextSelected())
598 if (myAISContext->SelectedInteractive()->IsKind(STANDARD_TYPE(User_Cylinder)))
5c1f974e 599 {
404c8936 600 myAISContext->ClearPrs(myAISContext->SelectedInteractive(),6,Standard_False);
601 myAISContext->RecomputePrsOnly(myAISContext->SelectedInteractive(), Standard_False);
0577ae8c 602 myAISContext->SetDisplayMode(myAISContext->SelectedInteractive(), 6, Standard_False);
5c1f974e 603 }
0577ae8c 604
605 myAISContext->UpdateCurrentViewer();
7fd59977 606}
607
47162471 608void CViewer3dDoc::OnUpdateObjectColoredMesh(CCmdUI* pCmdUI)
7fd59977 609{
610 bool CylinderIsCurrentAndDisplayed = false;
404c8936 611 for (myAISContext->InitSelected();myAISContext->MoreSelected ();myAISContext->NextSelected ())
612 if(myAISContext->SelectedInteractive()->IsKind(STANDARD_TYPE(User_Cylinder)))
47162471 613 CylinderIsCurrentAndDisplayed=true;
614 pCmdUI->Enable (CylinderIsCurrentAndDisplayed);
7fd59977 615}
616
47162471 617void CViewer3dDoc::OnUpdateObjectWireframe(CCmdUI* pCmdUI)
7fd59977 618{
619 bool OneOrMoreInShadingOrColoredMesh = false;
404c8936 620 for (myAISContext->InitSelected();myAISContext->MoreSelected ();myAISContext->NextSelected ())
621 if (myAISContext->IsDisplayed(myAISContext->SelectedInteractive(), 1) || myAISContext->IsDisplayed(myAISContext->SelectedInteractive(), 6))
47162471 622 OneOrMoreInShadingOrColoredMesh=true;
623 pCmdUI->Enable (OneOrMoreInShadingOrColoredMesh);
7fd59977 624}
625
626
47162471 627void CViewer3dDoc::OnUpdateObjectShading(CCmdUI* pCmdUI)
7fd59977 628{
629 bool OneOrMoreInWireframeOrColoredMesh = false;
404c8936 630 for (myAISContext->InitSelected();myAISContext->MoreSelected ();myAISContext->NextSelected ())
631 if (myAISContext->IsDisplayed(myAISContext->SelectedInteractive(),0) || myAISContext->IsDisplayed(myAISContext->SelectedInteractive(),6))
47162471 632 OneOrMoreInWireframeOrColoredMesh=true;
633 pCmdUI->Enable (OneOrMoreInWireframeOrColoredMesh);
7fd59977 634}
635
47162471 636void CViewer3dDoc::OnOptionsTrihedronDynamicTrihedron()
7fd59977 637{
47162471 638 if (myAISContext -> IsDisplayed(myTrihedron))
639 {
0577ae8c 640 myAISContext->Remove(myTrihedron, Standard_True);
47162471 641 }
642 else
643 {
644 Handle(Geom_Axis2Placement) myTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
645 myTrihedron=new AIS_Trihedron(myTrihedronAxis);
0577ae8c 646 myAISContext->SetTrihedronSize(200, Standard_False);
647 myAISContext->Display(myTrihedron, Standard_True);
47162471 648 }
7fd59977 649}
650
47162471 651void CViewer3dDoc::OnUpdateOptionsTrihedronDynamicTrihedron(CCmdUI* pCmdUI)
7fd59977 652{
47162471 653 if (myAISContext->IsDisplayed(myTrihedron))
654 pCmdUI->SetCheck(1);
655 else
656 pCmdUI->SetCheck(0);
7fd59977 657}
658
659void CViewer3dDoc::SetMyStaticTrihedronAxisIsDisplayed(BOOL IsDisplayed)
660{
47162471 661 myStaticTrihedronAxisIsDisplayed = IsDisplayed;
7fd59977 662}
663
664void CViewer3dDoc::OnUpdateOptionsTrihedronStaticTrihedron(CCmdUI* pCmdUI)
665{
47162471 666 if (myStaticTrihedronAxisIsDisplayed)
667 pCmdUI->SetCheck(1);
668 else
669 pCmdUI->SetCheck(0);
670
7fd59977 671}
672
a6eb515f 673void CViewer3dDoc::Popup (const Standard_Integer x,
674 const Standard_Integer y ,
675 const Handle(V3d_View)& aView)
7fd59977 676{
a6eb515f 677 myPopupMenuNumber=0;
678 // Specified check for context menu number to call
404c8936 679 myAISContext->InitSelected();
680 if (myAISContext->MoreSelected())
7fd59977 681 {
404c8936 682 if (myAISContext->SelectedInteractive()->IsKind(STANDARD_TYPE(User_Cylinder)))
a6eb515f 683 {
684 myPopupMenuNumber = 2;
685 //return;
686 }
687 }
688 OCC_3dBaseDoc::Popup(x,y, aView);
7fd59977 689}
5c1f974e 690
7fd59977 691//Set faces selection mode
692void CViewer3dDoc::OnFaces()
693{
404c8936 694 myAISContext->Activate (AIS_Shape::SelectionMode (TopAbs_FACE));
7fd59977 695
5c573e69 696 myCResultDialog.SetTitle("Standard mode: TopAbs_FACE");
697 myCResultDialog.SetText(" myAISContext->OpenLocalContext(); \n"
5c1f974e 698 " \n"
699 " myAISContext->ActivateStandardMode(TopAbs_FACE); \n"
700 " \n");
576f8b11 701 SetTitle (L"Standard mode: TopAbs_FACE");
7fd59977 702}
703
704//Set edges selection mode
705void CViewer3dDoc::OnEdges()
706{
404c8936 707 myAISContext->Activate (AIS_Shape::SelectionMode (TopAbs_EDGE));
7fd59977 708
5c573e69 709 myCResultDialog.SetTitle("Standard mode: TopAbs_EDGE");
710 myCResultDialog.SetText(" myAISContext->OpenLocalContext(); \n"
5c1f974e 711 " \n"
712 " myAISContext->ActivateStandardMode(TopAbs_EDGE); \n"
713 " \n");
576f8b11 714 SetTitle (L"Standard mode: TopAbs_EDGE");
7fd59977 715}
716
717// Set vertices selection mode
718void CViewer3dDoc::OnVertices()
719{
404c8936 720 myAISContext->Activate (AIS_Shape::SelectionMode (TopAbs_VERTEX));
7fd59977 721
5c573e69 722 myCResultDialog.SetTitle("Standard mode: TopAbs_VERTEX");
723 myCResultDialog.SetText(" myAISContext->OpenLocalContext(); \n"
5c1f974e 724 " \n"
725 " myAISContext->ActivateStandardMode(TopAbs_VERTEX); \n"
726 " \n");
576f8b11 727 SetTitle (L"Standard mode: TopAbs_VERTEX");
7fd59977 728}
729
730//Neutral selection mode
731void CViewer3dDoc::OnNeutral()
732{
5c573e69 733 myCResultDialog.SetTitle("Standard mode: Neutral");
734 myCResultDialog.SetText(" myAISContext->CloseAllContexts(); \n"
5c1f974e 735 " \n");
576f8b11 736 SetTitle (L"Standard mode: Neutral");
7fd59977 737}
738
739// Change the color of faces on a user cylinder
740void CViewer3dDoc::OnUsercylinderChangefacecolor()
741{
404c8936 742 myAISContext->Activate(myAISContext->SelectedInteractive(), 4);
5c1f974e 743 myState = FACE_COLOR;
744 // see the following of treatment in inputevent
7fd59977 745}
746
747// Make 3d fillets on solids
748// It is necessary to activate the edges selection mode and select edges on an object
749// before running this function
750void CViewer3dDoc::OnFillet3d()
751{
5c1f974e 752 myAISContext->InitSelected();
753 if (myAISContext->MoreSelected())
754 {
92efcf78 755 Handle(AIS_Shape) aSelInteractive (Handle(AIS_Shape)::DownCast (myAISContext->SelectedInteractive()));
47162471 756 if (aSelInteractive.IsNull())
5c1f974e 757 {
576f8b11 758 AfxMessageBox (L"It is necessary to activate the edges selection mode\n"
759 L"and select edges on an object before \nrunning this function");
5c1f974e 760 return;
761 }
762
47162471 763 BRepFilletAPI_MakeFillet aFillet (aSelInteractive->Shape());
5c1f974e 764
765 for (myAISContext->InitSelected(); myAISContext->MoreSelected(); myAISContext->NextSelected())
7fd59977 766 {
47162471 767 const TopoDS_Shape& aSelShape = myAISContext->SelectedShape();
5c1f974e 768 if (aSelShape.ShapeType() != TopAbs_EDGE)
769 {
576f8b11 770 AfxMessageBox (L"It is necessary to activate the edges selection mode\n"
771 L"and select edges on an object before \nrunning this function");
7fd59977 772 return;
5c1f974e 773 }
7fd59977 774 }
7fd59977 775
47162471 776 BoxRadius aDialog (NULL,10.);
777 if (aDialog.DoModal() == IDOK)
5c1f974e 778 {
779 for (myAISContext->InitSelected(); myAISContext->MoreSelected(); myAISContext->NextSelected())
780 {
47162471 781 // Selected shape has its own location, and sub-shapes in the solid shape for fillet building
782 // don't have own locations. Fillet builder needs to know that input edge is just the same one as
783 // some sub-shape in our target solid shape, so no location is to be in input edge for fillet builder.
784 TopoDS_Shape aSelShape = myAISContext->SelectedShape().Located (TopLoc_Location());
785 aFillet.Add (aDialog.m_radius, TopoDS::Edge (aSelShape) );
5c1f974e 786 }
787 }
788 else
789 {
790 return;
791 }
792
793 TopoDS_Shape aNewShape;
794 try
795 {
796 aNewShape = aFillet.Shape();
797 }
798 catch (Standard_Failure)
799 {
576f8b11 800 AfxMessageBox (L"Error During Fillet computation");
5c1f974e 801 return;
802 }
803
47162471 804 aSelInteractive ->Set (aNewShape);
0577ae8c 805 myAISContext->Redisplay (aSelInteractive, Standard_True);
5c1f974e 806 }
807
5c573e69 808 myCResultDialog.SetTitle("Make a fillet");
809 myCResultDialog.SetText(" Handle(AIS_Shape) S = Handle(AIS_Shape)::DownCast(myAISContext->Interactive()); \n"
5c1f974e 810 " \n"
811 " BRepAPI_MakeFillet aFillet(S->Shape()); \n"
812 " \n"
813 " TopoDS_Edge anEdge=TopoDS::Edge(myAISContext->SelectedShape()); \n"
814 " \n"
815 " aFillet.Add(dlg.m_radius,anEdge); \n"
816 " \n"
817 " TopoDS_Shape aNewShape = aFillet.Shape(); \n"
818 " \n"
819 " S->Set(aNewShape); \n"
820 " \n"
821 " myAISContext->Redisplay(S); \n"
822 " \n");
576f8b11 823 SetTitle (L"Make a fillet");
7fd59977 824}
5c1f974e 825
7fd59977 826// Create and display a circle with standard tools
827void CViewer3dDoc::OnCircle()
828{
5c1f974e 829 gp_Ax2 anAx2 (gp_Pnt (0., 0., 0.), gp_Dir(0., 0., -1.));
830 Handle(Geom_Circle) aGeomCircle = new Geom_Circle (anAx2, 300);
7fd59977 831
5c1f974e 832 // the lines above substitute
833 // GC_MakeCircle C(gp_Pnt(-100.,-300.,0.),gp_Pnt(-50.,-200.,0.),gp_Pnt(-10.,-250.,0.));
834 // Handle(AIS_Circle) anAISCirc = new AIS_Circle(C.Value());
835
836 Handle(AIS_Circle) anAISCirc = new AIS_Circle(aGeomCircle);
0577ae8c 837 myAISContext->Display (anAISCirc, Standard_True);
7fd59977 838
5c573e69 839 myCResultDialog.SetTitle("Create a circle");
840 myCResultDialog.SetText(" GC_MakeCircle C(gp_Pnt(-100.,-300.,0.),gp_Pnt(-50.,-200.,0.),gp_Pnt(-10.,-250.,0.)); \n"
5c1f974e 841 " \n"
842 " Handle(AIS_Circle) anAISCirc = new AIS_Circle(C.Value()); \n"
843 " \n"
844 " myAISContext->Display(anAISCirc); \n"
845 " \n");
576f8b11 846 SetTitle (L"Create a circle");
7fd59977 847}
848
849void CViewer3dDoc::OnLine()
850{
5c1f974e 851 // TODO: Add your command handler code here
852 gp_Lin aGpLin (gp_Pnt (0., 0., 0.), gp_Dir(1., 0., 0.));
853 Handle(Geom_Line) aGeomLin = new Geom_Line (aGpLin);
854 Handle(AIS_Line) anAISLine = new AIS_Line (aGeomLin);
0577ae8c 855 myAISContext->Display (anAISLine, Standard_True);
7fd59977 856
5c573e69 857 myCResultDialog.SetTitle("Create a line");
858 myCResultDialog.SetText(" gp_Lin L(gp_Pnt(0.,0.,0.),gp_Dir(1.,0.,0.)); \n"
5c1f974e 859 " \n"
860 " Handle(Geom_Line) aLine = new Geom_Line(L); \n"
861 " \n"
862 " Handle(AIS_Line) anAISLine = new AIS_Line(aLine); \n"
863 " \n"
864 " myAISContext->Display(anAISLine); \n"
865 " \n");
576f8b11 866 SetTitle (L"Create a line");
7fd59977 867}
868
869void CViewer3dDoc::OnNbisos()
870{
5c1f974e 871 int aNumU = myAISContext->DefaultDrawer()->UIsoAspect()->Number();
872 int aNumV = myAISContext->DefaultDrawer()->VIsoAspect()->Number();
7fd59977 873
5c1f974e 874 DlgIsos aDlg (NULL, aNumU, aNumV);
7fd59977 875
5c1f974e 876 if (aDlg.DoModal() == IDOK)
877 {
878 myAISContext->DefaultDrawer()->UIsoAspect()->SetNumber (aDlg.m_isou);
879 myAISContext->DefaultDrawer()->VIsoAspect()->SetNumber (aDlg.m_isov);
880
5c573e69 881 myCResultDialog.SetTitle("Iso Aspect");
882 myCResultDialog.SetText(" myAISContext->DefaultDrawer()->UIsoAspect()->SetNumber(dlg.m_isou); \n"
5c1f974e 883 " \n"
884 " myAISContext->DefaultDrawer()->VIsoAspect()->SetNumber(dlg.m_isov); \n"
885 " \n");
576f8b11 886 SetTitle (L"Iso Aspect");
5c1f974e 887 }
7fd59977 888}
889
890BOOL CViewer3dDoc::OnNewDocument()
891{
5c1f974e 892 if (!CDocument::OnNewDocument())
893 return FALSE;
7fd59977 894
5c1f974e 895 // TODO: add reinitialization code here
896 // (SDI documents will reuse this document)
7fd59977 897 SetTitle(myPresentation->GetName());
898
0577ae8c 899 myAISContext->EraseAll (Standard_False);
900 myAISContext->SetDisplayMode(AIS_Shaded, Standard_True);
7fd59977 901
902 POSITION pos = GetFirstViewPosition();
903 while (pos != NULL)
904 {
905 CViewer3dView* pView = (CViewer3dView*) GetNextView(pos);
906 pView->Reset();
907 }
908
5c1f974e 909 return TRUE;
7fd59977 910}
911
912void CViewer3dDoc::OnFileNew()
913{
914 OnNewDocument();
915}
916
917void CViewer3dDoc::InitViewButtons()
918{
919 POSITION pos = GetFirstViewPosition();
920 while (pos != NULL)
921 {
922 CViewer3dView* pView = (CViewer3dView*) GetNextView(pos);
923 pView->InitButtons();
924 }
925}
926
927void CViewer3dDoc::OnTextureOn()
928{
929 isTextureSampleStarted = TRUE;
930 Start();
931}
932
933void CViewer3dDoc::DoSample()
934{
935 InitViewButtons();
936
937 HCURSOR hOldCursor = ::GetCursor();
938 HCURSOR hNewCursor = AfxGetApp()->LoadStandardCursor(IDC_APPSTARTING);
939
940 SetCursor(hNewCursor);
941 {
942 try
943 {
944 myPresentation->DoSample();
945 }
946 catch (Standard_Failure)
947 {
948 Standard_SStream aSStream;
949 aSStream << "An exception was caught: " << Standard_Failure::Caught() << ends;
576f8b11 950 CString aMsg = aSStream.str().c_str();
7fd59977 951 AfxMessageBox (aMsg);
952 }
953 }
954 SetCursor(hOldCursor);
955}
956
957void CViewer3dDoc::OnBUTTONStart()
958{
0577ae8c 959 myAISContext->EraseAll (Standard_True);
7fd59977 960 myPresentation->FirstSample();
961 DoSample();
962}
963
964void CViewer3dDoc::OnBUTTONEnd()
965{
0577ae8c 966 myAISContext->EraseAll (Standard_True);
7fd59977 967 myPresentation->LastSample();
968 DoSample();
969}
970
971void CViewer3dDoc::OnBUTTONRepeat()
972{
973 DoSample();
974}
975
976void CViewer3dDoc::OnBUTTONNext()
977{
978 if (!myPresentation->AtLastSample())
979 {
980 myPresentation->NextSample();
981 DoSample();
982 }
983}
984
985void CViewer3dDoc::OnBUTTONPrev()
986{
987 if (!myPresentation->AtFirstSample())
988 {
989 myPresentation->PrevSample();
990 DoSample();
991 }
992}
993
994void CViewer3dDoc::OnUpdateBUTTONNext(CCmdUI* pCmdUI)
995{
996 if ( isTextureSampleStarted )
997 pCmdUI->Enable (!myPresentation->AtLastSample());
998 else
999 pCmdUI->Enable (FALSE);
1000}
1001
1002void CViewer3dDoc::OnUpdateBUTTONPrev(CCmdUI* pCmdUI)
1003{
1004 if ( isTextureSampleStarted )
1005 pCmdUI->Enable (!myPresentation->AtFirstSample());
1006 else
1007 pCmdUI->Enable (FALSE);
1008}
1009
1010void CViewer3dDoc::OnUpdateBUTTONStart(CCmdUI* pCmdUI)
1011{
1012 pCmdUI->Enable (isTextureSampleStarted);
1013}
1014
1015void CViewer3dDoc::OnUpdateBUTTONRepeat(CCmdUI* pCmdUI)
1016{
1017 pCmdUI->Enable (isTextureSampleStarted);
1018}
1019
1020void CViewer3dDoc::OnUpdateBUTTONEnd(CCmdUI* pCmdUI)
1021{
1022 pCmdUI->Enable (isTextureSampleStarted);
1023}
1024
12c76bee 1025void CViewer3dDoc::OnDumpView()
1026{
5c1f974e 1027 for (POSITION aPos = GetFirstViewPosition(); aPos != NULL;)
1028 {
1029 CViewer3dView* pView = (CViewer3dView* )GetNextView (aPos);
1030 pView->UpdateWindow();
7fd59977 1031 }
12c76bee 1032
5c1f974e 1033 myViewer->InitActiveViews();
1034 Handle(V3d_View) aView = myViewer->ActiveView();
12c76bee 1035 ExportView (aView);
7fd59977 1036}
1037
1038void CViewer3dDoc::Start()
1039{
1040 myPresentation->Init();
1041 OnBUTTONStart();
1042}
1043
1044void CViewer3dDoc::Fit()
1045{
1046 CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
1047 CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
1048 CViewer3dView *pView = (CViewer3dView *) pChild->GetActiveView();
1049 pView->FitAll();
1050}