// +-------------------------------- DISCLAIMER ---------------------------------+
// |                                                                             |
// | This program is provided to you free of charge "as such".                   |
// | You should not assume that this program is error-free or suitable for any   |
// | purpose whatsoever.                                                         |
// |                                                                             |
// | EURESYS does not give any representation, warranty or undertaking that this |
// | program is free of any defect or error or suitable for any purpose. EURESYS |
// | shall not be liable, in contract, in torts or otherwise, for any damages,   |
// | loss, costs, expenses or other claims for compensation, including those     |
// | asserted by third parties, arising out of or in connection with the use of  |
// | this program.                                                               |
// +-----------------------------------------------------------------------------+

#pragma once

class C3DObjectExtractionDlg;

// C2DView control
class C2DView : public CStatic
{
public:
  C2DView();
  ~C2DView();

protected:
  DECLARE_MESSAGE_MAP()
  afx_msg void OnRButtonDown(UINT nflags, CPoint point);
  afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint point);
  afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  afx_msg LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);
  afx_msg void OnMove(int x, int y);
  afx_msg void OnPaint();

public:
  void SetImage(const EImageBW8& image);
  void SetDepthMap(Easy3D::EDepthMap* map);
  void SetZMap(Easy3D::EZMap* map);
  void SetObjectList(const std::vector<Easy3D::E3DObject>& object_list);

protected:
  // Input
  EImageBW8 m_Image;
  int m_ImageWidth;
  int m_ImageHeight;

  // Optional 3D object list
  std::vector<Easy3D::E3DObject> m_ObjList;

  // Context
  CRect m_ViewRect;
  float m_ZoomFactor;
  int m_OrgX;
  int m_OrgY;
  CPoint m_DragOrigin;
  CPoint m_DragOffset;
  bool m_Dragging;
  bool m_TrackLeave;
};
