Move the sources to trunk
[opencv] / apps / StereoGR / StereoGRDoc.cpp
1 /*M///////////////////////////////////////////////////////////////////////////////////////\r
2 //\r
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r
4 //\r
5 //  By downloading, copying, installing or using the software you agree to this license.\r
6 //  If you do not agree to this license, do not download, install,\r
7 //  copy or use the software.\r
8 //\r
9 //\r
10 //                        Intel License Agreement\r
11 //                For Open Source Computer Vision Library\r
12 //\r
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.\r
14 // Third party copyrights are property of their respective owners.\r
15 //\r
16 // Redistribution and use in source and binary forms, with or without modification,\r
17 // are permitted provided that the following conditions are met:\r
18 //\r
19 //   * Redistribution's of source code must retain the above copyright notice,\r
20 //     this list of conditions and the following disclaimer.\r
21 //\r
22 //   * Redistribution's in binary form must reproduce the above copyright notice,\r
23 //     this list of conditions and the following disclaimer in the documentation\r
24 //     and/or other materials provided with the distribution.\r
25 //\r
26 //   * The name of Intel Corporation may not be used to endorse or promote products\r
27 //     derived from this software without specific prior written permission.\r
28 //\r
29 // This software is provided by the copyright holders and contributors "as is" and\r
30 // any express or implied warranties, including, but not limited to, the implied\r
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.\r
32 // In no event shall the Intel Corporation or contributors be liable for any direct,\r
33 // indirect, incidental, special, exemplary, or consequential damages\r
34 // (including, but not limited to, procurement of substitute goods or services;\r
35 // loss of use, data, or profits; or business interruption) however caused\r
36 // and on any theory of liability, whether in contract, strict liability,\r
37 // or tort (including negligence or otherwise) arising in any way out of\r
38 // the use of this software, even if advised of the possibility of such damage.\r
39 //\r
40 //M*/// StereoGRDoc.cpp : implementation of the CStereoGRDoc class\r
41 //\r
42 \r
43 #include "stdafx.h"\r
44 #include "StereoGR.h"\r
45 \r
46 #include "StereoGRDoc.h"\r
47 #include "PGControl.h"\r
48 #include "PTGrey.h"\r
49 \r
50 #ifdef _DEBUG\r
51 #define new DEBUG_NEW\r
52 #undef THIS_FILE\r
53 static char THIS_FILE[] = __FILE__;\r
54 #endif\r
55 \r
56 \r
57 /////////////////////////////////////////////////////////////////////////////\r
58 // CStereoGRDoc\r
59 \r
60 IMPLEMENT_DYNCREATE(CStereoGRDoc, CDocument)\r
61 \r
62 BEGIN_MESSAGE_MAP(CStereoGRDoc, CDocument)\r
63         //{{AFX_MSG_MAP(CStereoGRDoc)\r
64                 // NOTE - the ClassWizard will add and remove mapping macros here.\r
65                 //    DO NOT EDIT what you see in these blocks of generated code!\r
66         //}}AFX_MSG_MAP\r
67 END_MESSAGE_MAP()\r
68 \r
69 /////////////////////////////////////////////////////////////////////////////\r
70 // CStereoGRDoc construction/destruction\r
71 \r
72 CStereoGRDoc::CStereoGRDoc()\r
73 {\r
74     CStereoGRApp* app = (CStereoGRApp*)AfxGetApp();\r
75     m_docType = app->GetDocType();\r
76 }\r
77 \r
78 CStereoGRDoc::~CStereoGRDoc()\r
79 {\r
80     PTGreySelectDataType(m_docType, 0);\r
81 }\r
82 \r
83 BOOL CStereoGRDoc::OnNewDocument()\r
84 {\r
85         if (!CDocument::OnNewDocument())\r
86                 return FALSE;\r
87 \r
88         // TODO: add reinitialization code here\r
89         // (SDI documents will reuse this document)\r
90 \r
91         return TRUE;\r
92 }\r
93 \r
94 \r
95 \r
96 /////////////////////////////////////////////////////////////////////////////\r
97 // CStereoGRDoc serialization\r
98 \r
99 void CStereoGRDoc::Serialize(CArchive& ar)\r
100 {\r
101         if (ar.IsStoring())\r
102         {\r
103                 // TODO: add storing code here\r
104         }\r
105         else\r
106         {\r
107                 // TODO: add loading code here\r
108         }\r
109 }\r
110 \r
111 /////////////////////////////////////////////////////////////////////////////\r
112 // CStereoGRDoc diagnostics\r
113 \r
114 #ifdef _DEBUG\r
115 void CStereoGRDoc::AssertValid() const\r
116 {\r
117         CDocument::AssertValid();\r
118 }\r
119 \r
120 void CStereoGRDoc::Dump(CDumpContext& dc) const\r
121 {\r
122         CDocument::Dump(dc);\r
123 }\r
124 #endif //_DEBUG\r
125 \r
126 /////////////////////////////////////////////////////////////////////////////\r
127 // CStereoGRDoc commands\r
128 \r
129 void CStereoGRDoc::SetDocType(int docType)\r
130 {\r
131     m_docType = docType;\r
132     if(IS_PTGREY_DATATYPE(docType))\r
133         SetTitle(PT_IMAGE_NAME(docType));\r
134     else\r
135         switch(docType)\r
136                 {\r
137                 case GR_MASK_VIEW:\r
138                         SetTitle("Mask view");\r
139                         break;\r
140 \r
141                 case GR_MAGICCUBE:\r
142                         SetTitle("3D view");\r
143                         break;\r
144                 }\r
145 \r
146 }\r
147 \r
148 void CStereoGRDoc::Initialize()\r
149 {\r
150     SetDocType(m_docType);\r
151     if(IS_PTGREY_DATATYPE(m_docType))\r
152         PTGreySelectDataType(m_docType, 1);\r
153 }\r
154 \r
155 int CStereoGRDoc::GetDocType()\r
156 {\r
157     return m_docType;\r
158 }\r
159 \r
160 BOOL CStereoGRDoc::CanCloseFrame(CFrameWnd* pFrame) \r
161 {\r
162         return FALSE;   \r
163         return CDocument::CanCloseFrame(pFrame);\r
164 }\r