1 // vtkMDIDoc.cpp : implementation of the CvtkMDIDoc class
2 //
3 
4 #include "stdafx.h"
5 #include "vtkMDI.h"
6 
7 #include "vtkMDIDoc.h"
8 
9 #ifdef _DEBUG
10 #define new DEBUG_NEW
11 #endif
12 
13 
14 // CvtkMDIDoc
15 
IMPLEMENT_DYNCREATE(CvtkMDIDoc,CDocument)16 IMPLEMENT_DYNCREATE(CvtkMDIDoc, CDocument)
17 
18 BEGIN_MESSAGE_MAP(CvtkMDIDoc, CDocument)
19 END_MESSAGE_MAP()
20 
21 
22 // CvtkMDIDoc construction/destruction
23 
24 CvtkMDIDoc::CvtkMDIDoc()
25 {
26   // TODO: add one-time construction code here
27   this->pvtkDataSetReader = NULL;
28 }
29 
~CvtkMDIDoc()30 CvtkMDIDoc::~CvtkMDIDoc()
31 {
32 }
33 
OnNewDocument()34 BOOL CvtkMDIDoc::OnNewDocument()
35 {
36   if (!CDocument::OnNewDocument())
37     return FALSE;
38 
39   // TODO: add reinitialization code here
40   // (SDI documents will reuse this document)
41 
42   return TRUE;
43 }
44 
45 
46 
47 
48 // CvtkMDIDoc serialization
49 
Serialize(CArchive & ar)50 void CvtkMDIDoc::Serialize(CArchive& ar)
51 {
52   if (ar.IsStoring())
53   {
54     // TODO: add storing code here
55   }
56   else
57   {
58     // TODO: add loading code here
59   }
60 }
61 
62 
63 // CvtkMDIDoc diagnostics
64 
65 #ifdef _DEBUG
AssertValid() const66 void CvtkMDIDoc::AssertValid() const
67 {
68   CDocument::AssertValid();
69 }
70 
Dump(CDumpContext & dc) const71 void CvtkMDIDoc::Dump(CDumpContext& dc) const
72 {
73   CDocument::Dump(dc);
74 }
75 #endif //_DEBUG
76 
77 
78 // CvtkMDIDoc commands
79 
OnOpenDocument(LPCTSTR lpszPathName)80 BOOL CvtkMDIDoc::OnOpenDocument(LPCTSTR lpszPathName)
81 {
82   if (!CDocument::OnOpenDocument(lpszPathName))
83     return FALSE;
84 
85   this->pvtkDataSetReader = vtkDataSetReader::New();
86   this->pvtkDataSetReader->SetFileName(lpszPathName);
87 
88   return TRUE;
89 }
90 
OnCloseDocument()91 void CvtkMDIDoc::OnCloseDocument()
92 {
93   // delete data
94   if (this->pvtkDataSetReader)  this->pvtkDataSetReader->Delete();
95 
96   CDocument::OnCloseDocument();
97 }
98