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 |
8 | const 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|" |
12 | "EXR Files (*.EXR)|*.exr|TGA Files (*.TGA)|*.tga|PS Files (*.PS)|*.ps|" |
13 | "EPS Files (*.EPS)|*.eps|TEX Files (*.TEX)|*.tex|PDF Files (*.PDF)|*.pdf" |
14 | "|SVG Files (*.SVG)|*.svg|PGF Files (*.PGF)|*.pgf"); |
15 | } |
16 | |
17 | void OCC_BaseDoc::ExportView (const Handle(V3d_View)& theView) const |
18 | { |
19 | CFileDialog anExportDlg (FALSE,_T("*.BMP"),NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, |
20 | SupportedImageFormats() + "||", NULL ); |
21 | |
22 | if (anExportDlg.DoModal() == IDOK) |
23 | { |
24 | // Set waiting cursor |
25 | SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT)); |
26 | |
27 | CString aFileName = anExportDlg.GetPathName(); |
28 | CString aFileExt = anExportDlg.GetFileExt(); |
29 | |
30 | // For vector formats use V3d_View::Export() method |
31 | if (!(aFileExt.CompareNoCase ("ps")) || !(aFileExt.CompareNoCase ("pdf")) |
32 | || !(aFileExt.CompareNoCase ("eps")) || !(aFileExt.CompareNoCase ("tex")) |
33 | || !(aFileExt.CompareNoCase ("svg")) || !(aFileExt.CompareNoCase ("pgf"))) |
34 | { |
35 | Graphic3d_ExportFormat anExportFormat; |
36 | |
37 | if (!(aFileExt.CompareNoCase ("ps"))) anExportFormat = Graphic3d_EF_PostScript; |
38 | else if (!(aFileExt.CompareNoCase ("eps"))) anExportFormat = Graphic3d_EF_EnhPostScript; |
39 | else if (!(aFileExt.CompareNoCase ("pdf"))) anExportFormat = Graphic3d_EF_PDF; |
40 | else if (!(aFileExt.CompareNoCase ("tex"))) anExportFormat = Graphic3d_EF_TEX; |
41 | else if (!(aFileExt.CompareNoCase ("svg"))) anExportFormat = Graphic3d_EF_SVG; |
42 | else anExportFormat = Graphic3d_EF_PGF; |
43 | |
44 | theView->View()->Export (aFileName, anExportFormat); |
45 | } |
46 | else |
47 | { |
48 | // For pixel formats use V3d_View:Dump() method |
49 | theView->Dump (aFileName); |
50 | } |
51 | |
52 | // Restore cursor |
53 | SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); |
54 | } |
55 | } |
56 | |
7fd59977 |
57 | ////////////////////////////////////////////////////////////////////// |
58 | // Construction/Destruction |
59 | ////////////////////////////////////////////////////////////////////// |
60 | |
61 | OCC_BaseDoc::OCC_BaseDoc() |
62 | { |
63 | |
64 | } |
65 | |
66 | OCC_BaseDoc::~OCC_BaseDoc() |
67 | { |
68 | |
69 | } |