⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 camerafeatureview.h

📁 BCAM 1394 Driver
💻 H
字号:
//-----------------------------------------------------------------------------
//  (c) 2002 by Basler Vision Technologies
//  Section:  Vision Components
//  Project:  BCAM
//  $Header: CameraFeatureView.h, 6, 02.10.2002 14:31:24, Nebelung, H.$
//-----------------------------------------------------------------------------
/**
\file     CameraFeatureView.h

  *
  * Interfaces for the CCamerFeatureView classes. These classes represent the dialog which 
  * are shown in the tool bar to adjust DCAM feature values.
  *
  \brief   Interface for the CCameraFeature class
*/
//-----------------------------------------------------------------------------


#if !defined(AFX_CAMERAFEATURE_H__682FA684_7D03_11D5_920E_0090278E5E96__INCLUDED_)
#define AFX_CAMERAFEATURE_H__682FA684_7D03_11D5_920E_0090278E5E96__INCLUDED_

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

#include "resource.h"
#include "DialogView.h"
#include "TBarEditCtrlDbl.h"
#include "TBarEditCtrlInt.h"
#include "Camera.h"

// The "feature" Bandwidth ( BytePerPacket ) isn't a standard DCAM feature and so not included 
// in the enumeration type BcamFeatureID.
// Nevertheless we want to support a feature to adjust the Bandwith. To use the mechanism of indexing 
// the feature views by their BcamFeatureID we define a new ID
#ifndef FeatureID_Bandwidth
#define FeatureID_Bandwidth (BcamFeatureID) ( FeatureID_Brightness + 100 )
#endif


class CMainFrame;

//------------------------------------------------------------------------------
// class CCameraFeatureViewBase
// Author: 
// Date: 
//------------------------------------------------------------------------------
/**
* \brief   Base class all feature views inherit from
*
*/
//------------------------------------------------------------------------------

class CCameraFeatureViewBase 
{
public:
  
  /// constructor
  CCameraFeatureViewBase(BcamFeatureID id, CMainFrame& MainFrame);
  
public: 
  /// Inform the feature view that it is rebound to an other device. pCamera == NULL deactivates the view
  void CurrentDeviceChanged(CCamera* pCamera);
  
  /// Inform the feature view that the Camera object has been reconfigured. The implementation of Configuration Changed
  /// calls the virtual OnConfigurationChanged() method, which must be overwritten by a feature view implementation
  void ConfigurationChanged(DCSVideoFormat Format, DCSVideoMode Mode, DCSVideoFrameRate Framerate, DCSColorCode Code);
  
  /// Retrieve the handle of the feature view
  virtual HWND hWnd() = 0;
  
  
protected:
  
  virtual void OnConfigurationChanged(DCSVideoFormat Format, DCSVideoMode Mode, DCSVideoFrameRate Framerate, DCSColorCode Code) = 0;
  
  /// BcamFeatureID of feature represented by this dialog
  BcamFeatureID       m_FeatureId;
  /// Camera object the feature view is currently bound to
  CCamera*            m_pCamera; 
  /// Current video format, mode, frame rate and color coding
  DCSVideoFormat      m_Format;
  DCSVideoMode        m_Mode;
  DCSVideoFrameRate   m_Framerate;
  DCSColorCode        m_Code;
  /// Reference to the application's main window
  CMainFrame&         m_MainFrame;
  
  
};

//------------------------------------------------------------------------------
// class CScalarFeatureView
// Author: 
// Date: 
//------------------------------------------------------------------------------
/**
* \brief View to contol standard DCAM scalar features (brightness, gain etc.)
*
*/
//------------------------------------------------------------------------------

class CScalarFeatureView : public CCameraFeatureViewBase,
public CDialogView<CScalarFeatureView>
{
public:
  enum { IDD = IDD_CAMERAFEATUREVIEW };
  
  BEGIN_MSG_MAP(CScalarFeatureView)
    CHAIN_MSG_MAP(CDialogView<CScalarFeatureView>)
    CHAIN_MSG_MAP_MEMBER(m_EditCtrlDbl);
    CHAIN_MSG_MAP_MEMBER(m_EditCtrlInt);
    MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
    COMMAND_HANDLER(IDC_EDITVALUE, EN_UPDATE, OnValueChanged)
    MESSAGE_HANDLER(WM_ENABLE, OnEnable)
  END_MSG_MAP()
    
  // Message handlers
  
  LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
  LRESULT OnEnable(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  LRESULT OnValueChanged(WPARAM uNotifyCode, WPARAM wID, HWND hWndCtrl, BOOL& bHandled);
  
  /// constructor
  CScalarFeatureView(BcamFeatureID id, CMainFrame& MainFrame) : CCameraFeatureViewBase(id, MainFrame), m_fAbsControl(false)
  { }
  
  virtual HWND hWnd() { return m_hWnd; }
  
  
private:
  // private member functions
  
  // Called if the configuration has been changed. 
  virtual void OnConfigurationChanged(DCSVideoFormat Format, DCSVideoMode Mode, DCSVideoFrameRate Framerate, DCSColorCode Code);
  
  // intialization
  void InitControl();
  void RefreshControl();
  /// Switch to absolute value control
  bool AbsoluteControl(bool on);
  CBcam::CScalarProperty& Feature();
  
  // member variables
  
  /// combined edit and slider control for regular value
  CTBarEditCtrlDbl m_EditCtrlDbl;  
  /// combined edit and slider control for absolute value
  CTBarEditCtrlInt m_EditCtrlInt;   
  
  bool m_fAbsControl;
  
  
};

//------------------------------------------------------------------------------
// class CWhiteBalanceView 
// Author: 
// Date: 20.09.2002
//------------------------------------------------------------------------------
/**
 * \brief Control with two sliders to adjust manually the white balance values
 *
 */
//------------------------------------------------------------------------------
class CWhiteBalanceView : public CCameraFeatureViewBase,
public CDialogView<CWhiteBalanceView>    
{
public:
  enum { IDD = IDD_WHITEBALANCEVIEW };
  
  CWhiteBalanceView(CMainFrame& MainFrame) : CCameraFeatureViewBase(FeatureID_WhiteBalance, MainFrame)
  { }
  
  BEGIN_MSG_MAP(CWhiteBalanceView)
    CHAIN_MSG_MAP(CDialogView<CWhiteBalanceView>)
    CHAIN_MSG_MAP_MEMBER(m_EditCtrlU);
    CHAIN_MSG_MAP_MEMBER(m_EditCtrlV);
    MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
    COMMAND_HANDLER(IDC_EDITVALUEU, EN_UPDATE, OnValueChanged)
    COMMAND_HANDLER(IDC_EDITVALUEV, EN_UPDATE, OnValueChanged)
    MESSAGE_HANDLER(WM_ENABLE, OnEnable)
  END_MSG_MAP()
    
  // Message handlers
  
  LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
  LRESULT OnEnable(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  LRESULT OnValueChanged(WPARAM uNotifyCode, WPARAM wID, HWND hWndCtrl, BOOL& bHandled);
  
  virtual HWND hWnd() { return m_hWnd; }
  
  void SetUBValue(long ub);
  void SetVRValue(long vr);
  
  void PostMsgEnable(bool enable);
  
private:
  void InitControl();
  void RefreshControl();
  virtual void OnConfigurationChanged(DCSVideoFormat Format, DCSVideoMode Mode, DCSVideoFrameRate Framerate, DCSColorCode Code);
  
  CTBarEditCtrlInt m_EditCtrlU;   
  CTBarEditCtrlInt m_EditCtrlV;
};

//------------------------------------------------------------------------------
// class CBytePerPacketView
// Author: 
// Date: 20.09.2002
//------------------------------------------------------------------------------
/**
 * \brief   View to adjust the bandwith ( byte per packet value)
 */
//------------------------------------------------------------------------------
class CBytePerPacketView : public CCameraFeatureViewBase,
public CDialogView<CBytePerPacketView>
{
public:
  enum { IDD = IDD_CAMERAFEATUREVIEW };
  
  BEGIN_MSG_MAP(CBytePerPacketView)
    CHAIN_MSG_MAP(CDialogView<CBytePerPacketView>)
    CHAIN_MSG_MAP_MEMBER(m_EditCtrl);
    MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
    COMMAND_HANDLER(IDC_EDITVALUE, EN_UPDATE, OnValueChanged)
    MESSAGE_HANDLER(WM_ENABLE, OnEnable)
  END_MSG_MAP()
    
  // Message handlers
  LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
  LRESULT OnEnable(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  LRESULT OnValueChanged(WPARAM uNotifyCode, WPARAM wID, HWND hWndCtrl, BOOL& bHandled);
  
  
  /// constructor
  CBytePerPacketView(CMainFrame& MainFrame) : CCameraFeatureViewBase(FeatureID_Bandwidth, MainFrame)
  { }
  
  
  virtual HWND hWnd() { return m_hWnd; }
  
private:
  // private member functions
  
  virtual void OnConfigurationChanged(DCSVideoFormat Format, DCSVideoMode Mode, DCSVideoFrameRate Framerate, DCSColorCode Code);  void InitControl();
  
  void RefreshControl();
  
  // member variables
  
  /// combined edit and slider control 
  CTBarEditCtrlInt m_EditCtrl;   
  int              m_Inc;
  int              m_Min;
  int              m_Max;
  
};
#endif // !defined(AFX_CAMERAFEATURE_H__682FA684_7D03_11D5_920E_0090278E5E96__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -