0031431: Visualization, PrsMgr_PresentableObject - simplify HLR computing interface
[occt.git] / samples / mfc / standard / Common / OCC_BaseDoc.cpp
CommitLineData
7fd59977 1// OCC_BaseDoc.cpp: implementation of the OCC_BaseDoc class.
2//
3//////////////////////////////////////////////////////////////////////
4
5#include <stdafx.h>
6#include "OCC_BaseDoc.h"
7
12c76bee 8const CString OCC_BaseDoc::SupportedImageFormats() const
9{
10 return ("BMP Files (*.BMP)|*.bmp|GIF Files (*.GIF)|*.gif|TIFF Files (*.TIFF)|*.tiff|"
11 "PPM Files (*.PPM)|*.ppm|JPEG Files(*.JPEG)|*.jpeg|PNG Files (*.PNG)|*.png|"
2a8d1e7b 12 "EXR Files (*.EXR)|*.exr|TGA Files (*.TGA)|*.tga");
12c76bee 13}
14
15void OCC_BaseDoc::ExportView (const Handle(V3d_View)& theView) const
16{
17 CFileDialog anExportDlg (FALSE,_T("*.BMP"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
18 SupportedImageFormats() + "||", NULL );
19
20 if (anExportDlg.DoModal() == IDOK)
21 {
22 // Set waiting cursor
23 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
24
12c76bee 25 CString aFileExt = anExportDlg.GetFileExt();
e620e285 26 TCollection_AsciiString aFileName ((const wchar_t* )anExportDlg.GetPathName());
12c76bee 27
2a8d1e7b 28 // For pixel formats use V3d_View:Dump() method
29 theView->Dump (aFileName.ToCString());
12c76bee 30
31 // Restore cursor
32 SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
33 }
34}
35
7fd59977 36//////////////////////////////////////////////////////////////////////
37// Construction/Destruction
38//////////////////////////////////////////////////////////////////////
39
40OCC_BaseDoc::OCC_BaseDoc()
41{
42
43}
44
45OCC_BaseDoc::~OCC_BaseDoc()
46{
47
b5ac8292 48}
49
50//=============================================================================
51// function: ResetDocumentViews
52// purpose:
53//=============================================================================
54void OCC_BaseDoc::ResetDocumentViews (CDocTemplate* theTemplate)
55{
56 // do not delete document if no views
57 BOOL isAutoDelete = m_bAutoDelete;
58 m_bAutoDelete = FALSE;
59
60 // close all opened views
61 POSITION aViewIt = GetFirstViewPosition();
62 while (aViewIt)
63 {
64 CView* aView = GetNextView (aViewIt);
65 if (aView == NULL)
66 {
67 continue;
68 }
69
70 RemoveView (aView);
71
72 aView->GetParentFrame()->SendMessage (WM_CLOSE);
73 }
74
75 // create new view frame
76 CFrameWnd* aNewFrame = theTemplate->CreateNewFrame (this, NULL);
77 m_bAutoDelete = isAutoDelete;
78
79 // init frame
80 theTemplate->InitialUpdateFrame(aNewFrame, this);
81
82
83
7fd59977 84}