Рефераты. Система идентификации личности по отпечаткам пальцев. Подсистема анализа изображения

      //  dismissed with OK

  }

  else if (nResponse == IDCANCEL)

  {

      // TODO: Place code here to handle when the dialog is

      //  dismissed with Cancel

  }


  // Since the dialog has been closed, return FALSE so that we exit the

  //  application, rather than start the application's message pump.

  return FALSE;

}


П.1.4. ТЕКСТ МОДУЛЯ FingAnalyserDlg.h

// FingerAnalyserDlg.h : header file

//

#pragma once

#include "TFingPicture.h"

#include "afxcmn.h"

typedef list<TInfo> listTInfo;

// CFingerAnalyserDlg dialog

class CFingerAnalyserDlg : public CDialog

{

// Construction

public:

  CFingerAnalyserDlg(CWnd* pParent = NULL); // standard constructor

  ~CFingerAnalyserDlg();  // деструктор

// Dialog Data

  enum { IDD = IDD_FINGERANALYSER_DIALOG };

  protected:

  virtual void DoDataExchange(CDataExchange* pDX);   // DDX/DDV support

// Implementation

protected:

  HICON m_hIcon;

  CDC memDC;

  CBitmap bm;

  BITMAP bmp;

  UINT timer;


  TFingPicture *fp;

  // Generated message map functions

  virtual BOOL OnInitDialog();

  afx_msg void OnSysCommand(UINT nID, LPARAM lParam);

  afx_msg void OnPaint();

  afx_msg HCURSOR OnQueryDragIcon();

  DECLARE_MESSAGE_MAP()

public:

  afx_msg void OnBnClickedOpenFile();

  afx_msg void OnBnClickedExit();

  afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);

  afx_msg void OnBnClickedAnalyse();

  afx_msg void OnBnClickedCompare();

  afx_msg void OnTimer(UINT nIDEvent);

  afx_msg void OnEnChangeSpecDot();

  int m_kolDots;

  afx_msg void OnBnClickedSaveToDb();

  CProgressCtrl loadProgress;

public:

  listTInfo *LoadDB(CString dbFile);

  list<TCompareFing> *CompareWithBase();

  CString m_workFile;

  CProgressCtrl compare_progress;

  long m_scantime;

  afx_msg void OnBnClickedButtonPrev();


  list<TCompareFing> *compareResult;

  list<TCompareFing>::iterator showIter;

  afx_msg void OnBnClickedButtonNext();

  void ShowBase(bool key, bool next = true);

  void PrintReport(CString file, CString report);

  CString GetSAV(CString srcName);       //получение пути к sav файлу

  BOOL m_show_base;

  afx_msg void OnBnClickedShowBase();

  afx_msg void OnMouseMove(UINT nFlags, CPoint point);

  CPoint mouse_pos;

  int m_mouse_x;

  int m_mouse_y;

  afx_msg void OnLButtonDown(UINT nFlags, CPoint point);

};


П.1.5 ТЕКСТ МОДУЛЯ FingAnalyserDlg.cpp

// FingerAnalyserDlg.cpp : implementation file

//

#include "stdafx.h"

#include "FingerAnalyser.h"

#include "FingerAnalyserDlg.h"

#include "TAnalysePicture.h"

#include ".\fingeranalyserdlg.h"

#ifdef _DEBUG

#define new DEBUG_NEW

#endif


CString sav_path, db_file;

TAnalysePicture *picture;

TAbsFing fingA;

TRelFing fingR;


// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog

{

public:

  CAboutDlg();

// Dialog Data

  enum { IDD = IDD_ABOUTBOX };


  protected:

  virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

// Implementation

protected:

  DECLARE_MESSAGE_MAP()

};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)

{}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)

{

  CDialog::DoDataExchange(pDX);

}


BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)

END_MESSAGE_MAP()

// CFingerAnalyserDlg dialog

CFingerAnalyserDlg::CFingerAnalyserDlg(CWnd* pParent /*=NULL*/)

  : CDialog(CFingerAnalyserDlg::IDD, pParent)

  , m_kolDots(0)

  , m_workFile(_T(""))

  , m_scantime(0)

  , m_show_base(FALSE)

  , m_mouse_x(0)

  , m_mouse_y(0)

{

  m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);

}

CFingerAnalyserDlg::~CFingerAnalyserDlg()

{

  delete(fp);

  delete(picture);

  if(compareResult)

  { 

      for(list<TCompareFing>::iterator i = compareResult->begin();

          i != compareResult->end();

          i++)

      { 

          list<TPairSur>::iterator j;

          for(j=i->surdots.begin(); j!=i->surdots.end(); j++)

          {

             j->first->clear();  delete(j->first);

             j->second->clear(); delete(j->second);

          }

      }

      compareResult->clear();

      delete(compareResult);

      compareResult = NULL;

  }

}


void CFingerAnalyserDlg::DoDataExchange(CDataExchange* pDX)

{

  CDialog::DoDataExchange(pDX);

  DDX_Text(pDX, IDC_SPEC_DOT, m_kolDots);

  DDX_Control(pDX, IDC_LOAD_PROGRESS, loadProgress);

  DDX_Text(pDX, IDC_WORK_FILE, m_workFile);

  DDX_Control(pDX, IDC_LOAD_COMPARE_PROGRESS, compare_progress);

  DDX_Text(pDX, IDC_TEMESCAN, m_scantime);

  DDX_Check(pDX, IDC_SHOW_BASE, m_show_base);

}


BEGIN_MESSAGE_MAP(CFingerAnalyserDlg, CDialog)

  ON_WM_SYSCOMMAND()

  ON_WM_PAINT()

  ON_WM_QUERYDRAGICON()

  //}}AFX_MSG_MAP

  ON_BN_CLICKED(IDC_OPEN_FILE, OnBnClickedOpenFile)

  ON_BN_CLICKED(IDC_EXIT, OnBnClickedExit)

  ON_WM_CLOSE()

  ON_WM_ACTIVATE()

  ON_BN_CLICKED(IDC_ANALYSE, OnBnClickedAnalyse)

  ON_BN_CLICKED(IDC_COMPARE, OnBnClickedCompare)

  ON_WM_TIMER()

  ON_BN_CLICKED(IDC_SAVE_TO_DB, OnBnClickedSaveToDb)

  ON_BN_CLICKED(IDC_BUTTON_PREV, OnBnClickedButtonPrev)

  ON_BN_CLICKED(IDC_BUTTON_NEXT, OnBnClickedButtonNext)

  ON_BN_CLICKED(IDC_SHOW_BASE, OnBnClickedShowBase)

  ON_WM_MOUSEMOVE()

  ON_WM_LBUTTONDOWN()

END_MESSAGE_MAP()


// CFingerAnalyserDlg message handlers


BOOL CFingerAnalyserDlg::OnInitDialog()

{

  CDialog::OnInitDialog();

  ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);

  ASSERT(IDM_ABOUTBOX < 0xF000);


  CMenu* pSysMenu = GetSystemMenu(FALSE);

  if (pSysMenu != NULL)

  {

      CString strAboutMenu;

      strAboutMenu.LoadString(IDS_ABOUTBOX);

      if (!strAboutMenu.IsEmpty())

      {

          pSysMenu->AppendMenu(MF_SEPARATOR);

          pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);

      }

  }


  // Set the icon for this dialog.  The framework does this automatically

  //  when the application's main window is not a dialog

  SetIcon(m_hIcon, TRUE);         // Set big icon

  SetIcon(m_hIcon, FALSE);        // Set small icon


  fp = new TFingPicture(this->GetDC());


  char fullpath[200];

  _fullpath(fullpath, NULL, 200);

  sav_path = fullpath;

  sav_path += "\\sav\\";

  db_file = sav_path + "fingbase.bse";


  compareResult = NULL;


  return TRUE;  // return TRUE  unless you set the focus to a control

}


void CFingerAnalyserDlg::OnSysCommand(UINT nID, LPARAM lParam)

{

  if ((nID & 0xFFF0) == IDM_ABOUTBOX)

  {

      CAboutDlg dlgAbout;

      dlgAbout.DoModal();

  }

  else

  {

      CDialog::OnSysCommand(nID, lParam);

  }

}


// If you add a minimize button to your dialog, you will need the code below

//  to draw the icon.  For MFC applications using the document/view model,

//  this is automatically done for you by the framework.


void CFingerAnalyserDlg::OnPaint()

{

  CPaintDC dc(this); // device context for painting


  if(m_show_base)

  {//режим просмотра базы

      ShowBase(true, false);

  }

  else

  {//режим просмотра открытого образа

      if (picture != NULL)

      {

          picture->GetPic1()->Show(110, 45);

          picture->GetPic2()->Show(545, 45);

      }

      m_kolDots = (int)fingA.size();

      UpdateData(false);

  }


  CDialog::OnPaint();

}


// The system calls this function to obtain the cursor to display while the user drags

//  the minimized window.

HCURSOR CFingerAnalyserDlg::OnQueryDragIcon()

{

  return static_cast<HCURSOR>(m_hIcon);

}


void CFingerAnalyserDlg::OnBnClickedOpenFile()

{

  char szFilters[]= "Образы (*.bmp)|*.bmp|All Files (*.*)|*.*||";

  CFileDialog dlg(TRUE, "bmp", "*.bmp", OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, szFilters, this);


  if(dlg.DoModal() != IDOK) return;     //никаких файлов не открыли

  if(dlg.GetFileExt().CompareNoCase("bmp")) return;  //открытый файл не имеет расширеня .bmp


//    fp->Load(dlg.GetFileName());

  CString fileName = dlg.GetFileName();

  delete(picture);

  picture = new TAnalysePicture(fileName, this->GetDC());

  m_workFile = fileName;


  if(compareResult)

  {

      for(list<TCompareFing>::iterator i = compareResult->begin();

          i != compareResult->end();

          i++)

      { 

          list<TPairSur>::iterator j;

          for(j=i->surdots.begin(); j!=i->surdots.end(); j++)

          {

             j->first->clear(); delete(j->first);

             j->second->clear(); delete(j->second);

      }  }

      compareResult->clear();

  }

  m_show_base = false;

  Invalidate();

}


void CFingerAnalyserDlg::OnBnClickedExit()

{

  CDialog::SendMessage(WM_CLOSE);

}

void CFingerAnalyserDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)

{

  CDialog::OnActivate(nState, pWndOther, bMinimized);


//    pWndOther->SetProperty(

}


void CFingerAnalyserDlg::OnBnClickedAnalyse()

{

  if(picture == NULL) return;


  LPSYSTEMTIME mTime;

  mTime = new SYSTEMTIME;

  GetSystemTime(mTime);

Страницы: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30



2012 © Все права защищены
При использовании материалов активная ссылка на источник обязательна.