// FingerCellDoc.h : interface of the CFingerCellDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_FINGERCELLDOC_H__5B38AFA8_82FA_4672_A583_8905E76A6F3C__INCLUDED_)
#define AFX_FINGERCELLDOC_H__5B38AFA8_82FA_4672_A583_8905E76A6F3C__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "LogerInterface.h"
#include "FPDatabase.h"
#include "SettingsDialog.h"
#include "FingerprintDescriptionDialog.h"
#include "NImage.h"
#include "FncExtractor.h"
#include "FncMatcher.h"
#include "NImageFormat.h"

#define MAX_FEATURES_SIZE 10000
#define GENERALIZE_COUNT 3

class CFingerCellDoc : public CDocument, public CLogerInterface 
{
protected: // create from serialization only
	CFingerCellDoc();
	DECLARE_DYNCREATE(CFingerCellDoc)

	enum modes
	{
		EnrollmentMode,
		EnrollmentFGMode,
		IdentificationMode,
		VerificationMode,
		FastIdentificationMode,
		FastVerificationMode
	};

	modes        m_mode;
	CFPDatabase  m_database;

	HNImage m_img_left;
	HNImage m_img_right;

	HNImage m_images_temp;

	HNFRecord m_features_left;
	HNFRecord m_features_right;

	int          m_left_dpi;
	int          m_right_dpi;
	int          m_fingercount;

	HNFRecord m_features[GENERALIZE_COUNT+1];


	CSettingsDialog m_settings;
	CFingerprintDescriptionDialog m_fddlg;

#ifndef NO_BIO_API
	// iPaq scanner
	BioAPI_RETURN	retCode;
	BioAPI_BIR		CapturedBIR;
	BioAPI_BIR		OriginalBIR;
	BOOL			m_image_from_iPAQ;
	CString			m_fdescription;
#endif

	// Attributes
public:
	HFncMatcher  hMatcher;
	HFncExtractor  hExtractor;
	// Operations
public:

	// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFingerCellDoc)
public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	virtual void OnCloseDocument();
	virtual BOOL CanCloseFrame(CFrameWnd* pFrame);
	virtual BOOL IsModified(); 
	virtual void DeleteContents();
	virtual void OnFinalRelease();
	//}}AFX_VIRTUAL

	// Implementation
public:
	int GetZoom();
	BOOL ShowFeatures()
	{
		return showFeatures;
	}

	BOOL ShowBinaryImage()
	{
		return showBinaryImage;
	}

	HNFRecord GetRightFeatures();
	HNFRecord GetLeftFeatures();
	HNImage GetRightImage();
	HNImage GetLeftImage();

	int GetLeftImageDPI()
	{
		return m_left_dpi;
	}
	int GetRightImageDPI()
	{
		return m_right_dpi;
	}

	virtual void AddToLog(CString str, BOOL addnewline=TRUE);
	virtual ~CFingerCellDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	////virtual void Dump(CDumpContext& dc) const;
#endif

protected:

	// Generated message map functions
protected:
	void ClearResults();

	int zoom; // 25..800% default 70
	BOOL showFeatures;
	BOOL showBlockedOrientations;
	BOOL showSingularPoints;
	BOOL showBinaryImage;

	//{{AFX_MSG(CFingerCellDoc)
	afx_msg void OnClearLog();
	afx_msg void OnLoadImage();
	afx_msg void OnEnrollment();
	afx_msg void OnUpdateEnrollment(CCmdUI* pCmdUI);
	afx_msg void OnEnrollmentfg();
	afx_msg void OnUpdateEnrollmentfg(CCmdUI* pCmdUI);
	afx_msg void OnIdentification();
	afx_msg void OnUpdateIdentification(CCmdUI* pCmdUI);
	afx_msg void OnFastIdentification();
	afx_msg void OnUpdateFastIdentification(CCmdUI* pCmdUI);
	afx_msg void OnVerification();
	afx_msg void OnUpdateVerification(CCmdUI* pCmdUI);
	afx_msg void OnFastVerification();
	afx_msg void OnUpdateFastVerification(CCmdUI* pCmdUI);
	afx_msg void OnZoom11();
	afx_msg void OnZoomIn();
	afx_msg void OnZoomOut();
	afx_msg void OnShowBlockedorientations();
	afx_msg void OnUpdateShowBlockedorientations(CCmdUI* pCmdUI);
	afx_msg void OnShowFeatures();
	afx_msg void OnUpdateShowFeatures(CCmdUI* pCmdUI);
	afx_msg void OnShowSingularpoints();
	afx_msg void OnUpdateShowSingularpoints(CCmdUI* pCmdUI);
	afx_msg void OnOptions();
	afx_msg void OnClearDb();
	afx_msg void OnShowBinaryImage();
	afx_msg void OnUpdateShowBinaryImage(CCmdUI* pCmdUI);
	afx_msg void OnScanf();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FINGERCELLDOC_H__5B38AFA8_82FA_4672_A583_8905E76A6F3C__INCLUDED_)
